diff -Nru libsdl2-2.0.22+dfsg/acinclude/ax_compute_relative_paths.m4 libsdl2-2.24.0+dfsg/acinclude/ax_compute_relative_paths.m4 --- libsdl2-2.0.22+dfsg/acinclude/ax_compute_relative_paths.m4 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/acinclude/ax_compute_relative_paths.m4 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,173 @@ +# ============================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_compute_relative_paths.html +# ============================================================================== +# +# SYNOPSIS +# +# AX_COMPUTE_RELATIVE_PATHS(PATH_LIST) +# +# DESCRIPTION +# +# PATH_LIST is a space-separated list of colon-separated triplets of the +# form 'FROM:TO:RESULT'. This function iterates over these triplets and +# set $RESULT to the relative path from $FROM to $TO. Note that $FROM and +# $TO needs to be absolute filenames for this macro to success. +# +# For instance, +# +# first=/usr/local/bin +# second=/usr/local/share +# AX_COMPUTE_RELATIVE_PATHS([first:second:fs second:first:sf]) +# # $fs is set to ../share +# # $sf is set to ../bin +# +# $FROM and $TO are both eval'ed recursively and normalized, this means +# that you can call this macro with autoconf's dirnames like `prefix' or +# `datadir'. For example: +# +# AX_COMPUTE_RELATIVE_PATHS([bindir:datadir:bin_to_data]) +# +# AX_COMPUTE_RELATIVE_PATHS should also works with DOS filenames. +# +# You may want to use this macro in order to make your package +# relocatable. Instead of hardcoding $datadir into your programs just +# encode $bin_to_data and try to determine $bindir at run-time. +# +# This macro requires AX_NORMALIZE_PATH and AX_RECURSIVE_EVAL. +# +# LICENSE +# +# Copyright (c) 2008 Alexandre Duret-Lutz +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 12 + +AU_ALIAS([ADL_COMPUTE_RELATIVE_PATHS], [AX_COMPUTE_RELATIVE_PATHS]) +AC_DEFUN([AX_COMPUTE_RELATIVE_PATHS], +[for _lcl_i in $1; do + _lcl_from=\[$]`echo "[$]_lcl_i" | sed 's,:.*$,,'` + _lcl_to=\[$]`echo "[$]_lcl_i" | sed 's,^[[^:]]*:,,' | sed 's,:[[^:]]*$,,'` + _lcl_result_var=`echo "[$]_lcl_i" | sed 's,^.*:,,'` + AX_RECURSIVE_EVAL([[$]_lcl_from], [_lcl_from]) + AX_RECURSIVE_EVAL([[$]_lcl_to], [_lcl_to]) + _lcl_notation="$_lcl_from$_lcl_to" + AX_NORMALIZE_PATH([_lcl_from],['/']) + AX_NORMALIZE_PATH([_lcl_to],['/']) + AX_COMPUTE_RELATIVE_PATH([_lcl_from], [_lcl_to], [_lcl_result_tmp]) + AX_NORMALIZE_PATH([_lcl_result_tmp],["[$]_lcl_notation"]) + eval $_lcl_result_var='[$]_lcl_result_tmp' +done]) + +## Note: +## ***** +## The following helper macros are too fragile to be used out +## of AX_COMPUTE_RELATIVE_PATHS (mainly because they assume that +## paths are normalized), that's why I'm keeping them in the same file. +## Still, some of them maybe worth to reuse. + +dnl AX_COMPUTE_RELATIVE_PATH(FROM, TO, RESULT) +dnl =========================================== +dnl Compute the relative path to go from $FROM to $TO and set the value +dnl of $RESULT to that value. This function work on raw filenames +dnl (for instead it will considerate /usr//local and /usr/local as +dnl two distinct paths), you should really use AX_COMPUTE_RELATIVE_PATHS +dnl instead to have the paths sanitized automatically. +dnl +dnl For instance: +dnl first_dir=/somewhere/on/my/disk/bin +dnl second_dir=/somewhere/on/another/disk/share +dnl AX_COMPUTE_RELATIVE_PATH(first_dir, second_dir, first_to_second) +dnl will set $first_to_second to '../../../another/disk/share'. +AC_DEFUN([AX_COMPUTE_RELATIVE_PATH], +[AX_COMPUTE_COMMON_PATH([$1], [$2], [_lcl_common_prefix]) +AX_COMPUTE_BACK_PATH([$1], [_lcl_common_prefix], [_lcl_first_rel]) +AX_COMPUTE_SUFFIX_PATH([$2], [_lcl_common_prefix], [_lcl_second_suffix]) +$3="[$]_lcl_first_rel[$]_lcl_second_suffix"]) + +dnl AX_COMPUTE_COMMON_PATH(LEFT, RIGHT, RESULT) +dnl ============================================ +dnl Compute the common path to $LEFT and $RIGHT and set the result to $RESULT. +dnl +dnl For instance: +dnl first_path=/somewhere/on/my/disk/bin +dnl second_path=/somewhere/on/another/disk/share +dnl AX_COMPUTE_COMMON_PATH(first_path, second_path, common_path) +dnl will set $common_path to '/somewhere/on'. +AC_DEFUN([AX_COMPUTE_COMMON_PATH], +[$3='' +_lcl_second_prefix_match='' +while test "[$]_lcl_second_prefix_match" != 0; do + _lcl_first_prefix=`expr "x[$]$1" : "x\([$]$3/*[[^/]]*\)"` + _lcl_second_prefix_match=`expr "x[$]$2" : "x[$]_lcl_first_prefix"` + if test "[$]_lcl_second_prefix_match" != 0; then + if test "[$]_lcl_first_prefix" != "[$]$3"; then + $3="[$]_lcl_first_prefix" + else + _lcl_second_prefix_match=0 + fi + fi +done]) + +dnl AX_COMPUTE_SUFFIX_PATH(PATH, SUBPATH, RESULT) +dnl ============================================== +dnl Subtract $SUBPATH from $PATH, and set the resulting suffix +dnl (or the empty string if $SUBPATH is not a subpath of $PATH) +dnl to $RESULT. +dnl +dnl For instance: +dnl first_path=/somewhere/on/my/disk/bin +dnl second_path=/somewhere/on +dnl AX_COMPUTE_SUFFIX_PATH(first_path, second_path, common_path) +dnl will set $common_path to '/my/disk/bin'. +AC_DEFUN([AX_COMPUTE_SUFFIX_PATH], +[$3=`expr "x[$]$1" : "x[$]$2/*\(.*\)"`]) + +dnl AX_COMPUTE_BACK_PATH(PATH, SUBPATH, RESULT) +dnl ============================================ +dnl Compute the relative path to go from $PATH to $SUBPATH, knowing that +dnl $SUBPATH is a subpath of $PATH (any other words, only repeated '../' +dnl should be needed to move from $PATH to $SUBPATH) and set the value +dnl of $RESULT to that value. If $SUBPATH is not a subpath of PATH, +dnl set $RESULT to the empty string. +dnl +dnl For instance: +dnl first_path=/somewhere/on/my/disk/bin +dnl second_path=/somewhere/on +dnl AX_COMPUTE_BACK_PATH(first_path, second_path, back_path) +dnl will set $back_path to '../../../'. +AC_DEFUN([AX_COMPUTE_BACK_PATH], +[AX_COMPUTE_SUFFIX_PATH([$1], [$2], [_lcl_first_suffix]) +$3='' +_lcl_tmp='xxx' +while test "[$]_lcl_tmp" != ''; do + _lcl_tmp=`expr "x[$]_lcl_first_suffix" : "x[[^/]]*/*\(.*\)"` + if test "[$]_lcl_first_suffix" != ''; then + _lcl_first_suffix="[$]_lcl_tmp" + $3="../[$]$3" + fi +done]) diff -Nru libsdl2-2.0.22+dfsg/acinclude/ax_normalize_path.m4 libsdl2-2.24.0+dfsg/acinclude/ax_normalize_path.m4 --- libsdl2-2.0.22+dfsg/acinclude/ax_normalize_path.m4 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/acinclude/ax_normalize_path.m4 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,115 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_normalize_path.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_NORMALIZE_PATH(VARNAME, [REFERENCE_STRING]) +# +# DESCRIPTION +# +# Perform some cleanups on the value of $VARNAME (interpreted as a path): +# +# - empty paths are changed to '.' +# - trailing slashes are removed +# - repeated slashes are squeezed except a leading doubled slash '//' +# (which might indicate a networked disk on some OS). +# +# REFERENCE_STRING is used to turn '/' into '\' and vice-versa: if +# REFERENCE_STRING contains some backslashes, all slashes and backslashes +# are turned into backslashes, otherwise they are all turned into slashes. +# +# This makes processing of DOS filenames quite easier, because you can +# turn a filename to the Unix notation, make your processing, and turn it +# back to original notation. +# +# filename='A:\FOO\\BAR\' +# old_filename="$filename" +# # Switch to the unix notation +# AX_NORMALIZE_PATH([filename], ["/"]) +# # now we have $filename = 'A:/FOO/BAR' and we can process it as if +# # it was a Unix path. For instance let's say that you want +# # to append '/subpath': +# filename="$filename/subpath" +# # finally switch back to the original notation +# AX_NORMALIZE_PATH([filename], ["$old_filename"]) +# # now $filename equals to 'A:\FOO\BAR\subpath' +# +# One good reason to make all path processing with the unix convention is +# that backslashes have a special meaning in many cases. For instance +# +# expr 'A:\FOO' : 'A:\Foo' +# +# will return 0 because the second argument is a regex in which +# backslashes have to be backslashed. In other words, to have the two +# strings to match you should write this instead: +# +# expr 'A:\Foo' : 'A:\\Foo' +# +# Such behavior makes DOS filenames extremely unpleasant to work with. So +# temporary turn your paths to the Unix notation, and revert them to the +# original notation after the processing. See the macro +# AX_COMPUTE_RELATIVE_PATHS for a concrete example of this. +# +# REFERENCE_STRING defaults to $VARIABLE, this means that slashes will be +# converted to backslashes if $VARIABLE already contains some backslashes +# (see $thirddir below). +# +# firstdir='/usr/local//share' +# seconddir='C:\Program Files\\' +# thirddir='C:\home/usr/' +# AX_NORMALIZE_PATH([firstdir]) +# AX_NORMALIZE_PATH([seconddir]) +# AX_NORMALIZE_PATH([thirddir]) +# # $firstdir = '/usr/local/share' +# # $seconddir = 'C:\Program Files' +# # $thirddir = 'C:\home\usr' +# +# LICENSE +# +# Copyright (c) 2008 Alexandre Duret-Lutz +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 8 + +AU_ALIAS([ADL_NORMALIZE_PATH], [AX_NORMALIZE_PATH]) +AC_DEFUN([AX_NORMALIZE_PATH], +[case ":[$]$1:" in +# change empty paths to '.' + ::) $1='.' ;; +# strip trailing slashes + :*[[\\/]]:) $1=`echo "[$]$1" | sed 's,[[\\/]]*[$],,'` ;; + :*:) ;; +esac +# squeeze repeated slashes +case ifelse($2,,"[$]$1",$2) in +# if the path contains any backslashes, turn slashes into backslashes + *\\*) $1=`echo "[$]$1" | sed 's,\(.\)[[\\/]][[\\/]]*,\1\\\\,g'` ;; +# if the path contains slashes, also turn backslashes into slashes + *) $1=`echo "[$]$1" | sed 's,\(.\)[[\\/]][[\\/]]*,\1/,g'` ;; +esac]) diff -Nru libsdl2-2.0.22+dfsg/acinclude/ax_recursive_eval.m4 libsdl2-2.24.0+dfsg/acinclude/ax_recursive_eval.m4 --- libsdl2-2.0.22+dfsg/acinclude/ax_recursive_eval.m4 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/acinclude/ax_recursive_eval.m4 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,56 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_recursive_eval.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_RECURSIVE_EVAL(VALUE, RESULT) +# +# DESCRIPTION +# +# Interpolate the VALUE in loop until it doesn't change, and set the +# result to $RESULT. WARNING: It's easy to get an infinite loop with some +# unsane input. +# +# LICENSE +# +# Copyright (c) 2008 Alexandre Duret-Lutz +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 1 + +AC_DEFUN([AX_RECURSIVE_EVAL], +[_lcl_receval="$1" +$2=`(test "x$prefix" = xNONE && prefix="$ac_default_prefix" + test "x$exec_prefix" = xNONE && exec_prefix="${prefix}" + _lcl_receval_old='' + while test "[$]_lcl_receval_old" != "[$]_lcl_receval"; do + _lcl_receval_old="[$]_lcl_receval" + eval _lcl_receval="\"[$]_lcl_receval\"" + done + echo "[$]_lcl_receval")`]) diff -Nru libsdl2-2.0.22+dfsg/autogen.sh libsdl2-2.24.0+dfsg/autogen.sh --- libsdl2-2.0.22+dfsg/autogen.sh 2021-07-27 14:52:29.000000000 +0000 +++ libsdl2-2.24.0+dfsg/autogen.sh 2022-06-02 02:01:57.000000000 +0000 @@ -1,5 +1,7 @@ #!/bin/sh +set -e + echo "Generating build information using autoconf" echo "This may take a while ..." @@ -10,11 +12,7 @@ # Regenerate configuration files cat acinclude/* >aclocal.m4 -if test "$AUTOCONF"x = x; then - AUTOCONF=autoconf -fi - -$AUTOCONF || exit 1 +"${AUTOCONF:-autoconf}" rm aclocal.m4 rm -rf autom4te.cache diff -Nru libsdl2-2.0.22+dfsg/build-scripts/androidbuildlibs.sh libsdl2-2.24.0+dfsg/build-scripts/androidbuildlibs.sh --- libsdl2-2.0.22+dfsg/build-scripts/androidbuildlibs.sh 2021-07-27 14:52:29.000000000 +0000 +++ libsdl2-2.24.0+dfsg/build-scripts/androidbuildlibs.sh 2022-06-02 02:01:57.000000000 +0000 @@ -33,22 +33,21 @@ ndk_args= # Allow an external caller to specify locations. -for arg in $* -do - if [ "${arg:0:8}" == "NDK_OUT=" ]; then - obj=${arg#NDK_OUT=} - elif [ "${arg:0:13}" == "NDK_LIBS_OUT=" ]; then - lib=${arg#NDK_LIBS_OUT=} - else - ndk_args="$ndk_args $arg" - fi +for arg in $*; do + if [ "${arg:0:8}" == "NDK_OUT=" ]; then + obj=${arg#NDK_OUT=} + elif [ "${arg:0:13}" == "NDK_LIBS_OUT=" ]; then + lib=${arg#NDK_LIBS_OUT=} + else + ndk_args="$ndk_args $arg" + fi done if [ -z $obj ]; then - obj=$buildandroid/obj + obj=$buildandroid/obj fi if [ -z $lib ]; then - lib=$buildandroid/lib + lib=$buildandroid/lib fi for dir in $build $buildandroid $obj $lib; do @@ -64,11 +63,11 @@ # ndk-build makefile segments that use them, e.g., default-application.mk. # For consistency, pass all values on the command line. ndk-build \ - NDK_PROJECT_PATH=null \ - NDK_OUT=$obj \ - NDK_LIBS_OUT=$lib \ - APP_BUILD_SCRIPT=Android.mk \ - APP_ABI="armeabi-v7a arm64-v8a x86 x86_64" \ - APP_PLATFORM=android-16 \ - APP_MODULES="SDL2 SDL2_main" \ - $ndk_args + NDK_PROJECT_PATH=null \ + NDK_OUT=$obj \ + NDK_LIBS_OUT=$lib \ + APP_BUILD_SCRIPT=Android.mk \ + APP_ABI="armeabi-v7a arm64-v8a x86 x86_64" \ + APP_PLATFORM=android-16 \ + APP_MODULES="SDL2 SDL2_main" \ + $ndk_args diff -Nru libsdl2-2.0.22+dfsg/build-scripts/clang-fat.sh libsdl2-2.24.0+dfsg/build-scripts/clang-fat.sh --- libsdl2-2.0.22+dfsg/build-scripts/clang-fat.sh 2021-07-27 14:52:29.000000000 +0000 +++ libsdl2-2.24.0+dfsg/build-scripts/clang-fat.sh 2022-08-13 03:48:10.000000000 +0000 @@ -6,12 +6,12 @@ DEVELOPER="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer" -# Intel 64-bit compiler flags (10.6 runtime compatibility) -CLANG_COMPILE_X64="clang -arch x86_64 -mmacosx-version-min=10.6 \ --DMAC_OS_X_VERSION_MIN_REQUIRED=1060 \ +# Intel 64-bit compiler flags (10.9 runtime compatibility) +CLANG_COMPILE_X64="clang -arch x86_64 -mmacosx-version-min=10.9 \ +-DMAC_OS_X_VERSION_MIN_REQUIRED=1070 \ -I/usr/local/include" -CLANG_LINK_X64="-mmacosx-version-min=10.6" +CLANG_LINK_X64="-mmacosx-version-min=10.9" # ARM 64-bit compiler flags (11.0 runtime compatibility) CLANG_COMPILE_ARM64="clang -arch arm64 -mmacosx-version-min=11.0 \ diff -Nru libsdl2-2.0.22+dfsg/build-scripts/clang++-fat.sh libsdl2-2.24.0+dfsg/build-scripts/clang++-fat.sh --- libsdl2-2.0.22+dfsg/build-scripts/clang++-fat.sh 2021-07-27 14:52:29.000000000 +0000 +++ libsdl2-2.24.0+dfsg/build-scripts/clang++-fat.sh 2022-06-02 02:01:57.000000000 +0000 @@ -6,11 +6,11 @@ DEVELOPER="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer" -# Intel 64-bit compiler flags (10.6 runtime compatibility) -CLANG_COMPILE_X64="clang++ -arch x86_64 -mmacosx-version-min=10.6 \ +# Intel 64-bit compiler flags (10.7 runtime compatibility) +CLANG_COMPILE_X64="clang++ -arch x86_64 -mmacosx-version-min=10.7 \ -I/usr/local/include" -CLANG_LINK_X64="-mmacosx-version-min=10.6" +CLANG_LINK_X64="-mmacosx-version-min=10.7" # ARM 64-bit compiler flags (11.0 runtime compatibility) CLANG_COMPILE_ARM64="clang++ -arch arm64 -mmacosx-version-min=11.0 \ diff -Nru libsdl2-2.0.22+dfsg/build-scripts/config.guess libsdl2-2.24.0+dfsg/build-scripts/config.guess --- libsdl2-2.0.22+dfsg/build-scripts/config.guess 2022-01-08 21:13:56.000000000 +0000 +++ libsdl2-2.24.0+dfsg/build-scripts/config.guess 2022-06-02 02:01:57.000000000 +0000 @@ -4,7 +4,7 @@ # shellcheck disable=SC2006,SC2268 # see below for rationale -timestamp='2022-01-03' +timestamp='2022-05-25' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -929,6 +929,9 @@ i*:PW*:*) GUESS=$UNAME_MACHINE-pc-pw32 ;; + *:SerenityOS:*:*) + GUESS=$UNAME_MACHINE-pc-serenity + ;; *:Interix*:*) case $UNAME_MACHINE in x86) @@ -1148,16 +1151,27 @@ ;; x86_64:Linux:*:*) set_cc_for_build + CPU=$UNAME_MACHINE LIBCABI=$LIBC if test "$CC_FOR_BUILD" != no_compiler_found; then - if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_X32 >/dev/null - then - LIBCABI=${LIBC}x32 - fi + ABI=64 + sed 's/^ //' << EOF > "$dummy.c" + #ifdef __i386__ + ABI=x86 + #else + #ifdef __ILP32__ + ABI=x32 + #endif + #endif +EOF + cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` + eval "$cc_set_abi" + case $ABI in + x86) CPU=i686 ;; + x32) LIBCABI=${LIBC}x32 ;; + esac fi - GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI + GUESS=$CPU-pc-linux-$LIBCABI ;; xtensa*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC @@ -1364,8 +1378,11 @@ BePC:Haiku:*:*) # Haiku running on Intel PC compatible. GUESS=i586-pc-haiku ;; - x86_64:Haiku:*:*) - GUESS=x86_64-unknown-haiku + ppc:Haiku:*:*) # Haiku running on Apple PowerPC + GUESS=powerpc-apple-haiku + ;; + *:Haiku:*:*) # Haiku modern gcc (not bound by BeOS compat) + GUESS=$UNAME_MACHINE-unknown-haiku ;; SX-4:SUPER-UX:*:*) GUESS=sx4-nec-superux$UNAME_RELEASE diff -Nru libsdl2-2.0.22+dfsg/build-scripts/emscripten-buildbot.sh libsdl2-2.24.0+dfsg/build-scripts/emscripten-buildbot.sh --- libsdl2-2.0.22+dfsg/build-scripts/emscripten-buildbot.sh 2021-07-27 14:52:29.000000000 +0000 +++ libsdl2-2.24.0+dfsg/build-scripts/emscripten-buildbot.sh 2022-08-19 15:46:21.000000000 +0000 @@ -55,7 +55,7 @@ pushd buildbot echo "Configuring..." -emconfigure ../configure --host=wasm32-unknown-emscripten --disable-assembly --disable-threads --disable-cpuinfo CFLAGS="-O2 -Wno-warn-absolute-paths -Wdeclaration-after-statement -Werror=declaration-after-statement" --prefix="$PWD/emscripten-sdl2-installed" || exit $? +emconfigure ../configure --host=wasm32-unknown-emscripten --disable-assembly --disable-threads --disable-cpuinfo CFLAGS="-s USE_SDL=0 -O2 -Wno-warn-absolute-paths -Wdeclaration-after-statement -Werror=declaration-after-statement" --prefix="$PWD/emscripten-sdl2-installed" || exit $? echo "Building..." emmake $MAKE || exit $? diff -Nru libsdl2-2.0.22+dfsg/build-scripts/fnsince.pl libsdl2-2.24.0+dfsg/build-scripts/fnsince.pl --- libsdl2-2.0.22+dfsg/build-scripts/fnsince.pl 2021-11-26 16:03:45.000000000 +0000 +++ libsdl2-2.24.0+dfsg/build-scripts/fnsince.pl 2022-06-02 02:01:57.000000000 +0000 @@ -46,9 +46,15 @@ # this happens to work for how SDL versions things at the moment. my $current_release = $releases[-1]; -my @current_release_segments = split /\./, $current_release; -@current_release_segments[2] = '' . ($current_release_segments[2] + 2); -my $next_release = join('.', @current_release_segments); +my $next_release; + +if ($current_release eq '2.0.22') { # Hack for our jump from 2.0.22 to 2.24.0... + $next_release = '2.24.0'; +} else { + my @current_release_segments = split /\./, $current_release; + @current_release_segments[1] = '' . ($current_release_segments[1] + 2); + $next_release = join('.', @current_release_segments); +} #print("\n\nSORTED\n"); #foreach (@releases) { diff -Nru libsdl2-2.0.22+dfsg/build-scripts/gen_audio_channel_conversion.c libsdl2-2.24.0+dfsg/build-scripts/gen_audio_channel_conversion.c --- libsdl2-2.0.22+dfsg/build-scripts/gen_audio_channel_conversion.c 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/build-scripts/gen_audio_channel_conversion.c 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,450 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include + +/* + +Built with: + +gcc -o genchancvt build-scripts/gen_audio_channel_conversion.c -lm && ./genchancvt > src/audio/SDL_audio_channel_converters.h + +*/ + +#define NUM_CHANNELS 8 + +static const char *layout_names[NUM_CHANNELS] = { + "Mono", "Stereo", "2.1", "Quad", "4.1", "5.1", "6.1", "7.1" +}; + +static const char *channel_names[NUM_CHANNELS][NUM_CHANNELS] = { + /* mono */ { "FC" }, + /* stereo */ { "FL", "FR" }, + /* 2.1 */ { "FL", "FR", "LFE" }, + /* quad */ { "FL", "FR", "BL", "BR" }, + /* 4.1 */ { "FL", "FR", "LFE", "BL", "BR" }, + /* 5.1 */ { "FL", "FR", "FC", "LFE", "BL", "BR" }, + /* 6.1 */ { "FL", "FR", "FC", "LFE", "BC", "SL", "SR" }, + /* 7.1 */ { "FL", "FR", "FC", "LFE", "BL", "BR", "SL", "SR" }, +}; + + +/* + * This table is from FAudio: + * + * https://raw.githubusercontent.com/FNA-XNA/FAudio/master/src/matrix_defaults.inl + */ +static const float channel_conversion_matrix[8][8][64] = { +{ + /* 1 x 1 */ + { 1.000000000f }, + /* 1 x 2 */ + { 1.000000000f, 1.000000000f }, + /* 1 x 3 */ + { 1.000000000f, 1.000000000f, 0.000000000f }, + /* 1 x 4 */ + { 1.000000000f, 1.000000000f, 0.000000000f, 0.000000000f }, + /* 1 x 5 */ + { 1.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f }, + /* 1 x 6 */ + { 1.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f }, + /* 1 x 7 */ + { 1.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f }, + /* 1 x 8 */ + { 1.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f } +}, +{ + /* 2 x 1 */ + { 0.500000000f, 0.500000000f }, + /* 2 x 2 */ + { 1.000000000f, 0.000000000f, 0.000000000f, 1.000000000f }, + /* 2 x 3 */ + { 1.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f }, + /* 2 x 4 */ + { 1.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f }, + /* 2 x 5 */ + { 1.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f }, + /* 2 x 6 */ + { 1.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f }, + /* 2 x 7 */ + { 1.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f }, + /* 2 x 8 */ + { 1.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f } +}, +{ + /* 3 x 1 */ + { 0.333333343f, 0.333333343f, 0.333333343f }, + /* 3 x 2 */ + { 0.800000012f, 0.000000000f, 0.200000003f, 0.000000000f, 0.800000012f, 0.200000003f }, + /* 3 x 3 */ + { 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f }, + /* 3 x 4 */ + { 0.888888896f, 0.000000000f, 0.111111112f, 0.000000000f, 0.888888896f, 0.111111112f, 0.000000000f, 0.000000000f, 0.111111112f, 0.000000000f, 0.000000000f, 0.111111112f }, + /* 3 x 5 */ + { 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f }, + /* 3 x 6 */ + { 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f }, + /* 3 x 7 */ + { 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f }, + /* 3 x 8 */ + { 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f } +}, +{ + /* 4 x 1 */ + { 0.250000000f, 0.250000000f, 0.250000000f, 0.250000000f }, + /* 4 x 2 */ + { 0.421000004f, 0.000000000f, 0.358999997f, 0.219999999f, 0.000000000f, 0.421000004f, 0.219999999f, 0.358999997f }, + /* 4 x 3 */ + { 0.421000004f, 0.000000000f, 0.358999997f, 0.219999999f, 0.000000000f, 0.421000004f, 0.219999999f, 0.358999997f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f }, + /* 4 x 4 */ + { 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f }, + /* 4 x 5 */ + { 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f }, + /* 4 x 6 */ + { 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f }, + /* 4 x 7 */ + { 0.939999998f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.939999998f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.500000000f, 0.500000000f, 0.000000000f, 0.000000000f, 0.796000004f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.796000004f }, + /* 4 x 8 */ + { 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f } +}, +{ + /* 5 x 1 */ + { 0.200000003f, 0.200000003f, 0.200000003f, 0.200000003f, 0.200000003f }, + /* 5 x 2 */ + { 0.374222219f, 0.000000000f, 0.111111112f, 0.319111109f, 0.195555553f, 0.000000000f, 0.374222219f, 0.111111112f, 0.195555553f, 0.319111109f }, + /* 5 x 3 */ + { 0.421000004f, 0.000000000f, 0.000000000f, 0.358999997f, 0.219999999f, 0.000000000f, 0.421000004f, 0.000000000f, 0.219999999f, 0.358999997f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f }, + /* 5 x 4 */ + { 0.941176474f, 0.000000000f, 0.058823530f, 0.000000000f, 0.000000000f, 0.000000000f, 0.941176474f, 0.058823530f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.058823530f, 0.941176474f, 0.000000000f, 0.000000000f, 0.000000000f, 0.058823530f, 0.000000000f, 0.941176474f }, + /* 5 x 5 */ + { 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f }, + /* 5 x 6 */ + { 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f }, + /* 5 x 7 */ + { 0.939999998f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.939999998f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.500000000f, 0.500000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.796000004f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.796000004f }, + /* 5 x 8 */ + { 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f } +}, +{ + /* 6 x 1 */ + { 0.166666672f, 0.166666672f, 0.166666672f, 0.166666672f, 0.166666672f, 0.166666672f }, + /* 6 x 2 */ + { 0.294545442f, 0.000000000f, 0.208181813f, 0.090909094f, 0.251818180f, 0.154545456f, 0.000000000f, 0.294545442f, 0.208181813f, 0.090909094f, 0.154545456f, 0.251818180f }, + /* 6 x 3 */ + { 0.324000001f, 0.000000000f, 0.229000002f, 0.000000000f, 0.277000010f, 0.170000002f, 0.000000000f, 0.324000001f, 0.229000002f, 0.000000000f, 0.170000002f, 0.277000010f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f }, + /* 6 x 4 */ + { 0.558095276f, 0.000000000f, 0.394285709f, 0.047619049f, 0.000000000f, 0.000000000f, 0.000000000f, 0.558095276f, 0.394285709f, 0.047619049f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.047619049f, 0.558095276f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.047619049f, 0.000000000f, 0.558095276f }, + /* 6 x 5 */ + { 0.586000025f, 0.000000000f, 0.414000005f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.586000025f, 0.414000005f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.586000025f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.586000025f }, + /* 6 x 6 */ + { 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f }, + /* 6 x 7 */ + { 0.939999998f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.939999998f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.939999998f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.500000000f, 0.500000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.796000004f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.796000004f }, + /* 6 x 8 */ + { 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f } +}, +{ + /* 7 x 1 */ + { 0.143142849f, 0.143142849f, 0.143142849f, 0.142857149f, 0.143142849f, 0.143142849f, 0.143142849f }, + /* 7 x 2 */ + { 0.247384623f, 0.000000000f, 0.174461529f, 0.076923080f, 0.174461529f, 0.226153851f, 0.100615382f, 0.000000000f, 0.247384623f, 0.174461529f, 0.076923080f, 0.174461529f, 0.100615382f, 0.226153851f }, + /* 7 x 3 */ + { 0.268000007f, 0.000000000f, 0.188999996f, 0.000000000f, 0.188999996f, 0.245000005f, 0.108999997f, 0.000000000f, 0.268000007f, 0.188999996f, 0.000000000f, 0.188999996f, 0.108999997f, 0.245000005f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f }, + /* 7 x 4 */ + { 0.463679999f, 0.000000000f, 0.327360004f, 0.040000003f, 0.000000000f, 0.168960005f, 0.000000000f, 0.000000000f, 0.463679999f, 0.327360004f, 0.040000003f, 0.000000000f, 0.000000000f, 0.168960005f, 0.000000000f, 0.000000000f, 0.000000000f, 0.040000003f, 0.327360004f, 0.431039989f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.040000003f, 0.327360004f, 0.000000000f, 0.431039989f }, + /* 7 x 5 */ + { 0.483000010f, 0.000000000f, 0.340999991f, 0.000000000f, 0.000000000f, 0.175999999f, 0.000000000f, 0.000000000f, 0.483000010f, 0.340999991f, 0.000000000f, 0.000000000f, 0.000000000f, 0.175999999f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.340999991f, 0.449000001f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.340999991f, 0.000000000f, 0.449000001f }, + /* 7 x 6 */ + { 0.611000001f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.223000005f, 0.000000000f, 0.000000000f, 0.611000001f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.223000005f, 0.000000000f, 0.000000000f, 0.611000001f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.432000011f, 0.568000019f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.432000011f, 0.000000000f, 0.568000019f }, + /* 7 x 7 */ + { 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f }, + /* 7 x 8 */ + { 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.707000017f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.707000017f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f } +}, +{ + /* 8 x 1 */ + { 0.125125006f, 0.125125006f, 0.125125006f, 0.125000000f, 0.125125006f, 0.125125006f, 0.125125006f, 0.125125006f }, + /* 8 x 2 */ + { 0.211866662f, 0.000000000f, 0.150266662f, 0.066666670f, 0.181066677f, 0.111066669f, 0.194133341f, 0.085866667f, 0.000000000f, 0.211866662f, 0.150266662f, 0.066666670f, 0.111066669f, 0.181066677f, 0.085866667f, 0.194133341f }, + /* 8 x 3 */ + { 0.226999998f, 0.000000000f, 0.160999998f, 0.000000000f, 0.194000006f, 0.119000003f, 0.208000004f, 0.092000000f, 0.000000000f, 0.226999998f, 0.160999998f, 0.000000000f, 0.119000003f, 0.194000006f, 0.092000000f, 0.208000004f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f }, + /* 8 x 4 */ + { 0.466344833f, 0.000000000f, 0.329241365f, 0.034482758f, 0.000000000f, 0.000000000f, 0.169931039f, 0.000000000f, 0.000000000f, 0.466344833f, 0.329241365f, 0.034482758f, 0.000000000f, 0.000000000f, 0.000000000f, 0.169931039f, 0.000000000f, 0.000000000f, 0.000000000f, 0.034482758f, 0.466344833f, 0.000000000f, 0.433517247f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.034482758f, 0.000000000f, 0.466344833f, 0.000000000f, 0.433517247f }, + /* 8 x 5 */ + { 0.483000010f, 0.000000000f, 0.340999991f, 0.000000000f, 0.000000000f, 0.000000000f, 0.175999999f, 0.000000000f, 0.000000000f, 0.483000010f, 0.340999991f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.175999999f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.483000010f, 0.000000000f, 0.449000001f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.483000010f, 0.000000000f, 0.449000001f }, + /* 8 x 6 */ + { 0.518000007f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.188999996f, 0.000000000f, 0.000000000f, 0.518000007f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.188999996f, 0.000000000f, 0.000000000f, 0.518000007f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.518000007f, 0.000000000f, 0.481999993f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.518000007f, 0.000000000f, 0.481999993f }, + /* 8 x 7 */ + { 0.541000009f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.541000009f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.541000009f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.287999988f, 0.287999988f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.458999991f, 0.000000000f, 0.541000009f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.458999991f, 0.000000000f, 0.541000009f }, + /* 8 x 8 */ + { 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f } +} +}; + +static char *remove_dots(const char *str) /* this is NOT robust. */ +{ + static char retval1[32]; + static char retval2[32]; + static int idx = 0; + char *retval = (idx++ & 1) ? retval1 : retval2; + char *ptr = retval; + while (*str) { + if (*str != '.') { + *(ptr++) = *str; + } + str++; + } + *ptr = '\0'; + return retval; +} + +static char *lowercase(const char *str) /* this is NOT robust. */ +{ + static char retval1[32]; + static char retval2[32]; + static int idx = 0; + char *retval = (idx++ & 1) ? retval1 : retval2; + char *ptr = retval; + while (*str) { + const char ch = *(str++); + *(ptr++) = ((ch >= 'A') && (ch <= 'Z')) ? (ch - ('A' - 'a')) : ch; + } + *ptr = '\0'; + return retval; +} + +static void write_converter(const int fromchans, const int tochans) +{ + const char *fromstr = layout_names[fromchans-1]; + const char *tostr = layout_names[tochans-1]; + const float *cvtmatrix = channel_conversion_matrix[fromchans-1][tochans-1]; + const float *fptr; + const int convert_backwards = (tochans > fromchans); + int input_channel_used[NUM_CHANNELS]; + int i, j; + + if (tochans == fromchans) { + return; /* nothing to convert, don't generate a converter. */ + } + + for (i = 0; i < fromchans; i++) { + input_channel_used[i] = 0; + } + + fptr = cvtmatrix; + for (j = 0; j < tochans; j++) { + for (i = 0; i < fromchans; i++) { + #if 0 + printf("to=%d, from=%d, coeff=%f\n", j, i, *fptr); + #endif + if (*(fptr++) != 0.0f) { + input_channel_used[i]++; + } + } + } + + printf("static void SDLCALL\n" + "SDL_Convert%sTo%s(SDL_AudioCVT *cvt, SDL_AudioFormat format)\n" + "{\n", remove_dots(fromstr), remove_dots(tostr)); + + if (convert_backwards) { /* must convert backwards when growing the output in-place. */ + printf(" float *dst = ((float *) (cvt->buf + ((cvt->len_cvt / %d) * %d))) - %d;\n", fromchans, tochans, tochans); + printf(" const float *src = ((const float *) (cvt->buf + cvt->len_cvt)) - %d;\n", fromchans); + } else { + printf(" float *dst = (float *) cvt->buf;\n"); + printf(" const float *src = dst;\n"); + } + + printf(" int i;\n" + "\n" + " LOG_DEBUG_CONVERT(\"%s\", \"%s\");\n" + " SDL_assert(format == AUDIO_F32SYS);\n" + "\n", lowercase(fromstr), lowercase(tostr)); + + if (convert_backwards) { + printf(" /* convert backwards, since output is growing in-place. */\n"); + printf(" for (i = cvt->len_cvt / (sizeof (float) * %d); i; i--, src -= %d, dst -= %d) {\n", fromchans, fromchans, tochans); + fptr = cvtmatrix; + for (i = 0; i < fromchans; i++) { + if (input_channel_used[i] > 1) { /* don't read it from src more than once. */ + printf(" const float src%s = src[%d];\n", channel_names[fromchans-1][i], i); + } + } + + for (j = tochans - 1; j >= 0; j--) { + int has_input = 0; + fptr = cvtmatrix + (fromchans * j); + printf(" dst[%d] /* %s */ =", j, channel_names[tochans-1][j]); + for (i = fromchans - 1; i >= 0; i--) { + const float coefficient = fptr[i]; + char srcname[32]; + if (coefficient == 0.0f) { + continue; + } else if (input_channel_used[i] > 1) { + snprintf(srcname, sizeof (srcname), "src%s", channel_names[fromchans-1][i]); + } else { + snprintf(srcname, sizeof (srcname), "src[%d]", i); + } + + if (has_input) { + printf(" +"); + } + + has_input = 1; + + if (coefficient == 1.0f) { + printf(" %s", srcname); + } else { + printf(" (%s * %.9ff)", srcname, coefficient); + } + } + + if (!has_input) { + printf(" 0.0f"); + } + + printf(";\n"); + } + + printf(" }\n"); + } else { + printf(" for (i = cvt->len_cvt / (sizeof (float) * %d); i; i--, src += %d, dst += %d) {\n", fromchans, fromchans, tochans); + + fptr = cvtmatrix; + for (i = 0; i < fromchans; i++) { + if (input_channel_used[i] > 1) { /* don't read it from src more than once. */ + printf(" const float src%s = src[%d];\n", channel_names[fromchans-1][i], i); + } + } + + for (j = 0; j < tochans; j++) { + int has_input = 0; + fptr = cvtmatrix + (fromchans * j); + printf(" dst[%d] /* %s */ =", j, channel_names[tochans-1][j]); + for (i = 0; i < fromchans; i++) { + const float coefficient = fptr[i]; + char srcname[32]; + if (coefficient == 0.0f) { + continue; + } else if (input_channel_used[i] > 1) { + snprintf(srcname, sizeof (srcname), "src%s", channel_names[fromchans-1][i]); + } else { + snprintf(srcname, sizeof (srcname), "src[%d]", i); + } + + if (has_input) { + printf(" +"); + } + + has_input = 1; + + if (coefficient == 1.0f) { + printf(" %s", srcname); + } else { + printf(" (%s * %.9ff)", srcname, coefficient); + } + } + + if (!has_input) { + printf(" 0.0f"); + } + + printf(";\n"); + } + printf(" }\n"); + } + + printf("\n"); + + if ((fromchans > 1) && (tochans > 1)) { + printf(" cvt->len_cvt = (cvt->len_cvt / %d) * %d;\n", fromchans, tochans); + } else if (tochans == 1) { + printf(" cvt->len_cvt = cvt->len_cvt / %d;\n", fromchans); + } else /* if (fromchans == 1) */ { + printf(" cvt->len_cvt = cvt->len_cvt * %d;\n", tochans); + } + + printf(" if (cvt->filters[++cvt->filter_index]) {\n" + " cvt->filters[cvt->filter_index] (cvt, format);\n" + " }\n" + "}\n\n"); +} + +int main(void) +{ + int ini, outi; + + printf( + "/*\n" + " Simple DirectMedia Layer\n" + " Copyright (C) 1997-2022 Sam Lantinga \n" + "\n" + " This software is provided 'as-is', without any express or implied\n" + " warranty. In no event will the authors be held liable for any damages\n" + " arising from the use of this software.\n" + "\n" + " Permission is granted to anyone to use this software for any purpose,\n" + " including commercial applications, and to alter it and redistribute it\n" + " freely, subject to the following restrictions:\n" + "\n" + " 1. The origin of this software must not be misrepresented; you must not\n" + " claim that you wrote the original software. If you use this software\n" + " in a product, an acknowledgment in the product documentation would be\n" + " appreciated but is not required.\n" + " 2. Altered source versions must be plainly marked as such, and must not be\n" + " misrepresented as being the original software.\n" + " 3. This notice may not be removed or altered from any source distribution.\n" + "*/\n" + "\n" + "/* DO NOT EDIT, THIS FILE WAS GENERATED BY build-scripts/gen_audio_channel_conversion.c */\n" + "\n" + ); + + for (ini = 1; ini <= NUM_CHANNELS; ini++) { + for (outi = 1; outi <= NUM_CHANNELS; outi++) { + write_converter(ini, outi); + } + } + + printf("static const SDL_AudioFilter channel_converters[%d][%d] = { /* [from][to] */\n", NUM_CHANNELS, NUM_CHANNELS); + for (ini = 1; ini <= NUM_CHANNELS; ini++) { + const char *comma = ""; + printf(" {"); + for (outi = 1; outi <= NUM_CHANNELS; outi++) { + const char *fromstr = layout_names[ini-1]; + const char *tostr = layout_names[outi-1]; + if (ini == outi) { + printf("%s NULL", comma); + } else { + printf("%s SDL_Convert%sTo%s", comma, remove_dots(fromstr), remove_dots(tostr)); + } + comma = ","; + } + printf(" }%s\n", (ini == NUM_CHANNELS) ? "" : ","); + } + + printf("};\n\n"); + printf("/* vi: set ts=4 sw=4 expandtab: */\n\n"); + + return 0; +} + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/build-scripts/gen_audio_resampler_filter.c libsdl2-2.24.0+dfsg/build-scripts/gen_audio_resampler_filter.c --- libsdl2-2.0.22+dfsg/build-scripts/gen_audio_resampler_filter.c 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/build-scripts/gen_audio_resampler_filter.c 2022-06-02 02:01:57.000000000 +0000 @@ -0,0 +1,163 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + +Built with: + +gcc -o genfilter build-scripts/gen_audio_resampler_filter.c -lm && ./genfilter > src/audio/SDL_audio_resampler_filter.h + + */ + +/* + SDL's resampler uses a "bandlimited interpolation" algorithm: + https://ccrma.stanford.edu/~jos/resample/ + + This code pre-generates the kaiser tables so we don't have to do this at + run time, at a cost of about 20 kilobytes of static data in SDL. This code + used to be part of SDL itself and generated the tables on the first use, + but that was expensive to produce on platforms without floating point + hardware. +*/ + +#include +#include + +#define RESAMPLER_ZERO_CROSSINGS 5 +#define RESAMPLER_BITS_PER_SAMPLE 16 +#define RESAMPLER_SAMPLES_PER_ZERO_CROSSING (1 << ((RESAMPLER_BITS_PER_SAMPLE / 2) + 1)) +#define RESAMPLER_FILTER_SIZE ((RESAMPLER_SAMPLES_PER_ZERO_CROSSING * RESAMPLER_ZERO_CROSSINGS) + 1) + +/* This is a "modified" bessel function, so you can't use POSIX j0() */ +static double +bessel(const double x) +{ + const double xdiv2 = x / 2.0; + double i0 = 1.0f; + double f = 1.0f; + int i = 1; + + while (1) { + const double diff = pow(xdiv2, i * 2) / pow(f, 2); + if (diff < 1.0e-21f) { + break; + } + i0 += diff; + i++; + f *= (double) i; + } + + return i0; +} + +/* build kaiser table with cardinal sine applied to it, and array of differences between elements. */ +static void +kaiser_and_sinc(float *table, float *diffs, const int tablelen, const double beta) +{ + const int lenm1 = tablelen - 1; + const int lenm1div2 = lenm1 / 2; + const double bessel_beta = bessel(beta); + int i; + + table[0] = 1.0f; + for (i = 1; i < tablelen; i++) { + const double kaiser = bessel(beta * sqrt(1.0 - pow(((i - lenm1) / 2.0) / lenm1div2, 2.0))) / bessel_beta; + table[tablelen - i] = (float) kaiser; + } + + for (i = 1; i < tablelen; i++) { + const float x = (((float) i) / ((float) RESAMPLER_SAMPLES_PER_ZERO_CROSSING)) * ((float) M_PI); + table[i] *= sinf(x) / x; + diffs[i - 1] = table[i] - table[i - 1]; + } + diffs[lenm1] = 0.0f; +} + + +static float ResamplerFilter[RESAMPLER_FILTER_SIZE]; +static float ResamplerFilterDifference[RESAMPLER_FILTER_SIZE]; + +static void +PrepareResampleFilter(void) +{ + /* if dB > 50, beta=(0.1102 * (dB - 8.7)), according to Matlab. */ + const double dB = 80.0; + const double beta = 0.1102 * (dB - 8.7); + kaiser_and_sinc(ResamplerFilter, ResamplerFilterDifference, RESAMPLER_FILTER_SIZE, beta); +} + +int main(void) +{ + int i; + + PrepareResampleFilter(); + + printf( + "/*\n" + " Simple DirectMedia Layer\n" + " Copyright (C) 1997-2022 Sam Lantinga \n" + "\n" + " This software is provided 'as-is', without any express or implied\n" + " warranty. In no event will the authors be held liable for any damages\n" + " arising from the use of this software.\n" + "\n" + " Permission is granted to anyone to use this software for any purpose,\n" + " including commercial applications, and to alter it and redistribute it\n" + " freely, subject to the following restrictions:\n" + "\n" + " 1. The origin of this software must not be misrepresented; you must not\n" + " claim that you wrote the original software. If you use this software\n" + " in a product, an acknowledgment in the product documentation would be\n" + " appreciated but is not required.\n" + " 2. Altered source versions must be plainly marked as such, and must not be\n" + " misrepresented as being the original software.\n" + " 3. This notice may not be removed or altered from any source distribution.\n" + "*/\n" + "\n" + "/* DO NOT EDIT, THIS FILE WAS GENERATED BY build-scripts/gen_audio_resampler_filter.c */\n" + "\n" + "#define RESAMPLER_ZERO_CROSSINGS %d\n" + "#define RESAMPLER_BITS_PER_SAMPLE %d\n" + "#define RESAMPLER_SAMPLES_PER_ZERO_CROSSING (1 << ((RESAMPLER_BITS_PER_SAMPLE / 2) + 1))\n" + "#define RESAMPLER_FILTER_SIZE ((RESAMPLER_SAMPLES_PER_ZERO_CROSSING * RESAMPLER_ZERO_CROSSINGS) + 1)\n" + "\n", RESAMPLER_ZERO_CROSSINGS, RESAMPLER_BITS_PER_SAMPLE + ); + + printf("static const float ResamplerFilter[RESAMPLER_FILTER_SIZE] = {\n"); + printf(" %.9ff", ResamplerFilter[0]); + for (i = 0; i < RESAMPLER_FILTER_SIZE-1; i++) { + printf("%s%.9ff", ((i % 5) == 4) ? ",\n " : ", ", ResamplerFilter[i+1]); + } + printf("\n};\n\n"); + + printf("static const float ResamplerFilterDifference[RESAMPLER_FILTER_SIZE] = {\n"); + printf(" %.9ff", ResamplerFilterDifference[0]); + for (i = 0; i < RESAMPLER_FILTER_SIZE-1; i++) { + printf("%s%.9ff", ((i % 5) == 4) ? ",\n " : ", ", ResamplerFilterDifference[i+1]); + } + printf("\n};\n\n"); + printf("/* vi: set ts=4 sw=4 expandtab: */\n\n"); + + return 0; +} + +/* vi: set ts=4 sw=4 expandtab: */ + diff -Nru libsdl2-2.0.22+dfsg/build-scripts/update-copyright.sh libsdl2-2.24.0+dfsg/build-scripts/update-copyright.sh --- libsdl2-2.0.22+dfsg/build-scripts/update-copyright.sh 2021-07-27 14:52:29.000000000 +0000 +++ libsdl2-2.24.0+dfsg/build-scripts/update-copyright.sh 2022-06-02 02:01:57.000000000 +0000 @@ -1,8 +1,7 @@ #!/bin/sh -find . -type f -exec grep -Il "Copyright" {} \; \ -| grep -v \.git \ -| while read file; \ -do \ - LC_ALL=C sed -b -i "s/\(.*Copyright.*\)[0-9]\{4\}\( *Sam Lantinga\)/\1`date +%Y`\2/" "$file"; \ +find . -type f -exec grep -Il "Copyright" {} \; \ +| grep -v \.git \ +| while read file; do \ + LC_ALL=C sed -b -i "s/\(.*Copyright.*\)[0-9]\{4\}\( *Sam Lantinga\)/\1`date +%Y`\2/" "$file"; \ done diff -Nru libsdl2-2.0.22+dfsg/build-scripts/wikiheaders.pl libsdl2-2.24.0+dfsg/build-scripts/wikiheaders.pl --- libsdl2-2.0.22+dfsg/build-scripts/wikiheaders.pl 2022-01-08 03:42:56.000000000 +0000 +++ libsdl2-2.24.0+dfsg/build-scripts/wikiheaders.pl 2022-08-13 03:48:10.000000000 +0000 @@ -4,10 +4,28 @@ use strict; use Text::Wrap; +$Text::Wrap::huge = 'overflow'; + +my $projectfullname = 'Simple Directmedia Layer'; +my $projectshortname = 'SDL'; +my $wikisubdir = ''; +my $incsubdir = 'include'; +my $apiprefixregex = undef; +my $versionfname = 'include/SDL_version.h'; +my $versionmajorregex = '\A\#define\s+SDL_MAJOR_VERSION\s+(\d+)\Z'; +my $versionminorregex = '\A\#define\s+SDL_MINOR_VERSION\s+(\d+)\Z'; +my $versionpatchregex = '\A\#define\s+SDL_PATCHLEVEL\s+(\d+)\Z'; +my $mainincludefname = 'SDL.h'; +my $selectheaderregex = '\ASDL.*?\.h\Z'; +my $projecturl = 'https://libsdl.org/'; +my $wikiurl = 'https://wiki.libsdl.org'; +my $bugreporturl = 'https://github.com/libsdl-org/sdlwiki/issues/new'; my $srcpath = undef; my $wikipath = undef; my $warn_about_missing = 0; my $copy_direction = 0; +my $optionsfname = undef; +my $wikipreamble = undef; foreach (@ARGV) { $warn_about_missing = 1, next if $_ eq '--warn-about-missing'; @@ -15,14 +33,74 @@ $copy_direction = 1, next if $_ eq '--copy-to-header'; $copy_direction = -1, next if $_ eq '--copy-to-wiki'; $copy_direction = -2, next if $_ eq '--copy-to-manpages'; + if (/\A--options=(.*)\Z/) { + $optionsfname = $1; + next; + } $srcpath = $_, next if not defined $srcpath; $wikipath = $_, next if not defined $wikipath; } +my $default_optionsfname = '.wikiheaders-options'; +$default_optionsfname = "$srcpath/$default_optionsfname" if defined $srcpath; + +if ((not defined $optionsfname) && (-f $default_optionsfname)) { + $optionsfname = $default_optionsfname; +} + +if (defined $optionsfname) { + open OPTIONS, '<', $optionsfname or die("Failed to open options file '$optionsfname': $!\n"); + while () { + chomp; + if (/\A(.*?)\=(.*)\Z/) { + my $key = $1; + my $val = $2; + $key =~ s/\A\s+//; + $key =~ s/\s+\Z//; + $val =~ s/\A\s+//; + $val =~ s/\s+\Z//; + $warn_about_missing = int($val), next if $key eq 'warn_about_missing'; + $srcpath = $val, next if $key eq 'srcpath'; + $wikipath = $val, next if $key eq 'wikipath'; + $apiprefixregex = $val, next if $key eq 'apiprefixregex'; + $projectfullname = $val, next if $key eq 'projectfullname'; + $projectshortname = $val, next if $key eq 'projectshortname'; + $wikisubdir = $val, next if $key eq 'wikisubdir'; + $incsubdir = $val, next if $key eq 'incsubdir'; + $versionmajorregex = $val, next if $key eq 'versionmajorregex'; + $versionminorregex = $val, next if $key eq 'versionminorregex'; + $versionpatchregex = $val, next if $key eq 'versionpatchregex'; + $versionfname = $val, next if $key eq 'versionfname'; + $mainincludefname = $val, next if $key eq 'mainincludefname'; + $selectheaderregex = $val, next if $key eq 'selectheaderregex'; + $projecturl = $val, next if $key eq 'projecturl'; + $wikiurl = $val, next if $key eq 'wikiurl'; + $bugreporturl = $val, next if $key eq 'bugreporturl'; + $wikipreamble = $val, next if $key eq 'wikipreamble'; + } + } + close(OPTIONS); +} + my $wordwrap_mode = 'mediawiki'; sub wordwrap_atom { # don't call this directly. my $str = shift; - return fill('', '', $str); + my $retval = ''; + + # wordwrap but leave links intact, even if they overflow. + if ($wordwrap_mode eq 'mediawiki') { + while ($str =~ s/(.*?)\s*(\[https?\:\/\/.*?\s+.*?\])\s*//ms) { + $retval .= fill('', '', $1); # wrap it. + $retval .= "\n$2\n"; # don't wrap it. + } + } elsif ($wordwrap_mode eq 'md') { + while ($str =~ s/(.*?)\s*(\[.*?\]\(https?\:\/\/.*?\))\s*//ms) { + $retval .= fill('', '', $1); # wrap it. + $retval .= "\n$2\n"; # don't wrap it. + } + } + + return $retval . fill('', '', $str); } sub wordwrap_with_bullet_indent { # don't call this directly. @@ -142,16 +220,23 @@ while ($str =~ s/\A(.*?)\`(.*?)\`//ms) { my $codeblock = $2; $codedstr .= wikify_chunk($wikitype, $1, undef, undef); - # Convert obvious SDL things to wikilinks, even inside `code` blocks. - $codeblock =~ s/\b(SDL_[a-zA-Z0-9_]+)/[[$1]]/gms; + if (defined $apiprefixregex) { + # Convert obvious API things to wikilinks, even inside `code` blocks. + $codeblock =~ s/\b($apiprefixregex[a-zA-Z0-9_]+)/[[$1]]/gms; + } $codedstr .= "$codeblock"; } - # Convert obvious SDL things to wikilinks. - $str =~ s/\b(SDL_[a-zA-Z0-9_]+)/[[$1]]/gms; + # Convert obvious API things to wikilinks. + if (defined $apiprefixregex) { + $str =~ s/\b($apiprefixregex[a-zA-Z0-9_]+)/[[$1]]/gms; + } # Make some Markdown things into MediaWiki... + # links + $str =~ s/\[(.*?)\]\((https?\:\/\/.*?)\)/\[$2 $1\]/g; + # bold+italic $str =~ s/\*\*\*(.*?)\*\*\*/'''''$1'''''/gms; @@ -170,8 +255,10 @@ $str .= "$code<\/syntaxhighlight>"; } } elsif ($wikitype eq 'md') { - # Convert obvious SDL things to wikilinks. - $str =~ s/\b(SDL_[a-zA-Z0-9_]+)/[$1]($1)/gms; + # Convert obvious API things to wikilinks. + if (defined $apiprefixregex) { + $str =~ s/\b($apiprefixregex[a-zA-Z0-9_]+)/[$1]($1)/gms; + } if (defined $code) { $str .= "```$codelang$code```"; } @@ -216,7 +303,13 @@ # Doxygen supports Markdown (and it just simply looks better than MediaWiki # when looking at the raw headers), so do some conversions here as necessary. - $str =~ s/\[\[(SDL_[a-zA-Z0-9_]+)\]\]/$1/gms; # Dump obvious wikilinks. + # Dump obvious wikilinks. + if (defined $apiprefixregex) { + $str =~ s/\[\[($apiprefixregex[a-zA-Z0-9_]+)\]\]/$1/gms; + } + + # links + $str =~ s/\[(https?\:\/\/.*?)\s+(.*?)\]/\[$2\]\($1\)/g; # is also popular. :/ $str =~ s/\(.*?)<\/code>/`$1`/gms; @@ -240,7 +333,13 @@ } elsif ($dewikify_mode eq 'manpage') { $str =~ s/\./\\[char46]/gms; # make sure these can't become control codes. if ($wikitype eq 'mediawiki') { - $str =~ s/\s*\[\[(SDL_[a-zA-Z0-9_]+)\]\]\s*/\n.BR $1\n/gms; # Dump obvious wikilinks. + # Dump obvious wikilinks. + if (defined $apiprefixregex) { + $str =~ s/\s*\[\[($apiprefixregex[a-zA-Z0-9_]+)\]\]\s*/\n.BR $1\n/gms; + } + + # links + $str =~ s/\[(https?\:\/\/.*?)\s+(.*?)\]/\n.URL "$1" "$2"\n/g; # is also popular. :/ $str =~ s/\s*\(.*?)<\/code>\s*/\n.BR $1\n/gms; @@ -336,11 +435,13 @@ my %headerfuncschunk = (); # $headerfuncschunk{"SDL_OpenAudio"} -> offset in array in %headers that should be replaced for this function. my %headerfuncshasdoxygen = (); # $headerfuncschunk{"SDL_OpenAudio"} -> 1 if there was no existing doxygen for this function. -my $incpath = "$srcpath/include"; +my $incpath = "$srcpath"; +$incpath .= "/$incsubdir" if $incsubdir ne ''; + opendir(DH, $incpath) or die("Can't opendir '$incpath': $!\n"); while (readdir(DH)) { my $dent = $_; - next if not $dent =~ /\ASDL.*?\.h\Z/; # just SDL*.h headers. + next if not $dent =~ /$selectheaderregex/; # just selected headers. open(FH, '<', "$incpath/$dent") or die("Can't open '$incpath/$dent': $!\n"); my @contents = (); @@ -490,21 +591,30 @@ while (readdir(DH)) { my $dent = $_; my $type = ''; - if ($dent =~ /\ASDL.*?\.(md|mediawiki)\Z/) { + if ($dent =~ /\.(md|mediawiki)\Z/) { $type = $1; } else { next; # only dealing with wiki pages. } + my $fn = $dent; + $fn =~ s/\..*\Z//; + + # Ignore FrontPage. + next if $fn eq 'FrontPage'; + + # Ignore "Category*" pages. + next if ($fn =~ /\ACategory/); + open(FH, '<', "$wikipath/$dent") or die("Can't open '$wikipath/$dent': $!\n"); my $current_section = '[start]'; my @section_order = ( $current_section ); - my $fn = $dent; - $fn =~ s/\..*\Z//; my %sections = (); $sections{$current_section} = ''; + my $firstline = 1; + while () { chomp; my $orig = $_; @@ -512,18 +622,24 @@ s/\s*\Z//; if ($type eq 'mediawiki') { - if (/\A\= (.*?) \=\Z/) { + if (defined($wikipreamble) && $firstline && /\A\=\=\=\=\=\= (.*?) \=\=\=\=\=\=\Z/ && ($1 eq $wikipreamble)) { + $firstline = 0; # skip this. + next; + } elsif (/\A\= (.*?) \=\Z/) { + $firstline = 0; $current_section = ($1 eq $fn) ? '[Brief]' : $1; die("Doubly-defined section '$current_section' in '$dent'!\n") if defined $sections{$current_section}; push @section_order, $current_section; $sections{$current_section} = ''; } elsif (/\A\=\= (.*?) \=\=\Z/) { + $firstline = 0; $current_section = ($1 eq $fn) ? '[Brief]' : $1; die("Doubly-defined section '$current_section' in '$dent'!\n") if defined $sections{$current_section}; push @section_order, $current_section; $sections{$current_section} = ''; next; } elsif (/\A\-\-\-\-\Z/) { + $firstline = 0; $current_section = '[footer]'; die("Doubly-defined section '$current_section' in '$dent'!\n") if defined $sections{$current_section}; push @section_order, $current_section; @@ -531,13 +647,18 @@ next; } } elsif ($type eq 'md') { - if (/\A\#+ (.*?)\Z/) { + if (defined($wikipreamble) && $firstline && /\A\#\#\#\#\#\# (.*?)\Z/ && ($1 eq $wikipreamble)) { + $firstline = 0; # skip this. + next; + } elsif (/\A\#+ (.*?)\Z/) { + $firstline = 0; $current_section = ($1 eq $fn) ? '[Brief]' : $1; die("Doubly-defined section '$current_section' in '$dent'!\n") if defined $sections{$current_section}; push @section_order, $current_section; $sections{$current_section} = ''; next; } elsif (/\A\-\-\-\-\Z/) { + $firstline = 0; $current_section = '[footer]'; die("Doubly-defined section '$current_section' in '$dent'!\n") if defined $sections{$current_section}; push @section_order, $current_section; @@ -548,7 +669,12 @@ die("Unexpected wiki file type. Fixme!\n"); } - $sections{$current_section} .= "$orig\n"; + if ($firstline) { + $firstline = ($_ ne ''); + } + if (!$firstline) { + $sections{$current_section} .= "$orig\n"; + } } close(FH); @@ -718,6 +844,8 @@ foreach (@desclines) { s/\A(\:|\* )//; s/\(\)\Z//; # Convert "SDL_Func()" to "SDL_Func" + s/\[\[(.*?)\]\]/$1/; # in case some wikilinks remain. + s/\A\/*//; $str .= "\\sa $_\n"; } } @@ -926,7 +1054,7 @@ if ($wikitype eq 'mediawiki') { $sections{'Related Functions'} .= ":[[$sa]]\n"; } elsif ($wikitype eq 'md') { - $sections{'Related Functions'} .= "* [$sa](/$sa)\n"; + $sections{'Related Functions'} .= "* [$sa]($sa)\n"; } else { die("Expected wikitype '$wikitype'\n"); } } } @@ -1008,6 +1136,14 @@ } else { die("Unexpected wikitype '$wikitype'\n"); } $$sectionsref{'[footer]'} = $footer; + if (defined $wikipreamble) { + if ($wikitype eq 'mediawiki') { + print FH "====== $wikipreamble ======\n"; + } elsif ($wikitype eq 'md') { + print FH "###### $wikipreamble\n"; + } else { die("Unexpected wikitype '$wikitype'\n"); } + } + my $prevsectstr = ''; my @ordered_sections = (@standard_wiki_sections, defined $wikisectionorderref ? @$wikisectionorderref : ()); # this copies the arrays into one. foreach (@ordered_sections) { @@ -1076,22 +1212,23 @@ my $gitrev = `cd "$srcpath" ; git rev-list HEAD~..`; chomp($gitrev); - open(FH, '<', "$srcpath/include/SDL_version.h") or die("Can't open '$srcpath/include/SDL_version.h': $!\n"); + # !!! FIXME + open(FH, '<', "$srcpath/$versionfname") or die("Can't open '$srcpath/$versionfname': $!\n"); my $majorver = 0; my $minorver = 0; my $patchver = 0; while () { chomp; - if (/\A\#define SDL_MAJOR_VERSION\s+(\d+)\Z/) { + if (/$versionmajorregex/) { $majorver = int($1); - } elsif (/\A\#define SDL_MINOR_VERSION\s+(\d+)\Z/) { + } elsif (/$versionminorregex/) { $minorver = int($1); - } elsif (/\A\#define SDL_PATCHLEVEL\s+(\d+)\Z/) { + } elsif (/$versionpatchregex/) { $patchver = int($1); } } close(FH); - my $sdlversion = "$majorver.$minorver.$patchver"; + my $fullversion = "$majorver.$minorver.$patchver"; foreach (keys %headerfuncs) { my $fn = $_; @@ -1126,17 +1263,24 @@ $str .= ".\\\" This manpage content is licensed under Creative Commons\n"; $str .= ".\\\" Attribution 4.0 International (CC BY 4.0)\n"; $str .= ".\\\" https://creativecommons.org/licenses/by/4.0/\n"; - $str .= ".\\\" This manpage was generated from SDL's wiki page for $fn:\n"; - $str .= ".\\\" https://wiki.libsdl.org/$fn\n"; + $str .= ".\\\" This manpage was generated from ${projectshortname}'s wiki page for $fn:\n"; + $str .= ".\\\" $wikiurl/$fn\n"; $str .= ".\\\" Generated with SDL/build-scripts/wikiheaders.pl\n"; $str .= ".\\\" revision $gitrev\n" if $gitrev ne ''; $str .= ".\\\" Please report issues in this manpage's content at:\n"; - $str .= ".\\\" https://github.com/libsdl-org/sdlwiki/issues/new?title=Feedback%20on%20page%20$fn\n"; + $str .= ".\\\" $bugreporturl\n"; $str .= ".\\\" Please report issues in the generation of this manpage from the wiki at:\n"; $str .= ".\\\" https://github.com/libsdl-org/SDL/issues/new?title=Misgenerated%20manpage%20for%20$fn\n"; - $str .= ".\\\" SDL can be found at https://libsdl.org/\n"; + $str .= ".\\\" $projectshortname can be found at $projecturl\n"; + + # Define a .URL macro. The "www.tmac" thing decides if we're using GNU roff (which has a .URL macro already), and if so, overrides the macro we just created. + # This wizadry is from https://web.archive.org/web/20060102165607/http://people.debian.org/~branden/talks/wtfm/wtfm.pdf + $str .= ".de URL\n"; + $str .= '\\$2 \(laURL: \\$1 \(ra\\$3' . "\n"; + $str .= "..\n"; + $str .= '.if \n[.g] .mso www.tmac' . "\n"; - $str .= ".TH $fn 3 \"SDL $sdlversion\" \"Simple Directmedia Layer\" \"SDL$majorver FUNCTIONS\"\n"; + $str .= ".TH $fn 3 \"$projectshortname $fullversion\" \"$projectfullname\" \"$projectshortname$majorver FUNCTIONS\"\n"; $str .= ".SH NAME\n"; $str .= "$fn"; @@ -1145,7 +1289,7 @@ $str .= ".SH SYNOPSIS\n"; $str .= ".nf\n"; - $str .= ".B #include \\(dqSDL.h\\(dq\n"; + $str .= ".B #include \\(dq$mainincludefname\\(dq\n"; $str .= ".PP\n"; my @decllines = split /\n/, $decl; @@ -1216,6 +1360,8 @@ foreach (@desclines) { s/\A(\:|\* )//; s/\(\)\Z//; # Convert "SDL_Func()" to "SDL_Func" + s/\[\[(.*?)\]\]/$1/; # in case some wikilinks remain. + s/\A\/*//; s/\A\.BR\s+//; # dewikify added this, but we want to handle it. s/\A\s+//; s/\s+\Z//; @@ -1234,14 +1380,14 @@ $str .= ".UE\n"; $str .= ".PP\n"; $str .= "This manpage was generated from\n"; - $str .= ".UR https://wiki.libsdl.org/$fn\n"; - $str .= "SDL's wiki\n"; + $str .= ".UR $wikiurl/$fn\n"; + $str .= "${projectshortname}'s wiki\n"; $str .= ".UE\n"; $str .= "using SDL/build-scripts/wikiheaders.pl"; $str .= " revision $gitrev" if $gitrev ne ''; $str .= ".\n"; $str .= "Please report issues in this manpage at\n"; - $str .= ".UR https://github.com/libsdl-org/sdlwiki/issues/new\n"; + $str .= ".UR $bugreporturl\n"; $str .= "our bugtracker!\n"; $str .= ".UE\n"; } diff -Nru libsdl2-2.0.22+dfsg/build-scripts/winrtbuild.bat libsdl2-2.24.0+dfsg/build-scripts/winrtbuild.bat --- libsdl2-2.0.22+dfsg/build-scripts/winrtbuild.bat 2021-07-27 14:52:29.000000000 +0000 +++ libsdl2-2.24.0+dfsg/build-scripts/winrtbuild.bat 1970-01-01 00:00:00.000000000 +0000 @@ -1,8 +0,0 @@ -@ECHO OFF -REM -REM winrtbuild.bat: a batch file to help launch the winrtbuild.ps1 -REM Powershell script, either from Windows Explorer, or through Buildbot. -REM -SET ThisScriptsDirectory=%~dp0 -SET PowerShellScriptPath=%ThisScriptsDirectory%winrtbuild.ps1 -PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& '%PowerShellScriptPath%'"; \ No newline at end of file diff -Nru libsdl2-2.0.22+dfsg/build-scripts/winrtbuild.ps1 libsdl2-2.24.0+dfsg/build-scripts/winrtbuild.ps1 --- libsdl2-2.0.22+dfsg/build-scripts/winrtbuild.ps1 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/build-scripts/winrtbuild.ps1 1970-01-01 00:00:00.000000000 +0000 @@ -1,302 +0,0 @@ -# -# winrtbuild.ps1 -- A Powershell script to build all SDL/WinRT variants, -# across all WinRT platforms, in all of their supported, CPU architectures. -# -# Initial version written by David Ludwig -# -# This script can be launched from Windows Explorer by double-clicking -# on winrtbuild.bat -# -# Output will be placed in the following subdirectories of the SDL source -# tree: -# * VisualC-WinRT\lib\ -- final .dll, .lib, and .pdb files -# * VisualC-WinRT\obj\ -- intermediate build files -# -# Recommended Dependencies: -# * Windows 8.1 or higher -# * Powershell 4.0 or higher (included as part of Windows 8.1) -# * Visual C++ 2012, for building Windows 8.0 and Windows Phone 8.0 binaries. -# * Visual C++ 2013, for building Windows 8.1 and Windows Phone 8.1 binaries -# * SDKs for Windows 8.0, Windows 8.1, Windows Phone 8.0, and -# Windows Phone 8.1, as needed -# -# Commom parameters/variables may include, but aren't strictly limited to: -# * PlatformToolset: the name of one of Visual Studio's build platforms. -# Different PlatformToolsets output different binaries. One -# PlatformToolset exists for each WinRT platform. Possible values -# may include: -# - "v110": Visual Studio 2012 build tools, plus the Windows 8.0 SDK -# - "v110_wp80": Visual Studio 2012 build tools, plus the Windows Phone 8.0 SDK -# - "v120": Visual Studio 2013 build tools, plus the Windows 8.1 SDK -# - "v120_wp81": Visual Studio 2013 build tools, plus the Windows Phone 8.1 SDK -# * VSProjectPath: the full path to a Visual Studio or Visual C++ project file -# * VSProjectName: the internal name of a Visual Studio or Visual C++ project -# file. Some of Visual Studio's own build tools use this name when -# calculating paths for build-output. -# * Platform: a Visual Studio platform name, which often maps to a CPU -# CPU architecture. Possible values may include: "Win32" (for 32-bit x86), -# "ARM", or "x64" (for 64-bit x86). -# - -# Base version of SDL, used for packaging purposes -$SDLVersion = "2.0.22" - -# Gets the .bat file that sets up an MSBuild environment, given one of -# Visual Studio's, "PlatformToolset"s. -function Get-MSBuild-Env-Launcher -{ - param( - [Parameter(Mandatory=$true,Position=1)][string]$PlatformToolset - ) - - if ($PlatformToolset -eq "v110") { # Windows 8.0 (not Windows Phone), via VS 2012 - return "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" - } - if ($PlatformToolset -eq "v110_wp80") { # Windows Phone 8.0, via VS 2012 - return "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\WPSDK\WP80\vcvarsphoneall.bat" - } - if ($PlatformToolset -eq "v120") { # Windows 8.1 (not Windows Phone), via VS 2013 - return "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" - } - if ($PlatformToolset -eq "v120_wp81") { # Windows Phone 8.1, via VS 2013 - return "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" - } - if ($PlatformToolset -eq "v140") { # Windows 10, via VS 2015 - return "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" - } - return "" -} - -# Gets a string that identifies the build-variant of SDL/WinRT that is specific -# to a particular Visual Studio PlatformToolset. -function Get-SDL-WinRT-Variant-Name -{ - param( - [Parameter(Mandatory=$true,Position=1)][string]$PlatformToolset, - - # If true, append a string to this function's output, identifying the - # build-variant's minimum-supported version of Visual Studio. - [switch]$IncludeVSSuffix = $false - ) - - if ($PlatformToolset -eq "v110") { # Windows 8.0 (not Windows Phone), via VS 2012 project files - if ($IncludeVSSuffix) { - return "WinRT80_VS2012" - } else { - return "WinRT80" - } - } - if ($PlatformToolset -eq "v110_wp80") { # Windows Phone 8.0, via VS 2012 project files - if ($IncludeVSSuffix) { - return "WinPhone80_VS2012" - } else { - return "WinPhone80" - } - } - if ($PlatformToolset -eq "v120") { # Windows 8.1 (not Windows Phone), via VS 2013 project files - if ($IncludeVSSuffix) { - return "WinRT81_VS2013" - } else { - return "WinRT81" - } - } - if ($PlatformToolset -eq "v120_wp81") { # Windows Phone 8.1, via VS 2013 project files - if ($IncludeVSSuffix) { - return "WinPhone81_VS2013" - } else { - return "WinPhone81" - } - } - if ($PlatformToolset -eq "v140") { # Windows 10, via VS 2015 project files - if ($IncludeVSSuffix) { - return "UWP_VS2015" - } else { - return "UWP" - } - } - return "" -} - -# Returns the internal name of a Visual Studio Project. -# -# The internal name of a VS Project is encoded inside the project file -# itself, inside a set of XML tags. -function Get-VS-ProjectName -{ - param( - [Parameter(Mandatory=$true,Position=1)]$VSProjectPath - ) - - # For now, just do a regex for the project name: - $matches = (Get-Content $VSProjectPath | Select-String -Pattern ".*([^<]+)<.*").Matches - foreach ($match in $matches) { - if ($match.Groups.Count -ge 1) { - return $match.Groups[1].Value - } - } - return $null -} - -# Build a specific variant of SDL/WinRT -function Build-SDL-WinRT-Variant -{ - # - # Read in arguments: - # - param ( - # name of an SDL project file, minus extensions and - # platform-identifying suffixes - [Parameter(Mandatory=$true,Position=1)][string]$SDLProjectName, - - [Parameter(Mandatory=$true,Position=2)][string]$PlatformToolset, - - [Parameter(Mandatory=$true,Position=3)][string]$Platform - ) - - # - # Derive other properties from read-in arguments: - # - - # The .bat file to setup a platform-appropriate MSBuild environment: - $BatchFileForMSBuildEnv = Get-MSBuild-Env-Launcher $PlatformToolset - - # The full path to the VS Project that'll be built: - $VSProjectPath = "$PSScriptRoot\..\VisualC-WinRT\$(Get-SDL-WinRT-Variant-Name $PlatformToolset -IncludeVSSuffix)\$SDLProjectName-$(Get-SDL-WinRT-Variant-Name $PlatformToolset).vcxproj" - - # The internal name of the VS Project, used in some post-build steps: - $VSProjectName = Get-VS-ProjectName $VSProjectPath - - # Where to place output binaries (.dll, .lib, and .pdb files): - $OutDir = "$PSScriptRoot\..\VisualC-WinRT\lib\$(Get-SDL-WinRT-Variant-Name $PlatformToolset)\$Platform" - - # Where to place intermediate build files: - $IntermediateDir = "$PSScriptRoot\..\VisualC-WinRT\obj\$SDLProjectName-$(Get-SDL-WinRT-Variant-Name $PlatformToolset)\$Platform" - - # - # Build the VS Project: - # - cmd.exe /c " ""$BatchFileForMSBuildEnv"" x86 & msbuild ""$VSProjectPath"" /p:Configuration=Release /p:Platform=$Platform /p:OutDir=""$OutDir\\"" /p:IntDir=""$IntermediateDir\\""" | Out-Host - $BuildResult = $? - - # - # Move .dll files into place. This fixes a problem whereby MSBuild may - # put output files into a sub-directory of $OutDir, rather than $OutDir - # itself. - # - if (Test-Path "$OutDir\$VSProjectName\") { - Move-Item -Force "$OutDir\$VSProjectName\*" "$OutDir" - } - - # - # Clean up unneeded files in $OutDir: - # - if (Test-Path "$OutDir\$VSProjectName\") { - Remove-Item -Recurse "$OutDir\$VSProjectName" - } - Remove-Item "$OutDir\*.exp" - Remove-Item "$OutDir\*.ilk" - Remove-Item "$OutDir\*.pri" - - # - # All done. Indicate success, or failure, to the caller: - # - #echo "RESULT: $BuildResult" | Out-Host - return $BuildResult -} - - -# -# Build each variant, with corresponding .dll, .lib, and .pdb files: -# -$DidAnyDLLBuildFail = $false -$DidAnyNugetBuildFail = $false - -# Ryan disabled WP8.0, because it doesn't appear to have mmdeviceapi.h that SDL_wasapi needs. -# My assumption is that no one will miss this, but send patches otherwise! --ryan. -# Build for Windows Phone 8.0, via VC++ 2012: -#if ( ! (Build-SDL-WinRT-Variant "SDL" "v110_wp80" "ARM")) { $DidAnyDLLBuildFail = $true } -#if ( ! (Build-SDL-WinRT-Variant "SDL" "v110_wp80" "Win32")) { $DidAnyDLLBuildFail = $true } - -# Build for Windows Phone 8.1, via VC++ 2013: -if ( ! (Build-SDL-WinRT-Variant "SDL" "v120_wp81" "ARM")) { $DidAnyDLLBuildFail = $true } -if ( ! (Build-SDL-WinRT-Variant "SDL" "v120_wp81" "Win32")) { $DidAnyDLLBuildFail = $true } - -# Build for Windows 8.0 and Windows RT 8.0, via VC++ 2012: -# -# Win 8.0 auto-building was disabled on 2017-Feb-25, by David Ludwig . -# Steam's OS-usage surveys indicate that Windows 8.0 use is pretty much nil, plus -# Microsoft hasn't supported Windows 8.0 development for a few years now. -# The commented-out lines below may still work on some systems, though. -# -#if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "ARM")) { $DidAnyDLLBuildFail = $true } -#if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "Win32")) { $DidAnyDLLBuildFail = $true } -#if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "x64")) { $DidAnyDLLBuildFail = $true } - -# Build for Windows 8.1 and Windows RT 8.1, via VC++ 2013: -if ( ! (Build-SDL-WinRT-Variant "SDL" "v120" "ARM")) { $DidAnyDLLBuildFail = $true } -if ( ! (Build-SDL-WinRT-Variant "SDL" "v120" "Win32")) { $DidAnyDLLBuildFail = $true } -if ( ! (Build-SDL-WinRT-Variant "SDL" "v120" "x64")) { $DidAnyDLLBuildFail = $true } - -# Build for Windows 10, via VC++ 2015 -if ( ! (Build-SDL-WinRT-Variant "SDL" "v140" "ARM")) { $DidAnyDLLBuildFail = $true } -if ( ! (Build-SDL-WinRT-Variant "SDL" "v140" "Win32")) { $DidAnyDLLBuildFail = $true } -if ( ! (Build-SDL-WinRT-Variant "SDL" "v140" "x64")) { $DidAnyDLLBuildFail = $true } - -# Build NuGet packages, if possible -if ($DidAnyDLLBuildFail -eq $true) { - Write-Warning -Message "Unable to build all variants. NuGet packages will not be built." - $DidAnyNugetBuildFail = $true -} else { - $NugetPath = (Get-Command -CommandType Application nuget.exe | %{$_.Path}) 2> $null - if ("$NugetPath" -eq "") { - Write-Warning -Message "Unable to find nuget.exe. NuGet packages will not be built." - $DidAnyNugetBuildFail = $true - } else { - Write-Host -ForegroundColor Cyan "Building SDL2 NuGet packages..." - Write-Host -ForegroundColor Cyan "... via NuGet install: $NugetPath" - $NugetOutputDir = "$PSScriptRoot\..\VisualC-WinRT\lib\nuget" - Write-Host -ForegroundColor Cyan "... output directory: $NugetOutputDir" - $SDLHGRevision = $($(hg log -l 1 --repository "$PSScriptRoot\.." | select-string "changeset") -Replace "changeset:\W*(\d+).*",'$1') 2>$null - Write-Host -ForegroundColor Cyan "... HG Revision: $SDLHGRevision" - - # Base options to nuget.exe - $NugetOptions = @("pack", "PACKAGE_NAME_WILL_GO_HERE", "-Output", "$NugetOutputDir") - - # Try attaching hg revision to NuGet package: - $NugetOptions += "-Version" - if ("$SDLHGRevision" -eq "") { - Write-Warning -Message "Unable to find the Mercurial revision (maybe hg.exe can't be found?). NuGet packages will not have this attached to their name." - $NugetOptions += "$SDLVersion-Unofficial" - } else { - $NugetOptions += "$SDLVersion.$SDLHGRevision-Unofficial" - } - - # Create NuGet output dir, if not yet created: - if ($(Test-Path "$NugetOutputDir") -eq $false) { - New-Item "$NugetOutputDir" -type directory - } - - # Package SDL2: - $NugetOptions[1] = "$PSScriptRoot\..\VisualC-WinRT\SDL2-WinRT.nuspec" - &"$NugetPath" $NugetOptions -Symbols - if ( ! $? ) { $DidAnyNugetBuildFail = $true } - - # Package SDL2main: - $NugetOptions[1] = "$PSScriptRoot\..\VisualC-WinRT\SDL2main-WinRT-NonXAML.nuspec" - &"$NugetPath" $NugetOptions - if ( ! $? ) { $DidAnyNugetBuildFail = $true } - } -} - - -# Let the script's caller know whether or not any errors occurred. -# Exit codes compatible with Buildbot are used (1 for error, 0 for success). -if ($DidAnyDLLBuildFail -eq $true) { - Write-Error -Message "Unable to build all known variants of SDL2 for WinRT" - exit 1 -} elseif ($DidAnyNugetBuildFail -eq $true) { - Write-Warning -Message "Unable to build NuGet packages" - exit 0 # Should NuGet package build failure lead to a non-failing result code instead? -} else { - exit 0 -} diff -Nru libsdl2-2.0.22+dfsg/cmake/macros.cmake libsdl2-2.24.0+dfsg/cmake/macros.cmake --- libsdl2-2.0.22+dfsg/cmake/macros.cmake 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/cmake/macros.cmake 2022-08-13 03:48:10.000000000 +0000 @@ -17,8 +17,8 @@ endmacro() macro(DEP_OPTION _NAME _DESC _DEFLT _DEPTEST _FAILDFLT) - add_to_alloptions(${_NAME}) - cmake_dependent_option(${_NAME} ${_DESC} ${_DEFLT} ${_DEPTEST} ${_FAILDFLT}) + add_to_alloptions("${_NAME}") + cmake_dependent_option("${_NAME}" "${_DESC}" "${_DEFLT}" "${_DEPTEST}" "${_FAILDFLT}") endmacro() macro(OPTION_STRING _NAME _DESC _VALUE) @@ -74,7 +74,7 @@ # Do not use string(REPLACE ";" " ") here to avoid messing up list # entries foreach(_ITEM ${${_LIST}}) - set(${_OUTPUT} "${_LPREFIX}${_ITEM} ${${_OUTPUT}}") + set(${_OUTPUT} "${${_OUTPUT}} ${_LPREFIX}${_ITEM}") endforeach() endmacro() @@ -88,7 +88,7 @@ # Do not use string(REPLACE ";" " ") here to avoid messing up list # entries foreach(_ITEM ${${_LIST}}) - set(${_OUTPUT} "${${_OUTPUT}} ${_LPREFIX}${_ITEM}") + set(${_OUTPUT} "${_LPREFIX}${_ITEM} ${${_OUTPUT}}") endforeach() endmacro() diff -Nru libsdl2-2.0.22+dfsg/cmake/sdlchecks.cmake libsdl2-2.24.0+dfsg/cmake/sdlchecks.cmake --- libsdl2-2.0.22+dfsg/cmake/sdlchecks.cmake 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/cmake/sdlchecks.cmake 2022-08-13 03:48:10.000000000 +0000 @@ -83,7 +83,7 @@ set(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H 1) endif() set(SDL_AUDIO_DRIVER_OSS 1) - set(SOURCE_FILES ${SOURCE_FILES} ${OSS_SOURCES}) + list(APPEND SOURCE_FILES ${OSS_SOURCES}) if(NETBSD OR OPENBSD) list(APPEND EXTRA_LIBS ossaudio) endif() @@ -106,13 +106,13 @@ if(HAVE_LIBASOUND) set(HAVE_ALSA TRUE) file(GLOB ALSA_SOURCES ${SDL2_SOURCE_DIR}/src/audio/alsa/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${ALSA_SOURCES}) + list(APPEND SOURCE_FILES ${ALSA_SOURCES}) set(SDL_AUDIO_DRIVER_ALSA 1) if(SDL_ALSA_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic ALSA loading") endif() - if(SDL_ALSA_SHARED AND HAVE_SDL_LOADSO) - FindLibraryAndSONAME("asound") + FindLibraryAndSONAME("asound") + if(SDL_ALSA_SHARED AND ASOUND_LIB AND HAVE_SDL_LOADSO) set(SDL_AUDIO_DRIVER_ALSA_DYNAMIC "\"${ASOUND_LIB_SONAME}\"") set(HAVE_ALSA_SHARED TRUE) else() @@ -134,14 +134,14 @@ if(PKG_PIPEWIRE_FOUND) set(HAVE_PIPEWIRE TRUE) file(GLOB PIPEWIRE_SOURCES ${SDL2_SOURCE_DIR}/src/audio/pipewire/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${PIPEWIRE_SOURCES}) + list(APPEND SOURCE_FILES ${PIPEWIRE_SOURCES}) set(SDL_AUDIO_DRIVER_PIPEWIRE 1) list(APPEND EXTRA_CFLAGS ${PKG_PIPEWIRE_CFLAGS}) if(SDL_PIPEWIRE_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic Pipewire loading") endif() - if(SDL_PIPEWIRE_SHARED AND HAVE_SDL_LOADSO) - FindLibraryAndSONAME("pipewire-0.3") + FindLibraryAndSONAME("pipewire-0.3") + if(SDL_PIPEWIRE_SHARED AND PIPEWIRE_0.3_LIB AND HAVE_SDL_LOADSO) set(SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC "\"${PIPEWIRE_0.3_LIB_SONAME}\"") set(HAVE_PIPEWIRE_SHARED TRUE) else() @@ -163,14 +163,14 @@ if(PKG_PULSEAUDIO_FOUND) set(HAVE_PULSEAUDIO TRUE) file(GLOB PULSEAUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/pulseaudio/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${PULSEAUDIO_SOURCES}) + list(APPEND SOURCE_FILES ${PULSEAUDIO_SOURCES}) set(SDL_AUDIO_DRIVER_PULSEAUDIO 1) list(APPEND EXTRA_CFLAGS ${PKG_PULSEAUDIO_CFLAGS}) if(SDL_PULSEAUDIO_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic PulseAudio loading") endif() - if(SDL_PULSEAUDIO_SHARED AND HAVE_SDL_LOADSO) - FindLibraryAndSONAME("pulse-simple") + FindLibraryAndSONAME("pulse-simple") + if(SDL_PULSEAUDIO_SHARED AND PULSE_SIMPLE_LIB AND HAVE_SDL_LOADSO) set(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC "\"${PULSE_SIMPLE_LIB_SONAME}\"") set(HAVE_PULSEAUDIO_SHARED TRUE) else() @@ -192,14 +192,14 @@ if(PKG_JACK_FOUND) set(HAVE_JACK TRUE) file(GLOB JACK_SOURCES ${SDL2_SOURCE_DIR}/src/audio/jack/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${JACK_SOURCES}) + list(APPEND SOURCE_FILES ${JACK_SOURCES}) set(SDL_AUDIO_DRIVER_JACK 1) list(APPEND EXTRA_CFLAGS ${PKG_JACK_CFLAGS}) if(SDL_JACK_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic JACK audio loading") endif() - if(SDL_JACK_SHARED AND HAVE_SDL_LOADSO) - FindLibraryAndSONAME("jack") + FindLibraryAndSONAME("jack") + if(SDL_JACK_SHARED AND JACK_LIB AND HAVE_SDL_LOADSO) set(SDL_AUDIO_DRIVER_JACK_DYNAMIC "\"${JACK_LIB_SONAME}\"") set(HAVE_JACK_SHARED TRUE) else() @@ -221,14 +221,14 @@ if(PKG_ESD_FOUND) set(HAVE_ESD TRUE) file(GLOB ESD_SOURCES ${SDL2_SOURCE_DIR}/src/audio/esd/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${ESD_SOURCES}) + list(APPEND SOURCE_FILES ${ESD_SOURCES}) set(SDL_AUDIO_DRIVER_ESD 1) list(APPEND EXTRA_CFLAGS ${PKG_ESD_CFLAGS}) if(SDL_ESD_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic ESD loading") endif() - if(SDL_ESD_SHARED AND HAVE_SDL_LOADSO) - FindLibraryAndSONAME(esd) + FindLibraryAndSONAME(esd) + if(SDL_ESD_SHARED AND ESD_LIB AND HAVE_SDL_LOADSO) set(SDL_AUDIO_DRIVER_ESD_DYNAMIC "\"${ESD_LIB_SONAME}\"") set(HAVE_ESD_SHARED TRUE) else() @@ -254,15 +254,15 @@ execute_process(CMD_ARTSLIBS ${ARTS_CONFIG} --libs OUTPUT_VARIABLE ARTS_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE) file(GLOB ARTS_SOURCES ${SDL2_SOURCE_DIR}/src/audio/arts/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${ARTS_SOURCES}) + list(APPEND SOURCE_FILES ${ARTS_SOURCES}) set(SDL_AUDIO_DRIVER_ARTS 1) set(HAVE_ARTS TRUE) if(SDL_ARTS_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic ARTS loading") endif() - if(SDL_ARTS_SHARED AND HAVE_SDL_LOADSO) + FindLibraryAndSONAME(artsc) + if(SDL_ARTS_SHARED AND ARTSC_LIB AND HAVE_SDL_LOADSO) # TODO - FindLibraryAndSONAME(artsc) set(SDL_AUDIO_DRIVER_ARTS_DYNAMIC "\"${ARTSC_LIB_SONAME}\"") set(HAVE_ARTS_SHARED TRUE) else() @@ -286,13 +286,13 @@ if(HAVE_NAS_H AND D_NAS_LIB) set(HAVE_NAS TRUE) file(GLOB NAS_SOURCES ${SDL2_SOURCE_DIR}/src/audio/nas/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${NAS_SOURCES}) + list(APPEND SOURCE_FILES ${NAS_SOURCES}) set(SDL_AUDIO_DRIVER_NAS 1) if(SDL_NAS_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic NAS loading") endif() - if(SDL_NAS_SHARED AND HAVE_SDL_LOADSO) - FindLibraryAndSONAME("audio") + FindLibraryAndSONAME("audio") + if(SDL_NAS_SHARED AND AUDIO_LIB AND HAVE_SDL_LOADSO) set(SDL_AUDIO_DRIVER_NAS_DYNAMIC "\"${AUDIO_LIB_SONAME}\"") set(HAVE_NAS_SHARED TRUE) else() @@ -316,13 +316,13 @@ if(HAVE_SNDIO_H AND D_SNDIO_LIB) set(HAVE_SNDIO TRUE) file(GLOB SNDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/sndio/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${SNDIO_SOURCES}) + list(APPEND SOURCE_FILES ${SNDIO_SOURCES}) set(SDL_AUDIO_DRIVER_SNDIO 1) if(SDL_SNDIO_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic sndio loading") endif() - if(SDL_SNDIO_SHARED AND HAVE_SDL_LOADSO) - FindLibraryAndSONAME("sndio") + FindLibraryAndSONAME("sndio") + if(SDL_SNDIO_SHARED AND SNDIO_LIB AND HAVE_SDL_LOADSO) set(SDL_AUDIO_DRIVER_SNDIO_DYNAMIC "\"${SNDIO_LIB_SONAME}\"") set(HAVE_SNDIO_SHARED TRUE) else() @@ -344,14 +344,14 @@ if(PKG_FUSIONSOUND_FOUND) set(HAVE_FUSIONSOUND TRUE) file(GLOB FUSIONSOUND_SOURCES ${SDL2_SOURCE_DIR}/src/audio/fusionsound/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${FUSIONSOUND_SOURCES}) + list(APPEND SOURCE_FILES ${FUSIONSOUND_SOURCES}) set(SDL_AUDIO_DRIVER_FUSIONSOUND 1) list(APPEND EXTRA_CFLAGS ${PKG_FUSIONSOUND_CFLAGS}) if(FUSIONSOUND_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic FusionSound loading") endif() - if(FUSIONSOUND_SHARED AND HAVE_SDL_LOADSO) - FindLibraryAndSONAME("fusionsound") + FindLibraryAndSONAME("fusionsound") + if(FUSIONSOUND_SHARED AND FUSIONSOUND_LIB AND HAVE_SDL_LOADSO) set(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "\"${FUSIONSOUND_LIB_SONAME}\"") set(HAVE_FUSIONSOUND_SHARED TRUE) else() @@ -369,18 +369,43 @@ # - HAVE_SDL_LOADSO opt macro(CheckLibSampleRate) if(SDL_LIBSAMPLERATE) - check_include_file(samplerate.h HAVE_LIBSAMPLERATE_H) - if(HAVE_LIBSAMPLERATE_H) + find_package(SampleRate QUIET) + if(SampleRate_FOUND AND TARGET SampleRate::samplerate) set(HAVE_LIBSAMPLERATE TRUE) - if(SDL_LIBSAMPLERATE_SHARED AND NOT HAVE_SDL_LOADSO) - message_warn("You must have SDL_LoadObject() support for dynamic libsamplerate loading") + set(HAVE_LIBSAMPLERATE_H TRUE) + if(SDL_LIBSAMPLERATE_SHARED) + target_include_directories(sdl-build-options INTERFACE $) + if(NOT HAVE_SDL_LOADSO) + message_warn("You must have SDL_LoadObject() support for dynamic libsamplerate loading") + else() + get_property(_samplerate_type TARGET SampleRate::samplerate PROPERTY TYPE) + if(_samplerate_type STREQUAL "SHARED_LIBRARY") + set(HAVE_LIBSAMPLERATE_SHARED TRUE) + if(WIN32 OR OS2) + set(SDL_LIBSAMPLERATE_DYNAMIC "\"$\"") + else() + set(SDL_LIBSAMPLERATE_DYNAMIC "\"$\"") + endif() + endif() + endif() + else() + target_link_libraries(sdl-build-options INTERFACE SampleRate::samplerate) + list(APPEND SDL_REQUIRES_PRIVATE SampleRate::samplerate) endif() - if(SDL_LIBSAMPLERATE_SHARED AND HAVE_SDL_LOADSO) + else() + check_include_file(samplerate.h HAVE_LIBSAMPLERATE_H) + if(HAVE_LIBSAMPLERATE_H) + set(HAVE_LIBSAMPLERATE TRUE) + if(SDL_LIBSAMPLERATE_SHARED AND NOT HAVE_SDL_LOADSO) + message_warn("You must have SDL_LoadObject() support for dynamic libsamplerate loading") + endif() FindLibraryAndSONAME("samplerate") - set(SDL_LIBSAMPLERATE_DYNAMIC "\"${SAMPLERATE_LIB_SONAME}\"") - set(HAVE_LIBSAMPLERATE_SHARED TRUE) - else() - list(APPEND EXTRA_LDFLAGS -lsamplerate) + if(SDL_LIBSAMPLERATE_SHARED AND SAMPLERATE_LIB AND HAVE_SDL_LOADSO) + set(SDL_LIBSAMPLERATE_DYNAMIC "\"${SAMPLERATE_LIB_SONAME}\"") + set(HAVE_LIBSAMPLERATE_SHARED TRUE) + else() + list(APPEND EXTRA_LDFLAGS -lsamplerate) + endif() endif() endif() endif() @@ -393,11 +418,14 @@ # - HAVE_SDL_LOADSO opt macro(CheckX11) if(SDL_X11) - foreach(_LIB X11 Xext Xcursor Xinerama Xi Xfixes Xrandr Xrender Xss Xxf86vm) + foreach(_LIB X11 Xext Xcursor Xi Xfixes Xrandr Xrender Xss) FindLibraryAndSONAME("${_LIB}") endforeach() - find_path(X_INCLUDEDIR X11/Xlib.h + set(X11_dirs) + find_path(X_INCLUDEDIR + NAMES X11/Xlib.h + PATHS /usr/pkg/xorg/include /usr/X11R6/include /usr/X11R7/include @@ -411,20 +439,17 @@ if(X_INCLUDEDIR) list(APPEND EXTRA_CFLAGS "-I${X_INCLUDEDIR}") - list(APPEND CMAKE_REQUIRED_INCLUDES "${X_INCLUDEDIR}") endif() - check_include_file(X11/Xcursor/Xcursor.h HAVE_XCURSOR_H) - check_include_file(X11/extensions/Xinerama.h HAVE_XINERAMA_H) - check_include_file(X11/extensions/XInput2.h HAVE_XINPUT2_H) - check_include_file(X11/extensions/Xrandr.h HAVE_XRANDR_H) - check_include_file(X11/extensions/Xfixes.h HAVE_XFIXES_H_) - check_include_file(X11/extensions/Xrender.h HAVE_XRENDER_H) - check_include_file(X11/extensions/scrnsaver.h HAVE_XSS_H) - check_include_file(X11/extensions/shape.h HAVE_XSHAPE_H) - check_include_files("X11/Xlib.h;X11/extensions/Xdbe.h" HAVE_XDBE_H) - check_include_files("X11/Xlib.h;X11/extensions/xf86vmode.h" HAVE_XF86VM_H) - check_include_files("X11/Xlib.h;X11/Xproto.h;X11/extensions/Xext.h" HAVE_XEXT_H) + find_file(HAVE_XCURSOR_H NAMES "X11/Xcursor/Xcursor.h" HINTS "${X_INCLUDEDIR}") + find_file(HAVE_XINPUT2_H NAMES "X11/extensions/XInput2.h" HINTS "${X_INCLUDEDIR}") + find_file(HAVE_XRANDR_H NAMES "X11/extensions/Xrandr.h" HINTS "${X_INCLUDEDIR}") + find_file(HAVE_XFIXES_H_ NAMES "X11/extensions/Xfixes.h" HINTS "${X_INCLUDEDIR}") + find_file(HAVE_XRENDER_H NAMES "X11/extensions/Xrender.h" HINTS "${X_INCLUDEDIR}") + find_file(HAVE_XSS_H NAMES "X11/extensions/scrnsaver.h" HINTS "${X_INCLUDEDIR}") + find_file(HAVE_XSHAPE_H NAMES "X11/extensions/shape.h" HINTS "${X_INCLUDEDIR}") + find_file(HAVE_XDBE_H NAMES "X11/extensions/Xdbe.h" HINTS "${X_INCLUDEDIR}") + find_file(HAVE_XEXT_H NAMES "X11/extensions/Xext.h" HINTS "${X_INCLUDEDIR}") if(X11_LIB) if(NOT HAVE_XEXT_H) @@ -435,7 +460,7 @@ set(HAVE_SDL_VIDEO TRUE) file(GLOB X11_SOURCES ${SDL2_SOURCE_DIR}/src/video/x11/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${X11_SOURCES}) + list(APPEND SOURCE_FILES ${X11_SOURCES}) set(SDL_VIDEO_DRIVER_X11 1) # !!! FIXME: why is this disabled for Apple? @@ -461,11 +486,19 @@ else() set(HAVE_X11_SHARED TRUE) endif() - if(HAVE_X11_SHARED) - set(SDL_VIDEO_DRIVER_X11_DYNAMIC "\"${X11_LIB_SONAME}\"") - set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "\"${XEXT_LIB_SONAME}\"") - else() - list(APPEND EXTRA_LIBS ${X11_LIB} ${XEXT_LIB}) + if(X11_LIB) + if(HAVE_X11_SHARED) + set(SDL_VIDEO_DRIVER_X11_DYNAMIC "\"${X11_LIB_SONAME}\"") + else() + list(APPEND EXTRA_LIBS ${X11_LIB}) + endif() + endif() + if(XEXT_LIB) + if(HAVE_X11_SHARED) + set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "\"${XEXT_LIB_SONAME}\"") + else() + list(APPEND EXTRA_LIBS ${XEXT_LIB_SONAME}) + endif() endif() else() list(APPEND EXTRA_LIBS ${X11_LIB} ${XEXT_LIB}) @@ -489,9 +522,9 @@ check_symbol_exists(XkbKeycodeToKeysym "X11/Xlib.h;X11/XKBlib.h" SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM) - if(SDL_X11_XCURSOR AND HAVE_XCURSOR_H) + if(SDL_X11_XCURSOR AND HAVE_XCURSOR_H AND XCURSOR_LIB) set(HAVE_X11_XCURSOR TRUE) - if(HAVE_X11_SHARED AND XCURSOR_LIB) + if(HAVE_X11_SHARED) set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR "\"${XCURSOR_LIB_SONAME}\"") else() list(APPEND EXTRA_LIBS ${XCURSOR_LIB}) @@ -504,19 +537,9 @@ set(SDL_VIDEO_DRIVER_X11_XDBE 1) endif() - if(SDL_X11_XINERAMA AND HAVE_XINERAMA_H) - set(HAVE_X11_XINERAMA TRUE) - if(HAVE_X11_SHARED AND XINERAMA_LIB) - set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "\"${XINERAMA_LIB_SONAME}\"") - else() - list(APPEND EXTRA_LIBS ${XINERAMA_LIB}) - endif() - set(SDL_VIDEO_DRIVER_X11_XINERAMA 1) - endif() - - if(SDL_X11_XINPUT AND HAVE_XINPUT2_H) + if(SDL_X11_XINPUT AND HAVE_XINPUT2_H AND XI_LIB) set(HAVE_X11_XINPUT TRUE) - if(HAVE_X11_SHARED AND XI_LIB) + if(HAVE_X11_SHARED) set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "\"${XI_LIB_SONAME}\"") else() list(APPEND EXTRA_LIBS ${XI_LIB}) @@ -549,8 +572,8 @@ BarrierEventID b; int main(int argc, char **argv) { return 0; }" HAVE_XFIXES_H) endif() - if(SDL_X11_XFIXES AND HAVE_XFIXES_H AND HAVE_XINPUT2_H) - if(HAVE_X11_SHARED AND XFIXES_LIB) + if(SDL_X11_XFIXES AND HAVE_XFIXES_H AND HAVE_XINPUT2_H AND XFIXES_LIB) + if(HAVE_X11_SHARED) set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES "\"${XFIXES_LIB_SONAME}\"") else() list(APPEND EXTRA_LIBS ${XFIXES_LIB}) @@ -559,8 +582,8 @@ set(HAVE_X11_XFIXES TRUE) endif() - if(SDL_X11_XRANDR AND HAVE_XRANDR_H) - if(HAVE_X11_SHARED AND XRANDR_LIB) + if(SDL_X11_XRANDR AND HAVE_XRANDR_H AND XRANDR_LIB) + if(HAVE_X11_SHARED) set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "\"${XRANDR_LIB_SONAME}\"") else() list(APPEND EXTRA_LIBS ${XRANDR_LIB}) @@ -569,8 +592,8 @@ set(HAVE_X11_XRANDR TRUE) endif() - if(SDL_X11_XSCRNSAVER AND HAVE_XSS_H) - if(HAVE_X11_SHARED AND XSS_LIB) + if(SDL_X11_XSCRNSAVER AND HAVE_XSS_H AND XSS_LIB) + if(HAVE_X11_SHARED) set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "\"${XSS_LIB_SONAME}\"") else() list(APPEND EXTRA_LIBS ${XSS_LIB}) @@ -584,16 +607,6 @@ set(HAVE_X11_XSHAPE TRUE) endif() - if(SDL_X11_XVM AND HAVE_XF86VM_H) - if(HAVE_X11_SHARED AND XXF86VM_LIB) - set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "\"${XXF86VM_LIB_SONAME}\"") - else() - list(APPEND EXTRA_LIBS ${XXF86VM_LIB}) - endif() - set(SDL_VIDEO_DRIVER_X11_XVIDMODE 1) - set(HAVE_X11_XVM TRUE) - endif() - set(CMAKE_REQUIRED_LIBRARIES) endif() endif() @@ -621,7 +634,8 @@ ARGS "${_CODE_MODE}" "${_XML}" "${_WAYLAND_PROT_C_CODE}" ) - set(SOURCE_FILES ${SOURCE_FILES} "${_WAYLAND_PROT_C_CODE}") + list(APPEND SDL_GENERATED_HEADERS "${_WAYLAND_PROT_H_CODE}") + list(APPEND SOURCE_FILES "${_WAYLAND_PROT_C_CODE}") endmacro() # Requires: @@ -664,7 +678,7 @@ set(HAVE_SDL_VIDEO TRUE) file(GLOB WAYLAND_SOURCES ${SDL2_SOURCE_DIR}/src/video/wayland/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${WAYLAND_SOURCES}) + list(APPEND SOURCE_FILES ${WAYLAND_SOURCES}) # We have to generate some protocol interface code for some unstable Wayland features. file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols") @@ -684,18 +698,18 @@ if(SDL_WAYLAND_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic Wayland loading") endif() - if(SDL_WAYLAND_SHARED AND HAVE_SDL_LOADSO) - FindLibraryAndSONAME(wayland-client) - FindLibraryAndSONAME(wayland-egl) - FindLibraryAndSONAME(wayland-cursor) - FindLibraryAndSONAME(xkbcommon) + FindLibraryAndSONAME(wayland-client) + FindLibraryAndSONAME(wayland-egl) + FindLibraryAndSONAME(wayland-cursor) + FindLibraryAndSONAME(xkbcommon) + if(SDL_WAYLAND_SHARED AND WAYLAND_CLIENT_LIB AND WAYLAND_EGL_LIB AND WAYLAND_CURSOR_LIB AND XKBCOMMON_LIB AND HAVE_SDL_LOADSO) set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC "\"${WAYLAND_CLIENT_LIB_SONAME}\"") set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL "\"${WAYLAND_EGL_LIB_SONAME}\"") set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR "\"${WAYLAND_CURSOR_LIB_SONAME}\"") set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON "\"${XKBCOMMON_LIB_SONAME}\"") set(HAVE_WAYLAND_SHARED TRUE) else() - set(EXTRA_LIBS ${WAYLAND_LIBRARIES} ${EXTRA_LIBS}) + list(APPEND EXTRA_LIBS ${WAYLAND_LIBRARIES}) endif() if(SDL_WAYLAND_LIBDECOR) @@ -708,12 +722,12 @@ if(SDL_WAYLAND_LIBDECOR_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic libdecor loading") endif() - if(SDL_WAYLAND_LIBDECOR_SHARED AND HAVE_SDL_LOADSO) + FindLibraryAndSONAME(decor-0) + if(SDL_WAYLAND_LIBDECOR_SHARED AND DECOR_0_LIB AND HAVE_SDL_LOADSO) set(HAVE_LIBDECOR_SHARED TRUE) - FindLibraryAndSONAME(decor-0) set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR "\"${DECOR_0_LIB_SONAME}\"") else() - set(EXTRA_LIBS ${LIBDECOR_LIBRARIES} ${EXTRA_LIBS}) + list(APPEND EXTRA_LIBS ${LIBDECOR_LIBRARIES}) endif() endif() endif() @@ -733,8 +747,7 @@ endif() if(HAVE_COCOA) file(GLOB COCOA_SOURCES ${SDL2_SOURCE_DIR}/src/video/cocoa/*.m) - set_source_files_properties(${COCOA_SOURCES} PROPERTIES LANGUAGE C) - set(SOURCE_FILES ${SOURCE_FILES} ${COCOA_SOURCES}) + list(APPEND SOURCE_FILES ${COCOA_SOURCES}) set(SDL_VIDEO_DRIVER_COCOA 1) set(HAVE_SDL_VIDEO TRUE) endif() @@ -752,15 +765,16 @@ if(PKG_DIRECTFB_FOUND) set(HAVE_DIRECTFB TRUE) file(GLOB DIRECTFB_SOURCES ${SDL2_SOURCE_DIR}/src/video/directfb/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${DIRECTFB_SOURCES}) + list(APPEND SOURCE_FILES ${DIRECTFB_SOURCES}) set(SDL_VIDEO_DRIVER_DIRECTFB 1) set(SDL_VIDEO_RENDER_DIRECTFB 1) list(APPEND EXTRA_CFLAGS ${PKG_DIRECTFB_CFLAGS}) + list(APPEND SDL_CFLAGS ${PKG_DIRECTFB_CFLAGS}) if(SDL_DIRECTFB_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic DirectFB loading") endif() - if(SDL_DIRECTFB_SHARED AND HAVE_SDL_LOADSO) - FindLibraryAndSONAME("directfb") + FindLibraryAndSONAME("directfb") + if(SDL_DIRECTFB_SHARED AND DIRECTFB_LIB AND HAVE_SDL_LOADSO) set(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC "\"${DIRECTFB_LIB_SONAME}\"") set(HAVE_DIRECTFB_SHARED TRUE) else() @@ -788,7 +802,7 @@ set(HAVE_SDL_VIDEO TRUE) file(GLOB VIVANTE_SOURCES ${SDL2_SOURCE_DIR}/src/video/vivante/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${VIVANTE_SOURCES}) + list(APPEND SOURCE_FILES ${VIVANTE_SOURCES}) set(SDL_VIDEO_DRIVER_VIVANTE 1) if(HAVE_VIVANTE_VDK) set(SDL_VIDEO_DRIVER_VIVANTE_VDK 1) @@ -796,7 +810,7 @@ find_library(VIVANTE_VDK_LIBRARY VDK REQUIRED) list(APPEND EXTRA_LIBS ${VIVANTE_LIBRARY} ${VIVANTE_VDK_LIBRARY}) else() - set(SDL_CFLAGS "${SDL_CFLAGS} -DLINUX -DEGL_API_FB") + list(APPEND SDL_CFLAGS -DLINUX -DEGL_API_FB) list(APPEND EXTRA_LIBS EGL) endif(HAVE_VIVANTE_VDK) endif() @@ -944,8 +958,7 @@ set(SDL_THREAD_PTHREAD 1) list(APPEND EXTRA_CFLAGS ${PTHREAD_CFLAGS}) list(APPEND EXTRA_LDFLAGS ${PTHREAD_LDFLAGS}) - set(SDL_CFLAGS "${SDL_CFLAGS} ${PTHREAD_CFLAGS}") - list(APPEND SDL_LIBS ${PTHREAD_LDFLAGS}) + list(APPEND SDL_CFLAGS ${PTHREAD_CFLAGS}) check_c_source_compiles(" #define _GNU_SOURCE 1 @@ -1150,7 +1163,7 @@ endif() set(SDL_JOYSTICK_USBHID 1) file(GLOB BSD_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/bsd/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${BSD_JOYSTICK_SOURCES}) + list(APPEND SOURCE_FILES ${BSD_JOYSTICK_SOURCES}) list(APPEND EXTRA_CFLAGS ${USB_CFLAGS}) list(APPEND EXTRA_LIBS ${USB_LIBS}) set(HAVE_SDL_JOYSTICK TRUE) @@ -1163,47 +1176,53 @@ # Check for HIDAPI support macro(CheckHIDAPI) set(HAVE_HIDAPI TRUE) - if(NOT HIDAPI_SKIP_LIBUSB) - set(HAVE_LIBUSB FALSE) - pkg_check_modules(LIBUSB libusb-1.0) - if (LIBUSB_FOUND) - check_include_file(libusb.h HAVE_LIBUSB_H ${LIBUSB_CFLAGS}) - if(HAVE_LIBUSB_H) - set(HAVE_LIBUSB TRUE) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBUSB_CFLAGS}") - if(HIDAPI_ONLY_LIBUSB) - list(APPEND EXTRA_LIBS ${LIBUSB_LIBS}) - elseif(OS2) - set(SDL_LIBUSB_DYNAMIC "\"usb100.dll\"") - else() - # libusb is loaded dynamically, so don't add it to EXTRA_LIBS - FindLibraryAndSONAME("usb-1.0") - set(SDL_LIBUSB_DYNAMIC "\"${USB_1.0_LIB_SONAME}\"") + if(SDL_HIDAPI) + if(SDL_HIDAPI_LIBUSB) + set(HAVE_LIBUSB FALSE) + pkg_check_modules(LIBUSB libusb-1.0) + if(LIBUSB_FOUND) + check_include_file(libusb.h HAVE_LIBUSB_H ${LIBUSB_CFLAGS}) + if(HAVE_LIBUSB_H) + set(HAVE_LIBUSB TRUE) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBUSB_CFLAGS}") + if(HIDAPI_ONLY_LIBUSB) + list(APPEND EXTRA_LIBS ${LIBUSB_LIBS}) + elseif(OS2) + set(SDL_LIBUSB_DYNAMIC "\"usb100.dll\"") + else() + # libusb is loaded dynamically, so don't add it to EXTRA_LIBS + FindLibraryAndSONAME("usb-1.0") + if(USB_1.0_LIB) + set(SDL_LIBUSB_DYNAMIC "\"${USB_1.0_LIB_SONAME}\"") + endif() + endif() endif() endif() + if(HIDAPI_ONLY_LIBUSB AND NOT HAVE_LIBUSB) + set(HAVE_HIDAPI FALSE) + endif() endif() - if(HIDAPI_ONLY_LIBUSB AND NOT HAVE_LIBUSB) - set(HAVE_HIDAPI FALSE) - endif() - endif() - if(HAVE_HIDAPI) - if(ANDROID) - set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/hidapi/android/hid.cpp) - endif() - if(IOS OR TVOS) - set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/hidapi/ios/hid.m) - set(SDL_FRAMEWORK_COREBLUETOOTH 1) - endif() - set(HAVE_SDL_HIDAPI TRUE) - - if(SDL_JOYSTICK AND SDL_HIDAPI_JOYSTICK) - set(SDL_JOYSTICK_HIDAPI 1) - set(HAVE_SDL_JOYSTICK TRUE) - set(HAVE_HIDAPI_JOYSTICK TRUE) - file(GLOB HIDAPI_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/hidapi/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${HIDAPI_JOYSTICK_SOURCES}) + if(HAVE_HIDAPI) + if(ANDROID) + list(APPEND SOURCE_FILES ${SDL2_SOURCE_DIR}/src/hidapi/android/hid.cpp) + endif() + if(IOS OR TVOS) + list(APPEND SOURCE_FILES ${SDL2_SOURCE_DIR}/src/hidapi/ios/hid.m) + set(SDL_FRAMEWORK_COREBLUETOOTH 1) + endif() + set(HAVE_SDL_HIDAPI TRUE) + + if(SDL_JOYSTICK AND SDL_HIDAPI_JOYSTICK) + set(SDL_JOYSTICK_HIDAPI 1) + set(HAVE_SDL_JOYSTICK TRUE) + set(HAVE_HIDAPI_JOYSTICK TRUE) + file(GLOB HIDAPI_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/hidapi/*.c) + list(APPEND SOURCE_FILES ${HIDAPI_JOYSTICK_SOURCES}) + endif() endif() + else() + set(SDL_HIDAPI_DISABLED 1) endif() endmacro() @@ -1238,7 +1257,7 @@ set(HAVE_SDL_VIDEO TRUE) set(SDL_VIDEO_DRIVER_RPI 1) file(GLOB VIDEO_RPI_SOURCES ${SDL2_SOURCE_DIR}/src/video/raspberry/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${VIDEO_RPI_SOURCES}) + list(APPEND SOURCE_FILES ${VIDEO_RPI_SOURCES}) list(APPEND EXTRA_LIBS ${VIDEO_RPI_LIBRARIES}) # !!! FIXME: shouldn't be using CMAKE_C_FLAGS, right? set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}") @@ -1265,7 +1284,7 @@ set(HAVE_SDL_VIDEO TRUE) file(GLOB KMSDRM_SOURCES ${SDL2_SOURCE_DIR}/src/video/kmsdrm/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${KMSDRM_SOURCES}) + list(APPEND SOURCE_FILES ${KMSDRM_SOURCES}) list(APPEND EXTRA_CFLAGS ${KMSDRM_CFLAGS}) @@ -1281,7 +1300,7 @@ set(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM "\"${GBM_LIB_SONAME}\"") set(HAVE_KMSDRM_SHARED TRUE) else() - set(EXTRA_LIBS ${KMSDRM_LIBRARIES} ${EXTRA_LIBS}) + list(APPEND EXTRA_LIBS ${KMSDRM_LIBRARIES}) endif() endif() endif() diff -Nru libsdl2-2.0.22+dfsg/cmake/test/CMakeLists.txt libsdl2-2.24.0+dfsg/cmake/test/CMakeLists.txt --- libsdl2-2.0.22+dfsg/cmake/test/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/cmake/test/CMakeLists.txt 2022-06-16 20:16:31.000000000 +0000 @@ -0,0 +1,100 @@ +# This cmake build script is meant for verifying the various CMake configuration script. + +cmake_minimum_required(VERSION 3.12) +project(sdl_test LANGUAGES C) + +if(ANDROID) + macro(add_executable NAME) + set(args ${ARGN}) + list(REMOVE_ITEM args WIN32) + add_library(${NAME} SHARED ${args}) + unset(args) + endmacro() +endif() + +cmake_policy(SET CMP0074 NEW) + +# Override CMAKE_FIND_ROOT_PATH_MODE to allow search for SDL2 outside of sysroot +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE NEVER) + +include(FeatureSummary) + +option(TEST_SHARED "Test linking to shared SDL2 library" ON) +add_feature_info("TEST_SHARED" TEST_SHARED "Test linking with shared library") + +option(TEST_STATIC "Test linking to static SDL2 libary" ON) +add_feature_info("TEST_STATIC" TEST_STATIC "Test linking with static library") + +if(TEST_SHARED) + find_package(SDL2 REQUIRED CONFIG COMPONENTS SDL2) + if(EMSCRIPTEN OR (WIN32 AND NOT WINDOWS_STORE)) + find_package(SDL2 REQUIRED CONFIG COMPONENTS SDL2main) + endif() + add_executable(gui-shared WIN32 main_gui.c) + if(TARGET SDL2::SDL2main) + target_link_libraries(gui-shared PRIVATE SDL2::SDL2main) + endif() + target_link_libraries(gui-shared PRIVATE SDL2::SDL2) + if(WIN32) + add_custom_command(TARGET gui-shared POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" + ) + endif() + + add_executable(gui-shared-vars WIN32 main_gui.c) + target_link_libraries(gui-shared-vars PRIVATE ${SDL2_LIBRARIES}) + target_include_directories(gui-shared-vars PRIVATE ${SDL2_INCLUDE_DIRS}) + + add_executable(cli-shared main_cli.c) + target_link_libraries(cli-shared PRIVATE SDL2::SDL2) + if(WIN32) + add_custom_command(TARGET cli-shared POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" + ) + endif() + + # SDL2_LIBRARIES does not support creating a cli SDL2 application + # (it is possible that SDL2main is a stub, but we don't know for sure) + if(NOT TARGET SDL2::SDL2main) + add_executable(cli-shared-vars main_cli.c) + target_link_libraries(cli-shared-vars PRIVATE ${SDL2_LIBRARIES}) + target_include_directories(cli-shared-vars PRIVATE ${SDL2_INCLUDE_DIRS}) + endif() +endif() + +if(TEST_STATIC) + find_package(SDL2 REQUIRED CONFIG COMPONENTS SDL2-static) + if(EMSCRIPTEN OR (WIN32 AND NOT WINDOWS_STORE)) + find_package(SDL2 REQUIRED CONFIG COMPONENTS SDL2main) + endif() + add_executable(gui-static WIN32 main_gui.c) + if(TARGET SDL2::SDL2main) + target_link_libraries(gui-static PRIVATE SDL2::SDL2main) + endif() + target_link_libraries(gui-static PRIVATE SDL2::SDL2-static) + + add_executable(gui-static-vars WIN32 main_gui.c) + target_link_libraries(gui-static-vars PRIVATE ${SDL2MAIN_LIBRARY} ${SDL2_STATIC_LIBRARIES}) + target_include_directories(gui-static-vars PRIVATE ${SDL2_INCLUDE_DIRS}) + + add_executable(cli-static main_cli.c) + target_link_libraries(cli-static PRIVATE SDL2::SDL2-static) + + # SDL2_LIBRARIES does not support creating a cli SDL2 application (when SDL2::SDL2main is available) + # (it is possible that SDL2main is a stub, but we don't know for sure) + if(NOT TARGET SDL2::SDL2main) + add_executable(cli-static-vars main_cli.c) + target_link_libraries(cli-static-vars PRIVATE ${SDL2_STATIC_LIBRARIES}) + target_include_directories(cli-static-vars PRIVATE ${SDL2_INCLUDE_DIRS}) + endif() +endif() + +message(STATUS "SDL2_PREFIX: ${SDL2_PREFIX}") +message(STATUS "SDL2_INCLUDE_DIR: ${SDL2_INCLUDE_DIR}") +message(STATUS "SDL2_INCLUDE_DIRS: ${SDL2_INCLUDE_DIRS}") +message(STATUS "SDL2_LIBRARIES: ${SDL2_LIBRARIES}") +message(STATUS "SDL2_STATIC_LIBRARIES: ${SDL2_STATIC_LIBRARIES}") +message(STATUS "SDL2MAIN_LIBRARY: ${SDL2MAIN_LIBRARY}") +message(STATUS "SDL2TEST_LIBRARY: ${SDL2TEST_LIBRARY}") + +feature_summary(WHAT ALL) diff -Nru libsdl2-2.0.22+dfsg/cmake/test/main_cli.c libsdl2-2.24.0+dfsg/cmake/test/main_cli.c --- libsdl2-2.0.22+dfsg/cmake/test/main_cli.c 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/cmake/test/main_cli.c 2022-06-03 19:42:12.000000000 +0000 @@ -0,0 +1,14 @@ +#define SDL_MAIN_HANDLED +#include "SDL.h" +#include + +int main(int argc, char *argv[]) { + SDL_SetMainReady(); + if (SDL_Init(0) < 0) { + fprintf(stderr, "could not initialize sdl2: %s\n", SDL_GetError()); + return 1; + } + SDL_Delay(100); + SDL_Quit(); + return 0; +} diff -Nru libsdl2-2.0.22+dfsg/cmake/test/main_gui.c libsdl2-2.24.0+dfsg/cmake/test/main_gui.c --- libsdl2-2.0.22+dfsg/cmake/test/main_gui.c 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/cmake/test/main_gui.c 2022-06-03 19:42:12.000000000 +0000 @@ -0,0 +1,28 @@ +#include "SDL.h" +#include + +int main(int argc, char *argv[]) { + SDL_Window *window = NULL; + SDL_Surface *screenSurface = NULL; + if (SDL_Init(SDL_INIT_VIDEO) < 0) { + fprintf(stderr, "could not initialize sdl2: %s\n", SDL_GetError()); + return 1; + } + window = SDL_CreateWindow( + "hello_sdl2", + SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, + 640, 480, + SDL_WINDOW_SHOWN + ); + if (window == NULL) { + fprintf(stderr, "could not create window: %s\n", SDL_GetError()); + return 1; + } + screenSurface = SDL_GetWindowSurface(window); + SDL_FillRect(screenSurface, NULL, SDL_MapRGB(screenSurface->format, 0xff, 0xff, 0xff)); + SDL_UpdateWindowSurface(window); + SDL_Delay(100); + SDL_DestroyWindow(window); + SDL_Quit(); + return 0; +} diff -Nru libsdl2-2.0.22+dfsg/cmake/test/test_pkgconfig.sh libsdl2-2.24.0+dfsg/cmake/test/test_pkgconfig.sh --- libsdl2-2.0.22+dfsg/cmake/test/test_pkgconfig.sh 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/cmake/test/test_pkgconfig.sh 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,51 @@ +#!/bin/sh + +if test "x$CC" = "x"; then + CC=cc +fi + +machine="$($CC -dumpmachine)" +case "$machine" in + *mingw* ) + EXEPREFIX="" + EXESUFFIX=".exe" + ;; + *android* ) + EXEPREFIX="lib" + EXESUFFIX=".so" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -shared" + ;; + * ) + EXEPREFIX="" + EXESUFFIX="" + ;; +esac + +set -e + +# Get the canonical path of the folder containing this script +testdir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)") +CFLAGS="$( pkg-config sdl2 --cflags )" +LDFLAGS="$( pkg-config sdl2 --libs )" +STATIC_LDFLAGS="$( pkg-config sdl2 --libs --static )" + +compile_cmd="$CC -c "$testdir/main_gui.c" -o main_gui_pkgconfig.c.o $CFLAGS $EXTRA_CFLAGS" +link_cmd="$CC main_gui_pkgconfig.c.o -o ${EXEPREFIX}main_gui_pkgconfig${EXESUFFIX} $LDFLAGS $EXTRA_LDFLAGS" +static_link_cmd="$CC main_gui_pkgconfig.c.o -o ${EXEPREFIX}main_gui_pkgconfig_static${EXESUFFIX} $STATIC_LDFLAGS $EXTRA_LDFLAGS" + +echo "-- CC: $CC" +echo "-- CFLAGS: $CFLAGS" +echo "-- EXTRA_CFLAGS: $EXTRA_CFLAGS" +echo "-- LDFLASG: $LDFLAGS" +echo "-- STATIC_LDFLAGS: $STATIC_LDFLAGS" +echo "-- EXTRA_LDFLAGS: $EXTRA_LDFLAGS" + +echo "-- COMPILE: $compile_cmd" +echo "-- LINK: $link_cmd" +echo "-- STATIC_LINK: $static_link_cmd" + +set -x + +$compile_cmd +$link_cmd +$static_link_cmd diff -Nru libsdl2-2.0.22+dfsg/cmake/test/test_sdlconfig.sh libsdl2-2.24.0+dfsg/cmake/test/test_sdlconfig.sh --- libsdl2-2.0.22+dfsg/cmake/test/test_sdlconfig.sh 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/cmake/test/test_sdlconfig.sh 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,51 @@ +#!/bin/sh + +if test "x$CC" = "x"; then + CC=cc +fi + +machine="$($CC -dumpmachine)" +case "$machine" in + *mingw* ) + EXEPREFIX="" + EXESUFFIX=".exe" + ;; + *android* ) + EXEPREFIX="lib" + EXESUFFIX=".so" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -shared" + ;; + * ) + EXEPREFIX="" + EXESUFFIX="" + ;; +esac + +set -e + +# Get the canonical path of the folder containing this script +testdir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)") +CFLAGS="$( sdl2-config --cflags )" +LDFLAGS="$( sdl2-config --libs )" +STATIC_LDFLAGS="$( sdl2-config --static-libs )" + +compile_cmd="$CC -c "$testdir/main_gui.c" -o main_gui_sdlconfig.c.o $CFLAGS $EXTRA_CFLAGS" +link_cmd="$CC main_gui_sdlconfig.c.o -o ${EXEPREFIX}main_gui_sdlconfig${EXESUFFIX} $LDFLAGS $EXTRA_LDFLAGS" +static_link_cmd="$CC main_gui_sdlconfig.c.o -o ${EXEPREFIX}main_gui_sdlconfig_static${EXESUFFIX} $STATIC_LDFLAGS $EXTRA_LDFLAGS" + +echo "-- CC: $CC" +echo "-- CFLAGS: $CFLAGS" +echo "-- EXTRA_CFLAGS: $EXTRA_CFLAGS" +echo "-- LDFLAGS: $LDFLAGS" +echo "-- STATIC_LDFLAGS: $STATIC_LDFLAGS" +echo "-- EXTRA_LDFLAGS: $EXTRA_LDFLAGS" + +echo "-- COMPILE: $compile_cmd" +echo "-- LINK: $link_cmd" +echo "-- STATIC_LINK: $static_link_cmd" + +set -x + +$compile_cmd +$link_cmd +$static_link_cmd diff -Nru libsdl2-2.0.22+dfsg/CMakeLists.txt libsdl2-2.24.0+dfsg/CMakeLists.txt --- libsdl2-2.0.22+dfsg/CMakeLists.txt 2022-04-21 17:37:37.000000000 +0000 +++ libsdl2-2.24.0+dfsg/CMakeLists.txt 2022-08-19 15:46:21.000000000 +0000 @@ -5,10 +5,19 @@ cmake_minimum_required(VERSION 3.0.0) project(SDL2 C CXX) +if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) + set(SDL2_SUBPROJECT OFF) +else() + set(SDL2_SUBPROJECT ON) +endif() + if (HAIKU) set(LINKER_LANGUAGE CXX) endif() +set(EXTRA_LIBS) +set(EXTRA_LDFLAGS) + # This is a virtual "library" that just exists to collect up compiler and # linker options that used to be global to this CMake project. When you # specify it as part of a real library's target_link_libraries(), that @@ -28,6 +37,13 @@ target_compile_options(sdl-build-options INTERFACE "/MP") endif(MSVC) +# CMake 3.0 expands the "if(${A})" in "set(OFF 1);set(A OFF);if(${A})" to "if(1)" +# CMake 3.24+ emits a warning when not set. +unset(OFF) +unset(ON) +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() # !!! FIXME: this should probably do "MACOSX_RPATH ON" as a target property # !!! FIXME: for the SDL2 shared library (so you get an @@ -47,7 +63,6 @@ include(CheckCSourceRuns) include(CheckCCompilerFlag) include(CheckCXXCompilerFlag) -include(CheckTypeSize) include(CheckStructHasMember) include(CMakeDependentOption) include(FindPkgConfig) @@ -56,23 +71,18 @@ include(${SDL2_SOURCE_DIR}/cmake/macros.cmake) include(${SDL2_SOURCE_DIR}/cmake/sdlchecks.cmake) -# General settings -# Edit include/SDL_version.h and change the version, then: -# SDL_MICRO_VERSION += 1; -# SDL_INTERFACE_AGE += 1; -# SDL_BINARY_AGE += 1; -# if any functions have been added, set SDL_INTERFACE_AGE to 0. -# if backwards compatibility has been broken, -# set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0. +# Enable large file support on 32-bit glibc, so that we can access files +# with large inode numbers +check_symbol_exists("__GLIBC__" "stdlib.h" LIBC_IS_GLIBC) +if (LIBC_IS_GLIBC AND CMAKE_SIZEOF_VOID_P EQUAL 4) + add_definitions(-D_FILE_OFFSET_BITS=64) +endif() + +# See docs/release_checklist.md set(SDL_MAJOR_VERSION 2) -set(SDL_MINOR_VERSION 0) -set(SDL_MICRO_VERSION 22) -set(SDL_INTERFACE_AGE 0) -set(SDL_BINARY_AGE 22) +set(SDL_MINOR_VERSION 24) +set(SDL_MICRO_VERSION 0) set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}") -# the following should match the versions in Xcode project file: -set(DYLIB_CURRENT_VERSION 23.0.0) -set(DYLIB_COMPATIBILITY_VERSION 1.0.0) # Set defaults preventing destination file conflicts set(SDL_CMAKE_DEBUG_POSTFIX "d" @@ -81,13 +91,44 @@ mark_as_advanced(CMAKE_IMPORT_LIBRARY_SUFFIX SDL_CMAKE_DEBUG_POSTFIX) # Calculate a libtool-like version number -math(EXPR LT_CURRENT "${SDL_MICRO_VERSION} - ${SDL_INTERFACE_AGE}") +math(EXPR SDL_BINARY_AGE "${SDL_MINOR_VERSION} * 100 + ${SDL_MICRO_VERSION}") +if(SDL_MINOR_VERSION MATCHES "[02468]$") + # Stable branch, 2.24.1 -> libSDL2-2.0.so.0.2400.1 + set(SDL_INTERFACE_AGE ${SDL_MICRO_VERSION}) +else() + # Development branch, 2.23.1 -> libSDL2-2.0.so.0.2301.0 + set(SDL_INTERFACE_AGE 0) +endif() + +# Increment this if there is an incompatible change - but if that happens, +# we should rename the library from SDL2 to SDL3, at which point this would +# reset to 0 anyway. +set(LT_MAJOR "0") + math(EXPR LT_AGE "${SDL_BINARY_AGE} - ${SDL_INTERFACE_AGE}") -math(EXPR LT_MAJOR "${LT_CURRENT}- ${LT_AGE}") +math(EXPR LT_CURRENT "${LT_MAJOR} + ${LT_AGE}") set(LT_REVISION "${SDL_INTERFACE_AGE}") -set(LT_RELEASE "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}") +# For historical reasons, the library name redundantly includes the major +# version twice: libSDL2-2.0.so.0. +# TODO: in SDL 3, set the OUTPUT_NAME to plain SDL3, which will simplify +# it to libSDL3.so.0 +set(LT_RELEASE "2.0") set(LT_VERSION "${LT_MAJOR}.${LT_AGE}.${LT_REVISION}") +# The following should match the versions in the Xcode project file. +# Each version is 1 higher than you might expect, for compatibility +# with libtool: macOS ABI versioning is 1-based, unlike other platforms +# which are normally 0-based. +math(EXPR DYLIB_CURRENT_VERSION_MAJOR "${LT_MAJOR} + ${LT_AGE} + 1") +math(EXPR DYLIB_CURRENT_VERSION_MINOR "${LT_REVISION}") +math(EXPR DYLIB_COMPAT_VERSION_MAJOR "${LT_MAJOR} + 1") +set(DYLIB_CURRENT_VERSION "${DYLIB_CURRENT_VERSION_MAJOR}.${DYLIB_CURRENT_VERSION_MINOR}.0") +set(DYLIB_COMPATIBILITY_VERSION "${DYLIB_COMPAT_VERSION_MAJOR}.0.0") + +# This list holds all generated headers. +# To avoid generating them twice, these are added to a dummy target on which all sdl targets depend. +set(SDL_GENERATED_HEADERS) + #message(STATUS "${LT_VERSION} :: ${LT_AGE} :: ${LT_REVISION} :: ${LT_CURRENT} :: ${LT_RELEASE}") # General settings & flags @@ -157,7 +198,7 @@ endif() # Don't mistake osx for unix -if(UNIX AND NOT APPLE AND NOT RISCOS) +if(UNIX AND NOT ANDROID AND NOT APPLE AND NOT RISCOS) set(UNIX_SYS ON) else() set(UNIX_SYS OFF) @@ -182,6 +223,12 @@ set(SDL_PTHREADS_ENABLED_BY_DEFAULT OFF) endif() +if(UNIX_SYS OR ANDROID) + set(SDL_CLOCK_GETTIME_ENABLED_BY_DEFAULT ON) +else() + set(SDL_CLOCK_GETTIME_ENABLED_BY_DEFAULT OFF) +endif() + # The hidraw support doesn't catch Xbox, PS4 and Nintendo controllers, # so we'll just use libusb when it's available. libusb does not support iOS, # so we default to yes on iOS. @@ -229,7 +276,7 @@ set(OPT_DEF_SSEMATH ON) endif() endif() -if(UNIX OR MINGW OR MSYS OR (USE_CLANG AND NOT WINDOWS) OR VITA OR PSP) +if(UNIX OR MINGW OR MSYS OR (USE_CLANG AND NOT WINDOWS) OR VITA OR PSP OR PS2) set(OPT_DEF_LIBC ON) endif() @@ -272,10 +319,10 @@ endif() endif() -# Those are used for pkg-config and friends, so that the SDL2.pc, sdl2-config, +# Those are used for pkg-config and friends, so that the sdl2.pc, sdl2-config, # etc. are created correctly. set(SDL_LIBS "-lSDL2") -set(SDL_CFLAGS "") +set(SDL_CFLAGS ) # When building shared lib for Windows with MinGW, # avoid the DLL having a "lib" prefix @@ -297,16 +344,15 @@ HAVE_GCC_NO_CYGWIN) set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) if(HAVE_GCC_NO_CYGWIN) - list(APPEND EXTRA_LDFLAGS "-mno-cygwin") + list(APPEND EXTRA_LDFLAGS_BUILD "-mno-cygwin") list(APPEND SDL_LIBS "-mno-cygwin") endif() - set(SDL_CFLAGS "${SDL_CFLAGS} -I/usr/include/mingw") + list(APPEND SDL_CFLAGS "-I/usr/include/mingw") endif() # General includes target_compile_definitions(sdl-build-options INTERFACE "-DUSING_GENERATED_CONFIG_H") -target_include_directories(sdl-build-options BEFORE INTERFACE "${SDL2_BINARY_DIR}/include") -target_include_directories(sdl-build-options INTERFACE "${SDL2_SOURCE_DIR}/include") +target_include_directories(sdl-build-options BEFORE INTERFACE "${SDL2_BINARY_DIR}/include" "${SDL2_BINARY_DIR}/include-config-$>") # Note: The clang toolset for Visual Studio does not support the '-idirafter' option. if(USE_GCC OR (USE_CLANG AND NOT MSVC_CLANG)) # !!! FIXME: do we _need_ to mess with CMAKE_C_FLAGS here? @@ -331,9 +377,10 @@ set(SDL_ATOMIC_ENABLED_BY_DEFAULT OFF) set(SDL_LOADSO_ENABLED_BY_DEFAULT OFF) set(SDL_CPUINFO_ENABLED_BY_DEFAULT OFF) + set(SDL_TEST_ENABLED_BY_DEFAULT OFF) endif() -if(VITA OR PSP) +if(VITA OR PSP OR PS2) set(SDL_SHARED_ENABLED_BY_DEFAULT OFF) set(SDL_LOADSO_ENABLED_BY_DEFAULT OFF) endif() @@ -357,6 +404,10 @@ endif() endif() +if (NOT DEFINED SDL_TEST_ENABLED_BY_DEFAULT) + set(SDL_TEST_ENABLED_BY_DEFAULT ON) +endif() + set(LONGESTOPTIONNAME 0) # set_option and friends will change this. set(SDL_SUBSYSTEMS @@ -372,7 +423,7 @@ # Allow some projects to be built conditionally. set_option(SDL2_DISABLE_SDL2MAIN "Disable building/installation of SDL2main" OFF) -set_option(SDL2_DISABLE_INSTALL "Disable installation of SDL2" OFF) +set_option(SDL2_DISABLE_INSTALL "Disable installation of SDL2" ${SDL2_SUBPROJECT}) set_option(SDL2_DISABLE_UNINSTALL "Disable uninstallation of SDL2" OFF) option_string(SDL_ASSERTIONS "Enable internal sanity checks (auto/disabled/release/enabled/paranoid)" "auto") @@ -414,16 +465,16 @@ set_option(SDL_NAS "Support the NAS audio API" ${UNIX_SYS}) dep_option(SDL_NAS_SHARED "Dynamically load NAS audio support" ON "SDL_NAS" OFF) set_option(SDL_SNDIO "Support the sndio audio API" ${UNIX_SYS}) -dep_option(SDL_SNDIO_SHARED "Dynamically load the sndio audio API" ${UNIX_SYS} ON "SDL_SNDIO" OFF) +dep_option(SDL_SNDIO_SHARED "Dynamically load the sndio audio API" ON "SDL_SNDIO" OFF) set_option(SDL_FUSIONSOUND "Use FusionSound audio driver" OFF) dep_option(SDL_FUSIONSOUND_SHARED "Dynamically load fusionsound audio support" ON "SDL_FUSIONSOUND" OFF) set_option(SDL_LIBSAMPLERATE "Use libsamplerate for audio rate conversion" ${UNIX_SYS}) dep_option(SDL_LIBSAMPLERATE_SHARED "Dynamically load libsamplerate" ON "SDL_LIBSAMPLERATE" OFF) set_option(SDL_RPATH "Use an rpath when linking SDL" ${UNIX_SYS}) -set_option(SDL_CLOCK_GETTIME "Use clock_gettime() instead of gettimeofday()" ${UNIX_SYS}) +set_option(SDL_CLOCK_GETTIME "Use clock_gettime() instead of gettimeofday()" ${SDL_CLOCK_GETTIME_ENABLED_BY_DEFAULT}) set_option(SDL_X11 "Use X11 video driver" ${UNIX_SYS}) dep_option(SDL_X11_SHARED "Dynamically load X11 support" ON "SDL_X11" OFF) -set(SDL_X11_OPTIONS Xcursor Xdbe Xinerama XInput Xfixes Xrandr Xscrnsaver XShape Xvm) +set(SDL_X11_OPTIONS Xcursor Xdbe XInput Xfixes Xrandr Xscrnsaver XShape) foreach(_SUB ${SDL_X11_OPTIONS}) string(TOUPPER "SDL_X11_${_SUB}" _OPT) dep_option(${_OPT} "Enable ${_SUB} support" ON "SDL_X11" OFF) @@ -448,15 +499,29 @@ set_option(SDL_OFFSCREEN "Use offscreen video driver" OFF) option_string(SDL_BACKGROUNDING_SIGNAL "number to use for magic backgrounding signal or 'OFF'" OFF) option_string(SDL_FOREGROUNDING_SIGNAL "number to use for magic foregrounding signal or 'OFF'" OFF) -set_option(SDL_HIDAPI_JOYSTICK "Use HIDAPI for low level joystick drivers" ON) -set_option(SDL_VIRTUAL_JOYSTICK "Enable the virtual-joystick driver" ON) +set_option(SDL_HIDAPI "Enable the HIDAPI subsystem" ON) +dep_option(SDL_HIDAPI_LIBUSB "Use libusb for low level joystick drivers" OFF SDL_HIDAPI OFF) +dep_option(SDL_HIDAPI_JOYSTICK "Use HIDAPI for low level joystick drivers" ON SDL_HIDAPI OFF) +dep_option(SDL_VIRTUAL_JOYSTICK "Enable the virtual-joystick driver" ON SDL_HIDAPI OFF) set_option(SDL_ASAN "Use AddressSanitizer to detect memory errors" OFF) set(SDL_SHARED ${SDL_SHARED_ENABLED_BY_DEFAULT} CACHE BOOL "Build a shared version of the library") set(SDL_STATIC ${SDL_STATIC_ENABLED_BY_DEFAULT} CACHE BOOL "Build a static version of the library") +set(SDL_TEST ${SDL_TEST_ENABLED_BY_DEFAULT} CACHE BOOL "Build the SDL2_test library") -dep_option(SDL_STATIC_PIC "Static version of the library should be built with Position Independent Code" OFF "SDL_STATIC" OFF) -set_option(SDL_TEST "Build the test directory" OFF) +dep_option(SDL_STATIC_PIC "Static version of the library should be built with Position Independent Code" "${CMAKE_POSITION_INDEPENDENT_CODE}" "SDL_STATIC" OFF) +dep_option(SDL_TESTS "Build the test directory" OFF SDL_TEST OFF) +set_option(SDL_INSTALL_TESTS "Install test-cases" OFF) + +set(HAVE_STATIC_PIC "${SDL_STATIC_PIC}") + +if(SDL_HIDAPI) + if(HIDAPI_ONLY_LIBUSB) + set(SDL_HIDAPI_LIBUSB ON CACHE BOOL "" FORCE) + elseif(HIDAPI_SKIP_LIBUSB) + set(SDL_HIDAPI_LIBUSB OFF CACHE BOOL "" FORCE) + endif() +endif() if(VITA) set_option(VIDEO_VITA_PIB "Build with PSVita piglet gles2 support" OFF) @@ -489,15 +554,18 @@ ${SDL2_SOURCE_DIR}/src/video/yuv2rgb/*.c) -if(SDL_ASSERTIONS STREQUAL "auto") +set(SDL_DEFAULT_ASSERT_LEVEL_CONFIGURED 1) +if(SDL_ASSERTIONS MATCHES "^(auto|)$") # Do nada - use optimization settings to determine the assertion level -elseif(SDL_ASSERTIONS STREQUAL "disabled") + set(SDL_DEFAULT_ASSERT_LEVEL ) + set(SDL_DEFAULT_ASSERT_LEVEL_CONFIGURED 0) +elseif(SDL_ASSERTIONS MATCHES "^(disabled|0)$") set(SDL_DEFAULT_ASSERT_LEVEL 0) -elseif(SDL_ASSERTIONS STREQUAL "release") +elseif(SDL_ASSERTIONS MATCHES "^(release|1)$") set(SDL_DEFAULT_ASSERT_LEVEL 1) -elseif(SDL_ASSERTIONS STREQUAL "enabled") +elseif(SDL_ASSERTIONS MATCHES "^(enabled|2)$") set(SDL_DEFAULT_ASSERT_LEVEL 2) -elseif(SDL_ASSERTIONS STREQUAL "paranoid") +elseif(SDL_ASSERTIONS MATCHES "^(paranoid|3)$") set(SDL_DEFAULT_ASSERT_LEVEL 3) else() message_error("unknown assertion level") @@ -532,13 +600,17 @@ list(APPEND EXTRA_CFLAGS "-fno-strict-aliasing") endif() - check_c_compiler_flag(-Wdeclaration-after-statement HAVE_GCC_WDECLARATION_AFTER_STATEMENT) - if(HAVE_GCC_WDECLARATION_AFTER_STATEMENT) - check_c_compiler_flag(-Werror=declaration-after-statement HAVE_GCC_WERROR_DECLARATION_AFTER_STATEMENT) - if(HAVE_GCC_WERROR_DECLARATION_AFTER_STATEMENT) - list(APPEND EXTRA_CFLAGS "-Werror=declaration-after-statement") + # Android needs to bring in external files that don't adhere to the declaration-after-statement + # warning, so skip this warning on Android. + if(NOT ANDROID) + check_c_compiler_flag(-Wdeclaration-after-statement HAVE_GCC_WDECLARATION_AFTER_STATEMENT) + if(HAVE_GCC_WDECLARATION_AFTER_STATEMENT) + check_c_compiler_flag(-Werror=declaration-after-statement HAVE_GCC_WERROR_DECLARATION_AFTER_STATEMENT) + if(HAVE_GCC_WERROR_DECLARATION_AFTER_STATEMENT) + list(APPEND EXTRA_CFLAGS "-Werror=declaration-after-statement") + endif() + list(APPEND EXTRA_CFLAGS "-Wdeclaration-after-statement") endif() - list(APPEND EXTRA_CFLAGS "-Wdeclaration-after-statement") endif() if(DEPENDENCY_TRACKING) @@ -590,15 +662,16 @@ endif() if(APPLE) - list(APPEND EXTRA_LDFLAGS "-Wl,-undefined,error") - list(APPEND EXTRA_LDFLAGS "-Wl,-compatibility_version,${DYLIB_COMPATIBILITY_VERSION}") - list(APPEND EXTRA_LDFLAGS "-Wl,-current_version,${DYLIB_CURRENT_VERSION}") + # FIXME: use generator expression instead of appending to EXTRA_LDFLAGS_BUILD + list(APPEND EXTRA_LDFLAGS_BUILD "-Wl,-undefined,error") + list(APPEND EXTRA_LDFLAGS_BUILD "-Wl,-compatibility_version,${DYLIB_COMPATIBILITY_VERSION}") + list(APPEND EXTRA_LDFLAGS_BUILD "-Wl,-current_version,${DYLIB_CURRENT_VERSION}") elseif(NOT OPENBSD) set(CMAKE_REQUIRED_FLAGS "-Wl,--no-undefined") check_c_compiler_flag("" HAVE_NO_UNDEFINED) set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) if(HAVE_NO_UNDEFINED AND NOT (USE_CLANG AND WINDOWS)) - list(APPEND EXTRA_LDFLAGS "-Wl,--no-undefined") + list(APPEND EXTRA_LDFLAGS_BUILD "-Wl,--no-undefined") endif() endif() @@ -611,10 +684,20 @@ endif() endif() endif() +if(MSVC) + target_compile_definitions(sdl-build-options INTERFACE "-D_CRT_SECURE_NO_DEPRECATE") + target_compile_definitions(sdl-build-options INTERFACE "-D_CRT_NONSTDC_NO_DEPRECATE") + target_compile_definitions(sdl-build-options INTERFACE "-D_CRT_SECURE_NO_WARNINGS") +endif() + +if(MSVC) + # Due to a limitation of Microsoft's LTO implementation, LTO must be disabled for memcpy and memset. + # The same applies to various functions normally belonging in the C library (for x86 architecture). + set_property(SOURCE src/stdlib/SDL_mslibc.c APPEND PROPERTY COMPILE_FLAGS /GL-) +endif() if(SDL_ASSEMBLY) if(USE_GCC OR USE_CLANG) - set(SDL_ASSEMBLY_ROUTINES 1) # TODO: Those all seem to be quite GCC specific - needs to be # reworked for better compiler support set(HAVE_ASSEMBLY TRUE) @@ -788,7 +871,7 @@ set(HAVE_ARMSIMD TRUE) set(SDL_ARM_SIMD_BLITTERS 1) file(GLOB ARMSIMD_SOURCES ${SDL2_SOURCE_DIR}/src/video/arm/pixman-arm-simd*.S) - set(SOURCE_FILES ${SOURCE_FILES} ${ARMSIMD_SOURCES}) + list(APPEND SOURCE_FILES ${ARMSIMD_SOURCES}) set(WARN_ABOUT_ARM_SIMD_ASM_MIT TRUE) endif() endif() @@ -816,7 +899,7 @@ set(HAVE_ARMNEON TRUE) set(SDL_ARM_NEON_BLITTERS 1) file(GLOB ARMNEON_SOURCES ${SDL2_SOURCE_DIR}/src/video/arm/pixman-arm-neon*.S) - set(SOURCE_FILES ${SOURCE_FILES} ${ARMNEON_SOURCES}) + list(APPEND SOURCE_FILES ${ARMNEON_SOURCES}) set(WARN_ABOUT_ARM_NEON_ASM_MIT TRUE) endif() endif() @@ -832,7 +915,6 @@ set(HAVE_SSE2 TRUE) set(HAVE_SSE3 TRUE) check_include_file("immintrin.h" HAVE_IMMINTRIN_H) - set(SDL_ASSEMBLY_ROUTINES 1) endif() endif() @@ -848,7 +930,7 @@ endforeach() set(HAVE_SIGNAL_H 1) foreach(_FN - malloc calloc realloc free qsort abs memset memcpy memmove memcmp + malloc calloc realloc free bsearch qsort abs memset memcpy memmove memcmp wcslen _wcsdup wcsdup wcsstr wcscmp wcsncmp _wcsicmp _wcsnicmp strlen _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _ultoa strtol strtoul strtoll strtod atoi atof strcmp strncmp @@ -861,7 +943,7 @@ set(HAVE_${_UPPER} 1) endforeach() set(HAVE_ALLOCA 1) - set(HAVE_M_PI 1) + check_symbol_exists(M_PI math.h HAVE_M_PI) target_compile_definitions(sdl-build-options INTERFACE "-D_USE_MATH_DEFINES") # needed for M_PI set(STDC_HEADERS 1) else() @@ -877,7 +959,6 @@ set(STDC_HEADER_NAMES "stddef.h;stdarg.h;stdlib.h;string.h;stdio.h;wchar.h;float.h") check_include_files("${STDC_HEADER_NAMES}" STDC_HEADERS) - check_type_size("size_t" SIZEOF_SIZE_T) check_symbol_exists(M_PI math.h HAVE_M_PI) # TODO: refine the mprotect check check_c_source_compiles("#include @@ -885,7 +966,7 @@ int main(void) { return 0; }" HAVE_MPROTECT) foreach(_FN strtod malloc calloc realloc free getenv setenv putenv unsetenv - qsort abs bcopy memset memcpy memmove memcmp strlen strlcpy strlcat + bsearch qsort abs bcopy memset memcpy memmove memcmp strlen strlcpy strlcat _strrev _strupr _strlwr index rindex strchr strrchr strstr strtok_r itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp @@ -980,14 +1061,14 @@ if(SDL_DUMMYAUDIO) set(SDL_AUDIO_DRIVER_DUMMY 1) file(GLOB DUMMYAUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/dummy/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${DUMMYAUDIO_SOURCES}) + list(APPEND SOURCE_FILES ${DUMMYAUDIO_SOURCES}) set(HAVE_DUMMYAUDIO TRUE) set(HAVE_SDL_AUDIO TRUE) endif() if(SDL_DISKAUDIO) set(SDL_AUDIO_DRIVER_DISK 1) file(GLOB DISKAUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/disk/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${DISKAUDIO_SOURCES}) + list(APPEND SOURCE_FILES ${DISKAUDIO_SOURCES}) set(HAVE_DISKAUDIO TRUE) set(HAVE_SDL_AUDIO TRUE) endif() @@ -1000,7 +1081,7 @@ if(SDL_LOADSO AND HAVE_DLOPEN) set(SDL_LOADSO_DLOPEN 1) file(GLOB DLOPEN_SOURCES ${SDL2_SOURCE_DIR}/src/loadso/dlopen/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${DLOPEN_SOURCES}) + list(APPEND SOURCE_FILES ${DLOPEN_SOURCES}) set(HAVE_SDL_LOADSO TRUE) endif() endif() @@ -1014,7 +1095,7 @@ set(HAVE_VIRTUAL_JOYSTICK TRUE) set(SDL_JOYSTICK_VIRTUAL 1) file(GLOB JOYSTICK_VIRTUAL_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/virtual/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_VIRTUAL_SOURCES}) + list(APPEND SOURCE_FILES ${JOYSTICK_VIRTUAL_SOURCES}) endif() endif() @@ -1022,14 +1103,14 @@ if(SDL_DUMMYVIDEO) set(SDL_VIDEO_DRIVER_DUMMY 1) file(GLOB VIDEO_DUMMY_SOURCES ${SDL2_SOURCE_DIR}/src/video/dummy/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${VIDEO_DUMMY_SOURCES}) + list(APPEND SOURCE_FILES ${VIDEO_DUMMY_SOURCES}) set(HAVE_DUMMYVIDEO TRUE) set(HAVE_SDL_VIDEO TRUE) endif() if(SDL_OFFSCREEN) set(SDL_VIDEO_DRIVER_OFFSCREEN 1) file(GLOB VIDEO_OFFSCREEN_SOURCES ${SDL2_SOURCE_DIR}/src/video/offscreen/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${VIDEO_OFFSCREEN_SOURCES}) + list(APPEND SOURCE_FILES ${VIDEO_OFFSCREEN_SOURCES}) set(HAVE_OFFSCREEN TRUE) set(HAVE_SDL_VIDEO TRUE) endif() @@ -1038,11 +1119,11 @@ # Platform-specific options and settings if(ANDROID) file(GLOB ANDROID_CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/android/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_CORE_SOURCES} ${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c) + list(APPEND SOURCE_FILES ${ANDROID_CORE_SOURCES} ${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c) if(SDL_MISC) file(GLOB ANDROID_MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/android/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_MISC_SOURCES}) + list(APPEND SOURCE_FILES ${ANDROID_MISC_SOURCES}) set(HAVE_SDL_MISC TRUE) endif() @@ -1056,36 +1137,35 @@ endif() file(GLOB ANDROID_MAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/android/*.c) - set(SDLMAIN_SOURCES ${SDLMAIN_SOURCES} ${ANDROID_MAIN_SOURCES}) + list(APPEND SDLMAIN_SOURCES ${ANDROID_MAIN_SOURCES}) if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_ANDROID 1) file(GLOB ANDROID_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/android/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_AUDIO_SOURCES}) + list(APPEND SOURCE_FILES ${ANDROID_AUDIO_SOURCES}) set(SDL_AUDIO_DRIVER_OPENSLES 1) file(GLOB OPENSLES_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/openslES/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${OPENSLES_AUDIO_SOURCES}) + list(APPEND SOURCE_FILES ${OPENSLES_AUDIO_SOURCES}) - find_library(ANDROID_OPENSLES_LIBRARY OpenSLES) - list(APPEND EXTRA_LIBS ${ANDROID_DL_LIBRARY} ${ANDROID_OPENSLES_LIBRARY}) + list(APPEND EXTRA_LIBS ${ANDROID_DL_LIBRARY} OpenSLES) set(SDL_AUDIO_DRIVER_AAUDIO 1) file(GLOB AAUDIO_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/aaudio/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${AAUDIO_AUDIO_SOURCES}) + list(APPEND SOURCE_FILES ${AAUDIO_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) endif() if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_ANDROID 1) file(GLOB ANDROID_FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/android/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_FILESYSTEM_SOURCES}) + list(APPEND SOURCE_FILES ${ANDROID_FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() if(SDL_HAPTIC) set(SDL_HAPTIC_ANDROID 1) file(GLOB ANDROID_HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/android/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_HAPTIC_SOURCES}) + list(APPEND SOURCE_FILES ${ANDROID_HAPTIC_SOURCES}) set(HAVE_SDL_HAPTIC TRUE) endif() if(SDL_HIDAPI) @@ -1094,51 +1174,48 @@ if(SDL_JOYSTICK) set(SDL_JOYSTICK_ANDROID 1) file(GLOB ANDROID_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/android/*.c ${SDL2_SOURCE_DIR}/src/joystick/steam/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_JOYSTICK_SOURCES}) + list(APPEND SOURCE_FILES ${ANDROID_JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() if(SDL_LOADSO) set(SDL_LOADSO_DLOPEN 1) file(GLOB LOADSO_SOURCES ${SDL2_SOURCE_DIR}/src/loadso/dlopen/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${LOADSO_SOURCES}) + list(APPEND SOURCE_FILES ${LOADSO_SOURCES}) set(HAVE_SDL_LOADSO TRUE) endif() if(SDL_POWER) set(SDL_POWER_ANDROID 1) file(GLOB ANDROID_POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/android/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_POWER_SOURCES}) + list(APPEND SOURCE_FILES ${ANDROID_POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) endif() if(SDL_LOCALE) file(GLOB ANDROID_LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/android/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_LOCALE_SOURCES}) + list(APPEND SOURCE_FILES ${ANDROID_LOCALE_SOURCES}) set(HAVE_SDL_LOCALE TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_UNIX 1) file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES}) + list(APPEND SOURCE_FILES ${TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif() if(SDL_SENSOR) set(SDL_SENSOR_ANDROID 1) set(HAVE_SDL_SENSORS TRUE) file(GLOB ANDROID_SENSOR_SOURCES ${SDL2_SOURCE_DIR}/src/sensor/android/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_SENSOR_SOURCES}) + list(APPEND SOURCE_FILES ${ANDROID_SENSOR_SOURCES}) endif() if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_ANDROID 1) file(GLOB ANDROID_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/android/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_VIDEO_SOURCES}) + list(APPEND SOURCE_FILES ${ANDROID_VIDEO_SOURCES}) set(HAVE_SDL_VIDEO TRUE) # Core stuff # find_library(ANDROID_DL_LIBRARY dl) # FIXME failing dlopen https://github.com/android-ndk/ndk/issues/929 - find_library(ANDROID_DL_LIBRARY NAMES libdl.so dl) - find_library(ANDROID_LOG_LIBRARY log) - find_library(ANDROID_LIBRARY_LIBRARY android) - list(APPEND EXTRA_LIBS ${ANDROID_DL_LIBRARY} ${ANDROID_LOG_LIBRARY} ${ANDROID_LIBRARY_LIBRARY}) + list(APPEND EXTRA_LIBS dl log android) target_compile_definitions(sdl-build-options INTERFACE "-DGL_GLEXT_PROTOTYPES") #enable gles @@ -1150,9 +1227,7 @@ set(SDL_VIDEO_OPENGL_ES2 1) set(SDL_VIDEO_RENDER_OGL_ES2 1) - find_library(OpenGLES1_LIBRARY GLESv1_CM) - find_library(OpenGLES2_LIBRARY GLESv2) - list(APPEND EXTRA_LIBS ${OpenGLES1_LIBRARY} ${OpenGLES2_LIBRARY}) + list(APPEND EXTRA_LIBS GLESv1_CM GLESv2) endif() if(SDL_VULKAN) @@ -1170,6 +1245,9 @@ endif() CheckPTHREAD() + if(SDL_CLOCK_GETTIME) + set(HAVE_CLOCK_GETTIME 1) + endif() elseif(EMSCRIPTEN) # Hide noisy warnings that intend to aid mostly during initial stages of porting a new @@ -1178,42 +1256,42 @@ if(SDL_MISC) file(GLOB EMSRIPTEN_MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/emscripten/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${EMSRIPTEN_MISC_SOURCES}) + list(APPEND SOURCE_FILES ${EMSRIPTEN_MISC_SOURCES}) set(HAVE_SDL_MISC TRUE) endif() if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_EMSCRIPTEN 1) file(GLOB EM_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/emscripten/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${EM_AUDIO_SOURCES}) + list(APPEND SOURCE_FILES ${EM_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) endif() if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_EMSCRIPTEN 1) file(GLOB EM_FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/emscripten/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${EM_FILESYSTEM_SOURCES}) + list(APPEND SOURCE_FILES ${EM_FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() if(SDL_JOYSTICK) set(SDL_JOYSTICK_EMSCRIPTEN 1) file(GLOB EM_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/emscripten/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${EM_JOYSTICK_SOURCES}) + list(APPEND SOURCE_FILES ${EM_JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() if(SDL_POWER) set(SDL_POWER_EMSCRIPTEN 1) file(GLOB EM_POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/emscripten/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${EM_POWER_SOURCES}) + list(APPEND SOURCE_FILES ${EM_POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) endif() if(SDL_LOCALE) file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/emscripten/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${LOCALE_SOURCES}) + list(APPEND SOURCE_FILES ${LOCALE_SOURCES}) set(HAVE_SDL_LOCALE TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_UNIX 1) file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES}) + list(APPEND SOURCE_FILES ${TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) if(SDL_CLOCK_GETTIME) @@ -1223,7 +1301,7 @@ if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_EMSCRIPTEN 1) file(GLOB EM_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/emscripten/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${EM_VIDEO_SOURCES}) + list(APPEND SOURCE_FILES ${EM_VIDEO_SOURCES}) set(HAVE_SDL_VIDEO TRUE) #enable gles @@ -1237,22 +1315,22 @@ CheckPTHREAD() -elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS AND NOT HAIKU) +elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU) if(SDL_AUDIO) if(SYSV5 OR SOLARIS OR HPUX) set(SDL_AUDIO_DRIVER_SUNAUDIO 1) file(GLOB SUN_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/sun/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${SUN_AUDIO_SOURCES}) + list(APPEND SOURCE_FILES ${SUN_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) elseif(NETBSD) set(SDL_AUDIO_DRIVER_NETBSD 1) file(GLOB NETBSD_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/netbsd/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${NETBSD_AUDIO_SOURCES}) + list(APPEND SOURCE_FILES ${NETBSD_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) elseif(AIX) set(SDL_AUDIO_DRIVER_PAUDIO 1) file(GLOB AIX_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/paudio/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${AIX_AUDIO_SOURCES}) + list(APPEND SOURCE_FILES ${AIX_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) endif() CheckOSS() @@ -1265,7 +1343,6 @@ CheckNAS() CheckSNDIO() CheckFusionSound() - CheckLibSampleRate() endif() if(SDL_VIDEO) @@ -1290,7 +1367,7 @@ if(UNIX) file(GLOB CORE_UNIX_SOURCES ${SDL2_SOURCE_DIR}/src/core/unix/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${CORE_UNIX_SOURCES}) + list(APPEND SOURCE_FILES ${CORE_UNIX_SOURCES}) check_c_source_compiles(" #include @@ -1327,7 +1404,7 @@ if(SDL_HAPTIC AND HAVE_INPUT_EVENTS) set(SDL_HAPTIC_LINUX 1) file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/linux/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES}) + list(APPEND SOURCE_FILES ${HAPTIC_SOURCES}) set(HAVE_SDL_HAPTIC TRUE) endif() @@ -1353,7 +1430,6 @@ if(DBUS_FOUND) set(HAVE_DBUS_DBUS_H TRUE) target_include_directories(sdl-build-options INTERFACE "${DBUS_INCLUDE_DIRS}") - list(APPEND EXTRA_LIBS ${DBUS_LIBRARIES}) # Fcitx need only dbus. set(HAVE_FCITX TRUE) endif() @@ -1362,7 +1438,6 @@ if(IBUS_FOUND) set(HAVE_IBUS_IBUS_H TRUE) target_include_directories(sdl-build-options INTERFACE "${IBUS_INCLUDE_DIRS}") - list(APPEND EXTRA_LIBS ${IBUS_LIBRARIES}) endif() if (HAVE_IBUS_IBUS_H OR HAVE_FCITX) @@ -1379,45 +1454,47 @@ endif() if(HAVE_LIBUNWIND_H) - # We've already found the header, so REQUIRE the lib to be present - pkg_search_module(UNWIND REQUIRED libunwind) + # We've already found the header, so link the lib if present. + # NB: This .pc file is not present on FreeBSD where the implicitly + # linked base system libgcc_s includes all libunwind ABI. + pkg_search_module(UNWIND libunwind) pkg_search_module(UNWIND_GENERIC libunwind-generic) - list(APPEND EXTRA_LIBS ${UNWIND_LIBRARIES} ${UNWIND_GENERIC_LIBRARIES}) + list(APPEND EXTRA_TEST_LIBS ${UNWIND_LIBRARIES} ${UNWIND_GENERIC_LIBRARIES}) endif() endif() if(HAVE_DBUS_DBUS_H) - set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/linux/SDL_dbus.c") + list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_dbus.c") endif() if(SDL_USE_IME) - set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/linux/SDL_ime.c") + list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_ime.c") endif() if(HAVE_IBUS_IBUS_H) - set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/linux/SDL_ibus.c") + list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_ibus.c") endif() if(HAVE_FCITX) - set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/linux/SDL_fcitx.c") + list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_fcitx.c") endif() if(HAVE_LIBUDEV_H) - set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/linux/SDL_udev.c") + list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_udev.c") endif() if(HAVE_INPUT_EVENTS) - set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/linux/SDL_evdev.c") - set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/linux/SDL_evdev_kbd.c") + list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_evdev.c") + list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_evdev_kbd.c") endif() if(HAVE_INPUT_KBIO) - set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/freebsd/SDL_evdev_kbd_freebsd.c") + list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/freebsd/SDL_evdev_kbd_freebsd.c") endif() # Always compiled for Linux, unconditionally: - set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/linux/SDL_evdev_capabilities.c") - set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/linux/SDL_threadprio.c") + list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_evdev_capabilities.c") + list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_threadprio.c") # src/core/unix/*.c is included in a generic if(UNIX) section, elsewhere. endif() @@ -1433,7 +1510,7 @@ if(LINUX AND NOT ANDROID) set(SDL_JOYSTICK_LINUX 1) file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/linux/*.c ${SDL2_SOURCE_DIR}/src/joystick/steam/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES}) + list(APPEND SOURCE_FILES ${JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() endif() @@ -1460,7 +1537,7 @@ if(SDL_MISC) file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/unix/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${MISC_SOURCES}) + list(APPEND SOURCE_FILES ${MISC_SOURCES}) set(HAVE_SDL_MISC TRUE) endif() @@ -1468,28 +1545,28 @@ if(LINUX) set(SDL_POWER_LINUX 1) file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/linux/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${POWER_SOURCES}) + list(APPEND SOURCE_FILES ${POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) endif() endif() if(SDL_LOCALE) file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/unix/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${LOCALE_SOURCES}) + list(APPEND SOURCE_FILES ${LOCALE_SOURCES}) set(HAVE_SDL_LOCALE TRUE) endif() if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_UNIX 1) file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/unix/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES}) + list(APPEND SOURCE_FILES ${FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_UNIX 1) file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES}) + list(APPEND SOURCE_FILES ${TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif() @@ -1519,7 +1596,7 @@ int main(int argc, char **argv) { return 0; }" HAVE_WIN32_CC) file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/windows/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${CORE_SOURCES}) + list(APPEND SOURCE_FILES ${CORE_SOURCES}) if(WINDOWS_STORE) file(GLOB WINRT_SOURCE_FILES ${SDL2_SOURCE_DIR}/src/core/winrt/*.c ${SDL2_SOURCE_DIR}/src/core/winrt/*.cpp) @@ -1529,7 +1606,7 @@ if(MSVC AND NOT SDL_LIBC) # Prevent codegen that would use the VC runtime libraries. set_property(DIRECTORY . APPEND PROPERTY COMPILE_OPTIONS "/GS-") - if(NOT ARCH_64) + if(NOT ARCH_64 AND NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM") set_property(DIRECTORY . APPEND PROPERTY COMPILE_OPTIONS "/arch:SSE") endif() endif() @@ -1540,7 +1617,7 @@ else() file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/windows/*.c) endif() - set(SOURCE_FILES ${SOURCE_FILES} ${MISC_SOURCES}) + list(APPEND SOURCE_FILES ${MISC_SOURCES}) set(HAVE_SDL_MISC TRUE) endif() @@ -1558,14 +1635,22 @@ check_include_file(d3d9.h HAVE_D3D_H) check_include_file(d3d11_1.h HAVE_D3D11_H) + check_c_source_compiles(" + #include + #include + #include + ID3D12Device1 *device; + #if WDK_NTDDI_VERSION > 0x0A000008 + int main(int argc, char **argv) { return 0; } + #endif" HAVE_D3D12_H) check_include_file(ddraw.h HAVE_DDRAW_H) check_include_file(dsound.h HAVE_DSOUND_H) check_include_file(dinput.h HAVE_DINPUT_H) - if(WINDOWS_STORE OR VCPKG_TARGET_TRIPLET MATCHES "arm-windows") + if(WINDOWS_STORE OR CMAKE_GENERATOR_PLATFORM STREQUAL "ARM") set(HAVE_DINPUT_H 0) endif() check_include_file(dxgi.h HAVE_DXGI_H) - if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H) + if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_D3D12_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H) set(HAVE_DIRECTX TRUE) if(NOT MINGW AND NOT USE_WINSDK_DIRECTX) # TODO: change $ENV{DXSDL_DIR} to get the path from the include checks @@ -1605,19 +1690,20 @@ check_include_file(mmdeviceapi.h HAVE_MMDEVICEAPI_H) check_include_file(audioclient.h HAVE_AUDIOCLIENT_H) check_include_file(sensorsapi.h HAVE_SENSORSAPI_H) + check_include_file(shellscalingapi.h HAVE_SHELLSCALINGAPI_H) if(SDL_AUDIO) if(NOT WINDOWS_STORE) set(SDL_AUDIO_DRIVER_WINMM 1) file(GLOB WINMM_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/winmm/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${WINMM_AUDIO_SOURCES}) + list(APPEND SOURCE_FILES ${WINMM_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) endif() if(HAVE_DSOUND_H AND NOT WINDOWS_STORE) set(SDL_AUDIO_DRIVER_DSOUND 1) file(GLOB DSOUND_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/directsound/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${DSOUND_AUDIO_SOURCES}) + list(APPEND SOURCE_FILES ${DSOUND_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) endif() @@ -1628,7 +1714,7 @@ if(WINDOWS_STORE) list(APPEND WASAPI_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/wasapi/SDL_wasapi_winrt.cpp) endif() - set(SOURCE_FILES ${SOURCE_FILES} ${WASAPI_AUDIO_SOURCES}) + list(APPEND SOURCE_FILES ${WASAPI_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) endif() endif() @@ -1649,7 +1735,7 @@ set(SDL_VIDEO_DRIVER_WINDOWS 1) file(GLOB WIN_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/windows/*.c) endif() - set(SOURCE_FILES ${SOURCE_FILES} ${WIN_VIDEO_SOURCES}) + list(APPEND SOURCE_FILES ${WIN_VIDEO_SOURCES}) if(SDL_RENDER_D3D AND HAVE_D3D_H AND NOT WINDOWS_STORE) set(SDL_VIDEO_RENDER_D3D 1) @@ -1659,13 +1745,17 @@ set(SDL_VIDEO_RENDER_D3D11 1) set(HAVE_RENDER_D3D TRUE) endif() + if(SDL_RENDER_D3D AND HAVE_D3D12_H AND NOT WINDOWS_STORE) + set(SDL_VIDEO_RENDER_D3D12 1) + set(HAVE_RENDER_D3D TRUE) + endif() set(HAVE_SDL_VIDEO TRUE) endif() if(SDL_THREADS) set(SDL_THREAD_GENERIC_COND_SUFFIX 1) set(SDL_THREAD_WINDOWS 1) - set(SOURCE_FILES ${SOURCE_FILES} + list(APPEND SOURCE_FILES ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_syscond.c ${SDL2_SOURCE_DIR}/src/thread/windows/SDL_syscond_cv.c ${SDL2_SOURCE_DIR}/src/thread/windows/SDL_sysmutex.c @@ -1679,16 +1769,16 @@ set(SDL_SENSOR_WINDOWS 1) set(HAVE_SDL_SENSORS TRUE) file(GLOB WINDOWS_SENSOR_SOURCES ${SDL2_SOURCE_DIR}/src/sensor/windows/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${WINDOWS_SENSOR_SOURCES}) + list(APPEND SOURCE_FILES ${WINDOWS_SENSOR_SOURCES}) endif() if(SDL_POWER) if(WINDOWS_STORE) set(SDL_POWER_WINRT 1) - set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/power/winrt/SDL_syspower.cpp) + list(APPEND SOURCE_FILES ${SDL2_SOURCE_DIR}/src/power/winrt/SDL_syspower.cpp) else() set(SDL_POWER_WINDOWS 1) - set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/power/windows/SDL_syspower.c) + list(APPEND SOURCE_FILES ${SDL2_SOURCE_DIR}/src/power/windows/SDL_syspower.c) set(HAVE_SDL_POWER TRUE) endif() endif() @@ -1699,7 +1789,7 @@ else() file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/windows/*.c) endif() - set(SOURCE_FILES ${SOURCE_FILES} ${LOCALE_SOURCES}) + list(APPEND SOURCE_FILES ${LOCALE_SOURCES}) set(HAVE_SDL_LOCALE TRUE) endif() @@ -1710,7 +1800,7 @@ else() file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/windows/*.c) endif() - set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES}) + list(APPEND SOURCE_FILES ${FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() @@ -1731,19 +1821,19 @@ if(SDL_TIMERS) set(SDL_TIMER_WINDOWS 1) file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/windows/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES}) + list(APPEND SOURCE_FILES ${TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif() if(SDL_LOADSO) set(SDL_LOADSO_WINDOWS 1) file(GLOB LOADSO_SOURCES ${SDL2_SOURCE_DIR}/src/loadso/windows/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${LOADSO_SOURCES}) + list(APPEND SOURCE_FILES ${LOADSO_SOURCES}) set(HAVE_SDL_LOADSO TRUE) endif() file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/windows/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${CORE_SOURCES}) + list(APPEND SOURCE_FILES ${CORE_SOURCES}) if(SDL_VIDEO) if(SDL_OPENGL AND NOT WINDOWS_STORE) @@ -1772,7 +1862,7 @@ if(SDL_JOYSTICK) file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/windows/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES}) + list(APPEND SOURCE_FILES ${JOYSTICK_SOURCES}) if(NOT WINDOWS_STORE) set(SDL_JOYSTICK_RAWINPUT 1) @@ -1805,7 +1895,7 @@ file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/dummy/*.c) set(SDL_HAPTIC_DUMMY 1) endif() - set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES}) + list(APPEND SOURCE_FILES ${HAPTIC_SOURCES}) set(HAVE_SDL_HAPTIC TRUE) endif() endif() @@ -1813,13 +1903,11 @@ file(GLOB VERSION_SOURCES ${SDL2_SOURCE_DIR}/src/main/windows/*.rc) file(GLOB SDLMAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/windows/*.c) if(MINGW OR CYGWIN) - list(APPEND EXTRA_LIBS mingw32) - list(APPEND EXTRA_LDFLAGS "-mwindows") - list(APPEND SDL_LIBS "-lmingw32" "-mwindows") if(NOT SDL2_DISABLE_SDL2MAIN) - set(SDL_CFLAGS "${SDL_CFLAGS} -Dmain=SDL_main") - list(APPEND SDL_LIBS "-lSDL2main") + list(APPEND SDL_CFLAGS "-Dmain=SDL_main") + list(INSERT SDL_LIBS 0 "-lSDL2main") endif(NOT SDL2_DISABLE_SDL2MAIN) + list(INSERT SDL_LIBS 0 "-lmingw32" "-mwindows") endif() elseif(APPLE) @@ -1839,7 +1927,7 @@ # Requires the darwin file implementation if(SDL_FILE) file(GLOB EXTRA_SOURCES ${SDL2_SOURCE_DIR}/src/file/cocoa/*.m) - set(SOURCE_FILES ${EXTRA_SOURCES} ${SOURCE_FILES}) + list(APPEND SOURCE_FILES ${EXTRA_SOURCES}) set(HAVE_SDL_FILE TRUE) endif() @@ -1853,14 +1941,14 @@ else() file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/macosx/*.m) endif() - set(SOURCE_FILES ${SOURCE_FILES} ${MISC_SOURCES}) + list(APPEND SOURCE_FILES ${MISC_SOURCES}) set(HAVE_SDL_MISC TRUE) endif() if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_COREAUDIO 1) file(GLOB AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/coreaudio/*.m) - set(SOURCE_FILES ${SOURCE_FILES} ${AUDIO_SOURCES}) + list(APPEND SOURCE_FILES ${AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) set(SDL_FRAMEWORK_COREAUDIO 1) set(SDL_FRAMEWORK_AUDIOTOOLBOX 1) @@ -1912,7 +2000,7 @@ set(SDL_FRAMEWORK_IOKIT 1) set(SDL_FRAMEWORK_FF 1) endif() - set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES} ${MFI_JOYSTICK_SOURCES}) + list(APPEND SOURCE_FILES ${JOYSTICK_SOURCES} ${MFI_JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() @@ -1926,7 +2014,7 @@ set(SDL_FRAMEWORK_IOKIT 1) set(SDL_FRAMEWORK_FF 1) endif() - set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES}) + list(APPEND SOURCE_FILES ${HAPTIC_SOURCES}) set(HAVE_SDL_HAPTIC TRUE) endif() @@ -1939,27 +2027,27 @@ set(SDL_POWER_MACOSX 1) set(SDL_FRAMEWORK_IOKIT 1) endif() - set(SOURCE_FILES ${SOURCE_FILES} ${POWER_SOURCES}) + list(APPEND SOURCE_FILES ${POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) endif() if(SDL_LOCALE) file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/macosx/*.m) - set(SOURCE_FILES ${SOURCE_FILES} ${LOCALE_SOURCES}) + list(APPEND SOURCE_FILES ${LOCALE_SOURCES}) set(HAVE_SDL_LOCALE TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_UNIX 1) file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES}) + list(APPEND SOURCE_FILES ${TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif(SDL_TIMERS) if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_COCOA 1) file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/cocoa/*.m) - set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES}) + list(APPEND SOURCE_FILES ${FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() @@ -1968,7 +2056,7 @@ set(SDL_SENSOR_COREMOTION 1) set(HAVE_SDL_SENSORS TRUE) file(GLOB SENSOR_SOURCES ${SDL2_SOURCE_DIR}/src/sensor/coremotion/*.m) - set(SOURCE_FILES ${SOURCE_FILES} ${SENSOR_SOURCES}) + list(APPEND SOURCE_FILES ${SENSOR_SOURCES}) endif() endif() @@ -1982,7 +2070,7 @@ set(SDL_IPHONE_KEYBOARD 1) set(SDL_IPHONE_LAUNCHSCREEN 1) file(GLOB UIKITVIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/uikit/*.m) - set(SOURCE_FILES ${SOURCE_FILES} ${UIKITVIDEO_SOURCES}) + list(APPEND SOURCE_FILES ${UIKITVIDEO_SOURCES}) set(HAVE_SDL_VIDEO TRUE) else() CheckCOCOA() @@ -2030,7 +2118,7 @@ endif() if(SDL_RENDER_METAL) file(GLOB RENDER_METAL_SOURCES ${SDL2_SOURCE_DIR}/src/render/metal/*.m) - set(SOURCE_FILES ${SOURCE_FILES} ${RENDER_METAL_SOURCES}) + list(APPEND SOURCE_FILES ${RENDER_METAL_SOURCES}) set(SDL_VIDEO_RENDER_METAL 1) set(HAVE_RENDER_METAL TRUE) endif() @@ -2040,52 +2128,40 @@ # Actually load the frameworks at the end so we don't duplicate include. if(SDL_FRAMEWORK_COREVIDEO) - find_library(COREVIDEO CoreVideo) - list(APPEND EXTRA_LIBS ${COREVIDEO}) + list(APPEND EXTRA_LDFLAGS "-Wl,-framework,CoreVideo") endif() if(SDL_FRAMEWORK_COCOA) - find_library(COCOA_LIBRARY Cocoa) - list(APPEND EXTRA_LIBS ${COCOA_LIBRARY}) + list(APPEND EXTRA_LDFLAGS "-Wl,-framework,Cocoa") endif() if(SDL_FRAMEWORK_IOKIT) - find_library(IOKIT IOKit) - list(APPEND EXTRA_LIBS ${IOKIT}) + list(APPEND EXTRA_LDFLAGS "-Wl,-framework,IOKit") endif() if(SDL_FRAMEWORK_FF) - find_library(FORCEFEEDBACK ForceFeedback) - list(APPEND EXTRA_LIBS ${FORCEFEEDBACK}) + list(APPEND EXTRA_LDFLAGS "-Wl,-framework,ForceFeedback") endif() if(SDL_FRAMEWORK_CARBON) - find_library(CARBON_LIBRARY Carbon) - list(APPEND EXTRA_LIBS ${CARBON_LIBRARY}) + list(APPEND EXTRA_LDFLAGS "-Wl,-framework,Carbon") endif() if(SDL_FRAMEWORK_COREAUDIO) - find_library(COREAUDIO CoreAudio) - list(APPEND EXTRA_LIBS ${COREAUDIO}) + list(APPEND EXTRA_LDFLAGS "-Wl,-framework,CoreAudio") endif() if(SDL_FRAMEWORK_AUDIOTOOLBOX) - find_library(AUDIOTOOLBOX AudioToolbox) - list(APPEND EXTRA_LIBS ${AUDIOTOOLBOX}) + list(APPEND EXTRA_LDFLAGS "-Wl,-framework,AudioToolbox") endif() if(SDL_FRAMEWORK_AVFOUNDATION) - find_library(AVFOUNDATION AVFoundation) - list(APPEND EXTRA_LIBS ${AVFOUNDATION}) + list(APPEND EXTRA_LDFLAGS "-Wl,-framework,AVFoundation") endif() if(SDL_FRAMEWORK_COREBLUETOOTH) - find_library(COREBLUETOOTH CoreBluetooth) - list(APPEND EXTRA_LIBS ${COREBLUETOOTH}) + list(APPEND EXTRA_LDFLAGS "-Wl,-framework,CoreBluetooth") endif() if(SDL_FRAMEWORK_COREGRAPHICS) - find_library(COREGRAPHICS CoreGraphics) - list(APPEND EXTRA_LIBS ${COREGRAPHICS}) + list(APPEND EXTRA_LDFLAGS "-Wl,-framework,CoreGraphics") endif() if(SDL_FRAMEWORK_COREMOTION) - find_library(COREMOTION CoreMotion) - list(APPEND EXTRA_LIBS ${COREMOTION}) + list(APPEND EXTRA_LDFLAGS "-Wl,-framework,CoreMotion") endif() if(SDL_FRAMEWORK_FOUNDATION) - find_library(FOUNDATION Foundation) - list(APPEND EXTRA_LIBS ${FOUNDATION}) + list(APPEND EXTRA_LDFLAGS "-Wl,-framework,Foundation") endif() if(SDL_FRAMEWORK_GAMECONTROLLER) find_library(GAMECONTROLLER GameController) @@ -2095,27 +2171,23 @@ endif() if(SDL_FRAMEWORK_METAL) if(IOS OR TVOS) - find_library(METAL Metal) - list(APPEND EXTRA_LIBS ${METAL}) + list(APPEND EXTRA_LDFLAGS "-Wl,-framework,Metal") else() list(APPEND EXTRA_LDFLAGS "-Wl,-weak_framework,Metal") endif() endif() if(SDL_FRAMEWORK_OPENGLES) - find_library(OPENGLES OpenGLES) - list(APPEND EXTRA_LIBS ${OPENGLES}) + list(APPEND EXTRA_LDFLAGS "-Wl,-framework,OpenGLES") endif() if(SDL_FRAMEWORK_QUARTZCORE) if(IOS OR TVOS) - find_library(QUARTZCORE QuartzCore) - list(APPEND EXTRA_LIBS ${QUARTZCORE}) + list(APPEND EXTRA_LDFLAGS "-Wl,-framework,QuartzCore") else() list(APPEND EXTRA_LDFLAGS "-Wl,-weak_framework,QuartzCore") endif() endif() if(SDL_FRAMEWORK_UIKIT) - find_library(UIKIT UIKit) - list(APPEND EXTRA_LIBS ${UIKIT}) + list(APPEND EXTRA_LDFLAGS "-Wl,-framework,UIKit") endif() if(SDL_FRAMEWORK_COREHAPTICS) find_library(COREHAPTICS CoreHaptics) @@ -2130,27 +2202,27 @@ if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_HAIKU 1) file(GLOB HAIKU_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/haiku/*.cc) - set(SOURCE_FILES ${SOURCE_FILES} ${HAIKU_AUDIO_SOURCES}) + list(APPEND SOURCE_FILES ${HAIKU_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) endif() if(SDL_JOYSTICK) set(SDL_JOYSTICK_HAIKU 1) file(GLOB HAIKU_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/haiku/*.cc) - set(SOURCE_FILES ${SOURCE_FILES} ${HAIKU_JOYSTICK_SOURCES}) + list(APPEND SOURCE_FILES ${HAIKU_JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() if(SDL_MISC) file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/haiku/*.cc) - set(SOURCE_FILES ${SOURCE_FILES} ${MISC_SOURCES}) + list(APPEND SOURCE_FILES ${MISC_SOURCES}) set(HAVE_SDL_MISC TRUE) endif() if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_HAIKU 1) file(GLOB HAIKUVIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/haiku/*.cc) - set(SOURCE_FILES ${SOURCE_FILES} ${HAIKUVIDEO_SOURCES}) + list(APPEND SOURCE_FILES ${HAIKUVIDEO_SOURCES}) set(HAVE_SDL_VIDEO TRUE) if(SDL_OPENGL) @@ -2166,32 +2238,32 @@ if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_HAIKU 1) file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/haiku/*.cc) - set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES}) + list(APPEND SOURCE_FILES ${FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_HAIKU 1) file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/haiku/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES}) + list(APPEND SOURCE_FILES ${TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif() if(SDL_POWER) set(SDL_POWER_HAIKU 1) file(GLOB HAIKU_POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/haiku/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${HAIKU_POWER_SOURCES}) + list(APPEND SOURCE_FILES ${HAIKU_POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) endif() if(SDL_LOCALE) file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/haiku/*.cc) - set(SOURCE_FILES ${SOURCE_FILES} ${LOCALE_SOURCES}) + list(APPEND SOURCE_FILES ${LOCALE_SOURCES}) set(HAVE_SDL_LOCALE TRUE) endif() file(GLOB MAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/haiku/*.cc) - set(SOURCE_FILES ${SOURCE_FILES} ${MAIN_SOURCES}) + list(APPEND SOURCE_FILES ${MAIN_SOURCES}) CheckPTHREAD() list(APPEND EXTRA_LIBS root be media game device textencoding) @@ -2199,28 +2271,28 @@ elseif(RISCOS) if(SDL_MISC) file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/riscos/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${MISC_SOURCES}) + list(APPEND SOURCE_FILES ${MISC_SOURCES}) set(HAVE_SDL_MISC TRUE) endif() if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_RISCOS 1) file(GLOB RISCOSVIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/riscos/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${RISCOSVIDEO_SOURCES}) + list(APPEND SOURCE_FILES ${RISCOSVIDEO_SOURCES}) set(HAVE_SDL_VIDEO TRUE) endif() if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_RISCOS 1) file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/riscos/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES}) + list(APPEND SOURCE_FILES ${FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_UNIX 1) file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES}) + list(APPEND SOURCE_FILES ${TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) if(SDL_CLOCK_GETTIME) @@ -2243,37 +2315,37 @@ if(SDL_MISC) file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/vita/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${MISC_SOURCES}) + list(APPEND SOURCE_FILES ${MISC_SOURCES}) set(HAVE_SDL_MISC TRUE) endif() if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_VITA 1) file(GLOB VITA_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/vita/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${VITA_AUDIO_SOURCES}) + list(APPEND SOURCE_FILES ${VITA_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) endif() if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_VITA 1) file(GLOB VITA_FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/vita/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${VITA_FILESYSTEM_SOURCES}) + list(APPEND SOURCE_FILES ${VITA_FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() if(SDL_JOYSTICK) set(SDL_JOYSTICK_VITA 1) file(GLOB VITA_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/vita/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${VITA_JOYSTICK_SOURCES}) + list(APPEND SOURCE_FILES ${VITA_JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() if(SDL_POWER) set(SDL_POWER_VITA 1) file(GLOB VITA_POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/vita/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${VITA_POWER_SOURCES}) + list(APPEND SOURCE_FILES ${VITA_POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) endif() if(SDL_THREADS) set(SDL_THREAD_VITA 1) - set(SOURCE_FILES ${SOURCE_FILES} + list(APPEND SOURCE_FILES ${SDL2_SOURCE_DIR}/src/thread/vita/SDL_sysmutex.c ${SDL2_SOURCE_DIR}/src/thread/vita/SDL_syssem.c ${SDL2_SOURCE_DIR}/src/thread/vita/SDL_systhread.c @@ -2283,25 +2355,25 @@ endif() if(SDL_LOCALE) file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/vita/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${LOCALE_SOURCES}) + list(APPEND SOURCE_FILES ${LOCALE_SOURCES}) set(HAVE_SDL_LOCALE TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_VITA 1) file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/vita/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES}) + list(APPEND SOURCE_FILES ${TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif() if(SDL_SENSOR) set(SDL_SENSOR_VITA 1) set(HAVE_SDL_SENSORS TRUE) file(GLOB VITA_SENSOR_SOURCES ${SDL2_SOURCE_DIR}/src/sensor/vita/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${VITA_SENSOR_SOURCES}) + list(APPEND SOURCE_FILES ${VITA_SENSOR_SOURCES}) endif() if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_VITA 1) file(GLOB VITA_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/vita/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${VITA_VIDEO_SOURCES}) + list(APPEND SOURCE_FILES ${VITA_VIDEO_SOURCES}) set(HAVE_SDL_VIDEO TRUE) if(VIDEO_VITA_PIB) @@ -2359,6 +2431,7 @@ SceDisplay_stub SceCtrl_stub SceAppMgr_stub + SceAppUtil_stub SceAudio_stub SceAudioIn_stub SceSysmodule_stub @@ -2388,15 +2461,15 @@ endif() endif() -# set(HAVE_ARMSIMD TRUE) + set(HAVE_ARMSIMD TRUE) # set(SDL_ARM_SIMD_BLITTERS 1) # file(GLOB ARMSIMD_SOURCES ${SDL2_SOURCE_DIR}/src/video/arm/pixman-arm-simd*.S) -# set(SOURCE_FILES ${SOURCE_FILES} ${ARMSIMD_SOURCES}) +# list(APPEND SOURCE_FILES ${ARMSIMD_SOURCES}) -# set(HAVE_ARMNEON TRUE) + set(HAVE_ARMNEON TRUE) # set(SDL_ARM_NEON_BLITTERS 1) # file(GLOB ARMNEON_SOURCES ${SDL2_SOURCE_DIR}/src/video/arm/pixman-arm-neon*.S) -# set(SOURCE_FILES ${SOURCE_FILES} ${ARMNEON_SOURCES}) +# list(APPEND SOURCE_FILES ${ARMNEON_SOURCES}) # set_property(SOURCE ${SDL2_SOURCE_DIR}/src/video/arm/pixman-arm-simd-asm.S PROPERTY LANGUAGE C) # set_property(SOURCE ${SDL2_SOURCE_DIR}/src/video/arm/pixman-arm-neon-asm.S PROPERTY LANGUAGE C) @@ -2411,49 +2484,49 @@ elseif(PSP) file(GLOB PSP_MAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/psp/*.c) - set(SDLMAIN_SOURCES ${SDLMAIN_SOURCES} ${PSP_MAIN_SOURCES}) + list(APPEND SDLMAIN_SOURCES ${PSP_MAIN_SOURCES}) if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_PSP 1) file(GLOB PSP_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/psp/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${PSP_AUDIO_SOURCES}) + list(APPEND SOURCE_FILES ${PSP_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) endif() if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_PSP 1) file(GLOB PSP_FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/psp/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${PSP_FILESYSTEM_SOURCES}) + list(APPEND SOURCE_FILES ${PSP_FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() if(SDL_JOYSTICK) set(SDL_JOYSTICK_PSP 1) file(GLOB PSP_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/psp/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${PSP_JOYSTICK_SOURCES}) + list(APPEND SOURCE_FILES ${PSP_JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() if(SDL_POWER) set(SDL_POWER_PSP 1) file(GLOB PSP_POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/psp/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${PSP_POWER_SOURCES}) + list(APPEND SOURCE_FILES ${PSP_POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) endif() if(SDL_THREADS) set(SDL_THREAD_PSP 1) file(GLOB PSP_THREAD_SOURCES ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_systls.c ${SDL2_SOURCE_DIR}/src/thread/psp/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${PSP_THREAD_SOURCES}) + list(APPEND SOURCE_FILES ${PSP_THREAD_SOURCES}) set(HAVE_SDL_THREADS TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_PSP 1) file(GLOB PSP_TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/psp/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${PSP_TIMER_SOURCES}) + list(APPEND SOURCE_FILES ${PSP_TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif() if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_PSP 1) set(SDL_VIDEO_RENDER_PSP 1) file(GLOB PSP_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/psp/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${PSP_VIDEO_SOURCES}) + list(APPEND SOURCE_FILES ${PSP_VIDEO_SOURCES}) set(SDL_VIDEO_OPENGL 1) set(HAVE_SDL_VIDEO TRUE) endif() @@ -2469,63 +2542,118 @@ pspaudio pspvram GL - ) + ) + if(NOT SDL2_DISABLE_SDL2MAIN) + list(INSERT SDL_LIBS 0 "-lSDL2main") + endif(NOT SDL2_DISABLE_SDL2MAIN) + +elseif(PS2) + list(APPEND EXTRA_CFLAGS "-DPS2" "-D__PS2__" "-I$ENV{PS2SDK}/ports/include" "-I$ENV{PS2DEV}/gsKit/include") + + file(GLOB PS2_MAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/ps2/*.c) + set(SDLMAIN_SOURCES ${SDLMAIN_SOURCES} ${PS2_MAIN_SOURCES}) + + if(SDL_AUDIO) + set(SDL_AUDIO_DRIVER_PS2 1) + file(GLOB PS2_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/ps2/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${PS2_AUDIO_SOURCES}) + set(HAVE_SDL_AUDIO TRUE) + endif() + if(SDL_FILESYSTEM) + set(SDL_FILESYSTEM_PS2 1) + file(GLOB PS2_FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/ps2/*.c) + list(APPEND SOURCE_FILES ${PS2_FILESYSTEM_SOURCES}) + set(HAVE_SDL_FILESYSTEM TRUE) + endif() + if(SDL_JOYSTICK) + set(SDL_JOYSTICK_PS2 1) + file(GLOB PS2_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/ps2/*.c) + list(APPEND SOURCE_FILES ${PS2_JOYSTICK_SOURCES}) + set(HAVE_SDL_JOYSTICK TRUE) + endif() + if(SDL_THREADS) + set(SDL_THREAD_PS2 1) + file(GLOB PS2_THREAD_SOURCES ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_systls.c ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_sysmutex.c ${SDL2_SOURCE_DIR}/src/thread/ps2/*.c) + list(APPEND SOURCE_FILES ${PS2_THREAD_SOURCES}) + set(HAVE_SDL_THREADS TRUE) + endif() + if(SDL_TIMERS) + set(SDL_TIMER_PS2 1) + file(GLOB PS2_TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/ps2/*.c) + list(APPEND SOURCE_FILES ${PS2_TIMER_SOURCES}) + set(HAVE_SDL_TIMERS TRUE) + endif() + if(SDL_VIDEO) + set(SDL_VIDEO_DRIVER_PS2 1) + set(SDL_VIDEO_RENDER_PS2 1) + file(GLOB PS2_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/ps2/*.c ${SDL2_SOURCE_DIR}/src/render/ps2/*.c) + list(APPEND SOURCE_FILES ${PS2_VIDEO_SOURCES}) + set(SDL_VIDEO_OPENGL 0) + set(HAVE_SDL_VIDEO TRUE) + endif() + + list(APPEND EXTRA_LIBS + patches + gskit + dmakit + ps2_drivers + ) elseif(OS2) list(APPEND EXTRA_CFLAGS "-DOS2EMX_PLAIN_CHAR") file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/os2/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${CORE_SOURCES}) + list(APPEND SOURCE_FILES ${CORE_SOURCES}) if(NOT (HAVE_ICONV AND HAVE_ICONV_H)) file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/os2/geniconv/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${CORE_SOURCES}) + list(APPEND SOURCE_FILES ${CORE_SOURCES}) endif() if(SDL_THREADS) set(SDL_THREAD_OS2 1) file(GLOB OS2_THREAD_SOURCES ${SDL2_SOURCE_DIR}/src/thread/os2/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${OS2_THREAD_SOURCES}) + list(APPEND SOURCE_FILES ${OS2_THREAD_SOURCES}) set(HAVE_SDL_THREADS TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_UNIX 1) file(GLOB OS2_TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/os2/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${OS2_TIMER_SOURCES}) + list(APPEND SOURCE_FILES ${OS2_TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif() if(SDL_LOADSO) set(SDL_LOADSO_OS2 1) file(GLOB OS2_LOADSO_SOURCES ${SDL2_SOURCE_DIR}/src/loadso/os2/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${OS2_LOADSO_SOURCES}) + list(APPEND SOURCE_FILES ${OS2_LOADSO_SOURCES}) set(HAVE_SDL_LOADSO TRUE) endif() if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_OS2 1) file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/os2/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES}) + list(APPEND SOURCE_FILES ${FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() if(SDL_LOCALE) file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/unix/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${LOCALE_SOURCES}) + list(APPEND SOURCE_FILES ${LOCALE_SOURCES}) set(HAVE_SDL_LOCALE TRUE) endif() if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_OS2 1) file(GLOB OS2_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/os2/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${OS2_VIDEO_SOURCES}) + list(APPEND SOURCE_FILES ${OS2_VIDEO_SOURCES}) set(HAVE_SDL_VIDEO TRUE) endif() if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_OS2 1) file(GLOB OS2_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/os2/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${OS2_AUDIO_SOURCES}) + list(APPEND SOURCE_FILES ${OS2_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) list(APPEND EXTRA_LIBS mmpm2) endif() @@ -2533,7 +2661,7 @@ if(SDL_JOYSTICK) set(SDL_JOYSTICK_OS2 1) file(GLOB OS2_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/os2/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${OS2_JOYSTICK_SOURCES}) + list(APPEND SOURCE_FILES ${OS2_JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() @@ -2548,6 +2676,9 @@ set(SDL_VIDEO_VULKAN 0) endif() +# Platform-independent options +CheckLibSampleRate() + # Dummies # configure.ac does it differently: # if not have X @@ -2559,59 +2690,64 @@ if(NOT HAVE_SDL_AUDIO) set(SDL_AUDIO_DRIVER_DUMMY 1) file(GLOB AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/dummy/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${AUDIO_SOURCES}) + list(APPEND SOURCE_FILES ${AUDIO_SOURCES}) endif() if(NOT HAVE_SDL_VIDEO) set(SDL_VIDEO_DRIVER_DUMMY 1) file(GLOB VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/dummy/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${VIDEO_SOURCES}) + list(APPEND SOURCE_FILES ${VIDEO_SOURCES}) endif() if(NOT HAVE_SDL_JOYSTICK) set(SDL_JOYSTICK_DUMMY 1) file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/dummy/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES}) + list(APPEND SOURCE_FILES ${JOYSTICK_SOURCES}) endif() if(NOT HAVE_SDL_HAPTIC) set(SDL_HAPTIC_DUMMY 1) file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/dummy/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES}) + list(APPEND SOURCE_FILES ${HAPTIC_SOURCES}) endif() if(NOT HAVE_SDL_SENSORS) set(SDL_SENSOR_DUMMY 1) file(GLOB SENSORS_SOURCES ${SDL2_SOURCE_DIR}/src/sensor/dummy/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${SENSORS_SOURCES}) + list(APPEND SOURCE_FILES ${SENSORS_SOURCES}) endif() if(NOT HAVE_SDL_LOADSO) set(SDL_LOADSO_DUMMY 1) file(GLOB LOADSO_SOURCES ${SDL2_SOURCE_DIR}/src/loadso/dummy/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${LOADSO_SOURCES}) + list(APPEND SOURCE_FILES ${LOADSO_SOURCES}) endif() if(NOT HAVE_SDL_FILESYSTEM) set(SDL_FILESYSTEM_DUMMY 1) file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/dummy/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES}) + list(APPEND SOURCE_FILES ${FILESYSTEM_SOURCES}) endif() if(NOT HAVE_SDL_LOCALE) set(SDL_LOCALE_DUMMY 1) file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/dummy/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${LOCALE_SOURCES}) + list(APPEND SOURCE_FILES ${LOCALE_SOURCES}) endif() if(NOT HAVE_SDL_MISC) set(SDL_MISC_DUMMY 1) file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/dummy/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${MISC_SOURCES}) + list(APPEND SOURCE_FILES ${MISC_SOURCES}) endif() # We always need to have threads and timers around if(NOT HAVE_SDL_THREADS) - set(SDL_THREADS_DISABLED 1) - file(GLOB THREADS_SOURCES ${SDL2_SOURCE_DIR}/src/thread/generic/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${THREADS_SOURCES}) + # The emscripten platform has been carefully vetted to work without threads + if (EMSCRIPTEN) + set(SDL_THREADS_DISABLED 1) + file(GLOB THREADS_SOURCES ${SDL2_SOURCE_DIR}/src/thread/generic/*.c) + list(APPEND SOURCE_FILES ${THREADS_SOURCES}) + else() + message_error("Threads are needed by many SDL subsystems and may not be disabled") + endif() endif() if(NOT HAVE_SDL_TIMERS) set(SDL_TIMER_DUMMY 1) file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/dummy/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES}) + list(APPEND SOURCE_FILES ${TIMER_SOURCES}) endif() if(NOT SDLMAIN_SOURCES) @@ -2625,8 +2761,17 @@ # endif() # endif() +# config variables may contain generator expression, so we need to generate SDL_config.h in 2 steps: +# 1. replace all `#cmakedefine`'s and `@abc@` configure_file("${SDL2_SOURCE_DIR}/include/SDL_config.h.cmake" - "${SDL2_BINARY_DIR}/include/SDL_config.h") + "${SDL2_BINARY_DIR}/SDL_config.h.intermediate") +# 2. Create the "include-config-${CMAKE_BUILD_TYPE}" folder (fails on older CMake versions when it does not exist) +string(TOLOWER "${CMAKE_BUILD_TYPE}" lower_build_type) +execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/include-config-${lower_build_type}") +# 3. generate SDL_config in an build_type-dependent folder (which should be first in the include search path) +file(GENERATE + OUTPUT "${SDL2_BINARY_DIR}/include-config-$>/SDL_config.h" + INPUT "${SDL2_BINARY_DIR}/SDL_config.h.intermediate") # Prepare the flags and remove duplicates if(EXTRA_LDFLAGS) @@ -2670,14 +2815,33 @@ configure_file("${SDL2_SOURCE_DIR}/include/SDL_revision.h.cmake" "${SDL2_BINARY_DIR}/include/SDL_revision.h") +# Copy all non-generated headers to "${SDL2_BINARY_DIR}/include" +# This is done to avoid the inclusion of a pre-generated SDL_config.h +file(GLOB SDL2_INCLUDE_FILES ${SDL2_SOURCE_DIR}/include/*.h) +set(SDL2_COPIED_INCLUDE_FILES) +foreach(_hdr IN LISTS SDL2_INCLUDE_FILES) + if(_hdr MATCHES ".*(SDL_config|SDL_revision).*") + list(REMOVE_ITEM SDL2_INCLUDE_FILES "${_hdr}") + else() + get_filename_component(_name "${_hdr}" NAME) + set(_bin_hdr "${SDL2_BINARY_DIR}/include/${_name}") + list(APPEND SDL2_COPIED_INCLUDE_FILES "${_bin_hdr}") + add_custom_command(OUTPUT "${_bin_hdr}" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_hdr}" "${_bin_hdr}" + DEPENDS "${_hdr}") + endif() +endforeach() +list(APPEND SDL_GENERATED_HEADERS ${SDL2_COPIED_INCLUDE_FILES}) + if(NOT WINDOWS OR CYGWIN OR MINGW) set(prefix ${CMAKE_INSTALL_PREFIX}) + file(RELATIVE_PATH bin_prefix_relpath "${CMAKE_INSTALL_FULL_BINDIR}" "${CMAKE_INSTALL_PREFIX}") set(exec_prefix "\${prefix}") - set(libdir "${CMAKE_INSTALL_FULL_LIBDIR}") - set(bindir "${CMAKE_INSTALL_FULL_BINDIR}") - set(includedir "${CMAKE_INSTALL_FULL_INCLUDEDIR}") + set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}") + set(bindir "\${exec_prefix}/${CMAKE_INSTALL_BINDIR}") + set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") if(SDL_STATIC) set(ENABLE_STATIC_TRUE "") set(ENABLE_STATIC_FALSE "#") @@ -2697,23 +2861,15 @@ endif() # Clean up the different lists - if (VITA) - listtostrrev(EXTRA_LIBS _EXTRA_LIBS "-l") - set(SDL_STATIC_LIBS ${SDL_LIBS} ${EXTRA_LDFLAGS} ${_EXTRA_LIBS}) - list(REMOVE_DUPLICATES SDL_STATIC_LIBS) - listtostrrev(SDL_STATIC_LIBS _SDL_STATIC_LIBS) - set(SDL_STATIC_LIBS ${_SDL_STATIC_LIBS}) - listtostrrev(SDL_LIBS _SDL_LIBS) - set(SDL_LIBS ${_SDL_LIBS}) - else() - listtostr(EXTRA_LIBS _EXTRA_LIBS "-l") - set(SDL_STATIC_LIBS ${SDL_LIBS} ${EXTRA_LDFLAGS} ${_EXTRA_LIBS}) - list(REMOVE_DUPLICATES SDL_STATIC_LIBS) - listtostr(SDL_STATIC_LIBS _SDL_STATIC_LIBS) - set(SDL_STATIC_LIBS ${_SDL_STATIC_LIBS}) - listtostr(SDL_LIBS _SDL_LIBS) - set(SDL_LIBS ${_SDL_LIBS}) - endif() + listtostr(EXTRA_LIBS _EXTRA_LIBS "-l") + set(SDL_STATIC_LIBS ${SDL_LIBS} ${EXTRA_LDFLAGS} ${_EXTRA_LIBS}) + list(REMOVE_DUPLICATES SDL_STATIC_LIBS) + listtostr(SDL_STATIC_LIBS _SDL_STATIC_LIBS) + set(SDL_STATIC_LIBS ${_SDL_STATIC_LIBS}) + listtostr(SDL_LIBS _SDL_LIBS) + set(SDL_LIBS ${_SDL_LIBS}) + listtostr(SDL_CFLAGS _SDL_CFLAGS "") + set(SDL_CFLAGS ${_SDL_CFLAGS}) # MESSAGE(STATUS "SDL_LIBS: ${SDL_LIBS}") # MESSAGE(STATUS "SDL_STATIC_LIBS: ${SDL_STATIC_LIBS}") @@ -2793,6 +2949,10 @@ endif() endif() +# Create target that collects all all generated include files. +add_custom_target(sdl_headers_copy + DEPENDS ${SDL_GENERATED_HEADERS}) + ##### Info output ##### message(STATUS "") message(STATUS "SDL2 was configured with the following options:") @@ -2825,7 +2985,7 @@ message(STATUS "") message(STATUS " CFLAGS: ${CMAKE_C_FLAGS}") message(STATUS " EXTRA_CFLAGS: ${EXTRA_CFLAGS}") -message(STATUS " EXTRA_LDFLAGS: ${EXTRA_LDFLAGS}") +message(STATUS " EXTRA_LDFLAGS: ${EXTRA_LDFLAGS} ${EXTRA_LDFLAGS_BUILD}") message(STATUS " EXTRA_LIBS: ${EXTRA_LIBS}") message(STATUS "") message(STATUS " Build Shared Library: ${SDL_SHARED}") @@ -2860,15 +3020,27 @@ endif() # Ensure that the extra cflags are used at compile time -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} ${EXTRA_CFLAGS_BUILD}") if(NOT WINDOWS_STORE AND NOT SDL2_DISABLE_SDL2MAIN) # Build SDLmain add_library(SDL2main STATIC ${SDLMAIN_SOURCES}) + add_dependencies(SDL2main sdl_headers_copy) # alias target for in-tree builds add_library(SDL2::SDL2main ALIAS SDL2main) - target_include_directories(SDL2main BEFORE PRIVATE "${SDL2_BINARY_DIR}/include") - target_include_directories(SDL2main PUBLIC "$" $ $) + target_include_directories(SDL2main BEFORE PRIVATE "${SDL2_BINARY_DIR}/include" PRIVATE "${SDL2_BINARY_DIR}/include-config-$>") + target_include_directories(SDL2main PUBLIC "$" $ $) + if (WIN32) + target_link_libraries(SDL2main PRIVATE shell32) + endif() + if(MINGW OR CYGWIN) + cmake_minimum_required(VERSION 3.13) + if(CMAKE_SIZEOF_VOID_P EQUAL 4) + target_link_options(SDL2main PUBLIC "-Wl,--undefined=_WinMain@16") + else() + target_link_options(SDL2main PUBLIC "-Wl,--undefined=WinMain") + endif() + endif() if (NOT ANDROID) set_target_properties(SDL2main PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}") endif() @@ -2878,14 +3050,20 @@ target_include_directories(sdl-build-options INTERFACE "${ANDROID_NDK}/sources/android/cpufeatures") endif() -if(IOS OR TVOS) +if(APPLE) target_compile_options(sdl-build-options INTERFACE "-fobjc-arc") endif() +if(PS2) + target_compile_options(sdl-build-options INTERFACE "-Wno-error=declaration-after-statement") +endif() + if(SDL_SHARED) add_library(SDL2 SHARED ${SOURCE_FILES} ${VERSION_SOURCES}) + add_dependencies(SDL2 sdl_headers_copy) # alias target for in-tree builds add_library(SDL2::SDL2 ALIAS SDL2) + set_target_properties(SDL2 PROPERTIES POSITION_INDEPENDENT_CODE TRUE) if(APPLE) set_target_properties(SDL2 PROPERTIES MACOSX_RPATH 1 @@ -2909,7 +3087,7 @@ OUTPUT_NAME "SDL2") endif() # Note: The clang toolset for Visual Studio does not support /NODEFAULTLIB. - if(MSVC AND NOT SDL_LIBC AND NOT MSVC_CLANG) + if(MSVC AND NOT SDL_LIBC AND NOT MSVC_CLANG AND NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM") # Don't try to link with the default set of libraries. if(NOT WINDOWS_STORE) set_target_properties(SDL2 PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB") @@ -2917,55 +3095,78 @@ endif() set_target_properties(SDL2 PROPERTIES STATIC_LIBRARY_FLAGS "/NODEFAULTLIB") endif() - target_link_libraries(SDL2 PRIVATE ${EXTRA_LIBS} ${EXTRA_LDFLAGS}) - target_include_directories(SDL2 BEFORE PRIVATE "${SDL2_BINARY_DIR}/include") - target_include_directories(SDL2 PUBLIC "$;$;$") + # FIXME: if CMAKE_VERSION >= 3.13, use target_link_options for EXTRA_LDFLAGS + target_link_libraries(SDL2 PRIVATE ${EXTRA_LIBS} ${EXTRA_LDFLAGS} ${EXTRA_LDFLAGS_BUILD}) + target_include_directories(SDL2 PUBLIC + "$" + "$>>" + "$" + "$") # This picks up all the compiler options and such we've accumulated up to here. target_link_libraries(SDL2 PRIVATE $) + if(MINGW OR CYGWIN) + if(NOT CMAKE_VERSION VERSION_LESS "3.13") + target_link_options(SDL2 PRIVATE -static-libgcc) + endif() + endif() if(NOT ANDROID) set_target_properties(SDL2 PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}") endif() + # Use `Compatible Interface Properties` to allow consumers to enforce a shared/static library + set_property(TARGET SDL2 PROPERTY INTERFACE_SDL2_SHARED TRUE) + set_property(TARGET SDL2 APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SDL2_SHARED) endif() if(SDL_STATIC) - set (BUILD_SHARED_LIBS FALSE) add_library(SDL2-static STATIC ${SOURCE_FILES}) + add_dependencies(SDL2-static sdl_headers_copy) # alias target for in-tree builds add_library(SDL2::SDL2-static ALIAS SDL2-static) - if (NOT SDL_SHARED OR NOT WIN32 OR MINGW) + if(MSVC OR (WATCOM AND (WIN32 OR OS2))) + # Avoid conflict between the dll import library and the static library + set_target_properties(SDL2-static PROPERTIES OUTPUT_NAME "SDL2-static") + else() set_target_properties(SDL2-static PROPERTIES OUTPUT_NAME "SDL2") - # Note: Apparently, OUTPUT_NAME must really be unique; even when - # CMAKE_IMPORT_LIBRARY_SUFFIX or the like are given. Otherwise - # the static build may race with the import lib and one will get - # clobbered, when the suffix is realized via subsequent rename. - endif() - set_target_properties(SDL2-static PROPERTIES POSITION_INDEPENDENT_CODE ${SDL_STATIC_PIC}) - # Note: The clang toolset for Visual Studio does not support /NODEFAULTLIB. - if(MSVC AND NOT SDL_LIBC AND NOT MSVC_CLANG) - set_target_properties(SDL2-static PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB") - set_target_properties(SDL2-static PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB") - set_target_properties(SDL2-static PROPERTIES STATIC_LIBRARY_FLAGS "/NODEFAULTLIB") endif() + set_target_properties(SDL2-static PROPERTIES POSITION_INDEPENDENT_CODE "${SDL_STATIC_PIC}") + target_compile_definitions(SDL2-static PRIVATE SDL_STATIC_LIB) # TODO: Win32 platforms keep the same suffix .lib for import and static # libraries - do we need to consider this? target_link_libraries(SDL2-static PRIVATE ${EXTRA_LIBS} ${EXTRA_LDFLAGS}) - target_include_directories(SDL2-static BEFORE PRIVATE "${SDL2_BINARY_DIR}/include") - target_include_directories(SDL2-static PUBLIC "$" $ $) + target_include_directories(SDL2-static PUBLIC + "$" + "$>>" + "$" + "$") # This picks up all the compiler options and such we've accumulated up to here. target_link_libraries(SDL2-static PRIVATE $) if(NOT ANDROID) set_target_properties(SDL2-static PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}") endif() + # Use `Compatible Interface Properties` to allow consumers to enforce a shared/static library + set_property(TARGET SDL2-static PROPERTY INTERFACE_SDL2_SHARED FALSE) + set_property(TARGET SDL2-static APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SDL2_SHARED) endif() +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSDL_BUILD_MAJOR_VERSION=${SDL_MAJOR_VERSION}") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSDL_BUILD_MINOR_VERSION=${SDL_MINOR_VERSION}") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSDL_BUILD_MICRO_VERSION=${SDL_MICRO_VERSION}") + ##### Tests ##### if(SDL_TEST) - include_directories(BEFORE "${SDL2_BINARY_DIR}/include") - include_directories(AFTER "${SDL2_SOURCE_DIR}/include") file(GLOB TEST_SOURCES ${SDL2_SOURCE_DIR}/src/test/*.c) add_library(SDL2_test STATIC ${TEST_SOURCES}) - add_subdirectory(test) + add_dependencies(SDL2_test sdl_headers_copy) + add_library(SDL2::SDL2test ALIAS SDL2_test) + set_target_properties(SDL2_test PROPERTIES + EXPORT_NAME SDL2test) + target_include_directories(SDL2_test PUBLIC + "$" + "$>>" + "$" + "$") + target_link_libraries(SDL2_test PRIVATE ${EXTRA_TEST_LIBS}) endif() ##### Installation targets ##### @@ -2991,6 +3192,13 @@ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") endif() + if(SDL_TEST) + install(TARGETS SDL2_test EXPORT SDL2testTargets + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") + endif() + ##### Export files ##### if (WINDOWS AND NOT MINGW) set(PKG_PREFIX "cmake") @@ -2999,7 +3207,11 @@ endif () include(CMakePackageConfigHelpers) - write_basic_package_version_file("${CMAKE_BINARY_DIR}/SDL2ConfigVersion.cmake" + configure_package_config_file(SDL2Config.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/SDL2Config.cmake" + PATH_VARS CMAKE_INSTALL_PREFIX CMAKE_INSTALL_FULL_BINDIR CMAKE_INSTALL_FULL_INCLUDEDIR CMAKE_INSTALL_FULL_LIBDIR + INSTALL_DESTINATION ${PKG_PREFIX} + ) + write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/SDL2ConfigVersion.cmake" VERSION ${SDL_VERSION} COMPATIBILITY AnyNewerVersion ) @@ -3010,6 +3222,10 @@ NAMESPACE SDL2:: DESTINATION ${PKG_PREFIX} ) + if(ANDROID AND NOT CMAKE_VERSION VERSION_LESS 3.7) + install(EXPORT_ANDROID_MK SDL2Targets + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/ndk-modules/SDL2") + endif() endif() if(NOT WINDOWS_STORE AND NOT SDL2_DISABLE_SDL2MAIN) @@ -3018,6 +3234,10 @@ NAMESPACE SDL2:: DESTINATION ${PKG_PREFIX} ) + if(ANDROID AND NOT CMAKE_VERSION VERSION_LESS 3.7) + install(EXPORT_ANDROID_MK SDL2mainTargets + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/ndk-modules/SDL2main") + endif() endif() if(SDL_STATIC) @@ -3026,24 +3246,38 @@ NAMESPACE SDL2:: DESTINATION ${PKG_PREFIX} ) + if(ANDROID AND NOT CMAKE_VERSION VERSION_LESS 3.7) + install(EXPORT_ANDROID_MK SDL2staticTargets + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/ndk-modules/SDL2-static") + endif() + endif() + + if(SDL_TEST) + install(EXPORT SDL2testTargets + FILE SDL2testTargets.cmake + NAMESPACE SDL2:: + DESTINATION ${PKG_PREFIX} + ) + if(ANDROID AND NOT CMAKE_VERSION VERSION_LESS 3.7) + install(EXPORT_ANDROID_MK SDL2testTargets + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/ndk-modules/SDL2test") + endif() endif() install( FILES - ${CMAKE_CURRENT_SOURCE_DIR}/SDL2Config.cmake - ${CMAKE_BINARY_DIR}/SDL2ConfigVersion.cmake + ${CMAKE_CURRENT_BINARY_DIR}/SDL2Config.cmake + ${CMAKE_CURRENT_BINARY_DIR}/SDL2ConfigVersion.cmake DESTINATION ${PKG_PREFIX} COMPONENT Devel ) - file(GLOB INCLUDE_FILES ${SDL2_SOURCE_DIR}/include/*.h) - file(GLOB BIN_INCLUDE_FILES ${SDL2_BINARY_DIR}/include/*.h) - foreach(_FNAME ${BIN_INCLUDE_FILES}) - get_filename_component(_INCNAME ${_FNAME} NAME) - list(REMOVE_ITEM INCLUDE_FILES ${SDL2_SOURCE_DIR}/include/${_INCNAME}) - endforeach() - list(APPEND INCLUDE_FILES ${BIN_INCLUDE_FILES}) - install(FILES ${INCLUDE_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SDL2) + install( + FILES + ${SDL2_INCLUDE_FILES} + "${SDL2_BINARY_DIR}/include/SDL_revision.h" + "${SDL2_BINARY_DIR}/include-config-$>/SDL_config.h" + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SDL2) string(TOUPPER "${CMAKE_BUILD_TYPE}" UPPER_BUILD_TYPE) if (UPPER_BUILD_TYPE MATCHES DEBUG) @@ -3074,6 +3308,7 @@ install(PROGRAMS ${SDL2_BINARY_DIR}/sdl2-config DESTINATION "${CMAKE_INSTALL_BINDIR}") # TODO: what about the .spec file? Is it only needed for RPM creation? install(FILES "${SDL2_SOURCE_DIR}/sdl2.m4" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/aclocal") + install(FILES "LICENSE.txt" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/licenses/${PROJECT_NAME}") endif() endif() @@ -3091,3 +3326,17 @@ endif() endif() +##### Tests subproject (must appear after the install/uninstall targets) ##### + +if(SDL_TESTS) + enable_testing() + add_subdirectory(test) +endif() + +##### Fix Objective C builds ##### +set(CMAKE_OBJC_FLAGS "${CMAKE_OBJC_FLAGS} ${CMAKE_C_FLAGS}") + +# Make sure SDL2::SDL2 always exists +if(TARGET SDL2::SDL2-static AND NOT TARGET SDL2::SDL2) + add_library(SDL2::SDL2 ALIAS SDL2-static) +endif() diff -Nru libsdl2-2.0.22+dfsg/configure libsdl2-2.24.0+dfsg/configure --- libsdl2-2.0.22+dfsg/configure 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/configure 2022-08-19 15:46:21.000000000 +0000 @@ -1,9 +1,10 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69. +# Generated by GNU Autoconf 2.71. # # -# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, +# Inc. # # # This configure script is free software; the Free Software Foundation @@ -14,14 +15,16 @@ # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -31,46 +34,46 @@ fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -79,13 +82,6 @@ fi -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -94,8 +90,12 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS @@ -107,30 +107,10 @@ as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. @@ -152,20 +132,22 @@ exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + as_bourne_compatible="as_nop=: +if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST -else +else \$as_nop case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( @@ -185,12 +167,15 @@ as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : +if ( set x; as_fn_ret_success y && test x = \"\$1\" ) +then : -else +else \$as_nop exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 +blah=\$(echo \$(echo blah)) +test x\"\$blah\" = xblah || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO @@ -205,30 +190,38 @@ test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null; then : + if (eval "$as_required") 2>/dev/null +then : as_have_required=yes -else +else $as_nop as_have_required=no fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null +then : -else +else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base + as_shell=$as_dir$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null +then : break 2 fi fi @@ -236,14 +229,21 @@ esac as_found=false done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi +fi - if test "x$CONFIG_SHELL" != x; then : + if test "x$CONFIG_SHELL" != x +then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also @@ -261,18 +261,19 @@ exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." + if test x$as_have_required = xno +then : + printf "%s\n" "$0: This script requires a shell more modern than all" + printf "%s\n" "$0: the shells that I found on your system." + if test ${ZSH_VERSION+y} ; then + printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" + printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." else - $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, + printf "%s\n" "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." @@ -299,6 +300,7 @@ } as_unset=as_fn_unset + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -316,6 +318,14 @@ as_fn_set_status $1 exit $1 } # as_fn_exit +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop # as_fn_mkdir_p # ------------- @@ -330,7 +340,7 @@ as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -339,7 +349,7 @@ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | +printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -378,12 +388,13 @@ # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : eval 'as_fn_append () { eval $1+=\$2 }' -else +else $as_nop as_fn_append () { eval $1=\$$1\$2 @@ -395,18 +406,27 @@ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else +else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- @@ -418,9 +438,9 @@ as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $2" >&2 + printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -447,7 +467,7 @@ $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -491,7 +511,7 @@ s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall @@ -505,6 +525,10 @@ exit } + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -518,6 +542,13 @@ ECHO_N='-n';; esac +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -585,50 +616,46 @@ MAKEFLAGS= # Identity of this package. -PACKAGE_NAME= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= -PACKAGE_URL= +PACKAGE_NAME='' +PACKAGE_TARNAME='' +PACKAGE_VERSION='' +PACKAGE_STRING='' +PACKAGE_BUGREPORT='' +PACKAGE_URL='' ac_unique_file="src/SDL.c" # Factoring default headers for most tests. ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include +#include +#ifdef HAVE_STDIO_H +# include #endif -#ifdef STDC_HEADERS +#ifdef HAVE_STDLIB_H # include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif #endif #ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif # include #endif -#ifdef HAVE_STRINGS_H -# include -#endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif #ifdef HAVE_UNISTD_H # include #endif" +ac_header_c_list= ac_subst_vars='LTLIBOBJS WAYLAND_SCANNER_CODE_MODE WAYLAND_SCANNER @@ -653,6 +680,8 @@ SDL_STATIC_LIBS SDL_LIBS SDL_CFLAGS +bin_prefix_relpath +cmake_prefix_relpath INSTALL_SDL2_CONFIG LIBUSB_LIBS LIBUSB_CFLAGS @@ -692,6 +721,7 @@ POW_LIB LIBOBJS ALLOCA +CPP LIBTOOLLINKERTAG LINKER PKG_CONFIG_LIBDIR @@ -710,7 +740,6 @@ LT_CURRENT LT_RELEASE RC -CPP LT_SYS_LIBRARY_PATH OTOOL64 OTOOL @@ -776,6 +805,7 @@ docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -806,6 +836,7 @@ with_gnu_ld with_sysroot enable_libtool_lock +enable_largefile enable_assertions enable_dependency_tracking enable_libc @@ -821,7 +852,6 @@ enable_sensor enable_power enable_filesystem -enable_threads enable_timers enable_file enable_misc @@ -836,6 +866,8 @@ enable_sse2 enable_sse3 enable_altivec +enable_lsx +enable_lasx enable_oss enable_alsa with_alsa_prefix @@ -878,13 +910,11 @@ enable_x11_shared enable_video_x11_xcursor enable_video_x11_xdbe -enable_video_x11_xinerama enable_video_x11_xinput enable_video_x11_xfixes enable_video_x11_xrandr enable_video_x11_scrnsaver enable_video_x11_xshape -enable_video_x11_vm enable_video_vivante enable_video_cocoa enable_video_metal @@ -930,7 +960,6 @@ LIBS CPPFLAGS LT_SYS_LIBRARY_PATH -CPP CXX CXXFLAGS CCC @@ -938,6 +967,7 @@ PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR +CPP JACK_CFLAGS JACK_LIBS PIPEWIRE_CFLAGS @@ -1001,6 +1031,7 @@ sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' @@ -1030,8 +1061,6 @@ *) ac_optarg=yes ;; esac - # Accept the important Cygnus configure options, so we can diagnose typos. - case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; @@ -1072,9 +1101,9 @@ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -1098,9 +1127,9 @@ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -1253,6 +1282,15 @@ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1302,9 +1340,9 @@ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1318,9 +1356,9 @@ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1364,9 +1402,9 @@ *) # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; @@ -1382,7 +1420,7 @@ case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1390,7 +1428,7 @@ for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1446,7 +1484,7 @@ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | +printf "%s\n" X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -1543,6 +1581,7 @@ --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -1583,6 +1622,7 @@ --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) + --disable-largefile omit support for large files --enable-assertions Enable internal sanity checks (auto/disabled/release/enabled/paranoid) [default=auto] @@ -1602,7 +1642,6 @@ --enable-sensor Enable the sensor subsystem [default=yes] --enable-power Enable the power subsystem [default=yes] --enable-filesystem Enable the filesystem subsystem [default=yes] - --enable-threads Enable the threading subsystem [default=yes] --enable-timers Enable the timer subsystem [default=yes] --enable-file Enable the file subsystem [default=yes] --enable-misc Enable the misc subsystem [default=yes] @@ -1619,6 +1658,8 @@ --enable-sse2 use SSE2 assembly routines [default=maybe] --enable-sse3 use SSE3 assembly routines [default=maybe] --enable-altivec use Altivec assembly routines [default=yes] + --enable-lsx use LSX assembly routines [default=yes] + --enable-lasx use LASX assembly routines [default=yes] --enable-oss support the OSS audio API [default=maybe] --enable-alsa support the ALSA audio API [default=yes] --disable-alsatest Do not try to compile and run a test Alsa program @@ -1668,8 +1709,6 @@ --enable-video-x11-xcursor enable X11 Xcursor support [default=yes] --enable-video-x11-xdbe enable X11 Xdbe support [default=yes] - --enable-video-x11-xinerama - enable X11 Xinerama support [default=yes] --enable-video-x11-xinput enable X11 XInput extension for manymouse, tablets, etc [default=yes] @@ -1682,7 +1721,6 @@ enable X11 screensaver extension [default=yes] --enable-video-x11-xshape enable X11 XShape support [default=yes] - --enable-video-x11-vm use X11 VM extension for fullscreen [default=yes] --enable-video-vivante use Vivante EGL video driver [default=yes] --enable-video-cocoa use Cocoa video driver [default=yes] --enable-video-metal include Metal support [default=yes] @@ -1760,7 +1798,6 @@ you have headers in a nonstandard directory LT_SYS_LIBRARY_PATH User-defined run-time library search path. - CPP C preprocessor CXX C++ compiler command CXXFLAGS C++ compiler flags CXXCPP C++ preprocessor @@ -1769,6 +1806,7 @@ directories to add to pkg-config's search path PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path + CPP C preprocessor JACK_CFLAGS C compiler flags for JACK, overriding pkg-config JACK_LIBS linker flags for JACK, overriding pkg-config PIPEWIRE_CFLAGS @@ -1826,9 +1864,9 @@ case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -1856,7 +1894,8 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. + # Check for configure.gnu first; this name is used for a wrapper for + # Metaconfig's "Configure" on case-insensitive file systems. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive @@ -1864,7 +1903,7 @@ echo && $SHELL "$ac_srcdir/configure" --help=recursive else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done @@ -1874,9 +1913,9 @@ if $ac_init_version; then cat <<\_ACEOF configure -generated by GNU Autoconf 2.69 +generated by GNU Autoconf 2.71 -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1893,14 +1932,14 @@ ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext + rm -f conftest.$ac_objext conftest.beam if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1908,14 +1947,15 @@ cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then : + } && test -s conftest.$ac_objext +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1931,14 +1971,14 @@ ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1946,17 +1986,18 @@ cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext - }; then : + } +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1978,120 +2019,44 @@ ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : eval "$3=yes" -else +else $as_nop eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. @@ -2099,16 +2064,9 @@ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif + which can conflict with char $2 (); below. */ +#include #undef $2 /* Override any GCC internal prototype to avoid an error. @@ -2126,24 +2084,25 @@ #endif int -main () +main (void) { return $2 (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : eval "$3=yes" -else +else $as_nop eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func @@ -2154,14 +2113,14 @@ ac_fn_cxx_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext + rm -f conftest.$ac_objext conftest.beam if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -2169,14 +2128,15 @@ cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then : + } && test -s conftest.$ac_objext +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -2198,7 +2158,7 @@ *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -2206,14 +2166,15 @@ cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err - }; then : + } +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -2229,14 +2190,14 @@ ac_fn_cxx_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -2244,17 +2205,18 @@ cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext - }; then : + } +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -2269,93 +2231,6 @@ } # ac_fn_cxx_try_link -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists, giving a warning if it cannot be compiled using -# the include files in INCLUDES and setting the cache variable VAR -# accordingly. -ac_fn_c_check_header_mongrel () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval \${$3+:} false; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$2> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.i conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_mongrel - # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache @@ -2363,17 +2238,18 @@ ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main () +main (void) { if (sizeof ($2)) return 0; @@ -2381,12 +2257,13 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main () +main (void) { if (sizeof (($2))) return 0; @@ -2394,86 +2271,191 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : -else +else $as_nop eval "$3=yes" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type -# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES -# ---------------------------------------------------- -# Tries to find if the field MEMBER exists in type AGGR, after including -# INCLUDES, setting cache variable VAR accordingly. -ac_fn_c_check_member () +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 -$as_echo_n "checking for $2.$3... " >&6; } -if eval \${$4+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$5 -int -main () -{ -static $2 ac_aggr; -if (ac_aggr.$3) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$4=yes" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$5 -int -main () -{ -static $2 ac_aggr; -if (sizeof ac_aggr.$3) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$4=yes" -else - eval "$4=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 fi -eval ac_res=\$$4 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that +# executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: program exited with status $ac_status" >&5 + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES +# ---------------------------------------------------- +# Tries to find if the field MEMBER exists in type AGGR, after including +# INCLUDES, setting cache variable VAR accordingly. +ac_fn_c_check_member () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 +printf %s "checking for $2.$3... " >&6; } +if eval test \${$4+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$5 +int +main (void) +{ +static $2 ac_aggr; +if (ac_aggr.$3) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval "$4=yes" +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$5 +int +main (void) +{ +static $2 ac_aggr; +if (sizeof ac_aggr.$3) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval "$4=yes" +else $as_nop + eval "$4=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +eval ac_res=\$$4 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_member +ac_configure_args_raw= +for ac_arg +do + case $ac_arg in + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append ac_configure_args_raw " '$ac_arg'" +done + +case $ac_configure_args_raw in + *$as_nl*) + ac_safe_unquote= ;; + *) + ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. + ac_unsafe_a="$ac_unsafe_z#~" + ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" + ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; +esac + cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was -generated by GNU Autoconf 2.69. Invocation command line was +generated by GNU Autoconf 2.71. Invocation command line was - $ $0 $@ + $ $0$ac_configure_args_raw _ACEOF exec 5>>config.log @@ -2506,8 +2488,12 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + printf "%s\n" "PATH: $as_dir" done IFS=$as_save_IFS @@ -2542,7 +2528,7 @@ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; @@ -2577,11 +2563,13 @@ # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? + # Sanitize IFS. + IFS=" "" $as_nl" # Save into config.log some information that might help in debugging. { echo - $as_echo "## ---------------- ## + printf "%s\n" "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo @@ -2592,8 +2580,8 @@ case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -2617,7 +2605,7 @@ ) echo - $as_echo "## ----------------- ## + printf "%s\n" "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo @@ -2625,14 +2613,14 @@ do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - $as_echo "$ac_var='\''$ac_val'\''" + printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## + printf "%s\n" "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo @@ -2640,15 +2628,15 @@ do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - $as_echo "$ac_var='\''$ac_val'\''" + printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then - $as_echo "## ----------- ## + printf "%s\n" "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo @@ -2656,8 +2644,8 @@ echo fi test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" + printf "%s\n" "$as_me: caught signal $ac_signal" + printf "%s\n" "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && @@ -2671,63 +2659,48 @@ # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h -$as_echo "/* confdefs.h */" > confdefs.h +printf "%s\n" "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF +printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF +printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF +printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF +printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF +printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF +printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac + ac_site_files="$CONFIG_SITE" elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site + ac_site_files="$prefix/share/config.site $prefix/etc/config.site" else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site + ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" + +for ac_site_file in $ac_site_files do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} + case $ac_site_file in #( + */*) : + ;; #( + *) : + ac_site_file=./$ac_site_file ;; +esac + if test -f "$ac_site_file" && test -r "$ac_site_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi @@ -2737,204 +2710,813 @@ # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +printf "%s\n" "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +printf "%s\n" "$as_me: creating cache $cache_file" >&6;} >$cache_file fi -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 -fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## +# Test code for whether the C compiler supports C89 (global declarations) +ac_c_conftest_c89_globals=' +/* Does the compiler advertise C89 conformance? + Do not test the value of __STDC__, because some compilers set it to 0 + while being otherwise adequately conformant. */ +#if !defined __STDC__ +# error "Compiler does not advertise C89 conformance" +#endif -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ +struct buf { int x; }; +struct buf * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not \xHH hex character constants. + These do not provoke an error unfortunately, instead are silently treated + as an "x". The following induces an error, until -std is added to get + proper ANSI mode. Curiously \x00 != x always comes out true, for an + array size at least. It is necessary to write \x00 == 0 to get something + that is true only with -std. */ +int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) '\''x'\'' +int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; -ac_config_headers="$ac_config_headers include/SDL_config.h" +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), + int, int);' -ac_aux_dir= -for ac_dir in build-scripts "$srcdir"/build-scripts; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in build-scripts \"$srcdir\"/build-scripts" "$LINENO" 5 -fi +# Test code for whether the C compiler supports C89 (body of main). +ac_c_conftest_c89_main=' +ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); +' -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. +# Test code for whether the C compiler supports C99 (global declarations) +ac_c_conftest_c99_globals=' +// Does the compiler advertise C99 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L +# error "Compiler does not advertise C99 conformance" +#endif +#include +extern int puts (const char *); +extern int printf (const char *, ...); +extern int dprintf (int, const char *, ...); +extern void *malloc (size_t); + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +// dprintf is used instead of fprintf to avoid needing to declare +// FILE and stderr. +#define debug(...) dprintf (2, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + #error "your preprocessor is broken" +#endif +#if BIG_OK +#else + #error "your preprocessor is broken" +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; +struct incomplete_array +{ + int datasize; + double data[]; +}; +struct named_init { + int number; + const wchar_t *name; + double average; +}; -orig_CFLAGS="$CFLAGS" +typedef const char *ccp; -# -# Making releases: -# Edit include/SDL_version.h and change the version, then: -# SDL_MICRO_VERSION += 1; -# SDL_INTERFACE_AGE += 1; -# SDL_BINARY_AGE += 1; -# if any functions have been added, set SDL_INTERFACE_AGE to 0. -# if backwards compatibility has been broken, -# set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0. -# -SDL_MAJOR_VERSION=2 -SDL_MINOR_VERSION=0 -SDL_MICRO_VERSION=22 -SDL_INTERFACE_AGE=0 -SDL_BINARY_AGE=22 -SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) + continue; + return 0; +} +// Check varargs and va_copy. +static bool +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + const char *str = ""; + int number = 0; + float fnumber = 0; + while (*format) + { + switch (*format++) + { + case '\''s'\'': // string + str = va_arg (args_copy, const char *); + break; + case '\''d'\'': // int + number = va_arg (args_copy, int); + break; + case '\''f'\'': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); + return *str && number && fnumber; +} +' +# Test code for whether the C compiler supports C99 (body of main). +ac_c_conftest_c99_main=' + // Check bool. + _Bool success = false; + success |= (argc != 0); + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[0] = argv[0][0]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' + || dynamic_array[ni.number - 1] != 543); +' +# Test code for whether the C compiler supports C11 (global declarations) +ac_c_conftest_c11_globals=' +// Does the compiler advertise C11 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L +# error "Compiler does not advertise C11 conformance" +#endif +// Check _Alignas. +char _Alignas (double) aligned_as_double; +char _Alignas (0) no_special_alignment; +extern char aligned_as_int; +char _Alignas (0) _Alignas (int) aligned_as_int; + +// Check _Alignof. +enum +{ + int_alignment = _Alignof (int), + int_array_alignment = _Alignof (int[100]), + char_alignment = _Alignof (char) +}; +_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); -# libtool versioning -case `pwd` in - *\ * | *\ *) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 -$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; -esac +// Check _Noreturn. +int _Noreturn does_not_return (void) { for (;;) continue; } +// Check _Static_assert. +struct test_static_assert +{ + int x; + _Static_assert (sizeof (int) <= sizeof (long int), + "_Static_assert does not work in struct"); + long int y; +}; +// Check UTF-8 literals. +#define u8 syntax error! +char const utf8_literal[] = u8"happens to be ASCII" "another string"; + +// Check duplicate typedefs. +typedef long *long_ptr; +typedef long int *long_ptr; +typedef long_ptr long_ptr; + +// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. +struct anonymous +{ + union { + struct { int i; int j; }; + struct { int k; long int l; } w; + }; + int m; +} v1; +' -macro_version='2.4.6' -macro_revision='2.4.6' +# Test code for whether the C compiler supports C11 (body of main). +ac_c_conftest_c11_main=' + _Static_assert ((offsetof (struct anonymous, i) + == offsetof (struct anonymous, w.k)), + "Anonymous union alignment botch"); + v1.i = 2; + v1.w.k = 5; + ok |= v1.i != 5; +' +# Test code for whether the C compiler supports C11 (complete). +ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} +${ac_c_conftest_c11_globals} +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + ${ac_c_conftest_c11_main} + return ok; +} +" +# Test code for whether the C compiler supports C99 (complete). +ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + return ok; +} +" +# Test code for whether the C compiler supports C89 (complete). +ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + return ok; +} +" +as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" +as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" +as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" +as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" +as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" +as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" +as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" +as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" +as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" +# Test code for whether the C++ compiler supports C++98 (global declarations) +ac_cxx_conftest_cxx98_globals=' +// Does the compiler advertise C++98 conformance? +#if !defined __cplusplus || __cplusplus < 199711L +# error "Compiler does not advertise C++98 conformance" +#endif +// These inclusions are to reject old compilers that +// lack the unsuffixed header files. +#include +#include + +// and are *not* freestanding headers in C++98. +extern void assert (int); +namespace std { + extern int strcmp (const char *, const char *); +} + +// Namespaces, exceptions, and templates were all added after "C++ 2.0". +using std::exception; +using std::strcmp; + +namespace { + +void test_exception_syntax() +{ + try { + throw "test"; + } catch (const char *s) { + // Extra parentheses suppress a warning when building autoconf itself, + // due to lint rules shared with more typical C programs. + assert (!(strcmp) (s, "test")); + } +} +template struct test_template +{ + T const val; + explicit test_template(T t) : val(t) {} + template T add(U u) { return static_cast(u) + val; } +}; +} // anonymous namespace +' +# Test code for whether the C++ compiler supports C++98 (body of main) +ac_cxx_conftest_cxx98_main=' + assert (argc); + assert (! argv[0]); +{ + test_exception_syntax (); + test_template tt (2.0); + assert (tt.add (4) == 6.0); + assert (true && !false); +} +' +# Test code for whether the C++ compiler supports C++11 (global declarations) +ac_cxx_conftest_cxx11_globals=' +// Does the compiler advertise C++ 2011 conformance? +#if !defined __cplusplus || __cplusplus < 201103L +# error "Compiler does not advertise C++11 conformance" +#endif -ltmain=$ac_aux_dir/ltmain.sh +namespace cxx11test +{ + constexpr int get_val() { return 20; } -# Make sure we can run config.sub. -$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 -$as_echo_n "checking build system type... " >&6; } -if ${ac_cv_build+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_build_alias=$build_alias -test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` -test "x$ac_build_alias" = x && - as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 -ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + struct testinit + { + int i; + double d; + }; -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 -$as_echo "$ac_cv_build" >&6; } -case $ac_cv_build in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; -esac -build=$ac_cv_build -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_build -shift -build_cpu=$1 -build_vendor=$2 -shift; shift + class delegate + { + public: + delegate(int n) : n(n) {} + delegate(): delegate(2354) {} + + virtual int getval() { return this->n; }; + protected: + int n; + }; + + class overridden : public delegate + { + public: + overridden(int n): delegate(n) {} + virtual int getval() override final { return this->n * 2; } + }; + + class nocopy + { + public: + nocopy(int i): i(i) {} + nocopy() = default; + nocopy(const nocopy&) = delete; + nocopy & operator=(const nocopy&) = delete; + private: + int i; + }; + + // for testing lambda expressions + template Ret eval(Fn f, Ret v) + { + return f(v); + } + + // for testing variadic templates and trailing return types + template auto sum(V first) -> V + { + return first; + } + template auto sum(V first, Args... rest) -> V + { + return first + sum(rest...); + } +} +' + +# Test code for whether the C++ compiler supports C++11 (body of main) +ac_cxx_conftest_cxx11_main=' +{ + // Test auto and decltype + auto a1 = 6538; + auto a2 = 48573953.4; + auto a3 = "String literal"; + + int total = 0; + for (auto i = a3; *i; ++i) { total += *i; } + + decltype(a2) a4 = 34895.034; +} +{ + // Test constexpr + short sa[cxx11test::get_val()] = { 0 }; +} +{ + // Test initializer lists + cxx11test::testinit il = { 4323, 435234.23544 }; +} +{ + // Test range-based for + int array[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, + 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; + for (auto &x : array) { x += 23; } +} +{ + // Test lambda expressions + using cxx11test::eval; + assert (eval ([](int x) { return x*2; }, 21) == 42); + double d = 2.0; + assert (eval ([&](double x) { return d += x; }, 3.0) == 5.0); + assert (d == 5.0); + assert (eval ([=](double x) mutable { return d += x; }, 4.0) == 9.0); + assert (d == 5.0); +} +{ + // Test use of variadic templates + using cxx11test::sum; + auto a = sum(1); + auto b = sum(1, 2); + auto c = sum(1.0, 2.0, 3.0); +} +{ + // Test constructor delegation + cxx11test::delegate d1; + cxx11test::delegate d2(); + cxx11test::delegate d3(45); +} +{ + // Test override and final + cxx11test::overridden o1(55464); +} +{ + // Test nullptr + char *c = nullptr; +} +{ + // Test template brackets + test_template<::test_template> v(test_template(12)); +} +{ + // Unicode literals + char const *utf8 = u8"UTF-8 string \u2500"; + char16_t const *utf16 = u"UTF-8 string \u2500"; + char32_t const *utf32 = U"UTF-32 string \u2500"; +} +' + +# Test code for whether the C compiler supports C++11 (complete). +ac_cxx_conftest_cxx11_program="${ac_cxx_conftest_cxx98_globals} +${ac_cxx_conftest_cxx11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_cxx_conftest_cxx98_main} + ${ac_cxx_conftest_cxx11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C++98 (complete). +ac_cxx_conftest_cxx98_program="${ac_cxx_conftest_cxx98_globals} +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_cxx_conftest_cxx98_main} + return ok; +} +" + + +# Auxiliary files required by this configure script. +ac_aux_files="install-sh config.guess config.sub ltmain.sh" + +# Locations in which to look for auxiliary files. +ac_aux_dir_candidates="${srcdir}/build-scripts" + +# Search for a directory containing all of the required auxiliary files, +# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. +# If we don't find one directory that contains all the files we need, +# we report the set of missing files from the *first* directory in +# $ac_aux_dir_candidates and give up. +ac_missing_aux_files="" +ac_first_candidate=: +printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in $ac_aux_dir_candidates +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + + printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 + ac_aux_dir_found=yes + ac_install_sh= + for ac_aux in $ac_aux_files + do + # As a special case, if "install-sh" is required, that requirement + # can be satisfied by any of "install-sh", "install.sh", or "shtool", + # and $ac_install_sh is set appropriately for whichever one is found. + if test x"$ac_aux" = x"install-sh" + then + if test -f "${as_dir}install-sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 + ac_install_sh="${as_dir}install-sh -c" + elif test -f "${as_dir}install.sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 + ac_install_sh="${as_dir}install.sh -c" + elif test -f "${as_dir}shtool"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 + ac_install_sh="${as_dir}shtool install -c" + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} install-sh" + else + break + fi + fi + else + if test -f "${as_dir}${ac_aux}"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" + else + break + fi + fi + fi + done + if test "$ac_aux_dir_found" = yes; then + ac_aux_dir="$as_dir" + break + fi + ac_first_candidate=false + + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 +fi + + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +if test -f "${ac_aux_dir}config.guess"; then + ac_config_guess="$SHELL ${ac_aux_dir}config.guess" +fi +if test -f "${ac_aux_dir}config.sub"; then + ac_config_sub="$SHELL ${ac_aux_dir}config.sub" +fi +if test -f "$ac_aux_dir/configure"; then + ac_configure="$SHELL ${ac_aux_dir}configure" +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' + and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +ac_config_headers="$ac_config_headers include/SDL_config.h" + + + + +orig_CFLAGS="$CFLAGS" + +# See docs/release_checklist.md +SDL_MAJOR_VERSION=2 +SDL_MINOR_VERSION=24 +SDL_MICRO_VERSION=0 +SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION + +SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION` +case "$SDL_MINOR_VERSION" in #( + *[02468]) : + SDL_INTERFACE_AGE="$SDL_MICRO_VERSION" ;; #( + *) : + SDL_INTERFACE_AGE=0 ;; #( + *) : + ;; +esac + + + + + + + + +# libtool versioning + + +case `pwd` in + *\ * | *\ *) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 +printf "%s\n" "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; +esac + + + +macro_version='2.4.6' +macro_revision='2.4.6' + + + + + + + + + + + + + + +ltmain=$ac_aux_dir/ltmain.sh + + + + # Make sure we can run config.sub. +$SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +printf %s "checking build system type... " >&6; } +if test ${ac_cv_build+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +printf "%s\n" "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* @@ -2942,21 +3524,22 @@ case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 -$as_echo_n "checking host system type... " >&6; } -if ${ac_cv_host+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +printf %s "checking host system type... " >&6; } +if test ${ac_cv_host+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else - ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 + ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 -$as_echo "$ac_cv_host" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +printf "%s\n" "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; @@ -2996,8 +3579,8 @@ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 -$as_echo_n "checking how to print strings... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 +printf %s "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then @@ -3023,12 +3606,12 @@ } case $ECHO in - printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 -$as_echo "printf" >&6; } ;; - print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 -$as_echo "print -r" >&6; } ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 -$as_echo "cat" >&6; } ;; + printf*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: printf" >&5 +printf "%s\n" "printf" >&6; } ;; + print*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 +printf "%s\n" "print -r" >&6; } ;; + *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: cat" >&5 +printf "%s\n" "cat" >&6; } ;; esac @@ -3044,6 +3627,15 @@ + + + + + + + + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -3052,11 +3644,12 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -3064,11 +3657,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3079,11 +3676,11 @@ fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3092,11 +3689,12 @@ ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -3104,11 +3702,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3119,11 +3721,11 @@ fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then @@ -3131,8 +3733,8 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -3145,11 +3747,12 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -3157,11 +3760,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3172,11 +3779,11 @@ fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3185,11 +3792,12 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -3198,15 +3806,19 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3222,18 +3834,18 @@ # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3244,11 +3856,12 @@ do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -3256,11 +3869,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3271,11 +3888,11 @@ fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3288,11 +3905,12 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -3300,11 +3918,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3315,11 +3937,11 @@ fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3331,8 +3953,8 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -3340,25 +3962,129 @@ fi fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. +set dummy ${ac_tool_prefix}clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "clang", so it can be a program name with args. +set dummy clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +fi + + +test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } - # Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 -for ac_option in --version -v -V -qversion; do +for ac_option in --version -v -V -qversion -version; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -3368,7 +4094,7 @@ cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done @@ -3376,7 +4102,7 @@ /* end confdefs.h. */ int -main () +main (void) { ; @@ -3388,9 +4114,9 @@ # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +printf %s "checking whether the C compiler works... " >&6; } +ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" @@ -3411,11 +4137,12 @@ *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, @@ -3432,7 +4159,7 @@ # certainly right. break;; *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi @@ -3448,44 +4175,46 @@ done test "$ac_cv_exeext" = no && ac_cv_exeext= -else +else $as_nop ac_file='' fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 +if test -z "$ac_file" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +printf %s "checking for C compiler default output file name... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +printf "%s\n" "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +printf %s "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with @@ -3499,15 +4228,15 @@ * ) break;; esac done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +printf "%s\n" "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext @@ -3516,7 +4245,7 @@ /* end confdefs.h. */ #include int -main () +main (void) { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; @@ -3528,8 +4257,8 @@ ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +printf %s "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in @@ -3537,10 +4266,10 @@ *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in @@ -3548,39 +4277,40 @@ *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C compiled programs. + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +printf "%s\n" "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +printf %s "checking for suffix of object files... " >&6; } +if test ${ac_cv_objext+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; @@ -3594,11 +4324,12 @@ *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in @@ -3607,31 +4338,32 @@ break;; esac done -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +printf "%s\n" "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 +printf %s "checking whether the compiler supports GNU C... " >&6; } +if test ${ac_cv_c_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { #ifndef __GNUC__ choke me @@ -3641,29 +4373,33 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_compiler_gnu=yes -else +else $as_nop ac_compiler_gnu=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_c_compiler_gnu + if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi -ac_test_CFLAGS=${CFLAGS+set} +ac_test_CFLAGS=${CFLAGS+y} ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +printf %s "checking whether $CC accepts -g... " >&6; } +if test ${ac_cv_prog_cc_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no @@ -3672,57 +4408,60 @@ /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_g=yes -else +else $as_nop CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : -else +else $as_nop ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_g=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +printf "%s\n" "$ac_cv_prog_cc_g" >&6; } +if test $ac_test_CFLAGS; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then @@ -3737,94 +4476,144 @@ CFLAGS= fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no +ac_prog_cc_stdc=no +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 +printf %s "checking for $CC option to enable C11 features... " >&6; } +if test ${ac_cv_prog_cc_c11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c11=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; +$ac_c_conftest_c11_program +_ACEOF +for ac_arg in '' -std=gnu11 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c11" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; +if test "x$ac_cv_prog_cc_c11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } + CC="$CC $ac_cv_prog_cc_c11" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 + ac_prog_cc_stdc=c11 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 +printf %s "checking for $CC option to enable C99 features... " >&6; } +if test ${ac_cv_prog_cc_c99+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c99_program +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} +if test "x$ac_cv_prog_cc_c99" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c99" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } + CC="$CC $ac_cv_prog_cc_c99" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 + ac_prog_cc_stdc=c99 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 +printf %s "checking for $CC option to enable C89 features... " >&6; } +if test ${ac_cv_prog_cc_c89+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c89_program _ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : + if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_c89=$ac_arg fi -rm -f core conftest.err conftest.$ac_objext +rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC - fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : +if test "x$ac_cv_prog_cc_c89" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c89" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } + CC="$CC $ac_cv_prog_cc_c89" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 + ac_prog_cc_stdc=c89 +fi fi ac_ext=c @@ -3833,11 +4622,12 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 -$as_echo_n "checking for a sed that does not truncate output... " >&6; } -if ${ac_cv_path_SED+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +printf %s "checking for a sed that does not truncate output... " >&6; } +if test ${ac_cv_path_SED+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" @@ -3851,10 +4641,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in sed gsed; do + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in sed gsed + do for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + ac_path_SED="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED @@ -3863,13 +4658,13 @@ ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 - $as_echo_n 0123456789 >"conftest.in" + printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" - $as_echo '' >> "conftest.nl" + printf "%s\n" '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val @@ -3897,8 +4692,8 @@ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 -$as_echo "$ac_cv_path_SED" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +printf "%s\n" "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed @@ -3915,11 +4710,12 @@ -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +printf %s "checking for grep that handles long lines and -e... " >&6; } +if test ${ac_cv_path_GREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST @@ -3927,10 +4723,15 @@ for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in grep ggrep + do for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP @@ -3939,13 +4740,13 @@ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 - $as_echo_n 0123456789 >"conftest.in" + printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" + printf "%s\n" 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val @@ -3973,16 +4774,17 @@ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +printf "%s\n" "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +printf %s "checking for egrep... " >&6; } +if test ${ac_cv_path_EGREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else @@ -3993,10 +4795,15 @@ for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in egrep + do for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP @@ -4005,13 +4812,13 @@ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 - $as_echo_n 0123456789 >"conftest.in" + printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" + printf "%s\n" 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val @@ -4040,16 +4847,17 @@ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +printf "%s\n" "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 -$as_echo_n "checking for fgrep... " >&6; } -if ${ac_cv_path_FGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 +printf %s "checking for fgrep... " >&6; } +if test ${ac_cv_path_FGREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else @@ -4060,10 +4868,15 @@ for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in fgrep; do + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in fgrep + do for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" + ac_path_FGREP="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP @@ -4072,13 +4885,13 @@ ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 - $as_echo_n 0123456789 >"conftest.in" + printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" - $as_echo 'FGREP' >> "conftest.nl" + printf "%s\n" 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val @@ -4107,8 +4920,8 @@ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 -$as_echo "$ac_cv_path_FGREP" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 +printf "%s\n" "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" @@ -4133,17 +4946,18 @@ # Check whether --with-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then : +if test ${with_gnu_ld+y} +then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes -else +else $as_nop with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 -$as_echo_n "checking for ld used by $CC... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +printf %s "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw @@ -4172,15 +4986,16 @@ ;; esac elif test yes = "$with_gnu_ld"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 -$as_echo_n "checking for GNU ld... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +printf %s "checking for GNU ld... " >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 -$as_echo_n "checking for non-GNU ld... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +printf %s "checking for non-GNU ld... " >&6; } fi -if ${lt_cv_path_LD+:} false; then : - $as_echo_n "(cached) " >&6 -else +if test ${lt_cv_path_LD+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do @@ -4209,18 +5024,19 @@ LD=$lt_cv_path_LD if test -n "$LD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 -$as_echo "$LD" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +printf "%s\n" "$LD" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if ${lt_cv_prog_gnu_ld+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +printf %s "checking if the linker ($LD) is GNU ld... " >&6; } +if test ${lt_cv_prog_gnu_ld+y} +then : + printf %s "(cached) " >&6 +else $as_nop # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 -$as_echo "$lt_cv_prog_gnu_ld" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5 +printf "%s\n" "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld @@ -4243,11 +5059,12 @@ -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 -$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } -if ${lt_cv_path_NM+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 +printf %s "checking for BSD- or MS-compatible name lister (nm)... " >&6; } +if test ${lt_cv_path_NM+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM=$NM @@ -4297,8 +5114,8 @@ : ${lt_cv_path_NM=no} fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 -$as_echo "$lt_cv_path_NM" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 +printf "%s\n" "$lt_cv_path_NM" >&6; } if test no != "$lt_cv_path_NM"; then NM=$lt_cv_path_NM else @@ -4311,11 +5128,12 @@ do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DUMPBIN+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_DUMPBIN+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else @@ -4323,11 +5141,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4338,11 +5160,11 @@ fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 -$as_echo "$DUMPBIN" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 +printf "%s\n" "$DUMPBIN" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -4355,11 +5177,12 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_DUMPBIN+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else @@ -4367,11 +5190,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4382,11 +5209,11 @@ fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 -$as_echo "$ac_ct_DUMPBIN" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 +printf "%s\n" "$ac_ct_DUMPBIN" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -4398,8 +5225,8 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN @@ -4427,11 +5254,12 @@ -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 -$as_echo_n "checking the name lister ($NM) interface... " >&6; } -if ${lt_cv_nm_interface+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 +printf %s "checking the name lister ($NM) interface... " >&6; } +if test ${lt_cv_nm_interface+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) @@ -4447,26 +5275,27 @@ fi rm -f conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 -$as_echo "$lt_cv_nm_interface" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 +printf "%s\n" "$lt_cv_nm_interface" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 -$as_echo_n "checking whether ln -s works... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +printf %s "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 -$as_echo "no, using $LN_S" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 +printf "%s\n" "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 -$as_echo_n "checking the maximum length of command line arguments... " >&6; } -if ${lt_cv_sys_max_cmd_len+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 +printf %s "checking the maximum length of command line arguments... " >&6; } +if test ${lt_cv_sys_max_cmd_len+y} +then : + printf %s "(cached) " >&6 +else $as_nop i=0 teststring=ABCD @@ -4593,11 +5422,11 @@ fi if test -n "$lt_cv_sys_max_cmd_len"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 -$as_echo "$lt_cv_sys_max_cmd_len" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 +printf "%s\n" "$lt_cv_sys_max_cmd_len" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 -$as_echo "none" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none" >&5 +printf "%s\n" "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len @@ -4641,11 +5470,12 @@ -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 -$as_echo_n "checking how to convert $build file names to $host format... " >&6; } -if ${lt_cv_to_host_file_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 +printf %s "checking how to convert $build file names to $host format... " >&6; } +if test ${lt_cv_to_host_file_cmd+y} +then : + printf %s "(cached) " >&6 +else $as_nop case $host in *-*-mingw* ) case $build in @@ -4681,18 +5511,19 @@ fi to_host_file_cmd=$lt_cv_to_host_file_cmd -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 -$as_echo "$lt_cv_to_host_file_cmd" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 +printf "%s\n" "$lt_cv_to_host_file_cmd" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 -$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } -if ${lt_cv_to_tool_file_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 +printf %s "checking how to convert $build file names to toolchain format... " >&6; } +if test ${lt_cv_to_tool_file_cmd+y} +then : + printf %s "(cached) " >&6 +else $as_nop #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in @@ -4708,22 +5539,23 @@ fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 -$as_echo "$lt_cv_to_tool_file_cmd" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 +printf "%s\n" "$lt_cv_to_tool_file_cmd" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 -$as_echo_n "checking for $LD option to reload object files... " >&6; } -if ${lt_cv_ld_reload_flag+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 +printf %s "checking for $LD option to reload object files... " >&6; } +if test ${lt_cv_ld_reload_flag+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_ld_reload_flag='-r' fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 -$as_echo "$lt_cv_ld_reload_flag" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 +printf "%s\n" "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; @@ -4756,11 +5588,12 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OBJDUMP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else @@ -4768,11 +5601,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4783,11 +5620,11 @@ fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 -$as_echo "$OBJDUMP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +printf "%s\n" "$OBJDUMP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -4796,11 +5633,12 @@ ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OBJDUMP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else @@ -4808,11 +5646,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4823,11 +5665,11 @@ fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 -$as_echo "$ac_ct_OBJDUMP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +printf "%s\n" "$ac_ct_OBJDUMP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then @@ -4835,8 +5677,8 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP @@ -4852,11 +5694,12 @@ -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 -$as_echo_n "checking how to recognize dependent libraries... " >&6; } -if ${lt_cv_deplibs_check_method+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 +printf %s "checking how to recognize dependent libraries... " >&6; } +if test ${lt_cv_deplibs_check_method+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' @@ -5054,8 +5897,8 @@ esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 -$as_echo "$lt_cv_deplibs_check_method" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 +printf "%s\n" "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no @@ -5099,11 +5942,12 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_DLLTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else @@ -5111,11 +5955,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5126,11 +5974,11 @@ fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 -$as_echo "$DLLTOOL" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +printf "%s\n" "$DLLTOOL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -5139,11 +5987,12 @@ ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_DLLTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else @@ -5151,11 +6000,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5166,11 +6019,11 @@ fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 -$as_echo "$ac_ct_DLLTOOL" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +printf "%s\n" "$ac_ct_DLLTOOL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then @@ -5178,8 +6031,8 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL @@ -5196,11 +6049,12 @@ -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 -$as_echo_n "checking how to associate runtime and link libraries... " >&6; } -if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 +printf %s "checking how to associate runtime and link libraries... " >&6; } +if test ${lt_cv_sharedlib_from_linklib_cmd+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in @@ -5223,8 +6077,8 @@ esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 -$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 +printf "%s\n" "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO @@ -5240,11 +6094,12 @@ do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AR+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else @@ -5252,11 +6107,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5267,11 +6126,11 @@ fi AR=$ac_cv_prog_AR if test -n "$AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 -$as_echo "$AR" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +printf "%s\n" "$AR" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -5284,11 +6143,12 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_AR+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else @@ -5296,11 +6156,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5311,11 +6175,11 @@ fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 -$as_echo "$ac_ct_AR" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +printf "%s\n" "$ac_ct_AR" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -5327,8 +6191,8 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR @@ -5348,30 +6212,32 @@ -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 -$as_echo_n "checking for archiver @FILE support... " >&6; } -if ${lt_cv_ar_at_file+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 +printf %s "checking for archiver @FILE support... " >&6; } +if test ${lt_cv_ar_at_file+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. @@ -5379,7 +6245,7 @@ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ @@ -5388,11 +6254,11 @@ rm -f conftest.* libconftest.a fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 -$as_echo "$lt_cv_ar_at_file" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 +printf "%s\n" "$lt_cv_ar_at_file" >&6; } if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= @@ -5409,11 +6275,12 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else @@ -5421,11 +6288,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5436,11 +6307,11 @@ fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +printf "%s\n" "$STRIP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -5449,11 +6320,12 @@ ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else @@ -5461,11 +6333,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5476,11 +6352,11 @@ fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +printf "%s\n" "$ac_ct_STRIP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then @@ -5488,8 +6364,8 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP @@ -5508,11 +6384,12 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else @@ -5520,11 +6397,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5535,11 +6416,11 @@ fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -$as_echo "$RANLIB" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +printf "%s\n" "$RANLIB" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -5548,11 +6429,12 @@ ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else @@ -5560,11 +6442,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5575,11 +6461,11 @@ fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -$as_echo "$ac_ct_RANLIB" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +printf "%s\n" "$ac_ct_RANLIB" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then @@ -5587,8 +6473,8 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB @@ -5652,11 +6538,12 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AWK+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AWK+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else @@ -5664,11 +6551,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5679,11 +6570,11 @@ fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 -$as_echo "$AWK" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +printf "%s\n" "$AWK" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -5719,11 +6610,12 @@ # Check for command to grab the raw symbol name followed by C symbol from nm. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 -$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } -if ${lt_cv_sys_global_symbol_pipe+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 +printf %s "checking command to parse $NM output from $compiler object... " >&6; } +if test ${lt_cv_sys_global_symbol_pipe+y} +then : + printf %s "(cached) " >&6 +else $as_nop # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] @@ -5875,14 +6767,14 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then @@ -5951,7 +6843,7 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then pipe_works=yes fi @@ -5986,11 +6878,11 @@ lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 -$as_echo "failed" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +printf "%s\n" "failed" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 -$as_echo "ok" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +printf "%s\n" "ok" >&6; } fi # Response file support. @@ -6036,13 +6928,14 @@ -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 -$as_echo_n "checking for sysroot... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 +printf %s "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. -if test "${with_sysroot+set}" = set; then : +if test ${with_sysroot+y} +then : withval=$with_sysroot; -else +else $as_nop with_sysroot=no fi @@ -6060,24 +6953,25 @@ no|'') ;; #( *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 -$as_echo "$with_sysroot" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 +printf "%s\n" "$with_sysroot" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 -$as_echo "${lt_sysroot:-no}" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 +printf "%s\n" "${lt_sysroot:-no}" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 -$as_echo_n "checking for a working dd... " >&6; } -if ${ac_cv_path_lt_DD+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 +printf %s "checking for a working dd... " >&6; } +if test ${ac_cv_path_lt_DD+y} +then : + printf %s "(cached) " >&6 +else $as_nop printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} @@ -6088,10 +6982,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in dd; do + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in dd + do for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_lt_DD="$as_dir/$ac_prog$ac_exec_ext" + ac_path_lt_DD="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_lt_DD" || continue if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ @@ -6111,15 +7010,16 @@ rm -f conftest.i conftest2.i conftest.out fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 -$as_echo "$ac_cv_path_lt_DD" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 +printf "%s\n" "$ac_cv_path_lt_DD" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 -$as_echo_n "checking how to truncate binary pipes... " >&6; } -if ${lt_cv_truncate_bin+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 +printf %s "checking how to truncate binary pipes... " >&6; } +if test ${lt_cv_truncate_bin+y} +then : + printf %s "(cached) " >&6 +else $as_nop printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= @@ -6130,8 +7030,8 @@ rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 -$as_echo "$lt_cv_truncate_bin" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 +printf "%s\n" "$lt_cv_truncate_bin" >&6; } @@ -6154,7 +7054,8 @@ } # Check whether --enable-libtool-lock was given. -if test "${enable_libtool_lock+set}" = set; then : +if test ${enable_libtool_lock+y} +then : enableval=$enable_libtool_lock; fi @@ -6170,7 +7071,7 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) @@ -6190,7 +7091,7 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test yes = "$lt_cv_prog_gnu_ld"; then case `/usr/bin/file conftest.$ac_objext` in @@ -6228,7 +7129,7 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then emul=elf case `/usr/bin/file conftest.$ac_objext` in @@ -6269,7 +7170,7 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) @@ -6332,11 +7233,12 @@ # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -belf" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 -$as_echo_n "checking whether the C compiler needs -belf... " >&6; } -if ${lt_cv_cc_needs_belf+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 +printf %s "checking whether the C compiler needs -belf... " >&6; } +if test ${lt_cv_cc_needs_belf+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -6347,19 +7249,20 @@ /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : lt_cv_cc_needs_belf=yes -else +else $as_nop lt_cv_cc_needs_belf=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -6368,8 +7271,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 -$as_echo "$lt_cv_cc_needs_belf" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 +printf "%s\n" "$lt_cv_cc_needs_belf" >&6; } if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS @@ -6382,7 +7285,7 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) @@ -6419,11 +7322,12 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_MANIFEST_TOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else @@ -6431,11 +7335,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -6446,11 +7354,11 @@ fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 -$as_echo "$MANIFEST_TOOL" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 +printf "%s\n" "$MANIFEST_TOOL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -6459,11 +7367,12 @@ ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_MANIFEST_TOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else @@ -6471,11 +7380,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -6486,11 +7399,11 @@ fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 -$as_echo "$ac_ct_MANIFEST_TOOL" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 +printf "%s\n" "$ac_ct_MANIFEST_TOOL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then @@ -6498,8 +7411,8 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL @@ -6509,11 +7422,12 @@ fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 -$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } -if ${lt_cv_path_mainfest_tool+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 +printf %s "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } +if test ${lt_cv_path_mainfest_tool+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out @@ -6523,8 +7437,8 @@ fi rm -f conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 -$as_echo "$lt_cv_path_mainfest_tool" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 +printf "%s\n" "$lt_cv_path_mainfest_tool" >&6; } if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi @@ -6539,11 +7453,12 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DSYMUTIL+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_DSYMUTIL+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else @@ -6551,11 +7466,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -6566,11 +7485,11 @@ fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 -$as_echo "$DSYMUTIL" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 +printf "%s\n" "$DSYMUTIL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -6579,11 +7498,12 @@ ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_DSYMUTIL+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else @@ -6591,11 +7511,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -6606,11 +7530,11 @@ fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 -$as_echo "$ac_ct_DSYMUTIL" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 +printf "%s\n" "$ac_ct_DSYMUTIL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then @@ -6618,8 +7542,8 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL @@ -6631,11 +7555,12 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_NMEDIT+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_NMEDIT+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else @@ -6643,11 +7568,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -6658,11 +7587,11 @@ fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 -$as_echo "$NMEDIT" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 +printf "%s\n" "$NMEDIT" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -6671,11 +7600,12 @@ ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_NMEDIT+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else @@ -6683,11 +7613,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -6698,11 +7632,11 @@ fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 -$as_echo "$ac_ct_NMEDIT" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 +printf "%s\n" "$ac_ct_NMEDIT" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then @@ -6710,8 +7644,8 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT @@ -6723,11 +7657,12 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_LIPO+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_LIPO+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else @@ -6735,11 +7670,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -6750,11 +7689,11 @@ fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 -$as_echo "$LIPO" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 +printf "%s\n" "$LIPO" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -6763,11 +7702,12 @@ ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_LIPO+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_LIPO+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else @@ -6775,11 +7715,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -6790,11 +7734,11 @@ fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 -$as_echo "$ac_ct_LIPO" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 +printf "%s\n" "$ac_ct_LIPO" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then @@ -6802,8 +7746,8 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO @@ -6815,11 +7759,12 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else @@ -6827,11 +7772,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -6842,11 +7791,11 @@ fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 -$as_echo "$OTOOL" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 +printf "%s\n" "$OTOOL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -6855,11 +7804,12 @@ ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else @@ -6867,11 +7817,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -6882,11 +7836,11 @@ fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 -$as_echo "$ac_ct_OTOOL" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 +printf "%s\n" "$ac_ct_OTOOL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then @@ -6894,8 +7848,8 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL @@ -6907,11 +7861,12 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OTOOL64+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OTOOL64+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else @@ -6919,11 +7874,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -6934,11 +7893,11 @@ fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 -$as_echo "$OTOOL64" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 +printf "%s\n" "$OTOOL64" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -6947,11 +7906,12 @@ ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OTOOL64+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else @@ -6959,11 +7919,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -6974,11 +7938,11 @@ fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 -$as_echo "$ac_ct_OTOOL64" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 +printf "%s\n" "$ac_ct_OTOOL64" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then @@ -6986,8 +7950,8 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 @@ -7022,11 +7986,12 @@ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 -$as_echo_n "checking for -single_module linker flag... " >&6; } -if ${lt_cv_apple_cc_single_mod+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 +printf %s "checking for -single_module linker flag... " >&6; } +if test ${lt_cv_apple_cc_single_mod+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_apple_cc_single_mod=no if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override @@ -7055,14 +8020,15 @@ rm -f conftest.* fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 -$as_echo "$lt_cv_apple_cc_single_mod" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 +printf "%s\n" "$lt_cv_apple_cc_single_mod" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 -$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } -if ${lt_cv_ld_exported_symbols_list+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 +printf %s "checking for -exported_symbols_list linker flag... " >&6; } +if test ${lt_cv_ld_exported_symbols_list+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym @@ -7071,31 +8037,33 @@ /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : lt_cv_ld_exported_symbols_list=yes -else +else $as_nop lt_cv_ld_exported_symbols_list=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 -$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 +printf "%s\n" "$lt_cv_ld_exported_symbols_list" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 -$as_echo_n "checking for -force_load linker flag... " >&6; } -if ${lt_cv_ld_force_load+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 +printf %s "checking for -force_load linker flag... " >&6; } +if test ${lt_cv_ld_force_load+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} @@ -7123,8 +8091,8 @@ rm -rf conftest.dSYM fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 -$as_echo "$lt_cv_ld_force_load" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 +printf "%s\n" "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; @@ -7190,286 +8158,43 @@ esac } -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes +ac_header= ac_cache= +for ac_item in $ac_header_c_list do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : + if test $ac_cache; then + ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" + if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then + printf "%s\n" "#define $ac_item 1" >> confdefs.h + fi + ac_header= ac_cache= + elif test $ac_header; then + ac_cache=$ac_item + else + ac_header=$ac_item + fi +done + + + + + + + + +if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes +then : + +printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h -else - # Broken: fails on valid input. -continue fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -for ac_header in dlfcn.h -do : - ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default -" -if test "x$ac_cv_header_dlfcn_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_DLFCN_H 1 -_ACEOF +ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default +" +if test "x$ac_cv_header_dlfcn_h" = xyes +then : + printf "%s\n" "#define HAVE_DLFCN_H 1" >>confdefs.h fi -done - @@ -7482,11 +8207,12 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. set dummy ${ac_tool_prefix}as; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AS+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AS+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$AS"; then ac_cv_prog_AS="$AS" # Let the user override the test. else @@ -7494,11 +8220,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AS="${ac_tool_prefix}as" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7509,11 +8239,11 @@ fi AS=$ac_cv_prog_AS if test -n "$AS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 -$as_echo "$AS" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 +printf "%s\n" "$AS" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -7522,11 +8252,12 @@ ac_ct_AS=$AS # Extract the first word of "as", so it can be a program name with args. set dummy as; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_AS+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_AS+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_AS"; then ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test. else @@ -7534,11 +8265,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AS="as" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7549,11 +8284,11 @@ fi ac_ct_AS=$ac_cv_prog_ac_ct_AS if test -n "$ac_ct_AS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5 -$as_echo "$ac_ct_AS" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5 +printf "%s\n" "$ac_ct_AS" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_AS" = x; then @@ -7561,8 +8296,8 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AS=$ac_ct_AS @@ -7574,11 +8309,12 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_DLLTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else @@ -7586,11 +8322,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7601,11 +8341,11 @@ fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 -$as_echo "$DLLTOOL" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +printf "%s\n" "$DLLTOOL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -7614,11 +8354,12 @@ ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_DLLTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else @@ -7626,11 +8367,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7641,11 +8386,11 @@ fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 -$as_echo "$ac_ct_DLLTOOL" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +printf "%s\n" "$ac_ct_DLLTOOL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then @@ -7653,8 +8398,8 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL @@ -7666,11 +8411,12 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OBJDUMP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else @@ -7678,11 +8424,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7693,11 +8443,11 @@ fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 -$as_echo "$OBJDUMP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +printf "%s\n" "$OBJDUMP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -7706,11 +8456,12 @@ ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OBJDUMP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else @@ -7718,11 +8469,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7733,11 +8488,11 @@ fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 -$as_echo "$ac_ct_OBJDUMP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +printf "%s\n" "$ac_ct_OBJDUMP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then @@ -7745,8 +8500,8 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP @@ -7783,7 +8538,8 @@ # Check whether --enable-shared was given. -if test "${enable_shared+set}" = set; then : +if test ${enable_shared+y} +then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; @@ -7801,7 +8557,7 @@ IFS=$lt_save_ifs ;; esac -else +else $as_nop enable_shared=yes fi @@ -7814,7 +8570,8 @@ # Check whether --enable-static was given. -if test "${enable_static+set}" = set; then : +if test ${enable_static+y} +then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; @@ -7832,7 +8589,7 @@ IFS=$lt_save_ifs ;; esac -else +else $as_nop enable_static=yes fi @@ -7846,7 +8603,8 @@ # Check whether --with-pic was given. -if test "${with_pic+set}" = set; then : +if test ${with_pic+y} +then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; @@ -7863,7 +8621,7 @@ IFS=$lt_save_ifs ;; esac -else +else $as_nop pic_mode=default fi @@ -7875,7 +8633,8 @@ # Check whether --enable-fast-install was given. -if test "${enable_fast_install+set}" = set; then : +if test ${enable_fast_install+y} +then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; @@ -7893,7 +8652,7 @@ IFS=$lt_save_ifs ;; esac -else +else $as_nop enable_fast_install=yes fi @@ -7907,11 +8666,12 @@ shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[5-9]*,yes) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 -$as_echo_n "checking which variant of shared library versioning to provide... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 +printf %s "checking which variant of shared library versioning to provide... " >&6; } # Check whether --with-aix-soname was given. -if test "${with_aix_soname+set}" = set; then : +if test ${with_aix_soname+y} +then : withval=$with_aix_soname; case $withval in aix|svr4|both) ;; @@ -7920,18 +8680,19 @@ ;; esac lt_cv_with_aix_soname=$with_aix_soname -else - if ${lt_cv_with_aix_soname+:} false; then : - $as_echo_n "(cached) " >&6 -else +else $as_nop + if test ${lt_cv_with_aix_soname+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_with_aix_soname=aix fi with_aix_soname=$lt_cv_with_aix_soname fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 -$as_echo "$with_aix_soname" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 +printf "%s\n" "$with_aix_soname" >&6; } if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', @@ -8013,11 +8774,12 @@ setopt NO_GLOB_SUBST fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 -$as_echo_n "checking for objdir... " >&6; } -if ${lt_cv_objdir+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 +printf %s "checking for objdir... " >&6; } +if test ${lt_cv_objdir+y} +then : + printf %s "(cached) " >&6 +else $as_nop rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then @@ -8028,17 +8790,15 @@ fi rmdir .libs 2>/dev/null fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 -$as_echo "$lt_cv_objdir" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 +printf "%s\n" "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir -cat >>confdefs.h <<_ACEOF -#define LT_OBJDIR "$lt_cv_objdir/" -_ACEOF +printf "%s\n" "#define LT_OBJDIR \"$lt_cv_objdir/\"" >>confdefs.h @@ -8084,11 +8844,12 @@ case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 -$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } -if ${lt_cv_path_MAGIC_CMD+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 +printf %s "checking for ${ac_tool_prefix}file... " >&6; } +if test ${lt_cv_path_MAGIC_CMD+y} +then : + printf %s "(cached) " >&6 +else $as_nop case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. @@ -8137,11 +8898,11 @@ MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 -$as_echo "$MAGIC_CMD" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +printf "%s\n" "$MAGIC_CMD" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -8150,11 +8911,12 @@ if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 -$as_echo_n "checking for file... " >&6; } -if ${lt_cv_path_MAGIC_CMD+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for file" >&5 +printf %s "checking for file... " >&6; } +if test ${lt_cv_path_MAGIC_CMD+y} +then : + printf %s "(cached) " >&6 +else $as_nop case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. @@ -8203,11 +8965,11 @@ MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 -$as_echo "$MAGIC_CMD" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +printf "%s\n" "$MAGIC_CMD" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -8292,11 +9054,12 @@ lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } -if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +printf %s "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } +if test ${lt_cv_prog_compiler_rtti_exceptions+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext @@ -8327,8 +9090,8 @@ $RM conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +printf "%s\n" "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" @@ -8685,26 +9448,28 @@ ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -$as_echo_n "checking for $compiler option to produce PIC... " >&6; } -if ${lt_cv_prog_compiler_pic+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +printf %s "checking for $compiler option to produce PIC... " >&6; } +if test ${lt_cv_prog_compiler_pic+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 -$as_echo "$lt_cv_prog_compiler_pic" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 +printf "%s\n" "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 -$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } -if ${lt_cv_prog_compiler_pic_works+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +printf %s "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } +if test ${lt_cv_prog_compiler_pic_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext @@ -8735,8 +9500,8 @@ $RM conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 -$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 +printf "%s\n" "$lt_cv_prog_compiler_pic_works" >&6; } if test yes = "$lt_cv_prog_compiler_pic_works"; then case $lt_prog_compiler_pic in @@ -8764,11 +9529,12 @@ # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if ${lt_cv_prog_compiler_static_works+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +printf %s "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if test ${lt_cv_prog_compiler_static_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler_static_works=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" @@ -8792,8 +9558,8 @@ LDFLAGS=$save_LDFLAGS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 -$as_echo "$lt_cv_prog_compiler_static_works" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 +printf "%s\n" "$lt_cv_prog_compiler_static_works" >&6; } if test yes = "$lt_cv_prog_compiler_static_works"; then : @@ -8807,11 +9573,12 @@ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test ${lt_cv_prog_compiler_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest @@ -8854,19 +9621,20 @@ $RM conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 -$as_echo "$lt_cv_prog_compiler_c_o" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +printf "%s\n" "$lt_cv_prog_compiler_c_o" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test ${lt_cv_prog_compiler_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest @@ -8909,8 +9677,8 @@ $RM conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 -$as_echo "$lt_cv_prog_compiler_c_o" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +printf "%s\n" "$lt_cv_prog_compiler_c_o" >&6; } @@ -8918,19 +9686,19 @@ hard_links=nottested if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 -$as_echo_n "checking if we can lock with hard links... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +printf %s "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 -$as_echo "$hard_links" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +printf "%s\n" "$hard_links" >&6; } if test no = "$hard_links"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 -$as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 +printf "%s\n" "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} need_locks=warn fi else @@ -8942,8 +9710,8 @@ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= @@ -9499,21 +10267,23 @@ if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else - if ${lt_cv_aix_libpath_+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test ${lt_cv_aix_libpath_+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { @@ -9528,7 +10298,7 @@ lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib @@ -9552,21 +10322,23 @@ if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else - if ${lt_cv_aix_libpath_+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test ${lt_cv_aix_libpath_+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { @@ -9581,7 +10353,7 @@ lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib @@ -9832,11 +10604,12 @@ # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 -$as_echo_n "checking if $CC understands -b... " >&6; } -if ${lt_cv_prog_compiler__b+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 +printf %s "checking if $CC understands -b... " >&6; } +if test ${lt_cv_prog_compiler__b+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler__b=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -b" @@ -9860,8 +10633,8 @@ LDFLAGS=$save_LDFLAGS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 -$as_echo "$lt_cv_prog_compiler__b" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 +printf "%s\n" "$lt_cv_prog_compiler__b" >&6; } if test yes = "$lt_cv_prog_compiler__b"; then archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' @@ -9901,28 +10674,30 @@ # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 -$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } -if ${lt_cv_irix_exported_symbol+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 +printf %s "checking whether the $host_os linker accepts -exported_symbol... " >&6; } +if test ${lt_cv_irix_exported_symbol+y} +then : + printf %s "(cached) " >&6 +else $as_nop save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : lt_cv_irix_exported_symbol=yes -else +else $as_nop lt_cv_irix_exported_symbol=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 -$as_echo "$lt_cv_irix_exported_symbol" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 +printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; } if test yes = "$lt_cv_irix_exported_symbol"; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi @@ -10203,8 +10978,8 @@ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 -$as_echo "$ld_shlibs" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 +printf "%s\n" "$ld_shlibs" >&6; } test no = "$ld_shlibs" && can_build_shared=no with_gnu_ld=$with_gnu_ld @@ -10240,18 +11015,19 @@ # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 -$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } -if ${lt_cv_archive_cmds_need_lc+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +printf %s "checking whether -lc should be explicitly linked in... " >&6; } +if test ${lt_cv_archive_cmds_need_lc+y} +then : + printf %s "(cached) " >&6 +else $as_nop $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest @@ -10269,7 +11045,7 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no @@ -10283,8 +11059,8 @@ $RM conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 -$as_echo "$lt_cv_archive_cmds_need_lc" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 +printf "%s\n" "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac @@ -10443,8 +11219,8 @@ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 -$as_echo_n "checking dynamic linker characteristics... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +printf %s "checking dynamic linker characteristics... " >&6; } if test yes = "$GCC"; then case $host_os in @@ -11007,9 +11783,10 @@ shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH - if ${lt_cv_shlibpath_overrides_runpath+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test ${lt_cv_shlibpath_overrides_runpath+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir @@ -11019,19 +11796,21 @@ /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : +if ac_fn_c_try_link "$LINENO" +then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null +then : lt_cv_shlibpath_overrides_runpath=yes fi fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir @@ -11268,8 +12047,8 @@ dynamic_linker=no ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 -$as_echo "$dynamic_linker" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +printf "%s\n" "$dynamic_linker" >&6; } test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" @@ -11390,8 +12169,8 @@ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 -$as_echo_n "checking how to hardcode library paths into programs... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +printf %s "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || @@ -11415,8 +12194,8 @@ # directories. hardcode_action=unsupported fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 -$as_echo "$hardcode_action" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 +printf "%s\n" "$hardcode_action" >&6; } if test relink = "$hardcode_action" || test yes = "$inherit_rpath"; then @@ -11460,11 +12239,12 @@ darwin*) # if libdl is installed we need to link against it - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +printf %s "checking for dlopen in -ldl... " >&6; } +if test ${ac_cv_lib_dl_dlopen+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11473,32 +12253,31 @@ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char dlopen (); int -main () +main (void) { return dlopen (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_dl_dlopen=yes -else +else $as_nop ac_cv_lib_dl_dlopen=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes +then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl -else +else $as_nop lt_cv_dlopen=dyld lt_cv_dlopen_libs= @@ -11518,14 +12297,16 @@ *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" -if test "x$ac_cv_func_shl_load" = xyes; then : +if test "x$ac_cv_func_shl_load" = xyes +then : lt_cv_dlopen=shl_load -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 -$as_echo_n "checking for shl_load in -ldld... " >&6; } -if ${ac_cv_lib_dld_shl_load+:} false; then : - $as_echo_n "(cached) " >&6 -else +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 +printf %s "checking for shl_load in -ldld... " >&6; } +if test ${ac_cv_lib_dld_shl_load+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11534,41 +12315,42 @@ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char shl_load (); int -main () +main (void) { return shl_load (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_dld_shl_load=yes -else +else $as_nop ac_cv_lib_dld_shl_load=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 -$as_echo "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 +printf "%s\n" "$ac_cv_lib_dld_shl_load" >&6; } +if test "x$ac_cv_lib_dld_shl_load" = xyes +then : lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld -else +else $as_nop ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" -if test "x$ac_cv_func_dlopen" = xyes; then : +if test "x$ac_cv_func_dlopen" = xyes +then : lt_cv_dlopen=dlopen -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +printf %s "checking for dlopen in -ldl... " >&6; } +if test ${ac_cv_lib_dl_dlopen+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11577,37 +12359,37 @@ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char dlopen (); int -main () +main (void) { return dlopen (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_dl_dlopen=yes -else +else $as_nop ac_cv_lib_dl_dlopen=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes +then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 -$as_echo_n "checking for dlopen in -lsvld... " >&6; } -if ${ac_cv_lib_svld_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 +printf %s "checking for dlopen in -lsvld... " >&6; } +if test ${ac_cv_lib_svld_dlopen+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11616,37 +12398,37 @@ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char dlopen (); int -main () +main (void) { return dlopen (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_svld_dlopen=yes -else +else $as_nop ac_cv_lib_svld_dlopen=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 -$as_echo "$ac_cv_lib_svld_dlopen" >&6; } -if test "x$ac_cv_lib_svld_dlopen" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 +printf "%s\n" "$ac_cv_lib_svld_dlopen" >&6; } +if test "x$ac_cv_lib_svld_dlopen" = xyes +then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 -$as_echo_n "checking for dld_link in -ldld... " >&6; } -if ${ac_cv_lib_dld_dld_link+:} false; then : - $as_echo_n "(cached) " >&6 -else +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 +printf %s "checking for dld_link in -ldld... " >&6; } +if test ${ac_cv_lib_dld_dld_link+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11655,30 +12437,29 @@ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char dld_link (); int -main () +main (void) { return dld_link (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_dld_dld_link=yes -else +else $as_nop ac_cv_lib_dld_dld_link=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 -$as_echo "$ac_cv_lib_dld_dld_link" >&6; } -if test "x$ac_cv_lib_dld_dld_link" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 +printf "%s\n" "$ac_cv_lib_dld_dld_link" >&6; } +if test "x$ac_cv_lib_dld_dld_link" = xyes +then : lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld fi @@ -11717,11 +12498,12 @@ save_LIBS=$LIBS LIBS="$lt_cv_dlopen_libs $LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 -$as_echo_n "checking whether a program can dlopen itself... " >&6; } -if ${lt_cv_dlopen_self+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 +printf %s "checking whether a program can dlopen itself... " >&6; } +if test ${lt_cv_dlopen_self+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test yes = "$cross_compiling"; then : lt_cv_dlopen_self=cross else @@ -11800,7 +12582,7 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? @@ -11818,16 +12600,17 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 -$as_echo "$lt_cv_dlopen_self" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 +printf "%s\n" "$lt_cv_dlopen_self" >&6; } if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 -$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } -if ${lt_cv_dlopen_self_static+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 +printf %s "checking whether a statically linked program can dlopen itself... " >&6; } +if test ${lt_cv_dlopen_self_static+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test yes = "$cross_compiling"; then : lt_cv_dlopen_self_static=cross else @@ -11906,7 +12689,7 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? @@ -11924,8 +12707,8 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 -$as_echo "$lt_cv_dlopen_self_static" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 +printf "%s\n" "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS=$save_CPPFLAGS @@ -11963,40 +12746,40 @@ striplib= old_striplib= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 -$as_echo_n "checking whether stripping libraries is possible... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 +printf %s "checking whether stripping libraries is possible... " >&6; } if test -z "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } else if $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then old_striplib="$STRIP --strip-debug" striplib="$STRIP --strip-unneeded" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } else case $host_os in darwin*) # FIXME - insert some real tests, host_os isn't really good enough striplib="$STRIP -x" old_striplib="$STRIP -S" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } ;; freebsd*) if $STRIP -V 2>&1 | $GREP "elftoolchain" >/dev/null; then old_striplib="$STRIP --strip-debug" striplib="$STRIP --strip-unneeded" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi ;; *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } ;; esac fi @@ -12014,13 +12797,13 @@ # Report what library types will actually be built - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 -$as_echo_n "checking if libtool supports shared libraries... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 -$as_echo "$can_build_shared" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 +printf %s "checking if libtool supports shared libraries... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 +printf "%s\n" "$can_build_shared" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 -$as_echo_n "checking whether to build shared libraries... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 +printf %s "checking whether to build shared libraries... " >&6; } test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and @@ -12044,15 +12827,15 @@ fi ;; esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 -$as_echo "$enable_shared" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 +printf "%s\n" "$enable_shared" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 -$as_echo_n "checking whether to build static libraries... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 +printf %s "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 -$as_echo "$enable_static" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 +printf "%s\n" "$enable_static" >&6; } @@ -12091,11 +12874,12 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args. set dummy ${ac_tool_prefix}windres; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_RC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_RC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$RC"; then ac_cv_prog_RC="$RC" # Let the user override the test. else @@ -12103,11 +12887,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_RC="${ac_tool_prefix}windres" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -12118,11 +12906,11 @@ fi RC=$ac_cv_prog_RC if test -n "$RC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RC" >&5 -$as_echo "$RC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RC" >&5 +printf "%s\n" "$RC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -12131,11 +12919,12 @@ ac_ct_RC=$RC # Extract the first word of "windres", so it can be a program name with args. set dummy windres; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_RC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_RC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_RC"; then ac_cv_prog_ac_ct_RC="$ac_ct_RC" # Let the user override the test. else @@ -12143,11 +12932,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RC="windres" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -12158,11 +12951,11 @@ fi ac_ct_RC=$ac_cv_prog_ac_ct_RC if test -n "$ac_ct_RC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RC" >&5 -$as_echo "$ac_ct_RC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RC" >&5 +printf "%s\n" "$ac_ct_RC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_RC" = x; then @@ -12170,8 +12963,8 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RC=$ac_ct_RC @@ -12259,10 +13052,17 @@ CFLAGS=$lt_save_CFLAGS -LT_RELEASE=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION -LT_CURRENT=`expr $SDL_MICRO_VERSION - $SDL_INTERFACE_AGE` -LT_REVISION=$SDL_INTERFACE_AGE +# For historical reasons, the library name redundantly includes the major +# version twice: libSDL2-2.0.so.0. +# TODO: in SDL 3, stop using -release, which will simplify it to libSDL3.so.0 +LT_RELEASE=2.0 +# Increment this if there is an incompatible change - but if that happens, +# we should rename the library from SDL2 to SDL3, at which point this would +# reset to 0 anyway. +LT_MAJOR=0 LT_AGE=`expr $SDL_BINARY_AGE - $SDL_INTERFACE_AGE` +LT_CURRENT=`expr $LT_MAJOR + $LT_AGE` +LT_REVISION=$SDL_INTERFACE_AGE @@ -12271,31 +13071,32 @@ -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AWK+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -12304,26 +13105,78 @@ fi fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +printf "%s\n" "$AWK" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -fi -if test -z "$ac_cv_prog_CC"; then + test -n "$AWK" && break +done + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -12331,11 +13184,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -12346,11 +13203,11 @@ fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then @@ -12358,8 +13215,8 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -12372,11 +13229,12 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -12384,11 +13242,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -12399,11 +13261,11 @@ fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -12412,11 +13274,12 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -12425,15 +13288,19 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -12449,18 +13316,18 @@ # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -12471,11 +13338,12 @@ do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -12483,11 +13351,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -12498,11 +13370,11 @@ fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -12515,11 +13387,12 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -12527,11 +13400,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -12542,11 +13419,11 @@ fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -12558,34 +13435,138 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. +set dummy ${ac_tool_prefix}clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "clang", so it can be a program name with args. +set dummy clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi +else + CC="$ac_cv_prog_CC" fi fi -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 -for ac_option in --version -v -V -qversion; do +for ac_option in --version -v -V -qversion -version; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -12595,20 +13576,21 @@ cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 +printf %s "checking whether the compiler supports GNU C... " >&6; } +if test ${ac_cv_c_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { #ifndef __GNUC__ choke me @@ -12618,29 +13600,33 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_compiler_gnu=yes -else +else $as_nop ac_compiler_gnu=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_c_compiler_gnu + if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi -ac_test_CFLAGS=${CFLAGS+set} +ac_test_CFLAGS=${CFLAGS+y} ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +printf %s "checking whether $CC accepts -g... " >&6; } +if test ${ac_cv_prog_cc_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no @@ -12649,57 +13635,60 @@ /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_g=yes -else +else $as_nop CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : -else +else $as_nop ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_g=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +printf "%s\n" "$ac_cv_prog_cc_g" >&6; } +if test $ac_test_CFLAGS; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then @@ -12714,94 +13703,144 @@ CFLAGS= fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no +ac_prog_cc_stdc=no +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 +printf %s "checking for $CC option to enable C11 features... " >&6; } +if test ${ac_cv_prog_cc_c11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c11=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; +$ac_c_conftest_c11_program +_ACEOF +for ac_arg in '' -std=gnu11 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c11" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; +if test "x$ac_cv_prog_cc_c11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } + CC="$CC $ac_cv_prog_cc_c11" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 + ac_prog_cc_stdc=c11 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 +printf %s "checking for $CC option to enable C99 features... " >&6; } +if test ${ac_cv_prog_cc_c99+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c99_program +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} +if test "x$ac_cv_prog_cc_c99" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c99" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } + CC="$CC $ac_cv_prog_cc_c99" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 + ac_prog_cc_stdc=c99 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 +printf %s "checking for $CC option to enable C89 features... " >&6; } +if test ${ac_cv_prog_cc_c89+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c89_program _ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : + if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_c89=$ac_arg fi -rm -f core conftest.err conftest.$ac_objext +rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC - fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : +if test "x$ac_cv_prog_cc_c89" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c89" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } + CC="$CC $ac_cv_prog_cc_c89" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 + ac_prog_cc_stdc=c89 +fi fi ac_ext=c @@ -12810,6 +13849,12 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -12820,15 +13865,16 @@ CXX=$CCC else if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else @@ -12836,11 +13882,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -12851,11 +13901,11 @@ fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 -$as_echo "$CXX" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +printf "%s\n" "$CXX" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -12864,15 +13914,16 @@ fi if test -z "$CXX"; then ac_ct_CXX=$CXX - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else @@ -12880,11 +13931,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -12895,11 +13950,11 @@ fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 -$as_echo "$ac_ct_CXX" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +printf "%s\n" "$ac_ct_CXX" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -12911,8 +13966,8 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX @@ -12922,7 +13977,7 @@ fi fi # Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do @@ -12932,7 +13987,7 @@ *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -12942,20 +13997,21 @@ cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 -$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } -if ${ac_cv_cxx_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C++" >&5 +printf %s "checking whether the compiler supports GNU C++... " >&6; } +if test ${ac_cv_cxx_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { #ifndef __GNUC__ choke me @@ -12965,29 +14021,33 @@ return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : ac_compiler_gnu=yes -else +else $as_nop ac_compiler_gnu=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 -$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi -ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_test_CXXFLAGS=${CXXFLAGS+y} ac_save_CXXFLAGS=$CXXFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 -$as_echo_n "checking whether $CXX accepts -g... " >&6; } -if ${ac_cv_prog_cxx_g+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +printf %s "checking whether $CXX accepts -g... " >&6; } +if test ${ac_cv_prog_cxx_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no @@ -12996,57 +14056,60 @@ /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : ac_cv_prog_cxx_g=yes -else +else $as_nop CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : -else +else $as_nop ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : ac_cv_prog_cxx_g=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 -$as_echo "$ac_cv_prog_cxx_g" >&6; } -if test "$ac_test_CXXFLAGS" = set; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +printf "%s\n" "$ac_cv_prog_cxx_g" >&6; } +if test $ac_test_CXXFLAGS; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then @@ -13061,6 +14124,100 @@ CXXFLAGS= fi fi +ac_prog_cxx_stdcxx=no +if test x$ac_prog_cxx_stdcxx = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 +printf %s "checking for $CXX option to enable C++11 features... " >&6; } +if test ${ac_cv_prog_cxx_11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cxx_11=no +ac_save_CXX=$CXX +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_cxx_conftest_cxx11_program +_ACEOF +for ac_arg in '' -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x -qlanglvl=extended0x -AA +do + CXX="$ac_save_CXX $ac_arg" + if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_cxx11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cxx_cxx11" != "xno" && break +done +rm -f conftest.$ac_ext +CXX=$ac_save_CXX +fi + +if test "x$ac_cv_prog_cxx_cxx11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cxx_cxx11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 +printf "%s\n" "$ac_cv_prog_cxx_cxx11" >&6; } + CXX="$CXX $ac_cv_prog_cxx_cxx11" +fi + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 + ac_prog_cxx_stdcxx=cxx11 +fi +fi +if test x$ac_prog_cxx_stdcxx = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 +printf %s "checking for $CXX option to enable C++98 features... " >&6; } +if test ${ac_cv_prog_cxx_98+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cxx_98=no +ac_save_CXX=$CXX +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_cxx_conftest_cxx98_program +_ACEOF +for ac_arg in '' -std=gnu++98 -std=c++98 -qlanglvl=extended -AA +do + CXX="$ac_save_CXX $ac_arg" + if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_cxx98=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cxx_cxx98" != "xno" && break +done +rm -f conftest.$ac_ext +CXX=$ac_save_CXX +fi + +if test "x$ac_cv_prog_cxx_cxx98" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cxx_cxx98" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 +printf "%s\n" "$ac_cv_prog_cxx_cxx98" >&6; } + CXX="$CXX $ac_cv_prog_cxx_cxx98" +fi + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98 + ac_prog_cxx_stdcxx=cxx98 +fi +fi + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -13085,36 +14242,32 @@ ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 -$as_echo_n "checking how to run the C++ preprocessor... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 +printf %s "checking how to run the C++ preprocessor... " >&6; } if test -z "$CXXCPP"; then - if ${ac_cv_prog_CXXCPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CXXCPP needs to be expanded - for CXXCPP in "$CXX -E" "/lib/cpp" + if test ${ac_cv_prog_CXXCPP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # Double quotes because $CXX needs to be expanded + for CXXCPP in "$CXX -E" cpp /lib/cpp do ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif +#include Syntax error _ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : +if ac_fn_cxx_try_cpp "$LINENO" +then : -else +else $as_nop # Broken: fails on valid input. continue fi @@ -13126,10 +14279,11 @@ /* end confdefs.h. */ #include _ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : +if ac_fn_cxx_try_cpp "$LINENO" +then : # Broken: success on invalid input. continue -else +else $as_nop # Passes both tests. ac_preproc_ok=: break @@ -13139,7 +14293,8 @@ done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : +if $ac_preproc_ok +then : break fi @@ -13151,29 +14306,24 @@ else ac_cv_prog_CXXCPP=$CXXCPP fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 -$as_echo "$CXXCPP" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 +printf "%s\n" "$CXXCPP" >&6; } ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif +#include Syntax error _ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : +if ac_fn_cxx_try_cpp "$LINENO" +then : -else +else $as_nop # Broken: fails on valid input. continue fi @@ -13185,10 +14335,11 @@ /* end confdefs.h. */ #include _ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : +if ac_fn_cxx_try_cpp "$LINENO" +then : # Broken: success on invalid input. continue -else +else $as_nop # Passes both tests. ac_preproc_ok=: break @@ -13198,11 +14349,12 @@ done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : +if $ac_preproc_ok +then : -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi @@ -13338,17 +14490,18 @@ # Check whether --with-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then : +if test ${with_gnu_ld+y} +then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes -else +else $as_nop with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 -$as_echo_n "checking for ld used by $CC... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +printf %s "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw @@ -13377,15 +14530,16 @@ ;; esac elif test yes = "$with_gnu_ld"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 -$as_echo_n "checking for GNU ld... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +printf %s "checking for GNU ld... " >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 -$as_echo_n "checking for non-GNU ld... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +printf %s "checking for non-GNU ld... " >&6; } fi -if ${lt_cv_path_LD+:} false; then : - $as_echo_n "(cached) " >&6 -else +if test ${lt_cv_path_LD+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do @@ -13414,18 +14568,19 @@ LD=$lt_cv_path_LD if test -n "$LD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 -$as_echo "$LD" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +printf "%s\n" "$LD" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if ${lt_cv_prog_gnu_ld+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +printf %s "checking if the linker ($LD) is GNU ld... " >&6; } +if test ${lt_cv_prog_gnu_ld+y} +then : + printf %s "(cached) " >&6 +else $as_nop # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 -$as_echo "$lt_cv_prog_gnu_ld" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5 +printf "%s\n" "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld @@ -13491,8 +14646,8 @@ fi # PORTME: fill in a description of your system's C++ link characteristics - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } ld_shlibs_CXX=yes case $host_os in aix3*) @@ -13630,21 +14785,23 @@ if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else - if ${lt_cv_aix_libpath__CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test ${lt_cv_aix_libpath__CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : +if ac_fn_cxx_try_link "$LINENO" +then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { @@ -13659,7 +14816,7 @@ lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=/usr/lib:/lib @@ -13684,21 +14841,23 @@ if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else - if ${lt_cv_aix_libpath__CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test ${lt_cv_aix_libpath__CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : +if ac_fn_cxx_try_link "$LINENO" +then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { @@ -13713,7 +14872,7 @@ lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=/usr/lib:/lib @@ -14565,8 +15724,8 @@ ;; esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 -$as_echo "$ld_shlibs_CXX" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 +printf "%s\n" "$ld_shlibs_CXX" >&6; } test no = "$ld_shlibs_CXX" && can_build_shared=no GCC_CXX=$GXX @@ -14604,7 +15763,7 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Parse the compiler output and extract the necessary # objects, libraries and library flags. @@ -15086,26 +16245,28 @@ ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -$as_echo_n "checking for $compiler option to produce PIC... " >&6; } -if ${lt_cv_prog_compiler_pic_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +printf %s "checking for $compiler option to produce PIC... " >&6; } +if test ${lt_cv_prog_compiler_pic_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5 -$as_echo "$lt_cv_prog_compiler_pic_CXX" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5 +printf "%s\n" "$lt_cv_prog_compiler_pic_CXX" >&6; } lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 -$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } -if ${lt_cv_prog_compiler_pic_works_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 +printf %s "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } +if test ${lt_cv_prog_compiler_pic_works_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler_pic_works_CXX=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext @@ -15136,8 +16297,8 @@ $RM conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 -$as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 +printf "%s\n" "$lt_cv_prog_compiler_pic_works_CXX" >&6; } if test yes = "$lt_cv_prog_compiler_pic_works_CXX"; then case $lt_prog_compiler_pic_CXX in @@ -15159,11 +16320,12 @@ # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if ${lt_cv_prog_compiler_static_works_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +printf %s "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if test ${lt_cv_prog_compiler_static_works_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler_static_works_CXX=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" @@ -15187,8 +16349,8 @@ LDFLAGS=$save_LDFLAGS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5 -$as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5 +printf "%s\n" "$lt_cv_prog_compiler_static_works_CXX" >&6; } if test yes = "$lt_cv_prog_compiler_static_works_CXX"; then : @@ -15199,11 +16361,12 @@ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test ${lt_cv_prog_compiler_c_o_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest @@ -15246,16 +16409,17 @@ $RM conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 -$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 +printf "%s\n" "$lt_cv_prog_compiler_c_o_CXX" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test ${lt_cv_prog_compiler_c_o_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest @@ -15298,8 +16462,8 @@ $RM conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 -$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 +printf "%s\n" "$lt_cv_prog_compiler_c_o_CXX" >&6; } @@ -15307,19 +16471,19 @@ hard_links=nottested if test no = "$lt_cv_prog_compiler_c_o_CXX" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 -$as_echo_n "checking if we can lock with hard links... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +printf %s "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 -$as_echo "$hard_links" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +printf "%s\n" "$hard_links" >&6; } if test no = "$hard_links"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 -$as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 +printf "%s\n" "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} need_locks=warn fi else @@ -15328,8 +16492,8 @@ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' @@ -15368,8 +16532,8 @@ ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 -$as_echo "$ld_shlibs_CXX" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 +printf "%s\n" "$ld_shlibs_CXX" >&6; } test no = "$ld_shlibs_CXX" && can_build_shared=no with_gnu_ld_CXX=$with_gnu_ld @@ -15396,18 +16560,19 @@ # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 -$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } -if ${lt_cv_archive_cmds_need_lc_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +printf %s "checking whether -lc should be explicitly linked in... " >&6; } +if test ${lt_cv_archive_cmds_need_lc_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest @@ -15425,7 +16590,7 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc_CXX=no @@ -15439,8 +16604,8 @@ $RM conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5 -$as_echo "$lt_cv_archive_cmds_need_lc_CXX" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5 +printf "%s\n" "$lt_cv_archive_cmds_need_lc_CXX" >&6; } archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX ;; esac @@ -15509,8 +16674,8 @@ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 -$as_echo_n "checking dynamic linker characteristics... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +printf %s "checking dynamic linker characteristics... " >&6; } library_names_spec= libname_spec='lib$name' @@ -16000,9 +17165,10 @@ shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH - if ${lt_cv_shlibpath_overrides_runpath+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test ${lt_cv_shlibpath_overrides_runpath+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir @@ -16012,19 +17178,21 @@ /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : +if ac_fn_cxx_try_link "$LINENO" +then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null +then : lt_cv_shlibpath_overrides_runpath=yes fi fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir @@ -16261,8 +17429,8 @@ dynamic_linker=no ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 -$as_echo "$dynamic_linker" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +printf "%s\n" "$dynamic_linker" >&6; } test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" @@ -16326,8 +17494,8 @@ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 -$as_echo_n "checking how to hardcode library paths into programs... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +printf %s "checking how to hardcode library paths into programs... " >&6; } hardcode_action_CXX= if test -n "$hardcode_libdir_flag_spec_CXX" || test -n "$runpath_var_CXX" || @@ -16351,8 +17519,8 @@ # directories. hardcode_action_CXX=unsupported fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 -$as_echo "$hardcode_action_CXX" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 +printf "%s\n" "$hardcode_action_CXX" >&6; } if test relink = "$hardcode_action_CXX" || test yes = "$inherit_rpath_CXX"; then @@ -16391,34 +17559,113 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -# Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } -if test -z "$INSTALL"; then -if ${ac_cv_path_install+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +printf %s "checking for egrep... " >&6; } +if test ${ac_cv_path_EGREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in egrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +printf "%s\n" "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + + + # Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +printf %s "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if test ${ac_cv_path_install+y} +then : + printf %s "(cached) " >&6 +else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in #(( - ./ | .// | /[cC]/* | \ + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + # Account for fact that we put trailing slashes in our PATH walk. +case $as_dir in #(( + ./ | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; @@ -16428,13 +17675,13 @@ # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext"; then if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else @@ -16442,12 +17689,12 @@ echo one > conftest.one echo two > conftest.two mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" break 3 fi fi @@ -16463,7 +17710,7 @@ rm -rf conftest.one conftest.two conftest.dir fi - if test "${ac_cv_path_install+set}" = set; then + if test ${ac_cv_path_install+y}; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a @@ -16473,8 +17720,8 @@ INSTALL=$ac_install_sh fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +printf "%s\n" "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. @@ -16484,13 +17731,14 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} -ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : - $as_echo_n "(cached) " >&6 -else +ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval test \${ac_cv_prog_make_${ac_make}_set+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @@ -16506,12 +17754,12 @@ rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } SET_MAKE= else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi @@ -16526,11 +17774,12 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_PKG_CONFIG+y} +then : + printf %s "(cached) " >&6 +else $as_nop case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. @@ -16540,11 +17789,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -16556,11 +17809,11 @@ fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 -$as_echo "$PKG_CONFIG" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +printf "%s\n" "$PKG_CONFIG" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -16569,11 +17822,12 @@ ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_ac_pt_PKG_CONFIG+y} +then : + printf %s "(cached) " >&6 +else $as_nop case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. @@ -16583,11 +17837,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -16599,11 +17857,11 @@ fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 -$as_echo "$ac_pt_PKG_CONFIG" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +printf "%s\n" "$ac_pt_PKG_CONFIG" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then @@ -16611,8 +17869,8 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG @@ -16624,18 +17882,227 @@ fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 -$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +printf %s "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } PKG_CONFIG="" fi fi +if test -z "$AWK" ; then + as_fn_error $? "*** awk not found, aborting" "$LINENO" 5 +fi + +# Check whether --enable-largefile was given. +if test ${enable_largefile+y} +then : + enableval=$enable_largefile; +fi + +if test "$enable_largefile" != no; then + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 +printf %s "checking for special C compiler options needed for large files... " >&6; } +if test ${ac_cv_sys_largefile_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_sys_largefile_CC=no + if test "$GCC" != yes; then + ac_save_CC=$CC + while :; do + # IRIX 6.2 and later do not support large files by default, + # so use the C compiler's -n32 option if that helps. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main (void) +{ + + ; + return 0; +} +_ACEOF + if ac_fn_c_try_compile "$LINENO" +then : + break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + CC="$CC -n32" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_sys_largefile_CC=' -n32'; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + break + done + CC=$ac_save_CC + rm -f conftest.$ac_ext + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 +printf "%s\n" "$ac_cv_sys_largefile_CC" >&6; } + if test "$ac_cv_sys_largefile_CC" != no; then + CC=$CC$ac_cv_sys_largefile_CC + fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 +printf %s "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } +if test ${ac_cv_sys_file_offset_bits+y} +then : + printf %s "(cached) " >&6 +else $as_nop + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_sys_file_offset_bits=no; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _FILE_OFFSET_BITS 64 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_sys_file_offset_bits=64; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_cv_sys_file_offset_bits=unknown + break +done +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 +printf "%s\n" "$ac_cv_sys_file_offset_bits" >&6; } +case $ac_cv_sys_file_offset_bits in #( + no | unknown) ;; + *) +printf "%s\n" "#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits" >>confdefs.h +;; +esac +rm -rf conftest* + if test $ac_cv_sys_file_offset_bits = unknown; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 +printf %s "checking for _LARGE_FILES value needed for large files... " >&6; } +if test ${ac_cv_sys_large_files+y} +then : + printf %s "(cached) " >&6 +else $as_nop + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_sys_large_files=no; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _LARGE_FILES 1 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_sys_large_files=1; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_cv_sys_large_files=unknown + break +done +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 +printf "%s\n" "$ac_cv_sys_large_files" >&6; } +case $ac_cv_sys_large_files in #( + no | unknown) ;; + *) +printf "%s\n" "#define _LARGE_FILES $ac_cv_sys_large_files" >>confdefs.h +;; +esac +rm -rf conftest* + fi +fi + + case "$host" in *-*-mingw*) # Except on msys, where make can't handle full pathnames (bug 1972) @@ -16683,27 +18150,28 @@ # We build SDL on cygwin without the UNIX emulation layer save_CFLAGS="$CFLAGS" have_no_cygwin=no - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -mno-cygwin option" >&5 -$as_echo_n "checking for GCC -mno-cygwin option... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -mno-cygwin option" >&5 +printf %s "checking for GCC -mno-cygwin option... " >&6; } CFLAGS="$save_CFLAGS -mno-cygwin" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_no_cygwin=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_no_cygwin" >&5 -$as_echo "$have_no_cygwin" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_no_cygwin" >&5 +printf "%s\n" "$have_no_cygwin" >&6; } CFLAGS="$save_CFLAGS" if test x$have_no_cygwin = xyes; then @@ -16759,15 +18227,7 @@ host_lib_path="/usr/$base_libdir /usr/local/$base_libdir" fi for path in $env_lib_path $gcc_bin_path $gcc_lib_path $host_lib_path; do - lib=`ls -- $path/$1 2>/dev/null | sed -e '/\.so\..*\./d' -e 's,.*/,,' | sort | tail -1` - if test x$lib != x; then - echo $lib - return - fi - done - # Try again, this time allowing more than one version digit after the .so - for path in $env_lib_path $gcc_bin_path $gcc_lib_path $host_lib_path; do - lib=`ls -- $path/$1 2>/dev/null | sed -e 's,.*/,,' | sort | tail -1` + lib=`ls -- $path/$1 2>/dev/null | sed 's,.*/,,' | sort -V -r | $AWK 'BEGIN{FS="."}{ print NF, $0 }' | sort -n -s | sed 's,[0-9]* ,,' | head -1` if test x$lib != x; then echo $lib return @@ -16775,16 +18235,17 @@ done } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 -$as_echo_n "checking for an ANSI C-conforming const... " >&6; } -if ${ac_cv_c_const+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 +printf %s "checking for an ANSI C-conforming const... " >&6; } +if test ${ac_cv_c_const+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { #ifndef __cplusplus @@ -16797,7 +18258,7 @@ /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; - /* AIX XL C 1.02.0.0 rejects this. + /* IBM XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ @@ -16825,7 +18286,7 @@ iptr p = 0; ++p; } - { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying + { /* IBM XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; } bx; struct s *b = &bx; b->j = 5; @@ -16841,47 +18302,50 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_c_const=yes -else +else $as_nop ac_cv_c_const=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 -$as_echo "$ac_cv_c_const" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 +printf "%s\n" "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then -$as_echo "#define const /**/" >>confdefs.h +printf "%s\n" "#define const /**/" >>confdefs.h fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 -$as_echo_n "checking for inline... " >&6; } -if ${ac_cv_c_inline+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +printf %s "checking for inline... " >&6; } +if test ${ac_cv_c_inline+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; -static $ac_kw foo_t static_foo () {return 0; } -$ac_kw foo_t foo () {return 0; } +static $ac_kw foo_t static_foo (void) {return 0; } +$ac_kw foo_t foo (void) {return 0; } #endif _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_c_inline=$ac_kw fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 -$as_echo "$ac_cv_c_inline" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +printf "%s\n" "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; @@ -16898,16 +18362,17 @@ ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working volatile" >&5 -$as_echo_n "checking for working volatile... " >&6; } -if ${ac_cv_c_volatile+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working volatile" >&5 +printf %s "checking for working volatile... " >&6; } +if test ${ac_cv_c_volatile+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { volatile int x; @@ -16917,26 +18382,28 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_c_volatile=yes -else +else $as_nop ac_cv_c_volatile=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_volatile" >&5 -$as_echo "$ac_cv_c_volatile" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_volatile" >&5 +printf "%s\n" "$ac_cv_c_volatile" >&6; } if test $ac_cv_c_volatile = no; then -$as_echo "#define volatile /**/" >>confdefs.h +printf "%s\n" "#define volatile /**/" >>confdefs.h fi # Check whether --enable-assertions was given. -if test "${enable_assertions+set}" = set; then : +if test ${enable_assertions+y} +then : enableval=$enable_assertions; -else +else $as_nop enable_assertions=auto fi @@ -16945,22 +18412,22 @@ ;; disabled) -$as_echo "#define SDL_DEFAULT_ASSERT_LEVEL 0" >>confdefs.h +printf "%s\n" "#define SDL_DEFAULT_ASSERT_LEVEL 0" >>confdefs.h ;; release) -$as_echo "#define SDL_DEFAULT_ASSERT_LEVEL 1" >>confdefs.h +printf "%s\n" "#define SDL_DEFAULT_ASSERT_LEVEL 1" >>confdefs.h ;; enabled) -$as_echo "#define SDL_DEFAULT_ASSERT_LEVEL 2" >>confdefs.h +printf "%s\n" "#define SDL_DEFAULT_ASSERT_LEVEL 2" >>confdefs.h ;; paranoid) -$as_echo "#define SDL_DEFAULT_ASSERT_LEVEL 3" >>confdefs.h +printf "%s\n" "#define SDL_DEFAULT_ASSERT_LEVEL 3" >>confdefs.h ;; *) @@ -16968,17 +18435,20 @@ ;; esac +EXTRA_CFLAGS="$EXTRA_CFLAGS -DSDL_BUILD_MAJOR_VERSION=$SDL_MAJOR_VERSION -DSDL_BUILD_MINOR_VERSION=$SDL_MINOR_VERSION -DSDL_BUILD_MICRO_VERSION=$SDL_MICRO_VERSION" + # Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then : +if test ${enable_dependency_tracking+y} +then : enableval=$enable_dependency_tracking; -else +else $as_nop enable_dependency_tracking=yes fi if test x$enable_dependency_tracking = xyes; then have_gcc_mmd_mt=no - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -MMD -MT option" >&5 -$as_echo_n "checking for GCC -MMD -MT option... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -MMD -MT option" >&5 +printf %s "checking for GCC -MMD -MT option... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -16987,27 +18457,28 @@ #endif int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_gcc_mmd_mt=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_mmd_mt" >&5 -$as_echo "$have_gcc_mmd_mt" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_mmd_mt" >&5 +printf "%s\n" "$have_gcc_mmd_mt" >&6; } if test x$have_gcc_mmd_mt = xyes; then DEPENDENCY_TRACKING_OPTIONS="-MMD -MT \$@" fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker option --no-undefined" >&5 -$as_echo_n "checking for linker option --no-undefined... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for linker option --no-undefined" >&5 +printf %s "checking for linker option --no-undefined... " >&6; } have_no_undefined=no case "$host" in *-*-openbsd*) @@ -17019,29 +18490,30 @@ /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : have_no_undefined=yes BUILD_LDFLAGS="$BUILD_LDFLAGS -Wl,--no-undefined" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_no_undefined" >&5 -$as_echo "$have_no_undefined" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_no_undefined" >&5 +printf "%s\n" "$have_no_undefined" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker option --dynamicbase" >&5 -$as_echo_n "checking for linker option --dynamicbase... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for linker option --dynamicbase" >&5 +printf %s "checking for linker option --dynamicbase... " >&6; } have_dynamicbase=no case "$host" in *) @@ -17051,29 +18523,30 @@ /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : have_dynamicbase=yes EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,--dynamicbase" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_dynamicbase" >&5 -$as_echo "$have_dynamicbase" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_dynamicbase" >&5 +printf "%s\n" "$have_dynamicbase" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker option --nxcompat" >&5 -$as_echo_n "checking for linker option --nxcompat... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for linker option --nxcompat" >&5 +printf %s "checking for linker option --nxcompat... " >&6; } have_nxcompat=no case "$host" in *) @@ -17083,29 +18556,30 @@ /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : have_nxcompat=yes EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,--nxcompat" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_nxcompat" >&5 -$as_echo "$have_nxcompat" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_nxcompat" >&5 +printf "%s\n" "$have_nxcompat" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker option --high-entropy-va" >&5 -$as_echo_n "checking for linker option --high-entropy-va... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for linker option --high-entropy-va" >&5 +printf %s "checking for linker option --high-entropy-va... " >&6; } have_high_entropy_va=no case "$host" in *) @@ -17115,222 +18589,344 @@ /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : have_high_entropy_va=yes EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,--high-entropy-va" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_high_entropy_va" >&5 -$as_echo "$have_high_entropy_va" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_high_entropy_va" >&5 +printf "%s\n" "$have_high_entropy_va" >&6; } # Check whether --enable-libc was given. -if test "${enable_libc+set}" = set; then : +if test ${enable_libc+y} +then : enableval=$enable_libc; -else +else $as_nop enable_libc=yes fi if test x$enable_libc = xyes; then -$as_echo "#define HAVE_LIBC 1" >>confdefs.h +printf "%s\n" "#define HAVE_LIBC 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -int -main () -{ + ac_fn_c_check_header_compile "$LINENO" "sys/types.h" "ac_cv_header_sys_types_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_types_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_TYPES_H 1" >>confdefs.h - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : +ac_fn_c_check_header_compile "$LINENO" "stdio.h" "ac_cv_header_stdio_h" "$ac_includes_default" +if test "x$ac_cv_header_stdio_h" = xyes +then : + printf "%s\n" "#define HAVE_STDIO_H 1" >>confdefs.h -else - ac_cv_header_stdc=no fi -rm -f conftest* +ac_fn_c_check_header_compile "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" +if test "x$ac_cv_header_stdlib_h" = xyes +then : + printf "%s\n" "#define HAVE_STDLIB_H 1" >>confdefs.h fi +ac_fn_c_check_header_compile "$LINENO" "stddef.h" "ac_cv_header_stddef_h" "$ac_includes_default" +if test "x$ac_cv_header_stddef_h" = xyes +then : + printf "%s\n" "#define HAVE_STDDEF_H 1" >>confdefs.h -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include +fi +ac_fn_c_check_header_compile "$LINENO" "stdarg.h" "ac_cv_header_stdarg_h" "$ac_includes_default" +if test "x$ac_cv_header_stdarg_h" = xyes +then : + printf "%s\n" "#define HAVE_STDARG_H 1" >>confdefs.h -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : +fi +ac_fn_c_check_header_compile "$LINENO" "malloc.h" "ac_cv_header_malloc_h" "$ac_includes_default" +if test "x$ac_cv_header_malloc_h" = xyes +then : + printf "%s\n" "#define HAVE_MALLOC_H 1" >>confdefs.h -else - ac_cv_header_stdc=no fi -rm -f conftest* +ac_fn_c_check_header_compile "$LINENO" "memory.h" "ac_cv_header_memory_h" "$ac_includes_default" +if test "x$ac_cv_header_memory_h" = xyes +then : + printf "%s\n" "#define HAVE_MEMORY_H 1" >>confdefs.h fi +ac_fn_c_check_header_compile "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default" +if test "x$ac_cv_header_string_h" = xyes +then : + printf "%s\n" "#define HAVE_STRING_H 1" >>confdefs.h -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif +fi +ac_fn_c_check_header_compile "$LINENO" "strings.h" "ac_cv_header_strings_h" "$ac_includes_default" +if test "x$ac_cv_header_strings_h" = xyes +then : + printf "%s\n" "#define HAVE_STRINGS_H 1" >>confdefs.h -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : +fi +ac_fn_c_check_header_compile "$LINENO" "wchar.h" "ac_cv_header_wchar_h" "$ac_includes_default" +if test "x$ac_cv_header_wchar_h" = xyes +then : + printf "%s\n" "#define HAVE_WCHAR_H 1" >>confdefs.h -else - ac_cv_header_stdc=no fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +ac_fn_c_check_header_compile "$LINENO" "inttypes.h" "ac_cv_header_inttypes_h" "$ac_includes_default" +if test "x$ac_cv_header_inttypes_h" = xyes +then : + printf "%s\n" "#define HAVE_INTTYPES_H 1" >>confdefs.h + fi +ac_fn_c_check_header_compile "$LINENO" "stdint.h" "ac_cv_header_stdint_h" "$ac_includes_default" +if test "x$ac_cv_header_stdint_h" = xyes +then : + printf "%s\n" "#define HAVE_STDINT_H 1" >>confdefs.h fi +ac_fn_c_check_header_compile "$LINENO" "limits.h" "ac_cv_header_limits_h" "$ac_includes_default" +if test "x$ac_cv_header_limits_h" = xyes +then : + printf "%s\n" "#define HAVE_LIMITS_H 1" >>confdefs.h + fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then +ac_fn_c_check_header_compile "$LINENO" "ctype.h" "ac_cv_header_ctype_h" "$ac_includes_default" +if test "x$ac_cv_header_ctype_h" = xyes +then : + printf "%s\n" "#define HAVE_CTYPE_H 1" >>confdefs.h -$as_echo "#define STDC_HEADERS 1" >>confdefs.h +fi +ac_fn_c_check_header_compile "$LINENO" "math.h" "ac_cv_header_math_h" "$ac_includes_default" +if test "x$ac_cv_header_math_h" = xyes +then : + printf "%s\n" "#define HAVE_MATH_H 1" >>confdefs.h fi +ac_fn_c_check_header_compile "$LINENO" "float.h" "ac_cv_header_float_h" "$ac_includes_default" +if test "x$ac_cv_header_float_h" = xyes +then : + printf "%s\n" "#define HAVE_FLOAT_H 1" >>confdefs.h - for ac_header in sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h wchar.h inttypes.h stdint.h limits.h ctype.h math.h float.h iconv.h signal.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +fi +ac_fn_c_check_header_compile "$LINENO" "iconv.h" "ac_cv_header_iconv_h" "$ac_includes_default" +if test "x$ac_cv_header_iconv_h" = xyes +then : + printf "%s\n" "#define HAVE_ICONV_H 1" >>confdefs.h fi +ac_fn_c_check_header_compile "$LINENO" "signal.h" "ac_cv_header_signal_h" "$ac_includes_default" +if test "x$ac_cv_header_signal_h" = xyes +then : + printf "%s\n" "#define HAVE_SIGNAL_H 1" >>confdefs.h -done +fi ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" -if test "x$ac_cv_type_size_t" = xyes; then : +if test "x$ac_cv_type_size_t" = xyes +then : -else +else $as_nop -cat >>confdefs.h <<_ACEOF -#define size_t unsigned int -_ACEOF +printf "%s\n" "#define size_t unsigned int" >>confdefs.h fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for M_PI in math.h" >&5 -$as_echo_n "checking for M_PI in math.h... " >&6; } -if ${ac_cv_define_M_PI+:} false; then : - $as_echo_n "(cached) " >&6 -else + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +printf %s "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test ${ac_cv_prog_CPP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # Double quotes because $CC needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : -#include -#ifdef M_PI -YES_IS_DEFINED -#endif +else $as_nop + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "YES_IS_DEFINED" >/dev/null 2>&1; then : - ac_cv_define_M_PI=yes -else - ac_cv_define_M_PI=no +if ac_fn_c_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else $as_nop + # Passes both tests. +ac_preproc_ok=: +break fi -rm -f conftest* +rm -f conftest.err conftest.i conftest.$ac_ext +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok +then : + break +fi + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +printf "%s\n" "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + +else $as_nop + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else $as_nop + # Passes both tests. +ac_preproc_ok=: +break fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_define_M_PI" >&5 -$as_echo "$ac_cv_define_M_PI" >&6; } +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok +then : + +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for M_PI in math.h" >&5 +printf %s "checking for M_PI in math.h... " >&6; } +if test ${ac_cv_define_M_PI+y} +then : + printf %s "(cached) " >&6 +else $as_nop + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifdef M_PI +YES_IS_DEFINED +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "YES_IS_DEFINED" >/dev/null 2>&1 +then : + ac_cv_define_M_PI=yes +else $as_nop + ac_cv_define_M_PI=no +fi +rm -rf conftest* + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_define_M_PI" >&5 +printf "%s\n" "$ac_cv_define_M_PI" >&6; } if test "$ac_cv_define_M_PI" = "yes" ; then -$as_echo "#define HAVE_M_PI /**/" >>confdefs.h +printf "%s\n" "#define HAVE_M_PI /**/" >>confdefs.h fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 -$as_echo_n "checking for working alloca.h... " >&6; } -if ${ac_cv_working_alloca_h+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 +printf %s "checking for working alloca.h... " >&6; } +if test ${ac_cv_working_alloca_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main () +main (void) { char *p = (char *) alloca (2 * sizeof (int)); if (p) return 0; @@ -17338,52 +18934,52 @@ return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_working_alloca_h=yes -else +else $as_nop ac_cv_working_alloca_h=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 -$as_echo "$ac_cv_working_alloca_h" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 +printf "%s\n" "$ac_cv_working_alloca_h" >&6; } if test $ac_cv_working_alloca_h = yes; then -$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h +printf "%s\n" "#define HAVE_ALLOCA_H 1" >>confdefs.h fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 -$as_echo_n "checking for alloca... " >&6; } -if ${ac_cv_func_alloca_works+:} false; then : - $as_echo_n "(cached) " >&6 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 +printf %s "checking for alloca... " >&6; } +if test ${ac_cv_func_alloca_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test $ac_cv_working_alloca_h = yes; then + ac_cv_func_alloca_works=yes else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef __GNUC__ -# define alloca __builtin_alloca -#else -# ifdef _MSC_VER +#include +#include +#ifndef alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _MSC_VER # include # define alloca _alloca # else -# ifdef HAVE_ALLOCA_H -# include -# else -# ifdef _AIX - #pragma alloca -# else -# ifndef alloca /* predefined by HP cc +Olibcalls */ -void *alloca (size_t); -# endif -# endif +# ifdef __cplusplus +extern "C" # endif +void *alloca (size_t); # endif #endif int -main () +main (void) { char *p = (char *) alloca (1); if (p) return 0; @@ -17391,20 +18987,22 @@ return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_func_alloca_works=yes -else +else $as_nop ac_cv_func_alloca_works=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 -$as_echo "$ac_cv_func_alloca_works" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 +printf "%s\n" "$ac_cv_func_alloca_works" >&6; } +fi if test $ac_cv_func_alloca_works = yes; then -$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h +printf "%s\n" "#define HAVE_ALLOCA 1" >>confdefs.h else # The SVR3 libPW and SVR4 libucb both contain incompatible functions @@ -17414,58 +19012,19 @@ ALLOCA=\${LIBOBJDIR}alloca.$ac_objext -$as_echo "#define C_ALLOCA 1" >>confdefs.h - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5 -$as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; } -if ${ac_cv_os_cray+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if defined CRAY && ! defined CRAY2 -webecray -#else -wenotbecray -#endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "webecray" >/dev/null 2>&1; then : - ac_cv_os_cray=yes -else - ac_cv_os_cray=no -fi -rm -f conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5 -$as_echo "$ac_cv_os_cray" >&6; } -if test $ac_cv_os_cray = yes; then - for ac_func in _getb67 GETB67 getb67; do - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - -cat >>confdefs.h <<_ACEOF -#define CRAY_STACKSEG_END $ac_func -_ACEOF - - break -fi +printf "%s\n" "#define C_ALLOCA 1" >>confdefs.h - done -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 -$as_echo_n "checking stack direction for C alloca... " >&6; } -if ${ac_cv_c_stack_direction+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 +printf %s "checking stack direction for C alloca... " >&6; } +if test ${ac_cv_c_stack_direction+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : ac_cv_c_stack_direction=0 -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default @@ -17486,9 +19045,10 @@ return find_stack_direction (0, argc + !argv + 20) < 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : ac_cv_c_stack_direction=1 -else +else $as_nop ac_cv_c_stack_direction=-1 fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -17496,29 +19056,29 @@ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5 -$as_echo "$ac_cv_c_stack_direction" >&6; } -cat >>confdefs.h <<_ACEOF -#define STACK_DIRECTION $ac_cv_c_stack_direction -_ACEOF +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5 +printf "%s\n" "$ac_cv_c_stack_direction" >&6; } +printf "%s\n" "#define STACK_DIRECTION $ac_cv_c_stack_direction" >>confdefs.h fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5 -$as_echo_n "checking for working memcmp... " >&6; } -if ${ac_cv_func_memcmp_working+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5 +printf %s "checking for working memcmp... " >&6; } +if test ${ac_cv_func_memcmp_working+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : ac_cv_func_memcmp_working=no -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int -main () +main (void) { /* Some versions of memcmp are not 8-bit clean. */ @@ -17549,9 +19109,10 @@ return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : ac_cv_func_memcmp_working=yes -else +else $as_nop ac_cv_func_memcmp_working=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -17559,8 +19120,8 @@ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_memcmp_working" >&5 -$as_echo "$ac_cv_func_memcmp_working" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_memcmp_working" >&5 +printf "%s\n" "$ac_cv_func_memcmp_working" >&6; } test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in *" memcmp.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" @@ -17570,17 +19131,19 @@ if test x$ac_cv_func_memcmp_working = xyes; then -$as_echo "#define HAVE_MEMCMP 1" >>confdefs.h +printf "%s\n" "#define HAVE_MEMCMP 1" >>confdefs.h fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working strtod" >&5 -$as_echo_n "checking for working strtod... " >&6; } -if ${ac_cv_func_strtod+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working strtod" >&5 +printf %s "checking for working strtod... " >&6; } +if test ${ac_cv_func_strtod+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : ac_cv_func_strtod=no -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -17589,7 +19152,7 @@ double strtod (); #endif int -main() +main (void) { { /* Some versions of Linux strtod mis-parse strings with leading '+'. */ @@ -17614,36 +19177,547 @@ } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : ac_cv_func_strtod=yes -else +else $as_nop ac_cv_func_strtod=no fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strtod" >&5 +printf "%s\n" "$ac_cv_func_strtod" >&6; } +if test $ac_cv_func_strtod = no; then + case " $LIBOBJS " in + *" strtod.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS strtod.$ac_objext" + ;; +esac + +ac_fn_c_check_func "$LINENO" "pow" "ac_cv_func_pow" +if test "x$ac_cv_func_pow" = xyes +then : + +fi + +if test $ac_cv_func_pow = no; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pow in -lm" >&5 +printf %s "checking for pow in -lm... " >&6; } +if test ${ac_cv_lib_m_pow+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char pow (); +int +main (void) +{ +return pow (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_m_pow=yes +else $as_nop + ac_cv_lib_m_pow=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_pow" >&5 +printf "%s\n" "$ac_cv_lib_m_pow" >&6; } +if test "x$ac_cv_lib_m_pow" = xyes +then : + POW_LIB=-lm +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cannot find library containing definition of pow" >&5 +printf "%s\n" "$as_me: WARNING: cannot find library containing definition of pow" >&2;} +fi + +fi + +fi + + if test x$ac_cv_func_strtod = xyes; then + +printf "%s\n" "#define HAVE_STRTOD 1" >>confdefs.h + + fi + ac_fn_c_check_func "$LINENO" "mprotect" "ac_cv_func_mprotect" +if test "x$ac_cv_func_mprotect" = xyes +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + #include + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + + +printf "%s\n" "#define HAVE_MPROTECT 1" >>confdefs.h + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + ac_fn_c_check_func "$LINENO" "malloc" "ac_cv_func_malloc" +if test "x$ac_cv_func_malloc" = xyes +then : + printf "%s\n" "#define HAVE_MALLOC 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "calloc" "ac_cv_func_calloc" +if test "x$ac_cv_func_calloc" = xyes +then : + printf "%s\n" "#define HAVE_CALLOC 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "realloc" "ac_cv_func_realloc" +if test "x$ac_cv_func_realloc" = xyes +then : + printf "%s\n" "#define HAVE_REALLOC 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "free" "ac_cv_func_free" +if test "x$ac_cv_func_free" = xyes +then : + printf "%s\n" "#define HAVE_FREE 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "getenv" "ac_cv_func_getenv" +if test "x$ac_cv_func_getenv" = xyes +then : + printf "%s\n" "#define HAVE_GETENV 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "setenv" "ac_cv_func_setenv" +if test "x$ac_cv_func_setenv" = xyes +then : + printf "%s\n" "#define HAVE_SETENV 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "putenv" "ac_cv_func_putenv" +if test "x$ac_cv_func_putenv" = xyes +then : + printf "%s\n" "#define HAVE_PUTENV 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "unsetenv" "ac_cv_func_unsetenv" +if test "x$ac_cv_func_unsetenv" = xyes +then : + printf "%s\n" "#define HAVE_UNSETENV 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "bsearch" "ac_cv_func_bsearch" +if test "x$ac_cv_func_bsearch" = xyes +then : + printf "%s\n" "#define HAVE_BSEARCH 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "qsort" "ac_cv_func_qsort" +if test "x$ac_cv_func_qsort" = xyes +then : + printf "%s\n" "#define HAVE_QSORT 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "abs" "ac_cv_func_abs" +if test "x$ac_cv_func_abs" = xyes +then : + printf "%s\n" "#define HAVE_ABS 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "bcopy" "ac_cv_func_bcopy" +if test "x$ac_cv_func_bcopy" = xyes +then : + printf "%s\n" "#define HAVE_BCOPY 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "memset" "ac_cv_func_memset" +if test "x$ac_cv_func_memset" = xyes +then : + printf "%s\n" "#define HAVE_MEMSET 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "memcpy" "ac_cv_func_memcpy" +if test "x$ac_cv_func_memcpy" = xyes +then : + printf "%s\n" "#define HAVE_MEMCPY 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "memmove" "ac_cv_func_memmove" +if test "x$ac_cv_func_memmove" = xyes +then : + printf "%s\n" "#define HAVE_MEMMOVE 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "wcslen" "ac_cv_func_wcslen" +if test "x$ac_cv_func_wcslen" = xyes +then : + printf "%s\n" "#define HAVE_WCSLEN 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "wcslcpy" "ac_cv_func_wcslcpy" +if test "x$ac_cv_func_wcslcpy" = xyes +then : + printf "%s\n" "#define HAVE_WCSLCPY 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "wcslcat" "ac_cv_func_wcslcat" +if test "x$ac_cv_func_wcslcat" = xyes +then : + printf "%s\n" "#define HAVE_WCSLCAT 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "_wcsdup" "ac_cv_func__wcsdup" +if test "x$ac_cv_func__wcsdup" = xyes +then : + printf "%s\n" "#define HAVE__WCSDUP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "wcsdup" "ac_cv_func_wcsdup" +if test "x$ac_cv_func_wcsdup" = xyes +then : + printf "%s\n" "#define HAVE_WCSDUP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "wcsstr" "ac_cv_func_wcsstr" +if test "x$ac_cv_func_wcsstr" = xyes +then : + printf "%s\n" "#define HAVE_WCSSTR 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "wcscmp" "ac_cv_func_wcscmp" +if test "x$ac_cv_func_wcscmp" = xyes +then : + printf "%s\n" "#define HAVE_WCSCMP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "wcsncmp" "ac_cv_func_wcsncmp" +if test "x$ac_cv_func_wcsncmp" = xyes +then : + printf "%s\n" "#define HAVE_WCSNCMP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "wcscasecmp" "ac_cv_func_wcscasecmp" +if test "x$ac_cv_func_wcscasecmp" = xyes +then : + printf "%s\n" "#define HAVE_WCSCASECMP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "_wcsicmp" "ac_cv_func__wcsicmp" +if test "x$ac_cv_func__wcsicmp" = xyes +then : + printf "%s\n" "#define HAVE__WCSICMP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "wcsncasecmp" "ac_cv_func_wcsncasecmp" +if test "x$ac_cv_func_wcsncasecmp" = xyes +then : + printf "%s\n" "#define HAVE_WCSNCASECMP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "_wcsnicmp" "ac_cv_func__wcsnicmp" +if test "x$ac_cv_func__wcsnicmp" = xyes +then : + printf "%s\n" "#define HAVE__WCSNICMP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strlen" "ac_cv_func_strlen" +if test "x$ac_cv_func_strlen" = xyes +then : + printf "%s\n" "#define HAVE_STRLEN 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strlcpy" "ac_cv_func_strlcpy" +if test "x$ac_cv_func_strlcpy" = xyes +then : + printf "%s\n" "#define HAVE_STRLCPY 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strlcat" "ac_cv_func_strlcat" +if test "x$ac_cv_func_strlcat" = xyes +then : + printf "%s\n" "#define HAVE_STRLCAT 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "_strrev" "ac_cv_func__strrev" +if test "x$ac_cv_func__strrev" = xyes +then : + printf "%s\n" "#define HAVE__STRREV 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "_strupr" "ac_cv_func__strupr" +if test "x$ac_cv_func__strupr" = xyes +then : + printf "%s\n" "#define HAVE__STRUPR 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "_strlwr" "ac_cv_func__strlwr" +if test "x$ac_cv_func__strlwr" = xyes +then : + printf "%s\n" "#define HAVE__STRLWR 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "index" "ac_cv_func_index" +if test "x$ac_cv_func_index" = xyes +then : + printf "%s\n" "#define HAVE_INDEX 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "rindex" "ac_cv_func_rindex" +if test "x$ac_cv_func_rindex" = xyes +then : + printf "%s\n" "#define HAVE_RINDEX 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strchr" "ac_cv_func_strchr" +if test "x$ac_cv_func_strchr" = xyes +then : + printf "%s\n" "#define HAVE_STRCHR 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strrchr" "ac_cv_func_strrchr" +if test "x$ac_cv_func_strrchr" = xyes +then : + printf "%s\n" "#define HAVE_STRRCHR 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strstr" "ac_cv_func_strstr" +if test "x$ac_cv_func_strstr" = xyes +then : + printf "%s\n" "#define HAVE_STRSTR 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strtok_r" "ac_cv_func_strtok_r" +if test "x$ac_cv_func_strtok_r" = xyes +then : + printf "%s\n" "#define HAVE_STRTOK_R 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "itoa" "ac_cv_func_itoa" +if test "x$ac_cv_func_itoa" = xyes +then : + printf "%s\n" "#define HAVE_ITOA 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "_ltoa" "ac_cv_func__ltoa" +if test "x$ac_cv_func__ltoa" = xyes +then : + printf "%s\n" "#define HAVE__LTOA 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "_uitoa" "ac_cv_func__uitoa" +if test "x$ac_cv_func__uitoa" = xyes +then : + printf "%s\n" "#define HAVE__UITOA 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "_ultoa" "ac_cv_func__ultoa" +if test "x$ac_cv_func__ultoa" = xyes +then : + printf "%s\n" "#define HAVE__ULTOA 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strtol" "ac_cv_func_strtol" +if test "x$ac_cv_func_strtol" = xyes +then : + printf "%s\n" "#define HAVE_STRTOL 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strtoul" "ac_cv_func_strtoul" +if test "x$ac_cv_func_strtoul" = xyes +then : + printf "%s\n" "#define HAVE_STRTOUL 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "_i64toa" "ac_cv_func__i64toa" +if test "x$ac_cv_func__i64toa" = xyes +then : + printf "%s\n" "#define HAVE__I64TOA 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "_ui64toa" "ac_cv_func__ui64toa" +if test "x$ac_cv_func__ui64toa" = xyes +then : + printf "%s\n" "#define HAVE__UI64TOA 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strtoll" "ac_cv_func_strtoll" +if test "x$ac_cv_func_strtoll" = xyes +then : + printf "%s\n" "#define HAVE_STRTOLL 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strtoull" "ac_cv_func_strtoull" +if test "x$ac_cv_func_strtoull" = xyes +then : + printf "%s\n" "#define HAVE_STRTOULL 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "atoi" "ac_cv_func_atoi" +if test "x$ac_cv_func_atoi" = xyes +then : + printf "%s\n" "#define HAVE_ATOI 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "atof" "ac_cv_func_atof" +if test "x$ac_cv_func_atof" = xyes +then : + printf "%s\n" "#define HAVE_ATOF 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strcmp" "ac_cv_func_strcmp" +if test "x$ac_cv_func_strcmp" = xyes +then : + printf "%s\n" "#define HAVE_STRCMP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strncmp" "ac_cv_func_strncmp" +if test "x$ac_cv_func_strncmp" = xyes +then : + printf "%s\n" "#define HAVE_STRNCMP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "_stricmp" "ac_cv_func__stricmp" +if test "x$ac_cv_func__stricmp" = xyes +then : + printf "%s\n" "#define HAVE__STRICMP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strcasecmp" "ac_cv_func_strcasecmp" +if test "x$ac_cv_func_strcasecmp" = xyes +then : + printf "%s\n" "#define HAVE_STRCASECMP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "_strnicmp" "ac_cv_func__strnicmp" +if test "x$ac_cv_func__strnicmp" = xyes +then : + printf "%s\n" "#define HAVE__STRNICMP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strncasecmp" "ac_cv_func_strncasecmp" +if test "x$ac_cv_func_strncasecmp" = xyes +then : + printf "%s\n" "#define HAVE_STRNCASECMP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "vsscanf" "ac_cv_func_vsscanf" +if test "x$ac_cv_func_vsscanf" = xyes +then : + printf "%s\n" "#define HAVE_VSSCANF 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "vsnprintf" "ac_cv_func_vsnprintf" +if test "x$ac_cv_func_vsnprintf" = xyes +then : + printf "%s\n" "#define HAVE_VSNPRINTF 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "fopen64" "ac_cv_func_fopen64" +if test "x$ac_cv_func_fopen64" = xyes +then : + printf "%s\n" "#define HAVE_FOPEN64 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "fseeko" "ac_cv_func_fseeko" +if test "x$ac_cv_func_fseeko" = xyes +then : + printf "%s\n" "#define HAVE_FSEEKO 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "fseeko64" "ac_cv_func_fseeko64" +if test "x$ac_cv_func_fseeko64" = xyes +then : + printf "%s\n" "#define HAVE_FSEEKO64 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "sigaction" "ac_cv_func_sigaction" +if test "x$ac_cv_func_sigaction" = xyes +then : + printf "%s\n" "#define HAVE_SIGACTION 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "setjmp" "ac_cv_func_setjmp" +if test "x$ac_cv_func_setjmp" = xyes +then : + printf "%s\n" "#define HAVE_SETJMP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "nanosleep" "ac_cv_func_nanosleep" +if test "x$ac_cv_func_nanosleep" = xyes +then : + printf "%s\n" "#define HAVE_NANOSLEEP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "sysconf" "ac_cv_func_sysconf" +if test "x$ac_cv_func_sysconf" = xyes +then : + printf "%s\n" "#define HAVE_SYSCONF 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "sysctlbyname" "ac_cv_func_sysctlbyname" +if test "x$ac_cv_func_sysctlbyname" = xyes +then : + printf "%s\n" "#define HAVE_SYSCTLBYNAME 1" >>confdefs.h + fi +ac_fn_c_check_func "$LINENO" "getauxval" "ac_cv_func_getauxval" +if test "x$ac_cv_func_getauxval" = xyes +then : + printf "%s\n" "#define HAVE_GETAUXVAL 1" >>confdefs.h fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strtod" >&5 -$as_echo "$ac_cv_func_strtod" >&6; } -if test $ac_cv_func_strtod = no; then - case " $LIBOBJS " in - *" strtod.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS strtod.$ac_objext" - ;; -esac +ac_fn_c_check_func "$LINENO" "elf_aux_info" "ac_cv_func_elf_aux_info" +if test "x$ac_cv_func_elf_aux_info" = xyes +then : + printf "%s\n" "#define HAVE_ELF_AUX_INFO 1" >>confdefs.h -ac_fn_c_check_func "$LINENO" "pow" "ac_cv_func_pow" -if test "x$ac_cv_func_pow" = xyes; then : +fi +ac_fn_c_check_func "$LINENO" "poll" "ac_cv_func_poll" +if test "x$ac_cv_func_poll" = xyes +then : + printf "%s\n" "#define HAVE_POLL 1" >>confdefs.h fi +ac_fn_c_check_func "$LINENO" "_Exit" "ac_cv_func__Exit" +if test "x$ac_cv_func__Exit" = xyes +then : + printf "%s\n" "#define HAVE__EXIT 1" >>confdefs.h -if test $ac_cv_func_pow = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pow in -lm" >&5 -$as_echo_n "checking for pow in -lm... " >&6; } -if ${ac_cv_lib_m_pow+:} false; then : - $as_echo_n "(cached) " >&6 -else +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pow in -lm" >&5 +printf %s "checking for pow in -lm... " >&6; } +if test ${ac_cv_lib_m_pow+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -17652,142 +19726,292 @@ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char pow (); int -main () +main (void) { return pow (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_m_pow=yes -else +else $as_nop ac_cv_lib_m_pow=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_pow" >&5 -$as_echo "$ac_cv_lib_m_pow" >&6; } -if test "x$ac_cv_lib_m_pow" = xyes; then : - POW_LIB=-lm -else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot find library containing definition of pow" >&5 -$as_echo "$as_me: WARNING: cannot find library containing definition of pow" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_pow" >&5 +printf "%s\n" "$ac_cv_lib_m_pow" >&6; } +if test "x$ac_cv_lib_m_pow" = xyes +then : + LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm" fi + ac_fn_c_check_func "$LINENO" "acos" "ac_cv_func_acos" +if test "x$ac_cv_func_acos" = xyes +then : + printf "%s\n" "#define HAVE_ACOS 1" >>confdefs.h + fi +ac_fn_c_check_func "$LINENO" "acosf" "ac_cv_func_acosf" +if test "x$ac_cv_func_acosf" = xyes +then : + printf "%s\n" "#define HAVE_ACOSF 1" >>confdefs.h fi +ac_fn_c_check_func "$LINENO" "asin" "ac_cv_func_asin" +if test "x$ac_cv_func_asin" = xyes +then : + printf "%s\n" "#define HAVE_ASIN 1" >>confdefs.h - if test x$ac_cv_func_strtod = xyes; then +fi +ac_fn_c_check_func "$LINENO" "asinf" "ac_cv_func_asinf" +if test "x$ac_cv_func_asinf" = xyes +then : + printf "%s\n" "#define HAVE_ASINF 1" >>confdefs.h -$as_echo "#define HAVE_STRTOD 1" >>confdefs.h +fi +ac_fn_c_check_func "$LINENO" "atan" "ac_cv_func_atan" +if test "x$ac_cv_func_atan" = xyes +then : + printf "%s\n" "#define HAVE_ATAN 1" >>confdefs.h - fi - ac_fn_c_check_func "$LINENO" "mprotect" "ac_cv_func_mprotect" -if test "x$ac_cv_func_mprotect" = xyes; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +fi +ac_fn_c_check_func "$LINENO" "atanf" "ac_cv_func_atanf" +if test "x$ac_cv_func_atanf" = xyes +then : + printf "%s\n" "#define HAVE_ATANF 1" >>confdefs.h - #include - #include +fi +ac_fn_c_check_func "$LINENO" "atan2" "ac_cv_func_atan2" +if test "x$ac_cv_func_atan2" = xyes +then : + printf "%s\n" "#define HAVE_ATAN2 1" >>confdefs.h -int -main () -{ +fi +ac_fn_c_check_func "$LINENO" "atan2f" "ac_cv_func_atan2f" +if test "x$ac_cv_func_atan2f" = xyes +then : + printf "%s\n" "#define HAVE_ATAN2F 1" >>confdefs.h - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +fi +ac_fn_c_check_func "$LINENO" "ceil" "ac_cv_func_ceil" +if test "x$ac_cv_func_ceil" = xyes +then : + printf "%s\n" "#define HAVE_CEIL 1" >>confdefs.h +fi +ac_fn_c_check_func "$LINENO" "ceilf" "ac_cv_func_ceilf" +if test "x$ac_cv_func_ceilf" = xyes +then : + printf "%s\n" "#define HAVE_CEILF 1" >>confdefs.h -$as_echo "#define HAVE_MPROTECT 1" >>confdefs.h +fi +ac_fn_c_check_func "$LINENO" "copysign" "ac_cv_func_copysign" +if test "x$ac_cv_func_copysign" = xyes +then : + printf "%s\n" "#define HAVE_COPYSIGN 1" >>confdefs.h +fi +ac_fn_c_check_func "$LINENO" "copysignf" "ac_cv_func_copysignf" +if test "x$ac_cv_func_copysignf" = xyes +then : + printf "%s\n" "#define HAVE_COPYSIGNF 1" >>confdefs.h fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_fn_c_check_func "$LINENO" "cos" "ac_cv_func_cos" +if test "x$ac_cv_func_cos" = xyes +then : + printf "%s\n" "#define HAVE_COS 1" >>confdefs.h + fi +ac_fn_c_check_func "$LINENO" "cosf" "ac_cv_func_cosf" +if test "x$ac_cv_func_cosf" = xyes +then : + printf "%s\n" "#define HAVE_COSF 1" >>confdefs.h - for ac_func in malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcslcpy wcslcat _wcsdup wcsdup wcsstr wcscmp wcsncmp wcscasecmp _wcsicmp wcsncasecmp _wcsnicmp strlen strlcpy strlcat _strrev _strupr _strlwr index rindex strchr strrchr strstr strtok_r itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval elf_aux_info poll _Exit -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +fi +ac_fn_c_check_func "$LINENO" "exp" "ac_cv_func_exp" +if test "x$ac_cv_func_exp" = xyes +then : + printf "%s\n" "#define HAVE_EXP 1" >>confdefs.h fi -done +ac_fn_c_check_func "$LINENO" "expf" "ac_cv_func_expf" +if test "x$ac_cv_func_expf" = xyes +then : + printf "%s\n" "#define HAVE_EXPF 1" >>confdefs.h +fi +ac_fn_c_check_func "$LINENO" "fabs" "ac_cv_func_fabs" +if test "x$ac_cv_func_fabs" = xyes +then : + printf "%s\n" "#define HAVE_FABS 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pow in -lm" >&5 -$as_echo_n "checking for pow in -lm... " >&6; } -if ${ac_cv_lib_m_pow+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lm $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +fi +ac_fn_c_check_func "$LINENO" "fabsf" "ac_cv_func_fabsf" +if test "x$ac_cv_func_fabsf" = xyes +then : + printf "%s\n" "#define HAVE_FABSF 1" >>confdefs.h -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char pow (); -int -main () -{ -return pow (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_m_pow=yes -else - ac_cv_lib_m_pow=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS +ac_fn_c_check_func "$LINENO" "floor" "ac_cv_func_floor" +if test "x$ac_cv_func_floor" = xyes +then : + printf "%s\n" "#define HAVE_FLOOR 1" >>confdefs.h + fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_pow" >&5 -$as_echo "$ac_cv_lib_m_pow" >&6; } -if test "x$ac_cv_lib_m_pow" = xyes; then : - LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm" +ac_fn_c_check_func "$LINENO" "floorf" "ac_cv_func_floorf" +if test "x$ac_cv_func_floorf" = xyes +then : + printf "%s\n" "#define HAVE_FLOORF 1" >>confdefs.h + fi +ac_fn_c_check_func "$LINENO" "trunc" "ac_cv_func_trunc" +if test "x$ac_cv_func_trunc" = xyes +then : + printf "%s\n" "#define HAVE_TRUNC 1" >>confdefs.h - for ac_func in acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf copysign copysignf cos cosf exp expf fabs fabsf floor floorf trunc truncf fmod fmodf log logf log10 log10f lround lroundf pow powf round roundf scalbn scalbnf sin sinf sqrt sqrtf tan tanf -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +fi +ac_fn_c_check_func "$LINENO" "truncf" "ac_cv_func_truncf" +if test "x$ac_cv_func_truncf" = xyes +then : + printf "%s\n" "#define HAVE_TRUNCF 1" >>confdefs.h fi -done +ac_fn_c_check_func "$LINENO" "fmod" "ac_cv_func_fmod" +if test "x$ac_cv_func_fmod" = xyes +then : + printf "%s\n" "#define HAVE_FMOD 1" >>confdefs.h +fi +ac_fn_c_check_func "$LINENO" "fmodf" "ac_cv_func_fmodf" +if test "x$ac_cv_func_fmodf" = xyes +then : + printf "%s\n" "#define HAVE_FMODF 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv_open in -liconv" >&5 -$as_echo_n "checking for iconv_open in -liconv... " >&6; } -if ${ac_cv_lib_iconv_iconv_open+:} false; then : - $as_echo_n "(cached) " >&6 -else +fi +ac_fn_c_check_func "$LINENO" "log" "ac_cv_func_log" +if test "x$ac_cv_func_log" = xyes +then : + printf "%s\n" "#define HAVE_LOG 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "logf" "ac_cv_func_logf" +if test "x$ac_cv_func_logf" = xyes +then : + printf "%s\n" "#define HAVE_LOGF 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "log10" "ac_cv_func_log10" +if test "x$ac_cv_func_log10" = xyes +then : + printf "%s\n" "#define HAVE_LOG10 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "log10f" "ac_cv_func_log10f" +if test "x$ac_cv_func_log10f" = xyes +then : + printf "%s\n" "#define HAVE_LOG10F 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "lround" "ac_cv_func_lround" +if test "x$ac_cv_func_lround" = xyes +then : + printf "%s\n" "#define HAVE_LROUND 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "lroundf" "ac_cv_func_lroundf" +if test "x$ac_cv_func_lroundf" = xyes +then : + printf "%s\n" "#define HAVE_LROUNDF 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "pow" "ac_cv_func_pow" +if test "x$ac_cv_func_pow" = xyes +then : + printf "%s\n" "#define HAVE_POW 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "powf" "ac_cv_func_powf" +if test "x$ac_cv_func_powf" = xyes +then : + printf "%s\n" "#define HAVE_POWF 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "round" "ac_cv_func_round" +if test "x$ac_cv_func_round" = xyes +then : + printf "%s\n" "#define HAVE_ROUND 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "roundf" "ac_cv_func_roundf" +if test "x$ac_cv_func_roundf" = xyes +then : + printf "%s\n" "#define HAVE_ROUNDF 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "scalbn" "ac_cv_func_scalbn" +if test "x$ac_cv_func_scalbn" = xyes +then : + printf "%s\n" "#define HAVE_SCALBN 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "scalbnf" "ac_cv_func_scalbnf" +if test "x$ac_cv_func_scalbnf" = xyes +then : + printf "%s\n" "#define HAVE_SCALBNF 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "sin" "ac_cv_func_sin" +if test "x$ac_cv_func_sin" = xyes +then : + printf "%s\n" "#define HAVE_SIN 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "sinf" "ac_cv_func_sinf" +if test "x$ac_cv_func_sinf" = xyes +then : + printf "%s\n" "#define HAVE_SINF 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "sqrt" "ac_cv_func_sqrt" +if test "x$ac_cv_func_sqrt" = xyes +then : + printf "%s\n" "#define HAVE_SQRT 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "sqrtf" "ac_cv_func_sqrtf" +if test "x$ac_cv_func_sqrtf" = xyes +then : + printf "%s\n" "#define HAVE_SQRTF 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "tan" "ac_cv_func_tan" +if test "x$ac_cv_func_tan" = xyes +then : + printf "%s\n" "#define HAVE_TAN 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "tanf" "ac_cv_func_tanf" +if test "x$ac_cv_func_tanf" = xyes +then : + printf "%s\n" "#define HAVE_TANF 1" >>confdefs.h + +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for iconv_open in -liconv" >&5 +printf %s "checking for iconv_open in -liconv... " >&6; } +if test ${ac_cv_lib_iconv_iconv_open+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-liconv $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -17796,85 +20020,77 @@ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char iconv_open (); int -main () +main (void) { return iconv_open (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_iconv_iconv_open=yes -else +else $as_nop ac_cv_lib_iconv_iconv_open=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_iconv_iconv_open" >&5 -$as_echo "$ac_cv_lib_iconv_iconv_open" >&6; } -if test "x$ac_cv_lib_iconv_iconv_open" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_iconv_iconv_open" >&5 +printf "%s\n" "$ac_cv_lib_iconv_iconv_open" >&6; } +if test "x$ac_cv_lib_iconv_iconv_open" = xyes +then : LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv" fi - for ac_func in iconv -do : - ac_fn_c_check_func "$LINENO" "iconv" "ac_cv_func_iconv" -if test "x$ac_cv_func_iconv" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_ICONV 1 -_ACEOF + ac_fn_c_check_func "$LINENO" "iconv" "ac_cv_func_iconv" +if test "x$ac_cv_func_iconv" = xyes +then : + printf "%s\n" "#define HAVE_ICONV 1" >>confdefs.h fi -done ac_fn_c_check_member "$LINENO" "struct sigaction" "sa_sigaction" "ac_cv_member_struct_sigaction_sa_sigaction" "#include " -if test "x$ac_cv_member_struct_sigaction_sa_sigaction" = xyes; then : +if test "x$ac_cv_member_struct_sigaction_sa_sigaction" = xyes +then : -$as_echo "#define HAVE_SA_SIGACTION 1" >>confdefs.h +printf "%s\n" "#define HAVE_SA_SIGACTION 1" >>confdefs.h fi - for ac_header in libunwind.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "libunwind.h" "ac_cv_header_libunwind_h" "$ac_includes_default" -if test "x$ac_cv_header_libunwind_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBUNWIND_H 1 -_ACEOF + ac_fn_c_check_header_compile "$LINENO" "libunwind.h" "ac_cv_header_libunwind_h" "$ac_includes_default" +if test "x$ac_cv_header_libunwind_h" = xyes +then : + printf "%s\n" "#define HAVE_LIBUNWIND_H 1" >>confdefs.h fi -done - fi # Check whether --enable-gcc-atomics was given. -if test "${enable_gcc_atomics+set}" = set; then : +if test ${enable_gcc_atomics+y} +then : enableval=$enable_gcc_atomics; -else +else $as_nop enable_gcc_atomics=yes fi if test x$enable_gcc_atomics = xyes; then have_gcc_atomics=no - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC builtin atomic operations" >&5 -$as_echo_n "checking for GCC builtin atomic operations... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC builtin atomic operations" >&5 +printf %s "checking for GCC builtin atomic operations... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { int a; @@ -17889,17 +20105,18 @@ return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : have_gcc_atomics=yes fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_atomics" >&5 -$as_echo "$have_gcc_atomics" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_atomics" >&5 +printf "%s\n" "$have_gcc_atomics" >&6; } if test x$have_gcc_atomics = xyes; then -$as_echo "#define HAVE_GCC_ATOMICS 1" >>confdefs.h +printf "%s\n" "#define HAVE_GCC_ATOMICS 1" >>confdefs.h else # See if we have the minimum operation needed for GCC atomics @@ -17907,7 +20124,7 @@ /* end confdefs.h. */ int -main () +main (void) { int a; @@ -17918,14 +20135,15 @@ return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : have_gcc_sync_lock_test_and_set=yes fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test x$have_gcc_sync_lock_test_and_set = xyes; then -$as_echo "#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1" >>confdefs.h +printf "%s\n" "#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1" >>confdefs.h fi fi @@ -17967,271 +20185,283 @@ esac # Check whether --enable-atomic was given. -if test "${enable_atomic+set}" = set; then : +if test ${enable_atomic+y} +then : enableval=$enable_atomic; -else +else $as_nop enable_atomic=$default_atomic fi if test x$enable_atomic != xyes; then -$as_echo "#define SDL_ATOMIC_DISABLED 1" >>confdefs.h +printf "%s\n" "#define SDL_ATOMIC_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} atomic" fi # Check whether --enable-audio was given. -if test "${enable_audio+set}" = set; then : +if test ${enable_audio+y} +then : enableval=$enable_audio; -else +else $as_nop enable_audio=yes fi if test x$enable_audio != xyes; then -$as_echo "#define SDL_AUDIO_DISABLED 1" >>confdefs.h +printf "%s\n" "#define SDL_AUDIO_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} audio" fi # Check whether --enable-video was given. -if test "${enable_video+set}" = set; then : +if test ${enable_video+y} +then : enableval=$enable_video; -else +else $as_nop enable_video=yes fi if test x$enable_video != xyes; then -$as_echo "#define SDL_VIDEO_DISABLED 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} video" fi # Check whether --enable-render was given. -if test "${enable_render+set}" = set; then : +if test ${enable_render+y} +then : enableval=$enable_render; -else +else $as_nop enable_render=yes fi if test x$enable_render != xyes; then -$as_echo "#define SDL_RENDER_DISABLED 1" >>confdefs.h +printf "%s\n" "#define SDL_RENDER_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} render" fi # Check whether --enable-events was given. -if test "${enable_events+set}" = set; then : +if test ${enable_events+y} +then : enableval=$enable_events; -else +else $as_nop enable_events=yes fi if test x$enable_events != xyes; then -$as_echo "#define SDL_EVENTS_DISABLED 1" >>confdefs.h +printf "%s\n" "#define SDL_EVENTS_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} events" fi # Check whether --enable-joystick was given. -if test "${enable_joystick+set}" = set; then : +if test ${enable_joystick+y} +then : enableval=$enable_joystick; -else +else $as_nop enable_joystick=yes fi if test x$enable_joystick != xyes; then -$as_echo "#define SDL_JOYSTICK_DISABLED 1" >>confdefs.h +printf "%s\n" "#define SDL_JOYSTICK_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} joystick" fi # Check whether --enable-haptic was given. -if test "${enable_haptic+set}" = set; then : +if test ${enable_haptic+y} +then : enableval=$enable_haptic; -else +else $as_nop enable_haptic=yes fi if test x$enable_haptic != xyes; then -$as_echo "#define SDL_HAPTIC_DISABLED 1" >>confdefs.h +printf "%s\n" "#define SDL_HAPTIC_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} haptic" fi # Check whether --enable-hidapi was given. -if test "${enable_hidapi+set}" = set; then : +if test ${enable_hidapi+y} +then : enableval=$enable_hidapi; -else +else $as_nop enable_hidapi=yes fi if test x$enable_hidapi != xyes; then -$as_echo "#define SDL_HIDAPI_DISABLED 1" >>confdefs.h +printf "%s\n" "#define SDL_HIDAPI_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} hidapi" fi # Check whether --enable-sensor was given. -if test "${enable_sensor+set}" = set; then : +if test ${enable_sensor+y} +then : enableval=$enable_sensor; -else +else $as_nop enable_sensor=yes fi if test x$enable_sensor != xyes; then -$as_echo "#define SDL_SENSOR_DISABLED 1" >>confdefs.h +printf "%s\n" "#define SDL_SENSOR_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} sensor" fi # Check whether --enable-power was given. -if test "${enable_power+set}" = set; then : +if test ${enable_power+y} +then : enableval=$enable_power; -else +else $as_nop enable_power=yes fi if test x$enable_power != xyes; then -$as_echo "#define SDL_POWER_DISABLED 1" >>confdefs.h +printf "%s\n" "#define SDL_POWER_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} power" fi # Check whether --enable-filesystem was given. -if test "${enable_filesystem+set}" = set; then : +if test ${enable_filesystem+y} +then : enableval=$enable_filesystem; -else +else $as_nop enable_filesystem=yes fi if test x$enable_filesystem != xyes; then -$as_echo "#define SDL_FILESYSTEM_DISABLED 1" >>confdefs.h +printf "%s\n" "#define SDL_FILESYSTEM_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} filesystem" fi -# Check whether --enable-threads was given. -if test "${enable_threads+set}" = set; then : - enableval=$enable_threads; -else - enable_threads=yes -fi - +# Many subsystems depend on threads, so leave them enabled by default +#AC_ARG_ENABLE(threads, +#[AS_HELP_STRING([--enable-threads], [Enable the threading subsystem [default=yes]])], +# , enable_threads=yes) +enable_threads=yes if test x$enable_threads != xyes; then -$as_echo "#define SDL_THREADS_DISABLED 1" >>confdefs.h +printf "%s\n" "#define SDL_THREADS_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} threads" fi # Check whether --enable-timers was given. -if test "${enable_timers+set}" = set; then : +if test ${enable_timers+y} +then : enableval=$enable_timers; -else +else $as_nop enable_timers=yes fi if test x$enable_timers != xyes; then -$as_echo "#define SDL_TIMERS_DISABLED 1" >>confdefs.h +printf "%s\n" "#define SDL_TIMERS_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} timers" fi # Check whether --enable-file was given. -if test "${enable_file+set}" = set; then : +if test ${enable_file+y} +then : enableval=$enable_file; -else +else $as_nop enable_file=yes fi if test x$enable_file != xyes; then -$as_echo "#define SDL_FILE_DISABLED 1" >>confdefs.h +printf "%s\n" "#define SDL_FILE_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} file" fi # Check whether --enable-misc was given. -if test "${enable_misc+set}" = set; then : +if test ${enable_misc+y} +then : enableval=$enable_misc; -else +else $as_nop enable_misc=yes fi if test x$enable_misc != xyes; then -$as_echo "#define SDL_MISC_DISABLED 1" >>confdefs.h +printf "%s\n" "#define SDL_MISC_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} misc" fi # Check whether --enable-locale was given. -if test "${enable_locale+set}" = set; then : +if test ${enable_locale+y} +then : enableval=$enable_locale; -else +else $as_nop enable_locale=yes fi if test x$enable_locale != xyes; then -$as_echo "#define SDL_LOCALE_DISABLED 1" >>confdefs.h +printf "%s\n" "#define SDL_LOCALE_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} locale" fi # Check whether --enable-loadso was given. -if test "${enable_loadso+set}" = set; then : +if test ${enable_loadso+y} +then : enableval=$enable_loadso; -else +else $as_nop enable_loadso=yes fi if test x$enable_loadso != xyes; then -$as_echo "#define SDL_LOADSO_DISABLED 1" >>confdefs.h +printf "%s\n" "#define SDL_LOADSO_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} loadso" fi # Check whether --enable-cpuinfo was given. -if test "${enable_cpuinfo+set}" = set; then : +if test ${enable_cpuinfo+y} +then : enableval=$enable_cpuinfo; -else +else $as_nop enable_cpuinfo=yes fi if test x$enable_cpuinfo != xyes; then -$as_echo "#define SDL_CPUINFO_DISABLED 1" >>confdefs.h +printf "%s\n" "#define SDL_CPUINFO_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} cpuinfo" fi # Check whether --enable-assembly was given. -if test "${enable_assembly+set}" = set; then : +if test ${enable_assembly+y} +then : enableval=$enable_assembly; -else +else $as_nop enable_assembly=yes fi if test x$enable_assembly = xyes; then SUMMARY_modules="${SUMMARY_modules} assembly" - -$as_echo "#define SDL_ASSEMBLY_ROUTINES 1" >>confdefs.h - - # Make sure that we don't generate floating point code that would # cause illegal instruction exceptions on older processors case "$host" in @@ -18248,9 +20478,10 @@ ;; esac # Check whether --enable-ssemath was given. -if test "${enable_ssemath+set}" = set; then : +if test ${enable_ssemath+y} +then : enableval=$enable_ssemath; -else +else $as_nop enable_ssemath=$default_ssemath fi @@ -18261,17 +20492,18 @@ fi # Check whether --enable-mmx was given. -if test "${enable_mmx+set}" = set; then : +if test ${enable_mmx+y} +then : enableval=$enable_mmx; -else +else $as_nop enable_mmx=yes fi if test x$enable_mmx = xyes; then save_CFLAGS="$CFLAGS" have_gcc_mmx=no - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -mmmx option" >&5 -$as_echo_n "checking for GCC -mmmx option... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -mmmx option" >&5 +printf %s "checking for GCC -mmmx option... " >&6; } mmx_CFLAGS="-mmmx" CFLAGS="$save_CFLAGS $mmx_CFLAGS" @@ -18293,19 +20525,20 @@ #endif int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_gcc_mmx=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_mmx" >&5 -$as_echo "$have_gcc_mmx" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_mmx" >&5 +printf "%s\n" "$have_gcc_mmx" >&6; } CFLAGS="$save_CFLAGS" if test x$have_gcc_mmx = xyes; then @@ -18315,17 +20548,18 @@ fi # Check whether --enable-3dnow was given. -if test "${enable_3dnow+set}" = set; then : +if test ${enable_3dnow+y} +then : enableval=$enable_3dnow; -else +else $as_nop enable_3dnow=yes fi if test x$enable_3dnow = xyes; then save_CFLAGS="$CFLAGS" have_gcc_3dnow=no - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -m3dnow option" >&5 -$as_echo_n "checking for GCC -m3dnow option... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -m3dnow option" >&5 +printf %s "checking for GCC -m3dnow option... " >&6; } amd3dnow_CFLAGS="-m3dnow" CFLAGS="$save_CFLAGS $amd3dnow_CFLAGS" @@ -18338,7 +20572,7 @@ #endif int -main () +main (void) { void *p = 0; @@ -18348,13 +20582,14 @@ return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : have_gcc_3dnow=yes fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_3dnow" >&5 -$as_echo "$have_gcc_3dnow" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_3dnow" >&5 +printf "%s\n" "$have_gcc_3dnow" >&6; } CFLAGS="$save_CFLAGS" if test x$have_gcc_3dnow = xyes; then @@ -18364,17 +20599,18 @@ fi # Check whether --enable-sse was given. -if test "${enable_sse+set}" = set; then : +if test ${enable_sse+y} +then : enableval=$enable_sse; -else +else $as_nop enable_sse=yes fi if test x$enable_sse = xyes; then save_CFLAGS="$CFLAGS" have_gcc_sse=no - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -msse option" >&5 -$as_echo_n "checking for GCC -msse option... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -msse option" >&5 +printf %s "checking for GCC -msse option... " >&6; } sse_CFLAGS="-msse" CFLAGS="$save_CFLAGS $sse_CFLAGS" @@ -18396,19 +20632,20 @@ #endif int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_gcc_sse=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_sse" >&5 -$as_echo "$have_gcc_sse" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_sse" >&5 +printf "%s\n" "$have_gcc_sse" >&6; } CFLAGS="$save_CFLAGS" if test x$have_gcc_sse = xyes; then @@ -18418,17 +20655,18 @@ fi # Check whether --enable-sse2 was given. -if test "${enable_sse2+set}" = set; then : +if test ${enable_sse2+y} +then : enableval=$enable_sse2; -else +else $as_nop enable_sse2=$default_ssemath fi if test x$enable_sse2 = xyes; then save_CFLAGS="$CFLAGS" have_gcc_sse2=no - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -msse2 option" >&5 -$as_echo_n "checking for GCC -msse2 option... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -msse2 option" >&5 +printf %s "checking for GCC -msse2 option... " >&6; } sse2_CFLAGS="-msse2" CFLAGS="$save_CFLAGS $sse2_CFLAGS" @@ -18450,19 +20688,20 @@ #endif int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_gcc_sse2=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_sse2" >&5 -$as_echo "$have_gcc_sse2" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_sse2" >&5 +printf "%s\n" "$have_gcc_sse2" >&6; } CFLAGS="$save_CFLAGS" if test x$have_gcc_sse2 = xyes; then @@ -18472,17 +20711,18 @@ fi # Check whether --enable-sse3 was given. -if test "${enable_sse3+set}" = set; then : +if test ${enable_sse3+y} +then : enableval=$enable_sse3; -else +else $as_nop enable_sse3=$default_ssemath fi if test x$enable_sse3 = xyes; then save_CFLAGS="$CFLAGS" have_gcc_sse3=no - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -msse3 option" >&5 -$as_echo_n "checking for GCC -msse3 option... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -msse3 option" >&5 +printf %s "checking for GCC -msse3 option... " >&6; } sse3_CFLAGS="-msse3" CFLAGS="$save_CFLAGS $sse3_CFLAGS" @@ -18504,19 +20744,20 @@ #endif int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_gcc_sse3=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_sse3" >&5 -$as_echo "$have_gcc_sse3" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_sse3" >&5 +printf "%s\n" "$have_gcc_sse3" >&6; } CFLAGS="$save_CFLAGS" if test x$have_gcc_sse3 = xyes; then @@ -18525,37 +20766,39 @@ fi fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for immintrin.h" >&5 -$as_echo_n "checking for immintrin.h... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for immintrin.h" >&5 +printf %s "checking for immintrin.h... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_immintrin_h_hdr=yes -else +else $as_nop have_immintrin_h_hdr=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_immintrin_h_hdr" >&5 -$as_echo "$have_immintrin_h_hdr" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_immintrin_h_hdr" >&5 +printf "%s\n" "$have_immintrin_h_hdr" >&6; } if test x$have_immintrin_h_hdr = xyes; then -$as_echo "#define HAVE_IMMINTRIN_H 1" >>confdefs.h +printf "%s\n" "#define HAVE_IMMINTRIN_H 1" >>confdefs.h fi # Check whether --enable-altivec was given. -if test "${enable_altivec+set}" = set; then : +if test ${enable_altivec+y} +then : enableval=$enable_altivec; -else +else $as_nop enable_altivec=yes fi @@ -18566,8 +20809,8 @@ altivec_CFLAGS="-maltivec" CFLAGS="$save_CFLAGS $altivec_CFLAGS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Altivec with GCC altivec.h and -maltivec option" >&5 -$as_echo_n "checking for Altivec with GCC altivec.h and -maltivec option... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Altivec with GCC altivec.h and -maltivec option" >&5 +printf %s "checking for Altivec with GCC altivec.h and -maltivec option... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -18577,26 +20820,27 @@ } int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_gcc_altivec=yes have_altivec_h_hdr=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_altivec" >&5 -$as_echo "$have_gcc_altivec" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_altivec" >&5 +printf "%s\n" "$have_gcc_altivec" >&6; } if test x$have_gcc_altivec = xno; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Altivec with GCC -maltivec option" >&5 -$as_echo_n "checking for Altivec with GCC -maltivec option... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Altivec with GCC -maltivec option" >&5 +printf %s "checking for Altivec with GCC -maltivec option... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -18605,24 +20849,25 @@ } int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_gcc_altivec=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_altivec" >&5 -$as_echo "$have_gcc_altivec" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_altivec" >&5 +printf "%s\n" "$have_gcc_altivec" >&6; } fi if test x$have_gcc_altivec = xno; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Altivec with GCC altivec.h and -faltivec option" >&5 -$as_echo_n "checking for Altivec with GCC altivec.h and -faltivec option... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Altivec with GCC altivec.h and -faltivec option" >&5 +printf %s "checking for Altivec with GCC altivec.h and -faltivec option... " >&6; } altivec_CFLAGS="-faltivec" CFLAGS="$save_CFLAGS $altivec_CFLAGS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -18634,27 +20879,28 @@ } int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_gcc_altivec=yes have_altivec_h_hdr=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_altivec" >&5 -$as_echo "$have_gcc_altivec" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_altivec" >&5 +printf "%s\n" "$have_gcc_altivec" >&6; } fi if test x$have_gcc_altivec = xno; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Altivec with GCC -faltivec option" >&5 -$as_echo_n "checking for Altivec with GCC -faltivec option... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Altivec with GCC -faltivec option" >&5 +printf %s "checking for Altivec with GCC -faltivec option... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -18663,43 +20909,193 @@ } int -main () +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + have_gcc_altivec=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_altivec" >&5 +printf "%s\n" "$have_gcc_altivec" >&6; } + fi + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_altivec = xyes; then + +printf "%s\n" "#define SDL_ALTIVEC_BLITTERS 1" >>confdefs.h + + if test x$have_altivec_h_hdr = xyes; then + +printf "%s\n" "#define HAVE_ALTIVEC_H 1" >>confdefs.h + + fi + EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS" + SUMMARY_math="${SUMMARY_math} altivec" + fi + fi +fi + + # Check whether --enable-lsx was given. +if test ${enable_lsx+y} +then : + enableval=$enable_lsx; +else $as_nop + enable_lsx=yes +fi + + if test x$enable_lsx = xyes; then + save_CFLAGS="$CFLAGS" + have_gcc_lsx=no + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -mlsx option" >&5 +printf %s "checking for GCC -mlsx option... " >&6; } + lsx_CFLAGS="-mlsx" + CFLAGS="$save_CFLAGS $lsx_CFLAGS" + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #ifndef __loongarch_sx + #error Assembler CPP flag not enabled + #endif + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + have_gcc_lsx=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_lsx" >&5 +printf "%s\n" "$have_gcc_lsx" >&6; } + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_lsx = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS $lsx_CFLAGS" + SUMMARY_math="${SUMMARY_math} lsx" + fi + fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for lsxintrin.h" >&5 +printf %s "checking for lsxintrin.h... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + have_lsxintrin_h_hdr=yes +else $as_nop + have_lsxintrin_h_hdr=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_lsxintrin_h_hdr" >&5 +printf "%s\n" "$have_lsxintrin_h_hdr" >&6; } + if test x$have_lsxintrin_h_hdr = xyes; then + +printf "%s\n" "#define HAVE_LSXINTRIN_H 1" >>confdefs.h + + fi + + # Check whether --enable-lasx was given. +if test ${enable_lasx+y} +then : + enableval=$enable_lasx; +else $as_nop + enable_LASX=yes +fi + + if test x$enable_LASX = xyes; then + save_CFLAGS="$CFLAGS" + have_gcc_lasx=no + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -mlasx option" >&5 +printf %s "checking for GCC -mlasx option... " >&6; } + lasx_CFLAGS="-mlasx" + CFLAGS="$save_CFLAGS $lasx_CFLAGS" + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #ifndef __loongarch_asx + #error Assembler CPP flag not enabled + #endif + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + have_gcc_lasx=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_lasx" >&5 +printf "%s\n" "$have_gcc_lasx" >&6; } + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_lasx = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS $lasx_CFLAGS" + SUMMARY_math="${SUMMARY_math} lasx" + fi + fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for lasxintrin.h" >&5 +printf %s "checking for lasxintrin.h... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - have_gcc_altivec=yes +if ac_fn_c_try_compile "$LINENO" +then : + have_lasxintrin_h_hdr=yes +else $as_nop + have_lasxintrin_h_hdr=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_altivec" >&5 -$as_echo "$have_gcc_altivec" >&6; } - fi - CFLAGS="$save_CFLAGS" - - if test x$have_gcc_altivec = xyes; then - -$as_echo "#define SDL_ALTIVEC_BLITTERS 1" >>confdefs.h - - if test x$have_altivec_h_hdr = xyes; then +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_lasxintrin_h_hdr" >&5 +printf "%s\n" "$have_lasxintrin_h_hdr" >&6; } + if test x$have_lasxintrin_h_hdr = xyes; then -$as_echo "#define HAVE_ALTIVEC_H 1" >>confdefs.h +printf "%s\n" "#define HAVE_LASXINTRIN_H 1" >>confdefs.h - fi - EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS" - SUMMARY_math="${SUMMARY_math} altivec" - fi fi -fi CheckOSS() { # Check whether --enable-oss was given. -if test "${enable_oss+set}" = set; then : +if test ${enable_oss+y} +then : enableval=$enable_oss; -else +else $as_nop enable_oss=maybe fi @@ -18716,8 +21112,8 @@ fi if test x$enable_audio = xyes -a x$enable_oss = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OSS audio support" >&5 -$as_echo_n "checking for OSS audio support... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OSS audio support" >&5 +printf %s "checking for OSS audio support... " >&6; } have_oss=no if test x$have_oss != xyes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -18726,7 +21122,7 @@ #include int -main () +main (void) { int arg = SNDCTL_DSP_SETFRAGMENT; @@ -18735,10 +21131,11 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_oss=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test x$have_oss != xyes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -18747,7 +21144,7 @@ #include int -main () +main (void) { int arg = SNDCTL_DSP_SETFRAGMENT; @@ -18756,22 +21153,23 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_oss=yes -$as_echo "#define SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H 1" >>confdefs.h +printf "%s\n" "#define SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H 1" >>confdefs.h fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_oss" >&5 -$as_echo "$have_oss" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_oss" >&5 +printf "%s\n" "$have_oss" >&6; } if test x$have_oss = xyes; then SUMMARY_audio="${SUMMARY_audio} oss" -$as_echo "#define SDL_AUDIO_DRIVER_OSS 1" >>confdefs.h +printf "%s\n" "#define SDL_AUDIO_DRIVER_OSS 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/dsp/*.c" have_audio=yes @@ -18788,9 +21186,10 @@ CheckALSA() { # Check whether --enable-alsa was given. -if test "${enable_alsa+set}" = set; then : +if test ${enable_alsa+y} +then : enableval=$enable_alsa; -else +else $as_nop enable_alsa=yes fi @@ -18802,41 +21201,44 @@ # Check whether --with-alsa-prefix was given. -if test "${with_alsa_prefix+set}" = set; then : +if test ${with_alsa_prefix+y} +then : withval=$with_alsa_prefix; alsa_prefix="$withval" -else +else $as_nop alsa_prefix="" fi # Check whether --with-alsa-inc-prefix was given. -if test "${with_alsa_inc_prefix+set}" = set; then : +if test ${with_alsa_inc_prefix+y} +then : withval=$with_alsa_inc_prefix; alsa_inc_prefix="$withval" -else +else $as_nop alsa_inc_prefix="" fi # Check whether --enable-alsatest was given. -if test "${enable_alsatest+set}" = set; then : +if test ${enable_alsatest+y} +then : enableval=$enable_alsatest; enable_alsatest="$enableval" -else +else $as_nop enable_alsatest=yes fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ALSA CFLAGS" >&5 -$as_echo_n "checking for ALSA CFLAGS... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ALSA CFLAGS" >&5 +printf %s "checking for ALSA CFLAGS... " >&6; } if test "$alsa_inc_prefix" != "" ; then ALSA_CFLAGS="$ALSA_CFLAGS -I$alsa_inc_prefix" CFLAGS="$CFLAGS -I$alsa_inc_prefix" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ALSA_CFLAGS" >&5 -$as_echo "$ALSA_CFLAGS" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ALSA_CFLAGS" >&5 +printf "%s\n" "$ALSA_CFLAGS" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ALSA LDFLAGS" >&5 -$as_echo_n "checking for ALSA LDFLAGS... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ALSA LDFLAGS" >&5 +printf %s "checking for ALSA LDFLAGS... " >&6; } if test "$alsa_prefix" != "" ; then ALSA_LIBS="$ALSA_LIBS -L$alsa_prefix" LDFLAGS="$LDFLAGS $ALSA_LIBS" @@ -18848,12 +21250,12 @@ LIBS=`echo $LIBS | sed 's/-lpthread//'` LIBS=`echo $LIBS | sed 's/ //'` LIBS="$ALSA_LIBS $LIBS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ALSA_LIBS" >&5 -$as_echo "$ALSA_LIBS" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ALSA_LIBS" >&5 +printf "%s\n" "$ALSA_LIBS" >&6; } min_alsa_version=1.0.11 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libasound headers version >= $min_alsa_version" >&5 -$as_echo_n "checking for libasound headers version >= $min_alsa_version... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libasound headers version >= $min_alsa_version" >&5 +printf %s "checking for libasound headers version >= $min_alsa_version... " >&6; } no_alsa="" alsa_min_major_version=`echo $min_alsa_version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` @@ -18874,7 +21276,7 @@ #include int -main () +main (void) { /* ensure backward compatibility */ @@ -18913,17 +21315,18 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found." >&5 -$as_echo "found." >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not present." >&5 -$as_echo "not present." >&6; } +if ac_fn_c_try_compile "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found." >&5 +printf "%s\n" "found." >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not present." >&5 +printf "%s\n" "not present." >&6; } alsa_found=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -18932,11 +21335,12 @@ if test "x$enable_alsatest" = "xyes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for snd_ctl_open in -lasound" >&5 -$as_echo_n "checking for snd_ctl_open in -lasound... " >&6; } -if ${ac_cv_lib_asound_snd_ctl_open+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for snd_ctl_open in -lasound" >&5 +printf %s "checking for snd_ctl_open in -lasound... " >&6; } +if test ${ac_cv_lib_asound_snd_ctl_open+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lasound $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -18945,37 +21349,34 @@ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char snd_ctl_open (); int -main () +main (void) { return snd_ctl_open (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_asound_snd_ctl_open=yes -else +else $as_nop ac_cv_lib_asound_snd_ctl_open=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_asound_snd_ctl_open" >&5 -$as_echo "$ac_cv_lib_asound_snd_ctl_open" >&6; } -if test "x$ac_cv_lib_asound_snd_ctl_open" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBASOUND 1 -_ACEOF +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_asound_snd_ctl_open" >&5 +printf "%s\n" "$ac_cv_lib_asound_snd_ctl_open" >&6; } +if test "x$ac_cv_lib_asound_snd_ctl_open" = xyes +then : + printf "%s\n" "#define HAVE_LIBASOUND 1" >>confdefs.h LIBS="-lasound $LIBS" -else +else $as_nop alsa_found=no @@ -19007,31 +21408,30 @@ LIBS="$alsa_save_LIBS" if test x$have_alsa = xyes; then # Check whether --enable-alsa-shared was given. -if test "${enable_alsa_shared+set}" = set; then : +if test ${enable_alsa_shared+y} +then : enableval=$enable_alsa_shared; -else +else $as_nop enable_alsa_shared=yes fi alsa_lib=`find_lib "libasound.so.*" "$ALSA_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` -$as_echo "#define SDL_AUDIO_DRIVER_ALSA 1" >>confdefs.h +printf "%s\n" "#define SDL_AUDIO_DRIVER_ALSA 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/alsa/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $ALSA_CFLAGS" if test x$have_loadso != xyes && \ test x$enable_alsa_shared = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic ALSA loading" >&5 -$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic ALSA loading" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic ALSA loading" >&5 +printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic ALSA loading" >&2;} fi if test x$have_loadso = xyes && \ test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then echo "-- dynamic libasound -> $alsa_lib" -cat >>confdefs.h <<_ACEOF -#define SDL_AUDIO_DRIVER_ALSA_DYNAMIC "$alsa_lib" -_ACEOF +printf "%s\n" "#define SDL_AUDIO_DRIVER_ALSA_DYNAMIC \"$alsa_lib\"" >>confdefs.h SUMMARY_audio="${SUMMARY_audio} alsa(dynamic)" else @@ -19046,26 +21446,27 @@ CheckJACK() { # Check whether --enable-jack was given. -if test "${enable_jack+set}" = set; then : +if test ${enable_jack+y} +then : enableval=$enable_jack; -else +else $as_nop enable_jack=yes fi if test x$enable_audio = xyes -a x$enable_jack = xyes; then pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for jack >= 0.125" >&5 -$as_echo_n "checking for jack >= 0.125... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for jack >= 0.125" >&5 +printf %s "checking for jack >= 0.125... " >&6; } if test -n "$JACK_CFLAGS"; then pkg_cv_JACK_CFLAGS="$JACK_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"jack >= 0.125\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"jack >= 0.125\""; } >&5 ($PKG_CONFIG --exists --print-errors "jack >= 0.125") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_JACK_CFLAGS=`$PKG_CONFIG --cflags "jack >= 0.125" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -19079,10 +21480,10 @@ pkg_cv_JACK_LIBS="$JACK_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"jack >= 0.125\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"jack >= 0.125\""; } >&5 ($PKG_CONFIG --exists --print-errors "jack >= 0.125") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_JACK_LIBS=`$PKG_CONFIG --libs "jack >= 0.125" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -19096,8 +21497,8 @@ if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -19114,44 +21515,43 @@ audio_jack=no elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } audio_jack=no else JACK_CFLAGS=$pkg_cv_JACK_CFLAGS JACK_LIBS=$pkg_cv_JACK_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } audio_jack=yes fi if test x$audio_jack = xyes; then # Check whether --enable-jack-shared was given. -if test "${enable_jack_shared+set}" = set; then : +if test ${enable_jack_shared+y} +then : enableval=$enable_jack_shared; -else +else $as_nop enable_jack_shared=yes fi jack_lib=`find_lib "libjack.so.*" "$JACK_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` -$as_echo "#define SDL_AUDIO_DRIVER_JACK 1" >>confdefs.h +printf "%s\n" "#define SDL_AUDIO_DRIVER_JACK 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/jack/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $JACK_CFLAGS" if test x$have_loadso != xyes && \ test x$enable_jack_shared = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic JACK audio loading" >&5 -$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic JACK audio loading" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic JACK audio loading" >&5 +printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic JACK audio loading" >&2;} fi if test x$have_loadso = xyes && \ test x$enable_jack_shared = xyes && test x$jack_lib != x; then echo "-- dynamic libjack -> $jack_lib" -cat >>confdefs.h <<_ACEOF -#define SDL_AUDIO_DRIVER_JACK_DYNAMIC "$jack_lib" -_ACEOF +printf "%s\n" "#define SDL_AUDIO_DRIVER_JACK_DYNAMIC \"$jack_lib\"" >>confdefs.h SUMMARY_audio="${SUMMARY_audio} jack(dynamic)" @@ -19174,33 +21574,37 @@ CheckESD() { # Check whether --enable-esd was given. -if test "${enable_esd+set}" = set; then : +if test ${enable_esd+y} +then : enableval=$enable_esd; -else +else $as_nop enable_esd=yes fi if test x$enable_audio = xyes -a x$enable_esd = xyes; then # Check whether --with-esd-prefix was given. -if test "${with_esd_prefix+set}" = set; then : +if test ${with_esd_prefix+y} +then : withval=$with_esd_prefix; esd_prefix="$withval" -else +else $as_nop esd_prefix="" fi # Check whether --with-esd-exec-prefix was given. -if test "${with_esd_exec_prefix+set}" = set; then : +if test ${with_esd_exec_prefix+y} +then : withval=$with_esd_exec_prefix; esd_exec_prefix="$withval" -else +else $as_nop esd_exec_prefix="" fi # Check whether --enable-esdtest was given. -if test "${enable_esdtest+set}" = set; then : +if test ${enable_esdtest+y} +then : enableval=$enable_esdtest; -else +else $as_nop enable_esdtest=yes fi @@ -19220,11 +21624,12 @@ # Extract the first word of "esd-config", so it can be a program name with args. set dummy esd-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ESD_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_ESD_CONFIG+y} +then : + printf %s "(cached) " >&6 +else $as_nop case $ESD_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ESD_CONFIG="$ESD_CONFIG" # Let the user override the test with a path. @@ -19234,11 +21639,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ESD_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_ESD_CONFIG="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -19251,17 +21660,17 @@ fi ESD_CONFIG=$ac_cv_path_ESD_CONFIG if test -n "$ESD_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ESD_CONFIG" >&5 -$as_echo "$ESD_CONFIG" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ESD_CONFIG" >&5 +printf "%s\n" "$ESD_CONFIG" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi min_esd_version=0.2.8 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ESD - version >= $min_esd_version" >&5 -$as_echo_n "checking for ESD - version >= $min_esd_version... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ESD - version >= $min_esd_version" >&5 +printf %s "checking for ESD - version >= $min_esd_version... " >&6; } no_esd="" if test "$ESD_CONFIG" = "no" ; then no_esd=yes @@ -19287,9 +21696,10 @@ CFLAGS="$CFLAGS $ESD_CFLAGS" LIBS="$LIBS $ESD_LIBS" rm -f conf.esdtest - if test "$cross_compiling" = yes; then : + if test "$cross_compiling" = yes +then : echo $ac_n "cross compiling; assumed OK... $ac_c" -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -19328,9 +21738,10 @@ } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : -else +else $as_nop no_esd=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -19348,12 +21759,12 @@ fi fi if test "x$no_esd" = x ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } have_esd=yes else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } if test "$ESD_CONFIG" = "no" ; then echo "*** The esd-config script installed by ESD could not be found" echo "*** If ESD was installed in PREFIX, make sure PREFIX/bin is in" @@ -19379,14 +21790,15 @@ #include int -main () +main (void) { return 0; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding ESD or finding the wrong" echo "*** version of ESD. If it is not finding ESD, you'll need to set your" @@ -19396,13 +21808,13 @@ echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" -else +else $as_nop echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means ESD was incorrectly installed" echo "*** or that you have moved ESD since it was installed. In the latter case, you" echo "*** may want to edit the esd-config script: $ESD_CONFIG" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" @@ -19424,31 +21836,30 @@ if test x$have_esd = xyes; then # Check whether --enable-esd-shared was given. -if test "${enable_esd_shared+set}" = set; then : +if test ${enable_esd_shared+y} +then : enableval=$enable_esd_shared; -else +else $as_nop enable_esd_shared=yes fi esd_lib=`find_lib "libesd.so.*" "$ESD_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` -$as_echo "#define SDL_AUDIO_DRIVER_ESD 1" >>confdefs.h +printf "%s\n" "#define SDL_AUDIO_DRIVER_ESD 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/esd/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $ESD_CFLAGS" if test x$have_loadso != xyes && \ test x$enable_esd_shared = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic ESD loading" >&5 -$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic ESD loading" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic ESD loading" >&5 +printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic ESD loading" >&2;} fi if test x$have_loadso = xyes && \ test x$enable_esd_shared = xyes && test x$esd_lib != x; then echo "-- dynamic libesd -> $esd_lib" -cat >>confdefs.h <<_ACEOF -#define SDL_AUDIO_DRIVER_ESD_DYNAMIC "$esd_lib" -_ACEOF +printf "%s\n" "#define SDL_AUDIO_DRIVER_ESD_DYNAMIC \"$esd_lib\"" >>confdefs.h SUMMARY_audio="${SUMMARY_audio} esd(dynamic)" else @@ -19463,26 +21874,27 @@ CheckPipewire() { # Check whether --enable-pipewire was given. -if test "${enable_pipewire+set}" = set; then : +if test ${enable_pipewire+y} +then : enableval=$enable_pipewire; -else +else $as_nop enable_pipewire=yes fi if test x$enable_audio = xyes -a x$enable_pipewire = xyes; then pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libpipewire-0.3 >= 0.3.20" >&5 -$as_echo_n "checking for libpipewire-0.3 >= 0.3.20... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libpipewire-0.3 >= 0.3.20" >&5 +printf %s "checking for libpipewire-0.3 >= 0.3.20... " >&6; } if test -n "$PIPEWIRE_CFLAGS"; then pkg_cv_PIPEWIRE_CFLAGS="$PIPEWIRE_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpipewire-0.3 >= 0.3.20\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpipewire-0.3 >= 0.3.20\""; } >&5 ($PKG_CONFIG --exists --print-errors "libpipewire-0.3 >= 0.3.20") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_PIPEWIRE_CFLAGS=`$PKG_CONFIG --cflags "libpipewire-0.3 >= 0.3.20" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -19496,10 +21908,10 @@ pkg_cv_PIPEWIRE_LIBS="$PIPEWIRE_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpipewire-0.3 >= 0.3.20\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpipewire-0.3 >= 0.3.20\""; } >&5 ($PKG_CONFIG --exists --print-errors "libpipewire-0.3 >= 0.3.20") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_PIPEWIRE_LIBS=`$PKG_CONFIG --libs "libpipewire-0.3 >= 0.3.20" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -19513,8 +21925,8 @@ if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -19531,44 +21943,43 @@ audio_pipewire=no elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } audio_pipewire=no else PIPEWIRE_CFLAGS=$pkg_cv_PIPEWIRE_CFLAGS PIPEWIRE_LIBS=$pkg_cv_PIPEWIRE_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } audio_pipewire=yes fi if test x$audio_pipewire = xyes; then # Check whether --enable-pipewire-shared was given. -if test "${enable_pipewire_shared+set}" = set; then : +if test ${enable_pipewire_shared+y} +then : enableval=$enable_pipewire_shared; -else +else $as_nop enable_pipewire_shared=yes fi pipewire_lib=`find_lib "libpipewire-0.3.so.*" "$PIPEWIRE_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` -$as_echo "#define SDL_AUDIO_DRIVER_PIPEWIRE 1" >>confdefs.h +printf "%s\n" "#define SDL_AUDIO_DRIVER_PIPEWIRE 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/pipewire/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $PIPEWIRE_CFLAGS" if test x$have_loadso != xyes && \ test x$enable_pipewire_shared = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic Pipewire loading" >&5 -$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic Pipewire loading" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic Pipewire loading" >&5 +printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic Pipewire loading" >&2;} fi if test x$have_loadso = xyes && \ test x$enable_pipewire_shared = xyes && test x$pipewire_lib != x; then echo "-- dynamic libpipewire-0.3 -> $pipewire_lib" -cat >>confdefs.h <<_ACEOF -#define SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC "$pipewire_lib" -_ACEOF +printf "%s\n" "#define SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC \"$pipewire_lib\"" >>confdefs.h SUMMARY_audio="${SUMMARY_audio} pipewire(dynamic)" else @@ -19583,26 +21994,27 @@ CheckPulseAudio() { # Check whether --enable-pulseaudio was given. -if test "${enable_pulseaudio+set}" = set; then : +if test ${enable_pulseaudio+y} +then : enableval=$enable_pulseaudio; -else +else $as_nop enable_pulseaudio=yes fi if test x$enable_audio = xyes -a x$enable_pulseaudio = xyes; then pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libpulse-simple >= 0.9" >&5 -$as_echo_n "checking for libpulse-simple >= 0.9... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libpulse-simple >= 0.9" >&5 +printf %s "checking for libpulse-simple >= 0.9... " >&6; } if test -n "$PULSEAUDIO_CFLAGS"; then pkg_cv_PULSEAUDIO_CFLAGS="$PULSEAUDIO_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpulse-simple >= 0.9\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpulse-simple >= 0.9\""; } >&5 ($PKG_CONFIG --exists --print-errors "libpulse-simple >= 0.9") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags "libpulse-simple >= 0.9" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -19616,10 +22028,10 @@ pkg_cv_PULSEAUDIO_LIBS="$PULSEAUDIO_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpulse-simple >= 0.9\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpulse-simple >= 0.9\""; } >&5 ($PKG_CONFIG --exists --print-errors "libpulse-simple >= 0.9") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_PULSEAUDIO_LIBS=`$PKG_CONFIG --libs "libpulse-simple >= 0.9" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -19633,8 +22045,8 @@ if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -19651,44 +22063,43 @@ audio_pulseaudio=no elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } audio_pulseaudio=no else PULSEAUDIO_CFLAGS=$pkg_cv_PULSEAUDIO_CFLAGS PULSEAUDIO_LIBS=$pkg_cv_PULSEAUDIO_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } audio_pulseaudio=yes fi if test x$audio_pulseaudio = xyes; then # Check whether --enable-pulseaudio-shared was given. -if test "${enable_pulseaudio_shared+set}" = set; then : +if test ${enable_pulseaudio_shared+y} +then : enableval=$enable_pulseaudio_shared; -else +else $as_nop enable_pulseaudio_shared=yes fi pulseaudio_lib=`find_lib "libpulse-simple.so.*" "$PULSEAUDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` -$as_echo "#define SDL_AUDIO_DRIVER_PULSEAUDIO 1" >>confdefs.h +printf "%s\n" "#define SDL_AUDIO_DRIVER_PULSEAUDIO 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/pulseaudio/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $PULSEAUDIO_CFLAGS" if test x$have_loadso != xyes && \ test x$enable_pulseaudio_shared = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic PulseAudio loading" >&5 -$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic PulseAudio loading" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic PulseAudio loading" >&5 +printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic PulseAudio loading" >&2;} fi if test x$have_loadso = xyes && \ test x$enable_pulseaudio_shared = xyes && test x$pulseaudio_lib != x; then echo "-- dynamic libpulse-simple -> $pulseaudio_lib" -cat >>confdefs.h <<_ACEOF -#define SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC "$pulseaudio_lib" -_ACEOF +printf "%s\n" "#define SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC \"$pulseaudio_lib\"" >>confdefs.h SUMMARY_audio="${SUMMARY_audio} pulse(dynamic)" @@ -19711,20 +22122,22 @@ CheckARTSC() { # Check whether --enable-arts was given. -if test "${enable_arts+set}" = set; then : +if test ${enable_arts+y} +then : enableval=$enable_arts; -else +else $as_nop enable_arts=yes fi if test x$enable_audio = xyes -a x$enable_arts = xyes; then # Extract the first word of "artsc-config", so it can be a program name with args. set dummy artsc-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ARTSCONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_ARTSCONFIG+y} +then : + printf %s "(cached) " >&6 +else $as_nop case $ARTSCONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ARTSCONFIG="$ARTSCONFIG" # Let the user override the test with a path. @@ -19734,11 +22147,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ARTSCONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_ARTSCONFIG="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -19750,11 +22167,11 @@ fi ARTSCONFIG=$ac_cv_path_ARTSCONFIG if test -n "$ARTSCONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ARTSCONFIG" >&5 -$as_echo "$ARTSCONFIG" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ARTSCONFIG" >&5 +printf "%s\n" "$ARTSCONFIG" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -19763,8 +22180,8 @@ else ARTS_CFLAGS=`$ARTSCONFIG --cflags` ARTS_LIBS=`$ARTSCONFIG --libs` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for aRts development environment" >&5 -$as_echo_n "checking for aRts development environment... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for aRts development environment" >&5 +printf %s "checking for aRts development environment... " >&6; } audio_arts=no save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $ARTS_CFLAGS" @@ -19774,7 +22191,7 @@ #include int -main () +main (void) { arts_stream_t stream; @@ -19783,40 +22200,40 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : audio_arts=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS="$save_CFLAGS" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $audio_arts" >&5 -$as_echo "$audio_arts" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $audio_arts" >&5 +printf "%s\n" "$audio_arts" >&6; } if test x$audio_arts = xyes; then # Check whether --enable-arts-shared was given. -if test "${enable_arts_shared+set}" = set; then : +if test ${enable_arts_shared+y} +then : enableval=$enable_arts_shared; -else +else $as_nop enable_arts_shared=yes fi arts_lib=`find_lib "libartsc.so.*" "$ARTS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` -$as_echo "#define SDL_AUDIO_DRIVER_ARTS 1" >>confdefs.h +printf "%s\n" "#define SDL_AUDIO_DRIVER_ARTS 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/arts/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $ARTS_CFLAGS" if test x$have_loadso != xyes && \ test x$enable_arts_shared = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic ARTS loading" >&5 -$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic ARTS loading" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic ARTS loading" >&5 +printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic ARTS loading" >&2;} fi if test x$have_loadso = xyes && \ test x$enable_arts_shared = xyes && test x$arts_lib != x; then echo "-- dynamic libartsc -> $arts_lib" -cat >>confdefs.h <<_ACEOF -#define SDL_AUDIO_DRIVER_ARTS_DYNAMIC "$arts_lib" -_ACEOF +printf "%s\n" "#define SDL_AUDIO_DRIVER_ARTS_DYNAMIC \"$arts_lib\"" >>confdefs.h SUMMARY_audio="${SUMMARY_audio} arts(dynamic)" else @@ -19832,24 +22249,26 @@ CheckNAS() { # Check whether --enable-nas was given. -if test "${enable_nas+set}" = set; then : +if test ${enable_nas+y} +then : enableval=$enable_nas; -else +else $as_nop enable_nas=yes fi if test x$enable_audio = xyes -a x$enable_nas = xyes; then - ac_fn_c_check_header_mongrel "$LINENO" "audio/audiolib.h" "ac_cv_header_audio_audiolib_h" "$ac_includes_default" -if test "x$ac_cv_header_audio_audiolib_h" = xyes; then : + ac_fn_c_check_header_compile "$LINENO" "audio/audiolib.h" "ac_cv_header_audio_audiolib_h" "$ac_includes_default" +if test "x$ac_cv_header_audio_audiolib_h" = xyes +then : have_nas_hdr=yes fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for AuOpenServer in -laudio" >&5 -$as_echo_n "checking for AuOpenServer in -laudio... " >&6; } -if ${ac_cv_lib_audio_AuOpenServer+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for AuOpenServer in -laudio" >&5 +printf %s "checking for AuOpenServer in -laudio... " >&6; } +if test ${ac_cv_lib_audio_AuOpenServer+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-laudio $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -19858,36 +22277,35 @@ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char AuOpenServer (); int -main () +main (void) { return AuOpenServer (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_audio_AuOpenServer=yes -else +else $as_nop ac_cv_lib_audio_AuOpenServer=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_audio_AuOpenServer" >&5 -$as_echo "$ac_cv_lib_audio_AuOpenServer" >&6; } -if test "x$ac_cv_lib_audio_AuOpenServer" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_audio_AuOpenServer" >&5 +printf "%s\n" "$ac_cv_lib_audio_AuOpenServer" >&6; } +if test "x$ac_cv_lib_audio_AuOpenServer" = xyes +then : have_nas_lib=yes fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for NAS audio support" >&5 -$as_echo_n "checking for NAS audio support... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for NAS audio support" >&5 +printf %s "checking for NAS audio support... " >&6; } have_nas=no if test x$have_nas_hdr = xyes -a x$have_nas_lib = xyes; then @@ -19901,14 +22319,15 @@ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_nas" >&5 -$as_echo "$have_nas" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_nas" >&5 +printf "%s\n" "$have_nas" >&6; } if test x$have_nas = xyes; then # Check whether --enable-nas-shared was given. -if test "${enable_nas_shared+set}" = set; then : +if test ${enable_nas_shared+y} +then : enableval=$enable_nas_shared; -else +else $as_nop enable_nas_shared=yes fi @@ -19916,16 +22335,14 @@ if test x$have_loadso != xyes && \ test x$enable_nas_shared = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic NAS loading" >&5 -$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic NAS loading" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic NAS loading" >&5 +printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic NAS loading" >&2;} fi if test x$have_loadso = xyes && \ test x$enable_nas_shared = xyes && test x$nas_lib != x; then echo "-- dynamic libaudio -> $nas_lib" -cat >>confdefs.h <<_ACEOF -#define SDL_AUDIO_DRIVER_NAS_DYNAMIC "$nas_lib" -_ACEOF +printf "%s\n" "#define SDL_AUDIO_DRIVER_NAS_DYNAMIC \"$nas_lib\"" >>confdefs.h SUMMARY_audio="${SUMMARY_audio} nas(dynamic)" else @@ -19934,7 +22351,7 @@ fi -$as_echo "#define SDL_AUDIO_DRIVER_NAS 1" >>confdefs.h +printf "%s\n" "#define SDL_AUDIO_DRIVER_NAS 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/nas/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS" @@ -19946,24 +22363,26 @@ CheckSNDIO() { # Check whether --enable-sndio was given. -if test "${enable_sndio+set}" = set; then : +if test ${enable_sndio+y} +then : enableval=$enable_sndio; -else +else $as_nop enable_sndio=yes fi if test x$enable_audio = xyes -a x$enable_sndio = xyes; then - ac_fn_c_check_header_mongrel "$LINENO" "sndio.h" "ac_cv_header_sndio_h" "$ac_includes_default" -if test "x$ac_cv_header_sndio_h" = xyes; then : + ac_fn_c_check_header_compile "$LINENO" "sndio.h" "ac_cv_header_sndio_h" "$ac_includes_default" +if test "x$ac_cv_header_sndio_h" = xyes +then : have_sndio_hdr=yes fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sio_open in -lsndio" >&5 -$as_echo_n "checking for sio_open in -lsndio... " >&6; } -if ${ac_cv_lib_sndio_sio_open+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sio_open in -lsndio" >&5 +printf %s "checking for sio_open in -lsndio... " >&6; } +if test ${ac_cv_lib_sndio_sio_open+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lsndio $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -19972,36 +22391,35 @@ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char sio_open (); int -main () +main (void) { return sio_open (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_sndio_sio_open=yes -else +else $as_nop ac_cv_lib_sndio_sio_open=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sndio_sio_open" >&5 -$as_echo "$ac_cv_lib_sndio_sio_open" >&6; } -if test "x$ac_cv_lib_sndio_sio_open" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sndio_sio_open" >&5 +printf "%s\n" "$ac_cv_lib_sndio_sio_open" >&6; } +if test "x$ac_cv_lib_sndio_sio_open" = xyes +then : have_sndio_lib=yes fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sndio audio support" >&5 -$as_echo_n "checking for sndio audio support... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sndio audio support" >&5 +printf %s "checking for sndio audio support... " >&6; } have_sndio=no if test x$have_sndio_hdr = xyes -a x$have_sndio_lib = xyes; then @@ -20009,14 +22427,15 @@ SNDIO_LIBS="-lsndio" fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_sndio" >&5 -$as_echo "$have_sndio" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_sndio" >&5 +printf "%s\n" "$have_sndio" >&6; } if test x$have_sndio = xyes; then # Check whether --enable-sndio-shared was given. -if test "${enable_sndio_shared+set}" = set; then : +if test ${enable_sndio_shared+y} +then : enableval=$enable_sndio_shared; -else +else $as_nop enable_sndio_shared=yes fi @@ -20024,16 +22443,14 @@ if test x$have_loadso != xyes && \ test x$enable_sndio_shared = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic sndio loading" >&5 -$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic sndio loading" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic sndio loading" >&5 +printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic sndio loading" >&2;} fi if test x$have_loadso = xyes && \ test x$enable_sndio_shared = xyes && test x$sndio_lib != x; then echo "-- dynamic libsndio -> $sndio_lib" -cat >>confdefs.h <<_ACEOF -#define SDL_AUDIO_DRIVER_SNDIO_DYNAMIC "$sndio_lib" -_ACEOF +printf "%s\n" "#define SDL_AUDIO_DRIVER_SNDIO_DYNAMIC \"$sndio_lib\"" >>confdefs.h SUMMARY_audio="${SUMMARY_audio} sndio(dynamic)" else @@ -20042,7 +22459,7 @@ fi -$as_echo "#define SDL_AUDIO_DRIVER_SNDIO 1" >>confdefs.h +printf "%s\n" "#define SDL_AUDIO_DRIVER_SNDIO 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/sndio/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $SNDIO_CFLAGS" @@ -20054,26 +22471,27 @@ CheckFusionSound() { # Check whether --enable-fusionsound was given. -if test "${enable_fusionsound+set}" = set; then : +if test ${enable_fusionsound+y} +then : enableval=$enable_fusionsound; -else +else $as_nop enable_fusionsound=no fi if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fusionsound >= 1.1.1" >&5 -$as_echo_n "checking for fusionsound >= 1.1.1... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fusionsound >= 1.1.1" >&5 +printf %s "checking for fusionsound >= 1.1.1... " >&6; } if test -n "$FUSIONSOUND_CFLAGS"; then pkg_cv_FUSIONSOUND_CFLAGS="$FUSIONSOUND_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fusionsound >= 1.1.1\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fusionsound >= 1.1.1\""; } >&5 ($PKG_CONFIG --exists --print-errors "fusionsound >= 1.1.1") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags "fusionsound >= 1.1.1" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -20087,10 +22505,10 @@ pkg_cv_FUSIONSOUND_LIBS="$FUSIONSOUND_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fusionsound >= 1.1.1\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fusionsound >= 1.1.1\""; } >&5 ($PKG_CONFIG --exists --print-errors "fusionsound >= 1.1.1") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_FUSIONSOUND_LIBS=`$PKG_CONFIG --libs "fusionsound >= 1.1.1" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -20104,8 +22522,8 @@ if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -20122,45 +22540,44 @@ fusionsound=no elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fusionsound=no else FUSIONSOUND_CFLAGS=$pkg_cv_FUSIONSOUND_CFLAGS FUSIONSOUND_LIBS=$pkg_cv_FUSIONSOUND_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } fusionsound=yes fi if test x$fusionsound = xyes; then -$as_echo "#define SDL_AUDIO_DRIVER_FUSIONSOUND 1" >>confdefs.h +printf "%s\n" "#define SDL_AUDIO_DRIVER_FUSIONSOUND 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS" # Check whether --enable-fusionsound-shared was given. -if test "${enable_fusionsound_shared+set}" = set; then : +if test ${enable_fusionsound_shared+y} +then : enableval=$enable_fusionsound_shared; -else +else $as_nop enable_fusionsound_shared=yes fi fusionsound_shared=no - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FusionSound dynamic loading support" >&5 -$as_echo_n "checking for FusionSound dynamic loading support... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for FusionSound dynamic loading support" >&5 +printf %s "checking for FusionSound dynamic loading support... " >&6; } if test x$have_loadso != xyes && \ test x$enable_fusionsound_shared = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic fusionsound loading" >&5 -$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic fusionsound loading" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic fusionsound loading" >&5 +printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic fusionsound loading" >&2;} fi if test x$have_loadso = xyes && \ test x$enable_fusionsound_shared = xyes; then -cat >>confdefs.h <<_ACEOF -#define SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "libfusionsound.so" -_ACEOF +printf "%s\n" "#define SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC \"libfusionsound.so\"" >>confdefs.h fusionsound_shared=yes SUMMARY_audio="${SUMMARY_audio} fusionsound(dynamic)" @@ -20168,8 +22585,8 @@ EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS" SUMMARY_audio="${SUMMARY_audio} fusionsound" fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fusionsound_shared" >&5 -$as_echo "$fusionsound_shared" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $fusionsound_shared" >&5 +printf "%s\n" "$fusionsound_shared" >&6; } have_audio=yes fi @@ -20179,15 +22596,16 @@ CheckDiskAudio() { # Check whether --enable-diskaudio was given. -if test "${enable_diskaudio+set}" = set; then : +if test ${enable_diskaudio+y} +then : enableval=$enable_diskaudio; -else +else $as_nop enable_diskaudio=yes fi if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then -$as_echo "#define SDL_AUDIO_DRIVER_DISK 1" >>confdefs.h +printf "%s\n" "#define SDL_AUDIO_DRIVER_DISK 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/disk/*.c" SUMMARY_audio="${SUMMARY_audio} disk" @@ -20198,15 +22616,16 @@ CheckDummyAudio() { # Check whether --enable-dummyaudio was given. -if test "${enable_dummyaudio+set}" = set; then : +if test ${enable_dummyaudio+y} +then : enableval=$enable_dummyaudio; -else +else $as_nop enable_dummyaudio=yes fi if test x$enable_audio = xyes -a x$enable_dummyaudio = xyes; then -$as_echo "#define SDL_AUDIO_DRIVER_DUMMY 1" >>confdefs.h +printf "%s\n" "#define SDL_AUDIO_DRIVER_DUMMY 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c" SUMMARY_audio="${SUMMARY_audio} dummy" @@ -20217,30 +22636,32 @@ CheckLibSampleRate() { # Check whether --enable-libsamplerate was given. -if test "${enable_libsamplerate+set}" = set; then : +if test ${enable_libsamplerate+y} +then : enableval=$enable_libsamplerate; -else +else $as_nop enable_libsamplerate=yes fi if test x$enable_libsamplerate = xyes; then - ac_fn_c_check_header_mongrel "$LINENO" "samplerate.h" "ac_cv_header_samplerate_h" "$ac_includes_default" -if test "x$ac_cv_header_samplerate_h" = xyes; then : + ac_fn_c_check_header_compile "$LINENO" "samplerate.h" "ac_cv_header_samplerate_h" "$ac_includes_default" +if test "x$ac_cv_header_samplerate_h" = xyes +then : have_samplerate_h_hdr=yes -else +else $as_nop have_samplerate_h_hdr=no fi - if test x$have_samplerate_h_hdr = xyes; then -$as_echo "#define HAVE_LIBSAMPLERATE_H 1" >>confdefs.h +printf "%s\n" "#define HAVE_LIBSAMPLERATE_H 1" >>confdefs.h # Check whether --enable-libsamplerate-shared was given. -if test "${enable_libsamplerate_shared+set}" = set; then : +if test ${enable_libsamplerate_shared+y} +then : enableval=$enable_libsamplerate_shared; -else +else $as_nop enable_libsamplerate_shared=yes fi @@ -20249,16 +22670,14 @@ if test x$have_loadso != xyes && \ test x$enable_libsamplerate_shared = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic libsamplerate loading" >&5 -$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic libsamplerate loading" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic libsamplerate loading" >&5 +printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic libsamplerate loading" >&2;} fi if test x$have_loadso = xyes && \ test x$enable_libsamplerate_shared = xyes && test x$samplerate_lib != x; then echo "-- dynamic libsamplerate -> $samplerate_lib" -cat >>confdefs.h <<_ACEOF -#define SDL_LIBSAMPLERATE_DYNAMIC "$samplerate_lib" -_ACEOF +printf "%s\n" "#define SDL_LIBSAMPLERATE_DYNAMIC \"$samplerate_lib\"" >>confdefs.h else EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lsamplerate" @@ -20270,9 +22689,10 @@ CheckARM() { # Check whether --enable-arm-simd was given. -if test "${enable_arm_simd+set}" = set; then : +if test ${enable_arm_simd+y} +then : enableval=$enable_arm_simd; enable_arm_simd=$enableval -else +else $as_nop enable_arm_simd=no fi @@ -20281,8 +22701,8 @@ have_arm_simd=no CFLAGS="-x assembler-with-cpp $CFLAGS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ARM SIMD" >&5 -$as_echo_n "checking for ARM SIMD... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ARM SIMD" >&5 +printf %s "checking for ARM SIMD... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20298,18 +22718,19 @@ uqadd8 r0, r0, r0 _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_arm_simd=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_arm_simd" >&5 -$as_echo "$have_arm_simd" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_arm_simd" >&5 +printf "%s\n" "$have_arm_simd" >&6; } CFLAGS="$save_CFLAGS" if test x$have_arm_simd = xyes; then -$as_echo "#define SDL_ARM_SIMD_BLITTERS 1" >>confdefs.h +printf "%s\n" "#define SDL_ARM_SIMD_BLITTERS 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/video/arm/pixman-arm-simd*.S" WARN_ABOUT_ARM_SIMD_ASM_MIT="yes" @@ -20320,9 +22741,10 @@ CheckNEON() { # Check whether --enable-arm-neon was given. -if test "${enable_arm_neon+set}" = set; then : +if test ${enable_arm_neon+y} +then : enableval=$enable_arm_neon; enable_arm_neon=$enableval -else +else $as_nop enable_arm_neon=no fi @@ -20331,8 +22753,8 @@ have_arm_neon=no CFLAGS="-x assembler-with-cpp $CFLAGS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ARM NEON" >&5 -$as_echo_n "checking for ARM NEON... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ARM NEON" >&5 +printf %s "checking for ARM NEON... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20350,17 +22772,18 @@ vmovn.u16 d0, q0 _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_arm_neon=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_arm_neon" >&5 -$as_echo "$have_arm_neon" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_arm_neon" >&5 +printf "%s\n" "$have_arm_neon" >&6; } CFLAGS="$save_CFLAGS" if test x$have_arm_neon = xyes; then -$as_echo "#define SDL_ARM_NEON_BLITTERS 1" >>confdefs.h +printf "%s\n" "#define SDL_ARM_NEON_BLITTERS 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/video/arm/pixman-arm-neon*.S" WARN_ABOUT_ARM_NEON_ASM_MIT="yes" @@ -20368,10 +22791,45 @@ fi } +CheckObjectiveCARC() +{ + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for clang -fobjc-arc option" >&5 +printf %s "checking for clang -fobjc-arc option... " >&6; } + have_clang_objc_arc=no + + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS -fobjc-arc" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + int x = 0; + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + have_clang_objc_arc=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_clang_objc_arc" >&5 +printf "%s\n" "$have_clang_objc_arc" >&6; } + CFLAGS="$save_CFLAGS" + + if test x$have_clang_objc_arc = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -fobjc-arc" + fi +} + CheckVisibilityHidden() { - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -fvisibility=hidden option" >&5 -$as_echo_n "checking for GCC -fvisibility=hidden option... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -fvisibility=hidden option" >&5 +printf %s "checking for GCC -fvisibility=hidden option... " >&6; } have_gcc_fvisibility=no visibility_CFLAGS="-fvisibility=hidden" @@ -20385,19 +22843,20 @@ #endif int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_gcc_fvisibility=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_fvisibility" >&5 -$as_echo "$have_gcc_fvisibility" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_fvisibility" >&5 +printf "%s\n" "$have_gcc_fvisibility" >&6; } CFLAGS="$save_CFLAGS" if test x$have_gcc_fvisibility = xyes; then @@ -20407,8 +22866,8 @@ CheckNoStrictAliasing() { - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -fno-strict-aliasing option" >&5 -$as_echo_n "checking for GCC -fno-strict-aliasing option... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -fno-strict-aliasing option" >&5 +printf %s "checking for GCC -fno-strict-aliasing option... " >&6; } have_gcc_no_strict_aliasing=no save_CFLAGS="$CFLAGS" @@ -20419,19 +22878,20 @@ int x = 0; int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_gcc_no_strict_aliasing=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_no_strict_aliasing" >&5 -$as_echo "$have_gcc_no_strict_aliasing" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_no_strict_aliasing" >&5 +printf "%s\n" "$have_gcc_no_strict_aliasing" >&6; } CFLAGS="$save_CFLAGS" if test x$have_gcc_no_strict_aliasing = xyes; then @@ -20441,8 +22901,8 @@ CheckStackBoundary() { - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -mpreferred-stack-boundary option" >&5 -$as_echo_n "checking for GCC -mpreferred-stack-boundary option... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -mpreferred-stack-boundary option" >&5 +printf %s "checking for GCC -mpreferred-stack-boundary option... " >&6; } have_gcc_preferred_stack_boundary=no save_CFLAGS="$CFLAGS" @@ -20453,19 +22913,20 @@ int x = 0; int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_gcc_preferred_stack_boundary=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_preferred_stack_boundary" >&5 -$as_echo "$have_gcc_preferred_stack_boundary" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_preferred_stack_boundary" >&5 +printf "%s\n" "$have_gcc_preferred_stack_boundary" >&6; } CFLAGS="$save_CFLAGS" if test x$have_gcc_preferred_stack_boundary = xyes; then @@ -20475,8 +22936,8 @@ CheckDeclarationAfterStatement() { - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -Wdeclaration-after-statement option" >&5 -$as_echo_n "checking for GCC -Wdeclaration-after-statement option... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -Wdeclaration-after-statement option" >&5 +printf %s "checking for GCC -Wdeclaration-after-statement option... " >&6; } have_gcc_declaration_after_statement=no save_CFLAGS="$CFLAGS" @@ -20487,19 +22948,20 @@ int x = 0; int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_gcc_declaration_after_statement=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_declaration_after_statement" >&5 -$as_echo "$have_gcc_declaration_after_statement" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_declaration_after_statement" >&5 +printf "%s\n" "$have_gcc_declaration_after_statement" >&6; } CFLAGS="$save_CFLAGS" if test x$have_gcc_declaration_after_statement = xyes; then @@ -20509,8 +22971,8 @@ CheckWarnAll() { - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -Wall option" >&5 -$as_echo_n "checking for GCC -Wall option... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -Wall option" >&5 +printf %s "checking for GCC -Wall option... " >&6; } have_gcc_Wall=no save_CFLAGS="$CFLAGS" @@ -20521,34 +22983,35 @@ int x = 0; int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_gcc_Wall=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_Wall" >&5 -$as_echo "$have_gcc_Wall" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_Wall" >&5 +printf "%s\n" "$have_gcc_Wall" >&6; } CFLAGS="$save_CFLAGS" if test x$have_gcc_Wall = xyes; then EXTRA_CFLAGS="$EXTRA_CFLAGS -Wall" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for necessary GCC -Wno-multichar option" >&5 -$as_echo_n "checking for necessary GCC -Wno-multichar option... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for necessary GCC -Wno-multichar option" >&5 +printf %s "checking for necessary GCC -Wno-multichar option... " >&6; } need_gcc_Wno_multichar=no case "$host" in *-*-haiku*) need_gcc_Wno_multichar=yes ;; esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $need_gcc_Wno_multichar" >&5 -$as_echo "$need_gcc_Wno_multichar" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $need_gcc_Wno_multichar" >&5 +printf "%s\n" "$need_gcc_Wno_multichar" >&6; } if test x$need_gcc_Wno_multichar = xyes; then EXTRA_CFLAGS="$EXTRA_CFLAGS -Wno-multichar" fi @@ -20558,24 +23021,26 @@ CheckWayland() { # Check whether --enable-video-wayland was given. -if test "${enable_video_wayland+set}" = set; then : +if test ${enable_video_wayland+y} +then : enableval=$enable_video_wayland; -else +else $as_nop enable_video_wayland=yes fi # Check whether --enable-video-wayland-qt-touch was given. -if test "${enable_video_wayland_qt_touch+set}" = set; then : +if test ${enable_video_wayland_qt_touch+y} +then : enableval=$enable_video_wayland_qt_touch; -else +else $as_nop enable_video_wayland_qt_touch=yes fi if test x$enable_video = xyes -a x$enable_video_wayland = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Wayland support" >&5 -$as_echo_n "checking for Wayland support... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Wayland support" >&5 +printf %s "checking for Wayland support... " >&6; } video_wayland=no if test x$video_opengl_egl = xyes && \ test x$video_opengles_v2 = xyes; then @@ -20583,24 +23048,25 @@ WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon` WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor xkbcommon` WAYLAND_SCANNER=`$PKG_CONFIG --variable=wayland_scanner wayland-scanner` - if $PKG_CONFIG --exists 'wayland-scanner >= 1.15'; then : + if $PKG_CONFIG --exists 'wayland-scanner >= 1.15' +then : WAYLAND_SCANNER_CODE_MODE=private-code -else +else $as_nop WAYLAND_SCANNER_CODE_MODE=code fi video_wayland=yes fi fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_wayland" >&5 -$as_echo "$video_wayland" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $video_wayland" >&5 +printf "%s\n" "$video_wayland" >&6; } if test x$video_wayland = xyes; then -$as_echo "#define SDL_VIDEO_DRIVER_WAYLAND 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_DRIVER_WAYLAND 1" >>confdefs.h if test x$enable_video_wayland_qt_touch = xyes; then -$as_echo "#define SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 1" >>confdefs.h fi @@ -20608,9 +23074,10 @@ SOURCES="$SOURCES $WAYLAND_SOURCES" EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS -I\$(gen)" # Check whether --enable-wayland-shared was given. -if test "${enable_wayland_shared+set}" = set; then : +if test ${enable_wayland_shared+y} +then : enableval=$enable_wayland_shared; -else +else $as_nop enable_wayland_shared=maybe fi @@ -20633,8 +23100,8 @@ fi if test x$have_loadso != xyes && \ test x$enable_wayland_shared = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic Wayland loading" >&5 -$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic Wayland loading" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic Wayland loading" >&5 +printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic Wayland loading" >&2;} enable_wayland_shared=no fi if test x$have_loadso = xyes && \ @@ -20648,24 +23115,16 @@ echo "-- dynamic libwayland-cursor -> $wayland_cursor_lib" echo "-- dynamic libxkbcommon -> $xkbcommon_lib" -cat >>confdefs.h <<_ACEOF -#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC "$wayland_client_lib" -_ACEOF +printf "%s\n" "#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC \"$wayland_client_lib\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL "$wayland_egl_lib" -_ACEOF +printf "%s\n" "#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL \"$wayland_egl_lib\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR "$wayland_cursor_lib" -_ACEOF +printf "%s\n" "#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR \"$wayland_cursor_lib\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON "$xkbcommon_lib" -_ACEOF +printf "%s\n" "#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON \"$xkbcommon_lib\"" >>confdefs.h SUMMARY_video="${SUMMARY_video} wayland(dynamic)" else @@ -20676,26 +23135,27 @@ have_video=yes # Check whether --enable-libdecor was given. -if test "${enable_libdecor+set}" = set; then : +if test ${enable_libdecor+y} +then : enableval=$enable_libdecor; -else +else $as_nop enable_libdecor=yes fi if test x$enable_libdecor = xyes; then pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libdecor-0" >&5 -$as_echo_n "checking for libdecor-0... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libdecor-0" >&5 +printf %s "checking for libdecor-0... " >&6; } if test -n "$DECOR_CFLAGS"; then pkg_cv_DECOR_CFLAGS="$DECOR_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdecor-0\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdecor-0\""; } >&5 ($PKG_CONFIG --exists --print-errors "libdecor-0") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_DECOR_CFLAGS=`$PKG_CONFIG --cflags "libdecor-0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -20709,10 +23169,10 @@ pkg_cv_DECOR_LIBS="$DECOR_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdecor-0\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdecor-0\""; } >&5 ($PKG_CONFIG --exists --print-errors "libdecor-0") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_DECOR_LIBS=`$PKG_CONFIG --libs "libdecor-0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -20726,8 +23186,8 @@ if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -20744,26 +23204,27 @@ video_libdecor=no elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } video_libdecor=no else DECOR_CFLAGS=$pkg_cv_DECOR_CFLAGS DECOR_LIBS=$pkg_cv_DECOR_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } video_libdecor=yes fi if test x$video_libdecor = xyes; then EXTRA_CFLAGS="$EXTRA_CFLAGS $DECOR_CFLAGS" -$as_echo "#define HAVE_LIBDECOR_H 1" >>confdefs.h +printf "%s\n" "#define HAVE_LIBDECOR_H 1" >>confdefs.h # Check whether --enable-libdecor-shared was given. -if test "${enable_libdecor_shared+set}" = set; then : +if test ${enable_libdecor_shared+y} +then : enableval=$enable_libdecor_shared; -else +else $as_nop enable_libdecor_shared=yes fi @@ -20775,16 +23236,14 @@ fi if test x$have_loadso != xyes && \ test x$enable_libdecor_shared = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic libdecor loading" >&5 -$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic libdecor loading" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic libdecor loading" >&5 +printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic libdecor loading" >&2;} fi if test x$have_loadso = xyes && \ test x$enable_libdecor_shared = xyes && test x$decor_lib != x; then echo "-- dynamic libdecor -> $decor_lib" -cat >>confdefs.h <<_ACEOF -#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR "$decor_lib" -_ACEOF +printf "%s\n" "#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR \"$decor_lib\"" >>confdefs.h else EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DECOR_LIBS" @@ -20805,32 +23264,33 @@ #endif int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : -$as_echo "#define SDL_VIDEO_DRIVER_NACL 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_DRIVER_NACL 1" >>confdefs.h -$as_echo "#define SDL_AUDIO_DRIVER_NACL 1" >>confdefs.h +printf "%s\n" "#define SDL_AUDIO_DRIVER_NACL 1" >>confdefs.h -$as_echo "#define HAVE_POW 1" >>confdefs.h +printf "%s\n" "#define HAVE_POW 1" >>confdefs.h -$as_echo "#define HAVE_OPENGLES2 1" >>confdefs.h +printf "%s\n" "#define HAVE_OPENGLES2 1" >>confdefs.h -$as_echo "#define SDL_VIDEO_OPENGL_ES2 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_OPENGL_ES2 1" >>confdefs.h -$as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h SDL_LIBS="-lppapi_simple -lppapi_gles2 $SDL_LIBS" @@ -20844,32 +23304,33 @@ have_video=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext } CheckRPI() { # Check whether --enable-video-rpi was given. -if test "${enable_video_rpi+set}" = set; then : +if test ${enable_video_rpi+y} +then : enableval=$enable_video_rpi; -else +else $as_nop enable_video_rpi=yes fi if test x$enable_video = xyes -a x$enable_video_rpi = xyes; then pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for bcm_host brcmegl" >&5 -$as_echo_n "checking for bcm_host brcmegl... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for bcm_host brcmegl" >&5 +printf %s "checking for bcm_host brcmegl... " >&6; } if test -n "$RPI_CFLAGS"; then pkg_cv_RPI_CFLAGS="$RPI_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"bcm_host brcmegl\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"bcm_host brcmegl\""; } >&5 ($PKG_CONFIG --exists --print-errors "bcm_host brcmegl") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_RPI_CFLAGS=`$PKG_CONFIG --cflags "bcm_host brcmegl" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -20883,10 +23344,10 @@ pkg_cv_RPI_LIBS="$RPI_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"bcm_host brcmegl\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"bcm_host brcmegl\""; } >&5 ($PKG_CONFIG --exists --print-errors "bcm_host brcmegl") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_RPI_LIBS=`$PKG_CONFIG --libs "bcm_host brcmegl" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -20900,8 +23361,8 @@ if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -20918,14 +23379,14 @@ video_rpi=no elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } video_rpi=no else RPI_CFLAGS=$pkg_cv_RPI_CFLAGS RPI_LIBS=$pkg_cv_RPI_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } video_rpi=yes fi @@ -20945,8 +23406,8 @@ # Add the Raspberry Pi compiler flags and libraries CFLAGS="$CFLAGS $RPI_CFLAGS"; LIBS="$LIBS $RPI_LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Raspberry Pi 2/3" >&5 -$as_echo_n "checking for Raspberry Pi 2/3... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Raspberry Pi 2/3" >&5 +printf %s "checking for Raspberry Pi 2/3... " >&6; } have_video_rpi=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20955,7 +23416,7 @@ #include int -main () +main (void) { EGL_DISPMANX_WINDOW_T window; @@ -20965,13 +23426,14 @@ return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : have_video_rpi=yes fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_video_rpi" >&5 -$as_echo "$have_video_rpi" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_video_rpi" >&5 +printf "%s\n" "$have_video_rpi" >&6; } # Restore the compiler flags and libraries CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs" @@ -20983,7 +23445,7 @@ EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_LIBS" SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c" -$as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h SUMMARY_video="${SUMMARY_video} rpi" have_video=yes @@ -20994,9 +23456,10 @@ CheckX11() { # Check whether --enable-video-x11 was given. -if test "${enable_video_x11+set}" = set; then : +if test ${enable_video_x11+y} +then : enableval=$enable_video_x11; -else +else $as_nop enable_video_x11=yes fi @@ -21013,12 +23476,13 @@ fi ;; esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for X" >&5 -$as_echo_n "checking for X... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for X" >&5 +printf %s "checking for X... " >&6; } # Check whether --with-x was given. -if test "${with_x+set}" = set; then : +if test ${with_x+y} +then : withval=$with_x; fi @@ -21029,9 +23493,10 @@ else case $x_includes,$x_libraries in #( *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5;; #( - *,NONE | NONE,*) if ${ac_cv_have_x+:} false; then : - $as_echo_n "(cached) " >&6 -else + *,NONE | NONE,*) if test ${ac_cv_have_x+y} +then : + printf %s "(cached) " >&6 +else $as_nop # One or both of the vars are not set, and there is no cached value. ac_x_includes=no ac_x_libraries=no @@ -21042,24 +23507,26 @@ /* end confdefs.h. */ #include int -main () +main (void) { XrmInitialize () ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : # We can compile and link X programs with no special options. ac_x_includes= ac_x_libraries= fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS="$ac_save_LIBS" -# If that didn't work, only try xmkmf and filesystem searches +# If that didn't work, only try xmkmf and file system searches # for native compilation. -if test x"$ac_x_includes" = xno && test "$cross_compiling" = no; then : +if test x"$ac_x_includes" = xno && test "$cross_compiling" = no +then : rm -f -r conftest.dir if mkdir conftest.dir; then cd conftest.dir @@ -21149,10 +23616,11 @@ /* end confdefs.h. */ #include _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : +if ac_fn_c_try_cpp "$LINENO" +then : # We can compile using X headers with no special include directory. ac_x_includes= -else +else $as_nop for ac_dir in $ac_x_header_dirs; do if test -r "$ac_dir/X11/Xlib.h"; then ac_x_includes=$ac_dir @@ -21173,20 +23641,21 @@ /* end confdefs.h. */ #include int -main () +main (void) { XrmInitialize () ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : LIBS=$ac_save_LIBS # We can link X programs with no special library path. ac_x_libraries= -else +else $as_nop LIBS=$ac_save_LIBS -for ac_dir in `$as_echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` +for ac_dir in `printf "%s\n" "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` do # Don't even attempt the hair of trying to link an X program! for ac_extension in a so sl dylib la dll; do @@ -21197,7 +23666,7 @@ done done fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi # $ac_x_libraries = no @@ -21221,8 +23690,8 @@ fi # $with_x != no if test "$have_x" != yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_x" >&5 -$as_echo "$have_x" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_x" >&5 +printf "%s\n" "$have_x" >&6; } no_x=yes else # If each of the values was on the command line, it overrides each guess. @@ -21232,14 +23701,14 @@ ac_cv_have_x="have_x=yes\ ac_x_includes='$x_includes'\ ac_x_libraries='$x_libraries'" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: libraries $x_libraries, headers $x_includes" >&5 -$as_echo "libraries $x_libraries, headers $x_includes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: libraries $x_libraries, headers $x_includes" >&5 +printf "%s\n" "libraries $x_libraries, headers $x_includes" >&6; } fi if test "$no_x" = yes; then # Not all programs may use this symbol, but it does not hurt to define it. -$as_echo "#define X_DISPLAY_MISSING 1" >>confdefs.h +printf "%s\n" "#define X_DISPLAY_MISSING 1" >>confdefs.h X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= else @@ -21252,8 +23721,8 @@ X_LIBS="$X_LIBS -L$x_libraries" # For Solaris; some versions of Sun CC require a space after -R and # others require no space. Words are not sufficient . . . . - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -R must be followed by a space" >&5 -$as_echo_n "checking whether -R must be followed by a space... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -R must be followed by a space" >&5 +printf %s "checking whether -R must be followed by a space... " >&6; } ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries" ac_xsave_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes @@ -21261,42 +23730,44 @@ /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } X_LIBS="$X_LIBS -R$x_libraries" -else +else $as_nop LIBS="$ac_xsave_LIBS -R $x_libraries" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } X_LIBS="$X_LIBS -R $x_libraries" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: neither works" >&5 -$as_echo "neither works" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: neither works" >&5 +printf "%s\n" "neither works" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext ac_c_werror_flag=$ac_xsave_c_werror_flag LIBS=$ac_xsave_LIBS @@ -21319,26 +23790,25 @@ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char XOpenDisplay (); int -main () +main (void) { return XOpenDisplay (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet" >&5 -$as_echo_n "checking for dnet_ntoa in -ldnet... " >&6; } -if ${ac_cv_lib_dnet_dnet_ntoa+:} false; then : - $as_echo_n "(cached) " >&6 -else +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet" >&5 +printf %s "checking for dnet_ntoa in -ldnet... " >&6; } +if test ${ac_cv_lib_dnet_dnet_ntoa+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -21347,39 +23817,39 @@ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char dnet_ntoa (); int -main () +main (void) { return dnet_ntoa (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_dnet_dnet_ntoa=yes -else +else $as_nop ac_cv_lib_dnet_dnet_ntoa=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 -$as_echo "$ac_cv_lib_dnet_dnet_ntoa" >&6; } -if test "x$ac_cv_lib_dnet_dnet_ntoa" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 +printf "%s\n" "$ac_cv_lib_dnet_dnet_ntoa" >&6; } +if test "x$ac_cv_lib_dnet_dnet_ntoa" = xyes +then : X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet_stub" >&5 -$as_echo_n "checking for dnet_ntoa in -ldnet_stub... " >&6; } -if ${ac_cv_lib_dnet_stub_dnet_ntoa+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet_stub" >&5 +printf %s "checking for dnet_ntoa in -ldnet_stub... " >&6; } +if test ${ac_cv_lib_dnet_stub_dnet_ntoa+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet_stub $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -21388,36 +23858,35 @@ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char dnet_ntoa (); int -main () +main (void) { return dnet_ntoa (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_dnet_stub_dnet_ntoa=yes -else +else $as_nop ac_cv_lib_dnet_stub_dnet_ntoa=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 -$as_echo "$ac_cv_lib_dnet_stub_dnet_ntoa" >&6; } -if test "x$ac_cv_lib_dnet_stub_dnet_ntoa" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 +printf "%s\n" "$ac_cv_lib_dnet_stub_dnet_ntoa" >&6; } +if test "x$ac_cv_lib_dnet_stub_dnet_ntoa" = xyes +then : X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" fi fi fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS="$ac_xsave_LIBS" @@ -21430,16 +23899,18 @@ # The functions gethostbyname, getservbyname, and inet_addr are # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking. ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" -if test "x$ac_cv_func_gethostbyname" = xyes; then : +if test "x$ac_cv_func_gethostbyname" = xyes +then : fi if test $ac_cv_func_gethostbyname = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5 -$as_echo_n "checking for gethostbyname in -lnsl... " >&6; } -if ${ac_cv_lib_nsl_gethostbyname+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5 +printf %s "checking for gethostbyname in -lnsl... " >&6; } +if test ${ac_cv_lib_nsl_gethostbyname+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -21448,39 +23919,39 @@ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char gethostbyname (); int -main () +main (void) { return gethostbyname (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_nsl_gethostbyname=yes -else +else $as_nop ac_cv_lib_nsl_gethostbyname=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5 -$as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; } -if test "x$ac_cv_lib_nsl_gethostbyname" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5 +printf "%s\n" "$ac_cv_lib_nsl_gethostbyname" >&6; } +if test "x$ac_cv_lib_nsl_gethostbyname" = xyes +then : X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" fi if test $ac_cv_lib_nsl_gethostbyname = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lbsd" >&5 -$as_echo_n "checking for gethostbyname in -lbsd... " >&6; } -if ${ac_cv_lib_bsd_gethostbyname+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lbsd" >&5 +printf %s "checking for gethostbyname in -lbsd... " >&6; } +if test ${ac_cv_lib_bsd_gethostbyname+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lbsd $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -21489,30 +23960,29 @@ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char gethostbyname (); int -main () +main (void) { return gethostbyname (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_bsd_gethostbyname=yes -else +else $as_nop ac_cv_lib_bsd_gethostbyname=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_gethostbyname" >&5 -$as_echo "$ac_cv_lib_bsd_gethostbyname" >&6; } -if test "x$ac_cv_lib_bsd_gethostbyname" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_gethostbyname" >&5 +printf "%s\n" "$ac_cv_lib_bsd_gethostbyname" >&6; } +if test "x$ac_cv_lib_bsd_gethostbyname" = xyes +then : X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd" fi @@ -21527,16 +23997,18 @@ # must be given before -lnsl if both are needed. We assume that # if connect needs -lnsl, so does gethostbyname. ac_fn_c_check_func "$LINENO" "connect" "ac_cv_func_connect" -if test "x$ac_cv_func_connect" = xyes; then : +if test "x$ac_cv_func_connect" = xyes +then : fi if test $ac_cv_func_connect = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for connect in -lsocket" >&5 -$as_echo_n "checking for connect in -lsocket... " >&6; } -if ${ac_cv_lib_socket_connect+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for connect in -lsocket" >&5 +printf %s "checking for connect in -lsocket... " >&6; } +if test ${ac_cv_lib_socket_connect+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -21545,30 +24017,29 @@ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char connect (); int -main () +main (void) { return connect (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_socket_connect=yes -else +else $as_nop ac_cv_lib_socket_connect=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_connect" >&5 -$as_echo "$ac_cv_lib_socket_connect" >&6; } -if test "x$ac_cv_lib_socket_connect" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_connect" >&5 +printf "%s\n" "$ac_cv_lib_socket_connect" >&6; } +if test "x$ac_cv_lib_socket_connect" = xyes +then : X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" fi @@ -21576,16 +24047,18 @@ # Guillermo Gomez says -lposix is necessary on A/UX. ac_fn_c_check_func "$LINENO" "remove" "ac_cv_func_remove" -if test "x$ac_cv_func_remove" = xyes; then : +if test "x$ac_cv_func_remove" = xyes +then : fi if test $ac_cv_func_remove = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for remove in -lposix" >&5 -$as_echo_n "checking for remove in -lposix... " >&6; } -if ${ac_cv_lib_posix_remove+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for remove in -lposix" >&5 +printf %s "checking for remove in -lposix... " >&6; } +if test ${ac_cv_lib_posix_remove+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lposix $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -21594,30 +24067,29 @@ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char remove (); int -main () +main (void) { return remove (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_posix_remove=yes -else +else $as_nop ac_cv_lib_posix_remove=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix_remove" >&5 -$as_echo "$ac_cv_lib_posix_remove" >&6; } -if test "x$ac_cv_lib_posix_remove" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix_remove" >&5 +printf "%s\n" "$ac_cv_lib_posix_remove" >&6; } +if test "x$ac_cv_lib_posix_remove" = xyes +then : X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" fi @@ -21625,16 +24097,18 @@ # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. ac_fn_c_check_func "$LINENO" "shmat" "ac_cv_func_shmat" -if test "x$ac_cv_func_shmat" = xyes; then : +if test "x$ac_cv_func_shmat" = xyes +then : fi if test $ac_cv_func_shmat = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shmat in -lipc" >&5 -$as_echo_n "checking for shmat in -lipc... " >&6; } -if ${ac_cv_lib_ipc_shmat+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for shmat in -lipc" >&5 +printf %s "checking for shmat in -lipc... " >&6; } +if test ${ac_cv_lib_ipc_shmat+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lipc $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -21643,30 +24117,29 @@ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char shmat (); int -main () +main (void) { return shmat (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_ipc_shmat=yes -else +else $as_nop ac_cv_lib_ipc_shmat=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ipc_shmat" >&5 -$as_echo "$ac_cv_lib_ipc_shmat" >&6; } -if test "x$ac_cv_lib_ipc_shmat" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ipc_shmat" >&5 +printf "%s\n" "$ac_cv_lib_ipc_shmat" >&6; } +if test "x$ac_cv_lib_ipc_shmat" = xyes +then : X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" fi @@ -21682,11 +24155,12 @@ # These have to be linked with before -lX11, unlike the other # libraries we check for below, so use a different variable. # John Interrante, Karl Berry - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for IceConnectionNumber in -lICE" >&5 -$as_echo_n "checking for IceConnectionNumber in -lICE... " >&6; } -if ${ac_cv_lib_ICE_IceConnectionNumber+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for IceConnectionNumber in -lICE" >&5 +printf %s "checking for IceConnectionNumber in -lICE... " >&6; } +if test ${ac_cv_lib_ICE_IceConnectionNumber+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -21695,30 +24169,29 @@ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char IceConnectionNumber (); int -main () +main (void) { return IceConnectionNumber (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_ICE_IceConnectionNumber=yes -else +else $as_nop ac_cv_lib_ICE_IceConnectionNumber=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 -$as_echo "$ac_cv_lib_ICE_IceConnectionNumber" >&6; } -if test "x$ac_cv_lib_ICE_IceConnectionNumber" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 +printf "%s\n" "$ac_cv_lib_ICE_IceConnectionNumber" >&6; } +if test "x$ac_cv_lib_ICE_IceConnectionNumber" = xyes +then : X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" fi @@ -21728,9 +24201,10 @@ if test x$have_x = xyes; then # Check whether --enable-x11-shared was given. -if test "${enable_x11_shared+set}" = set; then : +if test ${enable_x11_shared+y} +then : enableval=$enable_x11_shared; -else +else $as_nop enable_x11_shared=maybe fi @@ -21741,37 +24215,31 @@ x11_lib='/opt/X11/lib/libX11.6.dylib' x11ext_lib='/opt/X11/lib/libXext.6.dylib' xcursor_lib='/opt/X11/lib/libXcursor.1.dylib' - xinerama_lib='/opt/X11/lib/libXinerama.1.dylib' xinput_lib='/opt/X11/lib/libXi.6.dylib' xfixes_lib='/opt/X11/lib/libXfixes.3.dylib' xrandr_lib='/opt/X11/lib/libXrandr.2.dylib' xrender_lib='/opt/X11/lib/libXrender.1.dylib' xss_lib='/opt/X11/lib/libXss.1.dylib' - xvidmode_lib='/opt/X11/lib/libXxf86vm.1.dylib' ;; *-*-openbsd*) x11_lib='libX11.so' x11ext_lib='libXext.so' xcursor_lib='libXcursor.so' - xinerama_lib='libXinerama.so' xinput_lib='libXi.so' xfixes_lib='libXfixes.so' xrandr_lib='libXrandr.so' xrender_lib='libXrender.so' xss_lib='libXss.so' - xvidmode_lib='libXxf86vm.so' ;; *) x11_lib=`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'` x11ext_lib=`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'` xcursor_lib=`find_lib "libXcursor.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'` - xinerama_lib=`find_lib "libXinerama.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'` xinput_lib=`find_lib "libXi.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'` xfixes_lib=`find_lib "libXfixes.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'` xrandr_lib=`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'` xrender_lib=`find_lib "libXrender.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'` xss_lib=`find_lib "libXss.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'` - xvidmode_lib=`find_lib "libXxf86vm.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'` ;; esac @@ -21785,13 +24253,13 @@ #include " -if test "x$ac_cv_header_X11_extensions_Xext_h" = xyes; then : +if test "x$ac_cv_header_X11_extensions_Xext_h" = xyes +then : have_xext_h_hdr=yes -else +else $as_nop have_xext_h_hdr=no fi - if test x$have_xext_h_hdr != xyes; then as_fn_error $? " *** Missing Xext.h, maybe you need to install the libxext-dev package? @@ -21799,7 +24267,7 @@ fi -$as_echo "#define SDL_VIDEO_DRIVER_X11 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_DRIVER_X11 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/video/x11/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS" @@ -21812,8 +24280,8 @@ fi if test x$have_loadso != xyes && \ test x$enable_x11_shared = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic X11 loading" >&5 -$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic X11 loading" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic X11 loading" >&5 +printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic X11 loading" >&2;} enable_x11_shared=no fi if test x$have_loadso = xyes && \ @@ -21821,14 +24289,10 @@ echo "-- dynamic libX11 -> $x11_lib" echo "-- dynamic libX11ext -> $x11ext_lib" -cat >>confdefs.h <<_ACEOF -#define SDL_VIDEO_DRIVER_X11_DYNAMIC "$x11_lib" -_ACEOF +printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_DYNAMIC \"$x11_lib\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "$x11ext_lib" -_ACEOF +printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT \"$x11ext_lib\"" >>confdefs.h SUMMARY_video="${SUMMARY_video} x11(dynamic)" else @@ -21838,8 +24302,8 @@ fi have_video=yes - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XGenericEvent" >&5 -$as_echo_n "checking for XGenericEvent... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for XGenericEvent" >&5 +printf %s "checking for XGenericEvent... " >&6; } have_XGenericEvent=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -21847,7 +24311,7 @@ #include int -main () +main (void) { Display *display; @@ -21861,23 +24325,25 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_XGenericEvent=yes -$as_echo "#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1" >>confdefs.h fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_XGenericEvent" >&5 -$as_echo "$have_XGenericEvent" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_XGenericEvent" >&5 +printf "%s\n" "$have_XGenericEvent" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XkbKeycodeToKeysym in -lX11" >&5 -$as_echo_n "checking for XkbKeycodeToKeysym in -lX11... " >&6; } -if ${ac_cv_lib_X11_XkbKeycodeToKeysym+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for XkbKeycodeToKeysym in -lX11" >&5 +printf %s "checking for XkbKeycodeToKeysym in -lX11... " >&6; } +if test ${ac_cv_lib_X11_XkbKeycodeToKeysym+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lX11 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -21886,40 +24352,40 @@ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char XkbKeycodeToKeysym (); int -main () +main (void) { return XkbKeycodeToKeysym (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_X11_XkbKeycodeToKeysym=yes -else +else $as_nop ac_cv_lib_X11_XkbKeycodeToKeysym=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_X11_XkbKeycodeToKeysym" >&5 -$as_echo "$ac_cv_lib_X11_XkbKeycodeToKeysym" >&6; } -if test "x$ac_cv_lib_X11_XkbKeycodeToKeysym" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_X11_XkbKeycodeToKeysym" >&5 +printf "%s\n" "$ac_cv_lib_X11_XkbKeycodeToKeysym" >&6; } +if test "x$ac_cv_lib_X11_XkbKeycodeToKeysym" = xyes +then : -$as_echo "#define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1" >>confdefs.h fi # Check whether --enable-video-x11-xcursor was given. -if test "${enable_video_x11_xcursor+set}" = set; then : +if test ${enable_video_x11_xcursor+y} +then : enableval=$enable_video_x11_xcursor; -else +else $as_nop enable_video_x11_xcursor=yes fi @@ -21928,28 +24394,27 @@ ac_fn_c_check_header_compile "$LINENO" "X11/Xcursor/Xcursor.h" "ac_cv_header_X11_Xcursor_Xcursor_h" "#include " -if test "x$ac_cv_header_X11_Xcursor_Xcursor_h" = xyes; then : +if test "x$ac_cv_header_X11_Xcursor_Xcursor_h" = xyes +then : have_xcursor_h_hdr=yes -else +else $as_nop have_xcursor_h_hdr=no fi - if test x$have_xcursor_h_hdr = xyes; then if test x$enable_x11_shared = xyes && test x$xcursor_lib != x ; then echo "-- dynamic libXcursor -> $xcursor_lib" -cat >>confdefs.h <<_ACEOF -#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR "$xcursor_lib" -_ACEOF +printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR \"$xcursor_lib\"" >>confdefs.h definitely_enable_video_x11_xcursor=yes else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XcursorImageCreate in -lXcursor" >&5 -$as_echo_n "checking for XcursorImageCreate in -lXcursor... " >&6; } -if ${ac_cv_lib_Xcursor_XcursorImageCreate+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for XcursorImageCreate in -lXcursor" >&5 +printf %s "checking for XcursorImageCreate in -lXcursor... " >&6; } +if test ${ac_cv_lib_Xcursor_XcursorImageCreate+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lXcursor $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -21958,30 +24423,29 @@ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char XcursorImageCreate (); int -main () +main (void) { return XcursorImageCreate (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_Xcursor_XcursorImageCreate=yes -else +else $as_nop ac_cv_lib_Xcursor_XcursorImageCreate=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xcursor_XcursorImageCreate" >&5 -$as_echo "$ac_cv_lib_Xcursor_XcursorImageCreate" >&6; } -if test "x$ac_cv_lib_Xcursor_XcursorImageCreate" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xcursor_XcursorImageCreate" >&5 +printf "%s\n" "$ac_cv_lib_Xcursor_XcursorImageCreate" >&6; } +if test "x$ac_cv_lib_Xcursor_XcursorImageCreate" = xyes +then : have_xcursor_lib=yes fi @@ -21994,14 +24458,15 @@ fi if test x$definitely_enable_video_x11_xcursor = xyes; then -$as_echo "#define SDL_VIDEO_DRIVER_X11_XCURSOR 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_XCURSOR 1" >>confdefs.h SUMMARY_video_x11="${SUMMARY_video_x11} xcursor" fi # Check whether --enable-video-x11-xdbe was given. -if test "${enable_video_x11_xdbe+set}" = set; then : +if test ${enable_video_x11_xdbe+y} +then : enableval=$enable_video_x11_xdbe; -else +else $as_nop enable_video_x11_xdbe=yes fi @@ -22009,106 +24474,25 @@ ac_fn_c_check_header_compile "$LINENO" "X11/extensions/Xdbe.h" "ac_cv_header_X11_extensions_Xdbe_h" "#include " -if test "x$ac_cv_header_X11_extensions_Xdbe_h" = xyes; then : +if test "x$ac_cv_header_X11_extensions_Xdbe_h" = xyes +then : have_dbe_h_hdr=yes -else +else $as_nop have_dbe_h_hdr=no fi - if test x$have_dbe_h_hdr = xyes; then -$as_echo "#define SDL_VIDEO_DRIVER_X11_XDBE 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_XDBE 1" >>confdefs.h SUMMARY_video_x11="${SUMMARY_video_x11} xdbe" fi fi - # Check whether --enable-video-x11-xinerama was given. -if test "${enable_video_x11_xinerama+set}" = set; then : - enableval=$enable_video_x11_xinerama; -else - enable_video_x11_xinerama=yes -fi - - if test x$enable_video_x11_xinerama = xyes; then - definitely_enable_video_x11_xinerama=no - ac_fn_c_check_header_compile "$LINENO" "X11/extensions/Xinerama.h" "ac_cv_header_X11_extensions_Xinerama_h" "#include - -" -if test "x$ac_cv_header_X11_extensions_Xinerama_h" = xyes; then : - have_xinerama_h_hdr=yes -else - have_xinerama_h_hdr=no -fi - - - if test x$have_xinerama_h_hdr = xyes; then - if test x$enable_x11_shared = xyes && test x$xinerama_lib != x ; then - echo "-- dynamic libXinerama -> $xinerama_lib" - -cat >>confdefs.h <<_ACEOF -#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "$xinerama_lib" -_ACEOF - - definitely_enable_video_x11_xinerama=yes - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XineramaQueryExtension in -lXinerama" >&5 -$as_echo_n "checking for XineramaQueryExtension in -lXinerama... " >&6; } -if ${ac_cv_lib_Xinerama_XineramaQueryExtension+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lXinerama $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char XineramaQueryExtension (); -int -main () -{ -return XineramaQueryExtension (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_Xinerama_XineramaQueryExtension=yes -else - ac_cv_lib_Xinerama_XineramaQueryExtension=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xinerama_XineramaQueryExtension" >&5 -$as_echo "$ac_cv_lib_Xinerama_XineramaQueryExtension" >&6; } -if test "x$ac_cv_lib_Xinerama_XineramaQueryExtension" = xyes; then : - have_xinerama_lib=yes -fi - - if test x$have_xinerama_lib = xyes ; then - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXinerama" - definitely_enable_video_x11_xinerama=yes - fi - fi - fi - fi - if test x$definitely_enable_video_x11_xinerama = xyes; then - -$as_echo "#define SDL_VIDEO_DRIVER_X11_XINERAMA 1" >>confdefs.h - - SUMMARY_video_x11="${SUMMARY_video_x11} xinerama" - fi # Check whether --enable-video-x11-xinput was given. -if test "${enable_video_x11_xinput+set}" = set; then : +if test ${enable_video_x11_xinput+y} +then : enableval=$enable_video_x11_xinput; -else +else $as_nop enable_video_x11_xinput=yes fi @@ -22117,28 +24501,27 @@ ac_fn_c_check_header_compile "$LINENO" "X11/extensions/XInput2.h" "ac_cv_header_X11_extensions_XInput2_h" "#include " -if test "x$ac_cv_header_X11_extensions_XInput2_h" = xyes; then : +if test "x$ac_cv_header_X11_extensions_XInput2_h" = xyes +then : have_xinput_h_hdr=yes -else +else $as_nop have_xinput_h_hdr=no fi - if test x$have_xinput_h_hdr = xyes; then if test x$enable_x11_shared = xyes && test x$xinput_lib != x ; then echo "-- dynamic libXi -> $xinput_lib" -cat >>confdefs.h <<_ACEOF -#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "$xinput_lib" -_ACEOF +printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 \"$xinput_lib\"" >>confdefs.h definitely_enable_video_x11_xinput=yes else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XOpenDevice in -lXi" >&5 -$as_echo_n "checking for XOpenDevice in -lXi... " >&6; } -if ${ac_cv_lib_Xi_XOpenDevice+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for XOpenDevice in -lXi" >&5 +printf %s "checking for XOpenDevice in -lXi... " >&6; } +if test ${ac_cv_lib_Xi_XOpenDevice+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lXi $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -22147,30 +24530,29 @@ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char XOpenDevice (); int -main () +main (void) { return XOpenDevice (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_Xi_XOpenDevice=yes -else +else $as_nop ac_cv_lib_Xi_XOpenDevice=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xi_XOpenDevice" >&5 -$as_echo "$ac_cv_lib_Xi_XOpenDevice" >&6; } -if test "x$ac_cv_lib_Xi_XOpenDevice" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xi_XOpenDevice" >&5 +printf "%s\n" "$ac_cv_lib_Xi_XOpenDevice" >&6; } +if test "x$ac_cv_lib_Xi_XOpenDevice" = xyes +then : have_xinput_lib=yes fi @@ -22184,10 +24566,10 @@ if test x$definitely_enable_video_x11_xinput = xyes; then SUMMARY_video_x11="${SUMMARY_video_x11} xinput2" -$as_echo "#define SDL_VIDEO_DRIVER_X11_XINPUT2 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_XINPUT2 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xinput2 multitouch" >&5 -$as_echo_n "checking for xinput2 multitouch... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for xinput2 multitouch" >&5 +printf %s "checking for xinput2 multitouch... " >&6; } have_xinput2_multitouch=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -22197,7 +24579,7 @@ #include int -main () +main (void) { int event_type = XI_TouchBegin; @@ -22207,31 +24589,33 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_xinput2_multitouch=yes -$as_echo "#define SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH 1" >>confdefs.h SUMMARY_video_x11="${SUMMARY_video_x11} xinput2_multitouch" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_xinput2_multitouch" >&5 -$as_echo "$have_xinput2_multitouch" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_xinput2_multitouch" >&5 +printf "%s\n" "$have_xinput2_multitouch" >&6; } fi # Check whether --enable-video-x11-xfixes was given. -if test "${enable_video_x11_xfixes+set}" = set; then : +if test ${enable_video_x11_xfixes+y} +then : enableval=$enable_video_x11_xfixes; -else +else $as_nop enable_video_x11_xfixes=yes fi if test x$enable_video_x11_xfixes = xyes; then definitely_enable_video_x11_xfixes=no # check along with XInput2.h because we use Xfixes with XIBarrierReleasePointer - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for X11/extensions/Xfixes.h" >&5 -$as_echo_n "checking for X11/extensions/Xfixes.h... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for X11/extensions/Xfixes.h" >&5 +printf %s "checking for X11/extensions/Xfixes.h... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -22240,36 +24624,36 @@ #include #include int -main () +main (void) { BarrierEventID b; ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_xfixes_h_hdr=yes -else +else $as_nop have_xfixes_h_hdr=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_xfixes_h_hdr" >&5 -$as_echo "$have_xfixes_h_hdr" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_xfixes_h_hdr" >&5 +printf "%s\n" "$have_xfixes_h_hdr" >&6; } if test x$have_xfixes_h_hdr = xyes; then if test x$enable_x11_shared = xyes && test x$xfixes_lib != x ; then echo "-- dynamic libXfixes -> $xfixes_lib" -cat >>confdefs.h <<_ACEOF -#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES "$xfixes_lib" -_ACEOF +printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES \"$xfixes_lib\"" >>confdefs.h definitely_enable_video_x11_xfixes=yes else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XFixesCreatePointerBarrier in -lXfixes" >&5 -$as_echo_n "checking for XFixesCreatePointerBarrier in -lXfixes... " >&6; } -if ${ac_cv_lib_Xfixes_XFixesCreatePointerBarrier+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for XFixesCreatePointerBarrier in -lXfixes" >&5 +printf %s "checking for XFixesCreatePointerBarrier in -lXfixes... " >&6; } +if test ${ac_cv_lib_Xfixes_XFixesCreatePointerBarrier+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lXfixes $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -22278,30 +24662,29 @@ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char XFixesCreatePointerBarrier (); int -main () +main (void) { return XFixesCreatePointerBarrier (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_Xfixes_XFixesCreatePointerBarrier=yes -else +else $as_nop ac_cv_lib_Xfixes_XFixesCreatePointerBarrier=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xfixes_XFixesCreatePointerBarrier" >&5 -$as_echo "$ac_cv_lib_Xfixes_XFixesCreatePointerBarrier" >&6; } -if test "x$ac_cv_lib_Xfixes_XFixesCreatePointerBarrier" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xfixes_XFixesCreatePointerBarrier" >&5 +printf "%s\n" "$ac_cv_lib_Xfixes_XFixesCreatePointerBarrier" >&6; } +if test "x$ac_cv_lib_Xfixes_XFixesCreatePointerBarrier" = xyes +then : have_xfixes_lib=yes fi @@ -22314,14 +24697,15 @@ fi if test x$definitely_enable_video_x11_xfixes = xyes; then -$as_echo "#define SDL_VIDEO_DRIVER_X11_XFIXES 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_XFIXES 1" >>confdefs.h SUMMARY_video_x11="${SUMMARY_video_x11} xfixes" fi # Check whether --enable-video-x11-xrandr was given. -if test "${enable_video_x11_xrandr+set}" = set; then : +if test ${enable_video_x11_xrandr+y} +then : enableval=$enable_video_x11_xrandr; -else +else $as_nop enable_video_x11_xrandr=yes fi @@ -22335,7 +24719,7 @@ #include int -main () +main (void) { XRRScreenResources *res = NULL; @@ -22344,25 +24728,25 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_xrandr_h_hdr=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test x$have_xrandr_h_hdr = xyes; then if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then echo "-- dynamic libXrandr -> $xrandr_lib" -cat >>confdefs.h <<_ACEOF -#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "$xrandr_lib" -_ACEOF +printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR \"$xrandr_lib\"" >>confdefs.h definitely_enable_video_x11_xrandr=yes else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XRRQueryExtension in -lXrandr" >&5 -$as_echo_n "checking for XRRQueryExtension in -lXrandr... " >&6; } -if ${ac_cv_lib_Xrandr_XRRQueryExtension+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for XRRQueryExtension in -lXrandr" >&5 +printf %s "checking for XRRQueryExtension in -lXrandr... " >&6; } +if test ${ac_cv_lib_Xrandr_XRRQueryExtension+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lXrandr $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -22371,30 +24755,29 @@ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char XRRQueryExtension (); int -main () +main (void) { return XRRQueryExtension (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_Xrandr_XRRQueryExtension=yes -else +else $as_nop ac_cv_lib_Xrandr_XRRQueryExtension=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xrandr_XRRQueryExtension" >&5 -$as_echo "$ac_cv_lib_Xrandr_XRRQueryExtension" >&6; } -if test "x$ac_cv_lib_Xrandr_XRRQueryExtension" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xrandr_XRRQueryExtension" >&5 +printf "%s\n" "$ac_cv_lib_Xrandr_XRRQueryExtension" >&6; } +if test "x$ac_cv_lib_Xrandr_XRRQueryExtension" = xyes +then : have_xrandr_lib=yes fi @@ -22407,14 +24790,15 @@ fi if test x$definitely_enable_video_x11_xrandr = xyes; then -$as_echo "#define SDL_VIDEO_DRIVER_X11_XRANDR 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_XRANDR 1" >>confdefs.h SUMMARY_video_x11="${SUMMARY_video_x11} xrandr" fi # Check whether --enable-video-x11-scrnsaver was given. -if test "${enable_video_x11_scrnsaver+set}" = set; then : +if test ${enable_video_x11_scrnsaver+y} +then : enableval=$enable_video_x11_scrnsaver; -else +else $as_nop enable_video_x11_scrnsaver=yes fi @@ -22422,28 +24806,27 @@ ac_fn_c_check_header_compile "$LINENO" "X11/extensions/scrnsaver.h" "ac_cv_header_X11_extensions_scrnsaver_h" "#include " -if test "x$ac_cv_header_X11_extensions_scrnsaver_h" = xyes; then : +if test "x$ac_cv_header_X11_extensions_scrnsaver_h" = xyes +then : have_scrnsaver_h_hdr=yes -else +else $as_nop have_scrnsaver_h_hdr=no fi - if test x$have_scrnsaver_h_hdr = xyes; then if test x$enable_x11_shared = xyes && test x$xss_lib != x ; then echo "-- dynamic libXss -> $xss_lib" -cat >>confdefs.h <<_ACEOF -#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "$xss_lib" -_ACEOF +printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS \"$xss_lib\"" >>confdefs.h definitely_enable_video_x11_scrnsaver=yes else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XScreenSaverSuspend in -lXss" >&5 -$as_echo_n "checking for XScreenSaverSuspend in -lXss... " >&6; } -if ${ac_cv_lib_Xss_XScreenSaverSuspend+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for XScreenSaverSuspend in -lXss" >&5 +printf %s "checking for XScreenSaverSuspend in -lXss... " >&6; } +if test ${ac_cv_lib_Xss_XScreenSaverSuspend+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lXss $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -22452,30 +24835,29 @@ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char XScreenSaverSuspend (); int -main () +main (void) { return XScreenSaverSuspend (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_Xss_XScreenSaverSuspend=yes -else +else $as_nop ac_cv_lib_Xss_XScreenSaverSuspend=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xss_XScreenSaverSuspend" >&5 -$as_echo "$ac_cv_lib_Xss_XScreenSaverSuspend" >&6; } -if test "x$ac_cv_lib_Xss_XScreenSaverSuspend" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xss_XScreenSaverSuspend" >&5 +printf "%s\n" "$ac_cv_lib_Xss_XScreenSaverSuspend" >&6; } +if test "x$ac_cv_lib_Xss_XScreenSaverSuspend" = xyes +then : have_xss_lib=yes fi @@ -22488,14 +24870,15 @@ fi if test x$definitely_enable_video_x11_scrnsaver = xyes; then -$as_echo "#define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1" >>confdefs.h SUMMARY_video_x11="${SUMMARY_video_x11} xscrnsaver" fi # Check whether --enable-video-x11-xshape was given. -if test "${enable_video_x11_xshape+set}" = set; then : +if test ${enable_video_x11_xshape+y} +then : enableval=$enable_video_x11_xshape; -else +else $as_nop enable_video_x11_xshape=yes fi @@ -22503,102 +24886,20 @@ ac_fn_c_check_header_compile "$LINENO" "X11/extensions/shape.h" "ac_cv_header_X11_extensions_shape_h" "#include " -if test "x$ac_cv_header_X11_extensions_shape_h" = xyes; then : +if test "x$ac_cv_header_X11_extensions_shape_h" = xyes +then : have_shape_h_hdr=yes -else +else $as_nop have_shape_h_hdr=no fi - if test x$have_shape_h_hdr = xyes; then -$as_echo "#define SDL_VIDEO_DRIVER_X11_XSHAPE 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_XSHAPE 1" >>confdefs.h SUMMARY_video_x11="${SUMMARY_video_x11} xshape" fi fi - # Check whether --enable-video-x11-vm was given. -if test "${enable_video_x11_vm+set}" = set; then : - enableval=$enable_video_x11_vm; -else - enable_video_x11_vm=yes -fi - - if test x$enable_video_x11_vm = xyes; then - definitely_enable_video_x11_vm=no - ac_fn_c_check_header_compile "$LINENO" "X11/extensions/xf86vmode.h" "ac_cv_header_X11_extensions_xf86vmode_h" "#include - -" -if test "x$ac_cv_header_X11_extensions_xf86vmode_h" = xyes; then : - have_vm_h_hdr=yes -else - have_vm_h_hdr=no -fi - - - if test x$have_vm_h_hdr = xyes; then - if test x$enable_x11_shared = xyes && test x$xvidmode_lib != x ; then - echo "-- dynamic libXxf86vm -> $xvidmode_lib" - -cat >>confdefs.h <<_ACEOF -#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "$xvidmode_lib" -_ACEOF - - definitely_enable_video_x11_vm=yes - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XF86VidModeQueryVersion in -lXxf86vm" >&5 -$as_echo_n "checking for XF86VidModeQueryVersion in -lXxf86vm... " >&6; } -if ${ac_cv_lib_Xxf86vm_XF86VidModeQueryVersion+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lXxf86vm $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char XF86VidModeQueryVersion (); -int -main () -{ -return XF86VidModeQueryVersion (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_Xxf86vm_XF86VidModeQueryVersion=yes -else - ac_cv_lib_Xxf86vm_XF86VidModeQueryVersion=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xxf86vm_XF86VidModeQueryVersion" >&5 -$as_echo "$ac_cv_lib_Xxf86vm_XF86VidModeQueryVersion" >&6; } -if test "x$ac_cv_lib_Xxf86vm_XF86VidModeQueryVersion" = xyes; then : - have_vm_lib=yes -fi - - if test x$have_vm_lib = xyes ; then - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXxf86vm" - definitely_enable_video_x11_vm=yes - fi - fi - fi - fi - if test x$definitely_enable_video_x11_vm = xyes; then - -$as_echo "#define SDL_VIDEO_DRIVER_X11_XVIDMODE 1" >>confdefs.h - - SUMMARY_video_x11="${SUMMARY_video_x11} xvidmode" - fi fi fi if test x$have_x != xyes; then @@ -22610,15 +24911,16 @@ CheckVivanteVideo() { # Check whether --enable-video-vivante was given. -if test "${enable_video_vivante+set}" = set; then : +if test ${enable_video_vivante+y} +then : enableval=$enable_video_vivante; -else +else $as_nop enable_video_vivante=yes fi if test x$enable_video = xyes -a x$enable_video_vivante = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Vivante VDK API" >&5 -$as_echo_n "checking for Vivante VDK API... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Vivante VDK API" >&5 +printf %s "checking for Vivante VDK API... " >&6; } have_vivante_vdk=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -22628,22 +24930,23 @@ #include int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_vivante_vdk=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_vivante_vdk" >&5 -$as_echo "$have_vivante_vdk" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_vivante_vdk" >&5 +printf "%s\n" "$have_vivante_vdk" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Vivante FB API" >&5 -$as_echo_n "checking for Vivante FB API... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Vivante FB API" >&5 +printf %s "checking for Vivante FB API... " >&6; } have_vivante_egl=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -22653,28 +24956,29 @@ #include int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_vivante_egl=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_vivante_egl" >&5 -$as_echo "$have_vivante_egl" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_vivante_egl" >&5 +printf "%s\n" "$have_vivante_egl" >&6; } if test x$have_vivante_vdk = xyes -o x$have_vivante_egl = xyes; then -$as_echo "#define SDL_VIDEO_DRIVER_VIVANTE 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_DRIVER_VIVANTE 1" >>confdefs.h EXTRA_CFLAGS="$EXTRA_CFLAGS -DLINUX -DEGL_API_FB" if test x$have_vivante_vdk = xyes; then -$as_echo "#define SDL_VIDEO_DRIVER_VIVANTE_VDK 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_DRIVER_VIVANTE_VDK 1" >>confdefs.h EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lVDK" fi @@ -22689,7 +24993,7 @@ { if test x$enable_video = xyes; then -$as_echo "#define SDL_VIDEO_DRIVER_HAIKU 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_DRIVER_HAIKU 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/video/haiku/*.cc" have_video=yes @@ -22700,17 +25004,18 @@ CheckCOCOA() { # Check whether --enable-video-cocoa was given. -if test "${enable_video_cocoa+set}" = set; then : +if test ${enable_video_cocoa+y} +then : enableval=$enable_video_cocoa; -else +else $as_nop enable_video_cocoa=yes fi if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -x objective-c" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Cocoa framework" >&5 -$as_echo_n "checking for Cocoa framework... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Cocoa framework" >&5 +printf %s "checking for Cocoa framework... " >&6; } have_cocoa=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -22718,23 +25023,24 @@ #import int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_cocoa=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_cocoa" >&5 -$as_echo "$have_cocoa" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_cocoa" >&5 +printf "%s\n" "$have_cocoa" >&6; } CFLAGS="$save_CFLAGS" if test x$have_cocoa = xyes; then -$as_echo "#define SDL_VIDEO_DRIVER_COCOA 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_DRIVER_COCOA 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/video/cocoa/*.m" SUMMARY_video="${SUMMARY_video} cocoa" @@ -22746,24 +25052,26 @@ CheckMETAL() { # Check whether --enable-video-metal was given. -if test "${enable_video_metal+set}" = set; then : +if test ${enable_video_metal+y} +then : enableval=$enable_video_metal; -else +else $as_nop enable_video_metal=yes fi # Check whether --enable-render-metal was given. -if test "${enable_render_metal+set}" = set; then : +if test ${enable_render_metal+y} +then : enableval=$enable_render_metal; -else +else $as_nop enable_render_metal=yes fi if test x$enable_video = xyes -a x$enable_video_metal = xyes; then save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -x objective-c" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Metal framework" >&5 -$as_echo_n "checking for Metal framework... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Metal framework" >&5 +printf %s "checking for Metal framework... " >&6; } have_metal=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -22777,27 +25085,28 @@ #endif int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_metal=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS="$save_CFLAGS" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_metal" >&5 -$as_echo "$have_metal" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_metal" >&5 +printf "%s\n" "$have_metal" >&6; } if test x$have_metal = xyes; then -$as_echo "#define SDL_VIDEO_METAL 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_METAL 1" >>confdefs.h if test x$enable_render = xyes -a x$enable_render_metal = xyes; then -$as_echo "#define SDL_VIDEO_RENDER_METAL 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_RENDER_METAL 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/render/metal/*.m" fi @@ -22812,26 +25121,27 @@ CheckDirectFB() { # Check whether --enable-video-directfb was given. -if test "${enable_video_directfb+set}" = set; then : +if test ${enable_video_directfb+y} +then : enableval=$enable_video_directfb; -else +else $as_nop enable_video_directfb=no fi if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for directfb >= 1.0.0" >&5 -$as_echo_n "checking for directfb >= 1.0.0... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for directfb >= 1.0.0" >&5 +printf %s "checking for directfb >= 1.0.0... " >&6; } if test -n "$DIRECTFB_CFLAGS"; then pkg_cv_DIRECTFB_CFLAGS="$DIRECTFB_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"directfb >= 1.0.0\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"directfb >= 1.0.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "directfb >= 1.0.0") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags "directfb >= 1.0.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -22845,10 +25155,10 @@ pkg_cv_DIRECTFB_LIBS="$DIRECTFB_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"directfb >= 1.0.0\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"directfb >= 1.0.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "directfb >= 1.0.0") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_DIRECTFB_LIBS=`$PKG_CONFIG --libs "directfb >= 1.0.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -22862,8 +25172,8 @@ if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -22880,14 +25190,14 @@ video_directfb=no elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } video_directfb=no else DIRECTFB_CFLAGS=$pkg_cv_DIRECTFB_CFLAGS DIRECTFB_LIBS=$pkg_cv_DIRECTFB_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } video_directfb=yes fi @@ -22895,32 +25205,33 @@ # SuSE 11.1 installs directfb-config without directfb-devel save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $DIRECTFB_CFLAGS" - ac_fn_c_check_header_mongrel "$LINENO" "directfb.h" "ac_cv_header_directfb_h" "$ac_includes_default" -if test "x$ac_cv_header_directfb_h" = xyes; then : + ac_fn_c_check_header_compile "$LINENO" "directfb.h" "ac_cv_header_directfb_h" "$ac_includes_default" +if test "x$ac_cv_header_directfb_h" = xyes +then : have_directfb_hdr=yes -else +else $as_nop have_directfb_hdr=no fi - CPPFLAGS="$save_CPPFLAGS" video_directfb=$have_directfb_hdr fi if test x$video_directfb = xyes; then # Check whether --enable-directfb-shared was given. -if test "${enable_directfb_shared+set}" = set; then : +if test ${enable_directfb_shared+y} +then : enableval=$enable_directfb_shared; -else +else $as_nop enable_directfb_shared=yes fi -$as_echo "#define SDL_VIDEO_DRIVER_DIRECTFB 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_DRIVER_DIRECTFB 1" >>confdefs.h -$as_echo "#define SDL_VIDEO_RENDER_DIRECTFB 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_RENDER_DIRECTFB 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/video/directfb/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS" @@ -22929,17 +25240,15 @@ directfb_lib=`find_lib "libdirectfb*.so.*" "$DIRECTFB_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` if test x$have_loadso != xyes && \ test x$enable_directfb_shared = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic directfb loading" >&5 -$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic directfb loading" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic directfb loading" >&5 +printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic directfb loading" >&2;} fi if test x$have_loadso = xyes && \ test x$enable_directfb_shared = xyes && test x$directfb_lib != x; then directfb_shared=yes echo "-- dynamic libdirectfb -> $directfb_lib" -cat >>confdefs.h <<_ACEOF -#define SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC "$directfb_lib" -_ACEOF +printf "%s\n" "#define SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC \"$directfb_lib\"" >>confdefs.h SUMMARY_video="${SUMMARY_video} directfb(dynamic)" else @@ -22955,9 +25264,10 @@ CheckKMSDRM() { # Check whether --enable-video-kmsdrm was given. -if test "${enable_video_kmsdrm+set}" = set; then : +if test ${enable_video_kmsdrm+y} +then : enableval=$enable_video_kmsdrm; -else +else $as_nop enable_video_kmsdrm=yes fi @@ -22970,17 +25280,17 @@ pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libdrm >= 1.4.82" >&5 -$as_echo_n "checking for libdrm >= 1.4.82... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libdrm >= 1.4.82" >&5 +printf %s "checking for libdrm >= 1.4.82... " >&6; } if test -n "$LIBDRM_CFLAGS"; then pkg_cv_LIBDRM_CFLAGS="$LIBDRM_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdrm >= 1.4.82\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdrm >= 1.4.82\""; } >&5 ($PKG_CONFIG --exists --print-errors "libdrm >= 1.4.82") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBDRM_CFLAGS=`$PKG_CONFIG --cflags "libdrm >= 1.4.82" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -22994,10 +25304,10 @@ pkg_cv_LIBDRM_LIBS="$LIBDRM_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdrm >= 1.4.82\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdrm >= 1.4.82\""; } >&5 ($PKG_CONFIG --exists --print-errors "libdrm >= 1.4.82") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBDRM_LIBS=`$PKG_CONFIG --libs "libdrm >= 1.4.82" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -23011,8 +25321,8 @@ if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -23029,29 +25339,29 @@ libdrm_avail=no elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } libdrm_avail=no else LIBDRM_CFLAGS=$pkg_cv_LIBDRM_CFLAGS LIBDRM_LIBS=$pkg_cv_LIBDRM_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } libdrm_avail=yes fi pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gbm >= 11.1.0" >&5 -$as_echo_n "checking for gbm >= 11.1.0... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gbm >= 11.1.0" >&5 +printf %s "checking for gbm >= 11.1.0... " >&6; } if test -n "$LIBGBM_CFLAGS"; then pkg_cv_LIBGBM_CFLAGS="$LIBGBM_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gbm >= 11.1.0\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gbm >= 11.1.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "gbm >= 11.1.0") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBGBM_CFLAGS=`$PKG_CONFIG --cflags "gbm >= 11.1.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -23065,10 +25375,10 @@ pkg_cv_LIBGBM_LIBS="$LIBGBM_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gbm >= 11.1.0\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gbm >= 11.1.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "gbm >= 11.1.0") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBGBM_LIBS=`$PKG_CONFIG --libs "gbm >= 11.1.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -23082,8 +25392,8 @@ if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -23100,14 +25410,14 @@ libgbm_avail=no elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } libgbm_avail=no else LIBGBM_CFLAGS=$pkg_cv_LIBGBM_CFLAGS LIBGBM_LIBS=$pkg_cv_LIBGBM_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } libgbm_avail=yes fi @@ -23117,54 +25427,49 @@ if test x$video_kmsdrm = xyes; then # Check whether --enable-kmsdrm-shared was given. -if test "${enable_kmsdrm_shared+set}" = set; then : +if test ${enable_kmsdrm_shared+y} +then : enableval=$enable_kmsdrm_shared; -else +else $as_nop enable_kmsdrm_shared=yes fi -$as_echo "#define SDL_VIDEO_DRIVER_KMSDRM 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_DRIVER_KMSDRM 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/video/kmsdrm/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBDRM_CFLAGS $LIBGBM_CFLAGS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for kmsdrm dynamic loading support" >&5 -$as_echo_n "checking for kmsdrm dynamic loading support... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for kmsdrm dynamic loading support" >&5 +printf %s "checking for kmsdrm dynamic loading support... " >&6; } kmsdrm_shared=no drm_lib=`find_lib "libdrm.so.*" "$LIBDRM_LIBS"` gbm_lib=`find_lib "libgbm.so.*" "$LIBGBM_LIBS"` if test x$have_loadso != xyes && \ test x$enable_kmsdrm_shared = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic kmsdrm loading" >&5 -$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic kmsdrm loading" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic kmsdrm loading" >&5 +printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic kmsdrm loading" >&2;} fi if test x$have_loadso = xyes && \ test x$enable_kmsdrm_shared = xyes && test x$drm_lib != x && test x$gbm_lib != x; then kmsdrm_shared=yes -cat >>confdefs.h <<_ACEOF -#define SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC "$drm_lib" -_ACEOF +printf "%s\n" "#define SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC \"$drm_lib\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM "$gbm_lib" -_ACEOF +printf "%s\n" "#define SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM \"$gbm_lib\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define HAVE_KMSDRM_SHARED "TRUE" -_ACEOF +printf "%s\n" "#define HAVE_KMSDRM_SHARED \"TRUE\"" >>confdefs.h SUMMARY_video="${SUMMARY_video} kmsdrm(dynamic)" else EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBDRM_LIBS $LIBGBM_LIBS" SUMMARY_video="${SUMMARY_video} kmsdrm" fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $kmsdrm_shared" >&5 -$as_echo "$kmsdrm_shared" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $kmsdrm_shared" >&5 +printf "%s\n" "$kmsdrm_shared" >&6; } if test x$kmsdrm_shared = xyes; then echo "-- dynamic libdrm -> $drm_lib" echo "-- dynamic libgbm -> $gbm_lib" @@ -23177,15 +25482,16 @@ CheckDummyVideo() { # Check whether --enable-video-dummy was given. -if test "${enable_video_dummy+set}" = set; then : +if test ${enable_video_dummy+y} +then : enableval=$enable_video_dummy; -else +else $as_nop enable_video_dummy=yes fi if test x$enable_video_dummy = xyes; then -$as_echo "#define SDL_VIDEO_DRIVER_DUMMY 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_DRIVER_DUMMY 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/video/dummy/*.c" have_video=yes @@ -23196,15 +25502,16 @@ CheckOffscreenVideo() { # Check whether --enable-video-offscreen was given. -if test "${enable_video_offscreen+set}" = set; then : +if test ${enable_video_offscreen+y} +then : enableval=$enable_video_offscreen; -else +else $as_nop enable_video_offscreen=no fi if test x$enable_video_offscreen = xyes; then -$as_echo "#define SDL_VIDEO_DRIVER_OFFSCREEN 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_DRIVER_OFFSCREEN 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/video/offscreen/*.c" have_video=yes @@ -23216,7 +25523,7 @@ { if test x$enable_video = xyes; then -$as_echo "#define SDL_VIDEO_DRIVER_QNX 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_DRIVER_QNX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/video/qnx/*.c" have_video=yes @@ -23229,7 +25536,7 @@ { if test x$enable_audio = xyes; then -$as_echo "#define SDL_AUDIO_DRIVER_QSA 1" >>confdefs.h +printf "%s\n" "#define SDL_AUDIO_DRIVER_QSA 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/qsa/*.c" have_audio=yes @@ -23239,9 +25546,10 @@ } # Check whether --enable-video-opengl was given. -if test "${enable_video_opengl+set}" = set; then : +if test ${enable_video_opengl+y} +then : enableval=$enable_video_opengl; -else +else $as_nop enable_video_opengl=yes fi @@ -23249,8 +25557,8 @@ CheckGLX() { if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLX support" >&5 -$as_echo_n "checking for GLX support... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GLX support" >&5 +printf %s "checking for GLX support... " >&6; } video_opengl_glx=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -23258,48 +25566,52 @@ #include int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : video_opengl_glx=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_opengl_glx" >&5 -$as_echo "$video_opengl_glx" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $video_opengl_glx" >&5 +printf "%s\n" "$video_opengl_glx" >&6; } if test x$video_opengl_glx = xyes; then -$as_echo "#define SDL_VIDEO_OPENGL 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_OPENGL 1" >>confdefs.h -$as_echo "#define SDL_VIDEO_OPENGL_GLX 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_OPENGL_GLX 1" >>confdefs.h fi fi } # Check whether --enable-video-opengles was given. -if test "${enable_video_opengles+set}" = set; then : +if test ${enable_video_opengles+y} +then : enableval=$enable_video_opengles; -else +else $as_nop enable_video_opengles=yes fi # Check whether --enable-video-opengles1 was given. -if test "${enable_video_opengles1+set}" = set; then : +if test ${enable_video_opengles1+y} +then : enableval=$enable_video_opengles1; -else +else $as_nop enable_video_opengles1=yes fi # Check whether --enable-video-opengles2 was given. -if test "${enable_video_opengles2+set}" = set; then : +if test ${enable_video_opengles2+y} +then : enableval=$enable_video_opengles2; -else +else $as_nop enable_video_opengles2=yes fi @@ -23307,8 +25619,8 @@ CheckEGL() { if test x$enable_video = xyes -a x$enable_video_opengl = xyes || test x$enable_video = xyes -a x$enable_video_opengles = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for EGL support" >&5 -$as_echo_n "checking for EGL support... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for EGL support" >&5 +printf %s "checking for EGL support... " >&6; } video_opengl_egl=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -23321,22 +25633,23 @@ #include int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : video_opengl_egl=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_opengl_egl" >&5 -$as_echo "$video_opengl_egl" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $video_opengl_egl" >&5 +printf "%s\n" "$video_opengl_egl" >&6; } if test x$video_opengl_egl = xyes; then -$as_echo "#define SDL_VIDEO_OPENGL_EGL 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_OPENGL_EGL 1" >>confdefs.h fi fi @@ -23345,8 +25658,8 @@ CheckOpenGL() { if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenGL headers" >&5 -$as_echo_n "checking for OpenGL headers... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OpenGL headers" >&5 +printf %s "checking for OpenGL headers... " >&6; } video_opengl=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -23355,25 +25668,26 @@ #include int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : video_opengl=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_opengl" >&5 -$as_echo "$video_opengl" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $video_opengl" >&5 +printf "%s\n" "$video_opengl" >&6; } if test x$video_opengl = xyes; then -$as_echo "#define SDL_VIDEO_OPENGL 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_OPENGL 1" >>confdefs.h -$as_echo "#define SDL_VIDEO_RENDER_OGL 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_RENDER_OGL 1" >>confdefs.h SUMMARY_video="${SUMMARY_video} opengl" fi @@ -23384,8 +25698,8 @@ { if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then if test x$enable_video_opengles1 = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenGL ES v1 headers" >&5 -$as_echo_n "checking for OpenGL ES v1 headers... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OpenGL ES v1 headers" >&5 +printf %s "checking for OpenGL ES v1 headers... " >&6; } video_opengles_v1=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -23394,33 +25708,34 @@ #include int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : video_opengles_v1=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_opengles_v1" >&5 -$as_echo "$video_opengles_v1" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $video_opengles_v1" >&5 +printf "%s\n" "$video_opengles_v1" >&6; } if test x$video_opengles_v1 = xyes; then -$as_echo "#define SDL_VIDEO_OPENGL_ES 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_OPENGL_ES 1" >>confdefs.h -$as_echo "#define SDL_VIDEO_RENDER_OGL_ES 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_RENDER_OGL_ES 1" >>confdefs.h SUMMARY_video="${SUMMARY_video} opengl_es1" fi fi if test x$enable_video_opengles2 = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenGL ES v2 headers" >&5 -$as_echo_n "checking for OpenGL ES v2 headers... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OpenGL ES v2 headers" >&5 +printf %s "checking for OpenGL ES v2 headers... " >&6; } video_opengles_v2=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -23429,25 +25744,26 @@ #include int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : video_opengles_v2=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_opengles_v2" >&5 -$as_echo "$video_opengles_v2" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $video_opengles_v2" >&5 +printf "%s\n" "$video_opengles_v2" >&6; } if test x$video_opengles_v2 = xyes; then -$as_echo "#define SDL_VIDEO_OPENGL_ES2 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_OPENGL_ES2 1" >>confdefs.h -$as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h SUMMARY_video="${SUMMARY_video} opengl_es2" fi @@ -23459,13 +25775,13 @@ { if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then -$as_echo "#define SDL_VIDEO_OPENGL 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_OPENGL 1" >>confdefs.h -$as_echo "#define SDL_VIDEO_OPENGL_WGL 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_OPENGL_WGL 1" >>confdefs.h -$as_echo "#define SDL_VIDEO_RENDER_OGL 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_RENDER_OGL 1" >>confdefs.h SUMMARY_video="${SUMMARY_video} opengl" fi @@ -23475,8 +25791,8 @@ { if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for EGL support" >&5 -$as_echo_n "checking for EGL support... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for EGL support" >&5 +printf %s "checking for EGL support... " >&6; } video_opengl_egl=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -23484,31 +25800,32 @@ #include int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : video_opengl_egl=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_opengl_egl" >&5 -$as_echo "$video_opengl_egl" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $video_opengl_egl" >&5 +printf "%s\n" "$video_opengl_egl" >&6; } if test x$video_opengl_egl = xyes; then -$as_echo "#define SDL_VIDEO_OPENGL 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_OPENGL 1" >>confdefs.h -$as_echo "#define SDL_VIDEO_OPENGL_EGL 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_OPENGL_EGL 1" >>confdefs.h SUMMARY_video="${SUMMARY_video} opengl_es1" fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenGL ES v2 headers" >&5 -$as_echo_n "checking for OpenGL ES v2 headers... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OpenGL ES v2 headers" >&5 +printf %s "checking for OpenGL ES v2 headers... " >&6; } video_opengles_v2=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -23517,28 +25834,29 @@ #include int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : video_opengles_v2=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_opengles_v2" >&5 -$as_echo "$video_opengles_v2" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $video_opengles_v2" >&5 +printf "%s\n" "$video_opengles_v2" >&6; } if test x$video_opengles_v2 = xyes; then -$as_echo "#define SDL_VIDEO_OPENGL 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_OPENGL 1" >>confdefs.h -$as_echo "#define SDL_VIDEO_OPENGL_ES2 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_OPENGL_ES2 1" >>confdefs.h -$as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h SUMMARY_video="${SUMMARY_video} opengl_es2" fi @@ -23549,13 +25867,13 @@ { if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then -$as_echo "#define SDL_VIDEO_OPENGL 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_OPENGL 1" >>confdefs.h -$as_echo "#define SDL_VIDEO_OPENGL_HAIKU 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_OPENGL_HAIKU 1" >>confdefs.h -$as_echo "#define SDL_VIDEO_RENDER_OGL 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_RENDER_OGL 1" >>confdefs.h EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL" SUMMARY_video="${SUMMARY_video} opengl" @@ -23566,13 +25884,13 @@ { if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then -$as_echo "#define SDL_VIDEO_OPENGL 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_OPENGL 1" >>confdefs.h -$as_echo "#define SDL_VIDEO_OPENGL_CGL 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_OPENGL_CGL 1" >>confdefs.h -$as_echo "#define SDL_VIDEO_RENDER_OGL 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_RENDER_OGL 1" >>confdefs.h SUMMARY_video="${SUMMARY_video} opengl" fi @@ -23583,14 +25901,14 @@ if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then video_opengl_egl=yes -$as_echo "#define SDL_VIDEO_OPENGL_EGL 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_OPENGL_EGL 1" >>confdefs.h video_opengles_v2=yes -$as_echo "#define SDL_VIDEO_OPENGL_ES2 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_OPENGL_ES2 1" >>confdefs.h -$as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h SUMMARY_video="${SUMMARY_video} opengl_es2" fi @@ -23599,8 +25917,8 @@ CheckEmscriptenGLES() { if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for EGL support" >&5 -$as_echo_n "checking for EGL support... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for EGL support" >&5 +printf %s "checking for EGL support... " >&6; } video_opengl_egl=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -23608,27 +25926,28 @@ #include int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : video_opengl_egl=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_opengl_egl" >&5 -$as_echo "$video_opengl_egl" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $video_opengl_egl" >&5 +printf "%s\n" "$video_opengl_egl" >&6; } if test x$video_opengl_egl = xyes; then -$as_echo "#define SDL_VIDEO_OPENGL_EGL 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_OPENGL_EGL 1" >>confdefs.h fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenGL ES v2 headers" >&5 -$as_echo_n "checking for OpenGL ES v2 headers... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OpenGL ES v2 headers" >&5 +printf %s "checking for OpenGL ES v2 headers... " >&6; } video_opengles_v2=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -23637,25 +25956,26 @@ #include int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : video_opengles_v2=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_opengles_v2" >&5 -$as_echo "$video_opengles_v2" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $video_opengles_v2" >&5 +printf "%s\n" "$video_opengles_v2" >&6; } if test x$video_opengles_v2 = xyes; then -$as_echo "#define SDL_VIDEO_OPENGL_ES2 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_OPENGL_ES2 1" >>confdefs.h -$as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h SUMMARY_video="${SUMMARY_video} opengl_es2" fi @@ -23663,9 +25983,10 @@ } # Check whether --enable-video-vulkan was given. -if test "${enable_video_vulkan+set}" = set; then : +if test ${enable_video_vulkan+y} +then : enableval=$enable_video_vulkan; -else +else $as_nop enable_video_vulkan=yes fi @@ -23683,19 +26004,20 @@ #endif int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : -else +else $as_nop enable_video_vulkan=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; *-*-darwin*) save_CFLAGS="$CFLAGS" @@ -23712,19 +26034,20 @@ #endif int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : -else +else $as_nop enable_video_vulkan=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS="$save_CFLAGS" ;; *) @@ -23733,18 +26056,18 @@ if test x$enable_video_vulkan = xno; then # For reasons I am totally unable to see, I get an undefined macro error if # I put this in the AC_TRY_COMPILE. - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Vulkan does not work on this configuration." >&5 -$as_echo "$as_me: WARNING: Vulkan does not work on this configuration." >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Vulkan does not work on this configuration." >&5 +printf "%s\n" "$as_me: WARNING: Vulkan does not work on this configuration." >&2;} fi fi if test x$have_loadso != xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Vulkan support is available, but disabled because there's no loadso." >&5 -$as_echo "$as_me: WARNING: Vulkan support is available, but disabled because there's no loadso." >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Vulkan support is available, but disabled because there's no loadso." >&5 +printf "%s\n" "$as_me: WARNING: Vulkan support is available, but disabled because there's no loadso." >&2;} enable_video_vulkan=no fi if test x$enable_video_vulkan = xyes; then -$as_echo "#define SDL_VIDEO_VULKAN 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_VULKAN 1" >>confdefs.h SUMMARY_video="${SUMMARY_video} vulkan" fi @@ -23752,8 +26075,8 @@ CheckInputEvents() { - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Linux 2.4 unified input interface" >&5 -$as_echo_n "checking for Linux 2.4 unified input interface... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Linux 2.4 unified input interface" >&5 +printf %s "checking for Linux 2.4 unified input interface... " >&6; } use_input_events=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -23761,7 +26084,7 @@ #include int -main () +main (void) { #ifndef EVIOCGNAME @@ -23772,15 +26095,16 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : use_input_events=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $use_input_events" >&5 -$as_echo "$use_input_events" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $use_input_events" >&5 +printf "%s\n" "$use_input_events" >&6; } if test x$use_input_events = xyes; then -$as_echo "#define SDL_INPUT_LINUXEV 1" >>confdefs.h +printf "%s\n" "#define SDL_INPUT_LINUXEV 1" >>confdefs.h SUMMARY_input="${SUMMARY_input} linuxev" fi @@ -23788,8 +26112,8 @@ CheckInputKD() { - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Linux kd.h" >&5 -$as_echo_n "checking for Linux kd.h... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Linux kd.h" >&5 +printf %s "checking for Linux kd.h... " >&6; } use_input_kd=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -23798,7 +26122,7 @@ #include int -main () +main (void) { struct kbentry kbe; @@ -23809,15 +26133,16 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : use_input_kd=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $use_input_kd" >&5 -$as_echo "$use_input_kd" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $use_input_kd" >&5 +printf "%s\n" "$use_input_kd" >&6; } if test x$use_input_kd = xyes; then -$as_echo "#define SDL_INPUT_LINUXKD 1" >>confdefs.h +printf "%s\n" "#define SDL_INPUT_LINUXKD 1" >>confdefs.h SUMMARY_input="${SUMMARY_input} linuxkd" fi @@ -23825,8 +26150,8 @@ CheckInputKBIO() { - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FreeBSD kbio.h" >&5 -$as_echo_n "checking for FreeBSD kbio.h... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for FreeBSD kbio.h" >&5 +printf %s "checking for FreeBSD kbio.h... " >&6; } use_input_kbio=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -23835,7 +26160,7 @@ #include int -main () +main (void) { accentmap_t accTable; @@ -23845,15 +26170,16 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : use_input_kbio=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $use_input_kbio" >&5 -$as_echo "$use_input_kbio" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $use_input_kbio" >&5 +printf "%s\n" "$use_input_kbio" >&6; } if test x$use_input_kbio = xyes; then -$as_echo "#define SDL_INPUT_FBSDKBIO 1" >>confdefs.h +printf "%s\n" "#define SDL_INPUT_FBSDKBIO 1" >>confdefs.h SUMMARY_input="${SUMMARY_input} fbsdkbio" fi @@ -23861,8 +26187,8 @@ CheckInputWSCONS() { - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenBSD wscons" >&5 -$as_echo_n "checking for OpenBSD wscons... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OpenBSD wscons" >&5 +printf %s "checking for OpenBSD wscons... " >&6; } use_input_wscons=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -23874,7 +26200,7 @@ #include int -main () +main (void) { struct wskbd_map_data data; @@ -23884,15 +26210,16 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : use_input_wscons=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $use_input_wscons" >&5 -$as_echo "$use_input_wscons" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $use_input_wscons" >&5 +printf "%s\n" "$use_input_wscons" >&6; } if test x$use_input_wscons = xyes; then -$as_echo "#define SDL_INPUT_WSCONS 1" >>confdefs.h +printf "%s\n" "#define SDL_INPUT_WSCONS 1" >>confdefs.h SUMMARY_input="${SUMMARY_input} wscons" fi @@ -23901,33 +26228,32 @@ CheckLibUDev() { # Check whether --enable-libudev was given. -if test "${enable_libudev+set}" = set; then : +if test ${enable_libudev+y} +then : enableval=$enable_libudev; -else +else $as_nop enable_libudev=yes fi if test x$enable_libudev = xyes; then - ac_fn_c_check_header_mongrel "$LINENO" "libudev.h" "ac_cv_header_libudev_h" "$ac_includes_default" -if test "x$ac_cv_header_libudev_h" = xyes; then : + ac_fn_c_check_header_compile "$LINENO" "libudev.h" "ac_cv_header_libudev_h" "$ac_includes_default" +if test "x$ac_cv_header_libudev_h" = xyes +then : have_libudev_h_hdr=yes -else +else $as_nop have_libudev_h_hdr=no fi - if test x$have_libudev_h_hdr = xyes; then -$as_echo "#define HAVE_LIBUDEV_H 1" >>confdefs.h +printf "%s\n" "#define HAVE_LIBUDEV_H 1" >>confdefs.h udev_lib=`find_lib "libudev.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'` if test x$udev_lib != x; then echo "-- dynamic udev -> $udev_lib" -cat >>confdefs.h <<_ACEOF -#define SDL_UDEV_DYNAMIC "$udev_lib" -_ACEOF +printf "%s\n" "#define SDL_UDEV_DYNAMIC \"$udev_lib\"" >>confdefs.h fi fi @@ -23937,26 +26263,27 @@ CheckDBus() { # Check whether --enable-dbus was given. -if test "${enable_dbus+set}" = set; then : +if test ${enable_dbus+y} +then : enableval=$enable_dbus; -else +else $as_nop enable_dbus=yes fi if test x$enable_dbus = xyes; then pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dbus-1" >&5 -$as_echo_n "checking for dbus-1... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dbus-1" >&5 +printf %s "checking for dbus-1... " >&6; } if test -n "$DBUS_CFLAGS"; then pkg_cv_DBUS_CFLAGS="$DBUS_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dbus-1\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dbus-1\""; } >&5 ($PKG_CONFIG --exists --print-errors "dbus-1") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_DBUS_CFLAGS=`$PKG_CONFIG --cflags "dbus-1" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -23970,10 +26297,10 @@ pkg_cv_DBUS_LIBS="$DBUS_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dbus-1\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dbus-1\""; } >&5 ($PKG_CONFIG --exists --print-errors "dbus-1") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_DBUS_LIBS=`$PKG_CONFIG --libs "dbus-1" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -23987,8 +26314,8 @@ if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -24005,30 +26332,30 @@ have_dbus=no elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } have_dbus=no else DBUS_CFLAGS=$pkg_cv_DBUS_CFLAGS DBUS_LIBS=$pkg_cv_DBUS_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } have_dbus=yes fi save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$save_CPPFLAGS $DBUS_CFLAGS" - ac_fn_c_check_header_mongrel "$LINENO" "dbus/dbus.h" "ac_cv_header_dbus_dbus_h" "$ac_includes_default" -if test "x$ac_cv_header_dbus_dbus_h" = xyes; then : + ac_fn_c_check_header_compile "$LINENO" "dbus/dbus.h" "ac_cv_header_dbus_dbus_h" "$ac_includes_default" +if test "x$ac_cv_header_dbus_dbus_h" = xyes +then : have_dbus_dbus_h_hdr=yes -else +else $as_nop have_dbus_dbus_h_hdr=no fi - CPPFLAGS="$save_CPPFLAGS" if test x$have_dbus_dbus_h_hdr = xyes; then -$as_echo "#define HAVE_DBUS_DBUS_H 1" >>confdefs.h +printf "%s\n" "#define HAVE_DBUS_DBUS_H 1" >>confdefs.h EXTRA_CFLAGS="$EXTRA_CFLAGS $DBUS_CFLAGS" SOURCES="$SOURCES $srcdir/src/core/linux/SDL_dbus.c" @@ -24039,15 +26366,16 @@ CheckIME() { # Check whether --enable-ime was given. -if test "${enable_ime+set}" = set; then : +if test ${enable_ime+y} +then : enableval=$enable_ime; -else +else $as_nop enable_ime=yes fi if test x$enable_ime = xyes; then -$as_echo "#define SDL_USE_IME 1" >>confdefs.h +printf "%s\n" "#define SDL_USE_IME 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ime.c" fi @@ -24057,49 +26385,43 @@ { save_LIBS="$LIBS" case "$host" in - *-*-freebsd*) LIBS="$LIBS -linotify" + *-*-freebsd*|*-*dragonfly*) LIBS="$LIBS -linotify" ;; esac - for ac_header in sys/inotify.h + for ac_header in sys/inotify.h do : - ac_fn_c_check_header_mongrel "$LINENO" "sys/inotify.h" "ac_cv_header_sys_inotify_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_inotify_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SYS_INOTIFY_H 1 -_ACEOF + ac_fn_c_check_header_compile "$LINENO" "sys/inotify.h" "ac_cv_header_sys_inotify_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_inotify_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_INOTIFY_H 1" >>confdefs.h have_inotify_inotify_h_hdr=yes fi done - for ac_func in inotify_init + for ac_func in inotify_init do : ac_fn_c_check_func "$LINENO" "inotify_init" "ac_cv_func_inotify_init" -if test "x$ac_cv_func_inotify_init" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_INOTIFY_INIT 1 -_ACEOF +if test "x$ac_cv_func_inotify_init" = xyes +then : + printf "%s\n" "#define HAVE_INOTIFY_INIT 1" >>confdefs.h have_inotify=yes fi -done - for ac_func in inotify_init1 -do : - ac_fn_c_check_func "$LINENO" "inotify_init1" "ac_cv_func_inotify_init1" -if test "x$ac_cv_func_inotify_init1" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_INOTIFY_INIT1 1 -_ACEOF +done + ac_fn_c_check_func "$LINENO" "inotify_init1" "ac_cv_func_inotify_init1" +if test "x$ac_cv_func_inotify_init1" = xyes +then : + printf "%s\n" "#define HAVE_INOTIFY_INIT1 1" >>confdefs.h fi -done if test x$have_inotify_inotify_h_hdr = xyes -a x$have_inotify = xyes; then -$as_echo "#define HAVE_INOTIFY 1" >>confdefs.h +printf "%s\n" "#define HAVE_INOTIFY 1" >>confdefs.h case "$host" in - *-*-freebsd*) + *-*-freebsd*|*-*-dragonfly*) EXTRA_LDFLAGS="$EXTRA_LDFLAGS -linotify" ;; esac @@ -24110,26 +26432,27 @@ CheckIBus() { # Check whether --enable-ibus was given. -if test "${enable_ibus+set}" = set; then : +if test ${enable_ibus+y} +then : enableval=$enable_ibus; -else +else $as_nop enable_ibus=yes fi if test x$enable_ibus = xyes; then pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ibus-1.0" >&5 -$as_echo_n "checking for ibus-1.0... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ibus-1.0" >&5 +printf %s "checking for ibus-1.0... " >&6; } if test -n "$IBUS_CFLAGS"; then pkg_cv_IBUS_CFLAGS="$IBUS_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ibus-1.0\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ibus-1.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "ibus-1.0") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_IBUS_CFLAGS=`$PKG_CONFIG --cflags "ibus-1.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -24143,10 +26466,10 @@ pkg_cv_IBUS_LIBS="$IBUS_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ibus-1.0\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ibus-1.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "ibus-1.0") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_IBUS_LIBS=`$PKG_CONFIG --libs "ibus-1.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -24160,8 +26483,8 @@ if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -24178,43 +26501,43 @@ have_ibus=no elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } have_ibus=no else IBUS_CFLAGS=$pkg_cv_IBUS_CFLAGS IBUS_LIBS=$pkg_cv_IBUS_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } have_ibus=yes fi save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$save_CPPFLAGS $IBUS_CFLAGS" - ac_fn_c_check_header_mongrel "$LINENO" "ibus-1.0/ibus.h" "ac_cv_header_ibus_1_0_ibus_h" "$ac_includes_default" -if test "x$ac_cv_header_ibus_1_0_ibus_h" = xyes; then : + ac_fn_c_check_header_compile "$LINENO" "ibus-1.0/ibus.h" "ac_cv_header_ibus_1_0_ibus_h" "$ac_includes_default" +if test "x$ac_cv_header_ibus_1_0_ibus_h" = xyes +then : have_ibus_ibus_h_hdr=yes -else +else $as_nop have_ibus_ibus_h_hdr=no fi - CPPFLAGS="$save_CPPFLAGS" if test x$have_ibus_ibus_h_hdr = xyes; then if test x$enable_ime != xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: IME support is required for IBus." >&5 -$as_echo "$as_me: WARNING: IME support is required for IBus." >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: IME support is required for IBus." >&5 +printf "%s\n" "$as_me: WARNING: IME support is required for IBus." >&2;} have_ibus_ibus_h_hdr=no elif test x$enable_dbus != xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: DBus support is required for IBus." >&5 -$as_echo "$as_me: WARNING: DBus support is required for IBus." >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: DBus support is required for IBus." >&5 +printf "%s\n" "$as_me: WARNING: DBus support is required for IBus." >&2;} have_ibus_ibus_h_hdr=no elif test x$have_inotify_inotify_h_hdr != xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: INotify support is required for IBus." >&5 -$as_echo "$as_me: WARNING: INotify support is required for IBus." >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: INotify support is required for IBus." >&5 +printf "%s\n" "$as_me: WARNING: INotify support is required for IBus." >&2;} have_ibus_ibus_h_hdr=no else -$as_echo "#define HAVE_IBUS_IBUS_H 1" >>confdefs.h +printf "%s\n" "#define HAVE_IBUS_IBUS_H 1" >>confdefs.h EXTRA_CFLAGS="$EXTRA_CFLAGS $IBUS_CFLAGS" SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ibus.c" @@ -24226,40 +26549,42 @@ CheckFcitx() { # Check whether --enable-fcitx was given. -if test "${enable_fcitx+set}" = set; then : +if test ${enable_fcitx+y} +then : enableval=$enable_fcitx; -else +else $as_nop enable_fcitx=yes fi if test x$enable_fcitx = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fcitx support" >&5 -$as_echo_n "checking for fcitx support... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fcitx support" >&5 +printf %s "checking for fcitx support... " >&6; } have_fcitx=no if test x$enable_ime != xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: IME support is required for fcitx." >&5 -$as_echo "$as_me: WARNING: IME support is required for fcitx." >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: IME support is required for fcitx." >&5 +printf "%s\n" "$as_me: WARNING: IME support is required for fcitx." >&2;} elif test x$have_dbus_dbus_h_hdr != xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: DBus support is required for fcitx." >&5 -$as_echo "$as_me: WARNING: DBus support is required for fcitx." >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: DBus support is required for fcitx." >&5 +printf "%s\n" "$as_me: WARNING: DBus support is required for fcitx." >&2;} else have_fcitx=yes -$as_echo "#define HAVE_FCITX 1" >>confdefs.h +printf "%s\n" "#define HAVE_FCITX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/core/linux/SDL_fcitx.c" fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_fcitx" >&5 -$as_echo "$have_fcitx" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_fcitx" >&5 +printf "%s\n" "$have_fcitx" >&6; } fi } CheckJoystickMFI() { # Check whether --enable-joystick-mfi was given. -if test "${enable_joystick_mfi+set}" = set; then : +if test ${enable_joystick_mfi+y} +then : enableval=$enable_joystick_mfi; -else +else $as_nop enable_joystick_mfi=yes fi @@ -24269,8 +26594,8 @@ save_LDFLAGS="$LDFLAGS" CFLAGS="$CFLAGS -x objective-c -fobjc-weak" LDFLAGS="$LDFLAGS -Wl,-weak_framework,CoreHaptics -Wl,-weak_framework,GameController" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GameController framework" >&5 -$as_echo_n "checking for GameController framework... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GameController framework" >&5 +printf %s "checking for GameController framework... " >&6; } enable_joystick_mfi=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -24280,7 +26605,7 @@ #import int -main () +main (void) { #if MAC_OS_X_VERSION_MIN_REQUIRED < 1080 @@ -24294,19 +26619,20 @@ return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : enable_joystick_mfi=yes fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$save_CFLAGS" LDFLAGS="$save_LDFLAGS" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_joystick_mfi" >&5 -$as_echo "$enable_joystick_mfi" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_joystick_mfi" >&5 +printf "%s\n" "$enable_joystick_mfi" >&6; } if test x$enable_joystick_mfi = xyes; then -$as_echo "#define SDL_JOYSTICK_MFI 1" >>confdefs.h +printf "%s\n" "#define SDL_JOYSTICK_MFI 1" >>confdefs.h EXTRA_CFLAGS="$EXTRA_CFLAGS -fobjc-weak -Wno-unused-command-line-argument" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-weak_framework,CoreHaptics -Wl,-weak_framework,GameController" @@ -24328,16 +26654,18 @@ esac # Check whether --enable-pthreads was given. -if test "${enable_pthreads+set}" = set; then : +if test ${enable_pthreads+y} +then : enableval=$enable_pthreads; -else +else $as_nop enable_pthreads=maybe fi # Check whether --enable-pthread-sem was given. -if test "${enable_pthread_sem+set}" = set; then : +if test ${enable_pthread_sem+y} +then : enableval=$enable_pthread_sem; -else +else $as_nop enable_pthread_sem=maybe fi @@ -24429,8 +26757,8 @@ # Add the pthread compiler flags and libraries CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib" # Check to see if we have pthread support on this system - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthreads" >&5 -$as_echo_n "checking for pthreads... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthreads" >&5 +printf %s "checking for pthreads... " >&6; } use_pthreads=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -24438,7 +26766,7 @@ #include int -main () +main (void) { pthread_attr_t type; @@ -24448,20 +26776,21 @@ return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : use_pthreads=yes fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $use_pthreads" >&5 -$as_echo "$use_pthreads" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $use_pthreads" >&5 +printf "%s\n" "$use_pthreads" >&6; } # Restore the compiler flags and libraries CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs" # Do futher testing if we have pthread support... if test x$use_pthreads = xyes; then -$as_echo "#define SDL_THREAD_PTHREAD 1" >>confdefs.h +printf "%s\n" "#define SDL_THREAD_PTHREAD 1" >>confdefs.h EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags" EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib" @@ -24473,8 +26802,8 @@ CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib" # Check to see if recursive mutexes are available - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for recursive mutexes" >&5 -$as_echo_n "checking for recursive mutexes... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for recursive mutexes" >&5 +printf %s "checking for recursive mutexes... " >&6; } has_recursive_mutexes=no if test x$has_recursive_mutexes = xno; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -24484,7 +26813,7 @@ #include int -main () +main (void) { pthread_mutexattr_t attr; @@ -24494,15 +26823,16 @@ return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : has_recursive_mutexes=yes -$as_echo "#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1" >>confdefs.h +printf "%s\n" "#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1" >>confdefs.h fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi if test x$has_recursive_mutexes = xno; then @@ -24513,7 +26843,7 @@ #include int -main () +main (void) { pthread_mutexattr_t attr; @@ -24523,24 +26853,25 @@ return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : has_recursive_mutexes=yes -$as_echo "#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1" >>confdefs.h +printf "%s\n" "#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1" >>confdefs.h fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $has_recursive_mutexes" >&5 -$as_echo "$has_recursive_mutexes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $has_recursive_mutexes" >&5 +printf "%s\n" "$has_recursive_mutexes" >&6; } # Check to see if pthread semaphore support is missing if test x$enable_pthread_sem = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread semaphores" >&5 -$as_echo_n "checking for pthread semaphores... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread semaphores" >&5 +printf %s "checking for pthread semaphores... " >&6; } have_pthread_sem=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -24549,23 +26880,24 @@ #include int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_pthread_sem=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_pthread_sem" >&5 -$as_echo "$have_pthread_sem" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_pthread_sem" >&5 +printf "%s\n" "$have_pthread_sem" >&6; } fi if test x$have_pthread_sem = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sem_timedwait" >&5 -$as_echo_n "checking for sem_timedwait... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sem_timedwait" >&5 +printf %s "checking for sem_timedwait... " >&6; } have_sem_timedwait=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -24574,7 +26906,7 @@ #include int -main () +main (void) { sem_timedwait(NULL, NULL); @@ -24583,109 +26915,106 @@ return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : have_sem_timedwait=yes -$as_echo "#define HAVE_SEM_TIMEDWAIT 1" >>confdefs.h +printf "%s\n" "#define HAVE_SEM_TIMEDWAIT 1" >>confdefs.h fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_sem_timedwait" >&5 -$as_echo "$have_sem_timedwait" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_sem_timedwait" >&5 +printf "%s\n" "$have_sem_timedwait" >&6; } fi ac_fn_c_check_header_compile "$LINENO" "pthread_np.h" "ac_cv_header_pthread_np_h" " #include " -if test "x$ac_cv_header_pthread_np_h" = xyes; then : +if test "x$ac_cv_header_pthread_np_h" = xyes +then : have_pthread_np_h=yes -else +else $as_nop have_pthread_np_h=no fi - if test x$have_pthread_np_h = xyes; then -$as_echo "#define HAVE_PTHREAD_NP_H 1" >>confdefs.h +printf "%s\n" "#define HAVE_PTHREAD_NP_H 1" >>confdefs.h fi # Check to see if pthread naming is available - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_setname_np" >&5 -$as_echo_n "checking for pthread_setname_np... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_setname_np" >&5 +printf %s "checking for pthread_setname_np... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char pthread_setname_np (); int -main () +main (void) { return pthread_setname_np (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : has_pthread_setname_np=yes -$as_echo "#define HAVE_PTHREAD_SETNAME_NP 1" >>confdefs.h +printf "%s\n" "#define HAVE_PTHREAD_SETNAME_NP 1" >>confdefs.h -else +else $as_nop has_pthread_setname_np=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $has_pthread_setname_np" >&5 -$as_echo "$has_pthread_setname_np" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $has_pthread_setname_np" >&5 +printf "%s\n" "$has_pthread_setname_np" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_set_name_np" >&5 -$as_echo_n "checking for pthread_set_name_np... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_set_name_np" >&5 +printf %s "checking for pthread_set_name_np... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char pthread_set_name_np (); int -main () +main (void) { return pthread_set_name_np (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : has_pthread_set_name_np=yes -$as_echo "#define HAVE_PTHREAD_SET_NAME_NP 1" >>confdefs.h +printf "%s\n" "#define HAVE_PTHREAD_SET_NAME_NP 1" >>confdefs.h -else +else $as_nop has_pthread_set_name_np=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $has_pthread_set_name_np" >&5 -$as_echo "$has_pthread_set_name_np" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $has_pthread_set_name_np" >&5 +printf "%s\n" "$has_pthread_set_name_np" >&6; } # Restore the compiler flags and libraries CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs" @@ -24719,8 +27048,8 @@ CheckWINDOWS() { - { $as_echo "$as_me:${as_lineno-$LINENO}: checking Windows compiler" >&5 -$as_echo_n "checking Windows compiler... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking Windows compiler" >&5 +printf %s "checking Windows compiler... " >&6; } have_win32_gcc=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -24728,27 +27057,28 @@ #include int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_win32_gcc=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_win32_gcc" >&5 -$as_echo "$have_win32_gcc" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_win32_gcc" >&5 +printf "%s\n" "$have_win32_gcc" >&6; } if test x$have_win32_gcc != xyes; then as_fn_error $? " *** Your compiler ($CC) does not produce Windows executables! " "$LINENO" 5 fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking Windows CE" >&5 -$as_echo_n "checking Windows CE... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking Windows CE" >&5 +printf %s "checking Windows CE... " >&6; } have_wince=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -24758,14 +27088,15 @@ #endif int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_wince=yes as_fn_error $? " @@ -24773,60 +27104,72 @@ " "$LINENO" 5 fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_wince" >&5 -$as_echo "$have_wince" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_wince" >&5 +printf "%s\n" "$have_wince" >&6; } # This fixes Windows stack alignment with newer GCC CheckStackBoundary # headers needed elsewhere - ac_fn_c_check_header_mongrel "$LINENO" "tpcshrd.h" "ac_cv_header_tpcshrd_h" "$ac_includes_default" -if test "x$ac_cv_header_tpcshrd_h" = xyes; then : + ac_fn_c_check_header_compile "$LINENO" "tpcshrd.h" "ac_cv_header_tpcshrd_h" "$ac_includes_default" +if test "x$ac_cv_header_tpcshrd_h" = xyes +then : have_tpcshrd_h=yes fi - if test x$have_tpcshrd_h = xyes; then -$as_echo "#define HAVE_TPCSHRD_H 1" >>confdefs.h +printf "%s\n" "#define HAVE_TPCSHRD_H 1" >>confdefs.h fi - ac_fn_c_check_header_mongrel "$LINENO" "roapi.h" "ac_cv_header_roapi_h" "$ac_includes_default" -if test "x$ac_cv_header_roapi_h" = xyes; then : + ac_fn_c_check_header_compile "$LINENO" "roapi.h" "ac_cv_header_roapi_h" "$ac_includes_default" +if test "x$ac_cv_header_roapi_h" = xyes +then : have_roapi_h=yes fi - if test x$have_roapi_h = xyes; then -$as_echo "#define HAVE_ROAPI_H 1" >>confdefs.h +printf "%s\n" "#define HAVE_ROAPI_H 1" >>confdefs.h + + fi + ac_fn_c_check_header_compile "$LINENO" "shellscalingapi.h" "ac_cv_header_shellscalingapi_h" "$ac_includes_default" +if test "x$ac_cv_header_shellscalingapi_h" = xyes +then : + have_shellscalingapi_h=yes +fi + + if test x$shellscalingapi_h = xyes; then + +printf "%s\n" "#define HAVE_SHELLSCALINGAPI_H 1" >>confdefs.h fi } CheckOS2() { - { $as_echo "$as_me:${as_lineno-$LINENO}: checking OS/2 compiler" >&5 -$as_echo_n "checking OS/2 compiler... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking OS/2 compiler" >&5 +printf %s "checking OS/2 compiler... " >&6; } have_os2_gcc=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_os2_gcc=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_os2_gcc" >&5 -$as_echo "$have_os2_gcc" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_os2_gcc" >&5 +printf "%s\n" "$have_os2_gcc" >&6; } if test x$have_os2_gcc != xyes; then as_fn_error $? " *** Your compiler ($CC) does not produce OS/2 executables! @@ -24837,68 +27180,99 @@ CheckDIRECTX() { # Check whether --enable-directx was given. -if test "${enable_directx+set}" = set; then : +if test ${enable_directx+y} +then : enableval=$enable_directx; -else +else $as_nop enable_directx=yes fi if test x$enable_directx = xyes; then - ac_fn_c_check_header_mongrel "$LINENO" "d3d9.h" "ac_cv_header_d3d9_h" "$ac_includes_default" -if test "x$ac_cv_header_d3d9_h" = xyes; then : + ac_fn_c_check_header_compile "$LINENO" "d3d9.h" "ac_cv_header_d3d9_h" "$ac_includes_default" +if test "x$ac_cv_header_d3d9_h" = xyes +then : have_d3d=yes fi - - ac_fn_c_check_header_mongrel "$LINENO" "d3d11_1.h" "ac_cv_header_d3d11_1_h" "$ac_includes_default" -if test "x$ac_cv_header_d3d11_1_h" = xyes; then : + ac_fn_c_check_header_compile "$LINENO" "d3d11_1.h" "ac_cv_header_d3d11_1_h" "$ac_includes_default" +if test "x$ac_cv_header_d3d11_1_h" = xyes +then : have_d3d11=yes fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for d3d12 Windows SDK version" >&5 +printf %s "checking for d3d12 Windows SDK version... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#include +ID3D12Device1 *device; +#if WDK_NTDDI_VERSION <= 0x0A000008 +asdf +#endif + +int +main (void) +{ - ac_fn_c_check_header_mongrel "$LINENO" "ddraw.h" "ac_cv_header_ddraw_h" "$ac_includes_default" -if test "x$ac_cv_header_ddraw_h" = xyes; then : + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + have_d3d12=yes +else $as_nop + have_d3d12=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_d3d12" >&5 +printf "%s\n" "$have_d3d12" >&6; } + ac_fn_c_check_header_compile "$LINENO" "ddraw.h" "ac_cv_header_ddraw_h" "$ac_includes_default" +if test "x$ac_cv_header_ddraw_h" = xyes +then : have_ddraw=yes fi - - ac_fn_c_check_header_mongrel "$LINENO" "dsound.h" "ac_cv_header_dsound_h" "$ac_includes_default" -if test "x$ac_cv_header_dsound_h" = xyes; then : + ac_fn_c_check_header_compile "$LINENO" "dsound.h" "ac_cv_header_dsound_h" "$ac_includes_default" +if test "x$ac_cv_header_dsound_h" = xyes +then : have_dsound=yes fi - - ac_fn_c_check_header_mongrel "$LINENO" "dinput.h" "ac_cv_header_dinput_h" "$ac_includes_default" -if test "x$ac_cv_header_dinput_h" = xyes; then : + ac_fn_c_check_header_compile "$LINENO" "dinput.h" "ac_cv_header_dinput_h" "$ac_includes_default" +if test "x$ac_cv_header_dinput_h" = xyes +then : have_dinput=yes fi - - ac_fn_c_check_header_mongrel "$LINENO" "dxgi.h" "ac_cv_header_dxgi_h" "$ac_includes_default" -if test "x$ac_cv_header_dxgi_h" = xyes; then : + ac_fn_c_check_header_compile "$LINENO" "dxgi.h" "ac_cv_header_dxgi_h" "$ac_includes_default" +if test "x$ac_cv_header_dxgi_h" = xyes +then : have_dxgi=yes fi - if test x$have_ddraw = xyes; then -$as_echo "#define HAVE_DDRAW_H 1" >>confdefs.h +printf "%s\n" "#define HAVE_DDRAW_H 1" >>confdefs.h fi if test x$have_dinput = xyes; then -$as_echo "#define HAVE_DINPUT_H 1" >>confdefs.h +printf "%s\n" "#define HAVE_DINPUT_H 1" >>confdefs.h fi if test x$have_dsound = xyes; then -$as_echo "#define HAVE_DSOUND_H 1" >>confdefs.h +printf "%s\n" "#define HAVE_DSOUND_H 1" >>confdefs.h fi if test x$have_dxgi = xyes; then -$as_echo "#define HAVE_DXGI_H 1" >>confdefs.h +printf "%s\n" "#define HAVE_DXGI_H 1" >>confdefs.h fi @@ -24912,23 +27286,24 @@ fi # Check whether --enable-xinput was given. -if test "${enable_xinput+set}" = set; then : +if test ${enable_xinput+y} +then : enableval=$enable_xinput; -else +else $as_nop enable_xinput=yes fi if test x$enable_xinput = xyes; then have_xinput_gamepadex=no have_xinput_stateex=no - ac_fn_c_check_header_mongrel "$LINENO" "xinput.h" "ac_cv_header_xinput_h" "$ac_includes_default" -if test "x$ac_cv_header_xinput_h" = xyes; then : + ac_fn_c_check_header_compile "$LINENO" "xinput.h" "ac_cv_header_xinput_h" "$ac_includes_default" +if test "x$ac_cv_header_xinput_h" = xyes +then : have_xinput=yes fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct XINPUT_GAMEPAD_EX" >&5 -$as_echo_n "checking for struct XINPUT_GAMEPAD_EX... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct XINPUT_GAMEPAD_EX" >&5 +printf %s "checking for struct XINPUT_GAMEPAD_EX... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -24937,21 +27312,22 @@ XINPUT_GAMEPAD_EX x1; int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_xinput_gamepadex=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_xinput_gamepadex" >&5 -$as_echo "$have_xinput_gamepadex" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct XINPUT_STATE_EX" >&5 -$as_echo_n "checking for struct XINPUT_STATE_EX... " >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_xinput_gamepadex" >&5 +printf "%s\n" "$have_xinput_gamepadex" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct XINPUT_STATE_EX" >&5 +printf %s "checking for struct XINPUT_STATE_EX... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -24960,39 +27336,40 @@ XINPUT_STATE_EX s1; int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_xinput_stateex=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_xinput_stateex" >&5 -$as_echo "$have_xinput_stateex" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_xinput_stateex" >&5 +printf "%s\n" "$have_xinput_stateex" >&6; } if test x$have_xinput = xyes; then -$as_echo "#define HAVE_XINPUT_H 1" >>confdefs.h +printf "%s\n" "#define HAVE_XINPUT_H 1" >>confdefs.h fi if test x$have_xinput_gamepadex = xyes; then -$as_echo "#define HAVE_XINPUT_GAMEPAD_EX 1" >>confdefs.h +printf "%s\n" "#define HAVE_XINPUT_GAMEPAD_EX 1" >>confdefs.h fi if test x$have_xinput_stateex = xyes; then -$as_echo "#define HAVE_XINPUT_STATE_EX 1" >>confdefs.h +printf "%s\n" "#define HAVE_XINPUT_STATE_EX 1" >>confdefs.h fi fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for windows.gaming.input.h" >&5 -$as_echo_n "checking for windows.gaming.input.h... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for windows.gaming.input.h" >&5 +printf %s "checking for windows.gaming.input.h... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -25001,57 +27378,59 @@ __x_ABI_CWindows_CGaming_CInput_CIGamepadStatics2 *s2; int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_wgi=yes -else +else $as_nop have_wgi=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_wgi" >&5 -$as_echo "$have_wgi" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_wgi" >&5 +printf "%s\n" "$have_wgi" >&6; } if test x$have_wgi = xyes; then -$as_echo "#define HAVE_WINDOWS_GAMING_INPUT_H 1" >>confdefs.h +printf "%s\n" "#define HAVE_WINDOWS_GAMING_INPUT_H 1" >>confdefs.h fi - ac_fn_c_check_header_mongrel "$LINENO" "mmdeviceapi.h" "ac_cv_header_mmdeviceapi_h" "$ac_includes_default" -if test "x$ac_cv_header_mmdeviceapi_h" = xyes; then : + ac_fn_c_check_header_compile "$LINENO" "mmdeviceapi.h" "ac_cv_header_mmdeviceapi_h" "$ac_includes_default" +if test "x$ac_cv_header_mmdeviceapi_h" = xyes +then : have_wasapi=yes fi - if test x$have_wasapi = xyes; then -$as_echo "#define HAVE_MMDEVICEAPI_H 1" >>confdefs.h +printf "%s\n" "#define HAVE_MMDEVICEAPI_H 1" >>confdefs.h fi - ac_fn_c_check_header_mongrel "$LINENO" "audioclient.h" "ac_cv_header_audioclient_h" "$ac_includes_default" -if test "x$ac_cv_header_audioclient_h" = xyes; then : + ac_fn_c_check_header_compile "$LINENO" "audioclient.h" "ac_cv_header_audioclient_h" "$ac_includes_default" +if test "x$ac_cv_header_audioclient_h" = xyes +then : -else +else $as_nop have_wasapi=no fi - if test x$have_wasapi = xyes; then -$as_echo "#define HAVE_AUDIOCLIENT_H 1" >>confdefs.h +printf "%s\n" "#define HAVE_AUDIOCLIENT_H 1" >>confdefs.h fi # Check whether --enable-wasapi was given. -if test "${enable_wasapi+set}" = set; then : +if test ${enable_wasapi+y} +then : enableval=$enable_wasapi; -else +else $as_nop enable_wasapi=yes fi @@ -25060,24 +27439,25 @@ CheckDLOPEN() { -$as_echo "#define DYNAPI_NEEDS_DLOPEN 1" >>confdefs.h +printf "%s\n" "#define DYNAPI_NEEDS_DLOPEN 1" >>confdefs.h - ac_fn_c_check_header_mongrel "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default" -if test "x$ac_cv_header_dlfcn_h" = xyes; then : + ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default" +if test "x$ac_cv_header_dlfcn_h" = xyes +then : have_dlfcn_h=yes -else +else $as_nop have_dlfcn_h=no fi - have_dlopen=no - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lc" >&5 -$as_echo_n "checking for dlopen in -lc... " >&6; } -if ${ac_cv_lib_c_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lc" >&5 +printf %s "checking for dlopen in -lc... " >&6; } +if test ${ac_cv_lib_c_dlopen+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lc $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -25086,37 +27466,37 @@ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char dlopen (); int -main () +main (void) { return dlopen (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_c_dlopen=yes -else +else $as_nop ac_cv_lib_c_dlopen=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_dlopen" >&5 -$as_echo "$ac_cv_lib_c_dlopen" >&6; } -if test "x$ac_cv_lib_c_dlopen" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_dlopen" >&5 +printf "%s\n" "$ac_cv_lib_c_dlopen" >&6; } +if test "x$ac_cv_lib_c_dlopen" = xyes +then : have_dlopen=yes -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +printf %s "checking for dlopen in -ldl... " >&6; } +if test ${ac_cv_lib_dl_dlopen+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -25125,47 +27505,46 @@ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char dlopen (); int -main () +main (void) { return dlopen (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_dl_dlopen=yes -else +else $as_nop ac_cv_lib_dl_dlopen=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes +then : have_dlopen=yes; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl" fi fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen" >&5 -$as_echo_n "checking for dlopen... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_dlopen" >&5 -$as_echo "$have_dlopen" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen" >&5 +printf %s "checking for dlopen... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_dlopen" >&5 +printf "%s\n" "$have_dlopen" >&6; } if test x$have_dlfcn_h = xyes -a x$have_dlopen = xyes; then -$as_echo "#define HAVE_DLOPEN 1" >>confdefs.h +printf "%s\n" "#define HAVE_DLOPEN 1" >>confdefs.h if test x$enable_loadso = xyes; then -$as_echo "#define SDL_LOADSO_DLOPEN 1" >>confdefs.h +printf "%s\n" "#define SDL_LOADSO_DLOPEN 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c" have_loadso=yes @@ -25175,8 +27554,8 @@ CheckO_CLOEXEC() { - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for O_CLOEXEC" >&5 -$as_echo_n "checking for O_CLOEXEC... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for O_CLOEXEC" >&5 +printf %s "checking for O_CLOEXEC... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -25184,24 +27563,25 @@ int flag = O_CLOEXEC; int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_o_cloexec=yes -else +else $as_nop have_o_cloexec=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_o_cloexec" >&5 -$as_echo "$have_o_cloexec" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_o_cloexec" >&5 +printf "%s\n" "$have_o_cloexec" >&6; } if test $have_o_cloexec = yes; then -$as_echo "#define HAVE_O_CLOEXEC 1" >>confdefs.h +printf "%s\n" "#define HAVE_O_CLOEXEC 1" >>confdefs.h fi } @@ -25211,11 +27591,12 @@ case "$host" in *-*-*bsd*|*-*-dragonfly*) if test x$enable_joystick = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for hid_init in -lusbhid" >&5 -$as_echo_n "checking for hid_init in -lusbhid... " >&6; } -if ${ac_cv_lib_usbhid_hid_init+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for hid_init in -lusbhid" >&5 +printf %s "checking for hid_init in -lusbhid... " >&6; } +if test ${ac_cv_lib_usbhid_hid_init+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lusbhid $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -25224,65 +27605,65 @@ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char hid_init (); int -main () +main (void) { return hid_init (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_usbhid_hid_init=yes -else +else $as_nop ac_cv_lib_usbhid_hid_init=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_usbhid_hid_init" >&5 -$as_echo "$ac_cv_lib_usbhid_hid_init" >&6; } -if test "x$ac_cv_lib_usbhid_hid_init" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_usbhid_hid_init" >&5 +printf "%s\n" "$ac_cv_lib_usbhid_hid_init" >&6; } +if test "x$ac_cv_lib_usbhid_hid_init" = xyes +then : have_libusbhid=yes fi if test x$have_libusbhid = xyes; then - ac_fn_c_check_header_mongrel "$LINENO" "usbhid.h" "ac_cv_header_usbhid_h" "$ac_includes_default" -if test "x$ac_cv_header_usbhid_h" = xyes; then : + ac_fn_c_check_header_compile "$LINENO" "usbhid.h" "ac_cv_header_usbhid_h" "$ac_includes_default" +if test "x$ac_cv_header_usbhid_h" = xyes +then : USB_CFLAGS="-DHAVE_USBHID_H" fi - - ac_fn_c_check_header_mongrel "$LINENO" "libusbhid.h" "ac_cv_header_libusbhid_h" "$ac_includes_default" -if test "x$ac_cv_header_libusbhid_h" = xyes; then : + ac_fn_c_check_header_compile "$LINENO" "libusbhid.h" "ac_cv_header_libusbhid_h" "$ac_includes_default" +if test "x$ac_cv_header_libusbhid_h" = xyes +then : USB_CFLAGS="-DHAVE_LIBUSBHID_H" fi - USB_LIBS="$USB_LIBS -lusbhid" else - ac_fn_c_check_header_mongrel "$LINENO" "usb.h" "ac_cv_header_usb_h" "$ac_includes_default" -if test "x$ac_cv_header_usb_h" = xyes; then : + ac_fn_c_check_header_compile "$LINENO" "usb.h" "ac_cv_header_usb_h" "$ac_includes_default" +if test "x$ac_cv_header_usb_h" = xyes +then : USB_CFLAGS="-DHAVE_USB_H" fi - - ac_fn_c_check_header_mongrel "$LINENO" "libusb.h" "ac_cv_header_libusb_h" "$ac_includes_default" -if test "x$ac_cv_header_libusb_h" = xyes; then : + ac_fn_c_check_header_compile "$LINENO" "libusb.h" "ac_cv_header_libusb_h" "$ac_includes_default" +if test "x$ac_cv_header_libusb_h" = xyes +then : USB_CFLAGS="-DHAVE_LIBUSB_H" fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for hid_init in -lusb" >&5 -$as_echo_n "checking for hid_init in -lusb... " >&6; } -if ${ac_cv_lib_usb_hid_init+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for hid_init in -lusb" >&5 +printf %s "checking for hid_init in -lusb... " >&6; } +if test ${ac_cv_lib_usb_hid_init+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lusb $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -25291,30 +27672,29 @@ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char hid_init (); int -main () +main (void) { return hid_init (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_usb_hid_init=yes -else +else $as_nop ac_cv_lib_usb_hid_init=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_usb_hid_init" >&5 -$as_echo "$ac_cv_lib_usb_hid_init" >&6; } -if test "x$ac_cv_lib_usb_hid_init" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_usb_hid_init" >&5 +printf "%s\n" "$ac_cv_lib_usb_hid_init" >&6; } +if test "x$ac_cv_lib_usb_hid_init" = xyes +then : USB_LIBS="$USB_LIBS -lusb" fi @@ -25323,8 +27703,8 @@ save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $USB_CFLAGS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for usbhid" >&5 -$as_echo_n "checking for usbhid... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for usbhid" >&5 +printf %s "checking for usbhid... " >&6; } have_usbhid=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -25349,7 +27729,7 @@ #endif int -main () +main (void) { struct report_desc *repdesc; @@ -25360,16 +27740,17 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_usbhid=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_usbhid" >&5 -$as_echo "$have_usbhid" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_usbhid" >&5 +printf "%s\n" "$have_usbhid" >&6; } if test x$have_usbhid = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ucr_data member of usb_ctl_report" >&5 -$as_echo_n "checking for ucr_data member of usb_ctl_report... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ucr_data member of usb_ctl_report" >&5 +printf %s "checking for ucr_data member of usb_ctl_report... " >&6; } have_usbhid_ucr_data=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -25394,7 +27775,7 @@ #endif int -main () +main (void) { struct usb_ctl_report buf; @@ -25404,18 +27785,19 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_usbhid_ucr_data=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test x$have_usbhid_ucr_data = xyes; then USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA" fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_usbhid_ucr_data" >&5 -$as_echo "$have_usbhid_ucr_data" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_usbhid_ucr_data" >&5 +printf "%s\n" "$have_usbhid_ucr_data" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for new usbhid API" >&5 -$as_echo_n "checking for new usbhid API... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for new usbhid API" >&5 +printf %s "checking for new usbhid API... " >&6; } have_usbhid_new=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -25440,7 +27822,7 @@ #endif int -main () +main (void) { report_desc_t d; @@ -25450,18 +27832,19 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_usbhid_new=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test x$have_usbhid_new = xyes; then USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW" fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_usbhid_new" >&5 -$as_echo "$have_usbhid_new" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_usbhid_new" >&5 +printf "%s\n" "$have_usbhid_new" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct joystick in machine/joystick.h" >&5 -$as_echo_n "checking for struct joystick in machine/joystick.h... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct joystick in machine/joystick.h" >&5 +printf %s "checking for struct joystick in machine/joystick.h... " >&6; } have_machine_joystick=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -25469,7 +27852,7 @@ #include int -main () +main (void) { struct joystick t; @@ -25478,20 +27861,21 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_machine_joystick=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test x$have_machine_joystick = xyes; then -$as_echo "#define SDL_HAVE_MACHINE_JOYSTICK_H 1" >>confdefs.h +printf "%s\n" "#define SDL_HAVE_MACHINE_JOYSTICK_H 1" >>confdefs.h fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_machine_joystick" >&5 -$as_echo "$have_machine_joystick" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_machine_joystick" >&5 +printf "%s\n" "$have_machine_joystick" >&6; } -$as_echo "#define SDL_JOYSTICK_USBHID 1" >>confdefs.h +printf "%s\n" "#define SDL_JOYSTICK_USBHID 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS" @@ -25508,16 +27892,18 @@ CheckHIDAPI() { # Check whether --enable-hidapi-joystick was given. -if test "${enable_hidapi_joystick+set}" = set; then : +if test ${enable_hidapi_joystick+y} +then : enableval=$enable_hidapi_joystick; -else +else $as_nop enable_hidapi_joystick=yes fi # Check whether --enable-hidapi-libusb was given. -if test "${enable_hidapi_libusb+set}" = set; then : +if test ${enable_hidapi_libusb+y} +then : enableval=$enable_hidapi_libusb; -else +else $as_nop enable_hidapi_libusb=maybe fi @@ -25542,17 +27928,17 @@ if test x$enable_hidapi_libusb = xyes; then pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libusb-1.0" >&5 -$as_echo_n "checking for libusb-1.0... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libusb-1.0" >&5 +printf %s "checking for libusb-1.0... " >&6; } if test -n "$LIBUSB_CFLAGS"; then pkg_cv_LIBUSB_CFLAGS="$LIBUSB_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libusb-1.0\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libusb-1.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "libusb-1.0") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBUSB_CFLAGS=`$PKG_CONFIG --cflags "libusb-1.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -25566,10 +27952,10 @@ pkg_cv_LIBUSB_LIBS="$LIBUSB_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libusb-1.0\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libusb-1.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "libusb-1.0") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBUSB_LIBS=`$PKG_CONFIG --libs "libusb-1.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -25583,8 +27969,8 @@ if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -25601,26 +27987,26 @@ have_libusb=no elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } have_libusb=no else LIBUSB_CFLAGS=$pkg_cv_LIBUSB_CFLAGS LIBUSB_LIBS=$pkg_cv_LIBUSB_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } have_libusb=yes fi save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$save_CPPFLAGS $LIBUSB_CFLAGS" - ac_fn_c_check_header_mongrel "$LINENO" "libusb.h" "ac_cv_header_libusb_h" "$ac_includes_default" -if test "x$ac_cv_header_libusb_h" = xyes; then : + ac_fn_c_check_header_compile "$LINENO" "libusb.h" "ac_cv_header_libusb_h" "$ac_includes_default" +if test "x$ac_cv_header_libusb_h" = xyes +then : have_libusb_h=yes -else +else $as_nop have_libusb_h=no fi - CPPFLAGS="$save_CPPFLAGS" if test x$have_libusb_h = xno && test x$require_hidapi_libusb = xyes; then hidapi_support=no @@ -25634,8 +28020,8 @@ EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LIBS" else if test x$have_loadso != xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic libusb loading" >&5 -$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic libusb loading" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic libusb loading" >&5 +printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic libusb loading" >&2;} fi # libusb is loaded dynamically, so don't add it to LDFLAGS libusb_lib="" @@ -25654,23 +28040,21 @@ libusb_lib=`find_lib "libusb-1.0.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'` fi -cat >>confdefs.h <<_ACEOF -#define SDL_LIBUSB_DYNAMIC "$libusb_lib" -_ACEOF +printf "%s\n" "#define SDL_LIBUSB_DYNAMIC \"$libusb_lib\"" >>confdefs.h fi fi fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for hidapi joystick support" >&5 -$as_echo_n "checking for hidapi joystick support... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hidapi_support" >&5 -$as_echo "$hidapi_support" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for hidapi joystick support" >&5 +printf %s "checking for hidapi joystick support... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hidapi_support" >&5 +printf "%s\n" "$hidapi_support" >&6; } fi if test x$enable_joystick = xyes -a x$hidapi_support = xyes -a x$enable_hidapi_joystick = xyes; then -$as_echo "#define SDL_JOYSTICK_HIDAPI 1" >>confdefs.h +printf "%s\n" "#define SDL_JOYSTICK_HIDAPI 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c" fi @@ -25679,18 +28063,20 @@ CheckClockGettime() { # Check whether --enable-clock_gettime was given. -if test "${enable_clock_gettime+set}" = set; then : +if test ${enable_clock_gettime+y} +then : enableval=$enable_clock_gettime; -else +else $as_nop enable_clock_gettime=yes fi if test x$enable_clock_gettime = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5 -$as_echo_n "checking for clock_gettime in -lrt... " >&6; } -if ${ac_cv_lib_rt_clock_gettime+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5 +printf %s "checking for clock_gettime in -lrt... " >&6; } +if test ${ac_cv_lib_rt_clock_gettime+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lrt $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -25699,44 +28085,44 @@ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char clock_gettime (); int -main () +main (void) { return clock_gettime (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_rt_clock_gettime=yes -else +else $as_nop ac_cv_lib_rt_clock_gettime=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_clock_gettime" >&5 -$as_echo "$ac_cv_lib_rt_clock_gettime" >&6; } -if test "x$ac_cv_lib_rt_clock_gettime" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_clock_gettime" >&5 +printf "%s\n" "$ac_cv_lib_rt_clock_gettime" >&6; } +if test "x$ac_cv_lib_rt_clock_gettime" = xyes +then : have_clock_gettime=yes fi if test x$have_clock_gettime = xyes; then -$as_echo "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h +printf "%s\n" "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt" else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lc" >&5 -$as_echo_n "checking for clock_gettime in -lc... " >&6; } -if ${ac_cv_lib_c_clock_gettime+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lc" >&5 +printf %s "checking for clock_gettime in -lc... " >&6; } +if test ${ac_cv_lib_c_clock_gettime+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lc $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -25745,36 +28131,35 @@ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char clock_gettime (); int -main () +main (void) { return clock_gettime (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_c_clock_gettime=yes -else +else $as_nop ac_cv_lib_c_clock_gettime=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_clock_gettime" >&5 -$as_echo "$ac_cv_lib_c_clock_gettime" >&6; } -if test "x$ac_cv_lib_c_clock_gettime" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_clock_gettime" >&5 +printf "%s\n" "$ac_cv_lib_c_clock_gettime" >&6; } +if test "x$ac_cv_lib_c_clock_gettime" = xyes +then : have_clock_gettime=yes fi if test x$have_clock_gettime = xyes; then -$as_echo "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h +printf "%s\n" "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h EXTRA_LDFLAGS="$EXTRA_LDFLAGS" fi @@ -25784,12 +28169,12 @@ CheckLinuxVersion() { - ac_fn_c_check_header_mongrel "$LINENO" "linux/version.h" "ac_cv_header_linux_version_h" "$ac_includes_default" -if test "x$ac_cv_header_linux_version_h" = xyes; then : + ac_fn_c_check_header_compile "$LINENO" "linux/version.h" "ac_cv_header_linux_version_h" "$ac_includes_default" +if test "x$ac_cv_header_linux_version_h" = xyes +then : have_linux_version_h=yes fi - if test x$have_linux_version_h = xyes; then EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H" fi @@ -25798,9 +28183,10 @@ CheckRPATH() { # Check whether --enable-rpath was given. -if test "${enable_rpath+set}" = set; then : +if test ${enable_rpath+y} +then : enableval=$enable_rpath; -else +else $as_nop enable_rpath=yes fi @@ -25809,9 +28195,10 @@ CheckEventSignals() { # Check whether --enable-backgrounding-signal was given. -if test "${enable_backgrounding_signal+set}" = set; then : +if test ${enable_backgrounding_signal+y} +then : enableval=$enable_backgrounding_signal; -else +else $as_nop enable_backgrounding_signal=no fi @@ -25820,9 +28207,10 @@ fi # Check whether --enable-foregrounding-signal was given. -if test "${enable_foregrounding_signal+set}" = set; then : +if test ${enable_foregrounding_signal+y} +then : enableval=$enable_foregrounding_signal; -else +else $as_nop enable_foregrounding_signal=no fi @@ -25834,15 +28222,16 @@ CheckVirtualJoystick() { # Check whether --enable-joystick-virtual was given. -if test "${enable_joystick_virtual+set}" = set; then : +if test ${enable_joystick_virtual+y} +then : enableval=$enable_joystick_virtual; -else +else $as_nop enable_joystick_virtual=yes fi if test x$enable_joystick = xyes -a x$enable_joystick_virtual = xyes; then -$as_echo "#define SDL_JOYSTICK_VIRTUAL 1" >>confdefs.h +printf "%s\n" "#define SDL_JOYSTICK_VIRTUAL 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/joystick/virtual/*.c" have_joystick_virtual=yes @@ -25871,7 +28260,7 @@ if test x$enable_video = xyes; then SOURCES="$SOURCES $srcdir/src/core/android/*.c $srcdir/src/video/android/*.c" -$as_echo "#define SDL_VIDEO_DRIVER_ANDROID 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_DRIVER_ANDROID 1" >>confdefs.h SUMMARY_video="${SUMMARY_video} android" have_video=yes @@ -25971,7 +28360,7 @@ case $ARCH in sysv5|solaris|hpux) -$as_echo "#define SDL_AUDIO_DRIVER_SUNAUDIO 1" >>confdefs.h +printf "%s\n" "#define SDL_AUDIO_DRIVER_SUNAUDIO 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/sun/*.c" SUMMARY_audio="${SUMMARY_audio} sun" @@ -25979,7 +28368,7 @@ ;; netbsd) # Don't use this on OpenBSD, it's busted. -$as_echo "#define SDL_AUDIO_DRIVER_NETBSD 1" >>confdefs.h +printf "%s\n" "#define SDL_AUDIO_DRIVER_NETBSD 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/netbsd/*.c" SUMMARY_audio="${SUMMARY_audio} netbsd" @@ -25987,7 +28376,7 @@ ;; aix) -$as_echo "#define SDL_AUDIO_DRIVER_PAUDIO 1" >>confdefs.h +printf "%s\n" "#define SDL_AUDIO_DRIVER_PAUDIO 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c" SUMMARY_audio="${SUMMARY_audio} paudio" @@ -25995,19 +28384,19 @@ ;; android) -$as_echo "#define SDL_AUDIO_DRIVER_ANDROID 1" >>confdefs.h +printf "%s\n" "#define SDL_AUDIO_DRIVER_ANDROID 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/android/*.c" SUMMARY_audio="${SUMMARY_audio} android" -$as_echo "#define SDL_AUDIO_DRIVER_OPENSLES 1" >>confdefs.h +printf "%s\n" "#define SDL_AUDIO_DRIVER_OPENSLES 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/openslES/*.c" SUMMARY_audio="${SUMMARY_audio} openslES" -$as_echo "#define SDL_AUDIO_DRIVER_AAUDIO 1" >>confdefs.h +printf "%s\n" "#define SDL_AUDIO_DRIVER_AAUDIO 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/aaudio/*.c" SUMMARY_audio="${SUMMARY_audio} aaudio" @@ -26024,7 +28413,7 @@ case $ARCH in linux) -$as_echo "#define SDL_JOYSTICK_LINUX 1" >>confdefs.h +printf "%s\n" "#define SDL_JOYSTICK_LINUX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c" SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" @@ -26033,7 +28422,7 @@ freebsd) if test x$use_input_events = xyes; then -$as_echo "#define SDL_JOYSTICK_LINUX 1" >>confdefs.h +printf "%s\n" "#define SDL_JOYSTICK_LINUX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c" SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" @@ -26042,7 +28431,7 @@ ;; android) -$as_echo "#define SDL_JOYSTICK_ANDROID 1" >>confdefs.h +printf "%s\n" "#define SDL_JOYSTICK_ANDROID 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/joystick/android/*.c" SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" @@ -26056,7 +28445,7 @@ linux|freebsd) if test x$use_input_events = xyes; then -$as_echo "#define SDL_HAPTIC_LINUX 1" >>confdefs.h +printf "%s\n" "#define SDL_HAPTIC_LINUX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c" have_haptic=yes @@ -26064,7 +28453,7 @@ ;; android) -$as_echo "#define SDL_HAPTIC_ANDROID 1" >>confdefs.h +printf "%s\n" "#define SDL_HAPTIC_ANDROID 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/haptic/android/*.c" have_haptic=yes @@ -26076,7 +28465,7 @@ case $ARCH in android) -$as_echo "#define SDL_SENSOR_ANDROID 1" >>confdefs.h +printf "%s\n" "#define SDL_SENSOR_ANDROID 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/sensor/android/*.c" have_sensor=yes @@ -26088,14 +28477,14 @@ case $ARCH in linux) -$as_echo "#define SDL_POWER_LINUX 1" >>confdefs.h +printf "%s\n" "#define SDL_POWER_LINUX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/power/linux/*.c" have_power=yes ;; android) -$as_echo "#define SDL_POWER_ANDROID 1" >>confdefs.h +printf "%s\n" "#define SDL_POWER_ANDROID 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/power/android/*.c" have_power=yes @@ -26107,14 +28496,14 @@ case $ARCH in android) -$as_echo "#define SDL_FILESYSTEM_ANDROID 1" >>confdefs.h +printf "%s\n" "#define SDL_FILESYSTEM_ANDROID 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/filesystem/android/*.c" have_filesystem=yes ;; *) -$as_echo "#define SDL_FILESYSTEM_UNIX 1" >>confdefs.h +printf "%s\n" "#define SDL_FILESYSTEM_UNIX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/filesystem/unix/*.c" have_filesystem=yes @@ -26124,7 +28513,7 @@ # Set up files for the timer library if test x$enable_timers = xyes; then -$as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h +printf "%s\n" "#define SDL_TIMER_UNIX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" have_timers=yes @@ -26190,47 +28579,54 @@ # Set up files for the video library if test x$enable_video = xyes; then -$as_echo "#define SDL_VIDEO_DRIVER_WINDOWS 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_DRIVER_WINDOWS 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/video/windows/*.c" have_video=yes # Check whether --enable-render-d3d was given. -if test "${enable_render_d3d+set}" = set; then : +if test ${enable_render_d3d+y} +then : enableval=$enable_render_d3d; -else +else $as_nop enable_render_d3d=yes fi if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then -$as_echo "#define SDL_VIDEO_RENDER_D3D 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_RENDER_D3D 1" >>confdefs.h SUMMARY_video="${SUMMARY_video} d3d9" fi if test x$enable_render_d3d = xyes -a x$have_d3d11 = xyes; then -$as_echo "#define SDL_VIDEO_RENDER_D3D11 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_RENDER_D3D11 1" >>confdefs.h SUMMARY_video="${SUMMARY_video} d3d11" fi + if test x$enable_render_d3d = xyes -a x$have_d3d12 = xyes; then + +printf "%s\n" "#define SDL_VIDEO_RENDER_D3D12 1" >>confdefs.h + + SUMMARY_video="${SUMMARY_video} d3d12" + fi fi # Set up files for the audio library if test x$enable_audio = xyes; then -$as_echo "#define SDL_AUDIO_DRIVER_WINMM 1" >>confdefs.h +printf "%s\n" "#define SDL_AUDIO_DRIVER_WINMM 1" >>confdefs.h SUMMARY_audio="${SUMMARY_audio} winmm" SOURCES="$SOURCES $srcdir/src/audio/winmm/*.c" if test x$have_dsound = xyes; then -$as_echo "#define SDL_AUDIO_DRIVER_DSOUND 1" >>confdefs.h +printf "%s\n" "#define SDL_AUDIO_DRIVER_DSOUND 1" >>confdefs.h SUMMARY_audio="${SUMMARY_audio} directsound" SOURCES="$SOURCES $srcdir/src/audio/directsound/*.c" fi if test x$have_wasapi = xyes -a x$enable_wasapi = xyes; then -$as_echo "#define SDL_AUDIO_DRIVER_WASAPI 1" >>confdefs.h +printf "%s\n" "#define SDL_AUDIO_DRIVER_WASAPI 1" >>confdefs.h SUMMARY_audio="${SUMMARY_audio} wasapi" SOURCES="$SOURCES $srcdir/src/audio/wasapi/*.c" @@ -26240,22 +28636,22 @@ # Set up files for the joystick library if test x$enable_joystick = xyes; then -$as_echo "#define SDL_JOYSTICK_RAWINPUT 1" >>confdefs.h +printf "%s\n" "#define SDL_JOYSTICK_RAWINPUT 1" >>confdefs.h if test x$have_dinput = xyes -o x$have_xinput = xyes -o x$have_wgi = xyes; then if test x$have_xinput = xyes; then -$as_echo "#define SDL_JOYSTICK_XINPUT 1" >>confdefs.h +printf "%s\n" "#define SDL_JOYSTICK_XINPUT 1" >>confdefs.h fi if test x$have_wgi = xyes; then -$as_echo "#define SDL_JOYSTICK_WGI 1" >>confdefs.h +printf "%s\n" "#define SDL_JOYSTICK_WGI 1" >>confdefs.h fi if test x$have_dinput = xyes; then -$as_echo "#define SDL_JOYSTICK_DINPUT 1" >>confdefs.h +printf "%s\n" "#define SDL_JOYSTICK_DINPUT 1" >>confdefs.h EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid -ldxerr8" fi @@ -26267,12 +28663,12 @@ if test x$have_dinput = xyes -o x$have_xinput = xyes; then if test x$have_xinput = xyes; then -$as_echo "#define SDL_HAPTIC_XINPUT 1" >>confdefs.h +printf "%s\n" "#define SDL_HAPTIC_XINPUT 1" >>confdefs.h fi if test x$have_dinput = xyes; then -$as_echo "#define SDL_HAPTIC_DINPUT 1" >>confdefs.h +printf "%s\n" "#define SDL_HAPTIC_DINPUT 1" >>confdefs.h fi SOURCES="$SOURCES $srcdir/src/haptic/windows/*.c" @@ -26280,22 +28676,22 @@ fi fi # Set up files for the sensor library - ac_fn_c_check_header_mongrel "$LINENO" "sensorsapi.h" "ac_cv_header_sensorsapi_h" "$ac_includes_default" -if test "x$ac_cv_header_sensorsapi_h" = xyes; then : + ac_fn_c_check_header_compile "$LINENO" "sensorsapi.h" "ac_cv_header_sensorsapi_h" "$ac_includes_default" +if test "x$ac_cv_header_sensorsapi_h" = xyes +then : have_winsensors=yes -else +else $as_nop have_winsensors=no fi - if test x$have_winsensors = xyes; then -$as_echo "#define HAVE_SENSORSAPI_H 1" >>confdefs.h +printf "%s\n" "#define HAVE_SENSORSAPI_H 1" >>confdefs.h fi if test x$enable_sensor = xyes -a x$have_winsensors = xyes; then -$as_echo "#define SDL_SENSOR_WINDOWS 1" >>confdefs.h +printf "%s\n" "#define SDL_SENSOR_WINDOWS 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/sensor/windows/*.c" have_sensor=yes @@ -26303,7 +28699,7 @@ # Set up files for the power library if test x$enable_power = xyes; then -$as_echo "#define SDL_POWER_WINDOWS 1" >>confdefs.h +printf "%s\n" "#define SDL_POWER_WINDOWS 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/power/windows/SDL_syspower.c" have_power=yes @@ -26311,7 +28707,7 @@ # Set up files for the filesystem library if test x$enable_filesystem = xyes; then -$as_echo "#define SDL_FILESYSTEM_WINDOWS 1" >>confdefs.h +printf "%s\n" "#define SDL_FILESYSTEM_WINDOWS 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/filesystem/windows/SDL_sysfilesystem.c" have_filesystem=yes @@ -26319,10 +28715,10 @@ # Set up files for the thread library if test x$enable_threads = xyes; then -$as_echo "#define SDL_THREAD_GENERIC_COND_SUFFIX 1" >>confdefs.h +printf "%s\n" "#define SDL_THREAD_GENERIC_COND_SUFFIX 1" >>confdefs.h -$as_echo "#define SDL_THREAD_WINDOWS 1" >>confdefs.h +printf "%s\n" "#define SDL_THREAD_WINDOWS 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/thread/windows/*.c" SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c" @@ -26331,7 +28727,7 @@ # Set up files for the timer library if test x$enable_timers = xyes; then -$as_echo "#define SDL_TIMER_WINDOWS 1" >>confdefs.h +printf "%s\n" "#define SDL_TIMER_WINDOWS 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/timer/windows/*.c" have_timers=yes @@ -26339,7 +28735,7 @@ # Set up files for the shared object loading library if test x$enable_loadso = xyes; then -$as_echo "#define SDL_LOADSO_WINDOWS 1" >>confdefs.h +printf "%s\n" "#define SDL_LOADSO_WINDOWS 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/loadso/windows/*.c" fi @@ -26359,11 +28755,12 @@ # Check to see if this is a mingw or cygwin build have_mingw32= - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lmingw32" >&5 -$as_echo_n "checking for main in -lmingw32... " >&6; } -if ${ac_cv_lib_mingw32_main+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for main in -lmingw32" >&5 +printf %s "checking for main in -lmingw32... " >&6; } +if test ${ac_cv_lib_mingw32_main+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lmingw32 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -26371,25 +28768,27 @@ int -main () +main (void) { return main (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_mingw32_main=yes -else +else $as_nop ac_cv_lib_mingw32_main=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mingw32_main" >&5 -$as_echo "$ac_cv_lib_mingw32_main" >&6; } -if test "x$ac_cv_lib_mingw32_main" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mingw32_main" >&5 +printf "%s\n" "$ac_cv_lib_mingw32_main" >&6; } +if test "x$ac_cv_lib_mingw32_main" = xyes +then : have_mingw32=yes fi @@ -26420,7 +28819,7 @@ # Set up files for the audio library if test x$enable_audio = xyes; then -$as_echo "#define SDL_AUDIO_DRIVER_HAIKU 1" >>confdefs.h +printf "%s\n" "#define SDL_AUDIO_DRIVER_HAIKU 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/haiku/*.cc" SUMMARY_audio="${SUMMARY_audio} haiku" @@ -26429,7 +28828,7 @@ # Set up files for the joystick library if test x$enable_joystick = xyes; then -$as_echo "#define SDL_JOYSTICK_HAIKU 1" >>confdefs.h +printf "%s\n" "#define SDL_JOYSTICK_HAIKU 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/joystick/haiku/*.cc" have_joystick=yes @@ -26437,7 +28836,7 @@ # Set up files for the timer library if test x$enable_timers = xyes; then -$as_echo "#define SDL_TIMER_HAIKU 1" >>confdefs.h +printf "%s\n" "#define SDL_TIMER_HAIKU 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/timer/haiku/*.c" have_timers=yes @@ -26445,7 +28844,7 @@ # Set up files for the system power library if test x$enable_power = xyes; then -$as_echo "#define SDL_POWER_HAIKU 1" >>confdefs.h +printf "%s\n" "#define SDL_POWER_HAIKU 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/power/haiku/*.c" have_power=yes @@ -26453,7 +28852,7 @@ # Set up files for the system filesystem library if test x$enable_filesystem = xyes; then -$as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h +printf "%s\n" "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/filesystem/haiku/*.cc" have_filesystem=yes @@ -26500,7 +28899,7 @@ # Set up files for the audio library if test x$enable_audio = xyes; then -$as_echo "#define SDL_AUDIO_DRIVER_COREAUDIO 1" >>confdefs.h +printf "%s\n" "#define SDL_AUDIO_DRIVER_COREAUDIO 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m" SUMMARY_audio="${SUMMARY_audio} coreaudio" @@ -26509,7 +28908,7 @@ # Set up files for the joystick library if test x$enable_joystick = xyes; then -$as_echo "#define SDL_JOYSTICK_MFI 1" >>confdefs.h +printf "%s\n" "#define SDL_JOYSTICK_MFI 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/joystick/iphoneos/*.m" SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" @@ -26527,7 +28926,7 @@ # Set up files for the sensor library if test x$enable_sensor = xyes; then -$as_echo "#define SDL_SENSOR_COREMOTION 1" >>confdefs.h +printf "%s\n" "#define SDL_SENSOR_COREMOTION 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/sensor/coremotion/*.m" have_sensor=yes @@ -26535,7 +28934,7 @@ # Set up files for the power library if test x$enable_power = xyes; then -$as_echo "#define SDL_POWER_UIKIT 1" >>confdefs.h +printf "%s\n" "#define SDL_POWER_UIKIT 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/power/uikit/*.m" have_power=yes @@ -26548,14 +28947,14 @@ # Set up additional files for the file library if test x$enable_file = xyes; then -$as_echo "#define SDL_FILESYSTEM_COCOA 1" >>confdefs.h +printf "%s\n" "#define SDL_FILESYSTEM_COCOA 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m" fi # Set up files for the timer library if test x$enable_timers = xyes; then -$as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h +printf "%s\n" "#define SDL_TIMER_UNIX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" have_timers=yes @@ -26564,19 +28963,19 @@ SOURCES="$SOURCES $srcdir/src/core/unix/*.c" # The iOS platform requires special setup. -$as_echo "#define SDL_VIDEO_DRIVER_UIKIT 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_DRIVER_UIKIT 1" >>confdefs.h -$as_echo "#define SDL_VIDEO_OPENGL_ES2 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_OPENGL_ES2 1" >>confdefs.h -$as_echo "#define SDL_VIDEO_OPENGL_ES 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_OPENGL_ES 1" >>confdefs.h -$as_echo "#define SDL_VIDEO_RENDER_OGL_ES 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_RENDER_OGL_ES 1" >>confdefs.h -$as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/video/uikit/*.m" SUMMARY_video="${SUMMARY_video} uikit" @@ -26607,6 +29006,7 @@ EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON" EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX" + CheckObjectiveCARC CheckVisibilityHidden CheckDeclarationAfterStatement CheckDummyVideo @@ -26639,7 +29039,7 @@ # Set up files for the audio library if test x$enable_audio = xyes; then -$as_echo "#define SDL_AUDIO_DRIVER_COREAUDIO 1" >>confdefs.h +printf "%s\n" "#define SDL_AUDIO_DRIVER_COREAUDIO 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox" @@ -26649,7 +29049,7 @@ # Set up files for the joystick library if test x$enable_joystick = xyes; then -$as_echo "#define SDL_JOYSTICK_IOKIT 1" >>confdefs.h +printf "%s\n" "#define SDL_JOYSTICK_IOKIT 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c" SOURCES="$SOURCES $srcdir/src/joystick/iphoneos/*.m" @@ -26659,7 +29059,7 @@ # Set up files for the haptic library if test x$enable_haptic = xyes; then -$as_echo "#define SDL_HAPTIC_IOKIT 1" >>confdefs.h +printf "%s\n" "#define SDL_HAPTIC_IOKIT 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback" @@ -26668,7 +29068,7 @@ # Set up files for the power library if test x$enable_power = xyes; then -$as_echo "#define SDL_POWER_MACOSX 1" >>confdefs.h +printf "%s\n" "#define SDL_POWER_MACOSX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/power/macosx/*.c" have_power=yes @@ -26676,7 +29076,7 @@ # Set up files for the filesystem library if test x$enable_filesystem = xyes; then -$as_echo "#define SDL_FILESYSTEM_COCOA 1" >>confdefs.h +printf "%s\n" "#define SDL_FILESYSTEM_COCOA 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/filesystem/cocoa/*.m" have_filesystem=yes @@ -26684,7 +29084,7 @@ # Set up files for the timer library if test x$enable_timers = xyes; then -$as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h +printf "%s\n" "#define SDL_TIMER_UNIX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" have_timers=yes @@ -26719,7 +29119,7 @@ # Set up files for the timer library if test x$enable_timers = xyes; then -$as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h +printf "%s\n" "#define SDL_TIMER_UNIX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" have_timers=yes @@ -26727,7 +29127,7 @@ if test x$enable_filesystem = xyes; then -$as_echo "#define SDL_FILESYSTEM_NACL 1" >>confdefs.h +printf "%s\n" "#define SDL_FILESYSTEM_NACL 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/filesystem/nacl/*.c" have_filesystem=yes @@ -26736,7 +29136,7 @@ *-*-emscripten* ) if test x$enable_video = xyes; then -$as_echo "#define SDL_VIDEO_DRIVER_EMSCRIPTEN 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_DRIVER_EMSCRIPTEN 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/video/emscripten/*.c" have_video=yes @@ -26745,7 +29145,7 @@ if test x$enable_audio = xyes; then -$as_echo "#define SDL_AUDIO_DRIVER_EMSCRIPTEN 1" >>confdefs.h +printf "%s\n" "#define SDL_AUDIO_DRIVER_EMSCRIPTEN 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/emscripten/*.c" have_audio=yes @@ -26772,7 +29172,7 @@ # Set up files for the power library if test x$enable_power = xyes; then -$as_echo "#define SDL_POWER_EMSCRIPTEN 1" >>confdefs.h +printf "%s\n" "#define SDL_POWER_EMSCRIPTEN 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/power/emscripten/*.c" have_power=yes @@ -26781,7 +29181,7 @@ # Set up files for the joystick library if test x$enable_joystick = xyes; then -$as_echo "#define SDL_JOYSTICK_EMSCRIPTEN 1" >>confdefs.h +printf "%s\n" "#define SDL_JOYSTICK_EMSCRIPTEN 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/joystick/emscripten/*.c" have_joystick=yes @@ -26790,7 +29190,7 @@ # Set up files for the filesystem library if test x$enable_filesystem = xyes; then -$as_echo "#define SDL_FILESYSTEM_EMSCRIPTEN 1" >>confdefs.h +printf "%s\n" "#define SDL_FILESYSTEM_EMSCRIPTEN 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/filesystem/emscripten/*.c" have_filesystem=yes @@ -26798,7 +29198,7 @@ # Set up files for the timer library if test x$enable_timers = xyes; then -$as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h +printf "%s\n" "#define SDL_TIMER_UNIX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" have_timers=yes @@ -26831,7 +29231,7 @@ # Set up files for the video library if test x$enable_video = xyes; then -$as_echo "#define SDL_VIDEO_DRIVER_RISCOS 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_DRIVER_RISCOS 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/video/riscos/*.c" have_video=yes @@ -26840,7 +29240,7 @@ # Set up files for the filesystem library if test x$enable_filesystem = xyes; then -$as_echo "#define SDL_FILESYSTEM_RISCOS 1" >>confdefs.h +printf "%s\n" "#define SDL_FILESYSTEM_RISCOS 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/filesystem/riscos/*.c" have_filesystem=yes @@ -26848,7 +29248,7 @@ # Set up files for the timer library if test x$enable_timers = xyes; then -$as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h +printf "%s\n" "#define SDL_TIMER_UNIX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" have_timers=yes @@ -26887,7 +29287,7 @@ # Set up files for the video library if test x$enable_video = xyes; then -$as_echo "#define SDL_VIDEO_DRIVER_OS2 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_DRIVER_OS2 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/video/os2/*.c" have_video=yes @@ -26896,7 +29296,7 @@ # Set up files for the audio library if test x$enable_audio = xyes; then -$as_echo "#define SDL_AUDIO_DRIVER_OS2 1" >>confdefs.h +printf "%s\n" "#define SDL_AUDIO_DRIVER_OS2 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/os2/*.c" have_audio=yes @@ -26906,7 +29306,7 @@ # Set up files for the thread library if test x$enable_threads = xyes; then -$as_echo "#define SDL_THREAD_OS2 1" >>confdefs.h +printf "%s\n" "#define SDL_THREAD_OS2 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/thread/os2/*.c" SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c" @@ -26915,7 +29315,7 @@ # Set up files for the timer library if test x$enable_timers = xyes; then -$as_echo "#define SDL_TIMER_OS2 1" >>confdefs.h +printf "%s\n" "#define SDL_TIMER_OS2 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/timer/os2/*.c" have_timers=yes @@ -26923,7 +29323,7 @@ # Set up files for the shared object loading library if test x$enable_loadso = xyes; then -$as_echo "#define SDL_LOADSO_OS2 1" >>confdefs.h +printf "%s\n" "#define SDL_LOADSO_OS2 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/loadso/os2/*.c" have_loadso=yes @@ -26931,7 +29331,7 @@ # Set up files for the filesystem library if test x$enable_filesystem = xyes; then -$as_echo "#define SDL_FILESYSTEM_OS2 1" >>confdefs.h +printf "%s\n" "#define SDL_FILESYSTEM_OS2 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/filesystem/os2/*.c" have_filesystem=yes @@ -26939,7 +29339,7 @@ # Set up files for the joystick library if test x$enable_joystick = xyes; then -$as_echo "#define SDL_JOYSTICK_OS2 1" >>confdefs.h +printf "%s\n" "#define SDL_JOYSTICK_OS2 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/joystick/os2/*.c" have_joystick=yes @@ -26955,25 +29355,26 @@ CheckVirtualJoystick # Check whether to install sdl2-config -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to install sdl2-config" >&5 -$as_echo_n "checking whether to install sdl2-config... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to install sdl2-config" >&5 +printf %s "checking whether to install sdl2-config... " >&6; } # Check whether --enable-sdl2-config was given. -if test "${enable_sdl2_config+set}" = set; then : +if test ${enable_sdl2_config+y} +then : enableval=$enable_sdl2_config; case "${enableval}" in yes) enable_sdl2_config="TRUE" ;; no) enable_sdl2_config="FALSE" ;; *) as_fn_error $? "bad value '${enableval}' for --enable-sdl2-config" "$LINENO" 5 ;; esac -else +else $as_nop enable_sdl2_config="TRUE" fi if test "$enable_sdl2_config" = "TRUE"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi INSTALL_SDL2_CONFIG=$enable_sdl2_config @@ -26983,7 +29384,7 @@ if test x$have_audio != xyes; then if test x$enable_audio = xyes; then -$as_echo "#define SDL_AUDIO_DRIVER_DUMMY 1" >>confdefs.h +printf "%s\n" "#define SDL_AUDIO_DRIVER_DUMMY 1" >>confdefs.h fi SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c" @@ -26991,7 +29392,7 @@ if test x$have_video != xyes; then if test x$enable_video = xyes; then -$as_echo "#define SDL_VIDEO_DRIVER_DUMMY 1" >>confdefs.h +printf "%s\n" "#define SDL_VIDEO_DRIVER_DUMMY 1" >>confdefs.h fi SOURCES="$SOURCES $srcdir/src/video/dummy/*.c" @@ -26999,7 +29400,7 @@ if test x$have_misc != xyes; then if test x$enable_misc = xyes; then -$as_echo "#define SDL_MISC_DUMMY 1" >>confdefs.h +printf "%s\n" "#define SDL_MISC_DUMMY 1" >>confdefs.h fi SOURCES="$SOURCES $srcdir/src/misc/dummy/*.c" @@ -27007,7 +29408,7 @@ if test x$have_locale != xyes; then if test x$enable_locale = xyes; then -$as_echo "#define SDL_LOCALE_DUMMY 1" >>confdefs.h +printf "%s\n" "#define SDL_LOCALE_DUMMY 1" >>confdefs.h fi SOURCES="$SOURCES $srcdir/src/locale/dummy/*.c" @@ -27015,7 +29416,7 @@ if test x$have_joystick != xyes; then if test x$enable_joystick = xyes; then -$as_echo "#define SDL_JOYSTICK_DUMMY 1" >>confdefs.h +printf "%s\n" "#define SDL_JOYSTICK_DUMMY 1" >>confdefs.h fi SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c" @@ -27023,7 +29424,7 @@ if test x$have_haptic != xyes; then if test x$enable_haptic = xyes; then -$as_echo "#define SDL_HAPTIC_DUMMY 1" >>confdefs.h +printf "%s\n" "#define SDL_HAPTIC_DUMMY 1" >>confdefs.h fi SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c" @@ -27031,7 +29432,7 @@ if test x$have_sensor != xyes; then if test x$enable_sensor = xyes; then -$as_echo "#define SDL_SENSOR_DUMMY 1" >>confdefs.h +printf "%s\n" "#define SDL_SENSOR_DUMMY 1" >>confdefs.h fi SOURCES="$SOURCES $srcdir/src/sensor/dummy/*.c" @@ -27039,7 +29440,7 @@ if test x$have_threads != xyes; then if test x$enable_threads = xyes; then -$as_echo "#define SDL_THREADS_DISABLED 1" >>confdefs.h +printf "%s\n" "#define SDL_THREADS_DISABLED 1" >>confdefs.h fi SOURCES="$SOURCES $srcdir/src/thread/generic/*.c" @@ -27047,7 +29448,7 @@ if test x$have_timers != xyes; then if test x$enable_timers = xyes; then -$as_echo "#define SDL_TIMER_DUMMY 1" >>confdefs.h +printf "%s\n" "#define SDL_TIMER_DUMMY 1" >>confdefs.h fi SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c" @@ -27055,7 +29456,7 @@ if test x$have_filesystem != xyes; then if test x$enable_filesystem = xyes; then -$as_echo "#define SDL_FILESYSTEM_DUMMY 1" >>confdefs.h +printf "%s\n" "#define SDL_FILESYSTEM_DUMMY 1" >>confdefs.h fi SOURCES="$SOURCES $srcdir/src/filesystem/dummy/*.c" @@ -27063,7 +29464,7 @@ if test x$have_loadso != xyes; then if test x$enable_loadso = xyes; then -$as_echo "#define SDL_LOADSO_DUMMY 1" >>confdefs.h +printf "%s\n" "#define SDL_LOADSO_DUMMY 1" >>confdefs.h fi SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c" @@ -27136,8 +29537,8 @@ if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = linux -o $ARCH = netbsd; then SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker option --enable-new-dtags" >&5 -$as_echo_n "checking for linker option --enable-new-dtags... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for linker option --enable-new-dtags" >&5 +printf %s "checking for linker option --enable-new-dtags... " >&6; } have_enable_new_dtags=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -Wl,--enable-new-dtags" @@ -27145,24 +29546,25 @@ /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : have_enable_new_dtags=yes SDL_RLD_FLAGS="$SDL_RLD_FLAGS -Wl,--enable-new-dtags" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_enable_new_dtags" >&5 -$as_echo "$have_enable_new_dtags" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_enable_new_dtags" >&5 +printf "%s\n" "$have_enable_new_dtags" >&6; } fi if test $ARCH = solaris; then SDL_RLD_FLAGS="-R\${libdir}" @@ -27173,6 +29575,102 @@ SDL_STATIC_LIBS="$EXTRA_LDFLAGS" +pkg_cmakedir='$libdir/cmake/SDL2' +for _lcl_i in pkg_cmakedir:prefix:cmake_prefix_relpath bindir:prefix:bin_prefix_relpath; do + _lcl_from=\$`echo "$_lcl_i" | sed 's,:.*$,,'` + _lcl_to=\$`echo "$_lcl_i" | sed 's,^[^:]*:,,' | sed 's,:[^:]*$,,'` + _lcl_result_var=`echo "$_lcl_i" | sed 's,^.*:,,'` + _lcl_receval="$_lcl_from" +_lcl_from=`(test "x$prefix" = xNONE && prefix="$ac_default_prefix" + test "x$exec_prefix" = xNONE && exec_prefix="${prefix}" + _lcl_receval_old='' + while test "$_lcl_receval_old" != "$_lcl_receval"; do + _lcl_receval_old="$_lcl_receval" + eval _lcl_receval="\"$_lcl_receval\"" + done + echo "$_lcl_receval")` + _lcl_receval="$_lcl_to" +_lcl_to=`(test "x$prefix" = xNONE && prefix="$ac_default_prefix" + test "x$exec_prefix" = xNONE && exec_prefix="${prefix}" + _lcl_receval_old='' + while test "$_lcl_receval_old" != "$_lcl_receval"; do + _lcl_receval_old="$_lcl_receval" + eval _lcl_receval="\"$_lcl_receval\"" + done + echo "$_lcl_receval")` + _lcl_notation="$_lcl_from$_lcl_to" + case ":$_lcl_from:" in +# change empty paths to '.' + ::) _lcl_from='.' ;; +# strip trailing slashes + :*[\\/]:) _lcl_from=`echo "$_lcl_from" | sed 's,[\\/]*$,,'` ;; + :*:) ;; +esac +# squeeze repeated slashes +case '/' in +# if the path contains any backslashes, turn slashes into backslashes + *\\*) _lcl_from=`echo "$_lcl_from" | sed 's,\(.\)[\\/][\\/]*,\1\\\\,g'` ;; +# if the path contains slashes, also turn backslashes into slashes + *) _lcl_from=`echo "$_lcl_from" | sed 's,\(.\)[\\/][\\/]*,\1/,g'` ;; +esac + case ":$_lcl_to:" in +# change empty paths to '.' + ::) _lcl_to='.' ;; +# strip trailing slashes + :*[\\/]:) _lcl_to=`echo "$_lcl_to" | sed 's,[\\/]*$,,'` ;; + :*:) ;; +esac +# squeeze repeated slashes +case '/' in +# if the path contains any backslashes, turn slashes into backslashes + *\\*) _lcl_to=`echo "$_lcl_to" | sed 's,\(.\)[\\/][\\/]*,\1\\\\,g'` ;; +# if the path contains slashes, also turn backslashes into slashes + *) _lcl_to=`echo "$_lcl_to" | sed 's,\(.\)[\\/][\\/]*,\1/,g'` ;; +esac + _lcl_common_prefix='' +_lcl_second_prefix_match='' +while test "$_lcl_second_prefix_match" != 0; do + _lcl_first_prefix=`expr "x$_lcl_from" : "x\($_lcl_common_prefix/*[^/]*\)"` + _lcl_second_prefix_match=`expr "x$_lcl_to" : "x$_lcl_first_prefix"` + if test "$_lcl_second_prefix_match" != 0; then + if test "$_lcl_first_prefix" != "$_lcl_common_prefix"; then + _lcl_common_prefix="$_lcl_first_prefix" + else + _lcl_second_prefix_match=0 + fi + fi +done +_lcl_first_suffix=`expr "x$_lcl_from" : "x$_lcl_common_prefix/*\(.*\)"` +_lcl_first_rel='' +_lcl_tmp='xxx' +while test "$_lcl_tmp" != ''; do + _lcl_tmp=`expr "x$_lcl_first_suffix" : "x[^/]*/*\(.*\)"` + if test "$_lcl_first_suffix" != ''; then + _lcl_first_suffix="$_lcl_tmp" + _lcl_first_rel="../$_lcl_first_rel" + fi +done +_lcl_second_suffix=`expr "x$_lcl_to" : "x$_lcl_common_prefix/*\(.*\)"` +_lcl_result_tmp="$_lcl_first_rel$_lcl_second_suffix" + case ":$_lcl_result_tmp:" in +# change empty paths to '.' + ::) _lcl_result_tmp='.' ;; +# strip trailing slashes + :*[\\/]:) _lcl_result_tmp=`echo "$_lcl_result_tmp" | sed 's,[\\/]*$,,'` ;; + :*:) ;; +esac +# squeeze repeated slashes +case "$_lcl_notation" in +# if the path contains any backslashes, turn slashes into backslashes + *\\*) _lcl_result_tmp=`echo "$_lcl_result_tmp" | sed 's,\(.\)[\\/][\\/]*,\1\\\\,g'` ;; +# if the path contains slashes, also turn backslashes into slashes + *) _lcl_result_tmp=`echo "$_lcl_result_tmp" | sed 's,\(.\)[\\/][\\/]*,\1/,g'` ;; +esac + eval $_lcl_result_var='$_lcl_result_tmp' +done + + + @@ -27330,8 +29828,8 @@ case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -27361,15 +29859,15 @@ /^ac_cv_env_/b end t clear :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else @@ -27383,8 +29881,8 @@ fi fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -27401,7 +29899,7 @@ for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" @@ -27417,8 +29915,8 @@ ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL @@ -27441,14 +29939,16 @@ # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -27458,46 +29958,46 @@ fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -27506,13 +30006,6 @@ fi -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -27521,8 +30014,12 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS @@ -27534,30 +30031,10 @@ as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] @@ -27570,13 +30047,14 @@ as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $2" >&2 + printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -27603,18 +30081,20 @@ { eval $1=; unset $1;} } as_unset=as_fn_unset + # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : eval 'as_fn_append () { eval $1+=\$2 }' -else +else $as_nop as_fn_append () { eval $1=\$$1\$2 @@ -27626,12 +30106,13 @@ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else +else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` @@ -27662,7 +30143,7 @@ $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -27684,6 +30165,10 @@ as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -27697,6 +30182,12 @@ ECHO_N='-n';; esac +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -27738,7 +30229,7 @@ as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -27747,7 +30238,7 @@ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | +printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -27810,7 +30301,7 @@ # values after options handling. ac_log=" This file was extended by $as_me, which was -generated by GNU Autoconf 2.69. Invocation command line was +generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -27872,14 +30363,16 @@ Report bugs to the package provider." _ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ config.status -configured by $0, generated by GNU Autoconf 2.69, +configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -27918,15 +30411,15 @@ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; + printf "%s\n" "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; + printf "%s\n" "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" @@ -27934,7 +30427,7 @@ --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; @@ -27943,7 +30436,7 @@ as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; + printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; @@ -27971,7 +30464,7 @@ if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" @@ -27985,7 +30478,7 @@ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX - $as_echo "$ac_log" + printf "%s\n" "$ac_log" } >&5 _ACEOF @@ -28493,9 +30986,9 @@ # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files + test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers + test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree @@ -28831,7 +31324,7 @@ esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done @@ -28839,17 +31332,17 @@ # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | + ac_sed_conf_input=`printf "%s\n" "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac @@ -28866,7 +31359,7 @@ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | +printf "%s\n" X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -28890,9 +31383,9 @@ case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -28949,8 +31442,8 @@ case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' @@ -28993,9 +31486,9 @@ { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" @@ -29011,27 +31504,27 @@ # if test x"$ac_file" != x-; then { - $as_echo "/* $configure_input */" \ + printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 -$as_echo "$as_me: $ac_file is unchanged" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else - $as_echo "/* $configure_input */" \ + printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; - :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 -$as_echo "$as_me: executing $ac_file commands" >&6;} + :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +printf "%s\n" "$as_me: executing $ac_file commands" >&6;} ;; esac @@ -29582,6 +32075,7 @@ esac + ltmain=$ac_aux_dir/ltmain.sh @@ -29939,7 +32433,8 @@ $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi + diff -Nru libsdl2-2.0.22+dfsg/configure.ac libsdl2-2.24.0+dfsg/configure.ac --- libsdl2-2.0.22+dfsg/configure.ac 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/configure.ac 2022-08-19 15:46:21.000000000 +0000 @@ -10,23 +10,21 @@ orig_CFLAGS="$CFLAGS" dnl Set various version strings - taken gratefully from the GTk sources -# -# Making releases: -# Edit include/SDL_version.h and change the version, then: -# SDL_MICRO_VERSION += 1; -# SDL_INTERFACE_AGE += 1; -# SDL_BINARY_AGE += 1; -# if any functions have been added, set SDL_INTERFACE_AGE to 0. -# if backwards compatibility has been broken, -# set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0. -# +# See docs/release_checklist.md SDL_MAJOR_VERSION=2 -SDL_MINOR_VERSION=0 -SDL_MICRO_VERSION=22 -SDL_INTERFACE_AGE=0 -SDL_BINARY_AGE=22 +SDL_MINOR_VERSION=24 +SDL_MICRO_VERSION=0 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION +SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION` +AS_CASE(["$SDL_MINOR_VERSION"], + [*@<:@02468@:>@], + dnl Stable branch, 2.24.1 -> libSDL2-2.0.so.0.2400.1 + [SDL_INTERFACE_AGE="$SDL_MICRO_VERSION"], + [*], + dnl Development branch, 2.23.1 -> libSDL2-2.0.so.0.2301.0 + [SDL_INTERFACE_AGE=0]) + AC_SUBST(SDL_MAJOR_VERSION) AC_SUBST(SDL_MINOR_VERSION) AC_SUBST(SDL_MICRO_VERSION) @@ -38,10 +36,17 @@ LT_INIT([win32-dll]) LT_LANG([Windows Resource]) -LT_RELEASE=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION -LT_CURRENT=`expr $SDL_MICRO_VERSION - $SDL_INTERFACE_AGE` -LT_REVISION=$SDL_INTERFACE_AGE +# For historical reasons, the library name redundantly includes the major +# version twice: libSDL2-2.0.so.0. +# TODO: in SDL 3, stop using -release, which will simplify it to libSDL3.so.0 +LT_RELEASE=2.0 +# Increment this if there is an incompatible change - but if that happens, +# we should rename the library from SDL2 to SDL3, at which point this would +# reset to 0 anyway. +LT_MAJOR=0 LT_AGE=`expr $SDL_BINARY_AGE - $SDL_INTERFACE_AGE` +LT_CURRENT=`expr $LT_MAJOR + $LT_AGE` +LT_REVISION=$SDL_INTERFACE_AGE m4_pattern_allow([^LT_]) AC_SUBST(LT_RELEASE) @@ -53,12 +58,21 @@ dnl AC_CANONICAL_HOST dnl Check for tools +AC_PROG_AWK AC_PROG_CC AC_PROG_CXX +AC_PROG_EGREP AC_PROG_INSTALL AC_PROG_MAKE_SET PKG_PROG_PKG_CONFIG +if [ test -z "$AWK" ]; then + AC_MSG_ERROR([*** awk not found, aborting]) +fi + +dnl 64-bit file offsets if possible unless --disable-largefile is specified +AC_SYS_LARGEFILE + dnl Make sure that srcdir is a full pathname case "$host" in *-*-mingw*) @@ -172,15 +186,7 @@ host_lib_path="/usr/$base_libdir /usr/local/$base_libdir" fi for path in $env_lib_path $gcc_bin_path $gcc_lib_path $host_lib_path; do - lib=[`ls -- $path/$1 2>/dev/null | sed -e '/\.so\..*\./d' -e 's,.*/,,' | sort | tail -1`] - if test x$lib != x; then - echo $lib - return - fi - done - # Try again, this time allowing more than one version digit after the .so - for path in $env_lib_path $gcc_bin_path $gcc_lib_path $host_lib_path; do - lib=[`ls -- $path/$1 2>/dev/null | sed -e 's,.*/,,' | sort | tail -1`] + lib=[`ls -- $path/$1 2>/dev/null | sed 's,.*/,,' | sort -V -r | $AWK 'BEGIN{FS="."}{ print NF, $0 }' | sort -n -s | sed 's,[0-9]* ,,' | head -1`] if test x$lib != x; then echo $lib return @@ -218,6 +224,9 @@ ;; esac +dnl For use in static assertions +EXTRA_CFLAGS="$EXTRA_CFLAGS -DSDL_BUILD_MAJOR_VERSION=$SDL_MAJOR_VERSION -DSDL_BUILD_MINOR_VERSION=$SDL_MINOR_VERSION -DSDL_BUILD_MICRO_VERSION=$SDL_MICRO_VERSION" + dnl See whether we can use gcc style dependency tracking AC_ARG_ENABLE(dependency-tracking, [AS_HELP_STRING([--enable-dependency-tracking], @@ -309,7 +318,8 @@ AC_DEFINE(HAVE_LIBC, 1, [ ]) dnl Check for C library headers - AC_HEADER_STDC +dnl AC_CHECK_INCLUDES_DEFAULT is an autoconf-2.7x thing where AC_HEADER_STDC is deprecated. + m4_ifdef([AC_CHECK_INCLUDES_DEFAULT], [AC_CHECK_INCLUDES_DEFAULT], [AC_HEADER_STDC]) AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h wchar.h inttypes.h stdint.h limits.h ctype.h math.h float.h iconv.h signal.h) dnl Check for typedefs, structures, etc. @@ -337,7 +347,7 @@ AC_DEFINE(HAVE_MPROTECT, 1, [ ]) ],[]), ) - AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcslcpy wcslcat _wcsdup wcsdup wcsstr wcscmp wcsncmp wcscasecmp _wcsicmp wcsncasecmp _wcsnicmp strlen strlcpy strlcat _strrev _strupr _strlwr index rindex strchr strrchr strstr strtok_r itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval elf_aux_info poll _Exit) + AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv bsearch qsort abs bcopy memset memcpy memmove wcslen wcslcpy wcslcat _wcsdup wcsdup wcsstr wcscmp wcsncmp wcscasecmp _wcsicmp wcsncasecmp _wcsnicmp strlen strlcpy strlcat _strrev _strupr _strlwr index rindex strchr strrchr strstr strtok_r itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval elf_aux_info poll _Exit) AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"]) AC_CHECK_FUNCS(acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf copysign copysignf cos cosf exp expf fabs fabsf floor floorf trunc truncf fmod fmodf log logf log10 log10f lround lroundf pow powf round roundf scalbn scalbnf sin sinf sqrt sqrtf tan tanf) @@ -512,9 +522,11 @@ else SUMMARY_modules="${SUMMARY_modules} filesystem" fi -AC_ARG_ENABLE(threads, -[AS_HELP_STRING([--enable-threads], [Enable the threading subsystem [default=yes]])], - , enable_threads=yes) +# Many subsystems depend on threads, so leave them enabled by default +#AC_ARG_ENABLE(threads, +#[AS_HELP_STRING([--enable-threads], [Enable the threading subsystem [default=yes]])], +# , enable_threads=yes) +enable_threads=yes if test x$enable_threads != xyes; then AC_DEFINE(SDL_THREADS_DISABLED, 1, [ ]) else @@ -574,8 +586,6 @@ if test x$enable_assembly = xyes; then SUMMARY_modules="${SUMMARY_modules} assembly" - AC_DEFINE(SDL_ASSEMBLY_ROUTINES, 1, [ ]) - # Make sure that we don't generate floating point code that would # cause illegal instruction exceptions on older processors case "$host" in @@ -844,6 +854,70 @@ fi fi + AC_ARG_ENABLE(lsx, +[AS_HELP_STRING([--enable-lsx], [use LSX assembly routines [default=yes]])], + , enable_lsx=yes) + if test x$enable_lsx = xyes; then + save_CFLAGS="$CFLAGS" + have_gcc_lsx=no + AC_MSG_CHECKING(for GCC -mlsx option) + lsx_CFLAGS="-mlsx" + CFLAGS="$save_CFLAGS $lsx_CFLAGS" + + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #ifndef __loongarch_sx + #error Assembler CPP flag not enabled + #endif + ]], [])], [have_gcc_lsx=yes], []) + AC_MSG_RESULT($have_gcc_lsx) + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_lsx = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS $lsx_CFLAGS" + SUMMARY_math="${SUMMARY_math} lsx" + fi + fi + + AC_MSG_CHECKING(for lsxintrin.h) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]])], + [have_lsxintrin_h_hdr=yes],[have_lsxintrin_h_hdr=no]) + AC_MSG_RESULT($have_lsxintrin_h_hdr) + if test x$have_lsxintrin_h_hdr = xyes; then + AC_DEFINE(HAVE_LSXINTRIN_H, 1, [ ]) + fi + + AC_ARG_ENABLE(lasx, +[AS_HELP_STRING([--enable-lasx], [use LASX assembly routines [default=yes]])], + , enable_LASX=yes) + if test x$enable_LASX = xyes; then + save_CFLAGS="$CFLAGS" + have_gcc_lasx=no + AC_MSG_CHECKING(for GCC -mlasx option) + lasx_CFLAGS="-mlasx" + CFLAGS="$save_CFLAGS $lasx_CFLAGS" + + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #ifndef __loongarch_asx + #error Assembler CPP flag not enabled + #endif + ]], [])], [have_gcc_lasx=yes], []) + AC_MSG_RESULT($have_gcc_lasx) + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_lasx = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS $lasx_CFLAGS" + SUMMARY_math="${SUMMARY_math} lasx" + fi + fi + + AC_MSG_CHECKING(for lasxintrin.h) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]])], + [have_lasxintrin_h_hdr=yes],[have_lasxintrin_h_hdr=no]) + AC_MSG_RESULT($have_lasxintrin_h_hdr) + if test x$have_lasxintrin_h_hdr = xyes; then + AC_DEFINE(HAVE_LASXINTRIN_H, 1, [ ]) + fi + dnl See if the OSS audio interface is supported CheckOSS() { @@ -1423,6 +1497,26 @@ fi } +dnl See if clang's -fobjc-arc supported. +dnl Reference: https://github.com/libsdl-org/SDL/pull/5632 +CheckObjectiveCARC() +{ + AC_MSG_CHECKING(for clang -fobjc-arc option) + have_clang_objc_arc=no + + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS -fobjc-arc" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + int x = 0; + ]],[])], [have_clang_objc_arc=yes],[]) + AC_MSG_RESULT($have_clang_objc_arc) + CFLAGS="$save_CFLAGS" + + if test x$have_clang_objc_arc = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -fobjc-arc" + fi +} + dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually). dnl Details of this flag are here: http://gcc.gnu.org/wiki/Visibility CheckVisibilityHidden() @@ -1768,37 +1862,31 @@ x11_lib='/opt/X11/lib/libX11.6.dylib' x11ext_lib='/opt/X11/lib/libXext.6.dylib' xcursor_lib='/opt/X11/lib/libXcursor.1.dylib' - xinerama_lib='/opt/X11/lib/libXinerama.1.dylib' xinput_lib='/opt/X11/lib/libXi.6.dylib' xfixes_lib='/opt/X11/lib/libXfixes.3.dylib' xrandr_lib='/opt/X11/lib/libXrandr.2.dylib' xrender_lib='/opt/X11/lib/libXrender.1.dylib' xss_lib='/opt/X11/lib/libXss.1.dylib' - xvidmode_lib='/opt/X11/lib/libXxf86vm.1.dylib' ;; *-*-openbsd*) x11_lib='libX11.so' x11ext_lib='libXext.so' xcursor_lib='libXcursor.so' - xinerama_lib='libXinerama.so' xinput_lib='libXi.so' xfixes_lib='libXfixes.so' xrandr_lib='libXrandr.so' xrender_lib='libXrender.so' xss_lib='libXss.so' - xvidmode_lib='libXxf86vm.so' ;; *) x11_lib=[`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] x11ext_lib=[`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] xcursor_lib=[`find_lib "libXcursor.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] - xinerama_lib=[`find_lib "libXinerama.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] xinput_lib=[`find_lib "libXi.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] xfixes_lib=[`find_lib "libXfixes.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] xrandr_lib=[`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] xrender_lib=[`find_lib "libXrender.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] xss_lib=[`find_lib "libXss.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] - xvidmode_lib=[`find_lib "libXxf86vm.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] ;; esac @@ -1910,34 +1998,6 @@ SUMMARY_video_x11="${SUMMARY_video_x11} xdbe" fi fi - AC_ARG_ENABLE(video-x11-xinerama, -[AS_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [default=yes]])], - , enable_video_x11_xinerama=yes) - if test x$enable_video_x11_xinerama = xyes; then - definitely_enable_video_x11_xinerama=no - AC_CHECK_HEADER(X11/extensions/Xinerama.h, - have_xinerama_h_hdr=yes, - have_xinerama_h_hdr=no, - [#include - ]) - if test x$have_xinerama_h_hdr = xyes; then - if test x$enable_x11_shared = xyes && test x$xinerama_lib != x ; then - echo "-- dynamic libXinerama -> $xinerama_lib" - AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA, "$xinerama_lib", [ ]) - definitely_enable_video_x11_xinerama=yes - else - AC_CHECK_LIB(Xinerama, XineramaQueryExtension, have_xinerama_lib=yes) - if test x$have_xinerama_lib = xyes ; then - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXinerama" - definitely_enable_video_x11_xinerama=yes - fi - fi - fi - fi - if test x$definitely_enable_video_x11_xinerama = xyes; then - AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA, 1, [ ]) - SUMMARY_video_x11="${SUMMARY_video_x11} xinerama" - fi AC_ARG_ENABLE(video-x11-xinput, [AS_HELP_STRING([--enable-video-x11-xinput], [enable X11 XInput extension for manymouse, tablets, etc [default=yes]])], , enable_video_x11_xinput=yes) @@ -2087,34 +2147,6 @@ SUMMARY_video_x11="${SUMMARY_video_x11} xshape" fi fi - AC_ARG_ENABLE(video-x11-vm, -[AS_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [default=yes]])], - , enable_video_x11_vm=yes) - if test x$enable_video_x11_vm = xyes; then - definitely_enable_video_x11_vm=no - AC_CHECK_HEADER(X11/extensions/xf86vmode.h, - have_vm_h_hdr=yes, - have_vm_h_hdr=no, - [#include - ]) - if test x$have_vm_h_hdr = xyes; then - if test x$enable_x11_shared = xyes && test x$xvidmode_lib != x ; then - echo "-- dynamic libXxf86vm -> $xvidmode_lib" - AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE, "$xvidmode_lib", [ ]) - definitely_enable_video_x11_vm=yes - else - AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryVersion, have_vm_lib=yes) - if test x$have_vm_lib = xyes ; then - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXxf86vm" - definitely_enable_video_x11_vm=yes - fi - fi - fi - fi - if test x$definitely_enable_video_x11_vm = xyes; then - AC_DEFINE(SDL_VIDEO_DRIVER_X11_XVIDMODE, 1, [ ]) - SUMMARY_video_x11="${SUMMARY_video_x11} xvidmode" - fi fi fi if test x$have_x != xyes; then @@ -2807,7 +2839,7 @@ { save_LIBS="$LIBS" case "$host" in - *-*-freebsd*) LIBS="$LIBS -linotify" + *-*-freebsd*|*-*dragonfly*) LIBS="$LIBS -linotify" ;; esac AC_CHECK_HEADERS(sys/inotify.h, [have_inotify_inotify_h_hdr=yes]) @@ -2816,7 +2848,7 @@ if test x$have_inotify_inotify_h_hdr = xyes -a x$have_inotify = xyes; then AC_DEFINE(HAVE_INOTIFY, 1, [ ]) case "$host" in - *-*-freebsd*) + *-*-freebsd*|*-*-dragonfly*) EXTRA_LDFLAGS="$EXTRA_LDFLAGS -linotify" ;; esac @@ -3208,6 +3240,10 @@ if test x$have_roapi_h = xyes; then AC_DEFINE(HAVE_ROAPI_H, 1, [ ]) fi + AC_CHECK_HEADER(shellscalingapi.h,have_shellscalingapi_h=yes) + if test x$shellscalingapi_h = xyes; then + AC_DEFINE(HAVE_SHELLSCALINGAPI_H, 1, [ ]) + fi } dnl Determine whether the compiler can produce OS/2 executables @@ -3234,6 +3270,17 @@ if test x$enable_directx = xyes; then AC_CHECK_HEADER(d3d9.h, have_d3d=yes) AC_CHECK_HEADER(d3d11_1.h, have_d3d11=yes) + AC_MSG_CHECKING(for d3d12 Windows SDK version) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include +#include +#include +ID3D12Device1 *device; +#if WDK_NTDDI_VERSION <= 0x0A000008 +asdf +#endif + ]])], [have_d3d12=yes],[have_d3d12=no]) + AC_MSG_RESULT($have_d3d12) AC_CHECK_HEADER(ddraw.h, have_ddraw=yes) AC_CHECK_HEADER(dsound.h, have_dsound=yes) AC_CHECK_HEADER(dinput.h, have_dinput=yes) @@ -3961,6 +4008,10 @@ AC_DEFINE(SDL_VIDEO_RENDER_D3D11, 1, [ ]) SUMMARY_video="${SUMMARY_video} d3d11" fi + if test x$enable_render_d3d = xyes -a x$have_d3d12 = xyes; then + AC_DEFINE(SDL_VIDEO_RENDER_D3D12, 1, [ ]) + SUMMARY_video="${SUMMARY_video} d3d12" + fi fi # Set up files for the audio library if test x$enable_audio = xyes; then @@ -4250,6 +4301,7 @@ EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON" EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX" + CheckObjectiveCARC CheckVisibilityHidden CheckDeclarationAfterStatement CheckDummyVideo @@ -4722,6 +4774,13 @@ SDL_STATIC_LIBS="$EXTRA_LDFLAGS" +dnl Calculate the location of the prefix, relative to the cmake folder +dnl Calculate the location of the prefix, relative to bindir +pkg_cmakedir='$libdir/cmake/SDL2' +AX_COMPUTE_RELATIVE_PATHS([pkg_cmakedir:prefix:cmake_prefix_relpath bindir:prefix:bin_prefix_relpath]) +AC_SUBST([cmake_prefix_relpath]) +AC_SUBST([bin_prefix_relpath]) + dnl Expand the cflags and libraries needed by apps using SDL AC_SUBST(SDL_CFLAGS) AC_SUBST(SDL_LIBS) diff -Nru libsdl2-2.0.22+dfsg/debian/changelog libsdl2-2.24.0+dfsg/debian/changelog --- libsdl2-2.0.22+dfsg/debian/changelog 2022-06-17 09:14:50.000000000 +0000 +++ libsdl2-2.24.0+dfsg/debian/changelog 2022-08-22 10:45:00.000000000 +0000 @@ -1,3 +1,55 @@ +libsdl2 (2.24.0+dfsg-1) unstable; urgency=medium + + * New upstream release + - Functionally equivalent to 2.23.2+dfsg-4 + * Drop patches that were applied upstream + * d/watch, d/gbp.conf, d/control: Go back to unstable branch + * Release to unstable + + -- Simon McVittie Mon, 22 Aug 2022 11:45:00 +0100 + +libsdl2 (2.23.2+dfsg-4) experimental; urgency=medium + + * d/patches: Update to upstream commit prerelease-2.23.2-21-g6e007c36e + + -- Simon McVittie Fri, 19 Aug 2022 10:22:45 +0100 + +libsdl2 (2.23.2+dfsg-3) experimental; urgency=medium + + * d/patches: Update to upstream commit prerelease-2.23.2-17-g51be30f3c, + excluding CI-only changes + + -- Simon McVittie Thu, 18 Aug 2022 17:38:47 +0100 + +libsdl2 (2.23.2+dfsg-2) experimental; urgency=medium + + * d/patches: Update to upstream prerelease-2.23.2-10-g9670d2bb9, + excluding changes specific to non-Linux platforms (macOS and PS2) + + -- Simon McVittie Tue, 16 Aug 2022 12:34:50 +0100 + +libsdl2 (2.23.2+dfsg-1) experimental; urgency=medium + + * New upstream release candidate + * d/p/core-linux-Don-t-cache-the-RealtimeKit-D-Bus-connection.patch, + d/p/Add-SDL_JOYBATTERYUPDATED-event-to-SDL_JoystickEventState.patch: + Add post-release bugfixes from upstream + * d/p/no-libdir.patch: Redo to cope with changes to how static linking + is handled upstream + * d/libsdl2-2.0-0.symbols: Update + * Update Lintian overrides + + -- Simon McVittie Mon, 15 Aug 2022 19:34:25 +0100 + +libsdl2 (2.23.1+dfsg-1) experimental; urgency=medium + + * New upstream prerelease + * d/watch: Use GitHub to download releases + * d/watch: Download prereleases for experimental branch + * Merge packaging changes from unstable + + -- Simon McVittie Fri, 17 Jun 2022 12:13:59 +0100 + libsdl2 (2.0.22+dfsg-6) unstable; urgency=medium * d/watch: Use GitHub to download releases @@ -21,6 +73,27 @@ -- Simon McVittie Fri, 17 Jun 2022 10:14:50 +0100 +libsdl2 (2.0.22+git20220615+g960b86d+dfsg-1) experimental; urgency=medium + + * New upstream git snapshot + * d/p/cmake-Fix-static-linking-to-dependencies-with-in-library-.patch: + Drop patch, applied upstream + + -- Simon McVittie Wed, 15 Jun 2022 14:04:37 +0100 + +libsdl2 (2.0.22+git20220612+gbdf1413+dfsg-1) experimental; urgency=medium + + * New upstream git snapshot + * Update symbols file + * d/p/no-libdir.patch: Refresh for new upstream git snapshot + * Merge packaging from unstable + - d/p/345efdcb.patch: Drop, included in new upstream git snapshot + * d/copyright: Update + * d/p/cmake-Fix-static-linking-to-dependencies-with-in-library-.patch: + Add proposed patch to fix SDL2::SDL2-static target in our configuration + + -- Simon McVittie Mon, 13 Jun 2022 12:07:53 +0100 + libsdl2 (2.0.22+dfsg-5) unstable; urgency=medium * debian/patches/345efdcb.patch: @@ -30,6 +103,14 @@ -- Gianfranco Costamagna Mon, 06 Jun 2022 11:50:18 +0200 +libsdl2 (2.0.22+git20220530+g3c3c025+dfsg-1) experimental; urgency=medium + + * Merge packaging from unstable + * New upstream git snapshot + * Refresh patches + + -- Simon McVittie Tue, 31 May 2022 13:26:32 +0100 + libsdl2 (2.0.22+dfsg-4) unstable; urgency=medium [ Gianfranco Costamagna ] @@ -50,6 +131,29 @@ -- Simon McVittie Mon, 30 May 2022 16:43:30 +0100 +libsdl2 (2.0.22+git20220524+g5dee082+dfsg-1) experimental; urgency=medium + + * New upstream git snapshot + - Avoid implicit promotion from float to double (Closes: #1011014) + + -- Simon McVittie Tue, 24 May 2022 18:06:53 +0100 + +libsdl2 (2.0.22+git20220518.g4cb57bf+dfsg-1) experimental; urgency=medium + + * New upstream git snapshot + * Update symbols file + + -- Simon McVittie Wed, 18 May 2022 20:57:32 +0100 + +libsdl2 (2.0.22+git20220508.gc71ee68+dfsg-1) experimental; urgency=medium + + * d/gbp.conf, d/control: Branch for experimental + * New upstream git snapshot + - Drop patches that were applied upstream + - Update symbols file with new ABI from development branch + + -- Simon McVittie Mon, 09 May 2022 17:02:07 +0100 + libsdl2 (2.0.22+dfsg-3) unstable; urgency=medium * d/tests: Install the correct dependency. diff -Nru libsdl2-2.0.22+dfsg/debian/copyright libsdl2-2.24.0+dfsg/debian/copyright --- libsdl2-2.0.22+dfsg/debian/copyright 2022-06-17 09:14:50.000000000 +0000 +++ libsdl2-2.24.0+dfsg/debian/copyright 2022-08-22 10:45:00.000000000 +0000 @@ -19,7 +19,7 @@ 2012 Raspberry Pi Foundation 2012-2018 RISC OS Open Ltd 2018-2019 EXL - 2020-2021 Valve Corporation + 2020-2022 Valve Corporation License: zlib/libpng and zlib-libpng-like-permissive Files: include/SDL_egl.h diff -Nru libsdl2-2.0.22+dfsg/debian/libsdl2-2.0-0.symbols libsdl2-2.24.0+dfsg/debian/libsdl2-2.0-0.symbols --- libsdl2-2.0.22+dfsg/debian/libsdl2-2.0-0.symbols 2022-06-17 09:14:50.000000000 +0000 +++ libsdl2-2.24.0+dfsg/debian/libsdl2-2.0-0.symbols 2022-08-22 10:45:00.000000000 +0000 @@ -1,5 +1,7 @@ libSDL2-2.0.so.0 libsdl2-2.0-0 #MINVER# * Build-Depends-Package: libsdl2-dev + (arch=linux-any)SDL_LinuxSetThreadPriority@Base 2.0.12 + (arch=linux-any)SDL_LinuxSetThreadPriorityAndPolicy@Base 2.0.18 SDL_AddEventWatch@Base 2.0.12 SDL_AddHintCallback@Base 2.0.12 SDL_AddTimer@Base 2.0.12 @@ -111,6 +113,8 @@ SDL_GL_SwapWindow@Base 2.0.12 SDL_GL_UnbindTexture@Base 2.0.12 SDL_GL_UnloadLibrary@Base 2.0.12 + SDL_GUIDFromString@Base 2.0.22+git20220612 + SDL_GUIDToString@Base 2.0.22+git20220612 SDL_GameControllerAddMapping@Base 2.0.12 SDL_GameControllerAddMappingsFromRW@Base 2.0.12 SDL_GameControllerClose@Base 2.0.12 @@ -126,6 +130,7 @@ SDL_GameControllerGetBindForButton@Base 2.0.12 SDL_GameControllerGetButton@Base 2.0.12 SDL_GameControllerGetButtonFromString@Base 2.0.12 + SDL_GameControllerGetFirmwareVersion@Base 2.0.22+git20220612 SDL_GameControllerGetJoystick@Base 2.0.12 SDL_GameControllerGetNumTouchpadFingers@Base 2.0.14 SDL_GameControllerGetNumTouchpads@Base 2.0.14 @@ -155,6 +160,8 @@ SDL_GameControllerNameForIndex@Base 2.0.12 SDL_GameControllerNumMappings@Base 2.0.12 SDL_GameControllerOpen@Base 2.0.12 + SDL_GameControllerPath@Base 2.0.22+git20220508 + SDL_GameControllerPathForIndex@Base 2.0.22+git20220508 SDL_GameControllerRumble@Base 2.0.12 SDL_GameControllerRumbleTriggers@Base 2.0.14 SDL_GameControllerSendEffect@Base 2.0.16 @@ -182,6 +189,7 @@ SDL_GetCurrentVideoDriver@Base 2.0.12 SDL_GetCursor@Base 2.0.12 SDL_GetDefaultAssertionHandler@Base 2.0.12 + SDL_GetDefaultAudioInfo@Base 2.23.2 SDL_GetDefaultCursor@Base 2.0.12 SDL_GetDesktopDisplayMode@Base 2.0.12 SDL_GetDisplayBounds@Base 2.0.12 @@ -215,16 +223,19 @@ SDL_GetNumTouchFingers@Base 2.0.12 SDL_GetNumVideoDisplays@Base 2.0.12 SDL_GetNumVideoDrivers@Base 2.0.12 + SDL_GetOriginalMemoryFunctions@Base 2.23.2 SDL_GetPerformanceCounter@Base 2.0.12 SDL_GetPerformanceFrequency@Base 2.0.12 SDL_GetPixelFormatName@Base 2.0.12 SDL_GetPlatform@Base 2.0.12 + SDL_GetPointDisplayIndex@Base 2.23.2 SDL_GetPowerInfo@Base 2.0.12 SDL_GetPrefPath@Base 2.0.12 SDL_GetPreferredLocales@Base 2.0.14 SDL_GetQueuedAudioSize@Base 2.0.12 SDL_GetRGB@Base 2.0.12 SDL_GetRGBA@Base 2.0.12 + SDL_GetRectDisplayIndex@Base 2.23.2 SDL_GetRelativeMouseMode@Base 2.0.12 SDL_GetRelativeMouseState@Base 2.0.12 SDL_GetRenderDrawBlendMode@Base 2.0.12 @@ -323,6 +334,8 @@ SDL_HasEvents@Base 2.0.12 SDL_HasIntersection@Base 2.0.12 SDL_HasIntersectionF@Base 2.0.22~rc1 + SDL_HasLASX@Base 2.0.22+git20220612 + SDL_HasLSX@Base 2.0.22+git20220612 SDL_HasMMX@Base 2.0.12 SDL_HasNEON@Base 2.0.12 SDL_HasRDTSC@Base 2.0.12 @@ -348,6 +361,7 @@ SDL_IsTextInputActive@Base 2.0.12 SDL_IsTextInputShown@Base 2.0.22~rc1 SDL_JoystickAttachVirtual@Base 2.0.14 + SDL_JoystickAttachVirtualEx@Base 2.0.22+git20220518 SDL_JoystickClose@Base 2.0.12 SDL_JoystickCurrentPowerLevel@Base 2.0.12 SDL_JoystickDetachVirtual@Base 2.0.14 @@ -366,6 +380,7 @@ SDL_JoystickGetDeviceProductVersion@Base 2.0.12 SDL_JoystickGetDeviceType@Base 2.0.12 SDL_JoystickGetDeviceVendor@Base 2.0.12 + SDL_JoystickGetFirmwareVersion@Base 2.0.22+git20220612 SDL_JoystickGetGUID@Base 2.0.12 SDL_JoystickGetGUIDFromString@Base 2.0.12 SDL_JoystickGetGUIDString@Base 2.0.12 @@ -389,6 +404,8 @@ SDL_JoystickNumButtons@Base 2.0.12 SDL_JoystickNumHats@Base 2.0.12 SDL_JoystickOpen@Base 2.0.12 + SDL_JoystickPath@Base 2.0.22+git20220508 + SDL_JoystickPathForIndex@Base 2.0.22+git20220508 SDL_JoystickRumble@Base 2.0.12 SDL_JoystickRumbleTriggers@Base 2.0.14 SDL_JoystickSendEffect@Base 2.0.16 @@ -398,8 +415,6 @@ SDL_JoystickSetVirtualButton@Base 2.0.14 SDL_JoystickSetVirtualHat@Base 2.0.14 SDL_JoystickUpdate@Base 2.0.12 - (arch=linux-any)SDL_LinuxSetThreadPriority@Base 2.0.12 - (arch=linux-any)SDL_LinuxSetThreadPriorityAndPolicy@Base 2.0.18 SDL_LoadBMP_RW@Base 2.0.12 SDL_LoadDollarTemplates@Base 2.0.12 SDL_LoadFile@Base 2.0.12 @@ -538,6 +553,8 @@ SDL_RenderWindowToLogical@Base 2.0.18 SDL_ReportAssertion@Base 2.0.12 SDL_ResetAssertionReport@Base 2.0.12 + SDL_ResetHint@Base 2.23.2 + SDL_ResetKeyboard@Base 2.23.2 SDL_RestoreWindow@Base 2.0.12 SDL_SIMDAlloc@Base 2.0.12 SDL_SIMDFree@Base 2.0.12 @@ -682,6 +699,7 @@ SDL_atanf@Base 2.0.12 SDL_atof@Base 2.0.12 SDL_atoi@Base 2.0.12 + SDL_bsearch@Base 2.0.22+git20220508 SDL_calloc@Base 2.0.12 SDL_ceil@Base 2.0.12 SDL_ceilf@Base 2.0.12 @@ -689,6 +707,7 @@ SDL_copysignf@Base 2.0.12 SDL_cos@Base 2.0.12 SDL_cosf@Base 2.0.12 + SDL_crc16@Base 2.23.2 SDL_crc32@Base 2.0.14 SDL_exp@Base 2.0.12 SDL_expf@Base 2.0.12 @@ -795,6 +814,7 @@ SDL_ultoa@Base 2.0.12 SDL_utf8strlcpy@Base 2.0.12 SDL_utf8strlen@Base 2.0.12 + SDL_utf8strnlen@Base 2.0.22+git20220612 SDL_vasprintf@Base 2.0.18 SDL_vsnprintf@Base 2.0.12 SDL_vsscanf@Base 2.0.12 diff -Nru libsdl2-2.0.22+dfsg/debian/libsdl2-2.0-0-udeb.install libsdl2-2.24.0+dfsg/debian/libsdl2-2.0-0-udeb.install --- libsdl2-2.0.22+dfsg/debian/libsdl2-2.0-0-udeb.install 2022-06-17 09:14:50.000000000 +0000 +++ libsdl2-2.24.0+dfsg/debian/libsdl2-2.0-0-udeb.install 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -usr/lib/*/libSDL2-2.0.so.0* diff -Nru libsdl2-2.0.22+dfsg/debian/libsdl2-tests.lintian-overrides libsdl2-2.24.0+dfsg/debian/libsdl2-tests.lintian-overrides --- libsdl2-2.0.22+dfsg/debian/libsdl2-tests.lintian-overrides 2022-06-17 09:14:50.000000000 +0000 +++ libsdl2-2.24.0+dfsg/debian/libsdl2-tests.lintian-overrides 2022-08-22 10:45:00.000000000 +0000 @@ -1,2 +1,4 @@ +# the tests avoid direct calls into libc so there is not necessarily anything to fortify +libsdl2-tests: hardening-no-fortify-functions [usr/libexec/installed-tests/*] # test data is not documentation -libsdl2-tests: package-contains-documentation-outside-usr-share-doc usr/libexec/installed-tests/* +libsdl2-tests: package-contains-documentation-outside-usr-share-doc [usr/libexec/installed-tests/*] diff -Nru libsdl2-2.0.22+dfsg/debian/patches/345efdcb.patch libsdl2-2.24.0+dfsg/debian/patches/345efdcb.patch --- libsdl2-2.0.22+dfsg/debian/patches/345efdcb.patch 2022-06-17 09:14:50.000000000 +0000 +++ libsdl2-2.24.0+dfsg/debian/patches/345efdcb.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,126 +0,0 @@ -From 345efdcb10725681a09b2de59af31bff0368487e Mon Sep 17 00:00:00 2001 -From: Sam Lantinga -Date: Fri, 3 Jun 2022 08:46:08 -0700 -Subject: [PATCH] Wait for all the threads to actually finish before exiting - -Fixes https://github.com/libsdl-org/SDL/issues/5748 ---- - test/testatomic.c | 27 ++++++++++++--------------- - 1 file changed, 12 insertions(+), 15 deletions(-) - -diff --git a/test/testatomic.c b/test/testatomic.c -index 7dbad45a4cb..9efbb29c069 100644 ---- a/test/testatomic.c -+++ b/test/testatomic.c -@@ -471,9 +471,6 @@ static SDL_bool DequeueEvent_Mutex(SDL_EventQueue *queue, SDL_Event *event) - return status; - } - --static SDL_sem *writersDone; --static SDL_sem *readersDone; -- - typedef struct - { - SDL_EventQueue *queue; -@@ -482,6 +479,7 @@ typedef struct - int waits; - SDL_bool lock_free; - char padding2[SDL_CACHELINE_SIZE-sizeof(int)-sizeof(SDL_bool)]; -+ SDL_Thread *thread; - } WriterData; - - typedef struct -@@ -491,6 +489,7 @@ typedef struct - int waits; - SDL_bool lock_free; - char padding[SDL_CACHELINE_SIZE-(sizeof(SDL_EventQueue*)+sizeof(int)*NUM_WRITERS+sizeof(int)+sizeof(SDL_bool))%SDL_CACHELINE_SIZE]; -+ SDL_Thread *thread; - } ReaderData; - - static int SDLCALL FIFO_Writer(void* _data) -@@ -523,7 +522,6 @@ static int SDLCALL FIFO_Writer(void* _data) - } - } - } -- SDL_SemPost(writersDone); - return 0; - } - -@@ -560,7 +558,6 @@ static int SDLCALL FIFO_Reader(void* _data) - } - } - } -- SDL_SemPost(readersDone); - return 0; - } - -@@ -590,6 +587,7 @@ static int SDLCALL FIFO_Watcher(void* _data) - static void RunFIFOTest(SDL_bool lock_free) - { - SDL_EventQueue queue; -+ SDL_Thread *fifo_thread = NULL; - WriterData writerData[NUM_WRITERS]; - ReaderData readerData[NUM_READERS]; - Uint32 start, end; -@@ -601,9 +599,6 @@ static void RunFIFOTest(SDL_bool lock_free) - SDL_Log("\nFIFO test---------------------------------------\n\n"); - SDL_Log("Mode: %s\n", lock_free ? "LockFree" : "Mutex"); - -- readersDone = SDL_CreateSemaphore(0); -- writersDone = SDL_CreateSemaphore(0); -- - SDL_memset(&queue, 0xff, sizeof(queue)); - - InitEventQueue(&queue); -@@ -616,7 +611,7 @@ static void RunFIFOTest(SDL_bool lock_free) - #ifdef TEST_SPINLOCK_FIFO - /* Start a monitoring thread */ - if (lock_free) { -- SDL_CreateThread(FIFO_Watcher, "FIFOWatcher", &queue); -+ fifo_thread = SDL_CreateThread(FIFO_Watcher, "FIFOWatcher", &queue); - } - #endif - -@@ -628,7 +623,7 @@ static void RunFIFOTest(SDL_bool lock_free) - SDL_snprintf(name, sizeof (name), "FIFOReader%d", i); - readerData[i].queue = &queue; - readerData[i].lock_free = lock_free; -- SDL_CreateThread(FIFO_Reader, name, &readerData[i]); -+ readerData[i].thread = SDL_CreateThread(FIFO_Reader, name, &readerData[i]); - } - - /* Start up the writers */ -@@ -640,12 +635,12 @@ static void RunFIFOTest(SDL_bool lock_free) - writerData[i].queue = &queue; - writerData[i].index = i; - writerData[i].lock_free = lock_free; -- SDL_CreateThread(FIFO_Writer, name, &writerData[i]); -+ writerData[i].thread = SDL_CreateThread(FIFO_Writer, name, &writerData[i]); - } - - /* Wait for the writers */ - for (i = 0; i < NUM_WRITERS; ++i) { -- SDL_SemWait(writersDone); -+ SDL_WaitThread(writerData[i].thread, NULL); - } - - /* Shut down the queue so readers exit */ -@@ -653,13 +648,15 @@ static void RunFIFOTest(SDL_bool lock_free) - - /* Wait for the readers */ - for (i = 0; i < NUM_READERS; ++i) { -- SDL_SemWait(readersDone); -+ SDL_WaitThread(readerData[i].thread, NULL); - } - - end = SDL_GetTicks(); - -- SDL_DestroySemaphore(readersDone); -- SDL_DestroySemaphore(writersDone); -+ /* Wait for the FIFO thread */ -+ if (fifo_thread) { -+ SDL_WaitThread(fifo_thread, NULL); -+ } - - if (!lock_free) { - SDL_DestroyMutex(queue.mutex); diff -Nru libsdl2-2.0.22+dfsg/debian/patches/no-libdir.patch libsdl2-2.24.0+dfsg/debian/patches/no-libdir.patch --- libsdl2-2.0.22+dfsg/debian/patches/no-libdir.patch 2022-06-17 09:14:50.000000000 +0000 +++ libsdl2-2.24.0+dfsg/debian/patches/no-libdir.patch 2022-08-22 10:45:00.000000000 +0000 @@ -1,37 +1,43 @@ -From: Gianfranco Costamagna -Date: Wed, 27 Sep 2017 00:29:24 +0200 -Subject: Remove libdir from sdl2-config +From: Simon McVittie +Date: Mon, 15 Aug 2022 16:47:26 +0100 +Subject: Avoid hard-coding libdir in sdl2-config This makes the -dev package multiarch co-installable, allowing compilation of SDL programs for more than one architecture on the same system. -This is not an upstreamable change, since it relies on a Debian-specific -assumption (that we are installing the library into a directory on the -linker's default search path). - -[smcv: Only patch sdl2-config.in, not sdl2-config.cmake.in. It's OK for -sdl2-config.cmake to be architecture-dependent, because it gets installed -in ${libdir} anyway.] +This is not an upstreamable change, since it relies on Debian-specific +assumptions: +* we are installing the library into a directory on the linker's default + search path +* static linking is done with at least one of: + - $DEB_HOST_MULTIARCH set, or + - $PKG_CONFIG set to the host architecture pkg-config, or + - $CC set to a compiler for the host architecture that supports the + -print-multiarch argument (which Debian's gcc and clang do) + +Adapted from an earlier patch by Gianfranco Costamagna. + +Co-authored-by: Gianfranco Costamagna Forwarded: not-needed -Last-Update: 2021-08-11 +Last-Update: 2022-08-15 --- - sdl2-config.in | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) + sdl2-config.in | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sdl2-config.in b/sdl2-config.in -index 5a2aed2..5cc21a6 100644 +index f6eca76..70f0190 100644 --- a/sdl2-config.in +++ b/sdl2-config.in -@@ -3,7 +3,6 @@ - prefix=@prefix@ +@@ -7,7 +7,6 @@ bindir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)") + prefix=$(cd -P -- "$bindir/@bin_prefix_relpath@" && printf '%s\n' "$(pwd -P)") exec_prefix=@exec_prefix@ exec_prefix_set=no -libdir=@libdir@ @ENABLE_STATIC_FALSE@usage="\ @ENABLE_STATIC_FALSE@Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs]" -@@ -45,11 +44,11 @@ while test $# -gt 0; do +@@ -49,12 +48,20 @@ while test $# -gt 0; do echo -I@includedir@/SDL2 @SDL_CFLAGS@ ;; @ENABLE_SHARED_TRUE@ --libs) @@ -40,8 +46,17 @@ @ENABLE_SHARED_TRUE@ ;; @ENABLE_STATIC_TRUE@@ENABLE_SHARED_TRUE@ --static-libs) @ENABLE_STATIC_TRUE@@ENABLE_SHARED_FALSE@ --libs|--static-libs) --@ENABLE_STATIC_TRUE@ echo -L@libdir@ @SDL_LIBS@ @SDL_STATIC_LIBS@ -+@ENABLE_STATIC_TRUE@ echo @SDL_LIBS@ @SDL_STATIC_LIBS@ ++@ENABLE_STATIC_TRUE@ if [ -n "${DEB_HOST_MULTIARCH-}" ]; then ++@ENABLE_STATIC_TRUE@ libdir="/usr/lib/$DEB_HOST_MULTIARCH" ++@ENABLE_STATIC_TRUE@ elif [ -n "${PKG_CONFIG}" ]; then ++@ENABLE_STATIC_TRUE@ libdir="$("$PKG_CONFIG" --variable=libdir sdl2)" ++@ENABLE_STATIC_TRUE@ else ++@ENABLE_STATIC_TRUE@ # Assume CC is set to a suitable gcc or clang version ++@ENABLE_STATIC_TRUE@ libdir="/usr/lib/$("$CC" -print-multiarch)" ++@ENABLE_STATIC_TRUE@ fi + @ENABLE_STATIC_TRUE@ sdl_static_libs=$(echo "@SDL_LIBS@ @SDL_STATIC_LIBS@" | sed -E "s#-lSDL2[ $]#$libdir/libSDL2.a #g") +-@ENABLE_STATIC_TRUE@ echo -L@libdir@ $sdl_static_libs ++@ENABLE_STATIC_TRUE@ echo $sdl_static_libs @ENABLE_STATIC_TRUE@ ;; *) echo "${usage}" 1>&2 diff -Nru libsdl2-2.0.22+dfsg/debian/patches/series libsdl2-2.24.0+dfsg/debian/patches/series --- libsdl2-2.0.22+dfsg/debian/patches/series 2022-06-17 09:14:50.000000000 +0000 +++ libsdl2-2.24.0+dfsg/debian/patches/series 2022-08-22 10:45:00.000000000 +0000 @@ -1,7 +1,2 @@ -test-Run-selected-noninteractive-tests-at-build-time.patch -test-Add-some-common-code-to-load-test-resources.patch -test-Add-a-make-install-target-for-the-tests.patch -test-Install-GNOME-style-installed-tests-metadata.patch no-libdir.patch test-Don-t-install-bundled-copy-of-unifont.patch -345efdcb.patch diff -Nru libsdl2-2.0.22+dfsg/debian/patches/test-Add-a-make-install-target-for-the-tests.patch libsdl2-2.24.0+dfsg/debian/patches/test-Add-a-make-install-target-for-the-tests.patch --- libsdl2-2.0.22+dfsg/debian/patches/test-Add-a-make-install-target-for-the-tests.patch 2022-06-17 09:14:50.000000000 +0000 +++ libsdl2-2.24.0+dfsg/debian/patches/test-Add-a-make-install-target-for-the-tests.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,200 +0,0 @@ -From: Simon McVittie -Date: Wed, 25 Nov 2020 13:30:29 +0000 -Subject: test: Add a `make install` target for the tests - -This makes it more convenient to compile them alongside SDL, install -them in an optional package and use them as smoke-tests or diagnostic -tools. The default installation directory is taken from GNOME's -installed-tests, which seems as good a convention as any other: -https://wiki.gnome.org/Initiatives/GnomeGoals/InstalledTests - -Signed-off-by: Simon McVittie -Origin: upstream, 2.23.0, commit:38ef6789909c04bb688731fbc3c5433f7fb5bc81 ---- - CMakeLists.txt | 1 + - test/CMakeLists.txt | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++ - test/Makefile.in | 15 +++++++++ - test/configure.ac | 9 ++++++ - 4 files changed, 112 insertions(+) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 18d9c35..7cb15b6 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -457,6 +457,7 @@ set(SDL_STATIC ${SDL_STATIC_ENABLED_BY_DEFAULT} CACHE BOOL "Build a static versi - - dep_option(SDL_STATIC_PIC "Static version of the library should be built with Position Independent Code" OFF "SDL_STATIC" OFF) - set_option(SDL_TEST "Build the test directory" OFF) -+set_option(SDL_INSTALL_TESTS "Install test-cases" OFF) - - if(VITA) - set_option(VIDEO_VITA_PIB "Build with PSVita piglet gles2 support" OFF) -diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt -index a73b7b9..7568f24 100644 ---- a/test/CMakeLists.txt -+++ b/test/CMakeLists.txt -@@ -2,6 +2,10 @@ cmake_minimum_required(VERSION 3.0.0) - project(SDL2 C) - include(CTest) - -+if(SDL_INSTALL_TESTS) -+ include(GNUInstallDirs) -+endif() -+ - # Global settings for all of the test targets - # FIXME: is this wrong? - remove_definitions(-DUSING_GENERATED_CONFIG_H) -@@ -128,6 +132,77 @@ add_executable(controllermap controllermap.c testutils.c) - add_executable(testvulkan testvulkan.c) - add_executable(testoffscreen testoffscreen.c) - -+SET(ALL_TESTS -+ checkkeys -+ checkkeysthreads -+ controllermap -+ loopwave -+ loopwavequeue -+ testatomic -+ testaudiocapture -+ testaudiohotplug -+ testaudioinfo -+ testautomation -+ testbounds -+ testcustomcursor -+ testdisplayinfo -+ testdraw2 -+ testdrawchessboard -+ testdropfile -+ testerror -+ testfile -+ testfilesystem -+ testgamecontroller -+ testgeometry -+ testgesture -+ testgl2 -+ testgles -+ testgles2 -+ testhaptic -+ testhittesting -+ testhotplug -+ testiconv -+ testime -+ testintersections -+ testjoystick -+ testkeys -+ testloadso -+ testlocale -+ testlock -+ testmessage -+ testmouse -+ testmultiaudio -+ testnative -+ testoffscreen -+ testoverlay2 -+ testplatform -+ testpower -+ testqsort -+ testrelative -+ testrendercopyex -+ testrendertarget -+ testresample -+ testrumble -+ testscale -+ testsem -+ testsensor -+ testshader -+ testshape -+ testsprite2 -+ testspriteminimal -+ teststreaming -+ testsurround -+ testthread -+ testtimer -+ testurl -+ testver -+ testviewport -+ testvulkan -+ testwm2 -+ testyuv -+ torturethread -+) -+ - set(NONINTERACTIVE - testatomic - testerror -@@ -143,6 +218,7 @@ set(NONINTERACTIVE - ) - - if(LINUX) -+ list(APPEND ALL_TESTS testevdev) - list(APPEND NONINTERACTIVE testevdev) - endif() - -@@ -346,3 +422,14 @@ foreach(TESTCASE ${NONINTERACTIVE} ${NEEDS_AUDIO} ${NEEDS_DISPLAY}) - PROPERTIES ENVIRONMENT "${TESTS_ENVIRONMENT}" - ) - endforeach() -+ -+if(SDL_INSTALL_TESTS) -+ install( -+ TARGETS ${ALL_TESTS} -+ DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/installed-tests/SDL2 -+ ) -+ install( -+ FILES ${RESOURCE_FILES} -+ DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/installed-tests/SDL2 -+ ) -+endif() -diff --git a/test/Makefile.in b/test/Makefile.in -index 8c11dbf..d14e073 100644 ---- a/test/Makefile.in -+++ b/test/Makefile.in -@@ -2,6 +2,15 @@ - - srcdir = @srcdir@ - -+prefix = @prefix@ -+exec_prefix = @exec_prefix@ -+bindir = @bindir@ -+libdir = @libdir@ -+libexecdir = @libexecdir@ -+includedir = @includedir@ -+datarootdir = @datarootdir@ -+datadir = @datadir@ -+ - CC = @CC@ - EXE = @EXE@ - CFLAGS = @CFLAGS@ -g -@@ -81,6 +90,12 @@ TARGETS = \ - - all: Makefile $(TARGETS) copydatafiles - -+installedtestsdir = $(libexecdir)/installed-tests/SDL2 -+ -+install: all -+ install -D -t $(DESTDIR)$(installedtestsdir) $(TARGETS) -+ install -m644 -D -t $(DESTDIR)$(installedtestsdir) $(DATA) -+ - Makefile: $(srcdir)/Makefile.in - $(SHELL) config.status $@ - -diff --git a/test/configure.ac b/test/configure.ac -index 694551c..3d37b6a 100644 ---- a/test/configure.ac -+++ b/test/configure.ac -@@ -99,6 +99,15 @@ AC_SUBST(ISWINDOWS) - AC_SUBST(ISUNIX) - AC_SUBST(ISOS2) - -+AC_SUBST([prefix]) -+AC_SUBST([exec_prefix]) -+AC_SUBST([bindir]) -+AC_SUBST([libdir]) -+AC_SUBST([libexecdir]) -+AC_SUBST([includedir]) -+AC_SUBST([datarootdir]) -+AC_SUBST([datadir]) -+ - dnl Check for SDL - SDL_VERSION=2.0.18 - AM_PATH_SDL2($SDL_VERSION, diff -Nru libsdl2-2.0.22+dfsg/debian/patches/test-Add-some-common-code-to-load-test-resources.patch libsdl2-2.24.0+dfsg/debian/patches/test-Add-some-common-code-to-load-test-resources.patch --- libsdl2-2.0.22+dfsg/debian/patches/test-Add-some-common-code-to-load-test-resources.patch 2022-06-17 09:14:50.000000000 +0000 +++ libsdl2-2.24.0+dfsg/debian/patches/test-Add-some-common-code-to-load-test-resources.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,1597 +0,0 @@ -From: Simon McVittie -Date: Tue, 12 Apr 2022 13:07:18 +0100 -Subject: test: Add some common code to load test resources - -As well as reducing duplication, this lets the tests load their resources -from the SDL_GetBasePath() on platforms that support it, which is useful -if the tests are compiled along with the rest of SDL and installed below -/usr as manual tests, similar to GNOME's installed-tests convention. - -Thanks to Ozkan Sezer for the OS/2 build glue. - -Co-authored-by: Ozkan Sezer -Signed-off-by: Simon McVittie -Origin: upstream, 2.23.0, commit:76a7b629bfc4869df7659c2f2e47d9253c73696f ---- - test/CMakeLists.txt | 42 ++++++------- - test/Makefile.in | 39 ++++++------ - test/Makefile.os2 | 12 ++-- - test/controllermap.c | 42 ++----------- - test/loopwave.c | 14 +++-- - test/loopwavequeue.c | 15 +++-- - test/testaudiohotplug.c | 14 +++-- - test/testgamecontroller.c | 37 ++---------- - test/testgeometry.c | 40 +------------ - test/testgles2_sdf.c | 18 +++++- - test/testiconv.c | 6 +- - test/testime.c | 10 +++- - test/testmultiaudio.c | 6 +- - test/testnative.c | 34 +---------- - test/testoverlay2.c | 10 +++- - test/testrendercopyex.c | 56 +---------------- - test/testrendertarget.c | 58 ++---------------- - test/testscale.c | 55 +---------------- - test/testsprite2.c | 40 +------------ - test/testspriteminimal.c | 54 ++--------------- - test/teststreaming.c | 10 +++- - test/testutils.c | 149 ++++++++++++++++++++++++++++++++++++++++++++++ - test/testutils.h | 17 ++++++ - test/testviewport.c | 55 ++--------------- - 24 files changed, 331 insertions(+), 502 deletions(-) - create mode 100644 test/testutils.c - create mode 100644 test/testutils.h - -diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt -index d2fc493..a73b7b9 100644 ---- a/test/CMakeLists.txt -+++ b/test/CMakeLists.txt -@@ -49,8 +49,8 @@ endif() - - add_executable(checkkeys checkkeys.c) - add_executable(checkkeysthreads checkkeysthreads.c) --add_executable(loopwave loopwave.c) --add_executable(loopwavequeue loopwavequeue.c) -+add_executable(loopwave loopwave.c testutils.c) -+add_executable(loopwavequeue loopwavequeue.c testutils.c) - add_executable(testsurround testsurround.c) - add_executable(testresample testresample.c) - add_executable(testaudioinfo testaudioinfo.c) -@@ -58,8 +58,8 @@ add_executable(testaudioinfo testaudioinfo.c) - file(GLOB TESTAUTOMATION_SOURCE_FILES testautomation*.c) - add_executable(testautomation ${TESTAUTOMATION_SOURCE_FILES}) - --add_executable(testmultiaudio testmultiaudio.c) --add_executable(testaudiohotplug testaudiohotplug.c) -+add_executable(testmultiaudio testmultiaudio.c testutils.c) -+add_executable(testaudiohotplug testaudiohotplug.c testutils.c) - add_executable(testaudiocapture testaudiocapture.c) - add_executable(testatomic testatomic.c) - add_executable(testintersections testintersections.c) -@@ -70,8 +70,8 @@ add_executable(testdrawchessboard testdrawchessboard.c) - add_executable(testdropfile testdropfile.c) - add_executable(testerror testerror.c) - add_executable(testfile testfile.c) --add_executable(testgamecontroller testgamecontroller.c) --add_executable(testgeometry testgeometry.c) -+add_executable(testgamecontroller testgamecontroller.c testutils.c) -+add_executable(testgeometry testgeometry.c testutils.c) - add_executable(testgesture testgesture.c) - add_executable(testgl2 testgl2.c) - add_executable(testgles testgles.c) -@@ -80,8 +80,8 @@ add_executable(testhaptic testhaptic.c) - add_executable(testhotplug testhotplug.c) - add_executable(testrumble testrumble.c) - add_executable(testthread testthread.c) --add_executable(testiconv testiconv.c) --add_executable(testime testime.c) -+add_executable(testiconv testiconv.c testutils.c) -+add_executable(testime testime.c testutils.c) - add_executable(testjoystick testjoystick.c) - add_executable(testkeys testkeys.c) - add_executable(testloadso testloadso.c) -@@ -91,38 +91,40 @@ add_executable(testmouse testmouse.c) - if(APPLE) - add_executable(testnative testnative.c - testnativecocoa.m -- testnativex11.c) -+ testnativex11.c -+ testutils.c) - elseif(WINDOWS) -- add_executable(testnative testnative.c testnativew32.c) -+ add_executable(testnative testnative.c testnativew32.c testutils.c) - elseif(UNIX) -- add_executable(testnative testnative.c testnativex11.c) -+ add_executable(testnative testnative.c testnativex11.c testutils.c) -+ target_link_libraries(testnative X11) - endif() - --add_executable(testoverlay2 testoverlay2.c testyuv_cvt.c) -+add_executable(testoverlay2 testoverlay2.c testyuv_cvt.c testutils.c) - add_executable(testplatform testplatform.c) - add_executable(testpower testpower.c) - add_executable(testfilesystem testfilesystem.c) --add_executable(testrendertarget testrendertarget.c) --add_executable(testscale testscale.c) -+add_executable(testrendertarget testrendertarget.c testutils.c) -+add_executable(testscale testscale.c testutils.c) - add_executable(testsem testsem.c) - add_executable(testshader testshader.c) - add_executable(testshape testshape.c) --add_executable(testsprite2 testsprite2.c) --add_executable(testspriteminimal testspriteminimal.c) --add_executable(teststreaming teststreaming.c) -+add_executable(testsprite2 testsprite2.c testutils.c) -+add_executable(testspriteminimal testspriteminimal.c testutils.c) -+add_executable(teststreaming teststreaming.c testutils.c) - add_executable(testtimer testtimer.c) - add_executable(testver testver.c) --add_executable(testviewport testviewport.c) -+add_executable(testviewport testviewport.c testutils.c) - add_executable(testwm2 testwm2.c) - add_executable(testyuv testyuv.c testyuv_cvt.c) - add_executable(torturethread torturethread.c) --add_executable(testrendercopyex testrendercopyex.c) -+add_executable(testrendercopyex testrendercopyex.c testutils.c) - add_executable(testmessage testmessage.c) - add_executable(testdisplayinfo testdisplayinfo.c) - add_executable(testqsort testqsort.c) - add_executable(testbounds testbounds.c) - add_executable(testcustomcursor testcustomcursor.c) --add_executable(controllermap controllermap.c) -+add_executable(controllermap controllermap.c testutils.c) - add_executable(testvulkan testvulkan.c) - add_executable(testoffscreen testoffscreen.c) - -diff --git a/test/Makefile.in b/test/Makefile.in -index 120e585..8c11dbf 100644 ---- a/test/Makefile.in -+++ b/test/Makefile.in -@@ -90,10 +90,10 @@ checkkeys$(EXE): $(srcdir)/checkkeys.c - checkkeysthreads$(EXE): $(srcdir)/checkkeysthreads.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) - --loopwave$(EXE): $(srcdir)/loopwave.c -+loopwave$(EXE): $(srcdir)/loopwave.c $(srcdir)/testutils.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) - --loopwavequeue$(EXE): $(srcdir)/loopwavequeue.c -+loopwavequeue$(EXE): $(srcdir)/loopwavequeue.c $(srcdir)/testutils.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) - - testsurround$(EXE): $(srcdir)/testsurround.c -@@ -126,10 +126,10 @@ testautomation$(EXE): $(srcdir)/testautomation.c \ - $(srcdir)/testautomation_hints.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) - --testmultiaudio$(EXE): $(srcdir)/testmultiaudio.c -+testmultiaudio$(EXE): $(srcdir)/testmultiaudio.c $(srcdir)/testutils.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) - --testaudiohotplug$(EXE): $(srcdir)/testaudiohotplug.c -+testaudiohotplug$(EXE): $(srcdir)/testaudiohotplug.c $(srcdir)/testutils.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) - - testaudiocapture$(EXE): $(srcdir)/testaudiocapture.c -@@ -165,10 +165,10 @@ testevdev$(EXE): $(srcdir)/testevdev.c - testfile$(EXE): $(srcdir)/testfile.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) - --testgamecontroller$(EXE): $(srcdir)/testgamecontroller.c -+testgamecontroller$(EXE): $(srcdir)/testgamecontroller.c $(srcdir)/testutils.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) - --testgeometry$(EXE): $(srcdir)/testgeometry.c -+testgeometry$(EXE): $(srcdir)/testgeometry.c $(srcdir)/testutils.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) - - testgesture$(EXE): $(srcdir)/testgesture.c -@@ -183,7 +183,7 @@ testgles$(EXE): $(srcdir)/testgles.c - testgles2$(EXE): $(srcdir)/testgles2.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@ - --testgles2_sdf$(EXE): $(srcdir)/testgles2_sdf.c -+testgles2_sdf$(EXE): $(srcdir)/testgles2_sdf.c $(srcdir)/testutils.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@ - - testhaptic$(EXE): $(srcdir)/testhaptic.c -@@ -198,10 +198,10 @@ testrumble$(EXE): $(srcdir)/testrumble.c - testthread$(EXE): $(srcdir)/testthread.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) - --testiconv$(EXE): $(srcdir)/testiconv.c -+testiconv$(EXE): $(srcdir)/testiconv.c $(srcdir)/testutils.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) - --testime$(EXE): $(srcdir)/testime.c -+testime$(EXE): $(srcdir)/testime.c $(srcdir)/testutils.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @SDL_TTF_LIB@ - - testjoystick$(EXE): $(srcdir)/testjoystick.c -@@ -219,18 +219,21 @@ testlock$(EXE): $(srcdir)/testlock.c - ifeq (@ISMACOSX@,true) - testnative$(EXE): $(srcdir)/testnative.c \ - $(srcdir)/testnativecocoa.m \ -+ $(srcdir)/testutils.c \ - $(srcdir)/testnativex11.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -framework Cocoa @XLIB@ - endif - - ifeq (@ISWINDOWS@,true) - testnative$(EXE): $(srcdir)/testnative.c \ -+ $(srcdir)/testutils.c \ - $(srcdir)/testnativew32.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) - endif - - ifeq (@ISUNIX@,true) - testnative$(EXE): $(srcdir)/testnative.c \ -+ $(srcdir)/testutils.c \ - $(srcdir)/testnativex11.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @XLIB@ - endif -@@ -252,7 +255,7 @@ endif - endif - endif - --testoverlay2$(EXE): $(srcdir)/testoverlay2.c $(srcdir)/testyuv_cvt.c -+testoverlay2$(EXE): $(srcdir)/testoverlay2.c $(srcdir)/testyuv_cvt.c $(srcdir)/testutils.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) - - testplatform$(EXE): $(srcdir)/testplatform.c -@@ -264,10 +267,10 @@ testpower$(EXE): $(srcdir)/testpower.c - testfilesystem$(EXE): $(srcdir)/testfilesystem.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) - --testrendertarget$(EXE): $(srcdir)/testrendertarget.c -+testrendertarget$(EXE): $(srcdir)/testrendertarget.c $(srcdir)/testutils.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) - --testscale$(EXE): $(srcdir)/testscale.c -+testscale$(EXE): $(srcdir)/testscale.c $(srcdir)/testutils.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) - - testsem$(EXE): $(srcdir)/testsem.c -@@ -282,13 +285,13 @@ testshader$(EXE): $(srcdir)/testshader.c - testshape$(EXE): $(srcdir)/testshape.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) - --testsprite2$(EXE): $(srcdir)/testsprite2.c -+testsprite2$(EXE): $(srcdir)/testsprite2.c $(srcdir)/testutils.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) - --testspriteminimal$(EXE): $(srcdir)/testspriteminimal.c -+testspriteminimal$(EXE): $(srcdir)/testspriteminimal.c $(srcdir)/testutils.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@ - --teststreaming$(EXE): $(srcdir)/teststreaming.c -+teststreaming$(EXE): $(srcdir)/teststreaming.c $(srcdir)/testutils.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@ - - testtimer$(EXE): $(srcdir)/testtimer.c -@@ -300,7 +303,7 @@ testurl$(EXE): $(srcdir)/testurl.c - testver$(EXE): $(srcdir)/testver.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) - --testviewport$(EXE): $(srcdir)/testviewport.c -+testviewport$(EXE): $(srcdir)/testviewport.c $(srcdir)/testutils.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) - - testwm2$(EXE): $(srcdir)/testwm2.c -@@ -312,7 +315,7 @@ testyuv$(EXE): $(srcdir)/testyuv.c $(srcdir)/testyuv_cvt.c - torturethread$(EXE): $(srcdir)/torturethread.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) - --testrendercopyex$(EXE): $(srcdir)/testrendercopyex.c -+testrendercopyex$(EXE): $(srcdir)/testrendercopyex.c $(srcdir)/testutils.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@ - - testmessage$(EXE): $(srcdir)/testmessage.c -@@ -330,7 +333,7 @@ testbounds$(EXE): $(srcdir)/testbounds.c - testcustomcursor$(EXE): $(srcdir)/testcustomcursor.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) - --controllermap$(EXE): $(srcdir)/controllermap.c -+controllermap$(EXE): $(srcdir)/controllermap.c $(srcdir)/testutils.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) - - testvulkan$(EXE): $(srcdir)/testvulkan.c -diff --git a/test/Makefile.os2 b/test/Makefile.os2 -index e238af4..8600837 100644 ---- a/test/Makefile.os2 -+++ b/test/Makefile.os2 -@@ -7,7 +7,7 @@ CFLAGS = $(INCPATH) -bt=os2 -d0 -q -bm -5s -fp5 -fpi87 -sg -oteanbmier -ei - CFLAGS+= -wx -wcd=303 - - LIBPATH = .. --LIBS = SDL2.lib SDL2test.lib -+LIBS = SDL2.lib SDL2test.lib testutils.lib - - #CFLAGS+= -DHAVE_SDL_TTF - #TTFLIBS = SDL2ttf.lib -@@ -44,7 +44,7 @@ OBJS = $(TARGETS:.exe=.obj) - COBJS = $(CSRCS:.c=.obj) - TAOBJS = $(TASRCS:.c=.obj) - --all: $(TARGETS) -+all: testutils.lib $(TARGETS) - - .c: ../src/test - -@@ -70,8 +70,10 @@ testyuv.exe: testyuv.obj testyuv_cvt.obj - testime.exe: testime.obj - wlink SYS os2v2 libpath $(LIBPATH) lib {$(LIBS) $(TTFLIBS)} op q op el file {$<} name $@ - -+testutils.lib: testutils.obj -+ wlib -q -b -n -c -pa -s -t -zld -ii -io $@ $< -+ - clean: .SYMBOLIC -- @if exist *.obj rm *.obj -- @if exist *.err rm *.err -+ rm -f *.obj *.err - distclean: .SYMBOLIC clean -- @if exist *.exe rm *.exe -+ rm -f *.exe *.lib -diff --git a/test/controllermap.c b/test/controllermap.c -index 308ddf5..429125a 100644 ---- a/test/controllermap.c -+++ b/test/controllermap.c -@@ -18,6 +18,7 @@ - #include - - #include "SDL.h" -+#include "testutils.h" - - #ifndef SDL_JOYSTICK_DISABLED - -@@ -169,39 +170,6 @@ static SDL_Renderer *screen; - static SDL_bool done = SDL_FALSE; - static SDL_bool bind_touchpad = SDL_FALSE; - --SDL_Texture * --LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent) --{ -- SDL_Surface *temp; -- SDL_Texture *texture; -- -- /* Load the sprite image */ -- temp = SDL_LoadBMP(file); -- if (temp == NULL) { -- SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError()); -- return NULL; -- } -- -- /* Set transparent pixel as the pixel at (0,0) */ -- if (transparent) { -- if (temp->format->palette) { -- SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *) temp->pixels); -- } -- } -- -- /* Create textures from the image */ -- texture = SDL_CreateTextureFromSurface(renderer, temp); -- if (!texture) { -- SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); -- SDL_FreeSurface(temp); -- return NULL; -- } -- SDL_FreeSurface(temp); -- -- /* We're ready to roll. :) */ -- return texture; --} -- - static int - StandardizeAxisValue(int nValue) - { -@@ -392,10 +360,10 @@ WatchJoystick(SDL_Joystick * joystick) - Uint32 alpha_ticks = 0; - SDL_JoystickID nJoystickID; - -- background_front = LoadTexture(screen, "controllermap.bmp", SDL_FALSE); -- background_back = LoadTexture(screen, "controllermap_back.bmp", SDL_FALSE); -- button = LoadTexture(screen, "button.bmp", SDL_TRUE); -- axis = LoadTexture(screen, "axis.bmp", SDL_TRUE); -+ background_front = LoadTexture(screen, "controllermap.bmp", SDL_FALSE, NULL, NULL); -+ background_back = LoadTexture(screen, "controllermap_back.bmp", SDL_FALSE, NULL, NULL); -+ button = LoadTexture(screen, "button.bmp", SDL_TRUE, NULL, NULL); -+ axis = LoadTexture(screen, "axis.bmp", SDL_TRUE, NULL, NULL); - SDL_RaiseWindow(window); - - /* scale for platforms that don't give you the window size you asked for. */ -diff --git a/test/loopwave.c b/test/loopwave.c -index 14ac4db..354ac2c 100644 ---- a/test/loopwave.c -+++ b/test/loopwave.c -@@ -25,6 +25,7 @@ - #endif - - #include "SDL.h" -+#include "testutils.h" - - static struct - { -@@ -114,7 +115,7 @@ int - main(int argc, char *argv[]) - { - int i; -- char filename[4096]; -+ char *filename = NULL; - - /* Enable standard application logging */ - SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); -@@ -125,11 +126,13 @@ main(int argc, char *argv[]) - return (1); - } - -- if (argc > 1) { -- SDL_strlcpy(filename, argv[1], sizeof(filename)); -- } else { -- SDL_strlcpy(filename, "sample.wav", sizeof(filename)); -+ filename = GetResourceFilename(argc > 1 ? argv[1] : NULL, "sample.wav"); -+ -+ if (filename == NULL) { -+ SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError()); -+ quit(1); - } -+ - /* Load the wave file into memory */ - if (SDL_LoadWAV(filename, &wave.spec, &wave.sound, &wave.soundlen) == NULL) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", filename, SDL_GetError()); -@@ -172,6 +175,7 @@ main(int argc, char *argv[]) - /* Clean up on signal */ - close_audio(); - SDL_FreeWAV(wave.sound); -+ SDL_free(filename); - SDL_Quit(); - return (0); - } -diff --git a/test/loopwavequeue.c b/test/loopwavequeue.c -index a5d0ea3..1996d78 100644 ---- a/test/loopwavequeue.c -+++ b/test/loopwavequeue.c -@@ -25,6 +25,8 @@ - #include - #endif - -+#include "testutils.h" -+ - static struct - { - SDL_AudioSpec spec; -@@ -74,7 +76,7 @@ loop() - int - main(int argc, char *argv[]) - { -- char filename[4096]; -+ char *filename = NULL; - - /* Enable standard application logging */ - SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); -@@ -85,11 +87,13 @@ main(int argc, char *argv[]) - return (1); - } - -- if (argc > 1) { -- SDL_strlcpy(filename, argv[1], sizeof(filename)); -- } else { -- SDL_strlcpy(filename, "sample.wav", sizeof(filename)); -+ filename = GetResourceFilename(argc > 1 ? argv[1] : NULL, "sample.wav"); -+ -+ if (filename == NULL) { -+ SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError()); -+ quit(1); - } -+ - /* Load the wave file into memory */ - if (SDL_LoadWAV(filename, &wave.spec, &wave.sound, &wave.soundlen) == NULL) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", filename, SDL_GetError()); -@@ -142,6 +146,7 @@ main(int argc, char *argv[]) - /* Clean up on signal */ - SDL_CloseAudio(); - SDL_FreeWAV(wave.sound); -+ SDL_free(filename); - SDL_Quit(); - return 0; - } -diff --git a/test/testaudiohotplug.c b/test/testaudiohotplug.c -index 536cc4c..dc84a78 100644 ---- a/test/testaudiohotplug.c -+++ b/test/testaudiohotplug.c -@@ -26,6 +26,7 @@ - #endif - - #include "SDL.h" -+#include "testutils.h" - - static SDL_AudioSpec spec; - static Uint8 *sound = NULL; /* Pointer to wave data */ -@@ -137,7 +138,7 @@ int - main(int argc, char *argv[]) - { - int i; -- char filename[4096]; -+ char *filename = NULL; - - /* Enable standard application logging */ - SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); -@@ -151,11 +152,13 @@ main(int argc, char *argv[]) - /* Some targets (Mac CoreAudio) need an event queue for audio hotplug, so make and immediately hide a window. */ - SDL_MinimizeWindow(SDL_CreateWindow("testaudiohotplug", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, 0)); - -- if (argc > 1) { -- SDL_strlcpy(filename, argv[1], sizeof(filename)); -- } else { -- SDL_strlcpy(filename, "sample.wav", sizeof(filename)); -+ filename = GetResourceFilename(argc > 1 ? argv[1] : NULL, "sample.wav"); -+ -+ if (filename == NULL) { -+ SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError()); -+ quit(1); - } -+ - /* Load the wave file into memory */ - if (SDL_LoadWAV(filename, &spec, &sound, &soundlen) == NULL) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", filename, SDL_GetError()); -@@ -196,6 +199,7 @@ main(int argc, char *argv[]) - /* Quit audio first, then free WAV. This prevents access violations in the audio threads. */ - SDL_QuitSubSystem(SDL_INIT_AUDIO); - SDL_FreeWAV(sound); -+ SDL_free(filename); - SDL_Quit(); - return (0); - } -diff --git a/test/testgamecontroller.c b/test/testgamecontroller.c -index 17fb60b..e65166c 100644 ---- a/test/testgamecontroller.c -+++ b/test/testgamecontroller.c -@@ -17,6 +17,7 @@ - #include - - #include "SDL.h" -+#include "testutils.h" - - #ifdef __EMSCRIPTEN__ - #include -@@ -216,34 +217,6 @@ static void DelController(SDL_JoystickID controller) - UpdateWindowTitle(); - } - --static SDL_Texture * --LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent) --{ -- SDL_Surface *temp = NULL; -- SDL_Texture *texture = NULL; -- -- temp = SDL_LoadBMP(file); -- if (temp == NULL) { -- SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError()); -- } else { -- /* Set transparent pixel as the pixel at (0,0) */ -- if (transparent) { -- if (temp->format->BytesPerPixel == 1) { -- SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *)temp->pixels); -- } -- } -- -- texture = SDL_CreateTextureFromSurface(renderer, temp); -- if (!texture) { -- SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); -- } -- } -- if (temp) { -- SDL_FreeSurface(temp); -- } -- return texture; --} -- - static Uint16 ConvertAxisToRumble(Sint16 axisval) - { - /* Only start rumbling if the axis is past the halfway point */ -@@ -634,10 +607,10 @@ main(int argc, char *argv[]) - /* scale for platforms that don't give you the window size you asked for. */ - SDL_RenderSetLogicalSize(screen, SCREEN_WIDTH, SCREEN_HEIGHT); - -- background_front = LoadTexture(screen, "controllermap.bmp", SDL_FALSE); -- background_back = LoadTexture(screen, "controllermap_back.bmp", SDL_FALSE); -- button = LoadTexture(screen, "button.bmp", SDL_TRUE); -- axis = LoadTexture(screen, "axis.bmp", SDL_TRUE); -+ background_front = LoadTexture(screen, "controllermap.bmp", SDL_FALSE, NULL, NULL); -+ background_back = LoadTexture(screen, "controllermap_back.bmp", SDL_FALSE, NULL, NULL); -+ button = LoadTexture(screen, "button.bmp", SDL_TRUE, NULL, NULL); -+ axis = LoadTexture(screen, "axis.bmp", SDL_TRUE, NULL, NULL); - - if (!background_front || !background_back || !button || !axis) { - SDL_DestroyRenderer(screen); -diff --git a/test/testgeometry.c b/test/testgeometry.c -index 3a87e3d..f0f07ee 100644 ---- a/test/testgeometry.c -+++ b/test/testgeometry.c -@@ -21,6 +21,7 @@ - #endif - - #include "SDL_test_common.h" -+#include "testutils.h" - - static SDLTest_CommonState *state; - static SDL_bool use_texture = SDL_FALSE; -@@ -44,54 +45,19 @@ int - LoadSprite(const char *file) - { - int i; -- SDL_Surface *temp; - -- /* Load the sprite image */ -- temp = SDL_LoadBMP(file); -- if (temp == NULL) { -- SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError()); -- return (-1); -- } -- sprite_w = temp->w; -- sprite_h = temp->h; -- -- /* Set transparent pixel as the pixel at (0,0) */ -- if (temp->format->palette) { -- SDL_SetColorKey(temp, 1, *(Uint8 *) temp->pixels); -- } else { -- switch (temp->format->BitsPerPixel) { -- case 15: -- SDL_SetColorKey(temp, 1, (*(Uint16 *) temp->pixels) & 0x00007FFF); -- break; -- case 16: -- SDL_SetColorKey(temp, 1, *(Uint16 *) temp->pixels); -- break; -- case 24: -- SDL_SetColorKey(temp, 1, (*(Uint32 *) temp->pixels) & 0x00FFFFFF); -- break; -- case 32: -- SDL_SetColorKey(temp, 1, *(Uint32 *) temp->pixels); -- break; -- } -- } -- -- /* Create textures from the image */ - for (i = 0; i < state->num_windows; ++i) { -- SDL_Renderer *renderer = state->renderers[i]; -- sprites[i] = SDL_CreateTextureFromSurface(renderer, temp); -+ /* This does the SDL_LoadBMP step repeatedly, but that's OK for test code. */ -+ sprites[i] = LoadTexture(state->renderers[i], file, SDL_TRUE, &sprite_w, &sprite_h); - if (!sprites[i]) { -- SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); -- SDL_FreeSurface(temp); - return (-1); - } - if (SDL_SetTextureBlendMode(sprites[i], blendMode) < 0) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set blend mode: %s\n", SDL_GetError()); -- SDL_FreeSurface(temp); - SDL_DestroyTexture(sprites[i]); - return (-1); - } - } -- SDL_FreeSurface(temp); - - /* We're ready to roll. :) */ - return (0); -diff --git a/test/testgles2_sdf.c b/test/testgles2_sdf.c -index a7f8016..064b6bc 100644 ---- a/test/testgles2_sdf.c -+++ b/test/testgles2_sdf.c -@@ -458,6 +458,7 @@ main(int argc, char *argv[]) - Uint32 then, now; - int status; - shader_data *data; -+ char *path = NULL; - - /* Initialize parameters */ - fsaa = 0; -@@ -561,14 +562,25 @@ main(int argc, char *argv[]) - - /* Load SDF BMP image */ - #if 1 -- tmp = SDL_LoadBMP(f); -+ path = GetNearbyFilename(f); -+ -+ if (path == NULL) -+ path = SDL_strdup(f); -+ -+ if (path == NULL) { -+ SDL_Log("out of memory\n"); -+ exit(-1); -+ } -+ -+ tmp = SDL_LoadBMP(path); - if (tmp == NULL) { -- SDL_Log("missing image file: %s", f); -+ SDL_Log("missing image file: %s", path); - exit(-1); - } else { -- SDL_Log("Load image file: %s", f); -+ SDL_Log("Load image file: %s", path); - } - -+ SDL_free(path); - #else - /* Generate SDF image using SDL_ttf */ - -diff --git a/test/testiconv.c b/test/testiconv.c -index bf9ad3b..31d05e1 100644 ---- a/test/testiconv.c -+++ b/test/testiconv.c -@@ -13,6 +13,7 @@ - #include - - #include "SDL.h" -+#include "testutils.h" - - static size_t - widelen(char *data) -@@ -43,7 +44,7 @@ main(int argc, char *argv[]) - "UCS-4", - }; - -- const char * fname; -+ char * fname; - char buffer[BUFSIZ]; - char *ucs4; - char *test[2]; -@@ -54,12 +55,13 @@ main(int argc, char *argv[]) - /* Enable standard application logging */ - SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); - -- fname = (argc < 2) ? "utf8.txt" : argv[1]; -+ fname = GetResourceFilename(argc > 1 ? argv[1] : NULL, "utf8.txt"); - file = fopen(fname, "rb"); - if (!file) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to open %s\n", fname); - return (1); - } -+ SDL_free(fname); - - while (fgets(buffer, sizeof(buffer), file)) { - /* Convert to UCS-4 */ -diff --git a/test/testime.c b/test/testime.c -index 5541d48..1558342 100644 ---- a/test/testime.c -+++ b/test/testime.c -@@ -23,6 +23,7 @@ - #endif - - #include "SDL_test_common.h" -+#include "testutils.h" - - #define DEFAULT_PTSIZE 30 - #ifdef HAVE_SDL_TTF -@@ -108,6 +109,7 @@ static int unifont_init(const char *fontname) - SDL_RWops *hexFile; - const size_t unifontGlyphSize = UNIFONT_NUM_GLYPHS * sizeof(struct UnifontGlyph); - const size_t unifontTextureSize = UNIFONT_NUM_TEXTURES * state->num_windows * sizeof(void *); -+ char *filename; - - /* Allocate memory for the glyph data so the file can be closed after initialization. */ - unifontGlyph = (struct UnifontGlyph *)SDL_malloc(unifontGlyphSize); -@@ -127,7 +129,13 @@ static int unifont_init(const char *fontname) - } - SDL_memset(unifontTexture, 0, unifontTextureSize); - -- hexFile = SDL_RWFromFile(fontname, "rb"); -+ filename = GetResourceFilename(NULL, fontname); -+ if (filename == NULL) { -+ SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory\n"); -+ return -1; -+ } -+ hexFile = SDL_RWFromFile(filename, "rb"); -+ SDL_free(filename); - if (hexFile == NULL) - { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to open font file: %s\n", fontname); -diff --git a/test/testmultiaudio.c b/test/testmultiaudio.c -index 51a7ff0..1154b83 100644 ---- a/test/testmultiaudio.c -+++ b/test/testmultiaudio.c -@@ -17,6 +17,8 @@ - #include - #endif - -+#include "testutils.h" -+ - static SDL_AudioSpec spec; - static Uint8 *sound = NULL; /* Pointer to wave data */ - static Uint32 soundlen = 0; /* Length of wave data */ -@@ -180,7 +182,7 @@ main(int argc, char **argv) - if (devcount < 1) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Don't see any specific audio devices!\n"); - } else { -- const char *file = (argc < 2) ? "sample.wav" : argv[1]; -+ char *file = GetResourceFilename(argc > 1 ? argv[1] : NULL, "sample.wav"); - - /* Load the wave file into memory */ - if (SDL_LoadWAV(file, &spec, &sound, &soundlen) == NULL) { -@@ -190,6 +192,8 @@ main(int argc, char **argv) - test_multi_audio(devcount); - SDL_FreeWAV(sound); - } -+ -+ SDL_free(file); - } - - SDL_Quit(); -diff --git a/test/testnative.c b/test/testnative.c -index 48f6f0e..34ee661 100644 ---- a/test/testnative.c -+++ b/test/testnative.c -@@ -16,6 +16,7 @@ - #include /* for time() */ - - #include "testnative.h" -+#include "testutils.h" - - #define WINDOW_W 640 - #define WINDOW_H 480 -@@ -52,37 +53,6 @@ quit(int rc) - exit(rc); - } - --SDL_Texture * --LoadSprite(SDL_Renderer *renderer, const char *file) --{ -- SDL_Surface *temp; -- SDL_Texture *sprite; -- -- /* Load the sprite image */ -- temp = SDL_LoadBMP(file); -- if (temp == NULL) { -- SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError()); -- return 0; -- } -- -- /* Set transparent pixel as the pixel at (0,0) */ -- if (temp->format->palette) { -- SDL_SetColorKey(temp, 1, *(Uint8 *) temp->pixels); -- } -- -- /* Create textures from the image */ -- sprite = SDL_CreateTextureFromSurface(renderer, temp); -- if (!sprite) { -- SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); -- SDL_FreeSurface(temp); -- return 0; -- } -- SDL_FreeSurface(temp); -- -- /* We're ready to roll. :) */ -- return sprite; --} -- - void - MoveSprites(SDL_Renderer * renderer, SDL_Texture * sprite) - { -@@ -180,7 +150,7 @@ main(int argc, char *argv[]) - SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF); - SDL_RenderClear(renderer); - -- sprite = LoadSprite(renderer, "icon.bmp"); -+ sprite = LoadTexture(renderer, "icon.bmp", SDL_TRUE, NULL, NULL); - if (!sprite) { - quit(6); - } -diff --git a/test/testoverlay2.c b/test/testoverlay2.c -index 8bb59a9..ab0fd82 100644 ---- a/test/testoverlay2.c -+++ b/test/testoverlay2.c -@@ -25,6 +25,7 @@ - #include "SDL.h" - - #include "testyuv_cvt.h" -+#include "testutils.h" - - #define MOOSEPIC_W 64 - #define MOOSEPIC_H 88 -@@ -243,6 +244,7 @@ main(int argc, char **argv) - int fps = 12; - int nodelay = 0; - int scale = 5; -+ char *filename = NULL; - - /* Enable standard application logging */ - SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); -@@ -315,7 +317,13 @@ main(int argc, char **argv) - } - - /* load the trojan moose images */ -- handle = SDL_RWFromFile("moose.dat", "rb"); -+ filename = GetResourceFilename(NULL, "moose.dat"); -+ if (filename == NULL) { -+ SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory\n"); -+ return -1; -+ } -+ handle = SDL_RWFromFile(filename, "rb"); -+ SDL_free(filename); - if (handle == NULL) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't find the file moose.dat !\n"); - SDL_free(RawMooseData); -diff --git a/test/testrendercopyex.c b/test/testrendercopyex.c -index 47d3ae9..b954499 100644 ---- a/test/testrendercopyex.c -+++ b/test/testrendercopyex.c -@@ -20,7 +20,7 @@ - #endif - - #include "SDL_test_common.h" -- -+#include "testutils.h" - - static SDLTest_CommonState *state; - -@@ -44,56 +44,6 @@ quit(int rc) - exit(rc); - } - --SDL_Texture * --LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent) --{ -- SDL_Surface *temp; -- SDL_Texture *texture; -- -- /* Load the sprite image */ -- temp = SDL_LoadBMP(file); -- if (temp == NULL) { -- SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError()); -- return NULL; -- } -- -- /* Set transparent pixel as the pixel at (0,0) */ -- if (transparent) { -- if (temp->format->palette) { -- SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *) temp->pixels); -- } else { -- switch (temp->format->BitsPerPixel) { -- case 15: -- SDL_SetColorKey(temp, SDL_TRUE, -- (*(Uint16 *) temp->pixels) & 0x00007FFF); -- break; -- case 16: -- SDL_SetColorKey(temp, SDL_TRUE, *(Uint16 *) temp->pixels); -- break; -- case 24: -- SDL_SetColorKey(temp, SDL_TRUE, -- (*(Uint32 *) temp->pixels) & 0x00FFFFFF); -- break; -- case 32: -- SDL_SetColorKey(temp, SDL_TRUE, *(Uint32 *) temp->pixels); -- break; -- } -- } -- } -- -- /* Create textures from the image */ -- texture = SDL_CreateTextureFromSurface(renderer, temp); -- if (!texture) { -- SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); -- SDL_FreeSurface(temp); -- return NULL; -- } -- SDL_FreeSurface(temp); -- -- /* We're ready to roll. :) */ -- return texture; --} -- - void - Draw(DrawState *s) - { -@@ -186,8 +136,8 @@ main(int argc, char *argv[]) - - drawstate->window = state->windows[i]; - drawstate->renderer = state->renderers[i]; -- drawstate->sprite = LoadTexture(drawstate->renderer, "icon.bmp", SDL_TRUE); -- drawstate->background = LoadTexture(drawstate->renderer, "sample.bmp", SDL_FALSE); -+ drawstate->sprite = LoadTexture(drawstate->renderer, "icon.bmp", SDL_TRUE, NULL, NULL); -+ drawstate->background = LoadTexture(drawstate->renderer, "sample.bmp", SDL_FALSE, NULL, NULL); - if (!drawstate->sprite || !drawstate->background) { - quit(2); - } -diff --git a/test/testrendertarget.c b/test/testrendertarget.c -index 3fb6112..98ceb16 100644 ---- a/test/testrendertarget.c -+++ b/test/testrendertarget.c -@@ -20,7 +20,7 @@ - #endif - - #include "SDL_test_common.h" -- -+#include "testutils.h" - - static SDLTest_CommonState *state; - -@@ -45,56 +45,6 @@ quit(int rc) - exit(rc); - } - --SDL_Texture * --LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent) --{ -- SDL_Surface *temp; -- SDL_Texture *texture; -- -- /* Load the sprite image */ -- temp = SDL_LoadBMP(file); -- if (temp == NULL) { -- SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError()); -- return NULL; -- } -- -- /* Set transparent pixel as the pixel at (0,0) */ -- if (transparent) { -- if (temp->format->palette) { -- SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *) temp->pixels); -- } else { -- switch (temp->format->BitsPerPixel) { -- case 15: -- SDL_SetColorKey(temp, SDL_TRUE, -- (*(Uint16 *) temp->pixels) & 0x00007FFF); -- break; -- case 16: -- SDL_SetColorKey(temp, SDL_TRUE, *(Uint16 *) temp->pixels); -- break; -- case 24: -- SDL_SetColorKey(temp, SDL_TRUE, -- (*(Uint32 *) temp->pixels) & 0x00FFFFFF); -- break; -- case 32: -- SDL_SetColorKey(temp, SDL_TRUE, *(Uint32 *) temp->pixels); -- break; -- } -- } -- } -- -- /* Create textures from the image */ -- texture = SDL_CreateTextureFromSurface(renderer, temp); -- if (!texture) { -- SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); -- SDL_FreeSurface(temp); -- return NULL; -- } -- SDL_FreeSurface(temp); -- -- /* We're ready to roll. :) */ -- return texture; --} -- - SDL_bool - DrawComposite(DrawState *s) - { -@@ -292,11 +242,11 @@ main(int argc, char *argv[]) - drawstate->window = state->windows[i]; - drawstate->renderer = state->renderers[i]; - if (test_composite) { -- drawstate->sprite = LoadTexture(drawstate->renderer, "icon-alpha.bmp", SDL_TRUE); -+ drawstate->sprite = LoadTexture(drawstate->renderer, "icon-alpha.bmp", SDL_TRUE, NULL, NULL); - } else { -- drawstate->sprite = LoadTexture(drawstate->renderer, "icon.bmp", SDL_TRUE); -+ drawstate->sprite = LoadTexture(drawstate->renderer, "icon.bmp", SDL_TRUE, NULL, NULL); - } -- drawstate->background = LoadTexture(drawstate->renderer, "sample.bmp", SDL_FALSE); -+ drawstate->background = LoadTexture(drawstate->renderer, "sample.bmp", SDL_FALSE, NULL, NULL); - if (!drawstate->sprite || !drawstate->background) { - quit(2); - } -diff --git a/test/testscale.c b/test/testscale.c -index 1235c81..0f1d21b 100644 ---- a/test/testscale.c -+++ b/test/testscale.c -@@ -20,6 +20,7 @@ - #endif - - #include "SDL_test_common.h" -+#include "testutils.h" - - #define WINDOW_WIDTH 640 - #define WINDOW_HEIGHT 480 -@@ -46,56 +47,6 @@ quit(int rc) - exit(rc); - } - --SDL_Texture * --LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent) --{ -- SDL_Surface *temp; -- SDL_Texture *texture; -- -- /* Load the sprite image */ -- temp = SDL_LoadBMP(file); -- if (temp == NULL) { -- SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError()); -- return NULL; -- } -- -- /* Set transparent pixel as the pixel at (0,0) */ -- if (transparent) { -- if (temp->format->palette) { -- SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *) temp->pixels); -- } else { -- switch (temp->format->BitsPerPixel) { -- case 15: -- SDL_SetColorKey(temp, SDL_TRUE, -- (*(Uint16 *) temp->pixels) & 0x00007FFF); -- break; -- case 16: -- SDL_SetColorKey(temp, SDL_TRUE, *(Uint16 *) temp->pixels); -- break; -- case 24: -- SDL_SetColorKey(temp, SDL_TRUE, -- (*(Uint32 *) temp->pixels) & 0x00FFFFFF); -- break; -- case 32: -- SDL_SetColorKey(temp, SDL_TRUE, *(Uint32 *) temp->pixels); -- break; -- } -- } -- } -- -- /* Create textures from the image */ -- texture = SDL_CreateTextureFromSurface(renderer, temp); -- if (!texture) { -- SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); -- SDL_FreeSurface(temp); -- return NULL; -- } -- SDL_FreeSurface(temp); -- -- /* We're ready to roll. :) */ -- return texture; --} -- - void - Draw(DrawState *s) - { -@@ -176,8 +127,8 @@ main(int argc, char *argv[]) - - drawstate->window = state->windows[i]; - drawstate->renderer = state->renderers[i]; -- drawstate->sprite = LoadTexture(drawstate->renderer, "icon.bmp", SDL_TRUE); -- drawstate->background = LoadTexture(drawstate->renderer, "sample.bmp", SDL_FALSE); -+ drawstate->sprite = LoadTexture(drawstate->renderer, "icon.bmp", SDL_TRUE, NULL, NULL); -+ drawstate->background = LoadTexture(drawstate->renderer, "sample.bmp", SDL_FALSE, NULL, NULL); - if (!drawstate->sprite || !drawstate->background) { - quit(2); - } -diff --git a/test/testsprite2.c b/test/testsprite2.c -index 88419ff..fa709e3 100644 ---- a/test/testsprite2.c -+++ b/test/testsprite2.c -@@ -21,6 +21,7 @@ - - #include "SDL_test.h" - #include "SDL_test_common.h" -+#include "testutils.h" - - #define NUM_SPRITES 100 - #define MAX_SPEED 1 -@@ -62,54 +63,19 @@ int - LoadSprite(const char *file) - { - int i; -- SDL_Surface *temp; - -- /* Load the sprite image */ -- temp = SDL_LoadBMP(file); -- if (temp == NULL) { -- SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError()); -- return (-1); -- } -- sprite_w = temp->w; -- sprite_h = temp->h; -- -- /* Set transparent pixel as the pixel at (0,0) */ -- if (temp->format->palette) { -- SDL_SetColorKey(temp, 1, *(Uint8 *) temp->pixels); -- } else { -- switch (temp->format->BitsPerPixel) { -- case 15: -- SDL_SetColorKey(temp, 1, (*(Uint16 *) temp->pixels) & 0x00007FFF); -- break; -- case 16: -- SDL_SetColorKey(temp, 1, *(Uint16 *) temp->pixels); -- break; -- case 24: -- SDL_SetColorKey(temp, 1, (*(Uint32 *) temp->pixels) & 0x00FFFFFF); -- break; -- case 32: -- SDL_SetColorKey(temp, 1, *(Uint32 *) temp->pixels); -- break; -- } -- } -- -- /* Create textures from the image */ - for (i = 0; i < state->num_windows; ++i) { -- SDL_Renderer *renderer = state->renderers[i]; -- sprites[i] = SDL_CreateTextureFromSurface(renderer, temp); -+ /* This does the SDL_LoadBMP step repeatedly, but that's OK for test code. */ -+ sprites[i] = LoadTexture(state->renderers[i], file, SDL_TRUE, &sprite_w, &sprite_h); - if (!sprites[i]) { -- SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); -- SDL_FreeSurface(temp); - return (-1); - } - if (SDL_SetTextureBlendMode(sprites[i], blendMode) < 0) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set blend mode: %s\n", SDL_GetError()); -- SDL_FreeSurface(temp); - SDL_DestroyTexture(sprites[i]); - return (-1); - } - } -- SDL_FreeSurface(temp); - - /* We're ready to roll. :) */ - return (0); -diff --git a/test/testspriteminimal.c b/test/testspriteminimal.c -index b9762ca..36ea373 100644 ---- a/test/testspriteminimal.c -+++ b/test/testspriteminimal.c -@@ -20,6 +20,7 @@ - #endif - - #include "SDL.h" -+#include "testutils.h" - - #define WINDOW_WIDTH 640 - #define WINDOW_HEIGHT 480 -@@ -42,55 +43,6 @@ quit(int rc) - exit(rc); - } - --int --LoadSprite(const char *file) --{ -- SDL_Surface *temp; -- -- /* Load the sprite image */ -- temp = SDL_LoadBMP(file); -- if (temp == NULL) { -- SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", file, SDL_GetError()); -- return (-1); -- } -- sprite_w = temp->w; -- sprite_h = temp->h; -- -- /* Set transparent pixel as the pixel at (0,0) */ -- if (temp->format->palette) { -- SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *) temp->pixels); -- } else { -- switch (temp->format->BitsPerPixel) { -- case 15: -- SDL_SetColorKey(temp, SDL_TRUE, -- (*(Uint16 *) temp->pixels) & 0x00007FFF); -- break; -- case 16: -- SDL_SetColorKey(temp, SDL_TRUE, *(Uint16 *) temp->pixels); -- break; -- case 24: -- SDL_SetColorKey(temp, SDL_TRUE, -- (*(Uint32 *) temp->pixels) & 0x00FFFFFF); -- break; -- case 32: -- SDL_SetColorKey(temp, SDL_TRUE, *(Uint32 *) temp->pixels); -- break; -- } -- } -- -- /* Create textures from the image */ -- sprite = SDL_CreateTextureFromSurface(renderer, temp); -- if (!sprite) { -- SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); -- SDL_FreeSurface(temp); -- return (-1); -- } -- SDL_FreeSurface(temp); -- -- /* We're ready to roll. :) */ -- return (0); --} -- - void - MoveSprites() - { -@@ -158,7 +110,9 @@ main(int argc, char *argv[]) - quit(2); - } - -- if (LoadSprite("icon.bmp") < 0) { -+ sprite = LoadTexture(renderer, "icon.bmp", SDL_TRUE, &sprite_w, &sprite_h); -+ -+ if (sprite == NULL) { - quit(2); - } - -diff --git a/test/teststreaming.c b/test/teststreaming.c -index 72444f8..dc3ae61 100644 ---- a/test/teststreaming.c -+++ b/test/teststreaming.c -@@ -23,6 +23,7 @@ - #endif - - #include "SDL.h" -+#include "testutils.h" - - #define MOOSEPIC_W 64 - #define MOOSEPIC_H 88 -@@ -128,6 +129,7 @@ main(int argc, char **argv) - { - SDL_Window *window; - SDL_RWops *handle; -+ char *filename = NULL; - - /* Enable standard application logging */ - SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); -@@ -138,7 +140,13 @@ main(int argc, char **argv) - } - - /* load the moose images */ -- handle = SDL_RWFromFile("moose.dat", "rb"); -+ filename = GetResourceFilename(NULL, "moose.dat"); -+ if (filename == NULL) { -+ SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory\n"); -+ return -1; -+ } -+ handle = SDL_RWFromFile(filename, "rb"); -+ SDL_free(filename); - if (handle == NULL) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't find the file moose.dat !\n"); - quit(2); -diff --git a/test/testutils.c b/test/testutils.c -new file mode 100644 -index 0000000..3bb2b9c ---- /dev/null -+++ b/test/testutils.c -@@ -0,0 +1,149 @@ -+/* -+Copyright 1997-2022 Sam Lantinga -+Copyright 2022 Collabora Ltd. -+SPDX-License-Identifier: Zlib -+*/ -+ -+#include "testutils.h" -+ -+#if defined(SDL_FILESYSTEM_OS2) || defined(SDL_FILESYSTEM_WINDOWS) -+static const char pathsep[] = "\\"; -+#elif defined(SDL_FILESYSTEM_RISCOS) -+static const char pathsep[] = "."; -+#else -+static const char pathsep[] = "/"; -+#endif -+ -+/* -+ * Return the absolute path to def in the SDL_GetBasePath() if possible, or -+ * the relative path to def on platforms that don't have a working -+ * SDL_GetBasePath(). Free the result with SDL_free. -+ * -+ * Fails and returns NULL if out of memory. -+ */ -+char * -+GetNearbyFilename(const char *file) -+{ -+ char *base; -+ char *path; -+ -+ base = SDL_GetBasePath(); -+ -+ if (base != NULL) { -+ size_t len = SDL_strlen(base) + SDL_strlen(pathsep) + SDL_strlen(file) + 1; -+ -+ path = SDL_malloc(len); -+ -+ if (path == NULL) { -+ SDL_OutOfMemory(); -+ return NULL; -+ } -+ -+ SDL_snprintf(path, len, "%s%s%s", base, pathsep, file); -+ } -+ -+ if (base) { -+ SDL_free(base); -+ } -+ -+ return path; -+} -+ -+/* -+ * If user_specified is non-NULL, return a copy of it. Free with SDL_free. -+ * -+ * Otherwise, return the absolute path to def in the SDL_GetBasePath() if -+ * possible, or the relative path to def on platforms that don't have a -+ * working SDL_GetBasePath(). Free the result with SDL_free. -+ * -+ * Fails and returns NULL if out of memory. -+ */ -+char * -+GetResourceFilename(const char *user_specified, const char *def) -+{ -+ if (user_specified != NULL) { -+ char *ret = SDL_strdup(user_specified); -+ -+ if (ret == NULL) { -+ SDL_OutOfMemory(); -+ } -+ -+ return ret; -+ } else { -+ return GetNearbyFilename(def); -+ } -+} -+ -+/* -+ * Load the .bmp file whose name is file, from the SDL_GetBasePath() if -+ * possible or the current working directory if not. -+ * -+ * If transparent is true, set the transparent colour from the top left pixel. -+ * -+ * If width_out is non-NULL, set it to the texture width. -+ * -+ * If height_out is non-NULL, set it to the texture height. -+ */ -+SDL_Texture * -+LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent, -+ int *width_out, int *height_out) -+{ -+ SDL_Surface *temp = NULL; -+ SDL_Texture *texture = NULL; -+ char *path; -+ -+ path = GetNearbyFilename(file); -+ -+ if (path != NULL) { -+ file = path; -+ } -+ -+ temp = SDL_LoadBMP(file); -+ if (temp == NULL) { -+ SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError()); -+ } else { -+ /* Set transparent pixel as the pixel at (0,0) */ -+ if (transparent) { -+ if (temp->format->palette) { -+ SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *)temp->pixels); -+ } else { -+ switch (temp->format->BitsPerPixel) { -+ case 15: -+ SDL_SetColorKey(temp, SDL_TRUE, -+ (*(Uint16 *) temp->pixels) & 0x00007FFF); -+ break; -+ case 16: -+ SDL_SetColorKey(temp, SDL_TRUE, *(Uint16 *) temp->pixels); -+ break; -+ case 24: -+ SDL_SetColorKey(temp, SDL_TRUE, -+ (*(Uint32 *) temp->pixels) & 0x00FFFFFF); -+ break; -+ case 32: -+ SDL_SetColorKey(temp, SDL_TRUE, *(Uint32 *) temp->pixels); -+ break; -+ } -+ } -+ } -+ -+ if (width_out != NULL) { -+ *width_out = temp->w; -+ } -+ -+ if (height_out != NULL) { -+ *height_out = temp->h; -+ } -+ -+ texture = SDL_CreateTextureFromSurface(renderer, temp); -+ if (!texture) { -+ SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); -+ } -+ } -+ if (temp) { -+ SDL_FreeSurface(temp); -+ } -+ if (path) { -+ SDL_free(path); -+ } -+ return texture; -+} -diff --git a/test/testutils.h b/test/testutils.h -new file mode 100644 -index 0000000..cf24ca0 ---- /dev/null -+++ b/test/testutils.h -@@ -0,0 +1,17 @@ -+/* -+Copyright 1997-2022 Sam Lantinga -+Copyright 2022 Collabora Ltd. -+SPDX-License-Identifier: Zlib -+*/ -+ -+#ifndef TESTUTILS_H -+#define TESTUTILS_H -+ -+#include "SDL.h" -+ -+SDL_Texture *LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent, -+ int *width_out, int *height_out); -+char *GetNearbyFilename(const char *file); -+char *GetResourceFilename(const char *user_specified, const char *def); -+ -+#endif -diff --git a/test/testviewport.c b/test/testviewport.c -index 0e39d85..162b310 100644 ---- a/test/testviewport.c -+++ b/test/testviewport.c -@@ -21,7 +21,7 @@ - - #include "SDL_test.h" - #include "SDL_test_common.h" -- -+#include "testutils.h" - - static SDLTest_CommonState *state; - -@@ -42,55 +42,6 @@ quit(int rc) - exit(rc); - } - --int --LoadSprite(const char *file, SDL_Renderer *renderer) --{ -- SDL_Surface *temp; -- -- /* Load the sprite image */ -- temp = SDL_LoadBMP(file); -- if (temp == NULL) { -- SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", file, SDL_GetError()); -- return (-1); -- } -- sprite_w = temp->w; -- sprite_h = temp->h; -- -- /* Set transparent pixel as the pixel at (0,0) */ -- if (temp->format->palette) { -- SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *) temp->pixels); -- } else { -- switch (temp->format->BitsPerPixel) { -- case 15: -- SDL_SetColorKey(temp, SDL_TRUE, -- (*(Uint16 *) temp->pixels) & 0x00007FFF); -- break; -- case 16: -- SDL_SetColorKey(temp, SDL_TRUE, *(Uint16 *) temp->pixels); -- break; -- case 24: -- SDL_SetColorKey(temp, SDL_TRUE, -- (*(Uint32 *) temp->pixels) & 0x00FFFFFF); -- break; -- case 32: -- SDL_SetColorKey(temp, SDL_TRUE, *(Uint32 *) temp->pixels); -- break; -- } -- } -- -- /* Create textures from the image */ -- sprite = SDL_CreateTextureFromSurface(renderer, temp); -- if (!sprite) { -- SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); -- SDL_FreeSurface(temp); -- return (-1); -- } -- SDL_FreeSurface(temp); -- -- /* We're ready to roll. :) */ -- return (0); --} -- - void - DrawOnViewport(SDL_Renderer * renderer) - { -@@ -229,7 +180,9 @@ main(int argc, char *argv[]) - quit(2); - } - -- if (LoadSprite("icon.bmp", state->renderers[0]) < 0) { -+ sprite = LoadTexture(state->renderers[0], "icon.bmp", SDL_TRUE, &sprite_w, &sprite_h); -+ -+ if (sprite == NULL) { - quit(2); - } - diff -Nru libsdl2-2.0.22+dfsg/debian/patches/test-Don-t-install-bundled-copy-of-unifont.patch libsdl2-2.24.0+dfsg/debian/patches/test-Don-t-install-bundled-copy-of-unifont.patch --- libsdl2-2.0.22+dfsg/debian/patches/test-Don-t-install-bundled-copy-of-unifont.patch 2022-06-17 09:14:50.000000000 +0000 +++ libsdl2-2.24.0+dfsg/debian/patches/test-Don-t-install-bundled-copy-of-unifont.patch 2022-08-22 10:45:00.000000000 +0000 @@ -11,10 +11,10 @@ 1 file changed, 1 deletion(-) diff --git a/test/Makefile.in b/test/Makefile.in -index 8fce76e..6373651 100644 +index 93df636..6970f65 100644 --- a/test/Makefile.in +++ b/test/Makefile.in -@@ -435,7 +435,6 @@ DATA = \ +@@ -440,7 +440,6 @@ DATA = \ testgles2_sdf_img_normal.bmp \ testgles2_sdf_img_sdf.bmp \ testyuv.bmp \ diff -Nru libsdl2-2.0.22+dfsg/debian/patches/test-Install-GNOME-style-installed-tests-metadata.patch libsdl2-2.24.0+dfsg/debian/patches/test-Install-GNOME-style-installed-tests-metadata.patch --- libsdl2-2.0.22+dfsg/debian/patches/test-Install-GNOME-style-installed-tests-metadata.patch 2022-06-17 09:14:50.000000000 +0000 +++ libsdl2-2.24.0+dfsg/debian/patches/test-Install-GNOME-style-installed-tests-metadata.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,84 +0,0 @@ -From: Simon McVittie -Date: Wed, 4 May 2022 13:53:15 +0100 -Subject: test: Install GNOME-style installed-tests metadata - -This allows these tests to be discovered and run by -gnome-desktop-test-runner. - -Signed-off-by: Simon McVittie -Origin: upstream, 2.23.0, commit:ce502054ad03cfea3851f09ed227fdf0d619f39b ---- - test/CMakeLists.txt | 9 +++++++++ - test/Makefile.in | 15 +++++++++++++-- - test/template.test.in | 3 +++ - 3 files changed, 25 insertions(+), 2 deletions(-) - create mode 100644 test/template.test.in - -diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt -index 7568f24..98bd09e 100644 ---- a/test/CMakeLists.txt -+++ b/test/CMakeLists.txt -@@ -421,6 +421,15 @@ foreach(TESTCASE ${NONINTERACTIVE} ${NEEDS_AUDIO} ${NEEDS_DISPLAY}) - ${TESTCASE} - PROPERTIES ENVIRONMENT "${TESTS_ENVIRONMENT}" - ) -+ if(SDL_INSTALL_TESTS) -+ set(exe ${TESTCASE}) -+ set(installedtestsdir "${CMAKE_INSTALL_FULL_LIBEXECDIR}/installed-tests/SDL2") -+ configure_file(template.test.in "${exe}.test" @ONLY) -+ install( -+ FILES "${CMAKE_CURRENT_BINARY_DIR}/${exe}.test" -+ DESTINATION ${CMAKE_INSTALL_DATADIR}/installed-tests/SDL2 -+ ) -+ endif() - endforeach() - - if(SDL_INSTALL_TESTS) -diff --git a/test/Makefile.in b/test/Makefile.in -index d14e073..8fce76e 100644 ---- a/test/Makefile.in -+++ b/test/Makefile.in -@@ -88,13 +88,24 @@ TARGETS = \ - @OPENGLES2_TARGETS@ += testgles2$(EXE) - - --all: Makefile $(TARGETS) copydatafiles -+all: Makefile $(TARGETS) copydatafiles generatetestmeta - - installedtestsdir = $(libexecdir)/installed-tests/SDL2 -+installedtestsmetadir = $(datadir)/installed-tests/SDL2 -+ -+generatetestmeta: -+ rm -f *.test -+ set -e; for exe in $(noninteractive) $(needs_audio) $(needs_display); do \ -+ sed \ -+ -e 's#@installedtestsdir@#$(installedtestsdir)#g' \ -+ -e "s#@exe@#$$exe#g" \ -+ < $(srcdir)/template.test.in > $$exe.test; \ -+ done - - install: all - install -D -t $(DESTDIR)$(installedtestsdir) $(TARGETS) - install -m644 -D -t $(DESTDIR)$(installedtestsdir) $(DATA) -+ install -m644 -D -t $(DESTDIR)$(installedtestsmetadir) *.test - - Makefile: $(srcdir)/Makefile.in - $(SHELL) config.status $@ -@@ -362,7 +373,7 @@ testmouse$(EXE): $(srcdir)/testmouse.c - - - clean: -- rm -f $(TARGETS) -+ rm -f $(TARGETS) *.test - - distclean: clean - rm -f Makefile -diff --git a/test/template.test.in b/test/template.test.in -new file mode 100644 -index 0000000..e1ac063 ---- /dev/null -+++ b/test/template.test.in -@@ -0,0 +1,3 @@ -+[Test] -+Type=session -+Exec=@installedtestsdir@/@exe@ diff -Nru libsdl2-2.0.22+dfsg/debian/patches/test-Run-selected-noninteractive-tests-at-build-time.patch libsdl2-2.24.0+dfsg/debian/patches/test-Run-selected-noninteractive-tests-at-build-time.patch --- libsdl2-2.0.22+dfsg/debian/patches/test-Run-selected-noninteractive-tests-at-build-time.patch 2022-06-17 09:14:50.000000000 +0000 +++ libsdl2-2.24.0+dfsg/debian/patches/test-Run-selected-noninteractive-tests-at-build-time.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,149 +0,0 @@ -From: Simon McVittie -Date: Tue, 12 Apr 2022 13:33:58 +0100 -Subject: test: Run selected noninteractive tests at build-time - -In Autotools, these are run by `make -C ${builddir}/test check`. -In CMake, they're run by `make -C ${builddir} test` or -`ninja -C ${builddir} test` or `ctest --test-dir ${builddir}`. - -Signed-off-by: Simon McVittie -Origin: upstream, 2.23.0, commit:7d2808e30b1405b91eb92439cadee6ab25dc9bfc ---- - CMakeLists.txt | 1 + - test/CMakeLists.txt | 46 ++++++++++++++++++++++++++++++++++++++++++++++ - test/Makefile.in | 43 +++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 90 insertions(+) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 644715a..18d9c35 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -2961,6 +2961,7 @@ endif() - ##### Tests ##### - - if(SDL_TEST) -+ include(CTest) - include_directories(BEFORE "${SDL2_BINARY_DIR}/include") - include_directories(AFTER "${SDL2_SOURCE_DIR}/include") - file(GLOB TEST_SOURCES ${SDL2_SOURCE_DIR}/src/test/*.c) -diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt -index 330af47..d2fc493 100644 ---- a/test/CMakeLists.txt -+++ b/test/CMakeLists.txt -@@ -1,5 +1,6 @@ - cmake_minimum_required(VERSION 3.0.0) - project(SDL2 C) -+include(CTest) - - # Global settings for all of the test targets - # FIXME: is this wrong? -@@ -125,6 +126,34 @@ add_executable(controllermap controllermap.c) - add_executable(testvulkan testvulkan.c) - add_executable(testoffscreen testoffscreen.c) - -+set(NONINTERACTIVE -+ testatomic -+ testerror -+ testfilesystem -+ testkeys -+ testlocale -+ testplatform -+ testpower -+ testqsort -+ testthread -+ testtimer -+ testver -+) -+ -+if(LINUX) -+ list(APPEND NONINTERACTIVE testevdev) -+endif() -+ -+set(NEEDS_AUDIO -+ testaudioinfo -+ testsurround -+) -+ -+set(NEEDS_DISPLAY -+ testbounds -+ testdisplayinfo -+) -+ - if(OPENGL_FOUND) - add_dependencies(testshader OpenGL::GL) - add_dependencies(testgl2 OpenGL::GL) -@@ -298,3 +327,20 @@ if(APPLE) - endforeach() - endif() - endif() -+ -+set(TESTS_ENVIRONMENT -+ SDL_AUDIODRIVER=dummy -+ SDL_VIDEODRIVER=dummy -+) -+ -+foreach(TESTCASE ${NONINTERACTIVE} ${NEEDS_AUDIO} ${NEEDS_DISPLAY}) -+ add_test( -+ NAME ${TESTCASE} -+ COMMAND ${TESTCASE} -+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} -+ ) -+ set_tests_properties( -+ ${TESTCASE} -+ PROPERTIES ENVIRONMENT "${TESTS_ENVIRONMENT}" -+ ) -+endforeach() -diff --git a/test/Makefile.in b/test/Makefile.in -index f724618..120e585 100644 ---- a/test/Makefile.in -+++ b/test/Makefile.in -@@ -351,6 +351,49 @@ distclean: clean - rm -f config.status config.cache config.log - rm -rf $(srcdir)/autom4te* - -+noninteractive = \ -+ testatomic$(EXE) \ -+ testerror$(EXE) \ -+ testevdev$(EXE) \ -+ testfilesystem$(EXE) \ -+ testkeys$(EXE) \ -+ testlocale$(EXE) \ -+ testplatform$(EXE) \ -+ testpower$(EXE) \ -+ testqsort$(EXE) \ -+ testthread$(EXE) \ -+ testtimer$(EXE) \ -+ testver$(EXE) \ -+ $(NULL) -+ -+needs_audio = \ -+ testaudioinfo$(EXE) \ -+ testsurround$(EXE) \ -+ $(NULL) -+ -+needs_display = \ -+ testbounds$(EXE) \ -+ testdisplayinfo$(EXE) \ -+ $(NULL) -+ -+TESTS = $(noninteractive) $(needs_audio) $(needs_display) -+ -+check: -+ @set -e; \ -+ status=0; \ -+ export SDL_AUDIODRIVER=dummy; \ -+ export SDL_VIDEODRIVER=dummy; \ -+ for exe in $(TESTS); do \ -+ echo "$$exe..."; \ -+ if ./"$$exe"; then \ -+ echo "$$exe: OK"; \ -+ else \ -+ echo "$$exe: FAILED: $$?"; \ -+ status=1; \ -+ fi; \ -+ done; \ -+ exit "$$status" -+ - DATA = \ - axis.bmp \ - button.bmp \ diff -Nru libsdl2-2.0.22+dfsg/docs/CONTRIBUTING.md libsdl2-2.24.0+dfsg/docs/CONTRIBUTING.md --- libsdl2-2.0.22+dfsg/docs/CONTRIBUTING.md 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/docs/CONTRIBUTING.md 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,97 @@ +# Contributing to SDL + +We appreciate your interest in contributing to SDL, this document will describe how to report bugs, contribute code or ideas or edit documentation. + +**Table Of Contents** + +- [Filing a GitHub issue](#filing-a-github-issue) + - [Reporting a bug](#reporting-a-bug) + - [Suggesting enhancements](#suggesting-enhancements) +- [Contributing code](#contributing-code) + - [Forking the project](#forking-the-project) + - [Following the style guide](#following-the-style-guide) + - [Running the tests](#running-the-tests) + - [Opening a pull request](#opening-a-pull-request) +- [Contributing to the documentation](#contributing-to-the-documentation) + - [Editing a function documentation](#editing-a-function-documentation) + - [Editing the wiki](#editing-the-wiki) + +## Filing a GitHub issue + +### Reporting a bug + +If you think you have found a bug and would like to report it, here are the steps you should take: + +- Before opening a new issue, ensure your bug has not already been reported on the [GitHub Issues page](https://github.com/libsdl-org/SDL/issues). +- On the issue tracker, click on [New Issue](https://github.com/libsdl-org/SDL/issues/new). +- Include details about your environment, such as your Operating System and SDL version. +- If possible, provide a small example that reproduces your bug. + +### Suggesting enhancements + +If you want to suggest changes for the project, here are the steps you should take: + +- Check if the suggestion has already been made on: + - the [issue tracker](https://github.com/libsdl-org/SDL/issues); + - the [discourse forum](https://discourse.libsdl.org/); + - or if a [pull request](https://github.com/libsdl-org/SDL/pulls) already exists. +- On the issue tracker, click on [New Issue](https://github.com/libsdl-org/SDL/issues/new). +- Describe what change you would like to happen. + +## Contributing code + +This section will cover how the process of forking the project, making a change and opening a pull request. + +### Forking the project + +The first step consists in making a fork of the project, this is only necessary for the first contribution. + +Head over to https://github.com/libsdl-org/SDL and click on the `Fork` button in the top right corner of your screen, you may leave the fields unchanged and click `Create Fork`. + +You will be redirected to your fork of the repository, click the green `Code` button and copy the git clone link. + +If you had already forked the repository, you may update it from the web page using the `Fetch upstream` button. + +### Following the style guide + +Code formatting is done using a custom `.clang-format` file, you can learn more about how to run it [here](https://clang.llvm.org/docs/ClangFormat.html). + +Some legacy code may not be formatted, as such avoid formatting the whole file at once and only format around your changes. + +For your commit message to be properly displayed on GitHub, it should contain: + +- A short description of the commit of 50 characters or less on the first line. +- If necessary, add a blank line followed by a long description, each line should be 72 characters or less. + +For example: + +``` +Fix crash in SDL_FooBar. + +This addresses the issue #123456 by making sure Foo was successful +before calling Bar. +``` + +### Running the tests + +Tests allow you to verify if your changes did not break any behaviour, here are the steps to follow: + +- Before pushing, run the `testautomation` suite on your machine, there should be no more failing tests after your change than before. +- After pushing to your fork, Continuous Integration (GitHub Actions) will ensure compilation and tests still pass on other systems. + +### Opening a pull request + +- Head over to your fork's GitHub page. +- Click on the `Contribute` button and `Open Pull Request`. +- Fill out the pull request template. +- If any changes are requested, you can add new commits to your fork and they will be automatically added to the pull request. + +## Contributing to the documentation + +### Editing a function documentation + +The wiki documentation for API functions is synchronised from the headers' doxygen comments. As such, all modifications to syntax; function parameters; return value; version; related functions should be done in the header directly. + +### Editing the wiki + +Other changes to the wiki should done directly from https://wiki.libsdl.org/ diff -Nru libsdl2-2.0.22+dfsg/docs/doxyfile libsdl2-2.24.0+dfsg/docs/doxyfile --- libsdl2-2.0.22+dfsg/docs/doxyfile 2021-07-27 14:52:29.000000000 +0000 +++ libsdl2-2.24.0+dfsg/docs/doxyfile 2022-06-02 02:01:57.000000000 +0000 @@ -640,6 +640,7 @@ ../include/SDL_opengles.h \ ../include/SDL_opengl.h \ ../include/SDL_egl.h \ + ./release_checklist.md \ # The EXCLUDE_SYMLINKS tag can be used select whether or not files or diff -Nru libsdl2-2.0.22+dfsg/docs/README-cmake.md libsdl2-2.24.0+dfsg/docs/README-cmake.md --- libsdl2-2.0.22+dfsg/docs/README-cmake.md 2021-07-27 14:52:29.000000000 +0000 +++ libsdl2-2.24.0+dfsg/docs/README-cmake.md 2022-08-13 03:48:10.000000000 +0000 @@ -1,40 +1,102 @@ -CMake -================================================================================ +# CMake + (www.cmake.org) SDL's build system was traditionally based on autotools. Over time, this approach has suffered from several issues across the different supported platforms. -To solve these problems, a new build system based on CMake is under development. -It works in parallel to the legacy system, so users can experiment with it -without complication. -While still experimental, the build system should be usable on the following -platforms: +To solve these problems, a new build system based on CMake was introduced. +It is developed in parallel to the legacy autotools build system, so users +can experiment with it without complication. + +The CMake build system is supported on the following platforms: * FreeBSD * Linux -* VS.NET 2010 +* Microsoft Visual C * MinGW and Msys * macOS, iOS, and tvOS, with support for XCode +* Android +* Emscripten +* RiscOS +* Playstation Vita + +## Building SDL + +Assuming the source for SDL is located at `~/sdl` +```sh +cd ~ +mkdir build +cd build +cmake ~/sdl +cmake --build . +``` + +This will build the static and dynamic versions of SDL in the `~/build` directory. +Installation can be done using: + +```sh +cmake --install . # '--install' requires CMake 3.15, or newer +``` + +## Including SDL in your project + +SDL can be included in your project in 2 major ways: +- using a system SDL library, provided by your (*nix) distribution or a package manager +- using a vendored SDL library: this is SDL copied or symlinked in a subfolder. + +The following CMake script supports both, depending on the value of `MYGAME_VENDORED`. +```cmake +cmake_minimum_required(VERSION 3.0) +project(mygame) -================================================================================ -Usage -================================================================================ +# Create an option to switch between a system sdl library and a vendored sdl library +option(MYGAME_VENDORED "Use vendored libraries" OFF) -Assuming the source for SDL is located at ~/sdl +if(MYGAME_VENDORED) + add_subdirectory(vendored/sdl EXCLUDE_FROM_ALL) +else() + # 1. Look for a SDL2 package, 2. look for the SDL2 component and 3. fail if none can be found + find_package(SDL2 REQUIRED CONFIG REQUIRED COMPONENTS SDL2) + + # 1. Look for a SDL2 package, 2. Look for the SDL2maincomponent and 3. DO NOT fail when SDL2main is not available + find_package(SDL2 REQUIRED CONFIG COMPONENTS SDL2main) +endif() - cd ~ - mkdir build - cd build - cmake ../sdl +# Create your game executable target as usual +add_executable(mygame WIN32 mygame.c) -This will build the static and dynamic versions of SDL in the ~/build directory. +# SDL2::SDL2main may or may not be available. It is e.g. required by Windows GUI applications +if(TARGET SDL2::SDL2main) + # It has an implicit dependency on SDL2 functions, so it MUST be added before SDL2::SDL2 (or SDL2::SDL2-static) + target_link_libraries(mygame PRIVATE SDL2::SDL2main) +endif() +# Link to the actual SDL2 library. SDL2::SDL2 is the shared SDL library, SDL2::SDL2-static is the static SDL libarary. +target_link_libraries(mygame PRIVATE SDL2::SDL2) +``` -================================================================================ -Usage, iOS/tvOS -================================================================================ +### A system SDL library + +For CMake to find SDL, it must be installed in [a default location CMake is looking for](https://cmake.org/cmake/help/latest/command/find_package.html#config-mode-search-procedure). + +The following components are available, to be used as an argument of `find_package`. + +| Component name | Description | +|----------------|--------------------------------------------------------------------------------------------| +| SDL2 | The SDL2 shared library, available through the `SDL2::SDL2` target [^SDL_TARGET_EXCEPTION] | +| SDL2-static | The SDL2 static library, available through the `SDL2::SDL2-static` target | +| SDL2main | The SDL2main static library, available through the `SDL2::SDL2main` target | +| SDL2test | The SDL2test static library, available through the `SDL2::SDL2test` target | + +### Using a vendored SDL + +This only requires a copy of SDL in a subdirectory. + +## CMake configuration options for platforms + +### iOS/tvOS CMake 3.14+ natively includes support for iOS and tvOS. SDL binaries may be built using Xcode or Make, possibly among other build-systems. @@ -53,32 +115,49 @@ - `CMAKE_OSX_ARCHITECTURES=` (example: "arm64;armv7s;x86_64") -### Examples (for iOS/tvOS): +#### Examples - for iOS-Simulator, using the latest, installed SDK: - `cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64` + ```bash + cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64 + ``` - for iOS-Device, using the latest, installed SDK, 64-bit only - `cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES=arm64` + ```bash + cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES=arm64 + ``` - for iOS-Device, using the latest, installed SDK, mixed 32/64 bit - `cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES="arm64;armv7s"` + ```cmake + cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES="arm64;armv7s" + ``` - for iOS-Device, using a specific SDK revision (iOS 12.4, in this example): - `cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos12.4 -DCMAKE_OSX_ARCHITECTURES=arm64` + ```cmake + cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos12.4 -DCMAKE_OSX_ARCHITECTURES=arm64 + ``` - for iOS-Simulator, using the latest, installed SDK, and building SDL test apps (as .app bundles): - `cmake ~/sdl -DSDL_TEST=1 -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64` + ```cmake + cmake ~/sdl -DSDL_TESTS=1 -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64 + ``` - for tvOS-Simulator, using the latest, installed SDK: - `cmake ~/sdl -DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvsimulator -DCMAKE_OSX_ARCHITECTURES=x86_64` + ```cmake + cmake ~/sdl -DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvsimulator -DCMAKE_OSX_ARCHITECTURES=x86_64 + ``` - for tvOS-Device, using the latest, installed SDK: - `cmake ~/sdl -DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvos -DCMAKE_OSX_ARCHITECTURES=arm64` + ```cmake + cmake ~/sdl -DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvos -DCMAKE_OSX_ARCHITECTURES=arm64` + ``` + + +[^SDL_TARGET_EXCEPTION]: `SDL2::SDL2` can be an ALIAS to a static `SDL2::SDL2-static` target for multiple reasons. diff -Nru libsdl2-2.0.22+dfsg/docs/README-gdk.md libsdl2-2.24.0+dfsg/docs/README-gdk.md --- libsdl2-2.0.22+dfsg/docs/README-gdk.md 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/docs/README-gdk.md 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,155 @@ +GDK +===== + +This port allows SDL applications to run via Microsoft's Game Development Kit (GDK). + +Windows (GDK) and Xbox One/Xbox Series (GDKX) are supported. Although most of the Xbox code is included in the public SDL source code, NDA access is required for a small number of source files. If you have access to GDKX, these required Xbox files are posted on the GDK forums [here](https://forums.xboxlive.com/questions/130003/). + + +Requirements +------------ + +* Microsoft Visual Studio 2022 (in theory, it should also work in 2017 or 2019, but this has not been tested) +* Microsoft GDK June 2022 or newer (public release [here](https://github.com/microsoft/GDK/releases/tag/June_2022)) +* To publish a package or successfully authenticate a user, you will need to create an app id/configure services in Partner Center. However, for local testing purposes (without authenticating on Xbox Live), the identifiers used by the GDK test programs in the included solution will work. + + +Windows GDK Status +------ + +The Windows GDK port supports the full set of Win32 APIs, renderers, controllers, input devices, etc., as the normal Windows x64 build of SDL. + +* Additionally, the GDK port adds the following: + * Compile-time platform detection for SDL programs. The `__GDK__` is `#define`d on every GDK platform, and the `__WINGDK__` is `#define`d on Windows GDK, specifically. (This distinction exists because other GDK platforms support a smaller subset of functionality. This allows you to mark code for "any" GDK separate from Windows GDK.) + * GDK-specific setup: + * Initializing/uninitializing the game runtime, and initializing Xbox Live services + * Creating a global task queue and setting it as the default for the process. When running any async operations, passing in `NULL` as the task queue will make the task get added to the global task queue. + + * An implementation on `WinMain` that performs the above GDK setup (you should link against SDL2main.lib, as in Windows x64). If you are unable to do this, you can instead manually call `SDL_GDKRunApp` from your entry point, passing in your `SDL_main` function and `NULL` as the parameters. + * Global task queue callbacks are dispatched during `SDL_PumpEvents` (which is also called internally if using `SDL_PollEvent`). + * You can get the handle of the global task queue through `SDL_GDKGetTaskQueue`, if needed. When done with the queue, be sure to use `XTaskQueueCloseHandle` to decrement the reference count (otherwise it will cause a resource leak). + +* What doesn't work: + * Compilation with anything other than through the included Visual C++ solution file + +## VisualC-GDK Solution + +The included `VisualC-GDK/SDL.sln` solution includes the following targets for the Gaming.Desktop.x64 configuration: + +* SDL2 (DLL) - This is the typical SDL2.dll, but for Gaming.Desktop.x64. +* SDL2main (lib) - This contains a drop-in implementation of `WinMain` that is used as the entry point for GDK programs. +* tests/testgamecontroller - Standard SDL test program demonstrating controller functionality. +* tests/testgdk - GDK-specific test program that demonstrates using the global task queue to login a user into Xbox Live. + *NOTE*: As of the June 2022 GDK, you cannot test user logins without a valid Title ID and MSAAppId. You will need to manually change the identifiers in the `MicrosoftGame.config` to your valid IDs from Partner Center if you wish to test this. +* tests/testsprite2 - Standard SDL test program demonstrating sprite drawing functionality. + +If you set one of the test programs as a startup project, you can run it directly from Visual Studio. + +Windows GDK Setup, Detailed Steps +--------------------- + +These steps assume you already have a game using SDL that runs on Windows x64 along with a corresponding Visual Studio solution file for the x64 version. If you don't have this, it's easiest to use one of the test program vcxproj files in the `VisualC-GDK` directory as a starting point, though you will still need to do most of the steps below. + +### 1. Add a Gaming.Desktop.x64 Configuration ### + +In your game's existing Visual Studio Solution, go to Build > Configuration Manager. From the "Active solution platform" drop-down select "New...". From the drop-down list, select Gaming.Desktop.x64 and copy the settings from the x64 configuration. + +### 2. Build SDL2 and SDL2main for GDK ### + +Open `VisualC-GDK/SDL.sln` in Visual Studio, you need to build the SDL2 and SDL2main targets for the Gaming.Desktop.x64 platform (Release is recommended). You will need to copy/keep track of the `SDL2.dll`, `XCurl.dll` (which is output by Gaming.Desktop.x64), `SDL2.lib`, and `SDL2main.lib` output files for your game project. + +*Alternatively*, you could setup your solution file to instead reference the SDL2/SDL2main project file targets from the SDL source, and add those projects as a dependency. This would mean that SDL2 and SDL2main would both be built when your game is built. + +### 3. Configuring Project Settings ### + +While the Gaming.Desktop.x64 configuration sets most of the required settings, there are some additional items to configure for your game project under the Gaming.Desktop.x64 Configuration: + +* Under C/C++ > General > Additional Include Directories, make sure the `SDL/include` path is referenced +* Under Linker > General > Additional Library Directories, make sure to reference the path where the newly-built SDL2.lib and SDL2main.lib are +* Under Linker > Input > Additional Dependencies, you need the following: + * `SDL2.lib` + * `SDL2main.lib` (unless not using) + * `xgameruntime.lib` + * `../Microsoft.Xbox.Services.141.GDK.C.Thunks.lib` +* Note that in general, the GDK libraries depend on the MSVC C/C++ runtime, so there is no way to remove this dependency from a GDK program that links against GDK. + +### 4. Setting up SDL_main ### + +Rather than using your own implementation of `WinMain`, it's recommended that you instead `#include "SDL_main.h"` and declare a standard main function. If you are unable to do this, you can instead manually call `SDL_GDKRunApp` from your entry point, passing in your `SDL_main` function and `NULL` as the parameters. + +### 5. Required DLLs ### + +The game will not launch in the debugger unless required DLLs are included in the directory that contains the game's .exe file. You need to make sure that the following files are copied into the directory: + +* Your SDL2.dll +* "$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.141.GDK.C.Thunks.dll" +* XCurl.dll + +You can either copy these in a post-build step, or you can add the dlls into the project and set its Configuration Properties > General > Item type to "Copy file," which will also copy them into the output directory. + +### 6. Setting up MicrosoftGame.config ### + +You can copy `VisualC-GDK/tests/testgdk/MicrosoftGame.config` and use that as a starting point in your project. Minimally, you will want to change the Executable Name attribute, the DefaultDisplayName, and the Description. + +This file must be copied into the same directory as the game's .exe file. As with the DLLs, you can either use a post-build step or the "Copy file" item type. + +For basic testing, you do not need to change anything else in `MicrosoftGame.config`. However, if you want to test any Xbox Live services (such as logging in users) _or_ publish a package, you will need to setup a Game app on Partner Center. + +Then, you need to set the following values to the values from Partner Center: + +* Identity tag - Name and Publisher attributes +* TitleId +* MSAAppId + +### 7. Adding Required Logos + +Several logo PNG files are required to be able to launch the game, even from the debugger. You can use the sample logos provided in `VisualC-GDK/logos`. As with the other files, they must be copied into the same directory as the game's .exe file. + + +### 8. Copying any Data Files ### + +When debugging GDK games, there is no way to specify a working directory. Therefore, any required game data must also be copied into the output directory, likely in a post-build step. + + +### 9. Build and Run from Visual Studio ### + +At this point, you should be able to build and run your game from the Visual Studio Debugger. If you get any linker errors, make sure you double-check that you referenced all the required libs. + +If you are testing Xbox Live functionality, it's likely you will need to change to the Sandbox for your title. To do this: + +1. Run "Desktop VS 2022 Gaming Command Prompt" from the Start Menu +2. Switch the sandbox name with: + `XblPCSandbox SANDBOX.#` +3. (To switch back to the retail sandbox): + `XblPCSandbox RETAIL` + +### 10. Packaging and Installing Locally + +You can use one of the test program's `PackageLayout.xml` as a starting point. Minimally, you will need to change the exe to the correct name and also reference any required game data. As with the other data files, it's easiest if you have this copy to the output directory, although it's not a requirement as you can specify relative paths to files. + +To create the package: + +1. Run "Desktop VS 2022 Gaming Command Prompt" from the Start Menu +2. `cd` to the directory containing the `PackageLayout.xml` with the correct paths (if you use the local path as in the sample package layout, this would be from your .exe output directory) +3. `mkdir Package` to create an output directory +4. To package the file into the `Package` directory, use: + `makepkg pack /f PackageLayout.xml /lt /d . /nogameos /pc /pd Package` +5. To install the package, use: + `wdapp install PACKAGENAME.msixvc` +6. Once the package is installed, you can run it from the start menu. +7. As with when running from Visual Studio, if you need to test any Xbox Live functionality you must switch to the correct sandbox. + + +Troubleshooting +--------------- + +#### Xbox Live Login does not work + +As of June 2022 GDK, you must have a valid Title Id and MSAAppId in order to test Xbox Live functionality such as user login. Make sure these are set correctly in the `MicrosoftGame.config`. This means that even testgdk will not let you login without setting these properties to valid values. + +Furthermore, confirm that your PC is set to the correct sandbox. + + +#### "The current user has already installed an unpackaged version of this app. A packaged version cannot replace this." error when installing + +Prior to June 2022 GDK, running from the Visual Studio debugger would still locally register the app (and it would appear on the start menu). To fix this, you have to uninstall it (it's simplest to right click on it from the start menu to uninstall it). diff -Nru libsdl2-2.0.22+dfsg/docs/README-ios.md libsdl2-2.24.0+dfsg/docs/README-ios.md --- libsdl2-2.0.22+dfsg/docs/README-ios.md 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/docs/README-ios.md 2022-08-13 03:48:10.000000000 +0000 @@ -1,10 +1,10 @@ iOS ====== -Building the Simple DirectMedia Layer for iOS 5.1+ +Building the Simple DirectMedia Layer for iOS 9.0+ ============================================================================== -Requirements: Mac OS X 10.8 or later and the iOS 7+ SDK. +Requirements: Mac OS X 10.9 or later and the iOS 9.0 or newer SDK. Instructions: diff -Nru libsdl2-2.0.22+dfsg/docs/README-linux.md libsdl2-2.24.0+dfsg/docs/README-linux.md --- libsdl2-2.0.22+dfsg/docs/README-linux.md 2021-11-26 16:03:45.000000000 +0000 +++ libsdl2-2.24.0+dfsg/docs/README-linux.md 2022-08-13 03:48:10.000000000 +0000 @@ -3,8 +3,8 @@ By default SDL will only link against glibc, the rest of the features will be enabled dynamically at runtime depending on the available features on the target -system. So, for example if you built SDL with Xinerama support and the target -system does not have the Xinerama libraries installed, it will be disabled +system. So, for example if you built SDL with XRandR support and the target +system does not have the XRandR libraries installed, it will be disabled at runtime, and you won't get a missing library error, at least with the default configuration parameters. @@ -12,27 +12,27 @@ Build Dependencies -------------------------------------------------------------------------------- -Ubuntu 20.04, all available features enabled: +Ubuntu 18.04, all available features enabled: - sudo apt-get install build-essential git make cmake autoconf automake \ - libtool pkg-config libasound2-dev libpulse-dev libaudio-dev libjack-dev \ - libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev \ - libxinerama-dev libxxf86vm-dev libxss-dev libgl1-mesa-dev libdbus-1-dev \ - libudev-dev libgles2-mesa-dev libegl1-mesa-dev libibus-1.0-dev \ - fcitx-libs-dev libsamplerate0-dev libsndio-dev libwayland-dev \ - libxkbcommon-dev libdrm-dev libgbm-dev + sudo apt-get install build-essential git make autoconf automake libtool \ + pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev \ + libaudio-dev libjack-dev libsndio-dev libsamplerate0-dev libx11-dev libxext-dev \ + libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libwayland-dev \ + libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \ + libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev + +Ubuntu 22.04+ can also add `libpipewire-0.3-dev libdecor-0-dev` to that command line. Fedora 35, all available features enabled: sudo yum install gcc git-core make cmake autoconf automake libtool \ alsa-lib-devel pulseaudio-libs-devel nas-devel pipewire-devel \ libX11-devel libXext-devel libXrandr-devel libXcursor-devel libXfixes-devel \ - libXi-devel libXinerama-devel libXxf86vm-devel libXScrnSaver-devel \ - dbus-devel ibus-devel fcitx-devel systemd-devel mesa-libGL-devel \ - libxkbcommon-devel mesa-libGLES-devel mesa-libEGL-devel vulkan-devel \ - wayland-devel wayland-protocols-devel libdrm-devel mesa-libgbm-devel \ - libusb-devel pipewire-jack-audio-connection-kit-devel libdecor-devel \ - libsamplerate-devel + libXi-devel libXScrnSaver-devel dbus-devel ibus-devel fcitx-devel \ + systemd-devel mesa-libGL-devel libxkbcommon-devel mesa-libGLES-devel \ + mesa-libEGL-devel vulkan-devel wayland-devel wayland-protocols-devel \ + libdrm-devel mesa-libgbm-devel libusb-devel libdecor-devel \ + libsamplerate-devel pipewire-jack-audio-connection-kit-devel \ NOTES: - This includes all the audio targets except arts and esd, because Ubuntu diff -Nru libsdl2-2.0.22+dfsg/docs/README-macos.md libsdl2-2.24.0+dfsg/docs/README-macos.md --- libsdl2-2.0.22+dfsg/docs/README-macos.md 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/docs/README-macos.md 2022-08-13 03:48:10.000000000 +0000 @@ -43,15 +43,14 @@ sudo make install ``` -This script builds SDL with 10.6 ABI compatibility on 64-bit Intel and 11.0 +This script builds SDL with 10.9 ABI compatibility on 64-bit Intel and 11.0 ABI compatibility on ARM64 architectures. For best compatibility you should compile your application the same way. -Please note that building SDL requires at least Xcode 4.6 and the 10.7 SDK -(even if you target back to 10.6 systems). PowerPC support for Mac OS X has -been officially dropped as of SDL 2.0.2. 32-bit Intel, using an older Xcode -release, is still supported at the time of this writing, but current Xcode -releases no longer support it, and eventually neither will SDL. +Please note that building SDL requires at least Xcode 6 and the 10.9 SDK. +PowerPC support for macOS has been officially dropped as of SDL 2.0.2. +32-bit Intel and macOS 10.8 runtime support has been officially dropped as +of SDL 2.24.0. To use the library once it's built, you essential have two possibilities: use the traditional autoconf/automake/make method, or use Xcode. diff -Nru libsdl2-2.0.22+dfsg/docs/README.md libsdl2-2.24.0+dfsg/docs/README.md --- libsdl2-2.0.22+dfsg/docs/README.md 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/docs/README.md 2022-08-13 03:48:10.000000000 +0000 @@ -34,6 +34,7 @@ - [DirectFB](README-directfb.md) - [DynAPI](README-dynapi.md) - [Emscripten](README-emscripten.md) +- [GDK](README-gdk.md) - [Gesture](README-gesture.md) - [Git](README-git.md) - [iOS](README-ios.md) @@ -45,12 +46,15 @@ - [Supported Platforms](README-platforms.md) - [Porting information](README-porting.md) - [PSP](README-psp.md) +- [PS2](README-ps2.md) - [Raspberry Pi](README-raspberrypi.md) - [Touch](README-touch.md) +- [Versions](README-versions.md) - [WinCE](README-wince.md) - [Windows](README-windows.md) - [WinRT](README-winrt.md) - [PSVita](README-vita.md) +- [Nokia N-Gage](README-ngage.md) If you need help with the library, or just want to discuss SDL related issues, you can join the [SDL Discourse](https://discourse.libsdl.org/), diff -Nru libsdl2-2.0.22+dfsg/docs/README-ngage.md libsdl2-2.24.0+dfsg/docs/README-ngage.md --- libsdl2-2.0.22+dfsg/docs/README-ngage.md 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/docs/README-ngage.md 2022-06-02 02:01:57.000000000 +0000 @@ -0,0 +1,44 @@ +Nokia N-Gage +============ + +SDL2 port for Symbian S60v1 and v2 with a main focus on the Nokia N-Gage +(Classic and QD) by [Michael Fitzmayer](https://github.com/mupfdev). + +Compiling +--------- + +SDL is part of the [N-Gage SDK.](https://github.com/ngagesdk) project. +The library is included in the +[toolchain](https://github.com/ngagesdk/ngage-toolchain) as a +sub-module. + +A complete example project based on SDL2 can be found in the GitHub +account of the SDK: [Wordle](https://github.com/ngagesdk/wordle). + +Current level of implementation +------------------------------- + +The video driver currently provides full screen video support with +keyboard input. + +At the moment only the software renderer works. + +Audio is not yet implemented. + +Acknowledgements +---------------- + +Thanks to Hannu Viitala, Kimmo Kinnunen and Markus Mertama for the +valuable insight into Symbian programming. Without the SDL 1.2 port +which was specially developed for CDoom (Doom for the Nokia 9210), this +adaptation would not have been possible. + +I would like to thank my friends +[Razvan](https://twitter.com/bewarerazvan) and [Dan +Whelan](https://danwhelan.ie/), for their continuous support. Without +you and the [N-Gage community](https://discord.gg/dbUzqJ26vs), I would +have lost my patience long ago. + +Last but not least, I would like to thank the development team of +[EKA2L1](https://12z1.com/) (an experimental Symbian OS emulator). Your +patience and support in troubleshooting helped me a lot. diff -Nru libsdl2-2.0.22+dfsg/docs/README-ps2.md libsdl2-2.24.0+dfsg/docs/README-ps2.md --- libsdl2-2.0.22+dfsg/docs/README-ps2.md 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/docs/README-ps2.md 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,47 @@ +PS2 +====== +SDL2 port for the Sony Playstation 2 contributed by: +- Francisco Javier Trujillo Mata + + +Credit to + - The guys that ported SDL to PSP & Vita because I'm taking them as reference. + - David G. F. for helping me with several issues and tests. + +## 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 --build build +cmake --install build +``` + +## 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. +So to avoid the reset of the IOP CPU, you need to call to the macro `SDL_PS2_SKIP_IOP_RESET();`. +It could be something similar as: +```c +..... + +SDL_PS2_SKIP_IOP_RESET(); + +int main(int argc, char *argv[]) +{ +..... +``` +For a release binary is recommendable to reset the IOP always. + +Remember to do a clean compilation everytime you enable or disable the `SDL_PS2_SKIP_IOP_RESET` otherwise the change won't be reflected. + +## Getting PS2 Dev +[Installing PS2 Dev](https://github.com/ps2dev/ps2dev) + +## Running on PCSX2 Emulator +[PCSX2](https://github.com/PCSX2/pcsx2) + +[More PCSX2 information](https://pcsx2.net/) + +## To Do +- PS2 Screen Keyboard +- Dialogs +- Others \ No newline at end of file diff -Nru libsdl2-2.0.22+dfsg/docs/README-raspberrypi.md libsdl2-2.24.0+dfsg/docs/README-raspberrypi.md --- libsdl2-2.0.22+dfsg/docs/README-raspberrypi.md 2021-11-26 16:03:45.000000000 +0000 +++ libsdl2-2.24.0+dfsg/docs/README-raspberrypi.md 2022-06-02 02:01:57.000000000 +0000 @@ -63,7 +63,7 @@ edit $SYSROOT/etc/ld.so.preload and comment out all lines in it. sudo chroot $SYSROOT - apt-get install libudev-dev libasound2-dev libdbus-1-dev libraspberrypi0 libraspberrypi-bin libraspberrypi-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libxxf86vm-dev libxss-dev + apt-get install libudev-dev libasound2-dev libdbus-1-dev libraspberrypi0 libraspberrypi-bin libraspberrypi-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxss-dev exit sudo umount $SYSROOT/dev sudo umount $SYSROOT/proc diff -Nru libsdl2-2.0.22+dfsg/docs/README-versions.md libsdl2-2.24.0+dfsg/docs/README-versions.md --- libsdl2-2.0.22+dfsg/docs/README-versions.md 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/docs/README-versions.md 2022-06-02 02:01:57.000000000 +0000 @@ -0,0 +1,60 @@ +# Versioning + +## Since 2.23.0 + +SDL follows an "odd/even" versioning policy, similar to GLib, GTK, Flatpak +and older versions of the Linux kernel: + +* The major version (first part) increases when backwards compatibility + is broken, which will happen infrequently. + +* If the minor version (second part) is divisible by 2 + (for example 2.24.x, 2.26.x), this indicates a version of SDL that + is believed to be stable and suitable for production use. + + * In stable releases, the patchlevel or micro version (third part) + indicates bugfix releases. Bugfix releases should not add or + remove ABI, so the ".0" release (for example 2.24.0) should be + forwards-compatible with all the bugfix releases from the + same cycle (for example 2.24.1). + + * The minor version increases when new API or ABI is added, or when + other significant changes are made. Newer minor versions are + backwards-compatible, but not fully forwards-compatible. + For example, programs built against SDL 2.24.x should work fine + with SDL 2.26.x, but programs built against SDL 2.26.x will not + necessarily work with 2.24.x. + +* If the minor version (second part) is not divisible by 2 + (for example 2.23.x, 2.25.x), this indicates a development prerelease + of SDL that is not suitable for stable software distributions. + Use with caution. + + * The patchlevel or micro version (third part) increases with + each prerelease. + + * Each prerelease might add new API and/or ABI. + + * Prereleases are backwards-compatible with older stable branches. + For example, 2.25.x will be backwards-compatible with 2.24.x. + + * Prereleases are not guaranteed to be backwards-compatible with + each other. For example, new API or ABI added in 2.25.1 + might be removed or changed in 2.25.2. + If this would be a problem for you, please do not use prereleases. + + * Only upgrade to a prerelease if you can guarantee that you will + promptly upgrade to the stable release that follows it. + For example, do not upgrade to 2.23.x unless you will be able to + upgrade to 2.24.0 when it becomes available. + + * Software distributions that have a freeze policy (in particular Linux + distributions with a release cycle, such as Debian and Fedora) + should usually only package stable releases, and not prereleases. + +## Before 2.23.0 + +Older versions of SDL followed a similar policy, but instead of the +odd/even rule applying to the minor version, it applied to the patchlevel +(micro version, third part). For example, 2.0.22 was a stable release +and 2.0.21 was a prerelease. diff -Nru libsdl2-2.0.22+dfsg/docs/README-winrt.md libsdl2-2.24.0+dfsg/docs/README-winrt.md --- libsdl2-2.0.22+dfsg/docs/README-winrt.md 2021-08-06 19:36:54.000000000 +0000 +++ libsdl2-2.24.0+dfsg/docs/README-winrt.md 2022-08-13 03:48:10.000000000 +0000 @@ -5,47 +5,21 @@ use of "Windows Runtime", aka. "WinRT", APIs. Microsoft may, in some cases, refer to them as either "Windows Store", or for Windows 10, "UWP" apps. -Some of the operating systems that include WinRT, are: - -* Windows 10, via its Universal Windows Platform (UWP) APIs -* Windows 8.x -* Windows RT 8.x (aka. Windows 8.x for ARM processors) -* Windows Phone 8.x +In the past, SDL has supported Windows RT 8.x, Windows Phone, etc, but in +modern times this port is focused on UWP apps, which run on Windows 10, +and modern Xbox consoles. Requirements ------------ -* Microsoft Visual C++ (aka Visual Studio), either 2017, 2015, 2013, or 2012 +* Microsoft Visual C++ (aka Visual Studio) 2019. - Free, "Community" or "Express" editions may be used, so long as they - include support for either "Windows Store" or "Windows Phone" apps. + include support for either "Windows Store" or "Windows Phone" apps. "Express" versions marked as supporting "Windows Desktop" development typically do not include support for creating WinRT apps, to note. (The "Community" editions of Visual C++ do, however, support both desktop/Win32 and WinRT development). - - Visual Studio 2017 can be used, however it is recommended that you install - the Visual C++ 2015 build tools. These build tools can be installed - using VS 2017's installer. Be sure to also install the workload for - "Universal Windows Platform development", its optional component, the - "C++ Universal Windows Platform tools", and for UWP / Windows 10 - development, the "Windows 10 SDK (10.0.10240.0)". Please note that - targeting UWP / Windows 10 apps from development machine(s) running - earlier versions of Windows, such as Windows 7, is not always supported - by Visual Studio, and you may get error(s) when attempting to do so. - - Visual C++ 2012 can only build apps that target versions 8.0 of Windows, - or Windows Phone. 8.0-targeted apps will run on devices running 8.1 - editions of Windows, however they will not be able to take advantage of - 8.1-specific features. - - Visual C++ 2013 cannot create app projects that target Windows 8.0. - Visual C++ 2013 Update 4, can create app projects for Windows Phone 8.0, - Windows Phone 8.1, and Windows 8.1, but not Windows 8.0. An optional - Visual Studio add-in, "Tools for Maintaining Store apps for Windows 8", - allows Visual C++ 2013 to load and build Windows 8.0 projects that were - created with Visual C++ 2012, so long as Visual C++ 2012 is installed - on the same machine. More details on targeting different versions of - Windows can found at the following web pages: - - [Develop apps by using Visual Studio 2013](http://msdn.microsoft.com/en-us/library/windows/apps/br211384.aspx) - - [To add the Tools for Maintaining Store apps for Windows 8](http://msdn.microsoft.com/en-us/library/windows/apps/dn263114.aspx#AddMaintenanceTools) * A valid Microsoft account - This requirement is not imposed by SDL, but rather by Microsoft's Visual C++ toolchain. This is required to launch or debug apps. @@ -57,7 +31,7 @@ Here is a rough list of what works, and what doesn't: * What works: - * compilation via Visual C++ 2012 through 2015 + * compilation via Visual C++ 2019. * compile-time platform detection for SDL programs. The C/C++ #define, `__WINRT__`, will be set to 1 (by SDL) when compiling for WinRT. * GPU-accelerated 2D rendering, via SDL_Renderer. @@ -234,13 +208,8 @@ "Solution Explorer") 2. right click on your app's solution. 3. navigate to "Add", then to "Existing Project..." -4. find SDL/WinRT's Visual C++ project file and open it. Different project - files exist for different WinRT platforms. All of them are in SDL's - source distribution, in the following directories: - * `VisualC-WinRT/UWP_VS2015/` - for Windows 10 / UWP apps - * `VisualC-WinRT/WinPhone81_VS2013/` - for Windows Phone 8.1 apps - * `VisualC-WinRT/WinRT80_VS2012/` - for Windows 8.0 apps - * `VisualC-WinRT/WinRT81_VS2013/` - for Windows 8.1 apps +4. find SDL/WinRT's Visual C++ project file and open it, in the `VisualC-WinRT` + directory. 5. once the project has been added, right-click on your app's project and select, "References..." 6. click on the button titled, "Add New Reference..." diff -Nru libsdl2-2.0.22+dfsg/docs/release_checklist.md libsdl2-2.24.0+dfsg/docs/release_checklist.md --- libsdl2-2.0.22+dfsg/docs/release_checklist.md 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/docs/release_checklist.md 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,91 @@ +# Release checklist + +## New feature release + +* Update `WhatsNew.txt` + +* Bump version number to 2.EVEN.0 in all these locations: + + * `configure.ac`, `CMakeLists.txt`: `SDL_*_VERSION` + * `Xcode/SDL/Info-Framework.plist`: `CFBundleShortVersionString`, + `CFBundleVersion` + * `Makefile.os2`: `VERSION` + * `Makefile.w32`: `*_VERSION` + * `include/SDL_version.h`: `SDL_*_VERSION`, `SDL_PATCHLEVEL` + * `src/main/windows/version.rc`: `FILEVERSION`, `PRODUCTVERSION`, + `FileVersion`, `ProductVersion` + +* Bump ABI version information + + * `CMakeLists.txt`, `Xcode/SDL/SDL.xcodeproj/project.pbxproj`: + `DYLIB_CURRENT_VERSION`, `DYLIB_COMPATIBILITY_VERSION` + * set first number in `DYLIB_CURRENT_VERSION` to + (100 * *minor*) + 1 + * set second number in `DYLIB_CURRENT_VERSION` to 0 + * if backwards compatibility has been broken, + increase `DYLIB_COMPATIBILITY_VERSION` (?) + +* Run test/versioning.sh to verify that everything is consistent + +* Regenerate `configure` + +* Do the release + +## New bugfix release + +* Check that no new API/ABI was added + + * If it was, do a new feature release (see above) instead + +* Bump version number from 2.Y.Z to 2.Y.(Z+1) (Y is even) + + * Same places as listed above + +* Bump ABI version information + + * `CMakeLists.txt`, `Xcode/SDL/SDL.xcodeproj/project.pbxproj`: + `DYLIB_CURRENT_VERSION`, `DYLIB_COMPATIBILITY_VERSION` + * set second number in `DYLIB_CURRENT_VERSION` to *patchlevel* + +* Run test/versioning.sh to verify that everything is consistent + +* Regenerate `configure` + +* Do the release + +## After a feature release + +* Create a branch like `release-2.24.x` + +* Bump version number to 2.ODD.0 for next development branch + + * Same places as listed above + +* Bump ABI version information + + * Same places as listed above + * Assume that the next feature release will contain new API/ABI + +* Run test/versioning.sh to verify that everything is consistent + +## New development prerelease + +* Bump version number from 2.Y.Z to 2.Y.(Z+1) (Y is odd) + + * Same places as listed above + +* Bump ABI version information + + * `CMakeLists.txt`, `Xcode/SDL/SDL.xcodeproj/project.pbxproj`: + `DYLIB_CURRENT_VERSION`, `DYLIB_COMPATIBILITY_VERSION` + * set first number in `DYLIB_CURRENT_VERSION` to + (100 * *minor*) + *patchlevel* + 1 + * set second number in `DYLIB_CURRENT_VERSION` to 0 + * if backwards compatibility has been broken, + increase `DYLIB_COMPATIBILITY_VERSION` (?) + +* Run test/versioning.sh to verify that everything is consistent + +* Regenerate `configure` + +* Do the release diff -Nru libsdl2-2.0.22+dfsg/include/begin_code.h libsdl2-2.24.0+dfsg/include/begin_code.h --- libsdl2-2.0.22+dfsg/include/begin_code.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/begin_code.h 2022-08-13 03:48:10.000000000 +0000 @@ -34,7 +34,7 @@ #define _begin_code_h #ifndef SDL_DEPRECATED -# if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ +# if defined(__GNUC__) && (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # define SDL_DEPRECATED @@ -51,7 +51,7 @@ /* Some compilers use a special export keyword */ #ifndef DECLSPEC -# if defined(__WIN32__) || defined(__WINRT__) || defined(__CYGWIN__) +# if defined(__WIN32__) || defined(__WINRT__) || defined(__CYGWIN__) || defined(__GDK__) # ifdef DLL_EXPORT # define DECLSPEC __declspec(dllexport) # else @@ -74,7 +74,7 @@ /* By default SDL uses the C calling convention */ #ifndef SDLCALL -#if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) +#if (defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__)) && !defined(__GNUC__) #define SDLCALL __cdecl #elif defined(__OS2__) || defined(__EMX__) #define SDLCALL _System diff -Nru libsdl2-2.0.22+dfsg/include/SDL_assert.h libsdl2-2.24.0+dfsg/include/SDL_assert.h --- libsdl2-2.0.22+dfsg/include/SDL_assert.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_assert.h 2022-08-13 03:48:10.000000000 +0000 @@ -22,7 +22,7 @@ #ifndef SDL_assert_h_ #define SDL_assert_h_ -#include "SDL_config.h" +#include "SDL_stdinc.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -51,6 +51,8 @@ /* Don't include intrin.h here because it contains C++ code */ extern void __cdecl __debugbreak(void); #define SDL_TriggerBreakpoint() __debugbreak() +#elif _SDL_HAS_BUILTIN(__builtin_debugtrap) + #define SDL_TriggerBreakpoint() __builtin_debugtrap() #elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) ) #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" ) #elif ( defined(__APPLE__) && (defined(__arm64__) || defined(__aarch64__)) ) /* this might work on other ARM targets, but this is a known quantity... */ @@ -69,7 +71,7 @@ #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */ # define SDL_FUNCTION __func__ -#elif ((__GNUC__ >= 2) || defined(_MSC_VER) || defined (__WATCOMC__)) +#elif ((defined(__GNUC__) && (__GNUC__ >= 2)) || defined(_MSC_VER) || defined (__WATCOMC__)) # define SDL_FUNCTION __FUNCTION__ #else # define SDL_FUNCTION "???" diff -Nru libsdl2-2.0.22+dfsg/include/SDL_atomic.h libsdl2-2.24.0+dfsg/include/SDL_atomic.h --- libsdl2-2.0.22+dfsg/include/SDL_atomic.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_atomic.h 2022-08-13 03:48:10.000000000 +0000 @@ -237,6 +237,26 @@ #endif #endif +/* "REP NOP" is PAUSE, coded for tools that don't know it by that name. */ +#if (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__)) + #define SDL_CPUPauseInstruction() __asm__ __volatile__("pause\n") /* Some assemblers can't do REP NOP, so go with PAUSE. */ +#elif (defined(__arm__) && __ARM_ARCH__ >= 7) || defined(__aarch64__) + #define SDL_CPUPauseInstruction() __asm__ __volatile__("yield" ::: "memory") +#elif (defined(__powerpc__) || defined(__powerpc64__)) + #define SDL_CPUPauseInstruction() __asm__ __volatile__("or 27,27,27"); +#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64)) + #define SDL_CPUPauseInstruction() _mm_pause() /* this is actually "rep nop" and not a SIMD instruction. No inline asm in MSVC x86-64! */ +#elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64)) + #define SDL_CPUPauseInstruction() __yield() +#elif defined(__WATCOMC__) && defined(__386__) + /* watcom assembler rejects PAUSE if CPU < i686, and it refuses REP NOP as an invalid combination. Hardcode the bytes. */ + extern __inline void SDL_CPUPauseInstruction(void); + #pragma aux SDL_CPUPauseInstruction = "db 0f3h,90h" +#else + #define SDL_CPUPauseInstruction() +#endif + + /** * \brief A type representing an atomic integer value. It is a struct * so people don't accidentally use numeric operations on it. diff -Nru libsdl2-2.0.22+dfsg/include/SDL_audio.h libsdl2-2.24.0+dfsg/include/SDL_audio.h --- libsdl2-2.0.22+dfsg/include/SDL_audio.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_audio.h 2022-08-13 03:48:10.000000000 +0000 @@ -172,7 +172,7 @@ * 2: FL FR (stereo) * 3: FL FR LFE (2.1 surround) * 4: FL FR BL BR (quad) - * 5: FL FR FC BL BR (quad + center) + * 5: FL FR LFE BL BR (4.1 surround) * 6: FL FR FC LFE SL SR (5.1 surround - last two can also be BL BR) * 7: FL FR FC LFE BC SL SR (6.1 surround) * 8: FL FR FC LFE BL BR SL SR (7.1 surround) @@ -487,6 +487,7 @@ * \since This function is available since SDL 2.0.0. * * \sa SDL_GetNumAudioDevices + * \sa SDL_GetDefaultAudioInfo */ extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index, int iscapture); @@ -512,6 +513,7 @@ * \since This function is available since SDL 2.0.16. * * \sa SDL_GetNumAudioDevices + * \sa SDL_GetDefaultAudioInfo */ extern DECLSPEC int SDLCALL SDL_GetAudioDeviceSpec(int index, int iscapture, @@ -519,6 +521,41 @@ /** + * Get the name and preferred format of the default audio device. + * + * Some (but not all!) platforms have an isolated mechanism to get information + * about the "default" device. This can actually be a completely different + * device that's not in the list you get from SDL_GetAudioDeviceSpec(). It can + * even be a network address! (This is discussed in SDL_OpenAudioDevice().) + * + * As a result, this call is not guaranteed to be performant, as it can query + * the sound server directly every time, unlike the other query functions. You + * should call this function sparingly! + * + * `spec` will be filled with the sample rate, sample format, and channel + * count, if a default device exists on the system. If `name` is provided, + * will be filled with either a dynamically-allocated UTF-8 string or NULL. + * + * \param name A pointer to be filled with the name of the default device (can + * be NULL). Please call SDL_free() when you are done with this + * pointer! + * \param spec The SDL_AudioSpec to be initialized by this function. + * \param iscapture non-zero to query the default recording device, zero to + * query the default output device. + * \returns 0 on success, nonzero on error + * + * \since This function is available since SDL 2.24.0. + * + * \sa SDL_GetAudioDeviceName + * \sa SDL_GetAudioDeviceSpec + * \sa SDL_OpenAudioDevice + */ +extern DECLSPEC int SDLCALL SDL_GetDefaultAudioInfo(char **name, + SDL_AudioSpec *spec, + int iscapture); + + +/** * Open a specific audio device. * * SDL_OpenAudio(), unlike this function, always acts on device ID 1. As such, @@ -584,6 +621,7 @@ * - `SDL_AUDIO_ALLOW_FREQUENCY_CHANGE` * - `SDL_AUDIO_ALLOW_FORMAT_CHANGE` * - `SDL_AUDIO_ALLOW_CHANNELS_CHANGE` + * - `SDL_AUDIO_ALLOW_SAMPLES_CHANGE` * - `SDL_AUDIO_ALLOW_ANY_CHANGE` * * These flags specify how SDL should behave when a device cannot offer a diff -Nru libsdl2-2.0.22+dfsg/include/SDL_config_android.h libsdl2-2.24.0+dfsg/include/SDL_config_android.h --- libsdl2-2.0.22+dfsg/include/SDL_config_android.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_config_android.h 2022-06-02 02:01:57.000000000 +0000 @@ -60,6 +60,7 @@ #define HAVE_SETENV 1 #define HAVE_UNSETENV 1 #define HAVE_QSORT 1 +#define HAVE_BSEARCH 1 #define HAVE_ABS 1 #define HAVE_BCOPY 1 #define HAVE_MEMSET 1 diff -Nru libsdl2-2.0.22+dfsg/include/SDL_config_emscripten.h libsdl2-2.24.0+dfsg/include/SDL_config_emscripten.h --- libsdl2-2.0.22+dfsg/include/SDL_config_emscripten.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_config_emscripten.h 2022-06-02 02:01:57.000000000 +0000 @@ -69,6 +69,7 @@ #define HAVE_PUTENV 1 #define HAVE_UNSETENV 1 #define HAVE_QSORT 1 +#define HAVE_BSEARCH 1 #define HAVE_ABS 1 #define HAVE_BCOPY 1 #define HAVE_MEMSET 1 diff -Nru libsdl2-2.0.22+dfsg/include/SDL_config.h libsdl2-2.24.0+dfsg/include/SDL_config.h --- libsdl2-2.0.22+dfsg/include/SDL_config.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_config.h 2022-08-13 03:48:10.000000000 +0000 @@ -33,6 +33,10 @@ #include "SDL_config_windows.h" #elif defined(__WINRT__) #include "SDL_config_winrt.h" +#elif defined(__WINGDK__) +#include "SDL_config_wingdk.h" +#elif defined(__XBOXONE__) || defined(__XBOXSERIES__) +#include "SDL_config_xbox.h" #elif defined(__MACOSX__) #include "SDL_config_macosx.h" #elif defined(__IPHONEOS__) @@ -43,6 +47,8 @@ #include "SDL_config_os2.h" #elif defined(__EMSCRIPTEN__) #include "SDL_config_emscripten.h" +#elif defined(__NGAGE__) +#include "SDL_config_ngage.h" #else /* This is a minimal configuration just to get SDL running on new platforms. */ #include "SDL_config_minimal.h" diff -Nru libsdl2-2.0.22+dfsg/include/SDL_config.h.cmake libsdl2-2.24.0+dfsg/include/SDL_config.h.cmake --- libsdl2-2.0.22+dfsg/include/SDL_config.h.cmake 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_config.h.cmake 2022-08-13 03:48:10.000000000 +0000 @@ -64,6 +64,7 @@ #cmakedefine HAVE_MEMORY_H 1 #cmakedefine HAVE_SIGNAL_H 1 #cmakedefine HAVE_STDARG_H 1 +#cmakedefine HAVE_STDDEF_H 1 #cmakedefine HAVE_STDINT_H 1 #cmakedefine HAVE_STDIO_H 1 #cmakedefine HAVE_STDLIB_H 1 @@ -88,6 +89,7 @@ #cmakedefine HAVE_UNSETENV 1 #endif #cmakedefine HAVE_QSORT 1 +#cmakedefine HAVE_BSEARCH 1 #cmakedefine HAVE_ABS 1 #cmakedefine HAVE_BCOPY 1 #cmakedefine HAVE_MEMSET 1 @@ -242,6 +244,7 @@ #cmakedefine HAVE_D3D_H @HAVE_D3D_H@ #cmakedefine HAVE_D3D11_H @HAVE_D3D11_H@ +#cmakedefine HAVE_D3D12_H @HAVE_D3D12_H@ #cmakedefine HAVE_DDRAW_H @HAVE_DDRAW_H@ #cmakedefine HAVE_DSOUND_H @HAVE_DSOUND_H@ #cmakedefine HAVE_DINPUT_H @HAVE_DINPUT_H@ @@ -254,12 +257,15 @@ #cmakedefine HAVE_TPCSHRD_H @HAVE_TPCSHRD_H@ #cmakedefine HAVE_SENSORSAPI_H @HAVE_SENSORSAPI_H@ #cmakedefine HAVE_ROAPI_H @HAVE_ROAPI_H@ +#cmakedefine HAVE_SHELLSCALINGAPI_H @HAVE_SHELLSCALINGAPI_H@ #cmakedefine HAVE_XINPUT_GAMEPAD_EX @HAVE_XINPUT_GAMEPAD_EX@ #cmakedefine HAVE_XINPUT_STATE_EX @HAVE_XINPUT_STATE_EX@ /* SDL internal assertion support */ +#if @SDL_DEFAULT_ASSERT_LEVEL_CONFIGURED@ #cmakedefine SDL_DEFAULT_ASSERT_LEVEL @SDL_DEFAULT_ASSERT_LEVEL@ +#endif /* Allow disabling of core subsystems */ #cmakedefine SDL_ATOMIC_DISABLED @SDL_ATOMIC_DISABLED@ @@ -320,6 +326,7 @@ #cmakedefine SDL_AUDIO_DRIVER_OS2 @SDL_AUDIO_DRIVER_OS2@ #cmakedefine SDL_AUDIO_DRIVER_VITA @SDL_AUDIO_DRIVER_VITA@ #cmakedefine SDL_AUDIO_DRIVER_PSP @SDL_AUDIO_DRIVER_PSP@ +#cmakedefine SDL_AUDIO_DRIVER_PS2 @SDL_AUDIO_DRIVER_PS2@ /* Enable various input drivers */ #cmakedefine SDL_INPUT_LINUXEV @SDL_INPUT_LINUXEV@ @@ -343,6 +350,7 @@ #cmakedefine SDL_JOYSTICK_VIRTUAL @SDL_JOYSTICK_VIRTUAL@ #cmakedefine SDL_JOYSTICK_VITA @SDL_JOYSTICK_VITA@ #cmakedefine SDL_JOYSTICK_PSP @SDL_JOYSTICK_PSP@ +#cmakedefine SDL_JOYSTICK_PS2 @SDL_JOYSTICK_PS2@ #cmakedefine SDL_HAPTIC_DUMMY @SDL_HAPTIC_DUMMY@ #cmakedefine SDL_HAPTIC_LINUX @SDL_HAPTIC_LINUX@ #cmakedefine SDL_HAPTIC_IOKIT @SDL_HAPTIC_IOKIT@ @@ -374,6 +382,7 @@ #cmakedefine SDL_THREAD_OS2 @SDL_THREAD_OS2@ #cmakedefine SDL_THREAD_VITA @SDL_THREAD_VITA@ #cmakedefine SDL_THREAD_PSP @SDL_THREAD_PSP@ +#cmakedefine SDL_THREAD_PS2 @SDL_THREAD_PS2@ /* Enable various timer systems */ #cmakedefine SDL_TIMER_HAIKU @SDL_TIMER_HAIKU@ @@ -383,6 +392,7 @@ #cmakedefine SDL_TIMER_OS2 @SDL_TIMER_OS2@ #cmakedefine SDL_TIMER_VITA @SDL_TIMER_VITA@ #cmakedefine SDL_TIMER_PSP @SDL_TIMER_PSP@ +#cmakedefine SDL_TIMER_PS2 @SDL_TIMER_PS2@ /* Enable various video drivers */ #cmakedefine SDL_VIDEO_DRIVER_ANDROID @SDL_VIDEO_DRIVER_ANDROID@ @@ -404,6 +414,7 @@ #cmakedefine SDL_VIDEO_DRIVER_QNX @SDL_VIDEO_DRIVER_QNX@ #cmakedefine SDL_VIDEO_DRIVER_RISCOS @SDL_VIDEO_DRIVER_RISCOS@ #cmakedefine SDL_VIDEO_DRIVER_PSP @SDL_VIDEO_DRIVER_PSP@ +#cmakedefine SDL_VIDEO_DRIVER_PS2 @SDL_VIDEO_DRIVER_PS2@ #cmakedefine SDL_VIDEO_DRIVER_KMSDRM @SDL_VIDEO_DRIVER_KMSDRM@ #cmakedefine SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC @SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC@ @@ -420,34 +431,32 @@ #cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC @SDL_VIDEO_DRIVER_X11_DYNAMIC@ #cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT @SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT@ #cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR @SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR@ -#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA @SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA@ #cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 @SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2@ #cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES @SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES@ #cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR @SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR@ #cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS @SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS@ -#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE @SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE@ #cmakedefine SDL_VIDEO_DRIVER_X11_XCURSOR @SDL_VIDEO_DRIVER_X11_XCURSOR@ #cmakedefine SDL_VIDEO_DRIVER_X11_XDBE @SDL_VIDEO_DRIVER_X11_XDBE@ -#cmakedefine SDL_VIDEO_DRIVER_X11_XINERAMA @SDL_VIDEO_DRIVER_X11_XINERAMA@ #cmakedefine SDL_VIDEO_DRIVER_X11_XINPUT2 @SDL_VIDEO_DRIVER_X11_XINPUT2@ #cmakedefine SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH @SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH@ #cmakedefine SDL_VIDEO_DRIVER_X11_XFIXES @SDL_VIDEO_DRIVER_X11_XFIXES@ #cmakedefine SDL_VIDEO_DRIVER_X11_XRANDR @SDL_VIDEO_DRIVER_X11_XRANDR@ #cmakedefine SDL_VIDEO_DRIVER_X11_XSCRNSAVER @SDL_VIDEO_DRIVER_X11_XSCRNSAVER@ #cmakedefine SDL_VIDEO_DRIVER_X11_XSHAPE @SDL_VIDEO_DRIVER_X11_XSHAPE@ -#cmakedefine SDL_VIDEO_DRIVER_X11_XVIDMODE @SDL_VIDEO_DRIVER_X11_XVIDMODE@ #cmakedefine SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS @SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS@ #cmakedefine SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM @SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM@ #cmakedefine SDL_VIDEO_DRIVER_VITA @SDL_VIDEO_DRIVER_VITA@ #cmakedefine SDL_VIDEO_RENDER_D3D @SDL_VIDEO_RENDER_D3D@ #cmakedefine SDL_VIDEO_RENDER_D3D11 @SDL_VIDEO_RENDER_D3D11@ +#cmakedefine SDL_VIDEO_RENDER_D3D12 @SDL_VIDEO_RENDER_D3D12@ #cmakedefine SDL_VIDEO_RENDER_OGL @SDL_VIDEO_RENDER_OGL@ #cmakedefine SDL_VIDEO_RENDER_OGL_ES @SDL_VIDEO_RENDER_OGL_ES@ #cmakedefine SDL_VIDEO_RENDER_OGL_ES2 @SDL_VIDEO_RENDER_OGL_ES2@ #cmakedefine SDL_VIDEO_RENDER_DIRECTFB @SDL_VIDEO_RENDER_DIRECTFB@ #cmakedefine SDL_VIDEO_RENDER_METAL @SDL_VIDEO_RENDER_METAL@ #cmakedefine SDL_VIDEO_RENDER_VITA_GXM @SDL_VIDEO_RENDER_VITA_GXM@ +#cmakedefine SDL_VIDEO_RENDER_PS2 @SDL_VIDEO_RENDER_PS2@ #cmakedefine SDL_VIDEO_RENDER_PSP @SDL_VIDEO_RENDER_PSP@ /* Enable OpenGL support */ @@ -493,6 +502,7 @@ #cmakedefine SDL_FILESYSTEM_OS2 @SDL_FILESYSTEM_OS2@ #cmakedefine SDL_FILESYSTEM_VITA @SDL_FILESYSTEM_VITA@ #cmakedefine SDL_FILESYSTEM_PSP @SDL_FILESYSTEM_PSP@ +#cmakedefine SDL_FILESYSTEM_PS2 @SDL_FILESYSTEM_PS2@ /* Enable misc subsystem */ #cmakedefine SDL_MISC_DUMMY @SDL_MISC_DUMMY@ @@ -501,7 +511,6 @@ #cmakedefine SDL_LOCALE_DUMMY @SDL_LOCALE_DUMMY@ /* Enable assembly routines */ -#cmakedefine SDL_ASSEMBLY_ROUTINES @SDL_ASSEMBLY_ROUTINES@ #cmakedefine SDL_ALTIVEC_BLITTERS @SDL_ALTIVEC_BLITTERS@ #cmakedefine SDL_ARM_SIMD_BLITTERS @SDL_ARM_SIMD_BLITTERS@ #cmakedefine SDL_ARM_NEON_BLITTERS @SDL_ARM_NEON_BLITTERS@ diff -Nru libsdl2-2.0.22+dfsg/include/SDL_config.h.in libsdl2-2.24.0+dfsg/include/SDL_config.h.in --- libsdl2-2.0.22+dfsg/include/SDL_config.h.in 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_config.h.in 2022-08-13 03:48:10.000000000 +0000 @@ -92,6 +92,7 @@ #undef HAVE_UNSETENV #endif #undef HAVE_QSORT +#undef HAVE_BSEARCH #undef HAVE_ABS #undef HAVE_BCOPY #undef HAVE_MEMSET @@ -228,6 +229,8 @@ #undef HAVE_LIBUDEV_H #undef HAVE_LIBSAMPLERATE_H #undef HAVE_LIBDECOR_H +#undef HAVE_LSXINTRIN_H +#undef HAVE_LASXINTRIN_H #undef HAVE_DDRAW_H #undef HAVE_DINPUT_H @@ -243,6 +246,7 @@ #undef HAVE_TPCSHRD_H #undef HAVE_SENSORSAPI_H #undef HAVE_ROAPI_H +#undef HAVE_SHELLSCALINGAPI_H /* SDL internal assertion support */ #undef SDL_DEFAULT_ASSERT_LEVEL @@ -387,22 +391,18 @@ #undef SDL_VIDEO_DRIVER_X11_DYNAMIC #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR -#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS -#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE #undef SDL_VIDEO_DRIVER_X11_XCURSOR #undef SDL_VIDEO_DRIVER_X11_XDBE -#undef SDL_VIDEO_DRIVER_X11_XINERAMA #undef SDL_VIDEO_DRIVER_X11_XINPUT2 #undef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH #undef SDL_VIDEO_DRIVER_X11_XFIXES #undef SDL_VIDEO_DRIVER_X11_XRANDR #undef SDL_VIDEO_DRIVER_X11_XSCRNSAVER #undef SDL_VIDEO_DRIVER_X11_XSHAPE -#undef SDL_VIDEO_DRIVER_X11_XVIDMODE #undef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS #undef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM #undef SDL_VIDEO_DRIVER_NACL @@ -414,6 +414,7 @@ #undef SDL_VIDEO_RENDER_D3D #undef SDL_VIDEO_RENDER_D3D11 +#undef SDL_VIDEO_RENDER_D3D12 #undef SDL_VIDEO_RENDER_OGL #undef SDL_VIDEO_RENDER_OGL_ES #undef SDL_VIDEO_RENDER_OGL_ES2 @@ -460,6 +461,7 @@ #undef SDL_FILESYSTEM_OS2 #undef SDL_FILESYSTEM_VITA #undef SDL_FILESYSTEM_PSP +#undef SDL_FILESYSTEM_PS2 /* Enable misc subsystem */ #undef SDL_MISC_DUMMY @@ -468,7 +470,6 @@ #undef SDL_LOCALE_DUMMY /* Enable assembly routines */ -#undef SDL_ASSEMBLY_ROUTINES #undef SDL_ALTIVEC_BLITTERS #undef SDL_ARM_SIMD_BLITTERS #undef SDL_ARM_NEON_BLITTERS diff -Nru libsdl2-2.0.22+dfsg/include/SDL_config_iphoneos.h libsdl2-2.24.0+dfsg/include/SDL_config_iphoneos.h --- libsdl2-2.0.22+dfsg/include/SDL_config_iphoneos.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_config_iphoneos.h 2022-06-02 02:01:57.000000000 +0000 @@ -60,6 +60,7 @@ #define HAVE_SETENV 1 #define HAVE_UNSETENV 1 #define HAVE_QSORT 1 +#define HAVE_BSEARCH 1 #define HAVE_ABS 1 #define HAVE_BCOPY 1 #define HAVE_MEMSET 1 @@ -117,7 +118,7 @@ #define HAVE_LROUNDF 1 #define HAVE_POW 1 #define HAVE_POWF 1 -#define HAVE_ROUND 1 +#define HAVE_ROUND 1 #define HAVE_ROUNDF 1 #define HAVE_SCALBN 1 #define HAVE_SCALBNF 1 diff -Nru libsdl2-2.0.22+dfsg/include/SDL_config_macosx.h libsdl2-2.24.0+dfsg/include/SDL_config_macosx.h --- libsdl2-2.0.22+dfsg/include/SDL_config_macosx.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_config_macosx.h 2022-06-02 02:01:57.000000000 +0000 @@ -63,6 +63,7 @@ #define HAVE_PUTENV 1 #define HAVE_UNSETENV 1 #define HAVE_QSORT 1 +#define HAVE_BSEARCH 1 #define HAVE_ABS 1 #define HAVE_BCOPY 1 #define HAVE_MEMSET 1 @@ -120,7 +121,7 @@ #define HAVE_LROUNDF 1 #define HAVE_POW 1 #define HAVE_POWF 1 -#define HAVE_ROUND 1 +#define HAVE_ROUND 1 #define HAVE_ROUNDF 1 #define HAVE_SCALBN 1 #define HAVE_SCALBNF 1 @@ -185,17 +186,13 @@ #undef SDL_VIDEO_DRIVER_X11 #define SDL_VIDEO_DRIVER_X11_DYNAMIC "/opt/X11/lib/libX11.6.dylib" #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/opt/X11/lib/libXext.6.dylib" -#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/opt/X11/lib/libXinerama.1.dylib" #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "/opt/X11/lib/libXi.6.dylib" #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/opt/X11/lib/libXrandr.2.dylib" #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/opt/X11/lib/libXss.1.dylib" -#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/opt/X11/lib/libXxf86vm.1.dylib" #define SDL_VIDEO_DRIVER_X11_XDBE 1 -#define SDL_VIDEO_DRIVER_X11_XINERAMA 1 #define SDL_VIDEO_DRIVER_X11_XRANDR 1 #define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1 #define SDL_VIDEO_DRIVER_X11_XSHAPE 1 -#define SDL_VIDEO_DRIVER_X11_XVIDMODE 1 #define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1 #ifdef MAC_OS_X_VERSION_10_8 @@ -272,7 +269,6 @@ #define SDL_FILESYSTEM_COCOA 1 /* Enable assembly routines */ -#define SDL_ASSEMBLY_ROUTINES 1 #ifdef __ppc__ #define SDL_ALTIVEC_BLITTERS 1 #endif diff -Nru libsdl2-2.0.22+dfsg/include/SDL_config_minimal.h libsdl2-2.24.0+dfsg/include/SDL_config_minimal.h --- libsdl2-2.0.22+dfsg/include/SDL_config_minimal.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_config_minimal.h 2022-08-13 03:48:10.000000000 +0000 @@ -49,6 +49,7 @@ typedef unsigned long uintptr_t; #else #define HAVE_STDINT_H 1 +#define HAVE_INTTYPES_H 1 #endif /* Visual Studio 2008 */ #ifdef __GNUC__ diff -Nru libsdl2-2.0.22+dfsg/include/SDL_config_ngage.h libsdl2-2.24.0+dfsg/include/SDL_config_ngage.h --- libsdl2-2.0.22+dfsg/include/SDL_config_ngage.h 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_config_ngage.h 2022-06-02 02:01:57.000000000 +0000 @@ -0,0 +1,89 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_config_ngage_h_ +#define SDL_config_ngage_h_ +#define SDL_config_h_ + +#include "SDL_platform.h" + +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef signed short int16_t; +typedef unsigned short uint16_t; +typedef signed int int32_t; +typedef unsigned int uint32_t; +typedef signed long long int64_t; +typedef unsigned long long uint64_t; +typedef unsigned long uintptr_t; + +#define HAVE_STDARG_H 1 +#define HAVE_STDDEF_H 1 +#define HAVE_STDIO_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_MATH_H 1 +#define HAVE_CEIL 1 +#define HAVE_COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_EXP 1 +#define HAVE_FABS 1 +#define HAVE_FLOOR 1 +#define HAVE_LOG 1 +#define HAVE_LOG10 1 +#define HAVE_SCALBN 1 +#define HAVE_SIN 1 +#define HAVE_SQRT 1 +#define HAVE_TAN 1 +#define HAVE_MALLOC 1 +#define SDL_MAIN_NEEDED 1 +#define LACKS_SYS_MMAN_H 1 + +/* Enable the N-Gage thread support (src/thread/ngage/\*.c) */ +#define SDL_THREAD_NGAGE 1 + +/* Enable the N-Gage timer support (src/timer/ngage/\*.c) */ +#define SDL_TIMER_NGAGE 1 + +/* Enable the N-Gage video driver (src/video/ngage/\*.c) */ +#define SDL_VIDEO_DRIVER_NGAGE 1 + +/* Enable the dummy audio driver (src/audio/dummy/\*.c) */ +#define SDL_AUDIO_DRIVER_DUMMY 1 + +/* Enable the stub joystick driver (src/joystick/dummy/\*.c) */ +#define SDL_JOYSTICK_DISABLED 1 + +/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */ +#define SDL_HAPTIC_DISABLED 1 + +/* Enable the stub HIDAPI */ +#define SDL_HIDAPI_DISABLED 1 + +/* Enable the stub sensor driver (src/sensor/dummy/\*.c) */ +#define SDL_SENSOR_DISABLED 1 + +/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */ +#define SDL_LOADSO_DISABLED 1 + +/* Enable the dummy filesystem driver (src/filesystem/dummy/\*.c) */ +#define SDL_FILESYSTEM_DUMMY 1 + +#endif /* SDL_config_ngage_h_ */ diff -Nru libsdl2-2.0.22+dfsg/include/SDL_config_os2.h libsdl2-2.24.0+dfsg/include/SDL_config_os2.h --- libsdl2-2.0.22+dfsg/include/SDL_config_os2.h 2022-01-09 19:28:24.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_config_os2.h 2022-06-02 02:01:57.000000000 +0000 @@ -56,9 +56,6 @@ #define SDL_TIMER_OS2 1 #define SDL_FILESYSTEM_OS2 1 -/* Enable assembly routines */ -#define SDL_ASSEMBLY_ROUTINES 1 - /* use libsamplerate for audio rate conversion. */ /*#define HAVE_LIBSAMPLERATE_H 1 */ @@ -105,7 +102,11 @@ #define HAVE_GETENV 1 #define HAVE_SETENV 1 #define HAVE_PUTENV 1 +/* OpenWatcom requires specific calling conventions for qsort and bsearch */ +#ifndef __WATCOMC__ #define HAVE_QSORT 1 +#define HAVE_BSEARCH 1 +#endif #define HAVE_ABS 1 #define HAVE_BCOPY 1 #define HAVE_MEMSET 1 diff -Nru libsdl2-2.0.22+dfsg/include/SDL_config_pandora.h libsdl2-2.24.0+dfsg/include/SDL_config_pandora.h --- libsdl2-2.0.22+dfsg/include/SDL_config_pandora.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_config_pandora.h 2022-06-02 02:01:57.000000000 +0000 @@ -65,6 +65,7 @@ #define HAVE_PUTENV 1 #define HAVE_UNSETENV 1 #define HAVE_QSORT 1 +#define HAVE_BSEARCH 1 #define HAVE_ABS 1 #define HAVE_BCOPY 1 #define HAVE_MEMSET 1 diff -Nru libsdl2-2.0.22+dfsg/include/SDL_config_windows.h libsdl2-2.24.0+dfsg/include/SDL_config_windows.h --- libsdl2-2.0.22+dfsg/include/SDL_config_windows.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_config_windows.h 2022-08-13 03:48:10.000000000 +0000 @@ -38,6 +38,18 @@ #include #endif +/* sdkddkver.h defines more specific SDK version numbers. This is needed because older versions of the + * Windows 10 SDK have broken declarations for the C API for DirectX 12. */ +#if !defined(HAVE_SDKDDKVER_H) && defined(__has_include) +#if __has_include() +#define HAVE_SDKDDKVER_H 1 +#endif +#endif + +#ifdef HAVE_SDKDDKVER_H +#include +#endif + /* This is a set of defines to configure the SDL features */ #if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) @@ -97,6 +109,7 @@ #define HAVE_DDRAW_H 1 #define HAVE_DINPUT_H 1 #define HAVE_DSOUND_H 1 +#ifndef __WATCOMC__ #define HAVE_DXGI_H 1 #define HAVE_XINPUT_H 1 #if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0A00 /* Windows 10 SDK */ @@ -106,10 +119,17 @@ #define HAVE_D3D11_H 1 #define HAVE_ROAPI_H 1 #endif +#if defined(WDK_NTDDI_VERSION) && WDK_NTDDI_VERSION > 0x0A000008 /* 10.0.19041.0 */ +#define HAVE_D3D12_H 1 +#endif +#if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0603 /* Windows 8.1 SDK */ +#define HAVE_SHELLSCALINGAPI_H 1 +#endif #define HAVE_MMDEVICEAPI_H 1 #define HAVE_AUDIOCLIENT_H 1 #define HAVE_TPCSHRD_H 1 #define HAVE_SENSORSAPI_H 1 +#endif #if (defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64)) && (defined(_MSC_VER) && _MSC_VER >= 1600) #define HAVE_IMMINTRIN_H 1 #elif defined(__has_include) && (defined(__i386__) || defined(__x86_64)) @@ -136,7 +156,11 @@ #define HAVE_REALLOC 1 #define HAVE_FREE 1 #define HAVE_ALLOCA 1 +/* OpenWatcom requires specific calling conventions for qsort and bsearch */ +#ifndef __WATCOMC__ #define HAVE_QSORT 1 +#define HAVE_BSEARCH 1 +#endif #define HAVE_ABS 1 #define HAVE_MEMSET 1 #define HAVE_MEMCPY 1 @@ -167,37 +191,40 @@ #define HAVE__WCSNICMP 1 #define HAVE__WCSDUP 1 #define HAVE_ACOS 1 -#define HAVE_ACOSF 1 #define HAVE_ASIN 1 -#define HAVE_ASINF 1 #define HAVE_ATAN 1 -#define HAVE_ATANF 1 #define HAVE_ATAN2 1 +#define HAVE_CEIL 1 +#define HAVE_COS 1 +#define HAVE_EXP 1 +#define HAVE_FABS 1 +#define HAVE_FLOOR 1 +#define HAVE_FMOD 1 +#define HAVE_LOG 1 +#define HAVE_LOG10 1 +#define HAVE_POW 1 +#define HAVE_SIN 1 +#define HAVE_SQRT 1 +#define HAVE_TAN 1 +#ifndef __WATCOMC__ +#define HAVE_ACOSF 1 +#define HAVE_ASINF 1 +#define HAVE_ATANF 1 #define HAVE_ATAN2F 1 #define HAVE_CEILF 1 #define HAVE__COPYSIGN 1 -#define HAVE_COS 1 #define HAVE_COSF 1 -#define HAVE_EXP 1 #define HAVE_EXPF 1 -#define HAVE_FABS 1 #define HAVE_FABSF 1 -#define HAVE_FLOOR 1 #define HAVE_FLOORF 1 -#define HAVE_FMOD 1 #define HAVE_FMODF 1 -#define HAVE_LOG 1 #define HAVE_LOGF 1 -#define HAVE_LOG10 1 #define HAVE_LOG10F 1 -#define HAVE_POW 1 #define HAVE_POWF 1 -#define HAVE_SIN 1 #define HAVE_SINF 1 -#define HAVE_SQRT 1 #define HAVE_SQRTF 1 -#define HAVE_TAN 1 #define HAVE_TANF 1 +#endif #if defined(_MSC_VER) /* These functions were added with the VC++ 2013 C runtime library */ #if _MSC_VER >= 1800 @@ -217,8 +244,18 @@ #if _MSC_VER >= 1400 #define HAVE__FSEEKI64 1 #endif +#ifdef _USE_MATH_DEFINES +#define HAVE_M_PI 1 #endif -#if !defined(_MSC_VER) || defined(_USE_MATH_DEFINES) +#elif defined(__WATCOMC__) +#define HAVE__FSEEKI64 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRTOULL 1 +#define HAVE_VSSCANF 1 +#define HAVE_ROUND 1 +#define HAVE_SCALBN 1 +#define HAVE_TRUNC 1 +#else #define HAVE_M_PI 1 #endif #else @@ -227,7 +264,9 @@ #endif /* Enable various audio drivers */ +#if defined(HAVE_MMDEVICEAPI_H) && defined(HAVE_AUDIOCLIENT_H) #define SDL_AUDIO_DRIVER_WASAPI 1 +#endif #define SDL_AUDIO_DRIVER_DSOUND 1 #define SDL_AUDIO_DRIVER_WINMM 1 #define SDL_AUDIO_DRIVER_DISK 1 @@ -248,7 +287,11 @@ #define SDL_HAPTIC_XINPUT 1 /* Enable the sensor driver */ +#ifdef HAVE_SENSORSAPI_H #define SDL_SENSOR_WINDOWS 1 +#else +#define SDL_SENSOR_DUMMY 1 +#endif /* Enable various shared object loading systems */ #define SDL_LOADSO_WINDOWS 1 @@ -270,6 +313,9 @@ #if !defined(SDL_VIDEO_RENDER_D3D11) && defined(HAVE_D3D11_H) #define SDL_VIDEO_RENDER_D3D11 1 #endif +#if !defined(SDL_VIDEO_RENDER_D3D12) && defined(HAVE_D3D12_H) +#define SDL_VIDEO_RENDER_D3D12 1 +#endif /* Enable OpenGL support */ #ifndef SDL_VIDEO_OPENGL @@ -300,11 +346,6 @@ /* Enable filesystem support */ #define SDL_FILESYSTEM_WINDOWS 1 -/* Enable assembly routines (Win64 doesn't have inline asm) */ -#ifndef _WIN64 -#define SDL_ASSEMBLY_ROUTINES 1 -#endif - #endif /* SDL_config_windows_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/include/SDL_config_wingdk.h libsdl2-2.24.0+dfsg/include/SDL_config_wingdk.h --- libsdl2-2.0.22+dfsg/include/SDL_config_wingdk.h 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_config_wingdk.h 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,285 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_config_wingdk_h_ +#define SDL_config_wingdk_h_ +#define SDL_config_h_ + +#include "SDL_platform.h" + +/* Windows GDK does not need Windows SDK version checks because it requires + * a recent version of the Windows 10 SDK. */ + +#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) +/* At this time, only recent MSVC or clang are supported by Windows GDK */ +#if defined(__clang__) +#define HAVE_STDINT_H 1 +#elif defined(_MSC_VER) +typedef signed __int8 int8_t; +typedef unsigned __int8 uint8_t; +typedef signed __int16 int16_t; +typedef unsigned __int16 uint16_t; +typedef signed __int32 int32_t; +typedef unsigned __int32 uint32_t; +typedef signed __int64 int64_t; +typedef unsigned __int64 uint64_t; +#ifndef _UINTPTR_T_DEFINED +typedef unsigned __int64 uintptr_t; +#define _UINTPTR_T_DEFINED +#endif +#else /* !__clang__ && !_MSC_VER */ +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef signed short int16_t; +typedef unsigned short uint16_t; +typedef signed int int32_t; +typedef unsigned int uint32_t; +typedef signed long long int64_t; +typedef unsigned long long uint64_t; +#ifndef _SIZE_T_DEFINED_ +#define _SIZE_T_DEFINED_ +typedef unsigned int size_t; +#endif +typedef unsigned int uintptr_t; +#endif /* __clang__ || _MSC_VER */ +#endif /* !_STDINT_H_ && !HAVE_STDINT_H */ + +/* GDK only supports 64-bit */ +# define SIZEOF_VOIDP 8 + +#ifdef __clang__ +# define HAVE_GCC_ATOMICS 1 +#endif + +#define HAVE_DDRAW_H 1 +#define HAVE_DINPUT_H 1 +#define HAVE_DSOUND_H 1 +/* No SDK version checks needed for these because the SDK has to be new. */ +#define HAVE_DXGI_H 1 +#define HAVE_XINPUT_H 1 +#define HAVE_WINDOWS_GAMING_INPUT_H 1 +#define HAVE_D3D11_H 1 +#define HAVE_ROAPI_H 1 +#define HAVE_D3D12_H 1 +#define HAVE_SHELLSCALINGAPI_H 1 +#define HAVE_MMDEVICEAPI_H 1 +#define HAVE_AUDIOCLIENT_H 1 +#define HAVE_TPCSHRD_H 1 +#define HAVE_SENSORSAPI_H 1 +#if (defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64)) && (defined(_MSC_VER) && _MSC_VER >= 1600) +#define HAVE_IMMINTRIN_H 1 +#elif defined(__has_include) && (defined(__i386__) || defined(__x86_64)) +# if __has_include() +# define HAVE_IMMINTRIN_H 1 +# endif +#endif + +/* This is disabled by default to avoid C runtime dependencies and manifest requirements */ +#ifdef HAVE_LIBC +/* Useful headers */ +#define STDC_HEADERS 1 +#define HAVE_CTYPE_H 1 +#define HAVE_FLOAT_H 1 +#define HAVE_LIMITS_H 1 +#define HAVE_MATH_H 1 +#define HAVE_SIGNAL_H 1 +#define HAVE_STDIO_H 1 +#define HAVE_STRING_H 1 + +/* C library functions */ +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_QSORT 1 +#define HAVE_BSEARCH 1 +#define HAVE_ABS 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMCMP 1 +#define HAVE_STRLEN 1 +#define HAVE__STRREV 1 +/* These functions have security warnings, so we won't use them */ +/* #undef HAVE__STRUPR */ +/* #undef HAVE__STRLWR */ +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +/* #undef HAVE_STRTOK_R */ +/* These functions have security warnings, so we won't use them */ +/* #undef HAVE__LTOA */ +/* #undef HAVE__ULTOA */ +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE_STRTOD 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE__STRICMP 1 +#define HAVE__STRNICMP 1 +#define HAVE__WCSICMP 1 +#define HAVE__WCSNICMP 1 +#define HAVE__WCSDUP 1 +#define HAVE_ACOS 1 +#define HAVE_ASIN 1 +#define HAVE_ATAN 1 +#define HAVE_ATAN2 1 +#define HAVE_CEIL 1 +#define HAVE_COS 1 +#define HAVE_EXP 1 +#define HAVE_FABS 1 +#define HAVE_FLOOR 1 +#define HAVE_FMOD 1 +#define HAVE_LOG 1 +#define HAVE_LOG10 1 +#define HAVE_POW 1 +#define HAVE_SIN 1 +#define HAVE_SQRT 1 +#define HAVE_TAN 1 +#define HAVE_ACOSF 1 +#define HAVE_ASINF 1 +#define HAVE_ATANF 1 +#define HAVE_ATAN2F 1 +#define HAVE_CEILF 1 +#define HAVE__COPYSIGN 1 +#define HAVE_COSF 1 +#define HAVE_EXPF 1 +#define HAVE_FABSF 1 +#define HAVE_FLOORF 1 +#define HAVE_FMODF 1 +#define HAVE_LOGF 1 +#define HAVE_LOG10F 1 +#define HAVE_POWF 1 +#define HAVE_SINF 1 +#define HAVE_SQRTF 1 +#define HAVE_TANF 1 +#if defined(_MSC_VER) +/* These functions were added with the VC++ 2013 C runtime library */ +#define HAVE_STRTOLL 1 +#define HAVE_STRTOULL 1 +#define HAVE_VSSCANF 1 +#define HAVE_LROUND 1 +#define HAVE_LROUNDF 1 +#define HAVE_ROUND 1 +#define HAVE_ROUNDF 1 +#define HAVE_SCALBN 1 +#define HAVE_SCALBNF 1 +#define HAVE_TRUNC 1 +#define HAVE_TRUNCF 1 +#define HAVE__FSEEKI64 1 +#ifdef _USE_MATH_DEFINES +#define HAVE_M_PI 1 +#endif +#else +#define HAVE_M_PI 1 +#endif +#else +#define HAVE_STDARG_H 1 +#define HAVE_STDDEF_H 1 +#endif + +/* Enable various audio drivers */ +#if defined(HAVE_MMDEVICEAPI_H) && defined(HAVE_AUDIOCLIENT_H) +#define SDL_AUDIO_DRIVER_WASAPI 1 +#endif +#define SDL_AUDIO_DRIVER_DSOUND 1 +#define SDL_AUDIO_DRIVER_WINMM 1 +#define SDL_AUDIO_DRIVER_DISK 1 +#define SDL_AUDIO_DRIVER_DUMMY 1 + +/* Enable various input drivers */ +#define SDL_JOYSTICK_DINPUT 1 +#define SDL_JOYSTICK_HIDAPI 1 +#define SDL_JOYSTICK_RAWINPUT 1 +#define SDL_JOYSTICK_VIRTUAL 1 +#ifdef HAVE_WINDOWS_GAMING_INPUT_H +#define SDL_JOYSTICK_WGI 1 +#endif +#define SDL_JOYSTICK_XINPUT 1 +#define SDL_HAPTIC_DINPUT 1 +#define SDL_HAPTIC_XINPUT 1 + +/* Enable the sensor driver */ +#ifdef HAVE_SENSORSAPI_H +#define SDL_SENSOR_WINDOWS 1 +#else +#define SDL_SENSOR_DUMMY 1 +#endif + +/* Enable various shared object loading systems */ +#define SDL_LOADSO_WINDOWS 1 + +/* Enable various threading systems */ +#define SDL_THREAD_GENERIC_COND_SUFFIX 1 +#define SDL_THREAD_WINDOWS 1 + +/* Enable various timer systems */ +#define SDL_TIMER_WINDOWS 1 + +/* Enable various video drivers */ +#define SDL_VIDEO_DRIVER_DUMMY 1 +#define SDL_VIDEO_DRIVER_WINDOWS 1 + +#ifndef SDL_VIDEO_RENDER_D3D +#define SDL_VIDEO_RENDER_D3D 1 +#endif +#if !defined(SDL_VIDEO_RENDER_D3D11) && defined(HAVE_D3D11_H) +#define SDL_VIDEO_RENDER_D3D11 1 +#endif +#if !defined(SDL_VIDEO_RENDER_D3D12) && defined(HAVE_D3D12_H) +#define SDL_VIDEO_RENDER_D3D12 1 +#endif + +/* Enable OpenGL support */ +#ifndef SDL_VIDEO_OPENGL +#define SDL_VIDEO_OPENGL 1 +#endif +#ifndef SDL_VIDEO_OPENGL_WGL +#define SDL_VIDEO_OPENGL_WGL 1 +#endif +#ifndef SDL_VIDEO_RENDER_OGL +#define SDL_VIDEO_RENDER_OGL 1 +#endif +#ifndef SDL_VIDEO_RENDER_OGL_ES2 +#define SDL_VIDEO_RENDER_OGL_ES2 1 +#endif +#ifndef SDL_VIDEO_OPENGL_ES2 +#define SDL_VIDEO_OPENGL_ES2 1 +#endif +#ifndef SDL_VIDEO_OPENGL_EGL +#define SDL_VIDEO_OPENGL_EGL 1 +#endif + +/* Enable Vulkan support */ +#define SDL_VIDEO_VULKAN 1 + +/* Enable system power support */ +#define SDL_POWER_WINDOWS 1 + +/* Enable filesystem support */ +#define SDL_FILESYSTEM_WINDOWS 1 + +#endif /* SDL_config_wingdk_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/include/SDL_config_winrt.h libsdl2-2.24.0+dfsg/include/SDL_config_winrt.h --- libsdl2-2.0.22+dfsg/include/SDL_config_winrt.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_config_winrt.h 2022-06-16 20:16:31.000000000 +0000 @@ -123,6 +123,7 @@ #define HAVE_FREE 1 #define HAVE_ALLOCA 1 #define HAVE_QSORT 1 +#define HAVE_BSEARCH 1 #define HAVE_ABS 1 #define HAVE_MEMSET 1 #define HAVE_MEMCPY 1 @@ -249,6 +250,9 @@ /* Enable appropriate renderer(s) */ #define SDL_VIDEO_RENDER_D3D11 1 +/* Disable D3D12 as it's not implemented for WinRT */ +#define SDL_VIDEO_RENDER_D3D12 0 + #if SDL_VIDEO_OPENGL_ES2 #define SDL_VIDEO_RENDER_OGL_ES2 1 #endif @@ -256,9 +260,4 @@ /* Enable system power support */ #define SDL_POWER_WINRT 1 -/* Enable assembly routines (Win64 doesn't have inline asm) */ -#ifndef _WIN64 -#define SDL_ASSEMBLY_ROUTINES 1 -#endif - #endif /* SDL_config_winrt_h_ */ diff -Nru libsdl2-2.0.22+dfsg/include/SDL_config_xbox.h libsdl2-2.24.0+dfsg/include/SDL_config_xbox.h --- libsdl2-2.0.22+dfsg/include/SDL_config_xbox.h 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_config_xbox.h 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,267 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_config_wingdk_h_ +#define SDL_config_wingdk_h_ +#define SDL_config_h_ + +#include "SDL_platform.h" + +/* Windows GDK does not need Windows SDK version checks because it requires + * a recent version of the Windows 10 SDK. */ + +#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) +/* At this time, only recent MSVC or clang are supported by Windows GDK */ +#if defined(__clang__) +#define HAVE_STDINT_H 1 +#elif defined(_MSC_VER) +typedef signed __int8 int8_t; +typedef unsigned __int8 uint8_t; +typedef signed __int16 int16_t; +typedef unsigned __int16 uint16_t; +typedef signed __int32 int32_t; +typedef unsigned __int32 uint32_t; +typedef signed __int64 int64_t; +typedef unsigned __int64 uint64_t; +#ifndef _UINTPTR_T_DEFINED +typedef unsigned __int64 uintptr_t; +#define _UINTPTR_T_DEFINED +#endif +#else /* !__clang__ && !_MSC_VER */ +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef signed short int16_t; +typedef unsigned short uint16_t; +typedef signed int int32_t; +typedef unsigned int uint32_t; +typedef signed long long int64_t; +typedef unsigned long long uint64_t; +#ifndef _SIZE_T_DEFINED_ +#define _SIZE_T_DEFINED_ +typedef unsigned int size_t; +#endif +typedef unsigned int uintptr_t; +#endif /* __clang__ || _MSC_VER */ +#endif /* !_STDINT_H_ && !HAVE_STDINT_H */ + +/* GDK only supports 64-bit */ +# define SIZEOF_VOIDP 8 + +#ifdef __clang__ +# define HAVE_GCC_ATOMICS 1 +#endif + +/*#define HAVE_DDRAW_H 1*/ +/*#define HAVE_DINPUT_H 1*/ +/*#define HAVE_DSOUND_H 1*/ +/* No SDK version checks needed for these because the SDK has to be new. */ +/* #define HAVE_DXGI_H 1 */ +#define HAVE_XINPUT_H 1 +/*#define HAVE_WINDOWS_GAMING_INPUT_H 1*/ +/*#define HAVE_D3D11_H 1*/ +/*#define HAVE_ROAPI_H 1*/ +#define HAVE_D3D12_H 1 +/*#define HAVE_SHELLSCALINGAPI_H 1*/ +#define HAVE_MMDEVICEAPI_H 1 +#define HAVE_AUDIOCLIENT_H 1 +/*#define HAVE_TPCSHRD_H 1*/ +/*#define HAVE_SENSORSAPI_H 1*/ +#if (defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64)) && (defined(_MSC_VER) && _MSC_VER >= 1600) +#define HAVE_IMMINTRIN_H 1 +#elif defined(__has_include) && (defined(__i386__) || defined(__x86_64)) +# if __has_include() +# define HAVE_IMMINTRIN_H 1 +# endif +#endif + +/* This is disabled by default to avoid C runtime dependencies and manifest requirements */ +#ifdef HAVE_LIBC +/* Useful headers */ +#define STDC_HEADERS 1 +#define HAVE_CTYPE_H 1 +#define HAVE_FLOAT_H 1 +#define HAVE_LIMITS_H 1 +#define HAVE_MATH_H 1 +#define HAVE_SIGNAL_H 1 +#define HAVE_STDIO_H 1 +#define HAVE_STRING_H 1 + +/* C library functions */ +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_QSORT 1 +#define HAVE_BSEARCH 1 +#define HAVE_ABS 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMCMP 1 +#define HAVE_STRLEN 1 +#define HAVE__STRREV 1 +/* These functions have security warnings, so we won't use them */ +/* #undef HAVE__STRUPR */ +/* #undef HAVE__STRLWR */ +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +/* #undef HAVE_STRTOK_R */ +/* These functions have security warnings, so we won't use them */ +/* #undef HAVE__LTOA */ +/* #undef HAVE__ULTOA */ +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE_STRTOD 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE__STRICMP 1 +#define HAVE__STRNICMP 1 +#define HAVE__WCSICMP 1 +#define HAVE__WCSNICMP 1 +#define HAVE__WCSDUP 1 +#define HAVE_ACOS 1 +#define HAVE_ASIN 1 +#define HAVE_ATAN 1 +#define HAVE_ATAN2 1 +#define HAVE_CEIL 1 +#define HAVE_COS 1 +#define HAVE_EXP 1 +#define HAVE_FABS 1 +#define HAVE_FLOOR 1 +#define HAVE_FMOD 1 +#define HAVE_LOG 1 +#define HAVE_LOG10 1 +#define HAVE_POW 1 +#define HAVE_SIN 1 +#define HAVE_SQRT 1 +#define HAVE_TAN 1 +#define HAVE_ACOSF 1 +#define HAVE_ASINF 1 +#define HAVE_ATANF 1 +#define HAVE_ATAN2F 1 +#define HAVE_CEILF 1 +#define HAVE__COPYSIGN 1 +#define HAVE_COSF 1 +#define HAVE_EXPF 1 +#define HAVE_FABSF 1 +#define HAVE_FLOORF 1 +#define HAVE_FMODF 1 +#define HAVE_LOGF 1 +#define HAVE_LOG10F 1 +#define HAVE_POWF 1 +#define HAVE_SINF 1 +#define HAVE_SQRTF 1 +#define HAVE_TANF 1 +#if defined(_MSC_VER) +/* These functions were added with the VC++ 2013 C runtime library */ +#define HAVE_STRTOLL 1 +#define HAVE_STRTOULL 1 +#define HAVE_VSSCANF 1 +#define HAVE_LROUND 1 +#define HAVE_LROUNDF 1 +#define HAVE_ROUND 1 +#define HAVE_ROUNDF 1 +#define HAVE_SCALBN 1 +#define HAVE_SCALBNF 1 +#define HAVE_TRUNC 1 +#define HAVE_TRUNCF 1 +#define HAVE__FSEEKI64 1 +#ifdef _USE_MATH_DEFINES +#define HAVE_M_PI 1 +#endif +#else +#define HAVE_M_PI 1 +#endif +#else +#define HAVE_STDARG_H 1 +#define HAVE_STDDEF_H 1 +#endif + +/* Enable various audio drivers */ +#if defined(HAVE_MMDEVICEAPI_H) && defined(HAVE_AUDIOCLIENT_H) +#define SDL_AUDIO_DRIVER_WASAPI 1 +#endif +/*#define SDL_AUDIO_DRIVER_DSOUND 1*/ +/*#define SDL_AUDIO_DRIVER_WINMM 1*/ +#define SDL_AUDIO_DRIVER_DISK 1 +#define SDL_AUDIO_DRIVER_DUMMY 1 + +/* Enable various input drivers */ +/*#define SDL_JOYSTICK_DINPUT 1*/ +/*#define SDL_JOYSTICK_HIDAPI 1*/ +/*#define SDL_JOYSTICK_RAWINPUT 1*/ +#define SDL_JOYSTICK_VIRTUAL 1 +#ifdef HAVE_WINDOWS_GAMING_INPUT_H +#define SDL_JOYSTICK_WGI 1 +#endif +#define SDL_JOYSTICK_XINPUT 1 +/*#define SDL_HAPTIC_DINPUT 1*/ +#define SDL_HAPTIC_XINPUT 1 + +/* Enable the sensor driver */ +#ifdef HAVE_SENSORSAPI_H +#define SDL_SENSOR_WINDOWS 1 +#else +#define SDL_SENSOR_DUMMY 1 +#endif + +/* Enable various shared object loading systems */ +#define SDL_LOADSO_WINDOWS 1 + +/* Enable various threading systems */ +#define SDL_THREAD_GENERIC_COND_SUFFIX 1 +#define SDL_THREAD_WINDOWS 1 + +/* Enable various timer systems */ +#define SDL_TIMER_WINDOWS 1 + +/* Enable various video drivers */ +#define SDL_VIDEO_DRIVER_DUMMY 1 +#define SDL_VIDEO_DRIVER_WINDOWS 1 + +/* #ifndef SDL_VIDEO_RENDER_D3D +#define SDL_VIDEO_RENDER_D3D 1 +#endif*/ +#if !defined(SDL_VIDEO_RENDER_D3D11) && defined(HAVE_D3D11_H) +#define SDL_VIDEO_RENDER_D3D11 1 +#endif +#if !defined(SDL_VIDEO_RENDER_D3D12) && defined(HAVE_D3D12_H) +#define SDL_VIDEO_RENDER_D3D12 1 +#endif + +/* Enable system power support */ +/*#define SDL_POWER_WINDOWS 1*/ +#define SDL_POWER_HARDWIRED 1 + +/* Enable filesystem support */ +/* #define SDL_FILESYSTEM_WINDOWS 1*/ +#define SDL_FILESYSTEM_XBOX 1 + +/* Disable IME as not supported yet (TODO: Xbox IME?) */ +#define SDL_DISABLE_WINDOWS_IME 1 + +#endif /* SDL_config_wingdk_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/include/SDL_cpuinfo.h libsdl2-2.24.0+dfsg/include/SDL_cpuinfo.h --- libsdl2-2.0.22+dfsg/include/SDL_cpuinfo.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_cpuinfo.h 2022-08-13 03:48:10.000000000 +0000 @@ -79,7 +79,7 @@ #if !defined(SDL_DISABLE_ARM_NEON_H) # if defined(__ARM_NEON) # include -# elif defined(__WINDOWS__) || defined(__WINRT__) +# elif defined(__WINDOWS__) || defined(__WINRT__) || defined(__GDK__) /* Visual Studio doesn't define __ARM_ARCH, but _M_ARM (if set, always 7), and _M_ARM64 (if set, always 1). */ # if defined(_M_ARM) # include @@ -98,6 +98,14 @@ #if defined(__3dNOW__) && !defined(SDL_DISABLE_MM3DNOW_H) #include #endif +#if defined(__loongarch_sx) && !defined(SDL_DISABLE_LSX_H) +#include +#define __LSX__ +#endif +#if defined(__loongarch_asx) && !defined(SDL_DISABLE_LASX_H) +#include +#define __LASX__ +#endif #if defined(HAVE_IMMINTRIN_H) && !defined(SDL_DISABLE_IMMINTRIN_H) #include #else @@ -434,9 +442,35 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void); /** + * Determine whether the CPU has LSX (LOONGARCH SIMD) features. + * + * This always returns false on CPUs that aren't using LOONGARCH instruction + * sets. + * + * \returns SDL_TRUE if the CPU has LOONGARCH LSX features or SDL_FALSE if + * not. + * + * \since This function is available since SDL 2.24.0. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasLSX(void); + +/** + * Determine whether the CPU has LASX (LOONGARCH SIMD) features. + * + * This always returns false on CPUs that aren't using LOONGARCH instruction + * sets. + * + * \returns SDL_TRUE if the CPU has LOONGARCH LASX features or SDL_FALSE if + * not. + * + * \since This function is available since SDL 2.24.0. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasLASX(void); + +/** * Get the amount of RAM configured in the system. * - * \returns the amount of RAM configured in the system in MB. + * \returns the amount of RAM configured in the system in MiB. * * \since This function is available since SDL 2.0.1. */ @@ -494,7 +528,7 @@ * * \since This function is available since SDL 2.0.10. * - * \sa SDL_SIMDAlignment + * \sa SDL_SIMDGetAlignment * \sa SDL_SIMDRealloc * \sa SDL_SIMDFree */ @@ -518,7 +552,7 @@ * * \since This function is available since SDL 2.0.14. * - * \sa SDL_SIMDAlignment + * \sa SDL_SIMDGetAlignment * \sa SDL_SIMDAlloc * \sa SDL_SIMDFree */ diff -Nru libsdl2-2.0.22+dfsg/include/SDL_endian.h libsdl2-2.24.0+dfsg/include/SDL_endian.h --- libsdl2-2.0.22+dfsg/include/SDL_endian.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_endian.h 2022-08-13 03:48:10.000000000 +0000 @@ -39,7 +39,7 @@ static __inline__ void __attribute__((__always_inline__, __nodebug__)) _m_prefetch(void *__P) { - __builtin_prefetch (__P, 0, 3 /* _MM_HINT_T0 */); + __builtin_prefetch(__P, 0, 3 /* _MM_HINT_T0 */); } #endif /* __PRFCHWINTRIN_H */ #endif /* __clang__ */ @@ -59,7 +59,7 @@ #ifdef __linux__ #include #define SDL_BYTEORDER __BYTE_ORDER -#elif defined(__OpenBSD__) +#elif defined(__OpenBSD__) || defined(__DragonFly__) #include #define SDL_BYTEORDER BYTE_ORDER #elif defined(__FreeBSD__) || defined(__NetBSD__) @@ -78,7 +78,7 @@ #if defined(__hppa__) || \ defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \ (defined(__MIPS__) && defined(__MIPSEB__)) || \ - defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \ + defined(__ppc__) || defined(__POWERPC__) || defined(__powerpc__) || defined(__PPC__) || \ defined(__sparc__) #define SDL_BYTEORDER SDL_BIG_ENDIAN #else @@ -87,6 +87,28 @@ #endif /* __linux__ */ #endif /* !SDL_BYTEORDER */ +#ifndef SDL_FLOATWORDORDER /* Not defined in SDL_config.h? */ +/* predefs from newer gcc versions: */ +#if defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__) && defined(__FLOAT_WORD_ORDER__) +#if (__FLOAT_WORD_ORDER__ == __ORDER_LITTLE_ENDIAN__) +#define SDL_FLOATWORDORDER SDL_LIL_ENDIAN +#elif (__FLOAT_WORD_ORDER__ == __ORDER_BIG_ENDIAN__) +#define SDL_FLOATWORDORDER SDL_BIG_ENDIAN +#else +#error Unsupported endianness +#endif /**/ +#elif defined(__MAVERICK__) +/* For Maverick, float words are always little-endian. */ +#define SDL_FLOATWORDORDER SDL_LIL_ENDIAN +#elif (defined(__arm__) || defined(__thumb__)) && !defined(__VFP_FP__) && !defined(__ARM_EABI__) +/* For FPA, float words are always big-endian. */ +#define SDL_FLOATWORDORDER SDL_BIG_ENDIAN +#else +/* By default, assume that floats words follow the memory system mode. */ +#define SDL_FLOATWORDORDER SDL_BYTEORDER +#endif /* __FLOAT_WORD_ORDER__ */ +#endif /* !SDL_FLOATWORDORDER */ + #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ diff -Nru libsdl2-2.0.22+dfsg/include/SDL_events.h libsdl2-2.24.0+dfsg/include/SDL_events.h --- libsdl2-2.0.22+dfsg/include/SDL_events.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_events.h 2022-06-02 02:01:57.000000000 +0000 @@ -118,6 +118,7 @@ SDL_JOYBUTTONUP, /**< Joystick button released */ SDL_JOYDEVICEADDED, /**< A new joystick has been inserted into the system */ SDL_JOYDEVICEREMOVED, /**< An opened joystick has been removed */ + SDL_JOYBATTERYUPDATED, /**< Joystick battery level change */ /* Game controller events */ SDL_CONTROLLERAXISMOTION = 0x650, /**< Game controller axis motion */ @@ -395,6 +396,16 @@ Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */ } SDL_JoyDeviceEvent; +/** + * \brief Joysick battery level change event structure (event.jbattery.*) + */ +typedef struct SDL_JoyBatteryEvent +{ + Uint32 type; /**< ::SDL_JOYBATTERYUPDATED */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + SDL_JoystickID which; /**< The joystick instance id */ + SDL_JoystickPowerLevel level; /**< The joystick battery level */ +} SDL_JoyBatteryEvent; /** * \brief Game controller axis motion event structure (event.caxis.*) @@ -625,6 +636,7 @@ SDL_JoyHatEvent jhat; /**< Joystick hat event data */ SDL_JoyButtonEvent jbutton; /**< Joystick button event data */ SDL_JoyDeviceEvent jdevice; /**< Joystick device change event data */ + SDL_JoyBatteryEvent jbattery; /**< Joystick battery event data */ SDL_ControllerAxisEvent caxis; /**< Game Controller axis event data */ SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */ SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */ diff -Nru libsdl2-2.0.22+dfsg/include/SDL_filesystem.h libsdl2-2.24.0+dfsg/include/SDL_filesystem.h --- libsdl2-2.0.22+dfsg/include/SDL_filesystem.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_filesystem.h 2022-08-13 03:48:10.000000000 +0000 @@ -92,7 +92,7 @@ * * `C:\\Users\\bob\\AppData\\Roaming\\My Company\\My Program Name\\` * - * On Linux, the string might look like" + * On Linux, the string might look like: * * `/home/bob/.local/share/My Program Name/` * diff -Nru libsdl2-2.0.22+dfsg/include/SDL_gamecontroller.h libsdl2-2.24.0+dfsg/include/SDL_gamecontroller.h --- libsdl2-2.0.22+dfsg/include/SDL_gamecontroller.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_gamecontroller.h 2022-08-13 03:48:10.000000000 +0000 @@ -69,7 +69,11 @@ SDL_CONTROLLER_TYPE_VIRTUAL, SDL_CONTROLLER_TYPE_PS5, SDL_CONTROLLER_TYPE_AMAZON_LUNA, - SDL_CONTROLLER_TYPE_GOOGLE_STADIA + SDL_CONTROLLER_TYPE_GOOGLE_STADIA, + SDL_CONTROLLER_TYPE_NVIDIA_SHIELD, + SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_LEFT, + SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT, + SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR } SDL_GameControllerType; typedef enum @@ -290,6 +294,25 @@ extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index); /** + * Get the implementation dependent path for the game controller. + * + * This function can be called before any controllers are opened. + * + * `joystick_index` is the same as the `device_index` passed to + * SDL_JoystickOpen(). + * + * \param joystick_index the device_index of a device, from zero to + * SDL_NumJoysticks()-1 + * \returns the implementation-dependent path for the game controller, or NULL + * if there is no path or the index is invalid. + * + * \since This function is available since SDL 2.24.0. + * + * \sa SDL_GameControllerPath + */ +extern DECLSPEC const char *SDLCALL SDL_GameControllerPathForIndex(int joystick_index); + +/** * Get the type of a game controller. * * This can be called before any controllers are opened. @@ -387,6 +410,23 @@ extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller); /** + * Get the implementation-dependent path for an opened game controller. + * + * This is the same path as returned by SDL_GameControllerNameForIndex(), but + * it takes a controller identifier instead of the (unstable) device index. + * + * \param gamecontroller a game controller identifier previously returned by + * SDL_GameControllerOpen() + * \returns the implementation dependent path for the game controller, or NULL + * if there is no path or the identifier passed is invalid. + * + * \since This function is available since SDL 2.24.0. + * + * \sa SDL_GameControllerPathForIndex + */ +extern DECLSPEC const char *SDLCALL SDL_GameControllerPath(SDL_GameController *gamecontroller); + +/** * Get the type of this currently opened controller * * This is the same name as returned by SDL_GameControllerTypeForIndex(), but @@ -415,7 +455,8 @@ * Set the player index of an opened game controller. * * \param gamecontroller the game controller object to adjust. - * \param player_index Player index to assign to this controller. + * \param player_index Player index to assign to this controller, or -1 to + * clear the player index and turn off player LEDs. * * \since This function is available since SDL 2.0.12. */ @@ -458,6 +499,18 @@ extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProductVersion(SDL_GameController *gamecontroller); /** + * Get the firmware version of an opened controller, if available. + * + * If the firmware version isn't available this function returns 0. + * + * \param gamecontroller the game controller object to query. + * \return the controller firmware version, or zero if unavailable. + * + * \since This function is available since SDL 2.24.0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetFirmwareVersion(SDL_GameController *gamecontroller); + +/** * Get the serial number of an opened controller, if available. * * Returns the serial number of the controller, or NULL if it is not diff -Nru libsdl2-2.0.22+dfsg/include/SDL_guid.h libsdl2-2.24.0+dfsg/include/SDL_guid.h --- libsdl2-2.0.22+dfsg/include/SDL_guid.h 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_guid.h 2022-06-16 20:16:31.000000000 +0000 @@ -0,0 +1,100 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_guid.h + * + * Include file for handling ::SDL_GUID values. + */ + +#ifndef SDL_guid_h_ +#define SDL_guid_h_ + +#include "SDL_stdinc.h" +#include "SDL_error.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * An SDL_GUID is a 128-bit identifier for an input device that + * identifies that device across runs of SDL programs on the same + * platform. If the device is detached and then re-attached to a + * different port, or if the base system is rebooted, the device + * should still report the same GUID. + * + * GUIDs are as precise as possible but are not guaranteed to + * distinguish physically distinct but equivalent devices. For + * example, two game controllers from the same vendor with the same + * product ID and revision may have the same GUID. + * + * GUIDs may be platform-dependent (i.e., the same device may report + * different GUIDs on different operating systems). + */ +typedef struct { + Uint8 data[16]; +} SDL_GUID; + +/* Function prototypes */ + +/** + * Get an ASCII string representation for a given ::SDL_GUID. + * + * You should supply at least 33 bytes for pszGUID. + * + * \param guid the ::SDL_GUID you wish to convert to string + * \param pszGUID buffer in which to write the ASCII string + * \param cbGUID the size of pszGUID + * + * \since This function is available since SDL 2.24.0. + * + * \sa SDL_GUIDFromString + */ +extern DECLSPEC void SDLCALL SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID); + +/** + * Convert a GUID string into a ::SDL_GUID structure. + * + * Performs no error checking. If this function is given a string containing + * an invalid GUID, the function will silently succeed, but the GUID generated + * will not be useful. + * + * \param pchGUID string containing an ASCII representation of a GUID + * \returns a ::SDL_GUID structure. + * + * \since This function is available since SDL 2.24.0. + * + * \sa SDL_GUIDToString + */ +extern DECLSPEC SDL_GUID SDLCALL SDL_GUIDFromString(const char *pchGUID); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_guid_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/include/SDL.h libsdl2-2.24.0+dfsg/include/SDL.h --- libsdl2-2.0.22+dfsg/include/SDL.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL.h 2022-08-13 03:48:10.000000000 +0000 @@ -41,6 +41,7 @@ #include "SDL_events.h" #include "SDL_filesystem.h" #include "SDL_gamecontroller.h" +#include "SDL_guid.h" #include "SDL_haptic.h" #include "SDL_hidapi.h" #include "SDL_hints.h" diff -Nru libsdl2-2.0.22+dfsg/include/SDL_hints.h libsdl2-2.24.0+dfsg/include/SDL_hints.h --- libsdl2-2.0.22+dfsg/include/SDL_hints.h 2022-04-21 17:37:37.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_hints.h 2022-08-13 03:48:10.000000000 +0000 @@ -392,13 +392,14 @@ #define SDL_HINT_ENABLE_STEAM_CONTROLLERS "SDL_ENABLE_STEAM_CONTROLLERS" /** - * \brief A variable controlling whether SDL logs all events pushed onto its internal queue. + * \brief A variable controlling verbosity of the logging of SDL events pushed onto the internal queue. * - * This variable can be set to the following values: + * This variable can be set to the following values, from least to most verbose: * * "0" - Don't log any events (default) - * "1" - Log all events except mouse and finger motion, which are pretty spammy. - * "2" - Log all events. + * "1" - Log most events (other than the really spammy ones). + * "2" - Include mouse and finger motion events. + * "3" - Include SDL_SysWMEvent events. * * This is generally meant to be used to debug SDL itself, but can be useful * for application developers that need better visibility into what is going @@ -651,18 +652,27 @@ */ #define SDL_HINT_JOYSTICK_GAMECUBE_RUMBLE_BRAKE "SDL_JOYSTICK_GAMECUBE_RUMBLE_BRAKE" - /** - * \brief A variable controlling whether Switch Joy-Cons should be treated the same as Switch Pro Controllers when using the HIDAPI driver. +/** + * \brief A variable controlling whether the HIDAPI driver for Nintendo Switch Joy-Cons should be used. * * This variable can be set to the following values: - * "0" - basic Joy-Con support with no analog input (the default) - * "1" - Joy-Cons treated as half full Pro Controllers with analog inputs and sensors + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used * - * This does not combine Joy-Cons into a single controller. That's up to the user. + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI */ #define SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS "SDL_JOYSTICK_HIDAPI_JOY_CONS" - /** +/** + * \brief A variable controlling whether Nintendo Switch Joy-Con controllers will be combined into a single Pro-like controller when using the HIDAPI driver + * + * This variable can be set to the following values: + * "0" - Left and right Joy-Con controllers will not be combined and each will be a mini-gamepad + * "1" - Left and right Joy-Con controllers will be combined into a single controller (the default) + */ +#define SDL_HINT_JOYSTICK_HIDAPI_COMBINE_JOY_CONS "SDL_JOYSTICK_HIDAPI_COMBINE_JOY_CONS" + +/** * \brief A variable controlling whether the HIDAPI driver for Amazon Luna controllers connected via Bluetooth should be used. * * This variable can be set to the following values: @@ -674,6 +684,28 @@ #define SDL_HINT_JOYSTICK_HIDAPI_LUNA "SDL_JOYSTICK_HIDAPI_LUNA" /** + * \brief A variable controlling whether the HIDAPI driver for Nintendo Online classic controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */ +#define SDL_HINT_JOYSTICK_HIDAPI_NINTENDO_CLASSIC "SDL_JOYSTICK_HIDAPI_NINTENDO_CLASSIC" + +/** + * \brief A variable controlling whether the HIDAPI driver for NVIDIA SHIELD controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */ +#define SDL_HINT_JOYSTICK_HIDAPI_SHIELD "SDL_JOYSTICK_HIDAPI_SHIELD" + +/** * \brief A variable controlling whether the HIDAPI driver for PS4 controllers should be used. * * This variable can be set to the following values: @@ -778,17 +810,37 @@ #define SDL_HINT_JOYSTICK_HIDAPI_SWITCH "SDL_JOYSTICK_HIDAPI_SWITCH" /** - * \brief A variable controlling whether the Home button LED should be turned on when a Nintendo Switch controller is opened + * \brief A variable controlling whether the Home button LED should be turned on when a Nintendo Switch Pro controller is opened * * This variable can be set to the following values: * "0" - home button LED is turned off * "1" - home button LED is turned on * - * By default the Home button LED state is not changed. + * By default the Home button LED state is not changed. This hint can also be set to a floating point value between 0.0 and 1.0 which controls the brightness of the Home button LED. */ #define SDL_HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED "SDL_JOYSTICK_HIDAPI_SWITCH_HOME_LED" /** + * \brief A variable controlling whether the Home button LED should be turned on when a Nintendo Switch Joy-Con controller is opened + * + * This variable can be set to the following values: + * "0" - home button LED is turned off + * "1" - home button LED is turned on + * + * By default the Home button LED state is not changed. This hint can also be set to a floating point value between 0.0 and 1.0 which controls the brightness of the Home button LED. + */ +#define SDL_HINT_JOYSTICK_HIDAPI_JOYCON_HOME_LED "SDL_JOYSTICK_HIDAPI_JOYCON_HOME_LED" + +/** + * \brief A variable controlling whether the player LEDs should be lit to indicate which player is associated with a Nintendo Switch controller. + * + * This variable can be set to the following values: + * "0" - player LEDs are not enabled + * "1" - player LEDs are enabled (the default) + */ +#define SDL_HINT_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED "SDL_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED" + +/** * \brief A variable controlling whether the HIDAPI driver for XBox controllers should be used. * * This variable can be set to the following values: @@ -799,7 +851,7 @@ */ #define SDL_HINT_JOYSTICK_HIDAPI_XBOX "SDL_JOYSTICK_HIDAPI_XBOX" - /** +/** * \brief A variable controlling whether the RAWINPUT joystick drivers should be used for better handling XInput-capable devices. * * This variable can be set to the following values: @@ -808,7 +860,7 @@ */ #define SDL_HINT_JOYSTICK_RAWINPUT "SDL_JOYSTICK_RAWINPUT" - /** +/** * \brief A variable controlling whether the RAWINPUT driver should pull correlated data from XInput. * * This variable can be set to the following values: @@ -821,7 +873,7 @@ */ #define SDL_HINT_JOYSTICK_RAWINPUT_CORRELATE_XINPUT "SDL_JOYSTICK_RAWINPUT_CORRELATE_XINPUT" - /** +/** * \brief A variable controlling whether the ROG Chakram mice should show up as joysticks * * This variable can be set to the following values: @@ -830,7 +882,7 @@ */ #define SDL_HINT_JOYSTICK_ROG_CHAKRAM "SDL_JOYSTICK_ROG_CHAKRAM" - /** +/** * \brief A variable controlling whether a separate thread should be used * for handling joystick detection and raw input messages on Windows * @@ -864,14 +916,32 @@ */ #define SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER "SDL_KMSDRM_REQUIRE_DRM_MASTER" - /** +/** * \brief A comma separated list of devices to open as joysticks * * This variable is currently only used by the Linux joystick driver. */ #define SDL_HINT_JOYSTICK_DEVICE "SDL_JOYSTICK_DEVICE" - /** +/** + * \brief A variable controlling whether joysticks on Linux will always treat 'hat' axis inputs (ABS_HAT0X - ABS_HAT3Y) as 8-way digital hats without checking whether they may be analog. + * + * This variable can be set to the following values: + * "0" - Only map hat axis inputs to digital hat outputs if the input axes appear to actually be digital (the default) + * "1" - Always handle the input axes numbered ABS_HAT0X to ABS_HAT3Y as digital hats + */ +#define SDL_HINT_LINUX_DIGITAL_HATS "SDL_LINUX_DIGITAL_HATS" + +/** + * \brief A variable controlling whether digital hats on Linux will apply deadzones to their underlying input axes or use unfiltered values. + * + * This variable can be set to the following values: + * "0" - Return digital hat values based on unfiltered input axis values + * "1" - Return digital hat values with deadzones on the input axes taken into account (the default) + */ +#define SDL_HINT_LINUX_HAT_DEADZONES "SDL_LINUX_HAT_DEADZONES" + +/** * \brief A variable controlling whether to use the classic /dev/input/js* joystick interface or the newer /dev/input/event* joystick interface on Linux * * This variable can be set to the following values: @@ -882,7 +952,7 @@ */ #define SDL_HINT_LINUX_JOYSTICK_CLASSIC "SDL_LINUX_JOYSTICK_CLASSIC" - /** +/** * \brief A variable controlling whether joysticks on Linux adhere to their HID-defined deadzones or return unfiltered values. * * This variable can be set to the following values: @@ -908,6 +978,24 @@ #define SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK "SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK" /** + * \brief A variable controlling whether dispatching OpenGL context updates should block the dispatching thread until the main thread finishes processing + * + * This variable can be set to the following values: + * "0" - Dispatching OpenGL context updates will block the dispatching thread until the main thread finishes processing (default). + * "1" - Dispatching OpenGL context updates will allow the dispatching thread to continue execution. + * + * Generally you want the default, but if you have OpenGL code in a background thread on a Mac, and the main thread + * hangs because it's waiting for that background thread, but that background thread is also hanging because it's + * waiting for the main thread to do an update, this might fix your issue. + * + * This hint only applies to macOS. + * + * This hint is available since SDL 2.24.0. + * + */ +#define SDL_HINT_MAC_OPENGL_ASYNC_DISPATCH "SDL_MAC_OPENGL_ASYNC_DISPATCH" + +/** * \brief A variable setting the double click radius, in pixels. */ #define SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS "SDL_MOUSE_DOUBLE_CLICK_RADIUS" @@ -977,6 +1065,17 @@ #define SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE "SDL_MOUSE_RELATIVE_SPEED_SCALE" /** + * \brief A variable controlling whether a motion event should be generated for mouse warping in relative mode. + * + * This variable can be set to the following values: + * "0" - Warping the mouse will not generate a motion event in relative mode + * "1" - Warping the mouse will generate a motion event in relative mode + * + * By default warping the mouse will not generate motion events in relative mode. This avoids the application having to filter out large relative motion due to warping. + */ +#define SDL_HINT_MOUSE_RELATIVE_WARP_MOTION "SDL_MOUSE_RELATIVE_WARP_MOTION" + +/** * \brief A variable controlling whether mouse events should generate synthetic touch events * * This variable can be set to the following values: @@ -1181,6 +1280,8 @@ * * This variable is case insensitive and can be set to the following values: * "direct3d" + * "direct3d11" + * "direct3d12" * "opengl" * "opengles2" * "opengles" @@ -1237,7 +1338,7 @@ */ #define SDL_HINT_RENDER_VSYNC "SDL_RENDER_VSYNC" - /** +/** * \brief A variable to control whether the return key on the soft keyboard * should hide the soft keyboard on Android and iOS. * @@ -1450,9 +1551,7 @@ * SDL_WINDOW_RESIZABLE windows will offer the "fullscreen" * button on their titlebars). * - * The default value is "1". Spaces are disabled regardless of this hint if - * the OS isn't at least Mac OS X Lion (10.7). This hint must be set before - * any windows are created. + * The default value is "1". This hint must be set before any windows are created. */ #define SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES "SDL_VIDEO_MAC_FULLSCREEN_SPACES" @@ -1490,6 +1589,21 @@ #define SDL_HINT_VIDEO_WAYLAND_PREFER_LIBDECOR "SDL_VIDEO_WAYLAND_PREFER_LIBDECOR" /** + * \brief A variable controlling whether video mode emulation is enabled under Wayland. + * + * When this hint is set, a standard set of emulated CVT video modes will be exposed for use by the application. + * If it is disabled, the only modes exposed will be the logical desktop size and, in the case of a scaled + * desktop, the native display resolution. + * + * This variable can be set to the following values: + * "0" - Video mode emulation is disabled. + * "1" - Video mode emulation is enabled. + * + * By default video mode emulation is enabled. + */ +#define SDL_HINT_VIDEO_WAYLAND_MODE_EMULATION "SDL_VIDEO_WAYLAND_MODE_EMULATION" + +/** * \brief A variable that is the address of another SDL_Window* (as a hex string formatted with "%p"). * * If this hint is set before SDL_CreateWindowFrom() and the SDL_Window* it is set to has @@ -1590,13 +1704,11 @@ #define SDL_HINT_VIDEO_X11_WINDOW_VISUALID "SDL_VIDEO_X11_WINDOW_VISUALID" /** - * \brief A variable controlling whether the X11 Xinerama extension should be used. - * - * This variable can be set to the following values: - * "0" - Disable Xinerama - * "1" - Enable Xinerama + * \brief A no-longer-used variable controlling whether the X11 Xinerama extension should be used. * - * By default SDL will use Xinerama if it is available. + * Before SDL 2.0.24, this would let apps and users disable Xinerama support on X11. + * Now SDL never uses Xinerama, and does not check for this hint at all. + * The preprocessor define is left here for source compatibility. */ #define SDL_HINT_VIDEO_X11_XINERAMA "SDL_VIDEO_X11_XINERAMA" @@ -1607,18 +1719,16 @@ * "0" - Disable XRandR * "1" - Enable XRandR * - * By default SDL will not use XRandR because of window manager issues. + * By default SDL will use XRandR. */ #define SDL_HINT_VIDEO_X11_XRANDR "SDL_VIDEO_X11_XRANDR" /** - * \brief A variable controlling whether the X11 VidMode extension should be used. - * - * This variable can be set to the following values: - * "0" - Disable XVidMode - * "1" - Enable XVidMode + * \brief A no-longer-used variable controlling whether the X11 VidMode extension should be used. * - * By default SDL will use XVidMode if it is available. + * Before SDL 2.0.24, this would let apps and users disable XVidMode support on X11. + * Now SDL never uses XVidMode, and does not check for this hint at all. + * The preprocessor define is left here for source compatibility. */ #define SDL_HINT_VIDEO_X11_XVIDMODE "SDL_VIDEO_X11_XVIDMODE" @@ -1779,6 +1889,57 @@ #define SDL_HINT_WINDOWS_USE_D3D9EX "SDL_WINDOWS_USE_D3D9EX" /** + * \brief Controls whether SDL will declare the process to be DPI aware. + * + * This hint must be set before initializing the video subsystem. + * + * The main purpose of declaring DPI awareness is to disable OS bitmap scaling of SDL windows on monitors with + * a DPI scale factor. + * + * This hint is equivalent to requesting DPI awareness via external means (e.g. calling SetProcessDpiAwarenessContext) + * and does not cause SDL to use a virtualized coordinate system, so it will generally give you 1 SDL coordinate = 1 pixel + * even on high-DPI displays. + * + * For more information, see: + * https://docs.microsoft.com/en-us/windows/win32/hidpi/high-dpi-desktop-application-development-on-windows + * + * This variable can be set to the following values: + * "" - Do not change the DPI awareness (default). + * "unaware" - Declare the process as DPI unaware. (Windows 8.1 and later). + * "system" - Request system DPI awareness. (Vista and later). + * "permonitor" - Request per-monitor DPI awareness. (Windows 8.1 and later). + * "permonitorv2" - Request per-monitor V2 DPI awareness. (Windows 10, version 1607 and later). + * The most visible difference from "permonitor" is that window title bar will be scaled + * to the visually correct size when dragging between monitors with different scale factors. + * This is the preferred DPI awareness level. + * + * If the requested DPI awareness is not available on the currently running OS, SDL will try to request the best + * available match. + */ +#define SDL_HINT_WINDOWS_DPI_AWARENESS "SDL_WINDOWS_DPI_AWARENESS" + +/** + * \brief Uses DPI-scaled points as the SDL coordinate system on Windows. + * + * This changes the SDL coordinate system units to be DPI-scaled points, rather than pixels everywhere. + * This means windows will be appropriately sized, even when created on high-DPI displays with scaling. + * + * e.g. requesting a 640x480 window from SDL, on a display with 125% scaling in Windows display settings, + * will create a window with an 800x600 client area (in pixels). + * + * Setting this to "1" implicitly requests process DPI awareness (setting SDL_WINDOWS_DPI_AWARENESS is unnecessary), + * and forces SDL_WINDOW_ALLOW_HIGHDPI on all windows. + * + * This variable can be set to the following values: + * "0" - SDL coordinates equal Windows coordinates. No automatic window resizing when dragging + * between monitors with different scale factors (unless this is performed by + * Windows itself, which is the case when the process is DPI unaware). + * "1" - SDL coordinates are in DPI-scaled points. Automatically resize windows as needed on + * displays with non-100% scale factors. + */ +#define SDL_HINT_WINDOWS_DPI_SCALING "SDL_WINDOWS_DPI_SCALING" + +/** * \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden * * This variable can be set to the following values: @@ -1920,6 +2081,15 @@ */ #define SDL_HINT_XINPUT_ENABLED "SDL_XINPUT_ENABLED" + /** + * \brief A variable that lets you disable the detection and use of DirectInput gamepad devices + * + * The variable can be set to the following values: + * "0" - Disable DirectInput detection (only uses XInput) + * "1" - Enable DirectInput detection (the default) + */ +#define SDL_HINT_DIRECTINPUT_ENABLED "SDL_DIRECTINPUT_ENABLED" + /** * \brief A variable that causes SDL to use the old axis and button mapping for XInput devices. * @@ -2039,6 +2209,42 @@ */ #define SDL_HINT_AUDIODRIVER "SDL_AUDIODRIVER" +/** + * \brief A variable that decides what KMSDRM device to use. + * + * Internally, SDL might open something like "/dev/dri/cardNN" to + * access KMSDRM functionality, where "NN" is a device index number. + * + * SDL makes a guess at the best index to use (usually zero), but the + * app or user can set this hint to a number between 0 and 99 to + * force selection. + * + * This hint is available since SDL 2.24.0. + */ +#define SDL_HINT_KMSDRM_DEVICE_INDEX "SDL_KMSDRM_DEVICE_INDEX" + + +/** + * \brief A variable that treats trackpads as touch devices. + * + * On macOS (and possibly other platforms in the future), SDL will report + * touches on a trackpad as mouse input, which is generally what users + * expect from this device; however, these are often actually full + * multitouch-capable touch devices, so it might be preferable to some apps + * to treat them as such. + * + * Setting this hint to true will make the trackpad input report as a + * multitouch device instead of a mouse. The default is false. + * + * Note that most platforms don't support this hint. As of 2.24.0, it + * only supports MacBooks' trackpads on macOS. Others may follow later. + * + * This hint is checked during SDL_Init and can not be changed after. + * + * This hint is available since SDL 2.24.0. + */ +#define SDL_HINT_TRACKPAD_IS_TOUCH_ONLY "SDL_TRACKPAD_IS_TOUCH_ONLY" + /** * \brief An enumeration of hint priorities @@ -2092,6 +2298,23 @@ const char *value); /** + * Reset a hint to the default value. + * + * This will reset a hint to the value of the environment variable, or NULL if + * the environment isn't set. Callbacks will be called normally with this + * change. + * + * \param name the hint to set + * \returns SDL_TRUE if the hint was set, SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.24.0. + * + * \sa SDL_GetHint + * \sa SDL_SetHint + */ +extern DECLSPEC SDL_bool SDLCALL SDL_ResetHint(const char *name); + +/** * Get the value of a hint. * * \param name the hint to query diff -Nru libsdl2-2.0.22+dfsg/include/SDL_joystick.h libsdl2-2.24.0+dfsg/include/SDL_joystick.h --- libsdl2-2.0.22+dfsg/include/SDL_joystick.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_joystick.h 2022-08-13 03:48:10.000000000 +0000 @@ -43,6 +43,7 @@ #include "SDL_stdinc.h" #include "SDL_error.h" +#include "SDL_guid.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -69,9 +70,7 @@ typedef struct _SDL_Joystick SDL_Joystick; /* A structure that encodes the stable unique id for a joystick device */ -typedef struct { - Uint8 data[16]; -} SDL_JoystickGUID; +typedef SDL_GUID SDL_JoystickGUID; /** * This is a unique ID for a joystick for the time it is connected to the system, @@ -153,6 +152,7 @@ * \since This function is available since SDL 2.0.0. * * \sa SDL_JoystickName + * \sa SDL_JoystickPath * \sa SDL_JoystickOpen */ extern DECLSPEC int SDLCALL SDL_NumJoysticks(void); @@ -175,6 +175,23 @@ extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index); /** + * Get the implementation dependent path of a joystick. + * + * This can be called before any joysticks are opened. + * + * \param device_index the index of the joystick to query (the N'th joystick + * on the system) + * \returns the path of the selected joystick. If no path can be found, this + * function returns NULL; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.24.0. + * + * \sa SDL_JoystickPath + * \sa SDL_JoystickOpen + */ +extern DECLSPEC const char *SDLCALL SDL_JoystickPathForIndex(int device_index); + +/** * Get the player index of a joystick, or -1 if it's not available This can be * called before any joysticks are opened. * @@ -331,6 +348,54 @@ int nhats); /** + * The structure that defines an extended virtual joystick description + * + * The caller must zero the structure and then initialize the version with `SDL_VIRTUAL_JOYSTICK_DESC_VERSION` before passing it to SDL_JoystickAttachVirtualEx() + * All other elements of this structure are optional and can be left 0. + * + * \sa SDL_JoystickAttachVirtualEx + */ +typedef struct SDL_VirtualJoystickDesc +{ + Uint16 version; /**< `SDL_VIRTUAL_JOYSTICK_DESC_VERSION` */ + Uint16 type; /**< `SDL_JoystickType` */ + Uint16 naxes; /**< the number of axes on this joystick */ + Uint16 nbuttons; /**< the number of buttons on this joystick */ + Uint16 nhats; /**< the number of hats on this joystick */ + Uint16 vendor_id; /**< the USB vendor ID of this joystick */ + Uint16 product_id; /**< the USB product ID of this joystick */ + Uint16 padding; /**< unused */ + Uint32 button_mask; /**< A mask of which buttons are valid for this controller + e.g. (1 << SDL_CONTROLLER_BUTTON_A) */ + Uint32 axis_mask; /**< A mask of which axes are valid for this controller + e.g. (1 << SDL_CONTROLLER_AXIS_LEFTX) */ + const char *name; /**< the name of the joystick */ + + void *userdata; /**< User data pointer passed to callbacks */ + void (SDLCALL *Update)(void *userdata); /**< Called when the joystick state should be updated */ + void (SDLCALL *SetPlayerIndex)(void *userdata, int player_index); /**< Called when the player index is set */ + int (SDLCALL *Rumble)(void *userdata, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble); /**< Implements SDL_JoystickRumble() */ + int (SDLCALL *RumbleTriggers)(void *userdata, Uint16 left_rumble, Uint16 right_rumble); /**< Implements SDL_JoystickRumbleTriggers() */ + int (SDLCALL *SetLED)(void *userdata, Uint8 red, Uint8 green, Uint8 blue); /**< Implements SDL_JoystickSetLED() */ + int (SDLCALL *SendEffect)(void *userdata, const void *data, int size); /**< Implements SDL_JoystickSendEffect() */ + +} SDL_VirtualJoystickDesc; + +/** + * \brief The current version of the SDL_VirtualJoystickDesc structure + */ +#define SDL_VIRTUAL_JOYSTICK_DESC_VERSION 1 + +/** + * Attach a new virtual joystick with extended properties. + * + * \returns the joystick's device index, or -1 if an error occurred. + * + * \since This function is available since SDL 2.24.0. + */ +extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtualEx(const SDL_VirtualJoystickDesc *desc); + +/** * Detach a virtual joystick. * * \param device_index a value previously returned from @@ -420,6 +485,19 @@ extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick *joystick); /** + * Get the implementation dependent path of a joystick. + * + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() + * \returns the path of the selected joystick. If no path can be found, this + * function returns NULL; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.24.0. + * + * \sa SDL_JoystickPathForIndex + */ +extern DECLSPEC const char *SDLCALL SDL_JoystickPath(SDL_Joystick *joystick); + +/** * Get the player index of an opened joystick. * * For XInput controllers this returns the XInput user index. Many joysticks @@ -436,7 +514,8 @@ * Set the player index of an opened joystick. * * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() - * \param player_index the player index to set. + * \param player_index Player index to assign to this joystick, or -1 to clear + * the player index and turn off player LEDs. * * \since This function is available since SDL 2.0.12. */ @@ -496,6 +575,19 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProductVersion(SDL_Joystick *joystick); /** + * Get the firmware version of an opened joystick, if available. + * + * If the firmware version isn't available this function returns 0. + * + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() + * \returns the firmware version of the selected joystick, or 0 if + * unavailable. + * + * \since This function is available since SDL 2.24.0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetFirmwareVersion(SDL_Joystick *joystick); + +/** * Get the serial number of an opened joystick, if available. * * Returns the serial number of the joystick, or NULL if it is not available. diff -Nru libsdl2-2.0.22+dfsg/include/SDL_keyboard.h libsdl2-2.24.0+dfsg/include/SDL_keyboard.h --- libsdl2-2.0.22+dfsg/include/SDL_keyboard.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_keyboard.h 2022-08-13 03:48:10.000000000 +0000 @@ -90,10 +90,22 @@ * \since This function is available since SDL 2.0.0. * * \sa SDL_PumpEvents + * \sa SDL_ResetKeyboard */ extern DECLSPEC const Uint8 *SDLCALL SDL_GetKeyboardState(int *numkeys); /** + * Clear the state of the keyboard + * + * This function will generate key up events for all pressed keys. + * + * \since This function is available since SDL 2.24.0. + * + * \sa SDL_GetKeyboardState + */ +extern DECLSPEC void SDLCALL SDL_ResetKeyboard(void); + +/** * Get the current key modifier state for the keyboard. * * \returns an OR'd combination of the modifier keys for the keyboard. See @@ -288,7 +300,11 @@ /** * Set the rectangle used to type Unicode text inputs. * - * Note: If you want use system native IME window, try to set hint + * To start text input in a given location, this function is intended to be + * called before SDL_StartTextInput, although some platforms support moving + * the rectangle even while text input (and a composition) is active. + * + * Note: If you want to use the system native IME window, try setting hint * **SDL_HINT_IME_SHOW_UI** to **1**, otherwise this function won't give you * any feedback. * @@ -299,7 +315,7 @@ * * \sa SDL_StartTextInput */ -extern DECLSPEC void SDLCALL SDL_SetTextInputRect(SDL_Rect *rect); +extern DECLSPEC void SDLCALL SDL_SetTextInputRect(const SDL_Rect *rect); /** * Check whether the platform has screen keyboard support. diff -Nru libsdl2-2.0.22+dfsg/include/SDL_keycode.h libsdl2-2.24.0+dfsg/include/SDL_keycode.h --- libsdl2-2.0.22+dfsg/include/SDL_keycode.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_keycode.h 2022-06-02 02:01:57.000000000 +0000 @@ -318,7 +318,12 @@ SDLK_APP2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP2), SDLK_AUDIOREWIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOREWIND), - SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD) + SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD), + + SDLK_SOFTLEFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SOFTLEFT), + SDLK_SOFTRIGHT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SOFTRIGHT), + SDLK_CALL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CALL), + SDLK_ENDCALL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_ENDCALL) } SDL_KeyCode; /** diff -Nru libsdl2-2.0.22+dfsg/include/SDL_log.h libsdl2-2.24.0+dfsg/include/SDL_log.h --- libsdl2-2.0.22+dfsg/include/SDL_log.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_log.h 2022-06-02 02:01:57.000000000 +0000 @@ -47,9 +47,9 @@ /** - * \brief The maximum size of a log message + * \brief The maximum size of a log message prior to SDL 2.0.24 * - * Messages longer than the maximum size will be truncated + * As of 2.0.24 there is no limit to the length of SDL log messages. */ #define SDL_MAX_LOG_MESSAGE 4096 diff -Nru libsdl2-2.0.22+dfsg/include/SDL_main.h libsdl2-2.24.0+dfsg/include/SDL_main.h --- libsdl2-2.0.22+dfsg/include/SDL_main.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_main.h 2022-08-13 03:48:10.000000000 +0000 @@ -51,6 +51,15 @@ */ #define SDL_MAIN_NEEDED +#elif defined(__GDK__) +/* On GDK, SDL provides a main function that initializes the game runtime. + + Please note that #include'ing SDL_main.h is not enough to get a main() + function working. You must either link against SDL2main or, if not possible, + call the SDL_GDKRunApp function from your entry point. +*/ +#define SDL_MAIN_NEEDED + #elif defined(__IPHONEOS__) /* On iOS SDL provides a main function that creates an application delegate and starts the iOS application run loop. @@ -92,6 +101,13 @@ */ #define SDL_MAIN_AVAILABLE +#elif defined(__PS2__) +#define SDL_MAIN_AVAILABLE + +#define SDL_PS2_SKIP_IOP_RESET() \ + void reset_IOP(); \ + void reset_IOP() {} + #endif #endif /* SDL_MAIN_HANDLED */ @@ -145,7 +161,7 @@ */ extern DECLSPEC void SDLCALL SDL_SetMainReady(void); -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__GDK__) /** * Register a win32 window class for SDL's use. @@ -189,7 +205,7 @@ */ extern DECLSPEC void SDLCALL SDL_UnregisterApp(void); -#endif /* __WIN32__ */ +#endif /* defined(__WIN32__) || defined(__GDK__) */ #ifdef __WINRT__ @@ -224,6 +240,21 @@ #endif /* __IPHONEOS__ */ +#ifdef __GDK__ + +/** + * Initialize and launch an SDL GDK application. + * + * \param mainFunction the SDL app's C-style main(), an SDL_main_func + * \param reserved reserved for future use; should be NULL + * \returns 0 on success or -1 on failure; call SDL_GetError() to retrieve + * more information on the failure. + * + * \since This function is available since SDL 2.24.0. + */ +extern DECLSPEC int SDLCALL SDL_GDKRunApp(SDL_main_func mainFunction, void *reserved); + +#endif /* __GDK__ */ #ifdef __cplusplus } diff -Nru libsdl2-2.0.22+dfsg/include/SDL_mouse.h libsdl2-2.24.0+dfsg/include/SDL_mouse.h --- libsdl2-2.0.22+dfsg/include/SDL_mouse.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_mouse.h 2022-08-13 03:48:10.000000000 +0000 @@ -154,7 +154,9 @@ /** * Move the mouse cursor to the given position within the window. * - * This function generates a mouse motion event. + * This function generates a mouse motion event if relative mode is not + * enabled. If relative mode is enabled, you can force mouse events for the + * warp by setting the SDL_HINT_MOUSE_RELATIVE_WARP_MOTION hint. * * Note that this function will appear to succeed, but not actually move the * mouse when used over Microsoft Remote Desktop. @@ -245,6 +247,15 @@ * While capturing is enabled, the current window will have the * `SDL_WINDOW_MOUSE_CAPTURE` flag set. * + * Please note that as of SDL 2.0.22, SDL will attempt to "auto capture" the + * mouse while the user is pressing a button; this is to try and make mouse + * behavior more consistent between platforms, and deal with the common case + * of a user dragging the mouse outside of the window. This means that if you + * are calling SDL_CaptureMouse() only to deal with this situation, you no + * longer have to (although it is safe to do so). If this causes problems for + * your app, you can disable auto capture by setting the + * `SDL_HINT_MOUSE_AUTO_CAPTURE` hint to zero. + * * \param enabled SDL_TRUE to enable capturing, SDL_FALSE to disable. * \returns 0 on success or -1 if not supported; call SDL_GetError() for more * information. diff -Nru libsdl2-2.0.22+dfsg/include/SDL_platform.h libsdl2-2.24.0+dfsg/include/SDL_platform.h --- libsdl2-2.0.22+dfsg/include/SDL_platform.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_platform.h 2022-08-13 03:48:10.000000000 +0000 @@ -65,11 +65,15 @@ #undef __LINUX__ /* do we need to do this? */ #define __ANDROID__ 1 #endif +#if defined(__NGAGE__) +#undef __NGAGE__ +#define __NGAGE__ 1 +#endif #if defined(__APPLE__) /* lets us know what version of Mac OS X we're compiling on */ -#include "AvailabilityMacros.h" -#include "TargetConditionals.h" +#include +#include /* Fix building with older SDKs that don't define these See this for more information: @@ -104,9 +108,9 @@ /* if not compiling for iOS */ #undef __MACOSX__ #define __MACOSX__ 1 -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 -# error SDL for Mac OS X only supports deploying on 10.6 and above. -#endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1060 */ +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 +# error SDL for Mac OS X only supports deploying on 10.7 and above. +#endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1070 */ #endif /* TARGET_OS_IPHONE */ #endif /* defined(__APPLE__) */ @@ -140,7 +144,7 @@ #endif #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) -/* Try to find out if we're compiling for WinRT or non-WinRT */ +/* Try to find out if we're compiling for WinRT, GDK or non-WinRT/GDK */ #if defined(_MSC_VER) && defined(__has_include) #if __has_include() #define HAVE_WINAPIFAMILY_H 1 @@ -165,6 +169,15 @@ #if WINAPI_FAMILY_WINRT #undef __WINRT__ #define __WINRT__ 1 +#elif defined(_GAMING_DESKTOP) /* GDK project configuration always defines _GAMING_XXX */ +#undef __WINGDK__ +#define __WINGDK__ 1 +#elif defined(_GAMING_XBOX_XBOXONE) +#undef __XBOXONE__ +#define __XBOXONE__ 1 +#elif defined(_GAMING_XBOX_SCARLETT) +#undef __XBOXSERIES__ +#define __XBOXSERIES__ 1 #else #undef __WINDOWS__ #define __WINDOWS__ 1 @@ -175,10 +188,18 @@ #undef __WIN32__ #define __WIN32__ 1 #endif +/* This is to support generic "any GDK" separate from a platform-specific GDK */ +#if defined(__WINGDK__) || defined(__XBOXONE__) || defined(__XBOXSERIES__) +#undef __GDK__ +#define __GDK__ 1 +#endif #if defined(__PSP__) #undef __PSP__ #define __PSP__ 1 #endif +#if defined(PS2) +#define __PS2__ 1 +#endif /* The NACL compiler defines __native_client__ and __pnacl__ * Ref: http://www.chromium.org/nativeclient/pnacl/stability-of-the-pnacl-bitcode-abi diff -Nru libsdl2-2.0.22+dfsg/include/SDL_rect.h libsdl2-2.24.0+dfsg/include/SDL_rect.h --- libsdl2-2.0.22+dfsg/include/SDL_rect.h 2022-04-23 17:37:35.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_rect.h 2022-06-02 02:01:57.000000000 +0000 @@ -252,10 +252,10 @@ SDL_FORCE_INLINE SDL_bool SDL_FRectEqualsEpsilon(const SDL_FRect *a, const SDL_FRect *b, const float epsilon) { return (a && b && ((a == b) || - ((SDL_fabs(a->x - b->x) <= epsilon) && - (SDL_fabs(a->y - b->y) <= epsilon) && - (SDL_fabs(a->w - b->w) <= epsilon) && - (SDL_fabs(a->h - b->h) <= epsilon)))) + ((SDL_fabsf(a->x - b->x) <= epsilon) && + (SDL_fabsf(a->y - b->y) <= epsilon) && + (SDL_fabsf(a->w - b->w) <= epsilon) && + (SDL_fabsf(a->h - b->h) <= epsilon)))) ? SDL_TRUE : SDL_FALSE; } diff -Nru libsdl2-2.0.22+dfsg/include/SDL_render.h libsdl2-2.24.0+dfsg/include/SDL_render.h --- libsdl2-2.0.22+dfsg/include/SDL_render.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_render.h 2022-08-13 03:48:10.000000000 +0000 @@ -825,9 +825,13 @@ /** * Get device independent resolution for rendering. * - * This may return 0 for `w` and `h` if the SDL_Renderer has never had its - * logical size set by SDL_RenderSetLogicalSize() and never had a render - * target set. + * When using the main rendering target (eg no target texture is set): this + * may return 0 for `w` and `h` if the SDL_Renderer has never had its logical + * size set by SDL_RenderSetLogicalSize(). Otherwise it returns the logical + * width and height. + * + * When using a target texture: Never return 0 for `w` and `h` at first. Then + * it returns the logical width and height that are set. * * \param renderer a rendering context * \param w an int to be filled with the width @@ -1000,7 +1004,7 @@ * and logical renderer size set * * \param renderer the renderer from which the logical coordinates should be - * calcualted + * calculated * \param windowX the real X coordinate in the window * \param windowY the real Y coordinate in the window * \param logicalX the pointer filled with the logical x coordinate @@ -1017,19 +1021,23 @@ int windowX, int windowY, float *logicalX, float *logicalY); - /** - * Get real coordinates of point in window when given logical coordinates of point in renderer. - * Logical coordinates will differ from real coordinates when render is scaled and logical renderer size set - * - * \param renderer the renderer from which the window coordinates should be calculated + +/** + * Get real coordinates of point in window when given logical coordinates of + * point in renderer. + * + * Logical coordinates will differ from real coordinates when render is scaled + * and logical renderer size set + * + * \param renderer the renderer from which the window coordinates should be + * calculated * \param logicalX the logical x coordinate * \param logicalY the logical y coordinate * \param windowX the pointer filled with the real X coordinate in the window * \param windowY the pointer filled with the real Y coordinate in the window - - * + * * \since This function is available since SDL 2.0.18. - * + * * \sa SDL_RenderGetScale * \sa SDL_RenderSetScale * \sa SDL_RenderGetLogicalSize diff -Nru libsdl2-2.0.22+dfsg/include/SDL_revision.h libsdl2-2.24.0+dfsg/include/SDL_revision.h --- libsdl2-2.0.22+dfsg/include/SDL_revision.h 2022-04-25 18:10:40.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_revision.h 2022-08-19 15:46:49.000000000 +0000 @@ -1,2 +1,2 @@ -#define SDL_REVISION "https://github.com/libsdl-org/SDL.git@53dea9830964eee8b5c2a7ee0a65d6e268dc78a1" +#define SDL_REVISION "https://github.com/libsdl-org/SDL.git@8c9beb0c873f6ca5efbd88f1ad2648bfc793b2ac" #define SDL_REVISION_NUMBER 0 diff -Nru libsdl2-2.0.22+dfsg/include/SDL_rwops.h libsdl2-2.24.0+dfsg/include/SDL_rwops.h --- libsdl2-2.0.22+dfsg/include/SDL_rwops.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_rwops.h 2022-08-13 03:48:10.000000000 +0000 @@ -45,9 +45,6 @@ #define SDL_RWOPS_JNIFILE 3U /**< Android asset */ #define SDL_RWOPS_MEMORY 4U /**< Memory stream */ #define SDL_RWOPS_MEMORY_RO 5U /**< Read-Only memory stream */ -#if defined(__VITA__) -#define SDL_RWOPS_VITAFILE 6U /**< Vita file */ -#endif /** * This is the read/write operation structure -- very basic. @@ -101,7 +98,7 @@ { void *asset; } androidio; -#elif defined(__WIN32__) +#elif defined(__WIN32__) || defined(__GDK__) struct { SDL_bool append; @@ -113,17 +110,6 @@ size_t left; } buffer; } windowsio; -#elif defined(__VITA__) - struct - { - int h; - struct - { - void *data; - size_t size; - size_t left; - } buffer; - } vitaio; #endif #ifdef HAVE_STDIO_H diff -Nru libsdl2-2.0.22+dfsg/include/SDL_scancode.h libsdl2-2.24.0+dfsg/include/SDL_scancode.h --- libsdl2-2.0.22+dfsg/include/SDL_scancode.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_scancode.h 2022-06-02 02:01:57.000000000 +0000 @@ -402,6 +402,26 @@ /* @} *//* Usage page 0x0C (additional media keys) */ + /** + * \name Mobile keys + * + * These are values that are often used on mobile phones. + */ + /* @{ */ + + SDL_SCANCODE_SOFTLEFT = 287, /**< Usually situated below the display on phones and + used as a multi-function feature key for selecting + a software defined function shown on the bottom left + of the display. */ + SDL_SCANCODE_SOFTRIGHT = 288, /**< Usually situated below the display on phones and + used as a multi-function feature key for selecting + a software defined function shown on the bottom right + of the display. */ + SDL_SCANCODE_CALL = 289, /**< Used for accepting phone calls. */ + SDL_SCANCODE_ENDCALL = 290, /**< Used for rejecting phone calls. */ + + /* @} *//* Mobile keys */ + /* Add any other keys here. */ SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes diff -Nru libsdl2-2.0.22+dfsg/include/SDL_stdinc.h libsdl2-2.24.0+dfsg/include/SDL_stdinc.h --- libsdl2-2.0.22+dfsg/include/SDL_stdinc.h 2022-04-21 17:37:37.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_stdinc.h 2022-08-19 15:46:21.000000000 +0000 @@ -115,6 +115,12 @@ # endif #endif +#ifdef SIZE_MAX +# define SDL_SIZE_MAX SIZE_MAX +#else +# define SDL_SIZE_MAX ((size_t) -1) +#endif + /** * Check if the compiler supports a given builtin. * Supported by virtually all clang versions and recent gcc. Use this @@ -253,7 +259,7 @@ #ifndef SDL_PRIs64 #ifdef PRIs64 #define SDL_PRIs64 PRIs64 -#elif defined(__WIN32__) +#elif defined(__WIN32__) || defined(__GDK__) #define SDL_PRIs64 "I64d" #elif defined(__LINUX__) && defined(__LP64__) #define SDL_PRIs64 "ld" @@ -264,7 +270,7 @@ #ifndef SDL_PRIu64 #ifdef PRIu64 #define SDL_PRIu64 PRIu64 -#elif defined(__WIN32__) +#elif defined(__WIN32__) || defined(__GDK__) #define SDL_PRIu64 "I64u" #elif defined(__LINUX__) && defined(__LP64__) #define SDL_PRIu64 "lu" @@ -275,7 +281,7 @@ #ifndef SDL_PRIx64 #ifdef PRIx64 #define SDL_PRIx64 PRIx64 -#elif defined(__WIN32__) +#elif defined(__WIN32__) || defined(__GDK__) #define SDL_PRIx64 "I64x" #elif defined(__LINUX__) && defined(__LP64__) #define SDL_PRIx64 "lx" @@ -286,7 +292,7 @@ #ifndef SDL_PRIX64 #ifdef PRIX64 #define SDL_PRIX64 PRIX64 -#elif defined(__WIN32__) +#elif defined(__WIN32__) || defined(__GDK__) #define SDL_PRIX64 "I64X" #elif defined(__LINUX__) && defined(__LP64__) #define SDL_PRIX64 "lX" @@ -367,14 +373,22 @@ #endif #endif /* SDL_DISABLE_ANALYZE_MACROS */ -#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) -#define SDL_COMPILE_TIME_ASSERT(name, x) _Static_assert(x, #x) -#elif defined(__cplusplus) && (__cplusplus >= 201103L) +#ifndef SDL_COMPILE_TIME_ASSERT +#if defined(__cplusplus) +#if (__cplusplus >= 201103L) #define SDL_COMPILE_TIME_ASSERT(name, x) static_assert(x, #x) -#else /* universal, but may trigger -Wunused-local-typedefs */ +#endif +#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) +#define SDL_COMPILE_TIME_ASSERT(name, x) _Static_assert(x, #x) +#endif +#endif /* !SDL_COMPILE_TIME_ASSERT */ + +#ifndef SDL_COMPILE_TIME_ASSERT +/* universal, but may trigger -Wunused-local-typedefs */ #define SDL_COMPILE_TIME_ASSERT(name, x) \ typedef int SDL_compile_time_assert_ ## name[(x) * 2 - 1] #endif + /** \cond */ #ifndef DOXYGEN_SHOULD_IGNORE_THIS SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1); @@ -433,6 +447,16 @@ typedef void (SDLCALL *SDL_free_func)(void *mem); /** + * Get the original set of SDL memory functions + * + * \since This function is available since SDL 2.24.0. + */ +extern DECLSPEC void SDLCALL SDL_GetOriginalMemoryFunctions(SDL_malloc_func *malloc_func, + SDL_calloc_func *calloc_func, + SDL_realloc_func *realloc_func, + SDL_free_func *free_func); + +/** * Get the current set of SDL memory functions * * \since This function is available since SDL 2.0.7. @@ -462,7 +486,8 @@ extern DECLSPEC char *SDLCALL SDL_getenv(const char *name); extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite); -extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *)); +extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, int (SDLCALL *compare) (const void *, const void *)); +extern DECLSPEC void * SDLCALL SDL_bsearch(const void *key, const void *base, size_t nmemb, size_t size, int (SDLCALL *compare) (const void *, const void *)); extern DECLSPEC int SDLCALL SDL_abs(int x); @@ -486,6 +511,7 @@ extern DECLSPEC int SDLCALL SDL_toupper(int x); extern DECLSPEC int SDLCALL SDL_tolower(int x); +extern DECLSPEC Uint16 SDLCALL SDL_crc16(Uint16 crc, const void *data, size_t len); extern DECLSPEC Uint32 SDLCALL SDL_crc32(Uint32 crc, const void *data, size_t len); extern DECLSPEC void *SDLCALL SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len); @@ -494,6 +520,11 @@ #define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x))) #define SDL_zeroa(x) SDL_memset((x), 0, sizeof((x))) +#define SDL_copyp(dst, src) \ + { SDL_COMPILE_TIME_ASSERT(SDL_copyp, sizeof (*(dst)) == sizeof (*(src))); } \ + SDL_memcpy((dst), (src), sizeof (*(src))) + + /* Note that memset() is a byte assignment and this is a 32-bit assignment, so they're not directly equivalent. */ SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords) { @@ -554,6 +585,7 @@ extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle); extern DECLSPEC char *SDLCALL SDL_strtokr(char *s1, const char *s2, char **saveptr); extern DECLSPEC size_t SDLCALL SDL_utf8strlen(const char *str); +extern DECLSPEC size_t SDLCALL SDL_utf8strnlen(const char *str, size_t bytes); extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix); extern DECLSPEC char *SDLCALL SDL_uitoa(unsigned int value, char *str, int radix); @@ -727,6 +759,65 @@ return SDL_memcpy(dst, src, dwords * 4); } +/** + * If a * b would overflow, return -1. Otherwise store a * b via ret + * and return 0. + * + * \since This function is available since SDL 2.24.0. + */ +SDL_FORCE_INLINE int SDL_size_mul_overflow (size_t a, + size_t b, + size_t *ret) +{ + if (a != 0 && b > SDL_SIZE_MAX / a) { + return -1; + } + *ret = a * b; + return 0; +} + +#if _SDL_HAS_BUILTIN(__builtin_mul_overflow) +/* This needs to be wrapped in an inline rather than being a direct #define, + * because __builtin_mul_overflow() is type-generic, but we want to be + * consistent about interpreting a and b as size_t. */ +SDL_FORCE_INLINE int _SDL_size_mul_overflow_builtin (size_t a, + size_t b, + size_t *ret) +{ + return __builtin_mul_overflow(a, b, ret) == 0 ? 0 : -1; +} +#define SDL_size_mul_overflow(a, b, ret) (_SDL_size_mul_overflow_builtin(a, b, ret)) +#endif + +/** + * If a + b would overflow, return -1. Otherwise store a + b via ret + * and return 0. + * + * \since This function is available since SDL 2.24.0. + */ +SDL_FORCE_INLINE int SDL_size_add_overflow (size_t a, + size_t b, + size_t *ret) +{ + if (b > SDL_SIZE_MAX - a) { + return -1; + } + *ret = a + b; + return 0; +} + +#if _SDL_HAS_BUILTIN(__builtin_add_overflow) +/* This needs to be wrapped in an inline rather than being a direct #define, + * the same as the call to __builtin_mul_overflow() above. */ +SDL_FORCE_INLINE int _SDL_size_add_overflow_builtin (size_t a, + size_t b, + size_t *ret) +{ + return __builtin_add_overflow(a, b, ret) == 0 ? 0 : -1; +} +#define SDL_size_add_overflow(a, b, ret) (_SDL_size_add_overflow_builtin(a, b, ret)) +#endif + /* Ends C function definitions when using C++ */ #ifdef __cplusplus } diff -Nru libsdl2-2.0.22+dfsg/include/SDL_surface.h libsdl2-2.24.0+dfsg/include/SDL_surface.h --- libsdl2-2.0.22+dfsg/include/SDL_surface.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_surface.h 2022-08-13 03:48:10.000000000 +0000 @@ -61,6 +61,8 @@ */ #define SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0) +typedef struct SDL_BlitMap SDL_BlitMap; /* this is an opaque type. */ + /** * \brief A collection of pixels used in software blitting. * @@ -88,7 +90,7 @@ SDL_Rect clip_rect; /**< Read-only */ /** info for fast blit mapping to other surfaces */ - struct SDL_BlitMap *map; /**< Private */ + SDL_BlitMap *map; /**< Private */ /** Reference count -- used when freeing surface */ int refcount; /**< Read-mostly */ diff -Nru libsdl2-2.0.22+dfsg/include/SDL_system.h libsdl2-2.24.0+dfsg/include/SDL_system.h --- libsdl2-2.0.22+dfsg/include/SDL_system.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_system.h 2022-08-13 03:48:10.000000000 +0000 @@ -41,7 +41,7 @@ /* Platform specific functions for Windows */ -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__GDK__) typedef void (SDLCALL * SDL_WindowsMessageHook)(void *userdata, void *hWnd, unsigned int message, Uint64 wParam, Sint64 lParam); @@ -55,6 +55,10 @@ */ extern DECLSPEC void SDLCALL SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata); +#endif /* defined(__WIN32__) || defined(__GDK__) */ + +#if defined(__WIN32__) || defined(__WINGDK__) + /** * Get the D3D9 adapter index that matches the specified display index. * @@ -102,6 +106,30 @@ */ extern DECLSPEC ID3D11Device* SDLCALL SDL_RenderGetD3D11Device(SDL_Renderer * renderer); +#endif /* defined(__WIN32__) || defined(__WINGDK__) */ + +#if defined(__WIN32__) || defined(__GDK__) + +typedef struct ID3D12Device ID3D12Device; + +/** + * Get the D3D12 device associated with a renderer. + * + * Once you are done using the device, you should release it to avoid a + * resource leak. + * + * \param renderer the renderer from which to get the associated D3D12 device + * \returns the D3D12 device associated with given renderer or NULL if it is + * not a D3D12 renderer; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.24.0. + */ +extern DECLSPEC ID3D12Device* SDLCALL SDL_RenderGetD3D12Device(SDL_Renderer* renderer); + +#endif /* defined(__WIN32__) || defined(__GDK__) */ + +#if defined(__WIN32__) || defined(__WINGDK__) + /** * Get the DXGI Adapter and Output indices for the specified display index. * @@ -122,8 +150,7 @@ */ extern DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo( int displayIndex, int *adapterIndex, int *outputIndex ); -#endif /* __WIN32__ */ - +#endif /* defined(__WIN32__) || defined(__WINGDK__) */ /* Platform specific functions for Linux */ #ifdef __LINUX__ @@ -178,7 +205,7 @@ * This function is only available on Apple iOS. * * For more information see: - * [README-ios.md](https://hg.libsdl.org/SDL/file/default/docs/README-ios.md) + * https://github.com/libsdl-org/SDL/blob/main/docs/README-ios.md * * This functions is also accessible using the macro * SDL_iOSSetAnimationCallback() since SDL 2.0.4. @@ -195,7 +222,7 @@ * * \sa SDL_iPhoneSetEventPump */ -extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam); +extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (SDLCALL *callback)(void*), void *callbackParam); #define SDL_iOSSetEventPump(enabled) SDL_iPhoneSetEventPump(enabled) @@ -532,7 +559,7 @@ extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType); /** - * Detects the device family of WinRT plattform at runtime. + * Detects the device family of WinRT platform at runtime. * * \returns a value from the SDL_WinRT_DeviceFamily enum. * @@ -564,6 +591,27 @@ extern DECLSPEC void SDLCALL SDL_OnApplicationDidChangeStatusBarOrientation(void); #endif +/* Functions used only by GDK */ +#if defined(__GDK__) +typedef struct XTaskQueueObject * XTaskQueueHandle; + +/** + * Gets a reference to the global async task queue handle for GDK, + * initializing if needed. + * + * Once you are done with the task queue, you should call + * XTaskQueueCloseHandle to reduce the reference count to avoid a resource + * leak. + * + * \param outTaskQueue a pointer to be filled in with task queue handle. + * \returns 0 if success, -1 if any error occurs. + * + * \since This function is available since SDL 2.24.0. + */ +extern DECLSPEC int SDLCALL SDL_GDKGetTaskQueue(XTaskQueueHandle * outTaskQueue); + +#endif + /* Ends C function definitions when using C++ */ #ifdef __cplusplus } diff -Nru libsdl2-2.0.22+dfsg/include/SDL_test_common.h libsdl2-2.24.0+dfsg/include/SDL_test_common.h --- libsdl2-2.0.22+dfsg/include/SDL_test_common.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_test_common.h 2022-08-13 03:48:10.000000000 +0000 @@ -50,6 +50,7 @@ #define VERBOSE_RENDER 0x00000004 #define VERBOSE_EVENT 0x00000008 #define VERBOSE_AUDIO 0x00000010 +#define VERBOSE_MOTION 0x00000020 typedef struct { diff -Nru libsdl2-2.0.22+dfsg/include/SDL_test_font.h libsdl2-2.24.0+dfsg/include/SDL_test_font.h --- libsdl2-2.0.22+dfsg/include/SDL_test_font.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_test_font.h 2022-08-13 03:48:10.000000000 +0000 @@ -38,7 +38,8 @@ /* Function prototypes */ -#define FONT_CHARACTER_SIZE 8 +#define FONT_CHARACTER_SIZE 8 +#define FONT_LINE_HEIGHT (FONT_CHARACTER_SIZE + 2) /** * \brief Draw a string in the currently set font. @@ -50,10 +51,12 @@ * * \returns 0 on success, -1 on failure. */ -int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c); +int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, Uint32 c); /** - * \brief Draw a string in the currently set font. + * \brief Draw a UTF-8 string in the currently set font. + * + * The font currently only supports characters in the Basic Latin and Latin-1 Supplement sets. * * \param renderer The renderer to draw on. * \param x The X coordinate of the upper left corner of the string. @@ -64,6 +67,90 @@ */ int SDLTest_DrawString(SDL_Renderer *renderer, int x, int y, const char *s); +/** + * \brief Data used for multi-line text output + */ +typedef struct SDLTest_TextWindow +{ + SDL_Rect rect; + int current; + int numlines; + char **lines; +} SDLTest_TextWindow; + +/** + * \brief Create a multi-line text output window + * + * \param x The X coordinate of the upper left corner of the window. + * \param y The Y coordinate of the upper left corner of the window. + * \param w The width of the window (currently ignored) + * \param h The height of the window (currently ignored) + * + * \returns the new window, or NULL on failure. + * + * \since This function is available since SDL 2.24.0 + */ +SDLTest_TextWindow *SDLTest_TextWindowCreate(int x, int y, int w, int h); + +/** + * \brief Display a multi-line text output window + * + * This function should be called every frame to display the text + * + * \param textwin The text output window + * \param renderer The renderer to use for display + * + * \since This function is available since SDL 2.24.0 + */ +void SDLTest_TextWindowDisplay(SDLTest_TextWindow *textwin, SDL_Renderer *renderer); + +/** + * \brief Add text to a multi-line text output window + * + * Adds UTF-8 text to the end of the current text. The newline character starts a + * new line of text. The backspace character deletes the last character or, if the + * line is empty, deletes the line and goes to the end of the previous line. + * + * \param textwin The text output window + * \param fmt A printf() style format string + * \param ... additional parameters matching % tokens in the `fmt` string, if any + * + * \since This function is available since SDL 2.24.0 + */ +void SDLTest_TextWindowAddText(SDLTest_TextWindow *textwin, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); + +/** + * \brief Add text to a multi-line text output window + * + * Adds UTF-8 text to the end of the current text. The newline character starts a + * new line of text. The backspace character deletes the last character or, if the + * line is empty, deletes the line and goes to the end of the previous line. + * + * \param textwin The text output window + * \param text The text to add to the window + * \param len The length, in bytes, of the text to add to the window + * + * \since This function is available since SDL 2.24.0 + */ +void SDLTest_TextWindowAddTextWithLength(SDLTest_TextWindow *textwin, const char *text, size_t len); + +/** + * \brief Clear the text in a multi-line text output window + * + * \param textwin The text output window + * + * \since This function is available since SDL 2.24.0 + */ +void SDLTest_TextWindowClear(SDLTest_TextWindow *textwin); + +/** + * \brief Free the storage associated with a multi-line text output window + * + * \param textwin The text output window + * + * \since This function is available since SDL 2.24.0 + */ +void SDLTest_TextWindowDestroy(SDLTest_TextWindow *textwin); /** * \brief Cleanup textures used by font drawing functions. diff -Nru libsdl2-2.0.22+dfsg/include/SDL_thread.h libsdl2-2.24.0+dfsg/include/SDL_thread.h --- libsdl2-2.0.22+dfsg/include/SDL_thread.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_thread.h 2022-08-13 03:48:10.000000000 +0000 @@ -35,7 +35,7 @@ #include "SDL_atomic.h" #include "SDL_mutex.h" -#if defined(__WIN32__) +#if defined(__WIN32__) || defined(__GDK__) #include /* _beginthreadex() and _endthreadex() */ #endif #if defined(__OS2__) /* for _beginthread() and _endthread() */ @@ -88,7 +88,7 @@ typedef int (SDLCALL * SDL_ThreadFunction) (void *data); -#if defined(__WIN32__) +#if defined(__WIN32__) || defined(__GDK__) /** * \file SDL_thread.h * @@ -129,7 +129,7 @@ pfnSDL_CurrentEndThread pfnEndThread); extern DECLSPEC SDL_Thread *SDLCALL -SDL_CreateThreadWithStackSize(int (SDLCALL * fn) (void *), +SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread); diff -Nru libsdl2-2.0.22+dfsg/include/SDL_version.h libsdl2-2.24.0+dfsg/include/SDL_version.h --- libsdl2-2.0.22+dfsg/include/SDL_version.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_version.h 2022-08-19 15:46:21.000000000 +0000 @@ -58,8 +58,8 @@ /* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL */ #define SDL_MAJOR_VERSION 2 -#define SDL_MINOR_VERSION 0 -#define SDL_PATCHLEVEL 22 +#define SDL_MINOR_VERSION 24 +#define SDL_PATCHLEVEL 0 /** * Macro to determine SDL version program was compiled against. @@ -83,6 +83,8 @@ (x)->patch = SDL_PATCHLEVEL; \ } +/* TODO: Remove this whole block in SDL 3 */ +#if SDL_MAJOR_VERSION < 3 /** * This macro turns the version numbers into a numeric value: * \verbatim @@ -90,21 +92,35 @@ \endverbatim * * This assumes that there will never be more than 100 patchlevels. + * + * In versions higher than 2.9.0, the minor version overflows into + * the thousands digit: for example, 2.23.0 is encoded as 4300, + * and 2.255.99 would be encoded as 25799. + * This macro will not be available in SDL 3.x. */ #define SDL_VERSIONNUM(X, Y, Z) \ ((X)*1000 + (Y)*100 + (Z)) /** * This is the version number macro for the current SDL version. + * + * In versions higher than 2.9.0, the minor version overflows into + * the thousands digit: for example, 2.23.0 is encoded as 4300. + * This macro will not be available in SDL 3.x. + * + * Deprecated, use SDL_VERSION_ATLEAST or SDL_VERSION instead. */ #define SDL_COMPILEDVERSION \ SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) +#endif /* SDL_MAJOR_VERSION < 3 */ /** * This macro will evaluate to true if compiled with SDL at least X.Y.Z. */ #define SDL_VERSION_ATLEAST(X, Y, Z) \ - (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) + ((SDL_MAJOR_VERSION >= X) && \ + (SDL_MAJOR_VERSION > X || SDL_MINOR_VERSION >= Y) && \ + (SDL_MAJOR_VERSION > X || SDL_MINOR_VERSION > Y || SDL_PATCHLEVEL >= Z)) /** * Get the version of SDL that is linked against your program. diff -Nru libsdl2-2.0.22+dfsg/include/SDL_video.h libsdl2-2.24.0+dfsg/include/SDL_video.h --- libsdl2-2.0.22+dfsg/include/SDL_video.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/include/SDL_video.h 2022-08-13 03:48:10.000000000 +0000 @@ -248,7 +248,8 @@ SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, SDL_GL_CONTEXT_RELEASE_BEHAVIOR, SDL_GL_CONTEXT_RESET_NOTIFICATION, - SDL_GL_CONTEXT_NO_ERROR + SDL_GL_CONTEXT_NO_ERROR, + SDL_GL_FLOATBUFFERS } SDL_GLattr; typedef enum @@ -444,6 +445,15 @@ * A failure of this function usually means that either no DPI information is * available or the `displayIndex` is out of range. * + * **WARNING**: This reports the DPI that the hardware reports, and it is not + * always reliable! It is almost always better to use SDL_GetWindowSize() to + * find the window size, which might be in logical points instead of pixels, + * and then SDL_GL_GetDrawableSize(), SDL_Vulkan_GetDrawableSize(), + * SDL_Metal_GetDrawableSize(), or SDL_GetRendererOutputSize(), and compare + * the two values to get an actual scaling value between the two. We will be + * rethinking how high-dpi details should be managed in SDL3 to make things + * more consistent, reliable, and clear. + * * \param displayIndex the index of the display from which DPI information * should be queried * \param ddpi a pointer filled in with the diagonal DPI of the display; may @@ -588,6 +598,35 @@ extern DECLSPEC SDL_DisplayMode * SDLCALL SDL_GetClosestDisplayMode(int displayIndex, const SDL_DisplayMode * mode, SDL_DisplayMode * closest); /** + * Get the index of the display containing a point + * + * \param point the point to query + * \returns the index of the display containing the point or a negative error + * code on failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.24.0. + * + * \sa SDL_GetDisplayBounds + * \sa SDL_GetNumVideoDisplays + */ +extern DECLSPEC int SDLCALL SDL_GetPointDisplayIndex(const SDL_Point * point); + +/** + * Get the index of the display primarily containing a rect + * + * \param rect the rect to query + * \returns the index of the display entirely containing the rect or closest + * to the center of the rect on success or a negative error code on + * failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.24.0. + * + * \sa SDL_GetDisplayBounds + * \sa SDL_GetNumVideoDisplays + */ +extern DECLSPEC int SDLCALL SDL_GetRectDisplayIndex(const SDL_Rect * rect); + +/** * Get the index of the display associated with a window. * * \param window the window to query @@ -697,7 +736,10 @@ * in pixels may differ from its size in screen coordinates on platforms with * high-DPI support (e.g. iOS and macOS). Use SDL_GetWindowSize() to query the * client area's size in screen coordinates, and SDL_GL_GetDrawableSize() or - * SDL_GetRendererOutputSize() to query the drawable size in pixels. + * SDL_GetRendererOutputSize() to query the drawable size in pixels. Note that + * when this flag is set, the drawable size can vary after the window is + * created and should be queried after major window events such as when the + * window is resized or moved between displays. * * If the window is set fullscreen, the width and height parameters `w` and * `h` will not be used. However, invalid size parameters (e.g. too large) may @@ -2009,13 +2051,8 @@ * retry the call with 1 for the interval. * * Adaptive vsync is implemented for some glX drivers with - * GLX_EXT_swap_control_tear: - * - * https://www.opengl.org/registry/specs/EXT/glx_swap_control_tear.txt - * - * and for some Windows drivers with WGL_EXT_swap_control_tear: - * - * https://www.opengl.org/registry/specs/EXT/wgl_swap_control_tear.txt + * GLX_EXT_swap_control_tear, and for some Windows drivers with + * WGL_EXT_swap_control_tear. * * Read more on the Khronos wiki: * https://www.khronos.org/opengl/wiki/Swap_Interval#Adaptive_Vsync diff -Nru libsdl2-2.0.22+dfsg/Makefile.in libsdl2-2.24.0+dfsg/Makefile.in --- libsdl2-2.0.22+dfsg/Makefile.in 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/Makefile.in 2022-08-13 03:48:10.000000000 +0000 @@ -50,7 +50,7 @@ INSTALL_SDL2_CONFIG = @INSTALL_SDL2_CONFIG@ -SRC_DIST = *.md *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake cmake_uninstall.cmake.in configure configure.ac docs include Makefile.* sdl2-config.cmake.in sdl2-config-version.cmake.in sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in SDL2Config.cmake src test VisualC VisualC-WinRT Xcode Xcode-iOS wayland-protocols +SRC_DIST = *.md *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake cmake_uninstall.cmake.in configure configure.ac docs include Makefile.* mingw sdl2-config.cmake.in sdl2-config-version.cmake.in sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in SDL2Config.cmake.in src test VisualC VisualC-WinRT Xcode Xcode-iOS wayland-protocols GEN_DIST = SDL2.spec ifneq ($V,1) @@ -80,6 +80,7 @@ SDL_filesystem.h \ SDL_gamecontroller.h \ SDL_gesture.h \ + SDL_guid.h \ SDL_haptic.h \ SDL_hidapi.h \ SDL_hints.h \ diff -Nru libsdl2-2.0.22+dfsg/Makefile.os2 libsdl2-2.24.0+dfsg/Makefile.os2 --- libsdl2-2.0.22+dfsg/Makefile.os2 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/Makefile.os2 2022-08-19 15:46:21.000000000 +0000 @@ -11,7 +11,10 @@ # wmake -f Makefile.os2 HIDAPI=1 LIBNAME = SDL2 -VERSION = 2.0.22 +MAJOR_VERSION = 2 +MINOR_VERSION = 24 +MICRO_VERSION = 0 +VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION) DESCRIPTION = Simple DirectMedia Layer 2 LIBICONV=0 @@ -60,15 +63,19 @@ # building SDL itself (for DECLSPEC): CFLAGS_DLL+= -DBUILD_SDL -SRCS = SDL.c SDL_assert.c SDL_error.c SDL_log.c SDL_dataqueue.c SDL_hints.c SDL_list.c -SRCS+= SDL_getenv.c SDL_iconv.c SDL_malloc.c SDL_qsort.c SDL_stdlib.c SDL_string.c SDL_strtokr.c SDL_crc32.c +CFLAGS_DLL+= -DSDL_BUILD_MAJOR_VERSION=$(MAJOR_VERSION) +CFLAGS_DLL+= -DSDL_BUILD_MINOR_VERSION=$(MINOR_VERSION) +CFLAGS_DLL+= -DSDL_BUILD_MICRO_VERSION=$(MICRO_VERSION) + +SRCS = SDL.c SDL_assert.c SDL_error.c SDL_guid.c SDL_log.c SDL_dataqueue.c SDL_hints.c SDL_list.c SDL_utils.c +SRCS+= SDL_getenv.c SDL_iconv.c SDL_malloc.c SDL_qsort.c SDL_stdlib.c SDL_string.c SDL_strtokr.c SDL_crc16.c SDL_crc32.c SRCS+= SDL_cpuinfo.c SDL_atomic.c SDL_spinlock.c SDL_thread.c SDL_timer.c SRCS+= SDL_rwops.c SDL_power.c SRCS+= SDL_audio.c SDL_audiocvt.c SDL_audiodev.c SDL_audiotypecvt.c SDL_mixer.c SDL_wave.c SRCS+= SDL_events.c SDL_quit.c SDL_keyboard.c SDL_mouse.c SDL_windowevents.c & SDL_clipboardevents.c SDL_dropevents.c SDL_displayevents.c SDL_gesture.c & SDL_sensor.c SDL_touch.c -SRCS+= SDL_haptic.c SDL_hidapi.c SDL_gamecontroller.c SDL_joystick.c +SRCS+= SDL_haptic.c SDL_hidapi.c SDL_gamecontroller.c SDL_joystick.c controller_type.c SRCS+= SDL_render.c yuv_rgb.c SDL_yuv.c SDL_yuv_sw.c SDL_blendfillrect.c & SDL_blendline.c SDL_blendpoint.c SDL_drawline.c SDL_drawpoint.c & SDL_render_sw.c SDL_rotate.c SDL_triangle.c @@ -82,7 +89,7 @@ SRCS+= SDL_sysloadso.c SRCS+= SDL_sysfilesystem.c SRCS+= SDL_os2joystick.c SDL_syshaptic.c SDL_sysjoystick.c SDL_virtualjoystick.c -SRCS+= SDL_hidapijoystick.c SDL_hidapi_rumble.c SDL_hidapi_gamecube.c SDL_hidapi_luna.c SDL_hidapi_ps4.c SDL_hidapi_ps5.c SDL_hidapi_stadia.c SDL_hidapi_switch.c SDL_hidapi_xbox360.c SDL_hidapi_xbox360w.c SDL_hidapi_xboxone.c SDL_hidapi_steam.c +SRCS+= SDL_hidapijoystick.c SDL_hidapi_rumble.c SDL_hidapi_combined.c SDL_hidapi_gamecube.c SDL_hidapi_luna.c SDL_hidapi_ps4.c SDL_hidapi_ps5.c SDL_hidapi_shield.c SDL_hidapi_stadia.c SDL_hidapi_switch.c SDL_hidapi_xbox360.c SDL_hidapi_xbox360w.c SDL_hidapi_xboxone.c SDL_hidapi_steam.c SRCS+= SDL_dummyaudio.c SDL_diskaudio.c SRCS+= SDL_nullvideo.c SDL_nullframebuffer.c SDL_nullevents.c SRCS+= SDL_dummysensor.c diff -Nru libsdl2-2.0.22+dfsg/Makefile.w32 libsdl2-2.24.0+dfsg/Makefile.w32 --- libsdl2-2.0.22+dfsg/Makefile.w32 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/Makefile.w32 2022-08-19 15:46:21.000000000 +0000 @@ -0,0 +1,273 @@ +# Open Watcom makefile to build SDL2.dll for Win32 +# wmake -f Makefile.w32 + +LIBNAME = SDL2 +MAJOR_VERSION = 2 +MINOR_VERSION = 24 +MICRO_VERSION = 0 +VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION) +DESCRIPTION = Simple DirectMedia Layer 2 + +LIBHOME = . +DLLFILE = $(LIBHOME)/$(LIBNAME).dll +LIBFILE = $(LIBHOME)/$(LIBNAME).lib +EXPFILE = $(LIBHOME)/$(LIBNAME).exp +LNKFILE = $(LIBNAME).lnk + +INCPATH = -I"$(%WATCOM)/h/nt" -I"$(%WATCOM)/h/nt/directx" -I"$(%WATCOM)/h" +INCPATH+= -Iinclude +INCPATH+= -I"src/video/khronos" + +LIBM = SDL2libm.lib +TLIB = SDL2test.lib +LIBS = user32.lib gdi32.lib winmm.lib imm32.lib ole32.lib oleaut32.lib shell32.lib setupapi.lib version.lib uuid.lib dxguid.lib $(LIBM) + +CFLAGS = -bt=nt -d0 -q -bm -5s -fp5 -fpi87 -sg -oeatxhn -ei +# max warnings: +CFLAGS+= -wx +# newer OpenWatcom versions enable W303 by default +CFLAGS+= -wcd=303 +# the include paths : +CFLAGS+= $(INCPATH) +CFLAGS_STATIC=$(CFLAGS) +# building dll: +CFLAGS_DLL =$(CFLAGS) +CFLAGS_DLL+= -bd +# we override the DECLSPEC define in begin_code.h, because we are using +# an exports file to remove the _cdecl '_' prefix from the symbol names +CFLAGS_DLL+= -DDECLSPEC= + +CFLAGS_DLL+= -DSDL_BUILD_MAJOR_VERSION=$(MAJOR_VERSION) +CFLAGS_DLL+= -DSDL_BUILD_MINOR_VERSION=$(MINOR_VERSION) +CFLAGS_DLL+= -DSDL_BUILD_MICRO_VERSION=$(MICRO_VERSION) + +RCFLAGS = -q -r -bt=nt $(INCPATH) + +SRCS = SDL.c SDL_assert.c SDL_error.c SDL_guid.c SDL_log.c SDL_dataqueue.c SDL_hints.c SDL_list.c SDL_utils.c +SRCS+= SDL_getenv.c SDL_iconv.c SDL_malloc.c SDL_qsort.c SDL_stdlib.c SDL_string.c SDL_strtokr.c SDL_crc16.c SDL_crc32.c +SRCS+= SDL_cpuinfo.c SDL_atomic.c SDL_spinlock.c SDL_thread.c SDL_timer.c +SRCS+= SDL_rwops.c SDL_power.c +SRCS+= SDL_audio.c SDL_audiocvt.c SDL_audiodev.c SDL_audiotypecvt.c SDL_mixer.c SDL_wave.c +SRCS+= SDL_events.c SDL_quit.c SDL_keyboard.c SDL_mouse.c SDL_windowevents.c & + SDL_clipboardevents.c SDL_dropevents.c SDL_displayevents.c SDL_gesture.c & + SDL_sensor.c SDL_touch.c +SRCS+= SDL_haptic.c SDL_hidapi.c SDL_gamecontroller.c SDL_joystick.c controller_type.c +SRCS+= SDL_render.c yuv_rgb.c SDL_yuv.c SDL_yuv_sw.c SDL_blendfillrect.c & + SDL_blendline.c SDL_blendpoint.c SDL_drawline.c SDL_drawpoint.c & + SDL_render_sw.c SDL_rotate.c SDL_triangle.c +SRCS+= SDL_blit.c SDL_blit_0.c SDL_blit_1.c SDL_blit_A.c SDL_blit_auto.c & + SDL_blit_copy.c SDL_blit_N.c SDL_blit_slow.c SDL_fillrect.c SDL_bmp.c & + SDL_pixels.c SDL_rect.c SDL_RLEaccel.c SDL_shape.c SDL_stretch.c & + SDL_surface.c SDL_video.c SDL_clipboard.c SDL_vulkan_utils.c SDL_egl.c + +SRCS+= SDL_syscond.c SDL_sysmutex.c SDL_syssem.c SDL_systhread.c SDL_systls.c +SRCS+= SDL_systimer.c +SRCS+= SDL_sysloadso.c +SRCS+= SDL_sysfilesystem.c +SRCS+= SDL_syshaptic.c SDL_sysjoystick.c SDL_virtualjoystick.c +SRCS+= SDL_hidapijoystick.c SDL_hidapi_rumble.c SDL_hidapi_combined.c SDL_hidapi_gamecube.c SDL_hidapi_luna.c SDL_hidapi_ps4.c SDL_hidapi_ps5.c SDL_hidapi_shield.c SDL_hidapi_stadia.c SDL_hidapi_switch.c SDL_hidapi_xbox360.c SDL_hidapi_xbox360w.c SDL_hidapi_xboxone.c SDL_hidapi_steam.c +SRCS+= SDL_dummyaudio.c SDL_diskaudio.c +SRCS+= SDL_nullvideo.c SDL_nullframebuffer.c SDL_nullevents.c +SRCS+= SDL_dummysensor.c +SRCS+= SDL_locale.c SDL_syslocale.c +SRCS+= SDL_url.c SDL_sysurl.c + +SRCS+= SDL_winmm.c SDL_directsound.c SDL_wasapi.c SDL_wasapi_win32.c +SRCS+= SDL_hid.c SDL_immdevice.c SDL_windows.c SDL_xinput.c +SRCS+= SDL_dinputhaptic.c SDL_windowshaptic.c SDL_xinputhaptic.c +SRCS+= SDL_dinputjoystick.c SDL_rawinputjoystick.c SDL_windowsjoystick.c SDL_windows_gaming_input.c SDL_xinputjoystick.c +SRCS+= SDL_syspower.c +SRCS+= SDL_d3dmath.c +SRCS+= SDL_render_d3d.c SDL_shaders_d3d.c +SRCS+= SDL_render_d3d11.c SDL_shaders_d3d11.c +SRCS+= SDL_render_d3d12.c SDL_shaders_d3d12.c +SRCS+= SDL_render_gl.c SDL_shaders_gl.c +SRCS+= SDL_render_gles2.c SDL_shaders_gles2.c +SRCS+= SDL_windowssensor.c +SRCS+= SDL_syscond_cv.c +SRCS+= SDL_windowsclipboard.c SDL_windowsevents.c SDL_windowsframebuffer.c SDL_windowskeyboard.c SDL_windowsmessagebox.c SDL_windowsmodes.c SDL_windowsmouse.c SDL_windowsopengl.c SDL_windowsopengles.c SDL_windowsshape.c SDL_windowsvideo.c SDL_windowsvulkan.c SDL_windowswindow.c + +SRCS+= SDL_dynapi.c + +RCSRCS = version.rc + +OBJS = $(SRCS:.c=.obj) +RCOBJS= $(RCSRCS:.rc=.res) + +.extensions: +.extensions: .lib .dll .obj .res .c .rc .asm + +.c: ./src;./src/dynapi;./src/audio;./src/cpuinfo;./src/events;./src/file;./src/haptic;./src/joystick;./src/power;./src/render;./src/render/software;./src/sensor;./src/stdlib;./src/thread;./src/timer;./src/video;./src/video/yuv2rgb;./src/atomic;./src/audio/disk; +.c: ./src/haptic/dummy;./src/joystick/dummy;./src/joystick/virtual;./src/audio/dummy;./src/video/dummy;./src/sensor/dummy; +.c: ./src/core/windows;./src/audio/winmm;./src/audio/directsound;./src/audio/wasapi;./src/loadso/windows;./src/filesystem/windows;./src/haptic/windows;./src/joystick/windows;./src/sensor/windows;./src/thread/windows;./src/timer/windows;./src/video/windows; +.c: ./src/locale/;./src/locale/windows;./src/misc;./src/misc/windows;./src/power/windows;./src/joystick/hidapi;./src/hidapi;./src/render/direct3d;./src/render/direct3d11;./src/render/direct3d12;./src/render/opengl;./src/render/opengles2 +.rc: ./src/main/windows + +all: $(DLLFILE) $(LIBFILE) $(TLIB) .symbolic + +build_dll: .symbolic + @echo * Compiling dll objects + +$(DLLFILE): build_dll $(OBJS) $(LIBM) $(RCOBJS) $(LNKFILE) + @echo * Linking: $@ + wlink @$(LNKFILE) + +$(LIBFILE): $(DLLFILE) + @echo * Creating LIB file: $@ + wlib -q -b -n -c -pa -s -t -zld -ii -io $* @$(EXPFILE) + +.c.obj: + wcc386 $(CFLAGS_DLL) -fo=$^@ $< + +.rc.res: + wrc $(RCFLAGS) -fo=$^@ $< + +SDL_syscond.obj: "src/thread/generic/SDL_syscond.c" + wcc386 $(CFLAGS_DLL) -fo=$^@ $< +SDL_cpuinfo.obj: SDL_cpuinfo.c + wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< +SDL_wave.obj: SDL_wave.c + wcc386 $(CFLAGS_DLL) -wcd=124 -fo=$^@ $< +SDL_blendfillrect.obj: SDL_blendfillrect.c + wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< +SDL_blendline.obj: SDL_blendline.c + wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< +SDL_blendpoint.obj: SDL_blendpoint.c + wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< +SDL_RLEaccel.obj: SDL_RLEaccel.c + wcc386 $(CFLAGS_DLL) -wcd=201 -fo=$^@ $< +SDL_malloc.obj: SDL_malloc.c + wcc386 $(CFLAGS_DLL) -wcd=201 -fo=$^@ $< + +# SDL2libm +MSRCS= e_atan2.c e_exp.c e_fmod.c e_log10.c e_log.c e_pow.c e_rem_pio2.c e_sqrt.c & + k_cos.c k_rem_pio2.c k_sin.c k_tan.c & + s_atan.c s_copysign.c s_cos.c s_fabs.c s_floor.c s_scalbn.c s_sin.c s_tan.c +MOBJS= $(MSRCS:.c=.obj) + +.c: ./src/libm; +e_atan2.obj: e_atan2.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< +e_exp.obj: e_exp.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< +e_fmod.obj: e_fmod.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< +e_log10.obj: e_log10.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< +e_log.obj: e_log.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< +e_pow.obj: e_pow.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< +e_rem_pio2.obj: e_rem_pio2.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< +e_sqrt.obj: e_sqrt.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< +k_cos.obj: k_cos.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< +k_rem_pio2.obj: k_rem_pio2.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< +k_sin.obj: k_sin.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< +k_tan.obj: k_tan.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< +s_atan.obj: s_atan.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< +s_copysign.obj: s_copysign.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< +s_cos.obj: s_cos.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< +s_fabs.obj: s_fabs.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< +s_floor.obj: s_floor.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< +s_scalbn.obj: s_scalbn.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< +s_sin.obj: s_sin.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< +s_tan.obj: s_tan.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< + +build_libm: .symbolic + @echo * Compiling libm objects +$(LIBM): build_libm $(MOBJS) + @echo * Creating: $@ + wlib -q -b -n -c -pa -s -t -zld -ii -io $@ $(MOBJS) + +# SDL2test +TSRCS = SDL_test_assert.c SDL_test_common.c SDL_test_compare.c & + SDL_test_crc32.c SDL_test_font.c SDL_test_fuzzer.c SDL_test_harness.c & + SDL_test_imageBlit.c SDL_test_imageBlitBlend.c SDL_test_imageFace.c & + SDL_test_imagePrimitives.c SDL_test_imagePrimitivesBlend.c & + SDL_test_log.c SDL_test_md5.c SDL_test_random.c SDL_test_memory.c +TOBJS= $(TSRCS:.c=.obj) + +.c: ./src/test; +SDL_test_assert.obj: SDL_test_assert.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< +SDL_test_common.obj: SDL_test_common.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< +SDL_test_compare.obj: SDL_test_compare.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< +SDL_test_crc32.obj: SDL_test_crc32.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< +SDL_test_font.obj: SDL_test_font.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< +SDL_test_fuzzer.obj: SDL_test_fuzzer.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< +SDL_test_harness.obj: SDL_test_harness.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< +SDL_test_imageBlit.obj: SDL_test_imageBlit.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< +SDL_test_imageBlitBlend.obj: SDL_test_imageBlitBlend.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< +SDL_test_imageFace.obj: SDL_test_imageFace.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< +SDL_test_imagePrimitives.obj: SDL_test_imagePrimitives.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< +SDL_test_imagePrimitivesBlend.obj: SDL_test_imagePrimitivesBlend.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< +SDL_test_log.obj: SDL_test_log.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< +SDL_test_md5.obj: SDL_test_md5.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< +SDL_test_random.obj: SDL_test_random.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< +SDL_test_memory.obj: SDL_test_memory.c + wcc386 $(CFLAGS_STATIC) -fo=$^@ $< + +build_tlib: .symbolic + @echo * Compiling testlib objects +$(TLIB): build_tlib $(TOBJS) + @echo * Creating: $@ + wlib -q -b -n -c -pa -s -t -zld -ii -io $@ $(TOBJS) + +$(LNKFILE): Makefile.w32 + @echo * Creating linker file: $@ + @%create $@ + @%append $@ SYSTEM nt_dll INITINSTANCE TERMINSTANCE + @%append $@ NAME $(DLLFILE) + @for %i in ($(OBJS)) do @%append $@ FILE %i + @for %i in ($(LIBS)) do @%append $@ LIB %i + @%append $@ OPTION RESOURCE=$(RCOBJS) + @%append $@ EXPORT=src/dynapi/SDL2.exports + @%append $@ OPTION QUIET + @%append $@ OPTION IMPF=$(EXPFILE) + @%append $@ OPTION MAP=$(LIBHOME)/$^&.map + @%append $@ OPTION DESCRIPTION '@$#libsdl org:$(VERSION)$#@$(DESCRIPTION)' + @%append $@ OPTION ELIMINATE + @%append $@ OPTION SHOWDEAD + +clean: .SYMBOLIC + @echo * Clean: $(LIBNAME) + @if exist *.obj rm *.obj + @if exist *.res rm *.res + @if exist *.err rm *.err + @if exist $(LNKFILE) rm $(LNKFILE) + @if exist $(LIBM) rm $(LIBM) + +distclean: .SYMBOLIC clean + @if exist $(LIBHOME)/*.exp rm $(LIBHOME)/*.exp + @if exist $(LIBHOME)/*.map rm $(LIBHOME)/*.map + @if exist $(LIBFILE) rm $(LIBFILE) + @if exist $(DLLFILE) rm $(DLLFILE) + @if exist $(TLIB) rm $(TLIB) diff -Nru libsdl2-2.0.22+dfsg/mingw/pkg-support/cmake/sdl2-config.cmake libsdl2-2.24.0+dfsg/mingw/pkg-support/cmake/sdl2-config.cmake --- libsdl2-2.0.22+dfsg/mingw/pkg-support/cmake/sdl2-config.cmake 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/mingw/pkg-support/cmake/sdl2-config.cmake 2022-06-16 20:16:31.000000000 +0000 @@ -0,0 +1,19 @@ +# SDL2 CMake configuration file: +# This file is meant to be placed in a cmake subfolder of SDL2-devel-2.x.y-mingw + +if(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(sdl2_config_path "${CMAKE_CURRENT_LIST_DIR}/../i686-w64-mingw32/lib/cmake/SDL2/sdl2-config.cmake") +elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(sdl2_config_path "${CMAKE_CURRENT_LIST_DIR}/../x86_64-w64-mingw32/lib/cmake/SDL2/sdl2-config.cmake") +else("${CMAKE_SIZEOF_VOID_P}" STREQUAL "") + set(SDL2_FOUND FALSE) + return() +endif() + +if(NOT EXISTS "${sdl2_config_path}") + message(WARNING "${sdl2_config_path} does not exist: MinGW development package is corrupted") + set(SDL2_FOUND FALSE) + return() +endif() + +include("${sdl2_config_path}") diff -Nru libsdl2-2.0.22+dfsg/mingw/pkg-support/cmake/sdl2-config-version.cmake libsdl2-2.24.0+dfsg/mingw/pkg-support/cmake/sdl2-config-version.cmake --- libsdl2-2.0.22+dfsg/mingw/pkg-support/cmake/sdl2-config-version.cmake 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/mingw/pkg-support/cmake/sdl2-config-version.cmake 2022-06-03 19:42:12.000000000 +0000 @@ -0,0 +1,19 @@ +# SDL2 CMake version configuration file: +# This file is meant to be placed in a cmake subfolder of SDL2-devel-2.x.y-mingw + +if(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(sdl2_config_path "${CMAKE_CURRENT_LIST_DIR}/../i686-w64-mingw32/lib/cmake/SDL2/sdl2-config-version.cmake") +elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(sdl2_config_path "${CMAKE_CURRENT_LIST_DIR}/../x86_64-w64-mingw32/lib/cmake/SDL2/sdl2-config-version.cmake") +else("${CMAKE_SIZEOF_VOID_P}" STREQUAL "") + set(PACKAGE_VERSION_UNSUITABLE TRUE) + return() +endif() + +if(NOT EXISTS "${sdl2_config_path}") + message(WARNING "${sdl2_config_path} does not exist: MinGW development package is corrupted") + set(PACKAGE_VERSION_UNSUITABLE TRUE) + return() +endif() + +include("${sdl2_config_path}") diff -Nru libsdl2-2.0.22+dfsg/SDL2Config.cmake libsdl2-2.24.0+dfsg/SDL2Config.cmake --- libsdl2-2.0.22+dfsg/SDL2Config.cmake 2022-01-08 21:13:56.000000000 +0000 +++ libsdl2-2.24.0+dfsg/SDL2Config.cmake 1970-01-01 00:00:00.000000000 +0000 @@ -1,119 +0,0 @@ -if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2Targets.cmake") - include("${CMAKE_CURRENT_LIST_DIR}/SDL2Targets.cmake") -endif() -if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2mainTargets.cmake") - include("${CMAKE_CURRENT_LIST_DIR}/SDL2mainTargets.cmake") -endif() -if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2staticTargets.cmake") - include("${CMAKE_CURRENT_LIST_DIR}/SDL2staticTargets.cmake") -endif() - -# on static-only builds create an alias -if(NOT TARGET SDL2::SDL2 AND TARGET SDL2::SDL2-static) - if(CMAKE_VERSION VERSION_LESS "3.18") - # Aliasing local targets is not supported on CMake < 3.18, so make it global. - set_target_properties(SDL2::SDL2-static PROPERTIES IMPORTED_GLOBAL TRUE) - endif() - add_library(SDL2::SDL2 ALIAS SDL2::SDL2-static) -endif() - -# provide ${SDL2_LIBRARIES}, ${SDL2_INCLUDE_DIRS} etc, like sdl2-config.cmake does, -# for compatibility between SDL2 built with autotools and SDL2 built with CMake - -# the following seems to work on Windows for both MSVC and MINGW+MSYS and with both SDL2Config/Target.cmake -# from vcpkg and from building myself with cmake from latest git -# AND on Linux when building SDL2 (tested current git) with CMake - -# the headers are easy - but note that this adds both .../include/ and .../include/SDL2/ -# while the SDL2_INCLUDE_DIRS of sdl2-config.cmake only add ...include/SDL2/ -# But at least if building worked with sdl2-config.cmake it will also work with this. -get_target_property(SDL2_INCLUDE_DIRS SDL2::SDL2 INTERFACE_INCLUDE_DIRECTORIES) - -# get the paths to the files to link against (.lib or .dll.a on Windows, .so or .a on Unix, ...) for both SDL2 and SDL2main - -# for the "normal"/release build they could be in lots of different properties.. -set(relprops IMPORTED_IMPLIB_RELEASE IMPORTED_IMPLIB_NOCONFIG IMPORTED_IMPLIB IMPORTED_IMPLIB_MINSIZEREL IMPORTED_IMPLIB_RELWITHDEBINFO - IMPORTED_LOCATION_RELEASE IMPORTED_LOCATION_NOCONFIG IMPORTED_LOCATION IMPORTED_LOCATION_MINSIZEREL IMPORTED_LOCATION_RELWITHDEBINFO) - -# fewer possibilities for debug builds -set(dbgprops IMPORTED_IMPLIB_DEBUG IMPORTED_LOCATION_DEBUG) - -foreach(prop ${relprops}) - get_target_property(sdl2implib SDL2::SDL2 ${prop}) - if(sdl2implib) - #message("set sdl2implib from ${prop}") - break() - endif() -endforeach() - -foreach(prop ${relprops}) - get_target_property(sdl2mainimplib SDL2::SDL2main ${prop}) - if(sdl2mainimplib) - #message("set sdl2mainimplib from ${prop}") - break() - endif() -endforeach() - -foreach(prop ${dbgprops}) - get_target_property(sdl2implibdbg SDL2::SDL2 ${prop}) - if(sdl2implibdbg) - #message("set sdl2implibdbg from ${prop}") - break() - endif() -endforeach() - -foreach(prop ${dbgprops}) - get_target_property(sdl2mainimplibdbg SDL2::SDL2main ${prop}) - if(sdl2mainimplibdbg) - #message("set sdl2mainimplibdbg from ${prop}") - break() - endif() -endforeach() - -if( sdl2implib AND sdl2mainimplib AND sdl2implibdbg AND sdl2mainimplibdbg ) - # we have both release and debug builds of SDL2 and SDL2main, so use this ugly - # generator expression in SDL2_LIBRARIES to support both in MSVC, depending on build type configured there - set(SDL2_LIBRARIES $,${sdl2mainimplibdbg},${sdl2mainimplib}> $,${sdl2implibdbg},${sdl2implib}>) -else() - if( (NOT sdl2implib) AND sdl2implibdbg ) # if we only have a debug version of the lib - set(sdl2implib ${sdl2implibdbg}) - endif() - if( (NOT sdl2mainimplib) AND sdl2mainimplibdbg ) # if we only have a debug version of the lib - set(sdl2mainimplib ${sdl2mainimplibdbg}) - endif() - - if( sdl2implib AND sdl2mainimplib ) - set(SDL2_LIBRARIES ${sdl2mainimplib} ${sdl2implib}) - elseif(WIN32 OR APPLE) # I think these platforms have a non-dummy SDLmain? - message(FATAL_ERROR, "SDL2::SDL2 and/or SDL2::SDL2main don't seem to contain any kind of IMPORTED_IMPLIB* or IMPORTED_LOCATION*") - elseif(sdl2implib) # on other platforms just libSDL2 will hopefully do? - set(SDL2_LIBRARIES ${sdl2implib}) - message(STATUS, "No SDL2main lib not found, I hope you don't need it..") - else() - message(FATAL_ERROR, "SDL2::SDL2 doesn't seem to contain any kind of lib to link against in IMPORTED_IMPLIB* or IMPORTED_LOCATION*") - endif() - - # TODO: should something like INTERFACE_LINK_LIBRARIES be appended? or wherever -mwindows and things like that - # might be defined (if they were defined by the CMake build at all; autotools has @SDL_RLD_FLAGS@ @SDL_LIBS@)? - # LINK_DEPENDS? LINK_FLAGS? - -endif() - -get_filename_component(SDL2_LIBDIR ${sdl2implib} PATH) - -# NOTE: SDL2_LIBRARIES now looks like "c:/path/to/SDL2main.lib;c:/path/to/SDL2.lib" -# which is different to what it looks like when coming from sdl2-config.cmake -# (there it's more like "-L${SDL2_LIBDIR} -lSDL2main -lSDL2" - and also -lmingw32 and -mwindows) -# This seems to work with both MSVC and MinGW though, while the other only worked with MinGW -# On Linux it looks like "/tmp/sdl2inst/lib/libSDL2main.a;/tmp/sdl2inst/lib/libSDL2-2.0.so.0.14.1" which also seems to work - -# the exec prefix is one level up from lib/ - TODO: really, always? at least on Linux there's /usr/lib/x86_64-bla-blub/libSDL2-asdf.so.0 .. -get_filename_component(SDL2_EXEC_PREFIX ${SDL2_LIBDIR} PATH) -set(SDL2_PREFIX ${SDL2_EXEC_PREFIX}) # TODO: could this be somewhere else? parent dir of include or sth? - -unset(sdl2implib) -unset(sdl2mainimplib) -unset(sdl2implibdbg) -unset(sdl2mainimplibdbg) -unset(relprops) -unset(dbgprops) diff -Nru libsdl2-2.0.22+dfsg/sdl2-config.cmake.in libsdl2-2.24.0+dfsg/sdl2-config.cmake.in --- libsdl2-2.0.22+dfsg/sdl2-config.cmake.in 2021-07-27 14:52:29.000000000 +0000 +++ libsdl2-2.24.0+dfsg/sdl2-config.cmake.in 2022-08-13 03:48:10.000000000 +0000 @@ -1,81 +1,195 @@ -# sdl2 cmake project-config input for ./configure scripts +# sdl2 cmake project-config input for ./configure script + +include(FeatureSummary) +set_package_properties(SDL2 PROPERTIES + URL "https://www.libsdl.org/" + DESCRIPTION "low level access to audio, keyboard, mouse, joystick, and graphics hardware" +) + +# Copied from `configure_package_config_file` +macro(set_and_check _var _file) + set(${_var} "${_file}") + if(NOT EXISTS "${_file}") + message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !") + endif() +endmacro() + +get_filename_component(prefix "${CMAKE_CURRENT_LIST_DIR}/@cmake_prefix_relpath@" ABSOLUTE) -set(prefix "@prefix@") set(exec_prefix "@exec_prefix@") +set(bindir "@bindir@") set(libdir "@libdir@") set(includedir "@includedir@") -set(SDL2_PREFIX "${prefix}") -set(SDL2_EXEC_PREFIX "${exec_prefix}") -set(SDL2_LIBDIR "${libdir}") -set(SDL2_INCLUDE_DIRS "${includedir}/SDL2") -set(SDL2_LIBRARIES "-L${SDL2_LIBDIR} @SDL_RLD_FLAGS@ @SDL_LIBS@") -string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES) - -if(NOT TARGET SDL2::SDL2) - # provide SDL2::SDL2, SDL2::SDL2main and SDL2::SDL2-static targets, like SDL2Config.cmake does, for compatibility - - # Remove -lSDL2 as that is handled by CMake, note the space at the end so it does not replace e.g. -lSDL2main - # This may require "libdir" beeing set (from above) - string(REPLACE "-lSDL2 " "" SDL2_EXTRA_LINK_FLAGS "@SDL_RLD_FLAGS@ @SDL_LIBS@ ") - # also get rid of -lSDL2main, if you want to link against that use both SDL2::SDL2main and SDL2::SDL2 (in that order) - # (SDL2Config.cmake has the same behavior) - string(REPLACE "-lSDL2main" "" SDL2_EXTRA_LINK_FLAGS ${SDL2_EXTRA_LINK_FLAGS}) - string(STRIP "${SDL2_EXTRA_LINK_FLAGS}" SDL2_EXTRA_LINK_FLAGS) - string(REPLACE "-lSDL2 " "" SDL2_EXTRA_LINK_FLAGS_STATIC "@SDL_STATIC_LIBS@ ") - string(STRIP "${SDL2_EXTRA_LINK_FLAGS_STATIC}" SDL2_EXTRA_LINK_FLAGS_STATIC) - -if(WIN32 AND NOT MSVC) - # MINGW needs very special handling, because the link order must be exactly -lmingw32 -lSDL2main -lSDL2 - # for it to work at all (and -mwindows somewhere); a normal SHARED IMPORTED or STATIC IMPORTED library always puts itself first - # so handle this like a header-only lib and put everything in INTERFACE_LINK_LIBRARIES - - add_library(SDL2::SDL2 INTERFACE IMPORTED) - set_target_properties(SDL2::SDL2 PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}" - INTERFACE_LINK_LIBRARIES "-L${SDL2_LIBDIR} -lSDL2") - - add_library(SDL2::SDL2main INTERFACE IMPORTED) - set_target_properties(SDL2::SDL2main PROPERTIES - INTERFACE_LINK_LIBRARIES "-L${SDL2_LIBDIR} -lmingw32 -lSDL2main -mwindows") - -else() # (not WIN32) or MSVC - - add_library(SDL2::SDL2 SHARED IMPORTED) - set_target_properties(SDL2::SDL2 PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION "${SDL2_LIBDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}SDL2${CMAKE_SHARED_LIBRARY_SUFFIX}") - - if(MSVC) - # This file is generated when building SDL2 with autotools and MinGW, and MinGW/dlltool - # isn't able to generate .lib files that are usable by recent MSVC versions - # (something about "module unsafe for SAFESEH"; SAFESEH is enabled by default in MSVC). - # The .lib file for SDL2.dll *could* be generated with `gendef SDL2.dll` and then - # `lib.exe /machine:x86 /def:SDL2.def /out:SDL2.lib` (or /machine:amd64) - # but that requires lib.exe from a Visual Studio installation - and that still doesn't - # give you a static SDL2main.lib with SAFESEH support that you'll need (unless you don't use SDL2main) - # Note that when building SDL2 with CMake and MSVC, the result works with both MinGW and MSVC. - - message(FATAL_ERROR, "This build of libSDL2 only supports MinGW, not MSVC (Visual C++), because it lacks .lib files!") - # MSVC needs SDL2.lib set as IMPORTED_IMPLIB to link against (comment out message() call above if you added SDL2.lib yourself) - set_target_properties(SDL2::SDL2 PROPERTIES IMPORTED_IMPLIB "${SDL2_LIBDIR}/SDL2.lib") + +set_and_check(SDL2_PREFIX "${prefix}") +set_and_check(SDL2_EXEC_PREFIX "${exec_prefix}") +set_and_check(SDL2_BINDIR "${bindir}") +set_and_check(SDL2_INCLUDE_DIR "${includedir}/SDL2") +set_and_check(SDL2_LIBDIR "${libdir}") +set(SDL2_INCLUDE_DIRS "${includedir};${SDL2_INCLUDE_DIR}") + +set(SDL2_LIBRARIES SDL2::SDL2) +set(SDL2_STATIC_LIBRARIES SDL2::SDL2-static) +set(SDL2MAIN_LIBRARY) +set(SDL2TEST_LIBRARY SDL2::SDL2test) + +unset(prefix) +unset(exec_prefix) +unset(bindir) +unset(libdir) +unset(includedir) + +set(_sdl2_libraries "@SDL_LIBS@") +set(_sdl2_static_private_libs "@SDL_STATIC_LIBS@") + +# Convert _sdl2_libraries to list and keep only libraries +string(REGEX MATCHALL "-[lm]([-a-zA-Z0-9._]+)" _sdl2_libraries "${_sdl2_libraries}") +string(REGEX REPLACE "^-l" "" _sdl2_libraries "${_sdl2_libraries}") +string(REGEX REPLACE ";-l" ";" _sdl2_libraries "${_sdl2_libraries}") + +# Convert _sdl2_static_private_libs to list and keep only libraries +string(REGEX MATCHALL "(-[lm]([-a-zA-Z0-9._]+))|(-Wl,[^ ]*framework[^ ]*)" _sdl2_static_private_libs "${_sdl2_static_private_libs}") +string(REGEX REPLACE "^-l" "" _sdl2_static_private_libs "${_sdl2_static_private_libs}") +string(REGEX REPLACE ";-l" ";" _sdl2_static_private_libs "${_sdl2_static_private_libs}") + +if(_sdl2_libraries MATCHES ".*SDL2main.*") + list(INSERT SDL2_LIBRARIES 0 SDL2::SDL2main) + list(INSERT SDL2_STATIC_LIBRARIES 0 SDL2::SDL2main) + set(_sdl2main_library ${SDL2_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2main${CMAKE_STATIC_LIBRARY_SUFFIX}) + if(EXISTS "${_sdl2main_library}") + set(SDL2MAIN_LIBRARY SDL2::SDL2main) + if(NOT TARGET SDL2::SDL2main) + add_library(SDL2::SDL2main STATIC IMPORTED) + set_target_properties(SDL2::SDL2main + PROPERTIES + IMPORTED_LOCATION "${_sdl2main_library}" + ) + if(WIN32) + # INTERFACE_LINK_OPTIONS needs CMake 3.13 + cmake_minimum_required(VERSION 3.13) + # Mark WinMain/WinMain@16 as undefined, such that it will be withheld by the linker. + if(CMAKE_SIZEOF_VOID_P EQUAL 4) + set_target_properties(SDL2::SDL2main + PROPERTIES + INTERFACE_LINK_OPTIONS "-Wl,--undefined=_WinMain@16" + ) + else() + set_target_properties(SDL2::SDL2main + PROPERTIES + INTERFACE_LINK_OPTIONS "-Wl,--undefined=WinMain" + ) + endif() + endif() + endif() + set(SDL2_SDL2main_FOUND TRUE) else() - # this mustn't be set for MSVC, so do it here in an extra call here - set_target_properties(SDL2::SDL2 PROPERTIES INTERFACE_LINK_LIBRARIES "${SDL2_EXTRA_LINK_FLAGS}") + set(SDL2_SDL2main_FOUND FALSE) endif() + unset(_sdl2main_library) +endif() - add_library(SDL2::SDL2main STATIC IMPORTED) - set_target_properties(SDL2::SDL2main PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION "${SDL2_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2main${CMAKE_STATIC_LIBRARY_SUFFIX}") - -endif() # (not WIN32) or MSVC - - add_library(SDL2::SDL2-static STATIC IMPORTED) - set_target_properties(SDL2::SDL2-static PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION "${SDL2_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2${CMAKE_STATIC_LIBRARY_SUFFIX}" - INTERFACE_LINK_LIBRARIES "${SDL2_EXTRA_LINK_FLAGS_STATIC}") +# Remove SDL2 since this is the "central" library +# Remove SDL2main since this will be provided by SDL2::SDL2main (if available) +# Remove mingw32 and cygwin since these are not needed when using `-Wl,--undefined,WinMain` +set(_sdl2_link_libraries ${_sdl2_libraries}) +list(REMOVE_ITEM _sdl2_link_libraries SDL2 SDL2main mingw32 cygwin) + +if(WIN32) + set(_sdl2_implib "${SDL2_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") + set(_sdl2_dll "${SDL2_BINDIR}/SDL2${CMAKE_SHARED_LIBRARY_SUFFIX}") + if(EXISTS "${_sdl2_implib}" AND EXISTS "${_sdl2_dll}") + if(NOT TARGET SDL2::SDL2) + add_library(SDL2::SDL2 SHARED IMPORTED) + set_target_properties(SDL2::SDL2 PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${_sdl2_link_libraries}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_IMPLIB "${_sdl2_implib}" + IMPORTED_LOCATION "${_sdl2_dll}" + ) + endif() + set(SDL2_SDL2_FOUND TRUE) + else() + set(SDL2_SDL2_FOUND FALSE) + endif() + unset(_sdl2_implib) + unset(_sdl2_dll) +else() + set(_sdl2_shared "${SDL2_LIBDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}SDL2${CMAKE_SHARED_LIBRARY_SUFFIX}") + if(EXISTS "${_sdl2_shared}") + if(NOT TARGET SDL2::SDL2) + add_library(SDL2::SDL2 SHARED IMPORTED) + set_target_properties(SDL2::SDL2 PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${_sdl2_link_libraries}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${_sdl2_shared}" + ) + endif() + set(SDL2_SDL2_FOUND TRUE) + else() + set(SDL2_SDL2_FOUND FALSE) + endif() + unset(_sdl2_shared) +endif() -endif() # NOT TARGET SDL2::SDL2 +set(_sdl2_static "${SDL2_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2${CMAKE_STATIC_LIBRARY_SUFFIX}") +if(EXISTS "${_sdl2_static}") + if(NOT TARGET SDL2::SDL2-static) + add_library(SDL2::SDL2-static STATIC IMPORTED) + set_target_properties(SDL2::SDL2-static + PROPERTIES + IMPORTED_LOCATION "${_sdl2_static}" + INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${_sdl2_link_libraries};${_sdl2_static_private_libs}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + ) + endif() + set(SDL2_SDL2-static_FOUND TRUE) +else() + set(SDL2_SDL2-static_FOUND FALSE) +endif() +unset(_sdl2_static) + +unset(_sdl2_link_libraries) + +set(_sdl2test_library "${SDL2_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2_test${CMAKE_STATIC_LIBRARY_SUFFIX}") +if(EXISTS "${_sdl2test_library}") + if(NOT TARGET SDL2::SDL2test) + add_library(SDL2::SDL2test STATIC IMPORTED) + set_target_properties(SDL2::SDL2test + PROPERTIES + IMPORTED_LOCATION "_sdl2test_library" + INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIR}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + ) + endif() + set(SDL2_SDL2test_FOUND TRUE) +else() + set(SDL2_SDL2test_FOUND FALSE) +endif() +unset(_sdl2test_library) + +# Copied from `configure_package_config_file` +macro(check_required_components _NAME) + foreach(comp ${${_NAME}_FIND_COMPONENTS}) + if(NOT ${_NAME}_${comp}_FOUND) + if(${_NAME}_FIND_REQUIRED_${comp}) + set(${_NAME}_FOUND FALSE) + endif() + endif() + endforeach() +endmacro() + +check_required_components(SDL2) + +# Create SDL2::SDL2 alias for static-only builds +if(TARGET SDL2::SDL2-static AND NOT TARGET SDL2::SDL2) + if(CMAKE_VERSION VERSION_LESS "3.18") + # FIXME: Aliasing local targets is not supported on CMake < 3.18, so make it global. + add_library(SDL2::SDL2 INTERFACE IMPORTED) + set_target_properties(SDL2::SDL2 PROPERTIES INTERFACE_LINK_LIBRARIES "SDL2::SDL2-static") + else() + add_library(SDL2::SDL2 ALIAS SDL2::SDL2-static) + endif() +endif() diff -Nru libsdl2-2.0.22+dfsg/SDL2Config.cmake.in libsdl2-2.24.0+dfsg/SDL2Config.cmake.in --- libsdl2-2.0.22+dfsg/SDL2Config.cmake.in 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/SDL2Config.cmake.in 2022-06-16 20:16:31.000000000 +0000 @@ -0,0 +1,65 @@ +# sdl2 cmake project-config input for CMakeLists.txt script + +include(FeatureSummary) +set_package_properties(SDL2 PROPERTIES + URL "https://www.libsdl.org/" + DESCRIPTION "low level access to audio, keyboard, mouse, joystick, and graphics hardware" +) + +@PACKAGE_INIT@ + +set(SDL2_FOUND TRUE) + +if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2Targets.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/SDL2Targets.cmake") + set(SDL2_SDL2_FOUND TRUE) +endif() +if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2staticTargets.cmake") + if(ANDROID) + enable_language(CXX) + endif() + include("${CMAKE_CURRENT_LIST_DIR}/SDL2staticTargets.cmake") + set(SDL2_SDL2-static_FOUND TRUE) +endif() +if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2mainTargets.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/SDL2mainTargets.cmake") + set(SDL2_SDL2main_FOUND TRUE) +endif() +if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2testTargets.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/SDL2testTargets.cmake") + set(SDL2_SDL2test_FOUND TRUE) +endif() + +check_required_components(SDL2) + +# Create SDL2::SDL2 alias for static-only builds +if(TARGET SDL2::SDL2-static AND NOT TARGET SDL2::SDL2) + if(CMAKE_VERSION VERSION_LESS "3.18") + # FIXME: Aliasing local targets is not supported on CMake < 3.18, so make it global. + add_library(SDL2::SDL2 INTERFACE IMPORTED) + set_target_properties(SDL2::SDL2 PROPERTIES INTERFACE_LINK_LIBRARIES "SDL2::SDL2-static") + else() + add_library(SDL2::SDL2 ALIAS SDL2::SDL2-static) + endif() +endif() + +# For compatibility with autotools sdl2-config.cmake, provide SDL2_* variables. + +set(SDL2_PREFIX "@PACKAGE_CMAKE_INSTALL_PREFIX@") +set(SDL2_EXEC_PREFIX "@PACKAGE_CMAKE_INSTALL_PREFIX@") +set(SDL2_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@/SDL2") +set(SDL2_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@;@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@/SDL2") +set(SDL2_BINDIR "@PACKAGE_CMAKE_INSTALL_FULL_BINDIR@") +set(SDL2_LIBDIR "@PACKAGE_CMAKE_INSTALL_FULL_LIBDIR@") +set(SDL2_LIBRARIES SDL2::SDL2) +set(SDL2_STATIC_LIBRARIES SDL2::SDL2-static) +set(SDL2_STATIC_PRIVATE_LIBS) + +set(SDL2MAIN_LIBRARY) +if(TARGET SDL2::SDL2main) + set(SDL2MAIN_LIBRARY SDL2::SDL2main) + list(INSERT SDL2_LIBRARIES 0 SDL2::SDL2main) + list(INSERT SDL2_STATIC_LIBRARIES 0 SDL2::SDL2main) +endif() + +set(SDL2TEST_LIBRARY SDL2::SDL2test) \ No newline at end of file diff -Nru libsdl2-2.0.22+dfsg/sdl2-config.in libsdl2-2.24.0+dfsg/sdl2-config.in --- libsdl2-2.0.22+dfsg/sdl2-config.in 2021-07-27 14:52:29.000000000 +0000 +++ libsdl2-2.24.0+dfsg/sdl2-config.in 2022-08-13 03:48:10.000000000 +0000 @@ -1,6 +1,10 @@ #!/bin/sh -prefix=@prefix@ +# Get the canonical path of the folder containing this script +bindir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)") + +# Calculate the canonical path of the prefix, relative to the folder of this script +prefix=$(cd -P -- "$bindir/@bin_prefix_relpath@" && printf '%s\n' "$(pwd -P)") exec_prefix=@exec_prefix@ exec_prefix_set=no libdir=@libdir@ @@ -49,7 +53,8 @@ @ENABLE_SHARED_TRUE@ ;; @ENABLE_STATIC_TRUE@@ENABLE_SHARED_TRUE@ --static-libs) @ENABLE_STATIC_TRUE@@ENABLE_SHARED_FALSE@ --libs|--static-libs) -@ENABLE_STATIC_TRUE@ echo -L@libdir@ @SDL_LIBS@ @SDL_STATIC_LIBS@ +@ENABLE_STATIC_TRUE@ sdl_static_libs=$(echo "@SDL_LIBS@ @SDL_STATIC_LIBS@" | sed -E "s#-lSDL2[ $]#$libdir/libSDL2.a #g") +@ENABLE_STATIC_TRUE@ echo -L@libdir@ $sdl_static_libs @ENABLE_STATIC_TRUE@ ;; *) echo "${usage}" 1>&2 diff -Nru libsdl2-2.0.22+dfsg/sdl2-config-version.cmake.in libsdl2-2.24.0+dfsg/sdl2-config-version.cmake.in --- libsdl2-2.0.22+dfsg/sdl2-config-version.cmake.in 2021-07-27 14:52:29.000000000 +0000 +++ libsdl2-2.24.0+dfsg/sdl2-config-version.cmake.in 2022-06-02 02:01:57.000000000 +0000 @@ -1,3 +1,5 @@ +# sdl2 cmake project-config-version input for ./configure scripts + set(PACKAGE_VERSION "@SDL_VERSION@") if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) @@ -8,4 +10,3 @@ set(PACKAGE_VERSION_EXACT TRUE) endif() endif() - diff -Nru libsdl2-2.0.22+dfsg/sdl2.pc.in libsdl2-2.24.0+dfsg/sdl2.pc.in --- libsdl2-2.0.22+dfsg/sdl2.pc.in 2021-07-27 14:52:29.000000000 +0000 +++ libsdl2-2.24.0+dfsg/sdl2.pc.in 2022-08-13 03:48:10.000000000 +0000 @@ -11,4 +11,4 @@ Requires: Conflicts: Libs: -L${libdir} @SDL_RLD_FLAGS@ @SDL_LIBS@ @PKGCONFIG_LIBS_PRIV@ @SDL_STATIC_LIBS@ -Cflags: -I${includedir}/SDL2 @SDL_CFLAGS@ +Cflags: -I${includedir} -I${includedir}/SDL2 @SDL_CFLAGS@ diff -Nru libsdl2-2.0.22+dfsg/SDL2.spec libsdl2-2.24.0+dfsg/SDL2.spec --- libsdl2-2.0.22+dfsg/SDL2.spec 2022-04-25 18:10:40.000000000 +0000 +++ libsdl2-2.24.0+dfsg/SDL2.spec 2022-08-19 15:46:48.000000000 +0000 @@ -1,6 +1,6 @@ Summary: Simple DirectMedia Layer Name: SDL2 -Version: 2.0.22 +Version: 2.24.0 Release: 2 Source: http://www.libsdl.org/release/%{name}-%{version}.tar.gz URL: http://www.libsdl.org/ diff -Nru libsdl2-2.0.22+dfsg/src/atomic/SDL_spinlock.c libsdl2-2.24.0+dfsg/src/atomic/SDL_spinlock.c --- libsdl2-2.0.22+dfsg/src/atomic/SDL_spinlock.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/atomic/SDL_spinlock.c 2022-08-13 03:48:10.000000000 +0000 @@ -20,7 +20,7 @@ */ #include "../SDL_internal.h" -#if defined(__WIN32__) || defined(__WINRT__) +#if defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__) #include "../core/windows/SDL_windows.h" #endif @@ -40,6 +40,14 @@ #include #endif +#if defined(PS2) +#include +#endif + +#if !defined(HAVE_GCC_ATOMICS) && defined(__MACOSX__) +#include +#endif + #if defined(__WATCOMC__) && defined(__386__) SDL_COMPILE_TIME_ASSERT(locksize, 4==sizeof(SDL_SpinLock)); extern __inline int _SDL_xchg_watcom(volatile int *a, int v); @@ -131,32 +139,25 @@ #elif defined(__SOLARIS__) && !defined(_LP64) /* Used for Solaris with non-gcc compilers. */ return (SDL_bool) ((int) atomic_cas_32((volatile uint32_t*)lock, 0, 1) == 0); +#elif defined(PS2) + uint32_t oldintr; + SDL_bool res = SDL_FALSE; + // disable interuption + oldintr = DIntr(); + if (*lock == 0) { + *lock = 1; + res = SDL_TRUE; + } + // enable interuption + if(oldintr) { EIntr(); } + return res; #else #error Please implement for your platform. return SDL_FALSE; #endif } -/* "REP NOP" is PAUSE, coded for tools that don't know it by that name. */ -#if (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__)) - #define PAUSE_INSTRUCTION() __asm__ __volatile__("pause\n") /* Some assemblers can't do REP NOP, so go with PAUSE. */ -#elif (defined(__arm__) && __ARM_ARCH__ >= 7) || defined(__aarch64__) - #define PAUSE_INSTRUCTION() __asm__ __volatile__("yield" ::: "memory") -#elif (defined(__powerpc__) || defined(__powerpc64__)) - #define PAUSE_INSTRUCTION() __asm__ __volatile__("or 27,27,27"); -#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64)) - #define PAUSE_INSTRUCTION() _mm_pause() /* this is actually "rep nop" and not a SIMD instruction. No inline asm in MSVC x86-64! */ -#elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64)) - #define PAUSE_INSTRUCTION() __yield() -#elif defined(__WATCOMC__) && defined(__386__) - /* watcom assembler rejects PAUSE if CPU < i686, and it refuses REP NOP as an invalid combination. Hardcode the bytes. */ - extern __inline void PAUSE_INSTRUCTION(void); - #pragma aux PAUSE_INSTRUCTION = "db 0f3h,90h" -#else - #define PAUSE_INSTRUCTION() -#endif - void SDL_AtomicLock(SDL_SpinLock *lock) { @@ -165,7 +166,7 @@ while (!SDL_AtomicTryLock(lock)) { if (iterations < 32) { iterations++; - PAUSE_INSTRUCTION(); + SDL_CPUPauseInstruction(); } else { /* !!! FIXME: this doesn't definitely give up the current timeslice, it does different things on various platforms. */ SDL_Delay(0); diff -Nru libsdl2-2.0.22+dfsg/src/audio/aaudio/SDL_aaudio.c libsdl2-2.24.0+dfsg/src/audio/aaudio/SDL_aaudio.c --- libsdl2-2.0.22+dfsg/src/audio/aaudio/SDL_aaudio.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/audio/aaudio/SDL_aaudio.c 2022-08-13 03:48:10.000000000 +0000 @@ -437,14 +437,17 @@ */ SDL_bool aaudio_DetectBrokenPlayState( void ) { + struct SDL_PrivateAudioData *private; + int64_t framePosition, timeNanoseconds; + aaudio_result_t res; + if ( !audioDevice || !audioDevice->hidden ) { return SDL_FALSE; } - struct SDL_PrivateAudioData *private = audioDevice->hidden; + private = audioDevice->hidden; - int64_t framePosition, timeNanoseconds; - aaudio_result_t res = ctx.AAudioStream_getTimestamp( private->stream, CLOCK_MONOTONIC, &framePosition, &timeNanoseconds ); + res = ctx.AAudioStream_getTimestamp( private->stream, CLOCK_MONOTONIC, &framePosition, &timeNanoseconds ); if ( res == AAUDIO_ERROR_INVALID_STATE ) { aaudio_stream_state_t currentState = ctx.AAudioStream_getState( private->stream ); /* AAudioStream_getTimestamp() will also return AAUDIO_ERROR_INVALID_STATE while the stream is still initially starting. But we only care if it silently went invalid while playing. */ diff -Nru libsdl2-2.0.22+dfsg/src/audio/alsa/SDL_alsa_audio.c libsdl2-2.24.0+dfsg/src/audio/alsa/SDL_alsa_audio.c --- libsdl2-2.0.22+dfsg/src/audio/alsa/SDL_alsa_audio.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/audio/alsa/SDL_alsa_audio.c 2022-08-13 03:48:10.000000000 +0000 @@ -1009,6 +1009,7 @@ impl->FlushCapture = ALSA_FlushCapture; impl->HasCaptureSupport = SDL_TRUE; + impl->SupportsNonPow2Samples = SDL_TRUE; return SDL_TRUE; /* this audio target is available. */ } diff -Nru libsdl2-2.0.22+dfsg/src/audio/coreaudio/SDL_coreaudio.m libsdl2-2.24.0+dfsg/src/audio/coreaudio/SDL_coreaudio.m --- libsdl2-2.0.22+dfsg/src/audio/coreaudio/SDL_coreaudio.m 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/audio/coreaudio/SDL_coreaudio.m 2022-08-13 03:48:10.000000000 +0000 @@ -522,8 +522,12 @@ outputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer) { SDL_AudioDevice *this = (SDL_AudioDevice *) inUserData; + + SDL_LockMutex(this->mixer_lock); + if (SDL_AtomicGet(&this->hidden->shutdown)) { - return; /* don't do anything. */ + SDL_UnlockMutex(this->mixer_lock); + return; /* don't do anything, since we don't even want to enqueue this buffer again. */ } if (!SDL_AtomicGet(&this->enabled) || SDL_AtomicGet(&this->paused)) { @@ -536,10 +540,8 @@ while (remaining > 0) { if (SDL_AudioStreamAvailable(this->stream) == 0) { /* Generate the data */ - SDL_LockMutex(this->mixer_lock); (*this->callbackspec.callback)(this->callbackspec.userdata, this->hidden->buffer, this->hidden->bufferSize); - SDL_UnlockMutex(this->mixer_lock); this->hidden->bufferOffset = 0; SDL_AudioStreamPut(this->stream, this->hidden->buffer, this->hidden->bufferSize); } @@ -565,10 +567,8 @@ UInt32 len; if (this->hidden->bufferOffset >= this->hidden->bufferSize) { /* Generate the data */ - SDL_LockMutex(this->mixer_lock); (*this->callbackspec.callback)(this->callbackspec.userdata, this->hidden->buffer, this->hidden->bufferSize); - SDL_UnlockMutex(this->mixer_lock); this->hidden->bufferOffset = 0; } @@ -587,6 +587,8 @@ AudioQueueEnqueueBuffer(this->hidden->audioQueue, inBuffer, 0, NULL); inBuffer->mAudioDataByteSize = inBuffer->mAudioDataBytesCapacity; + + SDL_UnlockMutex(this->mixer_lock); } static void @@ -822,7 +824,10 @@ const AudioStreamBasicDescription *strdesc = &this->hidden->strdesc; const int iscapture = this->iscapture; OSStatus result; - int i; + int i, numAudioBuffers = 2; + AudioChannelLayout layout; + double MINIMUM_AUDIO_BUFFER_TIME_MS; + const double msecs = (this->spec.samples / ((double) this->spec.freq)) * 1000.0;; SDL_assert(CFRunLoopGetCurrent() != NULL); @@ -854,7 +859,6 @@ SDL_CalculateAudioSpec(&this->spec); /* Set the channel layout for the audio queue */ - AudioChannelLayout layout; SDL_zero(layout); switch (this->spec.channels) { case 1: @@ -899,15 +903,13 @@ } /* Make sure we can feed the device a minimum amount of time */ - double MINIMUM_AUDIO_BUFFER_TIME_MS = 15.0; + MINIMUM_AUDIO_BUFFER_TIME_MS = 15.0; #if defined(__IPHONEOS__) if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_7_1) { /* Older iOS hardware, use 40 ms as a minimum time */ MINIMUM_AUDIO_BUFFER_TIME_MS = 40.0; } #endif - const double msecs = (this->spec.samples / ((double) this->spec.freq)) * 1000.0; - int numAudioBuffers = 2; if (msecs < MINIMUM_AUDIO_BUFFER_TIME_MS) { /* use more buffers if we have a VERY small sample set. */ numAudioBuffers = ((int)SDL_ceil(MINIMUM_AUDIO_BUFFER_TIME_MS / msecs) * 2); } @@ -944,6 +946,7 @@ audioqueue_thread(void *arg) { SDL_AudioDevice *this = (SDL_AudioDevice *) arg; + int rc; #if MACOSX_COREAUDIO const AudioObjectPropertyAddress default_device_address = { @@ -958,7 +961,7 @@ } #endif - const int rc = prepare_audioqueue(this); + rc = prepare_audioqueue(this); if (!rc) { this->hidden->thread_error = SDL_strdup(SDL_GetError()); SDL_SemPost(this->hidden->ready_semaphore); @@ -975,6 +978,7 @@ #if MACOSX_COREAUDIO if ((this->handle == NULL) && SDL_AtomicGet(&this->hidden->device_change_flag)) { + const AudioDeviceID prev_devid = this->hidden->deviceID; SDL_AtomicSet(&this->hidden->device_change_flag, 0); #if DEBUG_COREAUDIO @@ -984,7 +988,6 @@ /* if any of this fails, there's not much to do but wait to see if the user gives up and quits (flagging the audioqueue for shutdown), or toggles to some other system output device (in which case we'll try again). */ - const AudioDeviceID prev_devid = this->hidden->deviceID; if (prepare_device(this) && (prev_devid != this->hidden->deviceID)) { AudioQueueStop(this->hidden->audioQueue, 1); if (assign_device_to_audioqueue(this)) { @@ -1170,6 +1173,7 @@ impl->ProvidesOwnCallbackThread = SDL_TRUE; impl->HasCaptureSupport = SDL_TRUE; + impl->SupportsNonPow2Samples = SDL_TRUE; return SDL_TRUE; /* this audio target is available. */ } diff -Nru libsdl2-2.0.22+dfsg/src/audio/directsound/SDL_directsound.c libsdl2-2.24.0+dfsg/src/audio/directsound/SDL_directsound.c --- libsdl2-2.0.22+dfsg/src/audio/directsound/SDL_directsound.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/audio/directsound/SDL_directsound.c 2022-08-13 03:48:10.000000000 +0000 @@ -29,11 +29,20 @@ #include "SDL_audio.h" #include "../SDL_audio_c.h" #include "SDL_directsound.h" +#include +#if HAVE_MMDEVICEAPI_H +#include "../../core/windows/SDL_immdevice.h" +#endif /* HAVE_MMDEVICEAPI_H */ #ifndef WAVE_FORMAT_IEEE_FLOAT #define WAVE_FORMAT_IEEE_FLOAT 0x0003 #endif +/* For Vista+, we can enumerate DSound devices with IMMDevice */ +#if HAVE_MMDEVICEAPI_H +static SDL_bool SupportsIMMDevice = SDL_FALSE; +#endif /* HAVE_MMDEVICEAPI_H */ + /* DirectX function pointers for audio */ static void* DSoundDLL = NULL; typedef HRESULT (WINAPI *fnDirectSoundCreate8)(LPGUID,LPDIRECTSOUND*,LPUNKNOWN); @@ -45,6 +54,9 @@ static fnDirectSoundCaptureCreate8 pDirectSoundCaptureCreate8 = NULL; static fnDirectSoundCaptureEnumerateW pDirectSoundCaptureEnumerateW = NULL; +static const GUID SDL_KSDATAFORMAT_SUBTYPE_PCM = { 0x00000001, 0x0000, 0x0010,{ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 } }; +static const GUID SDL_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT = { 0x00000003, 0x0000, 0x0010,{ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 } }; + static void DSOUND_Unload(void) { @@ -148,6 +160,17 @@ SDL_free(handle); } +static int +DSOUND_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int iscapture) +{ +#if HAVE_MMDEVICEAPI_H + if (SupportsIMMDevice) { + return SDL_IMMDevice_GetDefaultAudioInfo(name, spec, iscapture); + } +#endif /* HAVE_MMDEVICEAPI_H */ + return SDL_Unsupported(); +} + static BOOL CALLBACK FindAllDevs(LPGUID guid, LPCWSTR desc, LPCWSTR module, LPVOID data) { @@ -172,8 +195,16 @@ static void DSOUND_DetectDevices(void) { - pDirectSoundCaptureEnumerateW(FindAllDevs, (void *) ((size_t) 1)); - pDirectSoundEnumerateW(FindAllDevs, (void *) ((size_t) 0)); +#if HAVE_MMDEVICEAPI_H + if (SupportsIMMDevice) { + SDL_IMMDevice_EnumerateEndpoints(SDL_TRUE); + } else { +#endif /* HAVE_MMDEVICEAPI_H */ + pDirectSoundCaptureEnumerateW(FindAllDevs, (void *)((size_t)1)); + pDirectSoundEnumerateW(FindAllDevs, (void *)((size_t)0)); +#if HAVE_MMDEVICEAPI_H + } +#endif /* HAVE_MMDEVICEAPI_H*/ } @@ -524,21 +555,56 @@ (int) (DSBSIZE_MAX / numchunks)); } else { int rc; - WAVEFORMATEX wfmt; + WAVEFORMATEXTENSIBLE wfmt; SDL_zero(wfmt); - if (SDL_AUDIO_ISFLOAT(this->spec.format)) { - wfmt.wFormatTag = WAVE_FORMAT_IEEE_FLOAT; + if (this->spec.channels > 2) { + wfmt.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; + wfmt.Format.cbSize = sizeof(wfmt) - sizeof(WAVEFORMATEX); + + if (SDL_AUDIO_ISFLOAT(this->spec.format)) { + SDL_memcpy(&wfmt.SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, sizeof(GUID)); + } else { + SDL_memcpy(&wfmt.SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_PCM, sizeof(GUID)); + } + wfmt.Samples.wValidBitsPerSample = SDL_AUDIO_BITSIZE(this->spec.format); + + switch (this->spec.channels) + { + case 3: /* 3.0 (or 2.1) */ + wfmt.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER; + break; + case 4: /* 4.0 */ + wfmt.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT; + break; + case 5: /* 5.0 (or 4.1) */ + wfmt.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT; + break; + case 6: /* 5.1 */ + wfmt.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT; + break; + case 7: /* 6.1 */ + wfmt.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT | SPEAKER_BACK_CENTER; + break; + case 8: /* 7.1 */ + wfmt.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT | SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT; + break; + default: + SDL_assert(0 && "Unsupported channel count!"); + break; + } + } else if (SDL_AUDIO_ISFLOAT(this->spec.format)) { + wfmt.Format.wFormatTag = WAVE_FORMAT_IEEE_FLOAT; } else { - wfmt.wFormatTag = WAVE_FORMAT_PCM; + wfmt.Format.wFormatTag = WAVE_FORMAT_PCM; } - wfmt.wBitsPerSample = SDL_AUDIO_BITSIZE(this->spec.format); - wfmt.nChannels = this->spec.channels; - wfmt.nSamplesPerSec = this->spec.freq; - wfmt.nBlockAlign = wfmt.nChannels * (wfmt.wBitsPerSample / 8); - wfmt.nAvgBytesPerSec = wfmt.nSamplesPerSec * wfmt.nBlockAlign; + wfmt.Format.wBitsPerSample = SDL_AUDIO_BITSIZE(this->spec.format); + wfmt.Format.nChannels = this->spec.channels; + wfmt.Format.nSamplesPerSec = this->spec.freq; + wfmt.Format.nBlockAlign = wfmt.Format.nChannels * (wfmt.Format.wBitsPerSample / 8); + wfmt.Format.nAvgBytesPerSec = wfmt.Format.nSamplesPerSec * wfmt.Format.nBlockAlign; - rc = iscapture ? CreateCaptureBuffer(this, bufsize, &wfmt) : CreateSecondary(this, bufsize, &wfmt); + rc = iscapture ? CreateCaptureBuffer(this, bufsize, (WAVEFORMATEX*) &wfmt) : CreateSecondary(this, bufsize, (WAVEFORMATEX*) &wfmt); if (rc == 0) { this->hidden->num_buffers = numchunks; break; @@ -567,6 +633,12 @@ static void DSOUND_Deinitialize(void) { +#if HAVE_MMDEVICEAPI_H + if (SupportsIMMDevice) { + SDL_IMMDevice_Quit(); + SupportsIMMDevice = SDL_FALSE; + } +#endif /* HAVE_MMDEVICEAPI_H */ DSOUND_Unload(); } @@ -578,6 +650,10 @@ return SDL_FALSE; } +#if HAVE_MMDEVICEAPI_H + SupportsIMMDevice = !(SDL_IMMDevice_Init() < 0); +#endif /* HAVE_MMDEVICEAPI_H */ + /* Set the function pointers */ impl->DetectDevices = DSOUND_DetectDevices; impl->OpenDevice = DSOUND_OpenDevice; @@ -589,8 +665,10 @@ impl->CloseDevice = DSOUND_CloseDevice; impl->FreeDeviceHandle = DSOUND_FreeDeviceHandle; impl->Deinitialize = DSOUND_Deinitialize; + impl->GetDefaultAudioInfo = DSOUND_GetDefaultAudioInfo; impl->HasCaptureSupport = SDL_TRUE; + impl->SupportsNonPow2Samples = SDL_TRUE; return SDL_TRUE; /* this audio target is available. */ } diff -Nru libsdl2-2.0.22+dfsg/src/audio/disk/SDL_diskaudio.c libsdl2-2.24.0+dfsg/src/audio/disk/SDL_diskaudio.c --- libsdl2-2.0.22+dfsg/src/audio/disk/SDL_diskaudio.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/audio/disk/SDL_diskaudio.c 2022-08-13 03:48:10.000000000 +0000 @@ -195,6 +195,7 @@ impl->AllowsArbitraryDeviceNames = SDL_TRUE; impl->HasCaptureSupport = SDL_TRUE; + impl->SupportsNonPow2Samples = SDL_TRUE; return SDL_TRUE; /* this audio target is available. */ } diff -Nru libsdl2-2.0.22+dfsg/src/audio/emscripten/SDL_emscriptenaudio.c libsdl2-2.24.0+dfsg/src/audio/emscripten/SDL_emscriptenaudio.c --- libsdl2-2.0.22+dfsg/src/audio/emscripten/SDL_emscriptenaudio.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/audio/emscripten/SDL_emscriptenaudio.c 2022-06-02 02:01:57.000000000 +0000 @@ -28,6 +28,11 @@ #include +/* !!! FIXME: this currently expects that the audio callback runs in the main thread, + !!! FIXME: in intervals when the application isn't running, but that may not be + !!! FIXME: true always once pthread support becomes widespread. Revisit this code + !!! FIXME: at some point and see what needs to be done for that! */ + static void FeedAudioDevice(_THIS, const void *buf, const int buflen) { diff -Nru libsdl2-2.0.22+dfsg/src/audio/haiku/SDL_haikuaudio.cc libsdl2-2.24.0+dfsg/src/audio/haiku/SDL_haikuaudio.cc --- libsdl2-2.0.22+dfsg/src/audio/haiku/SDL_haikuaudio.cc 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/audio/haiku/SDL_haikuaudio.cc 2022-06-02 02:01:57.000000000 +0000 @@ -49,39 +49,40 @@ SDL_AudioDevice *audio = (SDL_AudioDevice *) device; SDL_AudioCallback callback = audio->callbackspec.callback; + SDL_LockMutex(audio->mixer_lock); + /* Only do something if audio is enabled */ if (!SDL_AtomicGet(&audio->enabled) || SDL_AtomicGet(&audio->paused)) { if (audio->stream) { SDL_AudioStreamClear(audio->stream); } SDL_memset(stream, audio->spec.silence, len); - return; - } - - SDL_assert(audio->spec.size == len); + } else { + SDL_assert(audio->spec.size == len); - if (audio->stream == NULL) { /* no conversion necessary. */ - SDL_LockMutex(audio->mixer_lock); - callback(audio->callbackspec.userdata, (Uint8 *) stream, len); - SDL_UnlockMutex(audio->mixer_lock); - } else { /* streaming/converting */ - const int stream_len = audio->callbackspec.size; - const int ilen = (int) len; - while (SDL_AudioStreamAvailable(audio->stream) < ilen) { - callback(audio->callbackspec.userdata, audio->work_buffer, stream_len); - if (SDL_AudioStreamPut(audio->stream, audio->work_buffer, stream_len) == -1) { - SDL_AudioStreamClear(audio->stream); - SDL_AtomicSet(&audio->enabled, 0); - break; + if (audio->stream == NULL) { /* no conversion necessary. */ + callback(audio->callbackspec.userdata, (Uint8 *) stream, len); + } else { /* streaming/converting */ + const int stream_len = audio->callbackspec.size; + const int ilen = (int) len; + while (SDL_AudioStreamAvailable(audio->stream) < ilen) { + callback(audio->callbackspec.userdata, audio->work_buffer, stream_len); + if (SDL_AudioStreamPut(audio->stream, audio->work_buffer, stream_len) == -1) { + SDL_AudioStreamClear(audio->stream); + SDL_AtomicSet(&audio->enabled, 0); + break; + } } - } - const int got = SDL_AudioStreamGet(audio->stream, stream, ilen); - SDL_assert((got < 0) || (got == ilen)); - if (got != ilen) { - SDL_memset(stream, audio->spec.silence, len); + const int got = SDL_AudioStreamGet(audio->stream, stream, ilen); + SDL_assert((got < 0) || (got == ilen)); + if (got != ilen) { + SDL_memset(stream, audio->spec.silence, len); + } } } + + SDL_UnlockMutex(audio->mixer_lock); } static void diff -Nru libsdl2-2.0.22+dfsg/src/audio/nacl/SDL_naclaudio.c libsdl2-2.24.0+dfsg/src/audio/nacl/SDL_naclaudio.c --- libsdl2-2.0.22+dfsg/src/audio/nacl/SDL_naclaudio.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/audio/nacl/SDL_naclaudio.c 2022-06-02 02:01:57.000000000 +0000 @@ -49,8 +49,8 @@ const int len = (int) buffer_size; SDL_AudioDevice* _this = (SDL_AudioDevice*) data; SDL_AudioCallback callback = _this->callbackspec.callback; - - SDL_LockMutex(private->mutex); /* !!! FIXME: is this mutex necessary? */ + + SDL_LockMutex(_this->mixer_lock); /* Only do something if audio is enabled */ if (!SDL_AtomicGet(&_this->enabled) || SDL_AtomicGet(&_this->paused)) { @@ -58,34 +58,31 @@ SDL_AudioStreamClear(_this->stream); } SDL_memset(stream, _this->spec.silence, len); - return; - } + } else { + SDL_assert(_this->spec.size == len); - SDL_assert(_this->spec.size == len); - - if (_this->stream == NULL) { /* no conversion necessary. */ - SDL_LockMutex(_this->mixer_lock); - callback(_this->callbackspec.userdata, stream, len); - SDL_UnlockMutex(_this->mixer_lock); - } else { /* streaming/converting */ - const int stream_len = _this->callbackspec.size; - while (SDL_AudioStreamAvailable(_this->stream) < len) { - callback(_this->callbackspec.userdata, _this->work_buffer, stream_len); - if (SDL_AudioStreamPut(_this->stream, _this->work_buffer, stream_len) == -1) { - SDL_AudioStreamClear(_this->stream); - SDL_AtomicSet(&_this->enabled, 0); - break; + if (_this->stream == NULL) { /* no conversion necessary. */ + callback(_this->callbackspec.userdata, stream, len); + } else { /* streaming/converting */ + const int stream_len = _this->callbackspec.size; + while (SDL_AudioStreamAvailable(_this->stream) < len) { + callback(_this->callbackspec.userdata, _this->work_buffer, stream_len); + if (SDL_AudioStreamPut(_this->stream, _this->work_buffer, stream_len) == -1) { + SDL_AudioStreamClear(_this->stream); + SDL_AtomicSet(&_this->enabled, 0); + break; + } } - } - const int got = SDL_AudioStreamGet(_this->stream, stream, len); - SDL_assert((got < 0) || (got == len)); - if (got != len) { - SDL_memset(stream, _this->spec.silence, len); + const int got = SDL_AudioStreamGet(_this->stream, stream, len); + SDL_assert((got < 0) || (got == len)); + if (got != len) { + SDL_memset(stream, _this->spec.silence, len); + } } } - SDL_UnlockMutex(private->mutex); + SDL_UnlockMutex(_this->mixer_lock); } static void NACLAUDIO_CloseDevice(SDL_AudioDevice *device) { @@ -94,7 +91,6 @@ SDL_PrivateAudioData *hidden = (SDL_PrivateAudioData *) device->hidden; ppb_audio->StopPlayback(hidden->audio); - SDL_DestroyMutex(hidden->mutex); core->ReleaseResource(hidden->audio); } @@ -109,7 +105,6 @@ return SDL_OutOfMemory(); } - private->mutex = SDL_CreateMutex(); _this->spec.freq = 44100; _this->spec.format = AUDIO_S16LSB; _this->spec.channels = 2; diff -Nru libsdl2-2.0.22+dfsg/src/audio/nacl/SDL_naclaudio.h libsdl2-2.24.0+dfsg/src/audio/nacl/SDL_naclaudio.h --- libsdl2-2.0.22+dfsg/src/audio/nacl/SDL_naclaudio.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/audio/nacl/SDL_naclaudio.h 2022-06-02 02:01:57.000000000 +0000 @@ -34,8 +34,7 @@ #define private _this->hidden typedef struct SDL_PrivateAudioData { - SDL_mutex* mutex; - PP_Resource audio; + PP_Resource audio; } SDL_PrivateAudioData; #endif /* SDL_naclaudio_h_ */ diff -Nru libsdl2-2.0.22+dfsg/src/audio/netbsd/SDL_netbsdaudio.c libsdl2-2.24.0+dfsg/src/audio/netbsd/SDL_netbsdaudio.c --- libsdl2-2.0.22+dfsg/src/audio/netbsd/SDL_netbsdaudio.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/audio/netbsd/SDL_netbsdaudio.c 2022-06-02 02:01:57.000000000 +0000 @@ -56,7 +56,7 @@ NETBSDAUDIO_Status(_THIS) { #ifdef DEBUG_AUDIO - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ audio_info_t info; const struct audio_prinfo *prinfo; @@ -118,7 +118,7 @@ "", this->spec.format, this->spec.size); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ #endif /* DEBUG_AUDIO */ } diff -Nru libsdl2-2.0.22+dfsg/src/audio/openslES/SDL_openslES.c libsdl2-2.24.0+dfsg/src/audio/openslES/SDL_openslES.c --- libsdl2-2.0.22+dfsg/src/audio/openslES/SDL_openslES.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/audio/openslES/SDL_openslES.c 2022-08-13 03:48:10.000000000 +0000 @@ -131,6 +131,8 @@ static int openslES_CreateEngine(void) { + const SLInterfaceID ids[1] = { SL_IID_VOLUME }; + const SLboolean req[1] = { SL_BOOLEAN_FALSE }; SLresult result; LOGI("openSLES_CreateEngine()"); @@ -160,8 +162,6 @@ LOGI("EngineGetInterface OK"); /* create output mix */ - const SLInterfaceID ids[1] = { SL_IID_VOLUME }; - const SLboolean req[1] = { SL_BOOLEAN_FALSE }; result = (*engineEngine)->CreateOutputMix(engineEngine, &outputMixObject, 1, ids, req); if (SL_RESULT_SUCCESS != result) { LOGE("CreateOutputMix failed: %d", result); @@ -229,6 +229,12 @@ { struct SDL_PrivateAudioData *audiodata = this->hidden; SLDataFormat_PCM format_pcm; + SLDataLocator_AndroidSimpleBufferQueue loc_bufq; + SLDataSink audioSnk; + SLDataLocator_IODevice loc_dev; + SLDataSource audioSrc; + const SLInterfaceID ids[1] = { SL_IID_ANDROIDSIMPLEBUFFERQUEUE }; + const SLboolean req[1] = { SL_BOOLEAN_TRUE }; SLresult result; int i; @@ -250,11 +256,16 @@ this->spec.channels, (this->spec.format & 0x1000) ? "BE" : "LE", this->spec.samples); /* configure audio source */ - SLDataLocator_IODevice loc_dev = {SL_DATALOCATOR_IODEVICE, SL_IODEVICE_AUDIOINPUT, SL_DEFAULTDEVICEID_AUDIOINPUT, NULL}; - SLDataSource audioSrc = {&loc_dev, NULL}; + loc_dev.locatorType = SL_DATALOCATOR_IODEVICE; + loc_dev.deviceType = SL_IODEVICE_AUDIOINPUT; + loc_dev.deviceID = SL_DEFAULTDEVICEID_AUDIOINPUT; + loc_dev.device = NULL; + audioSrc.pLocator = &loc_dev; + audioSrc.pFormat = NULL; /* configure audio sink */ - SLDataLocator_AndroidSimpleBufferQueue loc_bufq = { SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, NUM_BUFFERS }; + loc_bufq.locatorType = SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE; + loc_bufq.numBuffers = NUM_BUFFERS; format_pcm.formatType = SL_DATAFORMAT_PCM; format_pcm.numChannels = this->spec.channels; @@ -264,17 +275,11 @@ format_pcm.endianness = SL_BYTEORDER_LITTLEENDIAN; format_pcm.channelMask = SL_SPEAKER_FRONT_CENTER; - SLDataSink audioSnk = { &loc_bufq, &format_pcm }; + audioSnk.pLocator = &loc_bufq; + audioSnk.pFormat = &format_pcm; /* create audio recorder */ /* (requires the RECORD_AUDIO permission) */ - const SLInterfaceID ids[1] = { - SL_IID_ANDROIDSIMPLEBUFFERQUEUE, - }; - const SLboolean req[1] = { - SL_BOOLEAN_TRUE, - }; - result = (*engineEngine)->CreateAudioRecorder(engineEngine, &recorderObject, &audioSrc, &audioSnk, 1, ids, req); if (SL_RESULT_SUCCESS != result) { LOGE("CreateAudioRecorder failed: %d", result); @@ -354,7 +359,6 @@ return 0; failed: - return SDL_SetError("Open device failed!"); } @@ -384,7 +388,6 @@ /* destroy buffer queue audio player object, and invalidate all associated interfaces */ if (bqPlayerObject != NULL) { - (*bqPlayerObject)->Destroy(bqPlayerObject); bqPlayerObject = NULL; @@ -406,8 +409,14 @@ openslES_CreatePCMPlayer(_THIS) { struct SDL_PrivateAudioData *audiodata = this->hidden; + SLDataLocator_AndroidSimpleBufferQueue loc_bufq; SLDataFormat_PCM format_pcm; SLAndroidDataFormat_PCM_EX format_pcm_ex; + SLDataSource audioSrc; + SLDataSink audioSnk; + SLDataLocator_OutputMix loc_outmix; + const SLInterfaceID ids[2] = { SL_IID_ANDROIDSIMPLEBUFFERQUEUE, SL_IID_VOLUME }; + const SLboolean req[2] = { SL_BOOLEAN_TRUE, SL_BOOLEAN_FALSE }; SLresult result; int i; @@ -442,7 +451,8 @@ this->spec.channels, (this->spec.format & 0x1000) ? "BE" : "LE", this->spec.samples); /* configure audio source */ - SLDataLocator_AndroidSimpleBufferQueue loc_bufq = { SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, NUM_BUFFERS }; + loc_bufq.locatorType = SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE; + loc_bufq.numBuffers = NUM_BUFFERS; format_pcm.formatType = SL_DATAFORMAT_PCM; format_pcm.numChannels = this->spec.channels; @@ -501,23 +511,16 @@ format_pcm_ex.representation = SL_ANDROID_PCM_REPRESENTATION_FLOAT; } - SLDataSource audioSrc = { &loc_bufq, SDL_AUDIO_ISFLOAT(this->spec.format) ? (void*)&format_pcm_ex : (void*)&format_pcm }; + audioSrc.pLocator = &loc_bufq; + audioSrc.pFormat = SDL_AUDIO_ISFLOAT(this->spec.format) ? (void*)&format_pcm_ex : (void*)&format_pcm; /* configure audio sink */ - SLDataLocator_OutputMix loc_outmix = { SL_DATALOCATOR_OUTPUTMIX, outputMixObject }; - SLDataSink audioSnk = { &loc_outmix, NULL }; + loc_outmix.locatorType = SL_DATALOCATOR_OUTPUTMIX; + loc_outmix.outputMix = outputMixObject; + audioSnk.pLocator = &loc_outmix; + audioSnk.pFormat = NULL; /* create audio player */ - const SLInterfaceID ids[2] = { - SL_IID_ANDROIDSIMPLEBUFFERQUEUE, - SL_IID_VOLUME - }; - - const SLboolean req[2] = { - SL_BOOLEAN_TRUE, - SL_BOOLEAN_FALSE, - }; - result = (*engineEngine)->CreateAudioPlayer(engineEngine, &bqPlayerObject, &audioSrc, &audioSnk, 2, ids, req); if (SL_RESULT_SUCCESS != result) { LOGE("CreateAudioPlayer failed: %d", result); @@ -590,7 +593,6 @@ return 0; failed: - return -1; } diff -Nru libsdl2-2.0.22+dfsg/src/audio/pipewire/SDL_pipewire.c libsdl2-2.24.0+dfsg/src/audio/pipewire/SDL_pipewire.c --- libsdl2-2.0.22+dfsg/src/audio/pipewire/SDL_pipewire.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/audio/pipewire/SDL_pipewire.c 2022-08-13 03:48:10.000000000 +0000 @@ -30,11 +30,12 @@ #include #include +#include /* * The following keys are defined for compatability when building against older versions of Pipewire - * prior to their introduction and can be removed if the minimum required Pipewire version is increased - * to or beyond their point of introduction. + * prior to their introduction and can be removed if the minimum required Pipewire build version is + * increased to or beyond their point of introduction. */ /* @@ -54,6 +55,14 @@ #endif /* + * Introduced in 0.3.44 + * Taken from src/pipewire/keys.h + */ +#ifndef PW_KEY_TARGET_OBJECT +#define PW_KEY_TARGET_OBJECT "target.object" +#endif + +/* * This seems to be a sane lower limit as Pipewire * uses it in several of it's own modules. */ @@ -62,6 +71,7 @@ #define PW_POD_BUFFER_LENGTH 1024 #define PW_THREAD_NAME_BUFFER_LENGTH 128 +#define PW_MAX_IDENTIFIER_LENGTH 256 enum PW_READY_FLAGS { @@ -76,7 +86,8 @@ static SDL_bool pipewire_initialized = SDL_FALSE; /* Pipewire entry points */ -static void (*PIPEWIRE_pw_init)(int *, char **); +static const char *(*PIPEWIRE_pw_get_library_version)(void); +static void (*PIPEWIRE_pw_init)(int *, char ***); static void (*PIPEWIRE_pw_deinit)(void); static struct pw_thread_loop *(*PIPEWIRE_pw_thread_loop_new)(const char *, const struct spa_dict *); static void (*PIPEWIRE_pw_thread_loop_destroy)(struct pw_thread_loop *); @@ -106,6 +117,10 @@ static int (*PIPEWIRE_pw_properties_set)(struct pw_properties *, const char *, const char *); static int (*PIPEWIRE_pw_properties_setf)(struct pw_properties *, const char *, const char *, ...) SPA_PRINTF_FUNC(3, 4); +static int pipewire_version_major; +static int pipewire_version_minor; +static int pipewire_version_patch; + #ifdef SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC static const char *pipewire_library = SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC; @@ -167,6 +182,7 @@ static int load_pipewire_syms() { + SDL_PIPEWIRE_SYM(pw_get_library_version); SDL_PIPEWIRE_SYM(pw_init); SDL_PIPEWIRE_SYM(pw_deinit); SDL_PIPEWIRE_SYM(pw_thread_loop_new); @@ -198,13 +214,31 @@ return 0; } +SDL_FORCE_INLINE SDL_bool +pipewire_version_at_least(int major, int minor, int patch) +{ + return (pipewire_version_major >= major) && + (pipewire_version_major > major || pipewire_version_minor >= minor) && + (pipewire_version_major > major || pipewire_version_minor > minor || pipewire_version_patch >= patch); +} + static int init_pipewire_library() { if (!load_pipewire_library()) { if (!load_pipewire_syms()) { - PIPEWIRE_pw_init(NULL, NULL); - return 0; + int nargs; + const char *version = PIPEWIRE_pw_get_library_version(); + nargs = SDL_sscanf(version, "%d.%d.%d", &pipewire_version_major, &pipewire_version_minor, &pipewire_version_patch); + if (nargs < 3) { + return -1; + } + + /* SDL can build against 0.3.20, but requires 0.3.24 */ + if (pipewire_version_at_least(0, 3, 24)) { + PIPEWIRE_pw_init(NULL, NULL); + return 0; + } } } @@ -223,8 +257,9 @@ { struct spa_list link; - Uint32 id; - int seq; + Uint32 id; + int seq; + SDL_bool persist; /* * NOTE: If used, this is *must* be allocated with SDL_malloc() or similar @@ -249,7 +284,10 @@ SDL_bool is_capture; SDL_AudioSpec spec; - char name[]; + const char *name; /* Friendly name */ + const char *path; /* OS identifier (i.e. ALSA endpoint) */ + + char buf[]; /* Buffer to hold the name and path strings. */ }; /* The global hotplug thread and associated objects. */ @@ -265,8 +303,8 @@ static SDL_bool hotplug_init_complete; static SDL_bool hotplug_events_enabled; -static Uint32 pipewire_default_sink_id = SPA_ID_INVALID; -static Uint32 pipewire_default_source_id = SPA_ID_INVALID; +static char *pipewire_default_sink_id = NULL; +static char *pipewire_default_source_id = NULL; /* The active node list */ static SDL_bool @@ -324,10 +362,10 @@ /* Find and move the default nodes to the beginning of the list */ spa_list_for_each_safe (n, temp, &hotplug_io_list, link) { - if (n->id == pipewire_default_sink_id) { + if (pipewire_default_sink_id != NULL && SDL_strcmp(n->path, pipewire_default_sink_id) == 0) { default_sink = n; spa_list_remove(&n->link); - } else if (n->id == pipewire_default_source_id) { + } else if (pipewire_default_source_id != NULL && SDL_strcmp(n->path, pipewire_default_source_id) == 0) { default_source = n; spa_list_remove(&n->link); } @@ -353,6 +391,30 @@ } } +static struct io_node* +io_list_get_by_id(Uint32 id) +{ + struct io_node *n, *temp; + spa_list_for_each_safe (n, temp, &hotplug_io_list, link) { + if (n->id == id) { + return n; + } + } + return NULL; +} + +static struct io_node* +io_list_get_by_path(char *path) +{ + struct io_node *n, *temp; + spa_list_for_each_safe (n, temp, &hotplug_io_list, link) { + if (SDL_strcmp(n->path, path) == 0) { + return n; + } + } + return NULL; +} + static void node_object_destroy(struct node_object *node) { @@ -462,7 +524,7 @@ { struct node_object *node = object; - if (id == PW_ID_CORE && seq == node->seq) { + if (id == PW_ID_CORE && seq == node->seq && !node->persist) { node_object_destroy(node); } } @@ -591,17 +653,47 @@ static const struct pw_node_events interface_node_events = { PW_VERSION_NODE_EVENTS, .info = node_event_info, .param = node_event_param }; +static char* +get_name_from_json(const char *json) +{ + struct spa_json parser[2]; + char key[7]; /* "name" */ + char value[PW_MAX_IDENTIFIER_LENGTH]; + spa_json_init(&parser[0], json, SDL_strlen(json)); + if (spa_json_enter_object(&parser[0], &parser[1]) <= 0) { + /* Not actually JSON */ + return NULL; + } + if (spa_json_get_string(&parser[1], key, sizeof(key)) <= 0) { + /* Not actually a key/value pair */ + return NULL; + } + if (spa_json_get_string(&parser[1], value, sizeof(value)) <= 0) { + /* Somehow had a key with no value? */ + return NULL; + } + return SDL_strdup(value); +} + /* Metadata node callback */ static int metadata_property(void *object, Uint32 subject, const char *key, const char *type, const char *value) { - if (subject == PW_ID_CORE && key != NULL && value != NULL) { - Uint32 val = SDL_atoi(value); + struct node_object *node = object; + if (subject == PW_ID_CORE && key != NULL && value != NULL) { if (!SDL_strcmp(key, "default.audio.sink")) { - pipewire_default_sink_id = val; + if (pipewire_default_sink_id != NULL) { + SDL_free(pipewire_default_sink_id); + } + pipewire_default_sink_id = get_name_from_json(value); + node->persist = SDL_TRUE; } else if (!SDL_strcmp(key, "default.audio.source")) { - pipewire_default_source_id = val; + if (pipewire_default_source_id != NULL) { + SDL_free(pipewire_default_source_id); + } + pipewire_default_source_id = get_name_from_json(value); + node->persist = SDL_TRUE; } } @@ -623,9 +715,11 @@ if (media_class) { const char *node_desc; + const char *node_path; struct io_node *io; SDL_bool is_capture; - int str_buffer_len; + int desc_buffer_len; + int path_buffer_len; /* Just want sink and capture */ if (!SDL_strcasecmp(media_class, "Audio/Sink")) { @@ -637,8 +731,9 @@ } node_desc = spa_dict_lookup(props, PW_KEY_NODE_DESCRIPTION); + node_path = spa_dict_lookup(props, PW_KEY_NODE_NAME); - if (node_desc) { + if (node_desc && node_path) { node = node_object_new(id, type, version, &interface_node_events, &interface_core_events); if (node == NULL) { SDL_SetError("Pipewire: Failed to allocate interface node"); @@ -646,8 +741,9 @@ } /* Allocate and initialize the I/O node information struct */ - str_buffer_len = SDL_strlen(node_desc) + 1; - node->userdata = io = SDL_calloc(1, sizeof(struct io_node) + str_buffer_len); + desc_buffer_len = SDL_strlen(node_desc) + 1; + path_buffer_len = SDL_strlen(node_path) + 1; + node->userdata = io = SDL_calloc(1, sizeof(struct io_node) + desc_buffer_len + path_buffer_len); if (io == NULL) { node_object_destroy(node); SDL_OutOfMemory(); @@ -658,7 +754,10 @@ io->id = id; io->is_capture = is_capture; io->spec.format = AUDIO_F32; /* Pipewire uses floats internally, other formats require conversion. */ - SDL_strlcpy(io->name, node_desc, str_buffer_len); + io->name = io->buf; + io->path = io->buf + desc_buffer_len; + SDL_strlcpy(io->buf, node_desc, desc_buffer_len); + SDL_strlcpy(io->buf + desc_buffer_len, node_path, path_buffer_len); /* Update sync points */ hotplug_core_sync(node); @@ -744,8 +843,14 @@ hotplug_init_complete = SDL_FALSE; hotplug_events_enabled = SDL_FALSE; - pipewire_default_sink_id = SPA_ID_INVALID; - pipewire_default_source_id = SPA_ID_INVALID; + if (pipewire_default_sink_id != NULL) { + SDL_free(pipewire_default_sink_id); + pipewire_default_sink_id = NULL; + } + if (pipewire_default_source_id != NULL) { + SDL_free(pipewire_default_source_id); + pipewire_default_source_id = NULL; + } if (hotplug_registry) { PIPEWIRE_pw_proxy_destroy((struct pw_proxy *)hotplug_registry); @@ -910,6 +1015,7 @@ * and run the callback with the work buffer to keep the callback * firing regularly in case the audio is being used as a timer. */ + SDL_LockMutex(this->mixer_lock); if (!SDL_AtomicGet(&this->paused)) { if (SDL_AtomicGet(&this->enabled)) { dst = spa_buf->datas[0].data; @@ -919,18 +1025,13 @@ } if (!this->stream) { - SDL_LockMutex(this->mixer_lock); this->callbackspec.callback(this->callbackspec.userdata, dst, this->callbackspec.size); - SDL_UnlockMutex(this->mixer_lock); } else { int got; /* Fire the callback until we have enough to fill a buffer */ while (SDL_AudioStreamAvailable(this->stream) < this->spec.size) { - SDL_LockMutex(this->mixer_lock); this->callbackspec.callback(this->callbackspec.userdata, this->work_buffer, this->callbackspec.size); - SDL_UnlockMutex(this->mixer_lock); - SDL_AudioStreamPut(this->stream, this->work_buffer, this->callbackspec.size); } @@ -940,6 +1041,7 @@ } else { SDL_memset(spa_buf->datas[0].data, this->spec.silence, this->spec.size); } + SDL_UnlockMutex(this->mixer_lock); spa_buf->datas[0].chunk->offset = 0; spa_buf->datas[0].chunk->stride = this->hidden->stride; @@ -1078,7 +1180,7 @@ struct SDL_PrivateAudioData *priv; struct pw_properties *props; const char *app_name, *stream_name, *stream_role, *error; - const Uint32 node_id = this->handle == NULL ? PW_ID_ANY : PW_HANDLE_TO_ID(this->handle); + Uint32 node_id = this->handle == NULL ? PW_ID_ANY : PW_HANDLE_TO_ID(this->handle); SDL_bool iscapture = this->iscapture; int res; @@ -1133,17 +1235,8 @@ return SDL_SetError("Pipewire: Failed to create stream loop (%i)", errno); } - /* - * Load the realtime module so Pipewire can set the loop thread to the appropriate priority. - * - * NOTE: Pipewire versions 0.3.22 or higher require the PW_KEY_CONFIG_NAME property (with client-rt.conf), - * lower versions require explicitly specifying the 'rtkit' module. - * - * PW_KEY_CONTEXT_PROFILE_MODULES is deprecated and can be safely removed if the minimum required - * Pipewire version is increased to 0.3.22 or higher at some point. - */ - props = PIPEWIRE_pw_properties_new(PW_KEY_CONFIG_NAME, "client-rt.conf", - PW_KEY_CONTEXT_PROFILE_MODULES, "default,rtkit", NULL); + /* Load the realtime module so Pipewire can set the loop thread to the appropriate priority. */ + props = PIPEWIRE_pw_properties_new(PW_KEY_CONFIG_NAME, "client-rt.conf", NULL); if (props == NULL) { return SDL_SetError("Pipewire: Failed to create stream context properties (%i)", errno); } @@ -1168,6 +1261,26 @@ PIPEWIRE_pw_properties_setf(props, PW_KEY_NODE_RATE, "1/%u", this->spec.freq); PIPEWIRE_pw_properties_set(props, PW_KEY_NODE_ALWAYS_PROCESS, "true"); + /* + * Pipewire 0.3.44 introduced PW_KEY_TARGET_OBJECT that takes either a path + * (PW_KEY_NODE_NAME) or node serial number (PE_KEY_OBJECT_SERIAL) to connect + * the stream to its target. The target_id parameter in pw_stream_connect() is + * now deprecated and should always be PW_ID_ANY. + */ + if (pipewire_version_at_least(0, 3, 44)) { + if (node_id != PW_ID_ANY) { + const struct io_node *node; + + PIPEWIRE_pw_thread_loop_lock(hotplug_loop); + if ((node = io_list_get_by_id(node_id))) { + PIPEWIRE_pw_properties_set(props, PW_KEY_TARGET_OBJECT, node->path); + } + PIPEWIRE_pw_thread_loop_unlock(hotplug_loop); + + node_id = PW_ID_ANY; + } + } + /* Create the new stream */ priv->stream = PIPEWIRE_pw_stream_new_simple(PIPEWIRE_pw_thread_loop_get_loop(priv->loop), stream_name, props, iscapture ? &stream_input_events : &stream_output_events, this); @@ -1231,6 +1344,45 @@ SDL_free(this->hidden); } +static int +PIPEWIRE_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int iscapture) +{ + struct io_node *node; + char *target; + int ret = 0; + + PIPEWIRE_pw_thread_loop_lock(hotplug_loop); + + if (iscapture) { + if (pipewire_default_source_id == NULL) { + ret = SDL_SetError("PipeWire could not find a default source"); + goto failed; + } + target = pipewire_default_source_id; + } else { + if (pipewire_default_sink_id == NULL) { + ret = SDL_SetError("PipeWire could not find a default sink"); + goto failed; + } + target = pipewire_default_sink_id; + } + + node = io_list_get_by_path(target); + if (node == NULL) { + ret = SDL_SetError("PipeWire device list is out of sync with defaults"); + goto failed; + } + + if (name != NULL) { + *name = SDL_strdup(node->name); + } + SDL_copyp(spec, &node->spec); + +failed: + PIPEWIRE_pw_thread_loop_unlock(hotplug_loop); + return ret; +} + static void PIPEWIRE_Deinitialize() { @@ -1258,13 +1410,15 @@ } /* Set the function pointers */ - impl->DetectDevices = PIPEWIRE_DetectDevices; - impl->OpenDevice = PIPEWIRE_OpenDevice; - impl->CloseDevice = PIPEWIRE_CloseDevice; - impl->Deinitialize = PIPEWIRE_Deinitialize; + impl->DetectDevices = PIPEWIRE_DetectDevices; + impl->OpenDevice = PIPEWIRE_OpenDevice; + impl->CloseDevice = PIPEWIRE_CloseDevice; + impl->Deinitialize = PIPEWIRE_Deinitialize; + impl->GetDefaultAudioInfo = PIPEWIRE_GetDefaultAudioInfo; impl->HasCaptureSupport = SDL_TRUE; impl->ProvidesOwnCallbackThread = SDL_TRUE; + impl->SupportsNonPow2Samples = SDL_TRUE; return SDL_TRUE; } diff -Nru libsdl2-2.0.22+dfsg/src/audio/ps2/SDL_ps2audio.c libsdl2-2.24.0+dfsg/src/audio/ps2/SDL_ps2audio.c --- libsdl2-2.0.22+dfsg/src/audio/ps2/SDL_ps2audio.c 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/audio/ps2/SDL_ps2audio.c 2022-08-19 15:46:21.000000000 +0000 @@ -0,0 +1,163 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +/* Output audio to nowhere... */ + +#include "SDL_timer.h" +#include "SDL_audio.h" +#include "../SDL_audio_c.h" +#include "SDL_ps2audio.h" + +#include +#include +#include +#include + +/* The tag name used by PS2 audio */ +#define PS2AUDIO_DRIVER_NAME "ps2" + +static int +PS2AUDIO_OpenDevice(_THIS, const char *devname) +{ + int i, mixlen; + struct audsrv_fmt_t format; + + this->hidden = (struct SDL_PrivateAudioData *) + SDL_malloc(sizeof(*this->hidden)); + if (this->hidden == NULL) { + return SDL_OutOfMemory(); + } + SDL_zerop(this->hidden); + + /* This is the native supported audio PS2 config */ + this->spec.freq = 48000; + this->spec.samples = 512; + this->spec.channels = 2; + this->spec.format = AUDIO_S16LSB; + + SDL_CalculateAudioSpec(&this->spec); + + format.bits = 16; + format.freq = this->spec.freq; + format.channels = this->spec.channels; + + this->hidden->channel = audsrv_set_format(&format); + audsrv_set_volume(MAX_VOLUME); + + if (this->hidden->channel < 0) { + free(this->hidden->rawbuf); + this->hidden->rawbuf = NULL; + return SDL_SetError("Couldn't reserve hardware channel"); + } + + /* Update the fragment size as size in bytes. */ + SDL_CalculateAudioSpec(&this->spec); + + /* Allocate the mixing buffer. Its size and starting address must + be a multiple of 64 bytes. Our sample count is already a multiple of + 64, so spec->size should be a multiple of 64 as well. */ + mixlen = this->spec.size * NUM_BUFFERS; + this->hidden->rawbuf = (Uint8 *) memalign(64, mixlen); + if (this->hidden->rawbuf == NULL) { + return SDL_SetError("Couldn't allocate mixing buffer"); + } + + SDL_memset(this->hidden->rawbuf, 0, mixlen); + for (i = 0; i < NUM_BUFFERS; i++) { + this->hidden->mixbufs[i] = &this->hidden->rawbuf[i * this->spec.size]; + } + + this->hidden->next_buffer = 0; + return 0; +} + +static void PS2AUDIO_PlayDevice(_THIS) +{ + uint8_t *mixbuf = this->hidden->mixbufs[this->hidden->next_buffer]; + audsrv_play_audio((char *)mixbuf, this->spec.size); + + this->hidden->next_buffer = (this->hidden->next_buffer + 1) % NUM_BUFFERS; +} + +/* This function waits until it is possible to write a full sound buffer */ +static void PS2AUDIO_WaitDevice(_THIS) +{ + audsrv_wait_audio(this->spec.size); +} + +static Uint8 *PS2AUDIO_GetDeviceBuf(_THIS) +{ + return this->hidden->mixbufs[this->hidden->next_buffer]; +} + +static void PS2AUDIO_CloseDevice(_THIS) +{ + if (this->hidden->channel >= 0) { + audsrv_stop_audio(); + this->hidden->channel = -1; + } + + if (this->hidden->rawbuf != NULL) { + free(this->hidden->rawbuf); + this->hidden->rawbuf = NULL; + } +} + +static void PS2AUDIO_ThreadInit(_THIS) +{ + /* Increase the priority of this audio thread by 1 to put it + ahead of other SDL threads. */ + int32_t thid; + ee_thread_status_t status; + thid = GetThreadId(); + if (ReferThreadStatus(GetThreadId(), &status) == 0) { + ChangeThreadPriority(thid, status.current_priority - 1); + } +} + +static void PS2AUDIO_Deinitialize(void) +{ + deinit_audio_driver(); +} + +static SDL_bool PS2AUDIO_Init(SDL_AudioDriverImpl * impl) +{ + if(init_audio_driver() < 0) + return SDL_FALSE; + + /* Set the function pointers */ + impl->OpenDevice = PS2AUDIO_OpenDevice; + impl->PlayDevice = PS2AUDIO_PlayDevice; + impl->WaitDevice = PS2AUDIO_WaitDevice; + impl->GetDeviceBuf = PS2AUDIO_GetDeviceBuf; + impl->CloseDevice = PS2AUDIO_CloseDevice; + impl->ThreadInit = PS2AUDIO_ThreadInit; + impl->Deinitialize = PS2AUDIO_Deinitialize; + impl->OnlyHasDefaultOutputDevice = SDL_TRUE; + return SDL_TRUE; /* this audio target is available. */ +} + +AudioBootStrap PS2AUDIO_bootstrap = { + "ps2", "PS2 audio driver", PS2AUDIO_Init, SDL_FALSE +}; + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/audio/ps2/SDL_ps2audio.h libsdl2-2.24.0+dfsg/src/audio/ps2/SDL_ps2audio.h --- libsdl2-2.0.22+dfsg/src/audio/ps2/SDL_ps2audio.h 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/audio/ps2/SDL_ps2audio.h 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,46 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifndef SDL_ps2audio_h_ +#define SDL_ps2audio_h_ + +#include "../SDL_sysaudio.h" + +/* Hidden "this" pointer for the audio functions */ +#define _THIS SDL_AudioDevice *this + +#define NUM_BUFFERS 2 + +struct SDL_PrivateAudioData +{ + /* The hardware output channel. */ + int channel; + /* The raw allocated mixing buffer. */ + Uint8 *rawbuf; + /* Individual mixing buffers. */ + Uint8 *mixbufs[NUM_BUFFERS]; + /* Index of the next available mixing buffer. */ + int next_buffer; +}; + +#endif /* SDL_ps2audio_h_ */ +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/audio/pulseaudio/SDL_pulseaudio.c libsdl2-2.24.0+dfsg/src/audio/pulseaudio/SDL_pulseaudio.c --- libsdl2-2.0.22+dfsg/src/audio/pulseaudio/SDL_pulseaudio.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/audio/pulseaudio/SDL_pulseaudio.c 2022-08-13 03:48:10.000000000 +0000 @@ -107,8 +107,6 @@ static pa_stream_state_t (*PULSEAUDIO_pa_stream_get_state) (const pa_stream *); static size_t (*PULSEAUDIO_pa_stream_writable_size) (const pa_stream *); static size_t (*PULSEAUDIO_pa_stream_readable_size) (const pa_stream *); -static int (*PULSEAUDIO_pa_stream_begin_write) (pa_stream *, void **, size_t*); -static int (*PULSEAUDIO_pa_stream_cancel_write) (pa_stream *); static int (*PULSEAUDIO_pa_stream_write) (pa_stream *, const void *, size_t, pa_free_cb_t, int64_t, pa_seek_mode_t); static pa_operation * (*PULSEAUDIO_pa_stream_drain) (pa_stream *, @@ -119,6 +117,8 @@ pa_stream_success_cb_t, void *); static int (*PULSEAUDIO_pa_stream_disconnect) (pa_stream *); static void (*PULSEAUDIO_pa_stream_unref) (pa_stream *); +static void (*PULSEAUDIO_pa_stream_set_write_callback)(pa_stream *, pa_stream_request_cb_t, void *); +static pa_operation * (*PULSEAUDIO_pa_context_get_server_info)(pa_context *, pa_server_info_cb_t, void *); static int load_pulseaudio_syms(void); @@ -222,8 +222,6 @@ SDL_PULSEAUDIO_SYM(pa_stream_writable_size); SDL_PULSEAUDIO_SYM(pa_stream_readable_size); SDL_PULSEAUDIO_SYM(pa_stream_write); - SDL_PULSEAUDIO_SYM(pa_stream_begin_write); - SDL_PULSEAUDIO_SYM(pa_stream_cancel_write); SDL_PULSEAUDIO_SYM(pa_stream_drain); SDL_PULSEAUDIO_SYM(pa_stream_disconnect); SDL_PULSEAUDIO_SYM(pa_stream_peek); @@ -232,6 +230,8 @@ SDL_PULSEAUDIO_SYM(pa_stream_unref); SDL_PULSEAUDIO_SYM(pa_channel_map_init_auto); SDL_PULSEAUDIO_SYM(pa_strerror); + SDL_PULSEAUDIO_SYM(pa_stream_set_write_callback); + SDL_PULSEAUDIO_SYM(pa_context_get_server_info); return 0; } @@ -359,51 +359,56 @@ static void PULSEAUDIO_WaitDevice(_THIS) { - struct SDL_PrivateAudioData *h = this->hidden; + /* this is a no-op; we wait in PULSEAUDIO_PlayDevice now. */ +} - while (SDL_AtomicGet(&this->enabled)) { - if (PULSEAUDIO_pa_context_get_state(h->context) != PA_CONTEXT_READY || - PULSEAUDIO_pa_stream_get_state(h->stream) != PA_STREAM_READY || - PULSEAUDIO_pa_mainloop_iterate(h->mainloop, 1, NULL) < 0) { - SDL_OpenedAudioDeviceDisconnected(this); - return; - } - if (PULSEAUDIO_pa_stream_writable_size(h->stream) >= (h->mixlen/8)) { - return; - } - } +static void WriteCallback(pa_stream *p, size_t nbytes, void *userdata) +{ + struct SDL_PrivateAudioData *h = (struct SDL_PrivateAudioData *) userdata; + /*printf("PULSEAUDIO WRITE CALLBACK! nbytes=%u\n", (unsigned int) nbytes);*/ + h->bytes_requested += nbytes; } static void PULSEAUDIO_PlayDevice(_THIS) { - /* Write the audio data */ struct SDL_PrivateAudioData *h = this->hidden; - if (SDL_AtomicGet(&this->enabled)) { - if (PULSEAUDIO_pa_stream_write(h->stream, h->pabuf, h->mixlen, NULL, 0LL, PA_SEEK_RELATIVE) < 0) { + int available = h->mixlen; + int written = 0; + int cpy; + + /*printf("PULSEAUDIO PLAYDEVICE START! mixlen=%d\n", available);*/ + + while (SDL_AtomicGet(&this->enabled) && (available > 0)) { + cpy = SDL_min(h->bytes_requested, available); + if (cpy) { + if (PULSEAUDIO_pa_stream_write(h->stream, h->mixbuf + written, cpy, NULL, 0LL, PA_SEEK_RELATIVE) < 0) { + SDL_OpenedAudioDeviceDisconnected(this); + return; + } + /*printf("PULSEAUDIO FEED! nbytes=%u\n", (unsigned int) cpy);*/ + h->bytes_requested -= cpy; + written += cpy; + available -= cpy; + } + + /* let WriteCallback fire if necessary. */ + /*printf("PULSEAUDIO ITERATE!\n");*/ + if (PULSEAUDIO_pa_context_get_state(h->context) != PA_CONTEXT_READY || + PULSEAUDIO_pa_stream_get_state(h->stream) != PA_STREAM_READY || + PULSEAUDIO_pa_mainloop_iterate(h->mainloop, 1, NULL) < 0) { SDL_OpenedAudioDeviceDisconnected(this); + return; } } + + /*printf("PULSEAUDIO PLAYDEVICE END! written=%d\n", written);*/ } static Uint8 * PULSEAUDIO_GetDeviceBuf(_THIS) { - struct SDL_PrivateAudioData *h = this->hidden; - size_t nbytes = h->mixlen; - int ret; - - ret = PULSEAUDIO_pa_stream_begin_write(h->stream, &h->pabuf, &nbytes); - - if (ret != 0) { - /* fall back it intermediate buffer */ - h->pabuf = h->mixbuf; - } else if (nbytes < h->mixlen) { - PULSEAUDIO_pa_stream_cancel_write(h->stream); - h->pabuf = h->mixbuf; - } - - return (Uint8 *)h->pabuf; + return this->hidden->mixbuf; } @@ -524,7 +529,7 @@ static SDL_bool FindDeviceName(struct SDL_PrivateAudioData *h, const SDL_bool iscapture, void *handle) { - const uint32_t idx = ((uint32_t) ((size_t) handle)) - 1; + const uint32_t idx = ((uint32_t) ((intptr_t) handle)) - 1; if (handle == NULL) { /* NULL == default device. */ return SDL_TRUE; @@ -604,9 +609,6 @@ paspec.format = format; /* Calculate the final parameters for this audio specification */ -#ifdef PA_STREAM_ADJUST_LATENCY - this->spec.samples /= 2; /* Mix in smaller chunck to avoid underruns */ -#endif SDL_CalculateAudioSpec(&this->spec); /* Allocate mixing buffer */ @@ -623,22 +625,12 @@ paspec.rate = this->spec.freq; /* Reduced prebuffering compared to the defaults. */ -#ifdef PA_STREAM_ADJUST_LATENCY paattr.fragsize = this->spec.size; - /* 2x original requested bufsize */ - paattr.tlength = h->mixlen * 4; + paattr.tlength = h->mixlen; paattr.prebuf = -1; paattr.maxlength = -1; - /* -1 can lead to pa_stream_writable_size() >= mixlen never being true */ - paattr.minreq = h->mixlen; - flags = PA_STREAM_ADJUST_LATENCY; -#else - paattr.fragsize = this->spec.size; - paattr.tlength = h->mixlen*2; - paattr.prebuf = h->mixlen*2; - paattr.maxlength = h->mixlen*2; - paattr.minreq = h->mixlen; -#endif + paattr.minreq = -1; + flags |= PA_STREAM_ADJUST_LATENCY; if (ConnectToPulseServer(&h->mainloop, &h->context) < 0) { return SDL_SetError("Could not connect to PulseAudio server"); @@ -675,6 +667,7 @@ if (iscapture) { rc = PULSEAUDIO_pa_stream_connect_record(h->stream, h->device_name, &paattr, flags); } else { + PULSEAUDIO_pa_stream_set_write_callback(h->stream, WriteCallback, h); rc = PULSEAUDIO_pa_stream_connect_playback(h->stream, h->device_name, &paattr, flags, NULL, NULL); } @@ -700,6 +693,13 @@ static pa_context *hotplug_context = NULL; static SDL_Thread *hotplug_thread = NULL; +/* These are the OS identifiers (i.e. ALSA strings)... */ +static char *default_sink_path = NULL; +static char *default_source_path = NULL; +/* ... and these are the descriptions we use in GetDefaultAudioInfo. */ +static char *default_sink_name = NULL; +static char *default_source_name = NULL; + /* device handles are device index + 1, cast to void*, so we never pass a NULL. */ static SDL_AudioFormat @@ -730,6 +730,7 @@ SinkInfoCallback(pa_context *c, const pa_sink_info *i, int is_last, void *data) { SDL_AudioSpec spec; + SDL_bool add = (SDL_bool) ((intptr_t) data); if (i) { spec.freq = i->sample_spec.rate; spec.channels = i->sample_spec.channels; @@ -740,7 +741,16 @@ spec.callback = NULL; spec.userdata = NULL; - SDL_AddAudioDevice(SDL_FALSE, i->description, &spec, (void *) ((size_t) i->index+1)); + if (add) { + SDL_AddAudioDevice(SDL_FALSE, i->description, &spec, (void *) ((intptr_t) i->index+1)); + } + + if (default_sink_path != NULL && SDL_strcmp(i->name, default_sink_path) == 0) { + if (default_sink_name != NULL) { + SDL_free(default_sink_name); + } + default_sink_name = SDL_strdup(i->description); + } } } @@ -749,6 +759,7 @@ SourceInfoCallback(pa_context *c, const pa_source_info *i, int is_last, void *data) { SDL_AudioSpec spec; + SDL_bool add = (SDL_bool) ((intptr_t) data); if (i) { /* Maybe skip "monitor" sources. These are just output from other sinks. */ if (include_monitors || (i->monitor_of_sink == PA_INVALID_INDEX)) { @@ -761,30 +772,59 @@ spec.callback = NULL; spec.userdata = NULL; - SDL_AddAudioDevice(SDL_TRUE, i->description, &spec, (void *) ((size_t) i->index+1)); + if (add) { + SDL_AddAudioDevice(SDL_TRUE, i->description, &spec, (void *) ((intptr_t) i->index+1)); + } + + if (default_source_path != NULL && SDL_strcmp(i->name, default_source_path) == 0) { + if (default_source_name != NULL) { + SDL_free(default_source_name); + } + default_source_name = SDL_strdup(i->description); + } } } } +static void +ServerInfoCallback(pa_context *c, const pa_server_info *i, void *data) +{ + if (default_sink_path != NULL) { + SDL_free(default_sink_path); + } + if (default_source_path != NULL) { + SDL_free(default_source_path); + } + default_sink_path = SDL_strdup(i->default_sink_name); + default_source_path = SDL_strdup(i->default_source_name); +} + /* This is called when PulseAudio has a device connected/removed/changed. */ static void HotplugCallback(pa_context *c, pa_subscription_event_type_t t, uint32_t idx, void *data) { const SDL_bool added = ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_NEW); const SDL_bool removed = ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE); + const SDL_bool changed = ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_CHANGE); - if (added || removed) { /* we only care about add/remove events. */ + if (added || removed || changed) { /* we only care about add/remove events. */ const SDL_bool sink = ((t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) == PA_SUBSCRIPTION_EVENT_SINK); const SDL_bool source = ((t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) == PA_SUBSCRIPTION_EVENT_SOURCE); /* adds need sink details from the PulseAudio server. Another callback... */ - if (added && sink) { - PULSEAUDIO_pa_context_get_sink_info_by_index(hotplug_context, idx, SinkInfoCallback, NULL); - } else if (added && source) { - PULSEAUDIO_pa_context_get_source_info_by_index(hotplug_context, idx, SourceInfoCallback, NULL); + if ((added || changed) && sink) { + if (changed) { + PULSEAUDIO_pa_context_get_server_info(hotplug_context, ServerInfoCallback, NULL); + } + PULSEAUDIO_pa_context_get_sink_info_by_index(hotplug_context, idx, SinkInfoCallback, (void*) ((intptr_t) added)); + } else if ((added || changed) && source) { + if (changed) { + PULSEAUDIO_pa_context_get_server_info(hotplug_context, ServerInfoCallback, NULL); + } + PULSEAUDIO_pa_context_get_source_info_by_index(hotplug_context, idx, SourceInfoCallback, (void*) ((intptr_t) added)); } else if (removed && (sink || source)) { /* removes we can handle just with the device index. */ - SDL_RemoveAudioDevice(source != 0, (void *) ((size_t) idx+1)); + SDL_RemoveAudioDevice(source != 0, (void *) ((intptr_t) idx+1)); } } } @@ -805,13 +845,46 @@ static void PULSEAUDIO_DetectDevices() { - WaitForPulseOperation(hotplug_mainloop, PULSEAUDIO_pa_context_get_sink_info_list(hotplug_context, SinkInfoCallback, NULL)); - WaitForPulseOperation(hotplug_mainloop, PULSEAUDIO_pa_context_get_source_info_list(hotplug_context, SourceInfoCallback, NULL)); + WaitForPulseOperation(hotplug_mainloop, PULSEAUDIO_pa_context_get_server_info(hotplug_context, ServerInfoCallback, NULL)); + WaitForPulseOperation(hotplug_mainloop, PULSEAUDIO_pa_context_get_sink_info_list(hotplug_context, SinkInfoCallback, (void*) ((intptr_t) SDL_TRUE))); + WaitForPulseOperation(hotplug_mainloop, PULSEAUDIO_pa_context_get_source_info_list(hotplug_context, SourceInfoCallback, (void*) ((intptr_t) SDL_TRUE))); /* ok, we have a sane list, let's set up hotplug notifications now... */ hotplug_thread = SDL_CreateThreadInternal(HotplugThread, "PulseHotplug", 256 * 1024, NULL); } +static int +PULSEAUDIO_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int iscapture) +{ + int i; + int numdevices; + + char *target; + if (iscapture) { + if (default_source_name == NULL) { + return SDL_SetError("PulseAudio could not find a default source"); + } + target = default_source_name; + } else { + if (default_sink_name == NULL) { + return SDL_SetError("PulseAudio could not find a default sink"); + } + target = default_sink_name; + } + + numdevices = SDL_GetNumAudioDevices(iscapture); + for (i = 0; i < numdevices; i += 1) { + if (SDL_strcmp(SDL_GetAudioDeviceName(i, iscapture), target) == 0) { + if (name != NULL) { + *name = SDL_strdup(target); + } + SDL_GetAudioDeviceSpec(i, iscapture, spec); + return 0; + } + } + return SDL_SetError("Could not find default PulseAudio device"); +} + static void PULSEAUDIO_Deinitialize(void) { @@ -825,6 +898,23 @@ hotplug_mainloop = NULL; hotplug_context = NULL; + if (default_sink_path != NULL) { + SDL_free(default_sink_path); + default_sink_path = NULL; + } + if (default_source_path != NULL) { + SDL_free(default_source_path); + default_source_path = NULL; + } + if (default_sink_name != NULL) { + SDL_free(default_sink_name); + default_sink_name = NULL; + } + if (default_source_name != NULL) { + SDL_free(default_source_name); + default_source_name = NULL; + } + UnloadPulseAudioLibrary(); } @@ -852,8 +942,10 @@ impl->Deinitialize = PULSEAUDIO_Deinitialize; impl->CaptureFromDevice = PULSEAUDIO_CaptureFromDevice; impl->FlushCapture = PULSEAUDIO_FlushCapture; + impl->GetDefaultAudioInfo = PULSEAUDIO_GetDefaultAudioInfo; impl->HasCaptureSupport = SDL_TRUE; + impl->SupportsNonPow2Samples = SDL_TRUE; return SDL_TRUE; /* this audio target is available. */ } diff -Nru libsdl2-2.0.22+dfsg/src/audio/pulseaudio/SDL_pulseaudio.h libsdl2-2.24.0+dfsg/src/audio/pulseaudio/SDL_pulseaudio.h --- libsdl2-2.0.22+dfsg/src/audio/pulseaudio/SDL_pulseaudio.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/audio/pulseaudio/SDL_pulseaudio.h 2022-06-02 02:01:57.000000000 +0000 @@ -43,11 +43,7 @@ Uint8 *mixbuf; int mixlen; - /* Pointer to the actual buffer in use in the current - GetDeviceBuf() -> PlayDevice() iteration. - Can be either the pointer returned by pa_stream_begin_write() - or mixbuf */ - void *pabuf; + int bytes_requested; /* bytes of data the hardware wants _now_. */ const Uint8 *capturebuf; int capturelen; diff -Nru libsdl2-2.0.22+dfsg/src/audio/qsa/SDL_qsa_audio.c libsdl2-2.24.0+dfsg/src/audio/qsa/SDL_qsa_audio.c --- libsdl2-2.0.22+dfsg/src/audio/qsa/SDL_qsa_audio.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/audio/qsa/SDL_qsa_audio.c 2022-08-13 03:48:10.000000000 +0000 @@ -260,7 +260,7 @@ QSA_OpenDevice(_THIS, const char *devname) { const QSA_Device *device = (const QSA_Device *) this->handle; - SDL_Bool iscapture = this->iscapture; + SDL_bool iscapture = this->iscapture; int status = 0; int format = 0; SDL_AudioFormat test_format; diff -Nru libsdl2-2.0.22+dfsg/src/audio/SDL_audio.c libsdl2-2.24.0+dfsg/src/audio/SDL_audio.c --- libsdl2-2.0.22+dfsg/src/audio/SDL_audio.c 2022-04-21 17:37:37.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/audio/SDL_audio.c 2022-08-13 03:48:10.000000000 +0000 @@ -27,6 +27,7 @@ #include "SDL_audio_c.h" #include "SDL_sysaudio.h" #include "../thread/SDL_systhread.h" +#include "../SDL_utils_c.h" #define _THIS SDL_AudioDevice *_this @@ -95,6 +96,9 @@ #if SDL_AUDIO_DRIVER_ANDROID &ANDROIDAUDIO_bootstrap, #endif +#if SDL_AUDIO_DRIVER_PS2 + &PS2AUDIO_bootstrap, +#endif #if SDL_AUDIO_DRIVER_PSP &PSPAUDIO_bootstrap, #endif @@ -382,7 +386,7 @@ item->dupenum = 0; item->name = item->original_name; if (spec != NULL) { - SDL_memcpy(&item->spec, spec, sizeof(SDL_AudioSpec)); + SDL_copyp(&item->spec, spec); } else { SDL_zero(item->spec); } @@ -523,6 +527,7 @@ { int device_index; SDL_AudioDevice *device = NULL; + SDL_bool device_was_opened = SDL_FALSE; SDL_LockMutex(current_audio.detectionLock); if (iscapture) { @@ -535,10 +540,29 @@ device = open_devices[device_index]; if (device != NULL && device->handle == handle) { + device_was_opened = SDL_TRUE; SDL_OpenedAudioDeviceDisconnected(device); break; } } + + /* Devices that aren't opened, as of 2.24.0, will post an + SDL_AUDIODEVICEREMOVED event with the `which` field set to zero. + Apps can use this to decide if they need to refresh a list of + available devices instead of closing an opened one. + Note that opened devices will send the non-zero event in + SDL_OpenedAudioDeviceDisconnected(). */ + if (!device_was_opened) { + if (SDL_GetEventState(SDL_AUDIODEVICEREMOVED) == SDL_ENABLE) { + SDL_Event event; + SDL_zero(event); + event.adevice.type = SDL_AUDIODEVICEREMOVED; + event.adevice.which = 0; + event.adevice.iscapture = iscapture ? 1 : 0; + SDL_PushEvent(&event); + } + } + SDL_UnlockMutex(current_audio.detectionLock); current_audio.impl.FreeDeviceHandle(handle); @@ -945,6 +969,15 @@ const char *driver_attempt_end = SDL_strchr(driver_attempt, ','); size_t driver_attempt_len = (driver_attempt_end != NULL) ? (driver_attempt_end - driver_attempt) : SDL_strlen(driver_attempt); +#if SDL_AUDIO_DRIVER_DSOUND + /* SDL 1.2 uses the name "dsound", so we'll support both. */ + if (driver_attempt_len == SDL_strlen("dsound") && + (SDL_strncasecmp(driver_attempt, "dsound", driver_attempt_len) == 0)) { + driver_attempt = "directsound"; + driver_attempt_len = SDL_strlen("directsound"); + } +#endif + #if SDL_AUDIO_DRIVER_PULSEAUDIO /* SDL 1.2 uses the name "pulse", so we'll support both. */ if (driver_attempt_len == SDL_strlen("pulse") && @@ -1131,7 +1164,7 @@ SDL_assert(item != NULL); } SDL_assert(item != NULL); - SDL_memcpy(spec, &item->spec, sizeof(SDL_AudioSpec)); + SDL_copyp(spec, &item->spec); retval = 0; } else { retval = SDL_InvalidParamError("index"); @@ -1142,6 +1175,24 @@ } +int +SDL_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int iscapture) +{ + if (spec == NULL) { + return SDL_InvalidParamError("spec"); + } + + if (!SDL_GetCurrentAudioDriver()) { + return SDL_SetError("Audio subsystem is not initialized"); + } + + if (current_audio.impl.GetDefaultAudioInfo == NULL) { + return SDL_Unsupported(); + } + return current_audio.impl.GetDefaultAudioInfo(name, spec, iscapture); +} + + static void close_audio_device(SDL_AudioDevice * device) { @@ -1193,7 +1244,7 @@ static int prepare_audiospec(const SDL_AudioSpec * orig, SDL_AudioSpec * prepared) { - SDL_memcpy(prepared, orig, sizeof(SDL_AudioSpec)); + SDL_copyp(prepared, orig); if (orig->freq == 0) { const char *env = SDL_getenv("SDL_AUDIO_FREQUENCY"); @@ -1209,22 +1260,12 @@ } } - switch (orig->channels) { - case 0:{ - const char *env = SDL_getenv("SDL_AUDIO_CHANNELS"); - if ((!env) || ((prepared->channels = (Uint8) SDL_atoi(env)) == 0)) { - prepared->channels = 2; /* a reasonable default */ - break; - } + if (orig->channels == 0) { + const char *env = SDL_getenv("SDL_AUDIO_CHANNELS"); + if ((!env) || ((prepared->channels = (Uint8) SDL_atoi(env)) == 0)) { + prepared->channels = 2; /* a reasonable default */ } - case 1: /* Mono */ - case 2: /* Stereo */ - case 4: /* Quadrophonic */ - case 6: /* 5.1 surround */ - case 7: /* 6.1 surround */ - case 8: /* 7.1 surround */ - break; - default: + } else if (orig->channels > 8) { SDL_SetError("Unsupported number of audio channels."); return 0; } @@ -1383,6 +1424,13 @@ } } + /* For backends that require a power-of-two value for spec.samples, take the + * value we got from 'desired' and round up to the nearest value + */ + if (!current_audio.impl.SupportsNonPow2Samples && device->spec.samples > 0) { + device->spec.samples = SDL_powerof2(device->spec.samples); + } + if (current_audio.impl.OpenDevice(device, devname) < 0) { close_audio_device(device); return 0; @@ -1649,8 +1697,6 @@ #ifdef HAVE_LIBSAMPLERATE_H UnloadLibSampleRate(); #endif - - SDL_FreeResampleFilter(); } #define NUM_FORMATS 10 diff -Nru libsdl2-2.0.22+dfsg/src/audio/SDL_audio_c.h libsdl2-2.24.0+dfsg/src/audio/SDL_audio_c.h --- libsdl2-2.0.22+dfsg/src/audio/SDL_audio_c.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/audio/SDL_audio_c.h 2022-08-13 03:48:10.000000000 +0000 @@ -29,7 +29,7 @@ #endif #if DEBUG_CONVERT -#define LOG_DEBUG_CONVERT(from, to) fprintf(stderr, "Converting %s to %s.\n", from, to); +#define LOG_DEBUG_CONVERT(from, to) SDL_Log("SDL_AUDIO_CONVERT: Converting %s to %s.\n", from, to); #else #define LOG_DEBUG_CONVERT(from, to) #endif @@ -70,11 +70,6 @@ extern SDL_AudioFilter SDL_Convert_F32_to_U16; extern SDL_AudioFilter SDL_Convert_F32_to_S32; -/* You need to call SDL_PrepareResampleFilter() before using the internal resampler. - SDL_AudioQuit() calls SDL_FreeResamplerFilter(), you should never call it yourself. */ -extern int SDL_PrepareResampleFilter(void); -extern void SDL_FreeResampleFilter(void); - #endif /* SDL_audio_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/audio/SDL_audio_channel_converters.h libsdl2-2.24.0+dfsg/src/audio/SDL_audio_channel_converters.h --- libsdl2-2.0.22+dfsg/src/audio/SDL_audio_channel_converters.h 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/audio/SDL_audio_channel_converters.h 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,1459 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* DO NOT EDIT, THIS FILE WAS GENERATED BY build-scripts/gen_audio_channel_conversion.c */ + +static void SDLCALL +SDL_ConvertMonoToStereo(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = ((float *) (cvt->buf + ((cvt->len_cvt / 1) * 2))) - 2; + const float *src = ((const float *) (cvt->buf + cvt->len_cvt)) - 1; + int i; + + LOG_DEBUG_CONVERT("mono", "stereo"); + SDL_assert(format == AUDIO_F32SYS); + + /* convert backwards, since output is growing in-place. */ + for (i = cvt->len_cvt / (sizeof (float) * 1); i; i--, src -= 1, dst -= 2) { + const float srcFC = src[0]; + dst[1] /* FR */ = srcFC; + dst[0] /* FL */ = srcFC; + } + + cvt->len_cvt = cvt->len_cvt * 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_ConvertMonoTo21(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = ((float *) (cvt->buf + ((cvt->len_cvt / 1) * 3))) - 3; + const float *src = ((const float *) (cvt->buf + cvt->len_cvt)) - 1; + int i; + + LOG_DEBUG_CONVERT("mono", "2.1"); + SDL_assert(format == AUDIO_F32SYS); + + /* convert backwards, since output is growing in-place. */ + for (i = cvt->len_cvt / (sizeof (float) * 1); i; i--, src -= 1, dst -= 3) { + const float srcFC = src[0]; + dst[2] /* LFE */ = 0.0f; + dst[1] /* FR */ = srcFC; + dst[0] /* FL */ = srcFC; + } + + cvt->len_cvt = cvt->len_cvt * 3; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_ConvertMonoToQuad(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = ((float *) (cvt->buf + ((cvt->len_cvt / 1) * 4))) - 4; + const float *src = ((const float *) (cvt->buf + cvt->len_cvt)) - 1; + int i; + + LOG_DEBUG_CONVERT("mono", "quad"); + SDL_assert(format == AUDIO_F32SYS); + + /* convert backwards, since output is growing in-place. */ + for (i = cvt->len_cvt / (sizeof (float) * 1); i; i--, src -= 1, dst -= 4) { + const float srcFC = src[0]; + dst[3] /* BR */ = 0.0f; + dst[2] /* BL */ = 0.0f; + dst[1] /* FR */ = srcFC; + dst[0] /* FL */ = srcFC; + } + + cvt->len_cvt = cvt->len_cvt * 4; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_ConvertMonoTo41(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = ((float *) (cvt->buf + ((cvt->len_cvt / 1) * 5))) - 5; + const float *src = ((const float *) (cvt->buf + cvt->len_cvt)) - 1; + int i; + + LOG_DEBUG_CONVERT("mono", "4.1"); + SDL_assert(format == AUDIO_F32SYS); + + /* convert backwards, since output is growing in-place. */ + for (i = cvt->len_cvt / (sizeof (float) * 1); i; i--, src -= 1, dst -= 5) { + const float srcFC = src[0]; + dst[4] /* BR */ = 0.0f; + dst[3] /* BL */ = 0.0f; + dst[2] /* LFE */ = 0.0f; + dst[1] /* FR */ = srcFC; + dst[0] /* FL */ = srcFC; + } + + cvt->len_cvt = cvt->len_cvt * 5; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_ConvertMonoTo51(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = ((float *) (cvt->buf + ((cvt->len_cvt / 1) * 6))) - 6; + const float *src = ((const float *) (cvt->buf + cvt->len_cvt)) - 1; + int i; + + LOG_DEBUG_CONVERT("mono", "5.1"); + SDL_assert(format == AUDIO_F32SYS); + + /* convert backwards, since output is growing in-place. */ + for (i = cvt->len_cvt / (sizeof (float) * 1); i; i--, src -= 1, dst -= 6) { + const float srcFC = src[0]; + dst[5] /* BR */ = 0.0f; + dst[4] /* BL */ = 0.0f; + dst[3] /* LFE */ = 0.0f; + dst[2] /* FC */ = 0.0f; + dst[1] /* FR */ = srcFC; + dst[0] /* FL */ = srcFC; + } + + cvt->len_cvt = cvt->len_cvt * 6; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_ConvertMonoTo61(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = ((float *) (cvt->buf + ((cvt->len_cvt / 1) * 7))) - 7; + const float *src = ((const float *) (cvt->buf + cvt->len_cvt)) - 1; + int i; + + LOG_DEBUG_CONVERT("mono", "6.1"); + SDL_assert(format == AUDIO_F32SYS); + + /* convert backwards, since output is growing in-place. */ + for (i = cvt->len_cvt / (sizeof (float) * 1); i; i--, src -= 1, dst -= 7) { + const float srcFC = src[0]; + dst[6] /* SR */ = 0.0f; + dst[5] /* SL */ = 0.0f; + dst[4] /* BC */ = 0.0f; + dst[3] /* LFE */ = 0.0f; + dst[2] /* FC */ = 0.0f; + dst[1] /* FR */ = srcFC; + dst[0] /* FL */ = srcFC; + } + + cvt->len_cvt = cvt->len_cvt * 7; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_ConvertMonoTo71(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = ((float *) (cvt->buf + ((cvt->len_cvt / 1) * 8))) - 8; + const float *src = ((const float *) (cvt->buf + cvt->len_cvt)) - 1; + int i; + + LOG_DEBUG_CONVERT("mono", "7.1"); + SDL_assert(format == AUDIO_F32SYS); + + /* convert backwards, since output is growing in-place. */ + for (i = cvt->len_cvt / (sizeof (float) * 1); i; i--, src -= 1, dst -= 8) { + const float srcFC = src[0]; + dst[7] /* SR */ = 0.0f; + dst[6] /* SL */ = 0.0f; + dst[5] /* BR */ = 0.0f; + dst[4] /* BL */ = 0.0f; + dst[3] /* LFE */ = 0.0f; + dst[2] /* FC */ = 0.0f; + dst[1] /* FR */ = srcFC; + dst[0] /* FL */ = srcFC; + } + + cvt->len_cvt = cvt->len_cvt * 8; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_ConvertStereoToMono(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("stereo", "mono"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof (float) * 2); i; i--, src += 2, dst += 1) { + dst[0] /* FC */ = (src[0] * 0.500000000f) + (src[1] * 0.500000000f); + } + + cvt->len_cvt = cvt->len_cvt / 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_ConvertStereoTo21(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = ((float *) (cvt->buf + ((cvt->len_cvt / 2) * 3))) - 3; + const float *src = ((const float *) (cvt->buf + cvt->len_cvt)) - 2; + int i; + + LOG_DEBUG_CONVERT("stereo", "2.1"); + SDL_assert(format == AUDIO_F32SYS); + + /* convert backwards, since output is growing in-place. */ + for (i = cvt->len_cvt / (sizeof (float) * 2); i; i--, src -= 2, dst -= 3) { + dst[2] /* LFE */ = 0.0f; + dst[1] /* FR */ = src[1]; + dst[0] /* FL */ = src[0]; + } + + cvt->len_cvt = (cvt->len_cvt / 2) * 3; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_ConvertStereoToQuad(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = ((float *) (cvt->buf + ((cvt->len_cvt / 2) * 4))) - 4; + const float *src = ((const float *) (cvt->buf + cvt->len_cvt)) - 2; + int i; + + LOG_DEBUG_CONVERT("stereo", "quad"); + SDL_assert(format == AUDIO_F32SYS); + + /* convert backwards, since output is growing in-place. */ + for (i = cvt->len_cvt / (sizeof (float) * 2); i; i--, src -= 2, dst -= 4) { + dst[3] /* BR */ = 0.0f; + dst[2] /* BL */ = 0.0f; + dst[1] /* FR */ = src[1]; + dst[0] /* FL */ = src[0]; + } + + cvt->len_cvt = (cvt->len_cvt / 2) * 4; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_ConvertStereoTo41(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = ((float *) (cvt->buf + ((cvt->len_cvt / 2) * 5))) - 5; + const float *src = ((const float *) (cvt->buf + cvt->len_cvt)) - 2; + int i; + + LOG_DEBUG_CONVERT("stereo", "4.1"); + SDL_assert(format == AUDIO_F32SYS); + + /* convert backwards, since output is growing in-place. */ + for (i = cvt->len_cvt / (sizeof (float) * 2); i; i--, src -= 2, dst -= 5) { + dst[4] /* BR */ = 0.0f; + dst[3] /* BL */ = 0.0f; + dst[2] /* LFE */ = 0.0f; + dst[1] /* FR */ = src[1]; + dst[0] /* FL */ = src[0]; + } + + cvt->len_cvt = (cvt->len_cvt / 2) * 5; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_ConvertStereoTo51(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = ((float *) (cvt->buf + ((cvt->len_cvt / 2) * 6))) - 6; + const float *src = ((const float *) (cvt->buf + cvt->len_cvt)) - 2; + int i; + + LOG_DEBUG_CONVERT("stereo", "5.1"); + SDL_assert(format == AUDIO_F32SYS); + + /* convert backwards, since output is growing in-place. */ + for (i = cvt->len_cvt / (sizeof (float) * 2); i; i--, src -= 2, dst -= 6) { + dst[5] /* BR */ = 0.0f; + dst[4] /* BL */ = 0.0f; + dst[3] /* LFE */ = 0.0f; + dst[2] /* FC */ = 0.0f; + dst[1] /* FR */ = src[1]; + dst[0] /* FL */ = src[0]; + } + + cvt->len_cvt = (cvt->len_cvt / 2) * 6; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_ConvertStereoTo61(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = ((float *) (cvt->buf + ((cvt->len_cvt / 2) * 7))) - 7; + const float *src = ((const float *) (cvt->buf + cvt->len_cvt)) - 2; + int i; + + LOG_DEBUG_CONVERT("stereo", "6.1"); + SDL_assert(format == AUDIO_F32SYS); + + /* convert backwards, since output is growing in-place. */ + for (i = cvt->len_cvt / (sizeof (float) * 2); i; i--, src -= 2, dst -= 7) { + dst[6] /* SR */ = 0.0f; + dst[5] /* SL */ = 0.0f; + dst[4] /* BC */ = 0.0f; + dst[3] /* LFE */ = 0.0f; + dst[2] /* FC */ = 0.0f; + dst[1] /* FR */ = src[1]; + dst[0] /* FL */ = src[0]; + } + + cvt->len_cvt = (cvt->len_cvt / 2) * 7; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_ConvertStereoTo71(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = ((float *) (cvt->buf + ((cvt->len_cvt / 2) * 8))) - 8; + const float *src = ((const float *) (cvt->buf + cvt->len_cvt)) - 2; + int i; + + LOG_DEBUG_CONVERT("stereo", "7.1"); + SDL_assert(format == AUDIO_F32SYS); + + /* convert backwards, since output is growing in-place. */ + for (i = cvt->len_cvt / (sizeof (float) * 2); i; i--, src -= 2, dst -= 8) { + dst[7] /* SR */ = 0.0f; + dst[6] /* SL */ = 0.0f; + dst[5] /* BR */ = 0.0f; + dst[4] /* BL */ = 0.0f; + dst[3] /* LFE */ = 0.0f; + dst[2] /* FC */ = 0.0f; + dst[1] /* FR */ = src[1]; + dst[0] /* FL */ = src[0]; + } + + cvt->len_cvt = (cvt->len_cvt / 2) * 8; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert21ToMono(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("2.1", "mono"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof (float) * 3); i; i--, src += 3, dst += 1) { + dst[0] /* FC */ = (src[0] * 0.333333343f) + (src[1] * 0.333333343f) + (src[2] * 0.333333343f); + } + + cvt->len_cvt = cvt->len_cvt / 3; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert21ToStereo(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("2.1", "stereo"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof (float) * 3); i; i--, src += 3, dst += 2) { + const float srcLFE = src[2]; + dst[0] /* FL */ = (src[0] * 0.800000012f) + (srcLFE * 0.200000003f); + dst[1] /* FR */ = (src[1] * 0.800000012f) + (srcLFE * 0.200000003f); + } + + cvt->len_cvt = (cvt->len_cvt / 3) * 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert21ToQuad(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = ((float *) (cvt->buf + ((cvt->len_cvt / 3) * 4))) - 4; + const float *src = ((const float *) (cvt->buf + cvt->len_cvt)) - 3; + int i; + + LOG_DEBUG_CONVERT("2.1", "quad"); + SDL_assert(format == AUDIO_F32SYS); + + /* convert backwards, since output is growing in-place. */ + for (i = cvt->len_cvt / (sizeof (float) * 3); i; i--, src -= 3, dst -= 4) { + const float srcLFE = src[2]; + dst[3] /* BR */ = (srcLFE * 0.111111112f); + dst[2] /* BL */ = (srcLFE * 0.111111112f); + dst[1] /* FR */ = (srcLFE * 0.111111112f) + (src[1] * 0.888888896f); + dst[0] /* FL */ = (srcLFE * 0.111111112f) + (src[0] * 0.888888896f); + } + + cvt->len_cvt = (cvt->len_cvt / 3) * 4; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert21To41(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = ((float *) (cvt->buf + ((cvt->len_cvt / 3) * 5))) - 5; + const float *src = ((const float *) (cvt->buf + cvt->len_cvt)) - 3; + int i; + + LOG_DEBUG_CONVERT("2.1", "4.1"); + SDL_assert(format == AUDIO_F32SYS); + + /* convert backwards, since output is growing in-place. */ + for (i = cvt->len_cvt / (sizeof (float) * 3); i; i--, src -= 3, dst -= 5) { + dst[4] /* BR */ = 0.0f; + dst[3] /* BL */ = 0.0f; + dst[2] /* LFE */ = src[2]; + dst[1] /* FR */ = src[1]; + dst[0] /* FL */ = src[0]; + } + + cvt->len_cvt = (cvt->len_cvt / 3) * 5; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert21To51(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = ((float *) (cvt->buf + ((cvt->len_cvt / 3) * 6))) - 6; + const float *src = ((const float *) (cvt->buf + cvt->len_cvt)) - 3; + int i; + + LOG_DEBUG_CONVERT("2.1", "5.1"); + SDL_assert(format == AUDIO_F32SYS); + + /* convert backwards, since output is growing in-place. */ + for (i = cvt->len_cvt / (sizeof (float) * 3); i; i--, src -= 3, dst -= 6) { + dst[5] /* BR */ = 0.0f; + dst[4] /* BL */ = 0.0f; + dst[3] /* LFE */ = src[2]; + dst[2] /* FC */ = 0.0f; + dst[1] /* FR */ = src[1]; + dst[0] /* FL */ = src[0]; + } + + cvt->len_cvt = (cvt->len_cvt / 3) * 6; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert21To61(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = ((float *) (cvt->buf + ((cvt->len_cvt / 3) * 7))) - 7; + const float *src = ((const float *) (cvt->buf + cvt->len_cvt)) - 3; + int i; + + LOG_DEBUG_CONVERT("2.1", "6.1"); + SDL_assert(format == AUDIO_F32SYS); + + /* convert backwards, since output is growing in-place. */ + for (i = cvt->len_cvt / (sizeof (float) * 3); i; i--, src -= 3, dst -= 7) { + dst[6] /* SR */ = 0.0f; + dst[5] /* SL */ = 0.0f; + dst[4] /* BC */ = 0.0f; + dst[3] /* LFE */ = src[2]; + dst[2] /* FC */ = 0.0f; + dst[1] /* FR */ = src[1]; + dst[0] /* FL */ = src[0]; + } + + cvt->len_cvt = (cvt->len_cvt / 3) * 7; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert21To71(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = ((float *) (cvt->buf + ((cvt->len_cvt / 3) * 8))) - 8; + const float *src = ((const float *) (cvt->buf + cvt->len_cvt)) - 3; + int i; + + LOG_DEBUG_CONVERT("2.1", "7.1"); + SDL_assert(format == AUDIO_F32SYS); + + /* convert backwards, since output is growing in-place. */ + for (i = cvt->len_cvt / (sizeof (float) * 3); i; i--, src -= 3, dst -= 8) { + dst[7] /* SR */ = 0.0f; + dst[6] /* SL */ = 0.0f; + dst[5] /* BR */ = 0.0f; + dst[4] /* BL */ = 0.0f; + dst[3] /* LFE */ = src[2]; + dst[2] /* FC */ = 0.0f; + dst[1] /* FR */ = src[1]; + dst[0] /* FL */ = src[0]; + } + + cvt->len_cvt = (cvt->len_cvt / 3) * 8; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_ConvertQuadToMono(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("quad", "mono"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof (float) * 4); i; i--, src += 4, dst += 1) { + dst[0] /* FC */ = (src[0] * 0.250000000f) + (src[1] * 0.250000000f) + (src[2] * 0.250000000f) + (src[3] * 0.250000000f); + } + + cvt->len_cvt = cvt->len_cvt / 4; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_ConvertQuadToStereo(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("quad", "stereo"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof (float) * 4); i; i--, src += 4, dst += 2) { + const float srcBL = src[2]; + const float srcBR = src[3]; + dst[0] /* FL */ = (src[0] * 0.421000004f) + (srcBL * 0.358999997f) + (srcBR * 0.219999999f); + dst[1] /* FR */ = (src[1] * 0.421000004f) + (srcBL * 0.219999999f) + (srcBR * 0.358999997f); + } + + cvt->len_cvt = (cvt->len_cvt / 4) * 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_ConvertQuadTo21(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("quad", "2.1"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof (float) * 4); i; i--, src += 4, dst += 3) { + const float srcBL = src[2]; + const float srcBR = src[3]; + dst[0] /* FL */ = (src[0] * 0.421000004f) + (srcBL * 0.358999997f) + (srcBR * 0.219999999f); + dst[1] /* FR */ = (src[1] * 0.421000004f) + (srcBL * 0.219999999f) + (srcBR * 0.358999997f); + dst[2] /* LFE */ = 0.0f; + } + + cvt->len_cvt = (cvt->len_cvt / 4) * 3; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_ConvertQuadTo41(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = ((float *) (cvt->buf + ((cvt->len_cvt / 4) * 5))) - 5; + const float *src = ((const float *) (cvt->buf + cvt->len_cvt)) - 4; + int i; + + LOG_DEBUG_CONVERT("quad", "4.1"); + SDL_assert(format == AUDIO_F32SYS); + + /* convert backwards, since output is growing in-place. */ + for (i = cvt->len_cvt / (sizeof (float) * 4); i; i--, src -= 4, dst -= 5) { + dst[4] /* BR */ = src[3]; + dst[3] /* BL */ = src[2]; + dst[2] /* LFE */ = 0.0f; + dst[1] /* FR */ = src[1]; + dst[0] /* FL */ = src[0]; + } + + cvt->len_cvt = (cvt->len_cvt / 4) * 5; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_ConvertQuadTo51(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = ((float *) (cvt->buf + ((cvt->len_cvt / 4) * 6))) - 6; + const float *src = ((const float *) (cvt->buf + cvt->len_cvt)) - 4; + int i; + + LOG_DEBUG_CONVERT("quad", "5.1"); + SDL_assert(format == AUDIO_F32SYS); + + /* convert backwards, since output is growing in-place. */ + for (i = cvt->len_cvt / (sizeof (float) * 4); i; i--, src -= 4, dst -= 6) { + dst[5] /* BR */ = src[3]; + dst[4] /* BL */ = src[2]; + dst[3] /* LFE */ = 0.0f; + dst[2] /* FC */ = 0.0f; + dst[1] /* FR */ = src[1]; + dst[0] /* FL */ = src[0]; + } + + cvt->len_cvt = (cvt->len_cvt / 4) * 6; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_ConvertQuadTo61(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = ((float *) (cvt->buf + ((cvt->len_cvt / 4) * 7))) - 7; + const float *src = ((const float *) (cvt->buf + cvt->len_cvt)) - 4; + int i; + + LOG_DEBUG_CONVERT("quad", "6.1"); + SDL_assert(format == AUDIO_F32SYS); + + /* convert backwards, since output is growing in-place. */ + for (i = cvt->len_cvt / (sizeof (float) * 4); i; i--, src -= 4, dst -= 7) { + const float srcBL = src[2]; + const float srcBR = src[3]; + dst[6] /* SR */ = (srcBR * 0.796000004f); + dst[5] /* SL */ = (srcBL * 0.796000004f); + dst[4] /* BC */ = (srcBR * 0.500000000f) + (srcBL * 0.500000000f); + dst[3] /* LFE */ = 0.0f; + dst[2] /* FC */ = 0.0f; + dst[1] /* FR */ = (src[1] * 0.939999998f); + dst[0] /* FL */ = (src[0] * 0.939999998f); + } + + cvt->len_cvt = (cvt->len_cvt / 4) * 7; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_ConvertQuadTo71(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = ((float *) (cvt->buf + ((cvt->len_cvt / 4) * 8))) - 8; + const float *src = ((const float *) (cvt->buf + cvt->len_cvt)) - 4; + int i; + + LOG_DEBUG_CONVERT("quad", "7.1"); + SDL_assert(format == AUDIO_F32SYS); + + /* convert backwards, since output is growing in-place. */ + for (i = cvt->len_cvt / (sizeof (float) * 4); i; i--, src -= 4, dst -= 8) { + dst[7] /* SR */ = 0.0f; + dst[6] /* SL */ = 0.0f; + dst[5] /* BR */ = src[3]; + dst[4] /* BL */ = src[2]; + dst[3] /* LFE */ = 0.0f; + dst[2] /* FC */ = 0.0f; + dst[1] /* FR */ = src[1]; + dst[0] /* FL */ = src[0]; + } + + cvt->len_cvt = (cvt->len_cvt / 4) * 8; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert41ToMono(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("4.1", "mono"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof (float) * 5); i; i--, src += 5, dst += 1) { + dst[0] /* FC */ = (src[0] * 0.200000003f) + (src[1] * 0.200000003f) + (src[2] * 0.200000003f) + (src[3] * 0.200000003f) + (src[4] * 0.200000003f); + } + + cvt->len_cvt = cvt->len_cvt / 5; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert41ToStereo(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("4.1", "stereo"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof (float) * 5); i; i--, src += 5, dst += 2) { + const float srcLFE = src[2]; + const float srcBL = src[3]; + const float srcBR = src[4]; + dst[0] /* FL */ = (src[0] * 0.374222219f) + (srcLFE * 0.111111112f) + (srcBL * 0.319111109f) + (srcBR * 0.195555553f); + dst[1] /* FR */ = (src[1] * 0.374222219f) + (srcLFE * 0.111111112f) + (srcBL * 0.195555553f) + (srcBR * 0.319111109f); + } + + cvt->len_cvt = (cvt->len_cvt / 5) * 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert41To21(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("4.1", "2.1"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof (float) * 5); i; i--, src += 5, dst += 3) { + const float srcBL = src[3]; + const float srcBR = src[4]; + dst[0] /* FL */ = (src[0] * 0.421000004f) + (srcBL * 0.358999997f) + (srcBR * 0.219999999f); + dst[1] /* FR */ = (src[1] * 0.421000004f) + (srcBL * 0.219999999f) + (srcBR * 0.358999997f); + dst[2] /* LFE */ = src[2]; + } + + cvt->len_cvt = (cvt->len_cvt / 5) * 3; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert41ToQuad(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("4.1", "quad"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof (float) * 5); i; i--, src += 5, dst += 4) { + const float srcLFE = src[2]; + dst[0] /* FL */ = (src[0] * 0.941176474f) + (srcLFE * 0.058823530f); + dst[1] /* FR */ = (src[1] * 0.941176474f) + (srcLFE * 0.058823530f); + dst[2] /* BL */ = (srcLFE * 0.058823530f) + (src[3] * 0.941176474f); + dst[3] /* BR */ = (srcLFE * 0.058823530f) + (src[4] * 0.941176474f); + } + + cvt->len_cvt = (cvt->len_cvt / 5) * 4; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert41To51(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = ((float *) (cvt->buf + ((cvt->len_cvt / 5) * 6))) - 6; + const float *src = ((const float *) (cvt->buf + cvt->len_cvt)) - 5; + int i; + + LOG_DEBUG_CONVERT("4.1", "5.1"); + SDL_assert(format == AUDIO_F32SYS); + + /* convert backwards, since output is growing in-place. */ + for (i = cvt->len_cvt / (sizeof (float) * 5); i; i--, src -= 5, dst -= 6) { + dst[5] /* BR */ = src[4]; + dst[4] /* BL */ = src[3]; + dst[3] /* LFE */ = src[2]; + dst[2] /* FC */ = 0.0f; + dst[1] /* FR */ = src[1]; + dst[0] /* FL */ = src[0]; + } + + cvt->len_cvt = (cvt->len_cvt / 5) * 6; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert41To61(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = ((float *) (cvt->buf + ((cvt->len_cvt / 5) * 7))) - 7; + const float *src = ((const float *) (cvt->buf + cvt->len_cvt)) - 5; + int i; + + LOG_DEBUG_CONVERT("4.1", "6.1"); + SDL_assert(format == AUDIO_F32SYS); + + /* convert backwards, since output is growing in-place. */ + for (i = cvt->len_cvt / (sizeof (float) * 5); i; i--, src -= 5, dst -= 7) { + const float srcBL = src[3]; + const float srcBR = src[4]; + dst[6] /* SR */ = (srcBR * 0.796000004f); + dst[5] /* SL */ = (srcBL * 0.796000004f); + dst[4] /* BC */ = (srcBR * 0.500000000f) + (srcBL * 0.500000000f); + dst[3] /* LFE */ = src[2]; + dst[2] /* FC */ = 0.0f; + dst[1] /* FR */ = (src[1] * 0.939999998f); + dst[0] /* FL */ = (src[0] * 0.939999998f); + } + + cvt->len_cvt = (cvt->len_cvt / 5) * 7; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert41To71(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = ((float *) (cvt->buf + ((cvt->len_cvt / 5) * 8))) - 8; + const float *src = ((const float *) (cvt->buf + cvt->len_cvt)) - 5; + int i; + + LOG_DEBUG_CONVERT("4.1", "7.1"); + SDL_assert(format == AUDIO_F32SYS); + + /* convert backwards, since output is growing in-place. */ + for (i = cvt->len_cvt / (sizeof (float) * 5); i; i--, src -= 5, dst -= 8) { + dst[7] /* SR */ = 0.0f; + dst[6] /* SL */ = 0.0f; + dst[5] /* BR */ = src[4]; + dst[4] /* BL */ = src[3]; + dst[3] /* LFE */ = src[2]; + dst[2] /* FC */ = 0.0f; + dst[1] /* FR */ = src[1]; + dst[0] /* FL */ = src[0]; + } + + cvt->len_cvt = (cvt->len_cvt / 5) * 8; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert51ToMono(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("5.1", "mono"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof (float) * 6); i; i--, src += 6, dst += 1) { + dst[0] /* FC */ = (src[0] * 0.166666672f) + (src[1] * 0.166666672f) + (src[2] * 0.166666672f) + (src[3] * 0.166666672f) + (src[4] * 0.166666672f) + (src[5] * 0.166666672f); + } + + cvt->len_cvt = cvt->len_cvt / 6; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert51ToStereo(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("5.1", "stereo"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof (float) * 6); i; i--, src += 6, dst += 2) { + const float srcFC = src[2]; + const float srcLFE = src[3]; + const float srcBL = src[4]; + const float srcBR = src[5]; + dst[0] /* FL */ = (src[0] * 0.294545442f) + (srcFC * 0.208181813f) + (srcLFE * 0.090909094f) + (srcBL * 0.251818180f) + (srcBR * 0.154545456f); + dst[1] /* FR */ = (src[1] * 0.294545442f) + (srcFC * 0.208181813f) + (srcLFE * 0.090909094f) + (srcBL * 0.154545456f) + (srcBR * 0.251818180f); + } + + cvt->len_cvt = (cvt->len_cvt / 6) * 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert51To21(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("5.1", "2.1"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof (float) * 6); i; i--, src += 6, dst += 3) { + const float srcFC = src[2]; + const float srcBL = src[4]; + const float srcBR = src[5]; + dst[0] /* FL */ = (src[0] * 0.324000001f) + (srcFC * 0.229000002f) + (srcBL * 0.277000010f) + (srcBR * 0.170000002f); + dst[1] /* FR */ = (src[1] * 0.324000001f) + (srcFC * 0.229000002f) + (srcBL * 0.170000002f) + (srcBR * 0.277000010f); + dst[2] /* LFE */ = src[3]; + } + + cvt->len_cvt = (cvt->len_cvt / 6) * 3; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert51ToQuad(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("5.1", "quad"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof (float) * 6); i; i--, src += 6, dst += 4) { + const float srcFC = src[2]; + const float srcLFE = src[3]; + dst[0] /* FL */ = (src[0] * 0.558095276f) + (srcFC * 0.394285709f) + (srcLFE * 0.047619049f); + dst[1] /* FR */ = (src[1] * 0.558095276f) + (srcFC * 0.394285709f) + (srcLFE * 0.047619049f); + dst[2] /* BL */ = (srcLFE * 0.047619049f) + (src[4] * 0.558095276f); + dst[3] /* BR */ = (srcLFE * 0.047619049f) + (src[5] * 0.558095276f); + } + + cvt->len_cvt = (cvt->len_cvt / 6) * 4; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert51To41(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("5.1", "4.1"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof (float) * 6); i; i--, src += 6, dst += 5) { + const float srcFC = src[2]; + dst[0] /* FL */ = (src[0] * 0.586000025f) + (srcFC * 0.414000005f); + dst[1] /* FR */ = (src[1] * 0.586000025f) + (srcFC * 0.414000005f); + dst[2] /* LFE */ = src[3]; + dst[3] /* BL */ = (src[4] * 0.586000025f); + dst[4] /* BR */ = (src[5] * 0.586000025f); + } + + cvt->len_cvt = (cvt->len_cvt / 6) * 5; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert51To61(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = ((float *) (cvt->buf + ((cvt->len_cvt / 6) * 7))) - 7; + const float *src = ((const float *) (cvt->buf + cvt->len_cvt)) - 6; + int i; + + LOG_DEBUG_CONVERT("5.1", "6.1"); + SDL_assert(format == AUDIO_F32SYS); + + /* convert backwards, since output is growing in-place. */ + for (i = cvt->len_cvt / (sizeof (float) * 6); i; i--, src -= 6, dst -= 7) { + const float srcBL = src[4]; + const float srcBR = src[5]; + dst[6] /* SR */ = (srcBR * 0.796000004f); + dst[5] /* SL */ = (srcBL * 0.796000004f); + dst[4] /* BC */ = (srcBR * 0.500000000f) + (srcBL * 0.500000000f); + dst[3] /* LFE */ = src[3]; + dst[2] /* FC */ = (src[2] * 0.939999998f); + dst[1] /* FR */ = (src[1] * 0.939999998f); + dst[0] /* FL */ = (src[0] * 0.939999998f); + } + + cvt->len_cvt = (cvt->len_cvt / 6) * 7; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert51To71(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = ((float *) (cvt->buf + ((cvt->len_cvt / 6) * 8))) - 8; + const float *src = ((const float *) (cvt->buf + cvt->len_cvt)) - 6; + int i; + + LOG_DEBUG_CONVERT("5.1", "7.1"); + SDL_assert(format == AUDIO_F32SYS); + + /* convert backwards, since output is growing in-place. */ + for (i = cvt->len_cvt / (sizeof (float) * 6); i; i--, src -= 6, dst -= 8) { + dst[7] /* SR */ = 0.0f; + dst[6] /* SL */ = 0.0f; + dst[5] /* BR */ = src[5]; + dst[4] /* BL */ = src[4]; + dst[3] /* LFE */ = src[3]; + dst[2] /* FC */ = src[2]; + dst[1] /* FR */ = src[1]; + dst[0] /* FL */ = src[0]; + } + + cvt->len_cvt = (cvt->len_cvt / 6) * 8; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert61ToMono(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("6.1", "mono"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof (float) * 7); i; i--, src += 7, dst += 1) { + dst[0] /* FC */ = (src[0] * 0.143142849f) + (src[1] * 0.143142849f) + (src[2] * 0.143142849f) + (src[3] * 0.142857149f) + (src[4] * 0.143142849f) + (src[5] * 0.143142849f) + (src[6] * 0.143142849f); + } + + cvt->len_cvt = cvt->len_cvt / 7; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert61ToStereo(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("6.1", "stereo"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof (float) * 7); i; i--, src += 7, dst += 2) { + const float srcFC = src[2]; + const float srcLFE = src[3]; + const float srcBC = src[4]; + const float srcSL = src[5]; + const float srcSR = src[6]; + dst[0] /* FL */ = (src[0] * 0.247384623f) + (srcFC * 0.174461529f) + (srcLFE * 0.076923080f) + (srcBC * 0.174461529f) + (srcSL * 0.226153851f) + (srcSR * 0.100615382f); + dst[1] /* FR */ = (src[1] * 0.247384623f) + (srcFC * 0.174461529f) + (srcLFE * 0.076923080f) + (srcBC * 0.174461529f) + (srcSL * 0.100615382f) + (srcSR * 0.226153851f); + } + + cvt->len_cvt = (cvt->len_cvt / 7) * 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert61To21(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("6.1", "2.1"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof (float) * 7); i; i--, src += 7, dst += 3) { + const float srcFC = src[2]; + const float srcBC = src[4]; + const float srcSL = src[5]; + const float srcSR = src[6]; + dst[0] /* FL */ = (src[0] * 0.268000007f) + (srcFC * 0.188999996f) + (srcBC * 0.188999996f) + (srcSL * 0.245000005f) + (srcSR * 0.108999997f); + dst[1] /* FR */ = (src[1] * 0.268000007f) + (srcFC * 0.188999996f) + (srcBC * 0.188999996f) + (srcSL * 0.108999997f) + (srcSR * 0.245000005f); + dst[2] /* LFE */ = src[3]; + } + + cvt->len_cvt = (cvt->len_cvt / 7) * 3; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert61ToQuad(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("6.1", "quad"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof (float) * 7); i; i--, src += 7, dst += 4) { + const float srcFC = src[2]; + const float srcLFE = src[3]; + const float srcBC = src[4]; + const float srcSL = src[5]; + const float srcSR = src[6]; + dst[0] /* FL */ = (src[0] * 0.463679999f) + (srcFC * 0.327360004f) + (srcLFE * 0.040000003f) + (srcSL * 0.168960005f); + dst[1] /* FR */ = (src[1] * 0.463679999f) + (srcFC * 0.327360004f) + (srcLFE * 0.040000003f) + (srcSR * 0.168960005f); + dst[2] /* BL */ = (srcLFE * 0.040000003f) + (srcBC * 0.327360004f) + (srcSL * 0.431039989f); + dst[3] /* BR */ = (srcLFE * 0.040000003f) + (srcBC * 0.327360004f) + (srcSR * 0.431039989f); + } + + cvt->len_cvt = (cvt->len_cvt / 7) * 4; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert61To41(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("6.1", "4.1"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof (float) * 7); i; i--, src += 7, dst += 5) { + const float srcFC = src[2]; + const float srcBC = src[4]; + const float srcSL = src[5]; + const float srcSR = src[6]; + dst[0] /* FL */ = (src[0] * 0.483000010f) + (srcFC * 0.340999991f) + (srcSL * 0.175999999f); + dst[1] /* FR */ = (src[1] * 0.483000010f) + (srcFC * 0.340999991f) + (srcSR * 0.175999999f); + dst[2] /* LFE */ = src[3]; + dst[3] /* BL */ = (srcBC * 0.340999991f) + (srcSL * 0.449000001f); + dst[4] /* BR */ = (srcBC * 0.340999991f) + (srcSR * 0.449000001f); + } + + cvt->len_cvt = (cvt->len_cvt / 7) * 5; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert61To51(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("6.1", "5.1"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof (float) * 7); i; i--, src += 7, dst += 6) { + const float srcBC = src[4]; + const float srcSL = src[5]; + const float srcSR = src[6]; + dst[0] /* FL */ = (src[0] * 0.611000001f) + (srcSL * 0.223000005f); + dst[1] /* FR */ = (src[1] * 0.611000001f) + (srcSR * 0.223000005f); + dst[2] /* FC */ = (src[2] * 0.611000001f); + dst[3] /* LFE */ = src[3]; + dst[4] /* BL */ = (srcBC * 0.432000011f) + (srcSL * 0.568000019f); + dst[5] /* BR */ = (srcBC * 0.432000011f) + (srcSR * 0.568000019f); + } + + cvt->len_cvt = (cvt->len_cvt / 7) * 6; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert61To71(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = ((float *) (cvt->buf + ((cvt->len_cvt / 7) * 8))) - 8; + const float *src = ((const float *) (cvt->buf + cvt->len_cvt)) - 7; + int i; + + LOG_DEBUG_CONVERT("6.1", "7.1"); + SDL_assert(format == AUDIO_F32SYS); + + /* convert backwards, since output is growing in-place. */ + for (i = cvt->len_cvt / (sizeof (float) * 7); i; i--, src -= 7, dst -= 8) { + const float srcBC = src[4]; + dst[7] /* SR */ = src[6]; + dst[6] /* SL */ = src[5]; + dst[5] /* BR */ = (srcBC * 0.707000017f); + dst[4] /* BL */ = (srcBC * 0.707000017f); + dst[3] /* LFE */ = src[3]; + dst[2] /* FC */ = src[2]; + dst[1] /* FR */ = src[1]; + dst[0] /* FL */ = src[0]; + } + + cvt->len_cvt = (cvt->len_cvt / 7) * 8; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert71ToMono(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("7.1", "mono"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof (float) * 8); i; i--, src += 8, dst += 1) { + dst[0] /* FC */ = (src[0] * 0.125125006f) + (src[1] * 0.125125006f) + (src[2] * 0.125125006f) + (src[3] * 0.125000000f) + (src[4] * 0.125125006f) + (src[5] * 0.125125006f) + (src[6] * 0.125125006f) + (src[7] * 0.125125006f); + } + + cvt->len_cvt = cvt->len_cvt / 8; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert71ToStereo(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("7.1", "stereo"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof (float) * 8); i; i--, src += 8, dst += 2) { + const float srcFC = src[2]; + const float srcLFE = src[3]; + const float srcBL = src[4]; + const float srcBR = src[5]; + const float srcSL = src[6]; + const float srcSR = src[7]; + dst[0] /* FL */ = (src[0] * 0.211866662f) + (srcFC * 0.150266662f) + (srcLFE * 0.066666670f) + (srcBL * 0.181066677f) + (srcBR * 0.111066669f) + (srcSL * 0.194133341f) + (srcSR * 0.085866667f); + dst[1] /* FR */ = (src[1] * 0.211866662f) + (srcFC * 0.150266662f) + (srcLFE * 0.066666670f) + (srcBL * 0.111066669f) + (srcBR * 0.181066677f) + (srcSL * 0.085866667f) + (srcSR * 0.194133341f); + } + + cvt->len_cvt = (cvt->len_cvt / 8) * 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert71To21(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("7.1", "2.1"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof (float) * 8); i; i--, src += 8, dst += 3) { + const float srcFC = src[2]; + const float srcBL = src[4]; + const float srcBR = src[5]; + const float srcSL = src[6]; + const float srcSR = src[7]; + dst[0] /* FL */ = (src[0] * 0.226999998f) + (srcFC * 0.160999998f) + (srcBL * 0.194000006f) + (srcBR * 0.119000003f) + (srcSL * 0.208000004f) + (srcSR * 0.092000000f); + dst[1] /* FR */ = (src[1] * 0.226999998f) + (srcFC * 0.160999998f) + (srcBL * 0.119000003f) + (srcBR * 0.194000006f) + (srcSL * 0.092000000f) + (srcSR * 0.208000004f); + dst[2] /* LFE */ = src[3]; + } + + cvt->len_cvt = (cvt->len_cvt / 8) * 3; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert71ToQuad(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("7.1", "quad"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof (float) * 8); i; i--, src += 8, dst += 4) { + const float srcFC = src[2]; + const float srcLFE = src[3]; + const float srcSL = src[6]; + const float srcSR = src[7]; + dst[0] /* FL */ = (src[0] * 0.466344833f) + (srcFC * 0.329241365f) + (srcLFE * 0.034482758f) + (srcSL * 0.169931039f); + dst[1] /* FR */ = (src[1] * 0.466344833f) + (srcFC * 0.329241365f) + (srcLFE * 0.034482758f) + (srcSR * 0.169931039f); + dst[2] /* BL */ = (srcLFE * 0.034482758f) + (src[4] * 0.466344833f) + (srcSL * 0.433517247f); + dst[3] /* BR */ = (srcLFE * 0.034482758f) + (src[5] * 0.466344833f) + (srcSR * 0.433517247f); + } + + cvt->len_cvt = (cvt->len_cvt / 8) * 4; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert71To41(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("7.1", "4.1"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof (float) * 8); i; i--, src += 8, dst += 5) { + const float srcFC = src[2]; + const float srcSL = src[6]; + const float srcSR = src[7]; + dst[0] /* FL */ = (src[0] * 0.483000010f) + (srcFC * 0.340999991f) + (srcSL * 0.175999999f); + dst[1] /* FR */ = (src[1] * 0.483000010f) + (srcFC * 0.340999991f) + (srcSR * 0.175999999f); + dst[2] /* LFE */ = src[3]; + dst[3] /* BL */ = (src[4] * 0.483000010f) + (srcSL * 0.449000001f); + dst[4] /* BR */ = (src[5] * 0.483000010f) + (srcSR * 0.449000001f); + } + + cvt->len_cvt = (cvt->len_cvt / 8) * 5; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert71To51(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("7.1", "5.1"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof (float) * 8); i; i--, src += 8, dst += 6) { + const float srcSL = src[6]; + const float srcSR = src[7]; + dst[0] /* FL */ = (src[0] * 0.518000007f) + (srcSL * 0.188999996f); + dst[1] /* FR */ = (src[1] * 0.518000007f) + (srcSR * 0.188999996f); + dst[2] /* FC */ = (src[2] * 0.518000007f); + dst[3] /* LFE */ = src[3]; + dst[4] /* BL */ = (src[4] * 0.518000007f) + (srcSL * 0.481999993f); + dst[5] /* BR */ = (src[5] * 0.518000007f) + (srcSR * 0.481999993f); + } + + cvt->len_cvt = (cvt->len_cvt / 8) * 6; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static void SDLCALL +SDL_Convert71To61(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("7.1", "6.1"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof (float) * 8); i; i--, src += 8, dst += 7) { + const float srcBL = src[4]; + const float srcBR = src[5]; + dst[0] /* FL */ = (src[0] * 0.541000009f); + dst[1] /* FR */ = (src[1] * 0.541000009f); + dst[2] /* FC */ = (src[2] * 0.541000009f); + dst[3] /* LFE */ = src[3]; + dst[4] /* BC */ = (srcBL * 0.287999988f) + (srcBR * 0.287999988f); + dst[5] /* SL */ = (srcBL * 0.458999991f) + (src[6] * 0.541000009f); + dst[6] /* SR */ = (srcBR * 0.458999991f) + (src[7] * 0.541000009f); + } + + cvt->len_cvt = (cvt->len_cvt / 8) * 7; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +static const SDL_AudioFilter channel_converters[8][8] = { /* [from][to] */ + { NULL, SDL_ConvertMonoToStereo, SDL_ConvertMonoTo21, SDL_ConvertMonoToQuad, SDL_ConvertMonoTo41, SDL_ConvertMonoTo51, SDL_ConvertMonoTo61, SDL_ConvertMonoTo71 }, + { SDL_ConvertStereoToMono, NULL, SDL_ConvertStereoTo21, SDL_ConvertStereoToQuad, SDL_ConvertStereoTo41, SDL_ConvertStereoTo51, SDL_ConvertStereoTo61, SDL_ConvertStereoTo71 }, + { SDL_Convert21ToMono, SDL_Convert21ToStereo, NULL, SDL_Convert21ToQuad, SDL_Convert21To41, SDL_Convert21To51, SDL_Convert21To61, SDL_Convert21To71 }, + { SDL_ConvertQuadToMono, SDL_ConvertQuadToStereo, SDL_ConvertQuadTo21, NULL, SDL_ConvertQuadTo41, SDL_ConvertQuadTo51, SDL_ConvertQuadTo61, SDL_ConvertQuadTo71 }, + { SDL_Convert41ToMono, SDL_Convert41ToStereo, SDL_Convert41To21, SDL_Convert41ToQuad, NULL, SDL_Convert41To51, SDL_Convert41To61, SDL_Convert41To71 }, + { SDL_Convert51ToMono, SDL_Convert51ToStereo, SDL_Convert51To21, SDL_Convert51ToQuad, SDL_Convert51To41, NULL, SDL_Convert51To61, SDL_Convert51To71 }, + { SDL_Convert61ToMono, SDL_Convert61ToStereo, SDL_Convert61To21, SDL_Convert61ToQuad, SDL_Convert61To41, SDL_Convert61To51, NULL, SDL_Convert61To71 }, + { SDL_Convert71ToMono, SDL_Convert71ToStereo, SDL_Convert71To21, SDL_Convert71ToQuad, SDL_Convert71To41, SDL_Convert71To51, SDL_Convert71To61, NULL } +}; + +/* vi: set ts=4 sw=4 expandtab: */ + diff -Nru libsdl2-2.0.22+dfsg/src/audio/SDL_audiocvt.c libsdl2-2.24.0+dfsg/src/audio/SDL_audiocvt.c --- libsdl2-2.0.22+dfsg/src/audio/SDL_audiocvt.c 2022-04-21 17:37:37.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/audio/SDL_audiocvt.c 2022-08-13 03:48:10.000000000 +0000 @@ -22,9 +22,6 @@ /* Functions for audio drivers to perform runtime conversion of audio format */ -/* FIXME: Channel weights when converting from more channels to fewer may need to be adjusted, see https://msdn.microsoft.com/en-us/library/windows/desktop/ff819070(v=vs.85).aspx -*/ - #include "SDL.h" #include "SDL_audio.h" #include "SDL_audio_c.h" @@ -63,6 +60,39 @@ # endif #endif +/* + * CHANNEL LAYOUTS AS SDL EXPECTS THEM: + * + * (Even if the platform expects something else later, that + * SDL will swizzle between the app and the platform). + * + * Abbreviations: + * - FRONT=single mono speaker + * - FL=front left speaker + * - FR=front right speaker + * - FC=front center speaker + * - BL=back left speaker + * - BR=back right speaker + * - SR=surround right speaker + * - SL=surround left speaker + * - BC=back center speaker + * - LFE=low-frequency speaker + * + * These are listed in the order they are laid out in + * memory, so "FL+FR" means "the front left speaker is + * layed out in memory first, then the front right, then + * it repeats for the next audio frame". + * + * 1 channel (mono) layout: FRONT + * 2 channels (stereo) layout: FL+FR + * 3 channels (2.1) layout: FL+FR+LFE + * 4 channels (quad) layout: FL+FR+BL+BR + * 5 channels (4.1) layout: FL+FR+LFE+BL+BR + * 6 channels (5.1) layout: FL+FR+FC+LFE+BL+BR + * 7 channels (6.1) layout: FL+FR+FC+LFE+BC+SL+SR + * 8 channels (7.1) layout: FL+FR+FC+LFE+BL+BR+SL+SR + */ + #if HAVE_SSE3_INTRINSICS /* Convert from stereo to mono. Average left and right. */ static void SDLCALL @@ -97,558 +127,36 @@ } #endif -/* Convert from stereo to mono. Average left and right. */ -static void SDLCALL -SDL_ConvertStereoToMono(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - float *dst = (float *) cvt->buf; - const float *src = dst; - int i; - - LOG_DEBUG_CONVERT("stereo", "mono"); - SDL_assert(format == AUDIO_F32SYS); - - for (i = cvt->len_cvt / 8; i; --i, src += 2) { - *(dst++) = (src[0] + src[1]) * 0.5f; - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -#if HAVE_AVX_INTRINSICS -/* MSVC will always accept AVX intrinsics when compiling for x64 */ -#if defined(__clang__) || defined(__GNUC__) -__attribute__((target("avx"))) -#endif -/* Convert from 5.1 to stereo. Average left and right, distribute center, discard LFE. */ -static void SDLCALL -SDL_Convert51ToStereo_AVX(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - float *dst = (float *) cvt->buf; - const float *src = dst; - int i = cvt->len_cvt / (sizeof (float) * 6); - const float two_fifths_f = 1.0f / 2.5f; - const __m256 two_fifths_v = _mm256_set1_ps(two_fifths_f); - const __m256 half = _mm256_set1_ps(0.5f); - - LOG_DEBUG_CONVERT("5.1", "stereo (using AVX)"); - SDL_assert(format == AUDIO_F32SYS); - - /* SDL's 5.1 layout: FL+FR+FC+LFE+BL+BR */ - while (i >= 4) { - __m256 in0 = _mm256_loadu_ps(src + 0); /* 0FL 0FR 0FC 0LF 0BL 0BR 1FL 1FR */ - __m256 in1 = _mm256_loadu_ps(src + 8); /* 1FC 1LF 1BL 1BR 2FL 2FR 2FC 2LF */ - __m256 in2 = _mm256_loadu_ps(src + 16); /* 2BL 2BR 3FL 3FR 3FC 3LF 3BL 3BR */ - - /* 0FL 0FR 0FC 0LF 2FL 2FR 2FC 2LF */ - __m256 temp0 = _mm256_blend_ps(in0, in1, 0xF0); - /* 1FC 1LF 1BL 1BR 3FC 3LF 3BL 3BR */ - __m256 temp1 = _mm256_blend_ps(in1, in2, 0xF0); - - /* 0FC 0FC 1FC 1FC 2FC 2FC 3FC 3FC */ - __m256 fc_distributed = _mm256_mul_ps(half, _mm256_shuffle_ps(temp0, temp1, _MM_SHUFFLE(0, 0, 2, 2))); - - /* 0FL 0FR 1BL 1BR 2FL 2FR 3BL 3BR */ - __m256 permuted0 = _mm256_blend_ps(temp0, temp1, 0xCC); - /* 0BL 0BR 1FL 1FR 2BL 2BR 3FL 3FR */ - __m256 permuted1 = _mm256_permute2f128_ps(in0, in2, 0x21); - - /* 0FL 0FR 1BL 1BR 2FL 2FR 3BL 3BR */ - /* + 0BL 0BR 1FL 1FR 2BL 2BR 3FL 3FR */ - /* = 0L 0R 1L 1R 2L 2R 3L 3R */ - __m256 out = _mm256_add_ps(permuted0, permuted1); - out = _mm256_add_ps(out, fc_distributed); - out = _mm256_mul_ps(out, two_fifths_v); - - _mm256_storeu_ps(dst, out); - - i -= 4; src += 24; dst += 8; - } - - - /* Finish off any leftovers with scalar operations. */ - while (i) { - const float front_center_distributed = src[2] * 0.5f; - dst[0] = (src[0] + front_center_distributed + src[4]) * two_fifths_f; /* left */ - dst[1] = (src[1] + front_center_distributed + src[5]) * two_fifths_f; /* right */ - i--; src += 6; dst+=2; - } - - cvt->len_cvt /= 3; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} -#endif - #if HAVE_SSE_INTRINSICS -/* Convert from 5.1 to stereo. Average left and right, distribute center, discard LFE. */ -static void SDLCALL -SDL_Convert51ToStereo_SSE(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - float *dst = (float *) cvt->buf; - const float *src = dst; - int i = cvt->len_cvt / (sizeof (float) * 6); - const float two_fifths_f = 1.0f / 2.5f; - const __m128 two_fifths_v = _mm_set1_ps(two_fifths_f); - const __m128 half = _mm_set1_ps(0.5f); - - LOG_DEBUG_CONVERT("5.1", "stereo (using SSE)"); - SDL_assert(format == AUDIO_F32SYS); - - /* SDL's 5.1 layout: FL+FR+FC+LFE+BL+BR */ - /* Just use unaligned load/stores, if the memory at runtime is */ - /* aligned it'll be just as fast on modern processors */ - while (i >= 2) { - /* Two 5.1 samples (12 floats) fit nicely in three 128bit */ - /* registers. Using shuffles they can be rearranged so that */ - /* the conversion math can be vectorized. */ - __m128 in0 = _mm_loadu_ps(src); /* 0FL 0FR 0FC 0LF */ - __m128 in1 = _mm_loadu_ps(src + 4); /* 0BL 0BR 1FL 1FR */ - __m128 in2 = _mm_loadu_ps(src + 8); /* 1FC 1LF 1BL 1BR */ - - /* 0FC 0FC 1FC 1FC */ - __m128 fc_distributed = _mm_mul_ps(half, _mm_shuffle_ps(in0, in2, _MM_SHUFFLE(0, 0, 2, 2))); - - /* 0FL 0FR 1BL 1BR */ - __m128 blended = _mm_shuffle_ps(in0, in2, _MM_SHUFFLE(3, 2, 1, 0)); - - /* 0FL 0FR 1BL 1BR */ - /* + 0BL 0BR 1FL 1FR */ - /* = 0L 0R 1L 1R */ - __m128 out = _mm_add_ps(blended, in1); - out = _mm_add_ps(out, fc_distributed); - out = _mm_mul_ps(out, two_fifths_v); - - _mm_storeu_ps(dst, out); - - i -= 2; src += 12; dst += 4; - } - - - /* Finish off any leftovers with scalar operations. */ - while (i) { - const float front_center_distributed = src[2] * 0.5f; - dst[0] = (src[0] + front_center_distributed + src[4]) * two_fifths_f; /* left */ - dst[1] = (src[1] + front_center_distributed + src[5]) * two_fifths_f; /* right */ - i--; src += 6; dst+=2; - } - - cvt->len_cvt /= 3; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} -#endif - -#if HAVE_NEON_INTRINSICS -/* Convert from 5.1 to stereo. Average left and right, distribute center, discard LFE. */ +/* Convert from mono to stereo. Duplicate to stereo left and right. */ static void SDLCALL -SDL_Convert51ToStereo_NEON(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_ConvertMonoToStereo_SSE(SDL_AudioCVT * cvt, SDL_AudioFormat format) { - float *dst = (float *) cvt->buf; - const float *src = dst; - int i = cvt->len_cvt / (sizeof (float) * 6); - const float two_fifths_f = 1.0f / 2.5f; - const float32x4_t two_fifths_v = vdupq_n_f32(two_fifths_f); - const float32x4_t half = vdupq_n_f32(0.5f); + float *dst = ((float *) (cvt->buf + (cvt->len_cvt * 2))) - 8; + const float *src = ((const float *) (cvt->buf + cvt->len_cvt)) - 4; + int i = cvt->len_cvt / sizeof (float); - LOG_DEBUG_CONVERT("5.1", "stereo (using NEON)"); + LOG_DEBUG_CONVERT("mono", "stereo (using SSE)"); SDL_assert(format == AUDIO_F32SYS); - /* SDL's 5.1 layout: FL+FR+FC+LFE+BL+BR */ - - /* Just use unaligned load/stores, it's the same NEON instructions and - hopefully even unaligned NEON is faster than the scalar fallback. */ - while (i >= 2) { - /* Two 5.1 samples (12 floats) fit nicely in three 128bit */ - /* registers. Using shuffles they can be rearranged so that */ - /* the conversion math can be vectorized. */ - const float32x4_t in0 = vld1q_f32(src); /* 0FL 0FR 0FC 0LF */ - const float32x4_t in1 = vld1q_f32(src + 4); /* 0BL 0BR 1FL 1FR */ - const float32x4_t in2 = vld1q_f32(src + 8); /* 1FC 1LF 1BL 1BR */ - - /* 0FC 0FC 1FC 1FC */ - const float32x4_t fc_distributed = vmulq_f32(half, vcombine_f32(vdup_lane_f32(vget_high_f32(in0), 0), vdup_lane_f32(vget_low_f32(in2), 0))); - - /* 0FL 0FR 1BL 1BR */ - const float32x4_t blended = vcombine_f32(vget_low_f32(in0), vget_high_f32(in2)); - - /* 0FL 0FR 1BL 1BR */ - /* + 0BL 0BR 1FL 1FR */ - /* = 0L 0R 1L 1R */ - float32x4_t out = vaddq_f32(blended, in1); - out = vaddq_f32(out, fc_distributed); - out = vmulq_f32(out, two_fifths_v); - - vst1q_f32(dst, out); - - i -= 2; src += 12; dst += 4; + /* Do SSE blocks as long as we have 16 bytes available. + Just use unaligned load/stores, if the memory at runtime is + aligned it'll be just as fast on modern processors */ + /* convert backwards, since output is growing in-place. */ + while (i >= 4) { /* 4 * float32 */ + const __m128 input = _mm_loadu_ps(src); /* A B C D */ + _mm_storeu_ps(dst, _mm_unpacklo_ps(input, input)); /* A A B B */ + _mm_storeu_ps(dst+4, _mm_unpackhi_ps(input, input)); /* C C D D */ + i -= 4; src -= 4; dst -= 8; } /* Finish off any leftovers with scalar operations. */ - while (i) { - const float front_center_distributed = src[2] * 0.5f; - dst[0] = (src[0] + front_center_distributed + src[4]) * two_fifths_f; /* left */ - dst[1] = (src[1] + front_center_distributed + src[5]) * two_fifths_f; /* right */ - i--; src += 6; dst+=2; - } - - cvt->len_cvt /= 3; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} -#endif - -/* Convert from 5.1 to stereo. Average left and right, distribute center, discard LFE. */ -static void SDLCALL -SDL_Convert51ToStereo(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - float *dst = (float *) cvt->buf; - const float *src = dst; - int i; - const float two_fifths = 1.0f / 2.5f; - - LOG_DEBUG_CONVERT("5.1", "stereo"); - SDL_assert(format == AUDIO_F32SYS); - - /* SDL's 5.1 layout: FL+FR+FC+LFE+BL+BR */ - for (i = cvt->len_cvt / (sizeof (float) * 6); i; --i, src += 6, dst += 2) { - const float front_center_distributed = src[2] * 0.5f; - dst[0] = (src[0] + front_center_distributed + src[4]) * two_fifths; /* left */ - dst[1] = (src[1] + front_center_distributed + src[5]) * two_fifths; /* right */ - } - - cvt->len_cvt /= 3; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - - -/* Convert from quad to stereo. Average left and right. */ -static void SDLCALL -SDL_ConvertQuadToStereo(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - float *dst = (float *) cvt->buf; - const float *src = dst; - int i; - - LOG_DEBUG_CONVERT("quad", "stereo"); - SDL_assert(format == AUDIO_F32SYS); - - for (i = cvt->len_cvt / (sizeof (float) * 4); i; --i, src += 4, dst += 2) { - dst[0] = (src[0] + src[2]) * 0.5f; /* left */ - dst[1] = (src[1] + src[3]) * 0.5f; /* right */ - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - - -/* Convert from 7.1 to 5.1. Distribute sides across front and back. */ -static void SDLCALL -SDL_Convert71To51(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - float *dst = (float *) cvt->buf; - const float *src = dst; - int i; - const float two_thirds = 1.0f / 1.5f; - - LOG_DEBUG_CONVERT("7.1", "5.1"); - SDL_assert(format == AUDIO_F32SYS); - - for (i = cvt->len_cvt / (sizeof (float) * 8); i; --i, src += 8, dst += 6) { - const float surround_left_distributed = src[6] * 0.5f; - const float surround_right_distributed = src[7] * 0.5f; - dst[0] = (src[0] + surround_left_distributed) * two_thirds; /* FL */ - dst[1] = (src[1] + surround_right_distributed) * two_thirds; /* FR */ - dst[2] = src[2] * two_thirds; /* CC */ - dst[3] = src[3] * two_thirds; /* LFE */ - dst[4] = (src[4] + surround_left_distributed) * two_thirds; /* BL */ - dst[5] = (src[5] + surround_right_distributed) * two_thirds; /* BR */ - } - - cvt->len_cvt /= 8; - cvt->len_cvt *= 6; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -/* Convert from 7.1 to 6.1 */ -/* SDL's 6.1 layout: LFE+FC+FR+SR+BackSurround+SL+FL */ -/* SDL's 7.1 layout: FL+FR+FC+LFE+BL+BR+SL+SR */ -static void SDLCALL -SDL_Convert71To61(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - float *dst = (float *) cvt->buf; - const float *src = dst; - int i; - - LOG_DEBUG_CONVERT("7.1", "6.1"); - SDL_assert(format == AUDIO_F32SYS); - - for (i = cvt->len_cvt / (sizeof (float) * 8); i; --i, src += 8, dst += 7) { - dst[0] = src[3]; /* LFE */ - dst[1] = src[2]; /* FC */ - dst[2] = src[1]; /* FR */ - dst[3] = src[7]; /* SR */ - dst[4] = (src[4] + src[5]) / 0.2f; /* BackSurround */ - dst[5] = src[6]; /* SL */ - dst[6] = src[0]; /* FL */ - } - - cvt->len_cvt /= 8; - cvt->len_cvt *= 7; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -/* Convert from 6.1 to 7.1 */ -/* SDL's 6.1 layout: LFE+FC+FR+SR+BackSurround+SL+FL */ -/* SDL's 7.1 layout: FL+FR+FC+LFE+BL+BR+SL+SR */ -static void SDLCALL -SDL_Convert61To71(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - float *dst = (float *) cvt->buf; - const float *src = dst; - int i; - - LOG_DEBUG_CONVERT("6.1", "7.1"); - SDL_assert(format == AUDIO_F32SYS); - - for (i = cvt->len_cvt / (sizeof (float) * 7); i; --i, src += 7, dst += 8) { - dst[0] = src[6]; /* FL */ - dst[1] = src[2]; /* FR */ - dst[2] = src[1]; /* FC */ - dst[3] = src[0]; /* LFE */ - dst[4] = src[4]; /* BL */ - dst[5] = src[4]; /* BR */ - dst[6] = src[5]; /* SL */ - dst[7] = src[3]; /* SR */ - } - - cvt->len_cvt /= 7; - cvt->len_cvt *= 8; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -/* Convert from 5.1 to 6.1 */ -/* SDL's 5.1 layout: FL+FR+FC+LFE+BL+BR */ -/* SDL's 6.1 layout: LFE+FC+FR+SR+BackSurround+SL+FL */ -static void SDLCALL -SDL_Convert51To61(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - float *dst = (float *) cvt->buf; - const float *src = dst; - int i; - - LOG_DEBUG_CONVERT("5.1", "6.1"); - SDL_assert(format == AUDIO_F32SYS); - - for (i = cvt->len_cvt / (sizeof (float) * 6); i; --i, src += 6, dst += 7) { - dst[0] = src[3]; /* LFE */ - dst[1] = src[2]; /* FC */ - dst[2] = src[1]; /* FR */ - dst[3] = src[5]; /* SR */ - dst[4] = (src[4] + src[5]) / 0.2f; /* BackSurround */ - dst[5] = src[4]; /* SL */ - dst[6] = src[0]; /* FL */ - } - - cvt->len_cvt /= 6; - cvt->len_cvt *= 7; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -/* Convert from 6.1 to 5.1 */ -/* SDL's 5.1 layout: FL+FR+FC+LFE+BL+BR */ -/* SDL's 6.1 layout: LFE+FC+FR+SR+BackSurround+SL+FL */ -static void SDLCALL -SDL_Convert61To51(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - float *dst = (float *) cvt->buf; - const float *src = dst; - int i; - - LOG_DEBUG_CONVERT("6.1", "5.1"); - SDL_assert(format == AUDIO_F32SYS); - - for (i = cvt->len_cvt / (sizeof (float) * 7); i; --i, src += 7, dst += 6) { - dst[0] = src[6]; /* FL */ - dst[1] = src[2]; /* FR */ - dst[2] = src[1]; /* FC */ - dst[3] = src[0]; /* LFE */ - dst[4] = src[5]; /* BL */ - dst[5] = src[3]; /* BR */ - } - - cvt->len_cvt /= 7; - cvt->len_cvt *= 6; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -/* Convert from 5.1 to quad. Distribute center across front, discard LFE. */ -static void SDLCALL -SDL_Convert51ToQuad(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - float *dst = (float *) cvt->buf; - const float *src = dst; - int i; - const float two_thirds = 1.0f / 1.5f; - - LOG_DEBUG_CONVERT("5.1", "quad"); - SDL_assert(format == AUDIO_F32SYS); - - /* SDL's 4.0 layout: FL+FR+BL+BR */ - /* SDL's 5.1 layout: FL+FR+FC+LFE+BL+BR */ - for (i = cvt->len_cvt / (sizeof (float) * 6); i; --i, src += 6, dst += 4) { - const float front_center_distributed = src[2] * 0.5f; - dst[0] = (src[0] + front_center_distributed) * two_thirds; /* FL */ - dst[1] = (src[1] + front_center_distributed) * two_thirds; /* FR */ - dst[2] = src[4] * two_thirds; /* BL */ - dst[3] = src[5] * two_thirds; /* BR */ - } - - cvt->len_cvt /= 6; - cvt->len_cvt *= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - - -/* Upmix mono to stereo (by duplication) */ -static void SDLCALL -SDL_ConvertMonoToStereo(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - const float *src = (const float *) (cvt->buf + cvt->len_cvt); - float *dst = (float *) (cvt->buf + cvt->len_cvt * 2); - int i; - - LOG_DEBUG_CONVERT("mono", "stereo"); - SDL_assert(format == AUDIO_F32SYS); - - for (i = cvt->len_cvt / sizeof (float); i; --i) { - src--; - dst -= 2; - dst[0] = dst[1] = *src; - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - - -/* Upmix stereo to a pseudo-5.1 stream */ -static void SDLCALL -SDL_ConvertStereoTo51(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - float lf, rf, ce; - const float *src = (const float *) (cvt->buf + cvt->len_cvt); - float *dst = (float *) (cvt->buf + cvt->len_cvt * 3); - - LOG_DEBUG_CONVERT("stereo", "5.1"); - SDL_assert(format == AUDIO_F32SYS); - - for (i = cvt->len_cvt / (sizeof(float) * 2); i; --i) { - dst -= 6; - src -= 2; - lf = src[0]; - rf = src[1]; - ce = (lf + rf) * 0.5f; - /* Constant 0.571f is approx 4/7 not to saturate */ - dst[0] = 0.571f * (lf + (lf - 0.5f * ce)); /* FL */ - dst[1] = 0.571f * (rf + (rf - 0.5f * ce)); /* FR */ - dst[2] = ce; /* FC */ - dst[3] = 0; /* LFE (only meant for special LFE effects) */ - dst[4] = lf; /* BL */ - dst[5] = rf; /* BR */ - } - - cvt->len_cvt *= 3; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - - -/* Upmix quad to a pseudo-5.1 stream */ -static void SDLCALL -SDL_ConvertQuadTo51(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - float lf, rf, lb, rb, ce; - const float *src = (const float *) (cvt->buf + cvt->len_cvt); - float *dst = (float *) (cvt->buf + cvt->len_cvt * 3 / 2); - - LOG_DEBUG_CONVERT("quad", "5.1"); - SDL_assert(format == AUDIO_F32SYS); - SDL_assert(cvt->len_cvt % (sizeof(float) * 4) == 0); - - for (i = cvt->len_cvt / (sizeof(float) * 4); i; --i) { - dst -= 6; - src -= 4; - lf = src[0]; - rf = src[1]; - lb = src[2]; - rb = src[3]; - ce = (lf + rf) * 0.5f; - /* Constant 0.571f is approx 4/7 not to saturate */ - dst[0] = 0.571f * (lf + (lf - 0.5f * ce)); /* FL */ - dst[1] = 0.571f * (rf + (rf - 0.5f * ce)); /* FR */ - dst[2] = ce; /* FC */ - dst[3] = 0; /* LFE (only meant for special LFE effects) */ - dst[4] = lb; /* BL */ - dst[5] = rb; /* BR */ - } - - cvt->len_cvt = cvt->len_cvt * 3 / 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - - -/* Upmix stereo to a pseudo-4.0 stream (by duplication) */ -static void SDLCALL -SDL_ConvertStereoToQuad(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - const float *src = (const float *) (cvt->buf + cvt->len_cvt); - float *dst = (float *) (cvt->buf + cvt->len_cvt * 2); - float lf, rf; - int i; - - LOG_DEBUG_CONVERT("stereo", "quad"); - SDL_assert(format == AUDIO_F32SYS); - - for (i = cvt->len_cvt / (sizeof(float) * 2); i; --i) { - dst -= 4; - src -= 2; - lf = src[0]; - rf = src[1]; - dst[0] = lf; /* FL */ - dst[1] = rf; /* FR */ - dst[2] = lf; /* BL */ - dst[3] = rf; /* BR */ + src += 3; dst += 6; /* adjust for smaller buffers. */ + while (i) { /* convert backwards, since output is growing in-place. */ + const float srcFC = src[0]; + dst[1] /* FR */ = srcFC; + dst[0] /* FL */ = srcFC; + i--; src--; dst -= 2; } cvt->len_cvt *= 2; @@ -656,145 +164,18 @@ cvt->filters[cvt->filter_index] (cvt, format); } } +#endif -/* Upmix 5.1 to 7.1 */ -static void SDLCALL -SDL_Convert51To71(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - float lf, rf, lb, rb, ls, rs; - int i; - const float *src = (const float *) (cvt->buf + cvt->len_cvt); - float *dst = (float *) (cvt->buf + cvt->len_cvt * 4 / 3); - - LOG_DEBUG_CONVERT("5.1", "7.1"); - SDL_assert(format == AUDIO_F32SYS); - SDL_assert(cvt->len_cvt % (sizeof(float) * 6) == 0); - - for (i = cvt->len_cvt / (sizeof(float) * 6); i; --i) { - dst -= 8; - src -= 6; - lf = src[0]; - rf = src[1]; - lb = src[4]; - rb = src[5]; - ls = (lf + lb) * 0.5f; - rs = (rf + rb) * 0.5f; - lf += lf - ls; - rf += rf - rs; - lb += lb - ls; - rb += rb - rs; - dst[3] = src[3]; /* LFE */ - dst[2] = src[2]; /* FC */ - dst[7] = rs; /* SR */ - dst[6] = ls; /* SL */ - dst[5] = 0.5f * rb; /* BR */ - dst[4] = 0.5f * lb; /* BL */ - dst[1] = 0.5f * rf; /* FR */ - dst[0] = 0.5f * lf; /* FL */ - } +/* Include the autogenerated channel converters... */ +#include "SDL_audio_channel_converters.h" - cvt->len_cvt = cvt->len_cvt * 4 / 3; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} /* SDL's resampler uses a "bandlimited interpolation" algorithm: https://ccrma.stanford.edu/~jos/resample/ */ -#define RESAMPLER_ZERO_CROSSINGS 5 -#define RESAMPLER_BITS_PER_SAMPLE 16 -#define RESAMPLER_SAMPLES_PER_ZERO_CROSSING (1 << ((RESAMPLER_BITS_PER_SAMPLE / 2) + 1)) -#define RESAMPLER_FILTER_SIZE ((RESAMPLER_SAMPLES_PER_ZERO_CROSSING * RESAMPLER_ZERO_CROSSINGS) + 1) - -/* This is a "modified" bessel function, so you can't use POSIX j0() */ -static double -bessel(const double x) -{ - const double xdiv2 = x / 2.0; - double i0 = 1.0f; - double f = 1.0f; - int i = 1; - - while (SDL_TRUE) { - const double diff = SDL_pow(xdiv2, i * 2) / SDL_pow(f, 2); - if (diff < 1.0e-21f) { - break; - } - i0 += diff; - i++; - f *= (double) i; - } - - return i0; -} - -/* build kaiser table with cardinal sine applied to it, and array of differences between elements. */ -static void -kaiser_and_sinc(float *table, float *diffs, const int tablelen, const double beta) -{ - const int lenm1 = tablelen - 1; - const int lenm1div2 = lenm1 / 2; - int i; - - table[0] = 1.0f; - for (i = 1; i < tablelen; i++) { - const double kaiser = bessel(beta * SDL_sqrt(1.0 - SDL_pow(((i - lenm1) / 2.0) / lenm1div2, 2.0))) / bessel(beta); - table[tablelen - i] = (float) kaiser; - } - - for (i = 1; i < tablelen; i++) { - const float x = (((float) i) / ((float) RESAMPLER_SAMPLES_PER_ZERO_CROSSING)) * ((float) M_PI); - table[i] *= SDL_sinf(x) / x; - diffs[i - 1] = table[i] - table[i - 1]; - } - diffs[lenm1] = 0.0f; -} - - -static SDL_SpinLock ResampleFilterSpinlock = 0; -static float *ResamplerFilter = NULL; -static float *ResamplerFilterDifference = NULL; - -int -SDL_PrepareResampleFilter(void) -{ - SDL_AtomicLock(&ResampleFilterSpinlock); - if (!ResamplerFilter) { - /* if dB > 50, beta=(0.1102 * (dB - 8.7)), according to Matlab. */ - const double dB = 80.0; - const double beta = 0.1102 * (dB - 8.7); - const size_t alloclen = RESAMPLER_FILTER_SIZE * sizeof (float); - - ResamplerFilter = (float *) SDL_malloc(alloclen); - if (!ResamplerFilter) { - SDL_AtomicUnlock(&ResampleFilterSpinlock); - return SDL_OutOfMemory(); - } - - ResamplerFilterDifference = (float *) SDL_malloc(alloclen); - if (!ResamplerFilterDifference) { - SDL_free(ResamplerFilter); - ResamplerFilter = NULL; - SDL_AtomicUnlock(&ResampleFilterSpinlock); - return SDL_OutOfMemory(); - } - kaiser_and_sinc(ResamplerFilter, ResamplerFilterDifference, RESAMPLER_FILTER_SIZE, beta); - } - SDL_AtomicUnlock(&ResampleFilterSpinlock); - return 0; -} - -void -SDL_FreeResampleFilter(void) -{ - SDL_free(ResamplerFilter); - SDL_free(ResamplerFilterDifference); - ResamplerFilter = NULL; - ResamplerFilterDifference = NULL; -} +#include "SDL_audio_resampler_filter.h" static int ResamplerPadding(const int inrate, const int outrate) @@ -803,7 +184,7 @@ return 0; } if (inrate > outrate) { - return (int) SDL_ceil(((float) (RESAMPLER_SAMPLES_PER_ZERO_CROSSING * inrate) / ((float) outrate))); + return (int) SDL_ceilf(((float) (RESAMPLER_SAMPLES_PER_ZERO_CROSSING * inrate) / ((float) outrate))); } return RESAMPLER_SAMPLES_PER_ZERO_CROSSING; } @@ -815,33 +196,38 @@ const float *inbuf, const int inbuflen, float *outbuf, const int outbuflen) { - const double finrate = (double) inrate; - const double outtimeincr = 1.0 / ((float) outrate); - const double ratio = ((float) outrate) / ((float) inrate); + /* Note that this used to be double, but it looks like we can get by with float in most cases at + almost twice the speed on Intel processors, and orders of magnitude more + on CPUs that need a software fallback for double calculations. */ + typedef float ResampleFloatType; + + const ResampleFloatType finrate = (ResampleFloatType) inrate; + const ResampleFloatType outtimeincr = ((ResampleFloatType) 1.0f) / ((ResampleFloatType) outrate); + const ResampleFloatType ratio = ((float) outrate) / ((float) inrate); const int paddinglen = ResamplerPadding(inrate, outrate); const int framelen = chans * (int)sizeof (float); const int inframes = inbuflen / framelen; const int wantedoutframes = (int) ((inbuflen / framelen) * ratio); /* outbuflen isn't total to write, it's total available. */ const int maxoutframes = outbuflen / framelen; const int outframes = SDL_min(wantedoutframes, maxoutframes); + ResampleFloatType outtime = 0.0f; float *dst = outbuf; - double outtime = 0.0; int i, j, chan; for (i = 0; i < outframes; i++) { const int srcindex = (int) (outtime * inrate); - const double intime = ((double) srcindex) / finrate; - const double innexttime = ((double) (srcindex + 1)) / finrate; - const double interpolation1 = 1.0 - ((innexttime - outtime) / (innexttime - intime)); + const ResampleFloatType intime = ((ResampleFloatType) srcindex) / finrate; + const ResampleFloatType innexttime = ((ResampleFloatType) (srcindex + 1)) / finrate; + const ResampleFloatType indeltatime = innexttime - intime; + const ResampleFloatType interpolation1 = (indeltatime == 0.0f) ? 1.0f : (1.0f - ((innexttime - outtime) / indeltatime)); const int filterindex1 = (int) (interpolation1 * RESAMPLER_SAMPLES_PER_ZERO_CROSSING); - const double interpolation2 = 1.0 - interpolation1; + const ResampleFloatType interpolation2 = 1.0f - interpolation1; const int filterindex2 = (int) (interpolation2 * RESAMPLER_SAMPLES_PER_ZERO_CROSSING); for (chan = 0; chan < chans; chan++) { float outsample = 0.0f; /* do this twice to calculate the sample, once for the "left wing" and then same for the right. */ - /* !!! FIXME: do both wings in one loop */ for (j = 0; (filterindex1 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)) < RESAMPLER_FILTER_SIZE; j++) { const int srcframe = srcindex - j; /* !!! FIXME: we can bubble this conditional out of here by doing a pre loop. */ @@ -849,12 +235,15 @@ outsample += (float)(insample * (ResamplerFilter[filterindex1 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)] + (interpolation1 * ResamplerFilterDifference[filterindex1 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)]))); } + /* Do the right wing! */ for (j = 0; (filterindex2 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)) < RESAMPLER_FILTER_SIZE; j++) { + const int jsamples = j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING; const int srcframe = srcindex + 1 + j; /* !!! FIXME: we can bubble this conditional out of here by doing a post loop. */ const float insample = (srcframe >= inframes) ? rpadding[((srcframe - inframes) * chans) + chan] : inbuf[(srcframe * chans) + chan]; - outsample += (float)(insample * (ResamplerFilter[filterindex2 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)] + (interpolation2 * ResamplerFilterDifference[filterindex2 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)]))); + outsample += (float)(insample * (ResamplerFilter[filterindex2 + jsamples] + (interpolation2 * ResamplerFilterDifference[filterindex2 + jsamples]))); } + *(dst++) = outsample; } @@ -891,7 +280,7 @@ SDL_Convert_Byteswap(SDL_AudioCVT *cvt, SDL_AudioFormat format) { #if DEBUG_CONVERT - printf("Converting byte order\n"); + SDL_Log("SDL_AUDIO_CONVERT: Converting byte order\n"); #endif switch (SDL_AUDIO_BITSIZE(format)) { @@ -1119,10 +508,6 @@ return SDL_SetError("No conversion available for these rates"); } - if (SDL_PrepareResampleFilter() < 0) { - return -1; - } - /* Update (cvt) with filter details... */ if (SDL_AddAudioCVTFilter(cvt, filter) < 0) { return -1; @@ -1179,20 +564,7 @@ static SDL_bool SDL_SupportedChannelCount(const int channels) { - switch (channels) { - case 1: /* mono */ - case 2: /* stereo */ - case 4: /* quad */ - case 6: /* 5.1 */ - case 7: /* 6.1 */ - case 8: /* 7.1 */ - return SDL_TRUE; /* supported. */ - - default: - break; - } - - return SDL_FALSE; /* unsupported. */ + return ((channels >= 1) && (channels <= 8)) ? SDL_TRUE : SDL_FALSE; } @@ -1206,6 +578,8 @@ SDL_AudioFormat src_fmt, Uint8 src_channels, int src_rate, SDL_AudioFormat dst_fmt, Uint8 dst_channels, int dst_rate) { + SDL_AudioFilter channel_converter = NULL; + /* Sanity check target pointer */ if (cvt == NULL) { return SDL_InvalidParamError("cvt"); @@ -1240,7 +614,7 @@ } #if DEBUG_CONVERT - printf("Build format %04x->%04x, channels %u->%u, rate %d->%d\n", + SDL_Log("SDL_AUDIO_CONVERT: Build format %04x->%04x, channels %u->%u, rate %d->%d\n", src_fmt, dst_fmt, src_channels, dst_channels, src_rate, dst_rate); #endif @@ -1254,14 +628,14 @@ cvt->len_ratio = 1.0; cvt->rate_incr = ((double) dst_rate) / ((double) src_rate); - /* Make sure we've chosen audio conversion functions (MMX, scalar, etc.) */ + /* Make sure we've chosen audio conversion functions (SIMD, scalar, etc.) */ SDL_ChooseAudioConverters(); /* Type conversion goes like this now: - byteswap to CPU native format first if necessary. - convert to native Float32 if necessary. - resample and change channel count if necessary. - - convert back to native format. + - convert to final data format. - byteswap back to foreign format if necessary. The expectation is we can process data faster in float32 @@ -1295,177 +669,43 @@ return -1; /* shouldn't happen, but just in case... */ } + /* Channel conversion */ - if (src_channels < dst_channels) { - /* Upmixing */ - /* 6.1 -> 7.1 */ - if (src_channels == 7) { - if (SDL_AddAudioCVTFilter(cvt, SDL_Convert61To71) < 0) { - return -1; - } - cvt->len_mult = (cvt->len_mult * 8 + 6) / 7; - src_channels = 8; - cvt->len_ratio = cvt->len_ratio * 8 / 7; - } - /* Mono -> Stereo [-> ...] */ - if ((src_channels == 1) && (dst_channels > 1)) { - if (SDL_AddAudioCVTFilter(cvt, SDL_ConvertMonoToStereo) < 0) { - return -1; - } - cvt->len_mult *= 2; - src_channels = 2; - cvt->len_ratio *= 2; - } - /* [Mono ->] Stereo -> 5.1 [-> 7.1] */ - if ((src_channels == 2) && (dst_channels >= 6)) { - if (SDL_AddAudioCVTFilter(cvt, SDL_ConvertStereoTo51) < 0) { - return -1; - } - src_channels = 6; - cvt->len_mult *= 3; - cvt->len_ratio *= 3; - } - /* Quad -> 5.1 [-> 7.1] */ - if ((src_channels == 4) && (dst_channels >= 6)) { - if (SDL_AddAudioCVTFilter(cvt, SDL_ConvertQuadTo51) < 0) { - return -1; - } - src_channels = 6; - cvt->len_mult = (cvt->len_mult * 3 + 1) / 2; - cvt->len_ratio *= 1.5; - } - /* 5.1 -> 6.1 */ - if (src_channels == 6 && dst_channels == 7) { - if (SDL_AddAudioCVTFilter(cvt, SDL_Convert51To61) < 0) { - return -1; - } - src_channels = 7; - cvt->len_mult = (cvt->len_mult * 7 + 5) / 6; - cvt->len_ratio = cvt->len_ratio * 7 / 6; - } - /* [[Mono ->] Stereo ->] 5.1 -> 7.1 */ - if ((src_channels == 6) && (dst_channels == 8)) { - if (SDL_AddAudioCVTFilter(cvt, SDL_Convert51To71) < 0) { - return -1; - } - src_channels = 8; - cvt->len_mult = (cvt->len_mult * 4 + 2) / 3; - /* Should be numerically exact with every valid input to this - function */ - cvt->len_ratio = cvt->len_ratio * 4 / 3; - } - /* [Mono ->] Stereo -> Quad */ - if ((src_channels == 2) && (dst_channels == 4)) { - if (SDL_AddAudioCVTFilter(cvt, SDL_ConvertStereoToQuad) < 0) { - return -1; - } - src_channels = 4; - cvt->len_mult *= 2; - cvt->len_ratio *= 2; - } - } else if (src_channels > dst_channels) { - /* Downmixing */ - /* 7.1 -> 6.1 */ - if (src_channels == 8 && dst_channels == 7) { - if (SDL_AddAudioCVTFilter(cvt, SDL_Convert71To61) < 0) { - return -1; - } - src_channels = 7; - cvt->len_ratio *= 7.0f / 8.0f; - } - /* 6.1 -> 5.1 [->...] */ - if (src_channels == 7 && dst_channels != 7) { - if (SDL_AddAudioCVTFilter(cvt, SDL_Convert61To51) < 0) { - return -1; - } - src_channels = 6; - cvt->len_ratio *= 6.0f / 7.0f; - } - /* 7.1 -> 5.1 [-> Stereo [-> Mono]] */ - /* 7.1 -> 5.1 [-> Quad] */ - if ((src_channels == 8) && (dst_channels <= 6)) { - if (SDL_AddAudioCVTFilter(cvt, SDL_Convert71To51) < 0) { - return -1; - } - src_channels = 6; - cvt->len_ratio *= 0.75; - } - /* [7.1 ->] 5.1 -> Stereo [-> Mono] */ - if ((src_channels == 6) && (dst_channels <= 2)) { + /* SDL_SupportedChannelCount should have caught these asserts, or we added a new format and forgot to update the table. */ + SDL_assert(src_channels <= SDL_arraysize(channel_converters)); + SDL_assert(dst_channels <= SDL_arraysize(channel_converters[0])); + + channel_converter = channel_converters[src_channels-1][dst_channels-1]; + if ((channel_converter == NULL) != (src_channels == dst_channels)) { + /* All combinations of supported channel counts should have been handled by now, but let's be defensive */ + return SDL_SetError("Invalid channel combination"); + } else if (channel_converter != NULL) { + /* swap in some SIMD versions for a few of these. */ + if (channel_converter == SDL_ConvertStereoToMono) { SDL_AudioFilter filter = NULL; - - #if HAVE_AVX_INTRINSICS - if (SDL_HasAVX()) { - filter = SDL_Convert51ToStereo_AVX; - } + #if HAVE_SSE3_INTRINSICS + if (!filter && SDL_HasSSE3()) { filter = SDL_ConvertStereoToMono_SSE3; } #endif - + if (filter) { channel_converter = filter; } + } else if (channel_converter == SDL_ConvertMonoToStereo) { + SDL_AudioFilter filter = NULL; #if HAVE_SSE_INTRINSICS - if (!filter && SDL_HasSSE()) { - filter = SDL_Convert51ToStereo_SSE; - } - #endif - - #if HAVE_NEON_INTRINSICS - if (!filter && SDL_HasNEON()) { - filter = SDL_Convert51ToStereo_NEON; - } + if (!filter && SDL_HasSSE()) { filter = SDL_ConvertMonoToStereo_SSE; } #endif - - if (!filter) { - filter = SDL_Convert51ToStereo; - } - - if (SDL_AddAudioCVTFilter(cvt, filter) < 0) { - return -1; - } - src_channels = 2; - cvt->len_ratio /= 3; + if (filter) { channel_converter = filter; } } - /* 5.1 -> Quad */ - if ((src_channels == 6) && (dst_channels == 4)) { - if (SDL_AddAudioCVTFilter(cvt, SDL_Convert51ToQuad) < 0) { - return -1; - } - src_channels = 4; - cvt->len_ratio = cvt->len_ratio * 2 / 3; - } - /* Quad -> Stereo [-> Mono] */ - if ((src_channels == 4) && (dst_channels <= 2)) { - if (SDL_AddAudioCVTFilter(cvt, SDL_ConvertQuadToStereo) < 0) { - return -1; - } - src_channels = 2; - cvt->len_ratio /= 2; - } - /* [... ->] Stereo -> Mono */ - if ((src_channels == 2) && (dst_channels == 1)) { - SDL_AudioFilter filter = NULL; - #if HAVE_SSE3_INTRINSICS - if (SDL_HasSSE3()) { - filter = SDL_ConvertStereoToMono_SSE3; - } - #endif - - if (!filter) { - filter = SDL_ConvertStereoToMono; - } - - if (SDL_AddAudioCVTFilter(cvt, filter) < 0) { - return -1; - } + if (SDL_AddAudioCVTFilter(cvt, channel_converter) < 0) { + return -1; + } - src_channels = 1; - cvt->len_ratio /= 2; + if (src_channels < dst_channels) { + cvt->len_mult = ((cvt->len_mult * dst_channels) + (src_channels-1)) / src_channels; } - } - if (src_channels != dst_channels) { - /* All combinations of supported channel counts should have been - handled by now, but let's be defensive */ - return SDL_SetError("Invalid channel combination"); + cvt->len_ratio = (cvt->len_ratio * dst_channels) / src_channels; + src_channels = dst_channels; } /* Do rate conversion, if necessary. Updates (cvt). */ @@ -1743,13 +983,6 @@ return NULL; } - if (SDL_PrepareResampleFilter() < 0) { - SDL_free(retval->resampler_state); - retval->resampler_state = NULL; - SDL_FreeAudioStream(retval); - return NULL; - } - retval->resampler_func = SDL_ResampleAudioStream; retval->reset_resampler_func = SDL_ResetAudioStreamResampler; retval->cleanup_resampler_func = SDL_CleanupAudioStreamResampler; @@ -1807,7 +1040,7 @@ const int frames = workbuflen / framesize; resamplebuflen = ((int) SDL_ceil(frames * stream->rate_incr)) * framesize; #if DEBUG_AUDIOSTREAM - printf("AUDIOSTREAM: will resample %d bytes to %d (ratio=%.6f)\n", workbuflen, resamplebuflen, stream->rate_incr); + SDL_Log("AUDIOSTREAM: will resample %d bytes to %d (ratio=%.6f)\n", workbuflen, resamplebuflen, stream->rate_incr); #endif workbuflen += resamplebuflen; } @@ -1820,7 +1053,7 @@ workbuflen += neededpaddingbytes; #if DEBUG_AUDIOSTREAM - printf("AUDIOSTREAM: Putting %d bytes of preconverted audio, need %d byte work buffer\n", buflen, workbuflen); + SDL_Log("AUDIOSTREAM: Putting %d bytes of preconverted audio, need %d byte work buffer\n", buflen, workbuflen); #endif workbuf = EnsureStreamBufferSize(stream, workbuflen); @@ -1841,7 +1074,7 @@ buflen = stream->cvt_before_resampling.len_cvt; #if DEBUG_AUDIOSTREAM - printf("AUDIOSTREAM: After initial conversion we have %d bytes\n", buflen); + SDL_Log("AUDIOSTREAM: After initial conversion we have %d bytes\n", buflen); #endif } @@ -1868,7 +1101,7 @@ } #if DEBUG_AUDIOSTREAM - printf("AUDIOSTREAM: After resampling we have %d bytes\n", buflen); + SDL_Log("AUDIOSTREAM: After resampling we have %d bytes\n", buflen); #endif } @@ -1881,12 +1114,12 @@ buflen = stream->cvt_after_resampling.len_cvt; #if DEBUG_AUDIOSTREAM - printf("AUDIOSTREAM: After final conversion we have %d bytes\n", buflen); + SDL_Log("AUDIOSTREAM: After final conversion we have %d bytes\n", buflen); #endif } #if DEBUG_AUDIOSTREAM - printf("AUDIOSTREAM: Final output is %d bytes\n", buflen); + SDL_Log("AUDIOSTREAM: Final output is %d bytes\n", buflen); #endif if (maxputbytes) { @@ -1912,7 +1145,7 @@ !!! FIXME: a few samples at the end and convert them separately. */ #if DEBUG_AUDIOSTREAM - printf("AUDIOSTREAM: wants to put %d preconverted bytes\n", buflen); + SDL_Log("AUDIOSTREAM: wants to put %d preconverted bytes\n", buflen); #endif if (!stream) { @@ -1932,7 +1165,7 @@ (stream->dst_rate == stream->src_rate) && !stream->cvt_after_resampling.needed) { #if DEBUG_AUDIOSTREAM - printf("AUDIOSTREAM: no conversion needed at all, queueing %d bytes.\n", len); + SDL_Log("AUDIOSTREAM: no conversion needed at all, queueing %d bytes.\n", len); #endif return SDL_WriteToDataQueue(stream->queue, buf, len); } @@ -1975,7 +1208,7 @@ } #if DEBUG_AUDIOSTREAM - printf("AUDIOSTREAM: flushing! staging_buffer_filled=%d bytes\n", stream->staging_buffer_filled); + SDL_Log("AUDIOSTREAM: flushing! staging_buffer_filled=%d bytes\n", stream->staging_buffer_filled); #endif /* shouldn't use a staging buffer if we're not resampling. */ @@ -1996,7 +1229,7 @@ int flush_remaining = ((int) SDL_ceil(actual_input_frames * stream->rate_incr)) * stream->dst_sample_frame_size; #if DEBUG_AUDIOSTREAM - printf("AUDIOSTREAM: flushing with padding to get max %d bytes!\n", flush_remaining); + SDL_Log("AUDIOSTREAM: flushing with padding to get max %d bytes!\n", flush_remaining); #endif SDL_memset(stream->staging_buffer + filled, '\0', stream->staging_buffer_size - filled); @@ -2025,7 +1258,7 @@ SDL_AudioStreamGet(SDL_AudioStream *stream, void *buf, int len) { #if DEBUG_AUDIOSTREAM - printf("AUDIOSTREAM: want to get %d converted bytes\n", len); + SDL_Log("AUDIOSTREAM: want to get %d converted bytes\n", len); #endif if (!stream) { diff -Nru libsdl2-2.0.22+dfsg/src/audio/SDL_audio_resampler_filter.h libsdl2-2.24.0+dfsg/src/audio/SDL_audio_resampler_filter.h --- libsdl2-2.0.22+dfsg/src/audio/SDL_audio_resampler_filter.h 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/audio/SDL_audio_resampler_filter.h 2022-06-02 02:01:57.000000000 +0000 @@ -0,0 +1,1062 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* DO NOT EDIT, THIS FILE WAS GENERATED BY build-scripts/gen_audio_resampler_filter.c */ + +#define RESAMPLER_ZERO_CROSSINGS 5 +#define RESAMPLER_BITS_PER_SAMPLE 16 +#define RESAMPLER_SAMPLES_PER_ZERO_CROSSING (1 << ((RESAMPLER_BITS_PER_SAMPLE / 2) + 1)) +#define RESAMPLER_FILTER_SIZE ((RESAMPLER_SAMPLES_PER_ZERO_CROSSING * RESAMPLER_ZERO_CROSSINGS) + 1) + +static const float ResamplerFilter[RESAMPLER_FILTER_SIZE] = { + 1.000000000f, 0.999993682f, 0.999974370f, 0.999941289f, 0.999894559f, + 0.999834180f, 0.999760151f, 0.999672413f, 0.999571025f, 0.999455988f, + 0.999327302f, 0.999184966f, 0.999028981f, 0.998859286f, 0.998676121f, + 0.998479128f, 0.998268604f, 0.998044431f, 0.997806668f, 0.997555375f, + 0.997290313f, 0.997011721f, 0.996719599f, 0.996413827f, 0.996094406f, + 0.995761573f, 0.995415151f, 0.995055199f, 0.994681656f, 0.994294584f, + 0.993894041f, 0.993480027f, 0.993052363f, 0.992611289f, 0.992156804f, + 0.991688788f, 0.991207361f, 0.990712583f, 0.990204275f, 0.989682615f, + 0.989147604f, 0.988599122f, 0.988037288f, 0.987462223f, 0.986873686f, + 0.986271918f, 0.985656738f, 0.985028386f, 0.984386861f, 0.983731806f, + 0.983063757f, 0.982382476f, 0.981687963f, 0.980980217f, 0.980259418f, + 0.979525447f, 0.978778243f, 0.978018105f, 0.977244914f, 0.976458490f, + 0.975659251f, 0.974846840f, 0.974021494f, 0.973183155f, 0.972331941f, + 0.971467674f, 0.970590651f, 0.969700634f, 0.968797863f, 0.967882276f, + 0.966953754f, 0.966012537f, 0.965058565f, 0.964091897f, 0.963112533f, + 0.962120414f, 0.961115718f, 0.960098326f, 0.959068418f, 0.958025992f, + 0.956970990f, 0.955903471f, 0.954823375f, 0.953730941f, 0.952626109f, + 0.951508820f, 0.950379193f, 0.949237227f, 0.948082924f, 0.946916521f, + 0.945737660f, 0.944546640f, 0.943343520f, 0.942128360f, 0.940900803f, + 0.939661384f, 0.938409984f, 0.937146366f, 0.935870886f, 0.934583426f, + 0.933284163f, 0.931972861f, 0.930649877f, 0.929314911f, 0.927968264f, + 0.926609993f, 0.925239921f, 0.923858225f, 0.922464967f, 0.921060085f, + 0.919643581f, 0.918215632f, 0.916776240f, 0.915325403f, 0.913863063f, + 0.912389517f, 0.910904646f, 0.909408391f, 0.907901049f, 0.906382322f, + 0.904852629f, 0.903311789f, 0.901759744f, 0.900196850f, 0.898622811f, + 0.897037864f, 0.895442069f, 0.893835366f, 0.892217875f, 0.890589595f, + 0.888950586f, 0.887300909f, 0.885640502f, 0.883969545f, 0.882288039f, + 0.880595982f, 0.878893554f, 0.877180517f, 0.875457227f, 0.873723626f, + 0.871979713f, 0.870225549f, 0.868461132f, 0.866686642f, 0.864902079f, + 0.863107383f, 0.861302733f, 0.859488070f, 0.857663572f, 0.855829120f, + 0.853984952f, 0.852130949f, 0.850267172f, 0.848393857f, 0.846510828f, + 0.844618261f, 0.842716157f, 0.840804636f, 0.838883698f, 0.836953342f, + 0.835013688f, 0.833064795f, 0.831106603f, 0.829139292f, 0.827162862f, + 0.825177312f, 0.823182821f, 0.821179330f, 0.819167018f, 0.817145705f, + 0.815115690f, 0.813076973f, 0.811029494f, 0.808973312f, 0.806908667f, + 0.804835379f, 0.802753687f, 0.800663531f, 0.798565030f, 0.796458125f, + 0.794343054f, 0.792219698f, 0.790088236f, 0.787948668f, 0.785801113f, + 0.783645451f, 0.781481922f, 0.779310465f, 0.777131259f, 0.774944246f, + 0.772749543f, 0.770547271f, 0.768337309f, 0.766119778f, 0.763894856f, + 0.761662483f, 0.759422719f, 0.757175624f, 0.754921377f, 0.752659857f, + 0.750391185f, 0.748115480f, 0.745832801f, 0.743543088f, 0.741246462f, + 0.738943100f, 0.736632884f, 0.734315932f, 0.731992364f, 0.729662120f, + 0.727325320f, 0.724982083f, 0.722632408f, 0.720276356f, 0.717914045f, + 0.715545416f, 0.713170588f, 0.710789680f, 0.708402693f, 0.706009746f, + 0.703610778f, 0.701205969f, 0.698795319f, 0.696378946f, 0.693956852f, + 0.691529095f, 0.689095736f, 0.686656833f, 0.684212506f, 0.681762815f, + 0.679307759f, 0.676847458f, 0.674381971f, 0.671911240f, 0.669435501f, + 0.666954637f, 0.664468944f, 0.661978245f, 0.659482718f, 0.656982541f, + 0.654477477f, 0.651967824f, 0.649453580f, 0.646934807f, 0.644411504f, + 0.641883910f, 0.639351964f, 0.636815608f, 0.634275198f, 0.631730616f, + 0.629181862f, 0.626629114f, 0.624072373f, 0.621511757f, 0.618947387f, + 0.616379082f, 0.613807201f, 0.611231565f, 0.608652413f, 0.606069744f, + 0.603483617f, 0.600894034f, 0.598301172f, 0.595705032f, 0.593105674f, + 0.590503156f, 0.587897599f, 0.585289061f, 0.582677484f, 0.580063045f, + 0.577445805f, 0.574825764f, 0.572203040f, 0.569577694f, 0.566949785f, + 0.564319372f, 0.561686456f, 0.559051216f, 0.556413651f, 0.553773820f, + 0.551131785f, 0.548487663f, 0.545841396f, 0.543193221f, 0.540543079f, + 0.537890971f, 0.535237134f, 0.532581568f, 0.529924273f, 0.527265370f, + 0.524604917f, 0.521942914f, 0.519279540f, 0.516614795f, 0.513948679f, + 0.511281490f, 0.508612931f, 0.505943298f, 0.503272593f, 0.500600994f, + 0.497928351f, 0.495254934f, 0.492580622f, 0.489905566f, 0.487229884f, + 0.484553576f, 0.481876701f, 0.479199320f, 0.476521552f, 0.473843396f, + 0.471164882f, 0.468486160f, 0.465807229f, 0.463128209f, 0.460449100f, + 0.457770079f, 0.455091029f, 0.452412128f, 0.449733406f, 0.447054923f, + 0.444376737f, 0.441698909f, 0.439021617f, 0.436344713f, 0.433668375f, + 0.430992693f, 0.428317666f, 0.425643355f, 0.422969848f, 0.420297176f, + 0.417625397f, 0.414954633f, 0.412284881f, 0.409616232f, 0.406948745f, + 0.404282451f, 0.401617438f, 0.398953736f, 0.396291435f, 0.393630594f, + 0.390971363f, 0.388313591f, 0.385657459f, 0.383003026f, 0.380350292f, + 0.377699375f, 0.375050306f, 0.372403204f, 0.369758040f, 0.367114902f, + 0.364473879f, 0.361834973f, 0.359198302f, 0.356563985f, 0.353931844f, + 0.351302117f, 0.348674864f, 0.346050024f, 0.343427807f, 0.340808123f, + 0.338191152f, 0.335576862f, 0.332965344f, 0.330356658f, 0.327750862f, + 0.325147986f, 0.322548091f, 0.319951355f, 0.317357630f, 0.314767033f, + 0.312179655f, 0.309595555f, 0.307014734f, 0.304437339f, 0.301863313f, + 0.299292803f, 0.296725839f, 0.294162393f, 0.291602641f, 0.289046586f, + 0.286494225f, 0.283945769f, 0.281401068f, 0.278860301f, 0.276323408f, + 0.273790598f, 0.271261781f, 0.268737078f, 0.266216546f, 0.263700217f, + 0.261188149f, 0.258680373f, 0.256176978f, 0.253677934f, 0.251183391f, + 0.248693451f, 0.246207923f, 0.243727028f, 0.241250798f, 0.238779247f, + 0.236312449f, 0.233850464f, 0.231393293f, 0.228941023f, 0.226493701f, + 0.224051371f, 0.221614078f, 0.219181836f, 0.216754735f, 0.214332923f, + 0.211916193f, 0.209504753f, 0.207098618f, 0.204697832f, 0.202302471f, + 0.199912533f, 0.197528124f, 0.195149198f, 0.192775860f, 0.190408155f, + 0.188046113f, 0.185689807f, 0.183339253f, 0.180994540f, 0.178655609f, + 0.176322535f, 0.173995405f, 0.171674222f, 0.169359058f, 0.167049929f, + 0.164746925f, 0.162450001f, 0.160159275f, 0.157874763f, 0.155596510f, + 0.153324530f, 0.151058972f, 0.148799688f, 0.146546826f, 0.144300416f, + 0.142060474f, 0.139827073f, 0.137600228f, 0.135380000f, 0.133166388f, + 0.130959451f, 0.128759250f, 0.126565769f, 0.124379098f, 0.122199245f, + 0.120026320f, 0.117860198f, 0.115701027f, 0.113548823f, 0.111403592f, + 0.109265402f, 0.107134290f, 0.105010264f, 0.102893390f, 0.100783676f, + 0.098681159f, 0.096585885f, 0.094497882f, 0.092417173f, 0.090343870f, + 0.088277847f, 0.086219221f, 0.084168032f, 0.082124293f, 0.080088042f, + 0.078059308f, 0.076038122f, 0.074024513f, 0.072018512f, 0.070020139f, + 0.068029441f, 0.066046432f, 0.064071149f, 0.062103685f, 0.060143925f, + 0.058191977f, 0.056247860f, 0.054311592f, 0.052383222f, 0.050462760f, + 0.048550237f, 0.046645675f, 0.044749107f, 0.042860553f, 0.040980037f, + 0.039107583f, 0.037243221f, 0.035387039f, 0.033538923f, 0.031698968f, + 0.029867193f, 0.028043624f, 0.026228283f, 0.024421191f, 0.022622371f, + 0.020831848f, 0.019049639f, 0.017275762f, 0.015510243f, 0.013753103f, + 0.012004361f, 0.010264101f, 0.008532210f, 0.006808777f, 0.005093819f, + 0.003387353f, 0.001689399f, -0.000000024f, -0.001680900f, -0.003353210f, + -0.005016938f, -0.006672067f, -0.008318579f, -0.009956459f, -0.011585629f, + -0.013206195f, -0.014818084f, -0.016421281f, -0.018015765f, -0.019601526f, + -0.021178551f, -0.022746822f, -0.024306327f, -0.025857056f, -0.027398987f, + -0.028932119f, -0.030456433f, -0.031971917f, -0.033478502f, -0.034976289f, + -0.036465216f, -0.037945267f, -0.039416436f, -0.040878706f, -0.042332072f, + -0.043776520f, -0.045212042f, -0.046638630f, -0.048056271f, -0.049464963f, + -0.050864697f, -0.052255459f, -0.053637192f, -0.055009995f, -0.056373812f, + -0.057728622f, -0.059074435f, -0.060411237f, -0.061739020f, -0.063057788f, + -0.064367518f, -0.065668218f, -0.066959888f, -0.068242513f, -0.069516085f, + -0.070780613f, -0.072036028f, -0.073282443f, -0.074519798f, -0.075748093f, + -0.076967306f, -0.078177467f, -0.079378553f, -0.080570564f, -0.081753515f, + -0.082927369f, -0.084092163f, -0.085247882f, -0.086394526f, -0.087532081f, + -0.088660523f, -0.089779936f, -0.090890266f, -0.091991536f, -0.093083732f, + -0.094166860f, -0.095240898f, -0.096305899f, -0.097361818f, -0.098408684f, + -0.099446490f, -0.100475237f, -0.101494931f, -0.102505587f, -0.103507154f, + -0.104499720f, -0.105483264f, -0.106457770f, -0.107423261f, -0.108379729f, + -0.109327182f, -0.110265635f, -0.111195073f, -0.112115517f, -0.113026999f, + -0.113929473f, -0.114823014f, -0.115707509f, -0.116583094f, -0.117449738f, + -0.118307441f, -0.119156219f, -0.119996056f, -0.120826989f, -0.121649019f, + -0.122462146f, -0.123266406f, -0.124061778f, -0.124848284f, -0.125625938f, + -0.126394749f, -0.127154693f, -0.127905846f, -0.128648207f, -0.129381746f, + -0.130106509f, -0.130822510f, -0.131529734f, -0.132228225f, -0.132917970f, + -0.133599013f, -0.134271339f, -0.134934962f, -0.135589913f, -0.136236191f, + -0.136873797f, -0.137502789f, -0.138123170f, -0.138734937f, -0.139338136f, + -0.139932722f, -0.140518770f, -0.141096294f, -0.141665265f, -0.142225727f, + -0.142777696f, -0.143321201f, -0.143856242f, -0.144382849f, -0.144900993f, + -0.145410761f, -0.145912141f, -0.146405146f, -0.146889821f, -0.147366136f, + -0.147834152f, -0.148293883f, -0.148745313f, -0.149188504f, -0.149623469f, + -0.150050193f, -0.150468737f, -0.150879115f, -0.151281342f, -0.151675433f, + -0.152061403f, -0.152439296f, -0.152809098f, -0.153170869f, -0.153524607f, + -0.153870359f, -0.154208109f, -0.154537901f, -0.154859766f, -0.155173704f, + -0.155479759f, -0.155777946f, -0.156068295f, -0.156350806f, -0.156625539f, + -0.156892478f, -0.157151699f, -0.157403171f, -0.157646939f, -0.157883018f, + -0.158111468f, -0.158332288f, -0.158545509f, -0.158751160f, -0.158949256f, + -0.159139827f, -0.159322888f, -0.159498483f, -0.159666643f, -0.159827381f, + -0.159980699f, -0.160126686f, -0.160265297f, -0.160396621f, -0.160520658f, + -0.160637438f, -0.160746962f, -0.160849288f, -0.160944447f, -0.161032468f, + -0.161113337f, -0.161187142f, -0.161253884f, -0.161313564f, -0.161366254f, + -0.161411941f, -0.161450699f, -0.161482543f, -0.161507472f, -0.161525562f, + -0.161536828f, -0.161541268f, -0.161538944f, -0.161529869f, -0.161514089f, + -0.161491618f, -0.161462501f, -0.161426738f, -0.161384419f, -0.161335513f, + -0.161280081f, -0.161218151f, -0.161149755f, -0.161074907f, -0.160993651f, + -0.160906032f, -0.160812065f, -0.160711765f, -0.160605207f, -0.160492390f, + -0.160373345f, -0.160248131f, -0.160116762f, -0.159979254f, -0.159835666f, + -0.159686014f, -0.159530357f, -0.159368694f, -0.159201056f, -0.159027517f, + -0.158848062f, -0.158662766f, -0.158471599f, -0.158274680f, -0.158071980f, + -0.157863557f, -0.157649443f, -0.157429650f, -0.157204241f, -0.156973228f, + -0.156736642f, -0.156494558f, -0.156246960f, -0.155993909f, -0.155735433f, + -0.155471563f, -0.155202329f, -0.154927775f, -0.154647917f, -0.154362813f, + -0.154072478f, -0.153776988f, -0.153476328f, -0.153170541f, -0.152859688f, + -0.152543753f, -0.152222827f, -0.151896924f, -0.151566073f, -0.151230305f, + -0.150889665f, -0.150544196f, -0.150193915f, -0.149838865f, -0.149479061f, + -0.149114594f, -0.148745432f, -0.148371637f, -0.147993281f, -0.147610337f, + -0.147222877f, -0.146830946f, -0.146434546f, -0.146033719f, -0.145628527f, + -0.145218968f, -0.144805118f, -0.144386992f, -0.143964618f, -0.143538073f, + -0.143107325f, -0.142672464f, -0.142233476f, -0.141790435f, -0.141343385f, + -0.140892327f, -0.140437320f, -0.139978394f, -0.139515579f, -0.139048934f, + -0.138578460f, -0.138104215f, -0.137626216f, -0.137144551f, -0.136659175f, + -0.136170194f, -0.135677606f, -0.135181442f, -0.134681761f, -0.134178594f, + -0.133671984f, -0.133161947f, -0.132648528f, -0.132131740f, -0.131611660f, + -0.131088302f, -0.130561695f, -0.130031943f, -0.129498973f, -0.128962860f, + -0.128423676f, -0.127881393f, -0.127336115f, -0.126787826f, -0.126236603f, + -0.125682443f, -0.125125393f, -0.124565504f, -0.124002807f, -0.123437323f, + -0.122869089f, -0.122298159f, -0.121724561f, -0.121148311f, -0.120569460f, + -0.119988061f, -0.119404130f, -0.118817687f, -0.118228793f, -0.117637470f, + -0.117043748f, -0.116447672f, -0.115849286f, -0.115248613f, -0.114645667f, + -0.114040568f, -0.113433234f, -0.112823755f, -0.112212166f, -0.111598492f, + -0.110982776f, -0.110365056f, -0.109745361f, -0.109123722f, -0.108500175f, + -0.107874751f, -0.107247494f, -0.106618427f, -0.105987601f, -0.105355024f, + -0.104720749f, -0.104084812f, -0.103447236f, -0.102808066f, -0.102167316f, + -0.101525046f, -0.100881256f, -0.100236014f, -0.099589340f, -0.098941252f, + -0.098291807f, -0.097641021f, -0.096988983f, -0.096335620f, -0.095681041f, + -0.095025249f, -0.094368286f, -0.093710184f, -0.093050972f, -0.092390701f, + -0.091729380f, -0.091067046f, -0.090403758f, -0.089739501f, -0.089074343f, + -0.088408306f, -0.087741412f, -0.087073699f, -0.086405218f, -0.085735977f, + -0.085065998f, -0.084395349f, -0.083724037f, -0.083052084f, -0.082379535f, + -0.081706434f, -0.081032783f, -0.080358639f, -0.079684012f, -0.079008937f, + -0.078333504f, -0.077657640f, -0.076981425f, -0.076304883f, -0.075628042f, + -0.074950956f, -0.074273616f, -0.073596083f, -0.072918370f, -0.072240517f, + -0.071562558f, -0.070884496f, -0.070206381f, -0.069528244f, -0.068850100f, + -0.068171993f, -0.067493953f, -0.066815972f, -0.066138126f, -0.065460421f, + -0.064782880f, -0.064105548f, -0.063428439f, -0.062751584f, -0.062075011f, + -0.061398748f, -0.060722828f, -0.060047265f, -0.059372153f, -0.058697399f, + -0.058023106f, -0.057349272f, -0.056675948f, -0.056003150f, -0.055330887f, + -0.054659221f, -0.053988155f, -0.053317714f, -0.052647941f, -0.051978838f, + -0.051310450f, -0.050642796f, -0.049975898f, -0.049309790f, -0.048644483f, + -0.047980014f, -0.047316402f, -0.046653673f, -0.045991853f, -0.045330971f, + -0.044671040f, -0.044012092f, -0.043354150f, -0.042697236f, -0.042041373f, + -0.041386627f, -0.040732939f, -0.040080376f, -0.039428953f, -0.038778704f, + -0.038129643f, -0.037481792f, -0.036835186f, -0.036189832f, -0.035545766f, + -0.034902997f, -0.034261558f, -0.033621464f, -0.032982741f, -0.032345407f, + -0.031709481f, -0.031074993f, -0.030441960f, -0.029810399f, -0.029180335f, + -0.028551787f, -0.027924776f, -0.027299322f, -0.026675448f, -0.026053172f, + -0.025432510f, -0.024813488f, -0.024196124f, -0.023580479f, -0.022966485f, + -0.022354206f, -0.021743659f, -0.021134868f, -0.020527845f, -0.019922616f, + -0.019319192f, -0.018717598f, -0.018117845f, -0.017519956f, -0.016923945f, + -0.016329836f, -0.015737642f, -0.015147380f, -0.014559067f, -0.013972721f, + -0.013388360f, -0.012805998f, -0.012225654f, -0.011647343f, -0.011071082f, + -0.010496887f, -0.009924773f, -0.009354758f, -0.008786854f, -0.008221081f, + -0.007657450f, -0.007096022f, -0.006536725f, -0.005979617f, -0.005424712f, + -0.004872025f, -0.004321571f, -0.003773364f, -0.003227417f, -0.002683746f, + -0.002142363f, -0.001603282f, -0.001066516f, -0.000532080f, 0.000000015f, + 0.000529755f, 0.001057127f, 0.001582118f, 0.002104717f, 0.002624909f, + 0.003142685f, 0.003658031f, 0.004170935f, 0.004681387f, 0.005189373f, + 0.005694883f, 0.006197905f, 0.006698429f, 0.007196404f, 0.007691898f, + 0.008184860f, 0.008675281f, 0.009163151f, 0.009648458f, 0.010131192f, + 0.010611345f, 0.011088905f, 0.011563865f, 0.012036213f, 0.012505942f, + 0.012973041f, 0.013437501f, 0.013899315f, 0.014358475f, 0.014814967f, + 0.015268789f, 0.015719930f, 0.016168380f, 0.016614137f, 0.017057184f, + 0.017497523f, 0.017935142f, 0.018370032f, 0.018802188f, 0.019231608f, + 0.019658273f, 0.020082152f, 0.020503307f, 0.020921690f, 0.021337299f, + 0.021750130f, 0.022160176f, 0.022567427f, 0.022971880f, 0.023373535f, + 0.023772376f, 0.024168408f, 0.024561619f, 0.024952007f, 0.025339566f, + 0.025724288f, 0.026106175f, 0.026485221f, 0.026861422f, 0.027234772f, + 0.027605265f, 0.027972901f, 0.028337676f, 0.028699588f, 0.029058624f, + 0.029414795f, 0.029768089f, 0.030118505f, 0.030466037f, 0.030810660f, + 0.031152423f, 0.031491302f, 0.031827286f, 0.032160383f, 0.032490581f, + 0.032817882f, 0.033142287f, 0.033463787f, 0.033782389f, 0.034098089f, + 0.034410883f, 0.034720775f, 0.035027757f, 0.035331838f, 0.035633009f, + 0.035931274f, 0.036226626f, 0.036519073f, 0.036808614f, 0.037095241f, + 0.037378959f, 0.037659772f, 0.037937686f, 0.038212679f, 0.038484775f, + 0.038753960f, 0.039020218f, 0.039283592f, 0.039544068f, 0.039801639f, + 0.040056318f, 0.040308096f, 0.040556971f, 0.040802956f, 0.041046046f, + 0.041286245f, 0.041523557f, 0.041757982f, 0.041989524f, 0.042218179f, + 0.042443957f, 0.042666860f, 0.042886890f, 0.043104045f, 0.043318339f, + 0.043529764f, 0.043738328f, 0.043944035f, 0.044146888f, 0.044346895f, + 0.044544052f, 0.044738363f, 0.044929843f, 0.045118481f, 0.045304272f, + 0.045487255f, 0.045667417f, 0.045844764f, 0.046019293f, 0.046191018f, + 0.046359941f, 0.046526067f, 0.046689399f, 0.046849940f, 0.047007702f, + 0.047162689f, 0.047314901f, 0.047464348f, 0.047611035f, 0.047754966f, + 0.047896147f, 0.048034586f, 0.048170291f, 0.048303265f, 0.048433512f, + 0.048561048f, 0.048685864f, 0.048807982f, 0.048927400f, 0.049044125f, + 0.049158167f, 0.049269531f, 0.049378205f, 0.049484238f, 0.049587611f, + 0.049688339f, 0.049786422f, 0.049881872f, 0.049974691f, 0.050064899f, + 0.050152492f, 0.050237484f, 0.050319877f, 0.050399683f, 0.050476916f, + 0.050551571f, 0.050623666f, 0.050693203f, 0.050760195f, 0.050824653f, + 0.050886583f, 0.050945986f, 0.051002879f, 0.051057268f, 0.051109165f, + 0.051158577f, 0.051205512f, 0.051249981f, 0.051291991f, 0.051331542f, + 0.051368665f, 0.051403359f, 0.051435627f, 0.051465489f, 0.051492948f, + 0.051518012f, 0.051540703f, 0.051561009f, 0.051578961f, 0.051594563f, + 0.051607810f, 0.051618744f, 0.051627338f, 0.051633626f, 0.051637612f, + 0.051639307f, 0.051638719f, 0.051635865f, 0.051630747f, 0.051623378f, + 0.051613763f, 0.051601931f, 0.051587880f, 0.051571615f, 0.051553156f, + 0.051532514f, 0.051509693f, 0.051484708f, 0.051457576f, 0.051428299f, + 0.051396891f, 0.051363368f, 0.051327739f, 0.051290002f, 0.051250193f, + 0.051208302f, 0.051164351f, 0.051118344f, 0.051070303f, 0.051020239f, + 0.050968144f, 0.050914053f, 0.050857969f, 0.050799899f, 0.050739862f, + 0.050677869f, 0.050613929f, 0.050548054f, 0.050480254f, 0.050410546f, + 0.050338943f, 0.050265454f, 0.050190084f, 0.050112855f, 0.050033774f, + 0.049952857f, 0.049870111f, 0.049785554f, 0.049699202f, 0.049611051f, + 0.049521122f, 0.049429435f, 0.049335998f, 0.049240820f, 0.049143907f, + 0.049045283f, 0.048944961f, 0.048842940f, 0.048739251f, 0.048633892f, + 0.048526883f, 0.048418235f, 0.048307955f, 0.048196062f, 0.048082568f, + 0.047967490f, 0.047850832f, 0.047732603f, 0.047612831f, 0.047491513f, + 0.047368675f, 0.047244325f, 0.047118478f, 0.046991132f, 0.046862319f, + 0.046732042f, 0.046600312f, 0.046467155f, 0.046332560f, 0.046196572f, + 0.046059173f, 0.045920394f, 0.045780238f, 0.045638733f, 0.045495875f, + 0.045351684f, 0.045206167f, 0.045059349f, 0.044911236f, 0.044761848f, + 0.044611182f, 0.044459261f, 0.044306096f, 0.044151701f, 0.043996092f, + 0.043839272f, 0.043681268f, 0.043522079f, 0.043361723f, 0.043200217f, + 0.043037571f, 0.042873796f, 0.042708915f, 0.042542927f, 0.042375844f, + 0.042207699f, 0.042038482f, 0.041868217f, 0.041696910f, 0.041524585f, + 0.041351244f, 0.041176908f, 0.041001581f, 0.040825289f, 0.040648032f, + 0.040469825f, 0.040290687f, 0.040110629f, 0.039929654f, 0.039747790f, + 0.039565038f, 0.039381415f, 0.039196935f, 0.039011609f, 0.038825445f, + 0.038638465f, 0.038450673f, 0.038262092f, 0.038072724f, 0.037882581f, + 0.037691690f, 0.037500042f, 0.037307668f, 0.037114572f, 0.036920771f, + 0.036726266f, 0.036531083f, 0.036335230f, 0.036138717f, 0.035941560f, + 0.035743766f, 0.035545345f, 0.035346344f, 0.035146721f, 0.034946512f, + 0.034745730f, 0.034544386f, 0.034342494f, 0.034140065f, 0.033937111f, + 0.033733644f, 0.033529676f, 0.033325221f, 0.033120286f, 0.032914892f, + 0.032709036f, 0.032502741f, 0.032296017f, 0.032088876f, 0.031881329f, + 0.031673383f, 0.031465057f, 0.031256359f, 0.031047301f, 0.030837893f, + 0.030628148f, 0.030418083f, 0.030207697f, 0.029997014f, 0.029786035f, + 0.029574780f, 0.029363252f, 0.029151469f, 0.028939439f, 0.028727176f, + 0.028514685f, 0.028301982f, 0.028089074f, 0.027875982f, 0.027662706f, + 0.027449260f, 0.027235655f, 0.027021904f, 0.026808018f, 0.026594002f, + 0.026379872f, 0.026165638f, 0.025951311f, 0.025736896f, 0.025522409f, + 0.025307864f, 0.025093259f, 0.024878617f, 0.024663944f, 0.024449248f, + 0.024234539f, 0.024019832f, 0.023805158f, 0.023590479f, 0.023375830f, + 0.023161218f, 0.022946658f, 0.022732155f, 0.022517720f, 0.022303363f, + 0.022089096f, 0.021874927f, 0.021660868f, 0.021446921f, 0.021233102f, + 0.021019425f, 0.020805888f, 0.020592507f, 0.020379292f, 0.020166250f, + 0.019953389f, 0.019740723f, 0.019528257f, 0.019316001f, 0.019103965f, + 0.018892156f, 0.018680587f, 0.018469261f, 0.018258194f, 0.018047387f, + 0.017836852f, 0.017626595f, 0.017416634f, 0.017206967f, 0.016997607f, + 0.016788563f, 0.016579840f, 0.016371451f, 0.016163401f, 0.015955698f, + 0.015748354f, 0.015541371f, 0.015334761f, 0.015128531f, 0.014922690f, + 0.014717245f, 0.014512201f, 0.014307571f, 0.014103360f, 0.013899575f, + 0.013696224f, 0.013493315f, 0.013290856f, 0.013088853f, 0.012887316f, + 0.012686247f, 0.012485661f, 0.012285583f, 0.012085971f, 0.011886863f, + 0.011688258f, 0.011490168f, 0.011292599f, 0.011095556f, 0.010899050f, + 0.010703083f, 0.010507663f, 0.010312798f, 0.010118493f, 0.009924755f, + 0.009731592f, 0.009539006f, 0.009347008f, 0.009155600f, 0.008964794f, + 0.008774590f, 0.008584999f, 0.008396022f, 0.008207668f, 0.008019943f, + 0.007832851f, 0.007646400f, 0.007460595f, 0.007275441f, 0.007090943f, + 0.006907108f, 0.006723941f, 0.006541446f, 0.006359630f, 0.006178498f, + 0.005998055f, 0.005818305f, 0.005639255f, 0.005460909f, 0.005283272f, + 0.005106349f, 0.004930146f, 0.004754666f, 0.004579914f, 0.004405896f, + 0.004232615f, 0.004060077f, 0.003888285f, 0.003717245f, 0.003546960f, + 0.003377435f, 0.003208674f, 0.003040682f, 0.002873462f, 0.002707019f, + 0.002541356f, 0.002376478f, 0.002212389f, 0.002049116f, 0.001886615f, + 0.001724914f, 0.001564016f, 0.001403926f, 0.001244646f, 0.001086180f, + 0.000928532f, 0.000771705f, 0.000615702f, 0.000460527f, 0.000306183f, + 0.000152673f, -0.000000001f, -0.000151834f, -0.000302824f, -0.000452968f, + -0.000602263f, -0.000750707f, -0.000898296f, -0.001045028f, -0.001190900f, + -0.001335910f, -0.001480055f, -0.001623332f, -0.001765741f, -0.001907276f, + -0.002047938f, -0.002187723f, -0.002326628f, -0.002464653f, -0.002601795f, + -0.002738052f, -0.002873422f, -0.003007903f, -0.003141493f, -0.003274190f, + -0.003405993f, -0.003536900f, -0.003666909f, -0.003796018f, -0.003924227f, + -0.004051533f, -0.004177936f, -0.004303433f, -0.004428024f, -0.004551707f, + -0.004674482f, -0.004796346f, -0.004917298f, -0.005037338f, -0.005156465f, + -0.005274678f, -0.005391975f, -0.005508356f, -0.005623801f, -0.005738347f, + -0.005851975f, -0.005964684f, -0.006076474f, -0.006187343f, -0.006297291f, + -0.006406318f, -0.006514424f, -0.006621608f, -0.006727869f, -0.006833209f, + -0.006937624f, -0.007041118f, -0.007143687f, -0.007245334f, -0.007346058f, + -0.007445859f, -0.007544736f, -0.007642691f, -0.007739722f, -0.007835831f, + -0.007931018f, -0.008025283f, -0.008118626f, -0.008211047f, -0.008302549f, + -0.008393129f, -0.008482790f, -0.008571531f, -0.008659353f, -0.008746257f, + -0.008832245f, -0.008917316f, -0.009001471f, -0.009084711f, -0.009167036f, + -0.009248449f, -0.009328948f, -0.009408538f, -0.009487216f, -0.009564986f, + -0.009641849f, -0.009717803f, -0.009792852f, -0.009866998f, -0.009940239f, + -0.010012579f, -0.010084019f, -0.010154560f, -0.010224204f, -0.010292951f, + -0.010360803f, -0.010427763f, -0.010493831f, -0.010558996f, -0.010623286f, + -0.010686691f, -0.010749210f, -0.010810846f, -0.010871602f, -0.010931478f, + -0.010990476f, -0.011048601f, -0.011105850f, -0.011162230f, -0.011217739f, + -0.011272381f, -0.011326157f, -0.011379071f, -0.011431124f, -0.011482318f, + -0.011532655f, -0.011582140f, -0.011630770f, -0.011678550f, -0.011725485f, + -0.011771576f, -0.011816822f, -0.011861229f, -0.011904799f, -0.011947533f, + -0.011989436f, -0.012030509f, -0.012070752f, -0.012110173f, -0.012148771f, + -0.012186551f, -0.012223513f, -0.012259661f, -0.012295000f, -0.012329529f, + -0.012363252f, -0.012396174f, -0.012428297f, -0.012459621f, -0.012490152f, + -0.012519893f, -0.012548844f, -0.012577013f, -0.012604399f, -0.012631006f, + -0.012656839f, -0.012681897f, -0.012706185f, -0.012729709f, -0.012752469f, + -0.012774469f, -0.012795713f, -0.012816204f, -0.012835944f, -0.012854930f, + -0.012873179f, -0.012890689f, -0.012907463f, -0.012923501f, -0.012938812f, + -0.012953395f, -0.012967254f, -0.012980393f, -0.012992817f, -0.013004529f, + -0.013015532f, -0.013025828f, -0.013035421f, -0.013044316f, -0.013052518f, + -0.013060026f, -0.013066847f, -0.013072984f, -0.013078442f, -0.013083221f, + -0.013087329f, -0.013090767f, -0.013093537f, -0.013095647f, -0.013097100f, + -0.013097897f, -0.013098043f, -0.013097542f, -0.013096399f, -0.013094617f, + -0.013092197f, -0.013089147f, -0.013085471f, -0.013081170f, -0.013076247f, + -0.013070711f, -0.013064560f, -0.013057803f, -0.013050442f, -0.013042479f, + -0.013033919f, -0.013024768f, -0.013015027f, -0.013004702f, -0.012993797f, + -0.012982314f, -0.012970260f, -0.012957636f, -0.012944449f, -0.012930701f, + -0.012916395f, -0.012901539f, -0.012886133f, -0.012870182f, -0.012853689f, + -0.012836664f, -0.012819104f, -0.012801019f, -0.012782406f, -0.012763276f, + -0.012743629f, -0.012723471f, -0.012702805f, -0.012681637f, -0.012659966f, + -0.012637801f, -0.012615148f, -0.012592005f, -0.012568381f, -0.012544277f, + -0.012519698f, -0.012494650f, -0.012469133f, -0.012443157f, -0.012416720f, + -0.012389832f, -0.012362492f, -0.012334707f, -0.012306482f, -0.012277817f, + -0.012248720f, -0.012219194f, -0.012189244f, -0.012158873f, -0.012128084f, + -0.012096884f, -0.012065274f, -0.012033261f, -0.012000849f, -0.011968041f, + -0.011934839f, -0.011901250f, -0.011867279f, -0.011832927f, -0.011798202f, + -0.011763104f, -0.011727640f, -0.011691812f, -0.011655626f, -0.011619086f, + -0.011582195f, -0.011544957f, -0.011507377f, -0.011469459f, -0.011431207f, + -0.011392625f, -0.011353718f, -0.011314487f, -0.011274938f, -0.011235079f, + -0.011194907f, -0.011154431f, -0.011113651f, -0.011072575f, -0.011031206f, + -0.010989547f, -0.010947601f, -0.010905375f, -0.010862871f, -0.010820094f, + -0.010777046f, -0.010733733f, -0.010690158f, -0.010646327f, -0.010602240f, + -0.010557905f, -0.010513324f, -0.010468500f, -0.010423439f, -0.010378144f, + -0.010332618f, -0.010286866f, -0.010240891f, -0.010194698f, -0.010148291f, + -0.010101672f, -0.010054846f, -0.010007816f, -0.009960588f, -0.009913164f, + -0.009865548f, -0.009817744f, -0.009769755f, -0.009721586f, -0.009673241f, + -0.009624721f, -0.009576033f, -0.009527179f, -0.009478163f, -0.009428989f, + -0.009379660f, -0.009330180f, -0.009280552f, -0.009230781f, -0.009180869f, + -0.009130822f, -0.009080641f, -0.009030331f, -0.008979894f, -0.008929336f, + -0.008878659f, -0.008827867f, -0.008776963f, -0.008725950f, -0.008674833f, + -0.008623619f, -0.008572303f, -0.008520893f, -0.008469390f, -0.008417801f, + -0.008366127f, -0.008314372f, -0.008262540f, -0.008210634f, -0.008158657f, + -0.008106613f, -0.008054503f, -0.008002332f, -0.007950104f, -0.007897821f, + -0.007845488f, -0.007793106f, -0.007740679f, -0.007688211f, -0.007635703f, + -0.007583159f, -0.007530585f, -0.007477981f, -0.007425350f, -0.007372697f, + -0.007320023f, -0.007267332f, -0.007214627f, -0.007161912f, -0.007109188f, + -0.007056459f, -0.007003729f, -0.006951000f, -0.006898273f, -0.006845553f, + -0.006792843f, -0.006740147f, -0.006687465f, -0.006634800f, -0.006582157f, + -0.006529537f, -0.006476944f, -0.006424380f, -0.006371849f, -0.006319351f, + -0.006266891f, -0.006214471f, -0.006162094f, -0.006109761f, -0.006057477f, + -0.006005243f, -0.005953063f, -0.005900938f, -0.005848871f, -0.005796865f, + -0.005744927f, -0.005693051f, -0.005641241f, -0.005589503f, -0.005537837f, + -0.005486248f, -0.005434736f, -0.005383304f, -0.005331955f, -0.005280690f, + -0.005229514f, -0.005178426f, -0.005127430f, -0.005076529f, -0.005025723f, + -0.004975016f, -0.004924410f, -0.004873907f, -0.004823509f, -0.004773218f, + -0.004723036f, -0.004672966f, -0.004623009f, -0.004573168f, -0.004523444f, + -0.004473840f, -0.004424357f, -0.004374999f, -0.004325765f, -0.004276660f, + -0.004227683f, -0.004178838f, -0.004130126f, -0.004081549f, -0.004033110f, + -0.003984808f, -0.003936647f, -0.003888629f, -0.003840754f, -0.003793026f, + -0.003745445f, -0.003698014f, -0.003650733f, -0.003603605f, -0.003556631f, + -0.003509813f, -0.003463153f, -0.003416652f, -0.003370312f, -0.003324133f, + -0.003278119f, -0.003232269f, -0.003186587f, -0.003141073f, -0.003095729f, + -0.003050560f, -0.003005560f, -0.002960733f, -0.002916081f, -0.002871606f, + -0.002827310f, -0.002783192f, -0.002739255f, -0.002695500f, -0.002651928f, + -0.002608541f, -0.002565339f, -0.002522324f, -0.002479498f, -0.002436860f, + -0.002394413f, -0.002352157f, -0.002310094f, -0.002268225f, -0.002226550f, + -0.002185071f, -0.002143790f, -0.002102705f, -0.002061821f, -0.002021135f, + -0.001980651f, -0.001940368f, -0.001900289f, -0.001860412f, -0.001820740f, + -0.001781274f, -0.001742014f, -0.001702961f, -0.001664116f, -0.001625479f, + -0.001587052f, -0.001548836f, -0.001510830f, -0.001473036f, -0.001435455f, + -0.001398086f, -0.001360932f, -0.001323992f, -0.001287267f, -0.001250757f, + -0.001214464f, -0.001178389f, -0.001142530f, -0.001106890f, -0.001071468f, + -0.001036266f, -0.001001283f, -0.000966520f, -0.000931978f, -0.000897657f, + -0.000863557f, -0.000829685f, -0.000796029f, -0.000762597f, -0.000729387f, + -0.000696401f, -0.000663639f, -0.000631101f, -0.000598788f, -0.000566699f, + -0.000534836f, -0.000503197f, -0.000471784f, -0.000440597f, -0.000409636f, + -0.000378901f, -0.000348393f, -0.000318111f, -0.000288056f, -0.000258228f, + -0.000228626f, -0.000199252f, -0.000170105f, -0.000141186f, -0.000112493f, + -0.000084028f, -0.000055791f, -0.000027781f, 0.000000002f, 0.000027557f, + 0.000054884f, 0.000081984f, 0.000108857f, 0.000135502f, 0.000161920f, + 0.000188111f, 0.000214075f, 0.000239812f, 0.000265322f, 0.000290606f, + 0.000315663f, 0.000340493f, 0.000365097f, 0.000389476f, 0.000413628f, + 0.000437555f, 0.000461256f, 0.000484733f, 0.000507984f, 0.000531011f, + 0.000553814f, 0.000576393f, 0.000598748f, 0.000620879f, 0.000642788f, + 0.000664473f, 0.000685933f, 0.000707174f, 0.000728194f, 0.000748993f, + 0.000769570f, 0.000789927f, 0.000810064f, 0.000829982f, 0.000849680f, + 0.000869160f, 0.000888421f, 0.000907465f, 0.000926291f, 0.000944901f, + 0.000963294f, 0.000981472f, 0.000999434f, 0.001017181f, 0.001034715f, + 0.001052034f, 0.001069141f, 0.001086035f, 0.001102717f, 0.001119188f, + 0.001135448f, 0.001151499f, 0.001167339f, 0.001182971f, 0.001198395f, + 0.001213611f, 0.001228620f, 0.001243423f, 0.001258021f, 0.001272413f, + 0.001286602f, 0.001300586f, 0.001314368f, 0.001327948f, 0.001341327f, + 0.001354505f, 0.001367483f, 0.001380263f, 0.001392843f, 0.001405226f, + 0.001417413f, 0.001429403f, 0.001441198f, 0.001452798f, 0.001464205f, + 0.001475418f, 0.001486440f, 0.001497271f, 0.001507911f, 0.001518361f, + 0.001528623f, 0.001538696f, 0.001548581f, 0.001558281f, 0.001567796f, + 0.001577127f, 0.001586274f, 0.001595238f, 0.001604020f, 0.001612622f, + 0.001621043f, 0.001629285f, 0.001637349f, 0.001645236f, 0.001652946f, + 0.001660481f, 0.001667841f, 0.001675027f, 0.001682041f, 0.001688883f, + 0.001695554f, 0.001702055f, 0.001708387f, 0.001714552f, 0.001720549f, + 0.001726380f, 0.001732047f, 0.001737549f, 0.001742888f, 0.001748065f, + 0.001753081f, 0.001757936f, 0.001762632f, 0.001767171f, 0.001771552f, + 0.001775777f, 0.001779847f, 0.001783762f, 0.001787525f, 0.001791135f, + 0.001794595f, 0.001797904f, 0.001801064f, 0.001804076f, 0.001806941f, + 0.001809660f, 0.001812234f, 0.001814664f, 0.001816952f, 0.001819097f, + 0.001821102f, 0.001822967f, 0.001824693f, 0.001826282f, 0.001827733f, + 0.001829050f, 0.001830231f, 0.001831278f, 0.001832194f, 0.001832979f, + 0.001833633f, 0.001834158f, 0.001834554f, 0.001834824f, 0.001834967f, + 0.001834986f, 0.001834880f, 0.001834651f, 0.001834301f, 0.001833830f, + 0.001833239f, 0.001832529f, 0.001831702f, 0.001830758f, 0.001829698f, + 0.001828525f, 0.001827237f, 0.001825838f, 0.001824327f, 0.001822706f, + 0.001820976f, 0.001819138f, 0.001817193f, 0.001815141f, 0.001812985f, + 0.001810725f, 0.001808363f, 0.001805898f, 0.001803333f, 0.001800668f, + 0.001797904f, 0.001795043f, 0.001792086f, 0.001789033f, 0.001785886f, + 0.001782645f, 0.001779312f, 0.001775887f, 0.001772373f, 0.001768769f, + 0.001765078f, 0.001761299f, 0.001757434f, 0.001753483f, 0.001749449f, + 0.001745332f, 0.001741133f, 0.001736853f, 0.001732493f, 0.001728054f, + 0.001723537f, 0.001718944f, 0.001714273f, 0.001709529f, 0.001704710f, + 0.001699819f, 0.001694857f, 0.001689823f, 0.001684719f, 0.001679546f, + 0.001674306f, 0.001668998f, 0.001663625f, 0.001658187f, 0.001652685f, + 0.001647120f, 0.001641493f, 0.001635804f, 0.001630056f, 0.001624249f, + 0.001618383f, 0.001612461f, 0.001606481f, 0.001600448f, 0.001594359f, + 0.001588217f, 0.001582022f, 0.001575776f, 0.001569480f, 0.001563134f, + 0.001556739f, 0.001550296f, 0.001543806f, 0.001537270f, 0.001530689f, + 0.001524064f, 0.001517395f, 0.001510684f, 0.001503932f, 0.001497139f, + 0.001490306f, 0.001483435f, 0.001476525f, 0.001469578f, 0.001462596f, + 0.001455577f, 0.001448524f, 0.001441438f, 0.001434318f, 0.001427167f, + 0.001419984f, 0.001412771f, 0.001405529f, 0.001398258f, 0.001390959f, + 0.001383633f, 0.001376281f, 0.001368903f, 0.001361501f, 0.001354076f, + 0.001346627f, 0.001339155f, 0.001331663f, 0.001324150f, 0.001316617f, + 0.001309064f, 0.001301494f, 0.001293906f, 0.001286301f, 0.001278680f, + 0.001271044f, 0.001263393f, 0.001255728f, 0.001248050f, 0.001240360f, + 0.001232658f, 0.001224945f, 0.001217221f, 0.001209488f, 0.001201747f, + 0.001193997f, 0.001186240f, 0.001178476f, 0.001170706f, 0.001162930f, + 0.001155150f, 0.001147365f, 0.001139577f, 0.001131787f, 0.001123994f, + 0.001116200f, 0.001108405f, 0.001100609f, 0.001092814f, 0.001085020f, + 0.001077228f, 0.001069438f, 0.001061651f, 0.001053867f, 0.001046087f, + 0.001038312f, 0.001030542f, 0.001022778f, 0.001015020f, 0.001007270f, + 0.000999526f, 0.000991791f, 0.000984065f, 0.000976347f, 0.000968640f, + 0.000960942f, 0.000953256f, 0.000945580f, 0.000937917f, 0.000930266f, + 0.000922628f, 0.000915002f, 0.000907391f, 0.000899794f, 0.000892212f, + 0.000884646f, 0.000877095f, 0.000869560f, 0.000862042f, 0.000854541f, + 0.000847058f, 0.000839593f, 0.000832147f, 0.000824719f, 0.000817311f, + 0.000809923f, 0.000802555f, 0.000795208f, 0.000787881f, 0.000780577f, + 0.000773294f, 0.000766033f, 0.000758795f, 0.000751581f, 0.000744389f, + 0.000737222f, 0.000730079f, 0.000722960f, 0.000715866f, 0.000708798f, + 0.000701755f, 0.000694738f, 0.000687748f, 0.000680784f, 0.000673847f, + 0.000666937f, 0.000660055f, 0.000653202f, 0.000646376f, 0.000639579f, + 0.000632810f, 0.000626071f, 0.000619362f, 0.000612682f, 0.000606032f, + 0.000599412f, 0.000592823f, 0.000586265f, 0.000579738f, 0.000573242f, + 0.000566777f, 0.000560345f, 0.000553944f, 0.000547577f, 0.000541241f, + 0.000534938f, 0.000528668f, 0.000522432f, 0.000516228f, 0.000510059f, + 0.000503923f, 0.000497821f, 0.000491753f, 0.000485720f, 0.000479721f, + 0.000473757f, 0.000467828f, 0.000461934f, 0.000456075f, 0.000450252f, + 0.000444464f, 0.000438712f, 0.000432996f, 0.000427316f, 0.000421672f, + 0.000416064f, 0.000410493f, 0.000404958f, 0.000399460f, 0.000393998f, + 0.000388574f, 0.000383186f, 0.000377836f, 0.000372523f, 0.000367247f, + 0.000362008f, 0.000356807f, 0.000351643f, 0.000346517f, 0.000341429f, + 0.000336378f, 0.000331366f, 0.000326391f, 0.000321454f, 0.000316555f, + 0.000311695f, 0.000306872f, 0.000302088f, 0.000297341f, 0.000292633f, + 0.000287963f, 0.000283332f, 0.000278739f, 0.000274184f, 0.000269667f, + 0.000265189f, 0.000260749f, 0.000256348f, 0.000251985f, 0.000247661f, + 0.000243374f, 0.000239126f, 0.000234917f, 0.000230745f, 0.000226613f, + 0.000222518f, 0.000218462f, 0.000214443f, 0.000210464f, 0.000206522f, + 0.000202618f, 0.000198753f, 0.000194926f, 0.000191136f, 0.000187385f, + 0.000183671f, 0.000179996f, 0.000176358f, 0.000172758f, 0.000169195f, + 0.000165670f, 0.000162183f, 0.000158733f, 0.000155321f, 0.000151945f, + 0.000148607f, 0.000145307f, 0.000142043f, 0.000138816f, 0.000135626f, + 0.000132473f, 0.000129356f, 0.000126276f, 0.000123233f, 0.000120225f, + 0.000117255f, 0.000114320f, 0.000111421f, 0.000108558f, 0.000105731f, + 0.000102940f, 0.000100184f, 0.000097463f, 0.000094778f, 0.000092128f, + 0.000089513f, 0.000086933f, 0.000084388f, 0.000081878f, 0.000079402f, + 0.000076960f, 0.000074552f, 0.000072179f, 0.000069839f, 0.000067534f, + 0.000065261f, 0.000063023f, 0.000060817f, 0.000058645f, 0.000056506f, + 0.000054399f, 0.000052326f, 0.000050284f, 0.000048275f, 0.000046299f, + 0.000044354f, 0.000042441f, 0.000040560f, 0.000038710f, 0.000036891f, + 0.000035104f, 0.000033348f, 0.000031622f, 0.000029927f, 0.000028263f, + 0.000026628f, 0.000025024f, 0.000023450f, 0.000021905f, 0.000020390f, + 0.000018904f, 0.000017447f, 0.000016019f, 0.000014620f, 0.000013249f, + 0.000011907f, 0.000010593f, 0.000009307f, 0.000008048f, 0.000006818f, + 0.000005614f, 0.000004438f, 0.000003288f, 0.000002166f, 0.000001070f, + -0.000000000f +}; + +static const float ResamplerFilterDifference[RESAMPLER_FILTER_SIZE] = { + -0.000006318f, -0.000019312f, -0.000033081f, -0.000046730f, -0.000060380f, + -0.000074029f, -0.000087738f, -0.000101388f, -0.000115037f, -0.000128686f, + -0.000142336f, -0.000155985f, -0.000169694f, -0.000183165f, -0.000196993f, + -0.000210524f, -0.000224173f, -0.000237763f, -0.000251293f, -0.000265062f, + -0.000278592f, -0.000292122f, -0.000305772f, -0.000319421f, -0.000332832f, + -0.000346422f, -0.000359952f, -0.000373542f, -0.000387073f, -0.000400543f, + -0.000414014f, -0.000427663f, -0.000441074f, -0.000454485f, -0.000468016f, + -0.000481427f, -0.000494778f, -0.000508308f, -0.000521660f, -0.000535011f, + -0.000548482f, -0.000561833f, -0.000575066f, -0.000588536f, -0.000601768f, + -0.000615180f, -0.000628352f, -0.000641525f, -0.000655055f, -0.000668049f, + -0.000681281f, -0.000694513f, -0.000707746f, -0.000720799f, -0.000733972f, + -0.000747204f, -0.000760138f, -0.000773191f, -0.000786424f, -0.000799239f, + -0.000812411f, -0.000825346f, -0.000838339f, -0.000851214f, -0.000864267f, + -0.000877023f, -0.000890017f, -0.000902772f, -0.000915587f, -0.000928521f, + -0.000941217f, -0.000953972f, -0.000966668f, -0.000979364f, -0.000992119f, + -0.001004696f, -0.001017392f, -0.001029909f, -0.001042426f, -0.001055002f, + -0.001067519f, -0.001080096f, -0.001092434f, -0.001104832f, -0.001117289f, + -0.001129627f, -0.001141965f, -0.001154304f, -0.001166403f, -0.001178861f, + -0.001191020f, -0.001203120f, -0.001215160f, -0.001227558f, -0.001239419f, + -0.001251400f, -0.001263618f, -0.001275480f, -0.001287460f, -0.001299262f, + -0.001311302f, -0.001322985f, -0.001334965f, -0.001346648f, -0.001358271f, + -0.001370072f, -0.001381695f, -0.001393259f, -0.001404881f, -0.001416504f, + -0.001427948f, -0.001439393f, -0.001450837f, -0.001462340f, -0.001473546f, + -0.001484871f, -0.001496255f, -0.001507342f, -0.001518726f, -0.001529694f, + -0.001540840f, -0.001552045f, -0.001562893f, -0.001574039f, -0.001584947f, + -0.001595795f, -0.001606703f, -0.001617491f, -0.001628280f, -0.001639009f, + -0.001649678f, -0.001660407f, -0.001670957f, -0.001681507f, -0.001692057f, + -0.001702428f, -0.001713037f, -0.001723289f, -0.001733601f, -0.001743913f, + -0.001754165f, -0.001764417f, -0.001774490f, -0.001784563f, -0.001794696f, + -0.001804650f, -0.001814663f, -0.001824498f, -0.001834452f, -0.001844168f, + -0.001854002f, -0.001863778f, -0.001873314f, -0.001883030f, -0.001892567f, + -0.001902103f, -0.001911521f, -0.001920938f, -0.001930356f, -0.001939654f, + -0.001948893f, -0.001958191f, -0.001967311f, -0.001976430f, -0.001985550f, + -0.001994491f, -0.002003491f, -0.002012312f, -0.002021313f, -0.002030015f, + -0.002038717f, -0.002047479f, -0.002056181f, -0.002064645f, -0.002073288f, + -0.002081692f, -0.002090156f, -0.002098501f, -0.002106905f, -0.002115071f, + -0.002123356f, -0.002131462f, -0.002139568f, -0.002147555f, -0.002155662f, + -0.002163529f, -0.002171457f, -0.002179205f, -0.002187014f, -0.002194703f, + -0.002202272f, -0.002209961f, -0.002217531f, -0.002224922f, -0.002232373f, + -0.002239764f, -0.002247095f, -0.002254248f, -0.002261519f, -0.002268672f, + -0.002275705f, -0.002282679f, -0.002289712f, -0.002296627f, -0.002303362f, + -0.002310216f, -0.002316952f, -0.002323568f, -0.002330244f, -0.002336800f, + -0.002343237f, -0.002349675f, -0.002356052f, -0.002362311f, -0.002368629f, + -0.002374828f, -0.002380908f, -0.002386987f, -0.002392948f, -0.002398968f, + -0.002404809f, -0.002410650f, -0.002416372f, -0.002422094f, -0.002427757f, + -0.002433360f, -0.002438903f, -0.002444327f, -0.002449691f, -0.002455056f, + -0.002460301f, -0.002465487f, -0.002470732f, -0.002475739f, -0.002480865f, + -0.002485693f, -0.002490699f, -0.002495527f, -0.002500176f, -0.002505064f, + -0.002509654f, -0.002514243f, -0.002518773f, -0.002523303f, -0.002527595f, + -0.002531946f, -0.002536356f, -0.002540410f, -0.002544582f, -0.002548754f, + -0.002552748f, -0.002556741f, -0.002560616f, -0.002564371f, -0.002568305f, + -0.002571881f, -0.002575636f, -0.002579153f, -0.002582669f, -0.002586126f, + -0.002589583f, -0.002592862f, -0.002596140f, -0.002599359f, -0.002602518f, + -0.002605557f, -0.002608538f, -0.002611578f, -0.002614439f, -0.002617240f, + -0.002620041f, -0.002622724f, -0.002625346f, -0.002627909f, -0.002630413f, + -0.002632916f, -0.002635241f, -0.002637565f, -0.002639830f, -0.002642035f, + -0.002644122f, -0.002646267f, -0.002648175f, -0.002650142f, -0.002652109f, + -0.002653837f, -0.002655566f, -0.002657294f, -0.002658904f, -0.002660453f, + -0.002662003f, -0.002663374f, -0.002664745f, -0.002666116f, -0.002667189f, + -0.002668560f, -0.002669632f, -0.002670705f, -0.002671599f, -0.002672642f, + -0.002673417f, -0.002674311f, -0.002675056f, -0.002675682f, -0.002676308f, + -0.002676874f, -0.002677381f, -0.002677768f, -0.002678156f, -0.002678514f, + -0.002678722f, -0.002678931f, -0.002679020f, -0.002679110f, -0.002679020f, + -0.002679050f, -0.002678901f, -0.002678722f, -0.002678484f, -0.002678186f, + -0.002677828f, -0.002677292f, -0.002676904f, -0.002676338f, -0.002675682f, + -0.002675027f, -0.002674311f, -0.002673507f, -0.002672672f, -0.002671778f, + -0.002670765f, -0.002669752f, -0.002668649f, -0.002667487f, -0.002666295f, + -0.002665013f, -0.002663702f, -0.002662301f, -0.002660841f, -0.002659231f, + -0.002657771f, -0.002656132f, -0.002654433f, -0.002652735f, -0.002650917f, + -0.002649069f, -0.002647102f, -0.002645165f, -0.002643138f, -0.002641022f, + -0.002638906f, -0.002636671f, -0.002634317f, -0.002632141f, -0.002629727f, + -0.002627254f, -0.002624840f, -0.002622217f, -0.002619684f, -0.002616972f, + -0.002614290f, -0.002611518f, -0.002608687f, -0.002605796f, -0.002602875f, + -0.002599895f, -0.002596736f, -0.002593726f, -0.002590597f, -0.002587378f, + -0.002584100f, -0.002580822f, -0.002577394f, -0.002574027f, -0.002570510f, + -0.002566963f, -0.002563447f, -0.002559751f, -0.002556056f, -0.002552360f, + -0.002548456f, -0.002544701f, -0.002540767f, -0.002536893f, -0.002532810f, + -0.002528816f, -0.002524704f, -0.002520531f, -0.002516329f, -0.002512068f, + -0.002507776f, -0.002503395f, -0.002499044f, -0.002494544f, -0.002489939f, + -0.002485529f, -0.002480894f, -0.002476230f, -0.002471551f, -0.002466798f, + -0.002461985f, -0.002457172f, -0.002452269f, -0.002447322f, -0.002442330f, + -0.002437294f, -0.002432242f, -0.002427101f, -0.002421811f, -0.002416730f, + -0.002411440f, -0.002406135f, -0.002400786f, -0.002395362f, -0.002389938f, + -0.002384409f, -0.002378926f, -0.002373338f, -0.002367705f, -0.002362043f, + -0.002356306f, -0.002350554f, -0.002344713f, -0.002338931f, -0.002333075f, + -0.002327129f, -0.002321184f, -0.002315164f, -0.002309129f, -0.002303004f, + -0.002296925f, -0.002290726f, -0.002284512f, -0.002278253f, -0.002271980f, + -0.002265558f, -0.002259284f, -0.002252862f, -0.002246410f, -0.002239943f, + -0.002233401f, -0.002226844f, -0.002220228f, -0.002213612f, -0.002206936f, + -0.002200201f, -0.002193481f, -0.002186671f, -0.002179854f, -0.002172925f, + -0.002166122f, -0.002159171f, -0.002152205f, -0.002145231f, -0.002138190f, + -0.002131112f, -0.002124026f, -0.002116874f, -0.002109714f, -0.002102517f, + -0.002095275f, -0.002088003f, -0.002080709f, -0.002073303f, -0.002066024f, + -0.002058625f, -0.002051190f, -0.002043739f, -0.002036251f, -0.002028733f, + -0.002021186f, -0.002013609f, -0.002006002f, -0.001998372f, -0.001990698f, + -0.001983009f, -0.001975283f, -0.001967464f, -0.001959760f, -0.001951948f, + -0.001944117f, -0.001936268f, -0.001928370f, -0.001920462f, -0.001912523f, + -0.001904562f, -0.001896568f, -0.001888555f, -0.001880515f, -0.001872454f, + -0.001864363f, -0.001856182f, -0.001848117f, -0.001839954f, -0.001831776f, + -0.001823569f, -0.001815341f, -0.001807092f, -0.001798820f, -0.001790524f, + -0.001782209f, -0.001773877f, -0.001765518f, -0.001757140f, -0.001748742f, + -0.001740261f, -0.001731890f, -0.001723433f, -0.001714959f, -0.001706466f, + -0.001697953f, -0.001689423f, -0.001680876f, -0.001672311f, -0.001663728f, + -0.001655128f, -0.001646512f, -0.001637880f, -0.001629170f, -0.001620566f, + -0.001611889f, -0.001603196f, -0.001594484f, -0.001585761f, -0.001577025f, + -0.001568271f, -0.001559505f, -0.001550728f, -0.001541931f, -0.001533132f, + -0.001524314f, -0.001515483f, -0.001506586f, -0.001497786f, -0.001488928f, + -0.001480050f, -0.001471169f, -0.001462270f, -0.001453366f, -0.001444448f, + -0.001435522f, -0.001426589f, -0.001417641f, -0.001408692f, -0.001399733f, + -0.001390763f, -0.001381733f, -0.001372803f, -0.001363818f, -0.001354810f, + -0.001345813f, -0.001336802f, -0.001327783f, -0.001318768f, -0.001309730f, + -0.001300700f, -0.001291670f, -0.001282625f, -0.001273572f, -0.001264527f, + -0.001255415f, -0.001246415f, -0.001237355f, -0.001228295f, -0.001219213f, + -0.001210161f, -0.001201086f, -0.001192011f, -0.001182951f, -0.001173854f, + -0.001164794f, -0.001155719f, -0.001146644f, -0.001137555f, -0.001128443f, + -0.001119412f, -0.001110330f, -0.001101270f, -0.001092196f, -0.001083128f, + -0.001074038f, -0.001065001f, -0.001055919f, -0.001046866f, -0.001037806f, + -0.001028746f, -0.001019694f, -0.001010656f, -0.001001567f, -0.000992566f, + -0.000983544f, -0.000974506f, -0.000965491f, -0.000956468f, -0.000947453f, + -0.000938453f, -0.000929438f, -0.000920445f, -0.000911482f, -0.000902474f, + -0.000893541f, -0.000884496f, -0.000875585f, -0.000866644f, -0.000857703f, + -0.000848778f, -0.000839837f, -0.000830933f, -0.000822030f, -0.000813127f, + -0.000804260f, -0.000795372f, -0.000786506f, -0.000777654f, -0.000768811f, + -0.000759944f, -0.000751153f, -0.000742361f, -0.000733539f, -0.000724763f, + -0.000716001f, -0.000707224f, -0.000698492f, -0.000689745f, -0.000681043f, + -0.000672325f, -0.000663623f, -0.000654951f, -0.000646278f, -0.000637606f, + -0.000628993f, -0.000620380f, -0.000611767f, -0.000603199f, -0.000594586f, + -0.000586048f, -0.000577524f, -0.000568971f, -0.000560462f, -0.000551969f, + -0.000543505f, -0.000535041f, -0.000526607f, -0.000518143f, -0.000509769f, + -0.000501379f, -0.000493005f, -0.000484675f, -0.000476316f, -0.000468016f, + -0.000459731f, -0.000451431f, -0.000443190f, -0.000434965f, -0.000426725f, + -0.000418544f, -0.000410378f, -0.000402227f, -0.000394091f, -0.000385970f, + -0.000377893f, -0.000369802f, -0.000361770f, -0.000353739f, -0.000345752f, + -0.000337750f, -0.000329792f, -0.000321865f, -0.000313938f, -0.000306055f, + -0.000298187f, -0.000290349f, -0.000282511f, -0.000274733f, -0.000266939f, + -0.000259221f, -0.000251472f, -0.000243768f, -0.000236079f, -0.000228450f, + -0.000220820f, -0.000213221f, -0.000205651f, -0.000198096f, -0.000190571f, + -0.000183061f, -0.000175595f, -0.000168160f, -0.000160739f, -0.000153318f, + -0.000145987f, -0.000138611f, -0.000131324f, -0.000124037f, -0.000116780f, + -0.000109524f, -0.000102326f, -0.000095159f, -0.000088021f, -0.000080869f, + -0.000073805f, -0.000066742f, -0.000059679f, -0.000052691f, -0.000045687f, + -0.000038758f, -0.000031844f, -0.000024930f, -0.000018090f, -0.000011265f, + -0.000004441f, 0.000002325f, 0.000009075f, 0.000015780f, 0.000022471f, + 0.000029117f, 0.000035763f, 0.000042319f, 0.000048906f, 0.000055432f, + 0.000061929f, 0.000068396f, 0.000074849f, 0.000081256f, 0.000087619f, + 0.000093967f, 0.000100300f, 0.000106558f, 0.000112817f, 0.000119045f, + 0.000125214f, 0.000131369f, 0.000137508f, 0.000143588f, 0.000149652f, + 0.000155658f, 0.000161663f, 0.000167638f, 0.000173539f, 0.000179455f, + 0.000185296f, 0.000191167f, 0.000196919f, 0.000202700f, 0.000208423f, + 0.000214115f, 0.000219792f, 0.000225410f, 0.000231013f, 0.000236586f, + 0.000242084f, 0.000247598f, 0.000253052f, 0.000258476f, 0.000263870f, + 0.000269234f, 0.000274554f, 0.000279859f, 0.000285104f, 0.000290334f, + 0.000295490f, 0.000300661f, 0.000305787f, 0.000310853f, 0.000315934f, + 0.000320926f, 0.000325903f, 0.000330850f, 0.000335768f, 0.000340641f, + 0.000345469f, 0.000350282f, 0.000355050f, 0.000359803f, 0.000364468f, + 0.000369161f, 0.000373796f, 0.000378355f, 0.000382945f, 0.000387460f, + 0.000391930f, 0.000396401f, 0.000400826f, 0.000405192f, 0.000409558f, + 0.000413850f, 0.000418127f, 0.000422373f, 0.000426546f, 0.000430748f, + 0.000434861f, 0.000438988f, 0.000443041f, 0.000447050f, 0.000451058f, + 0.000455007f, 0.000458926f, 0.000462815f, 0.000466645f, 0.000470474f, + 0.000474244f, 0.000477999f, 0.000481665f, 0.000485376f, 0.000488982f, + 0.000492588f, 0.000496164f, 0.000499681f, 0.000503168f, 0.000506610f, + 0.000510037f, 0.000513420f, 0.000516787f, 0.000520080f, 0.000523359f, + 0.000526607f, 0.000529751f, 0.000532970f, 0.000536114f, 0.000539184f, + 0.000542283f, 0.000545278f, 0.000548288f, 0.000551224f, 0.000554159f, + 0.000557050f, 0.000559889f, 0.000562698f, 0.000565484f, 0.000568233f, + 0.000570931f, 0.000573598f, 0.000576250f, 0.000578851f, 0.000581399f, + 0.000583932f, 0.000586443f, 0.000588894f, 0.000591323f, 0.000593722f, + 0.000596076f, 0.000598386f, 0.000600673f, 0.000602946f, 0.000605099f, + 0.000607334f, 0.000609480f, 0.000611588f, 0.000613675f, 0.000615716f, + 0.000617720f, 0.000619695f, 0.000621639f, 0.000623547f, 0.000625424f, + 0.000627257f, 0.000629067f, 0.000630826f, 0.000632577f, 0.000634275f, + 0.000635937f, 0.000637576f, 0.000639170f, 0.000640750f, 0.000642270f, + 0.000643790f, 0.000645243f, 0.000646673f, 0.000648089f, 0.000649445f, + 0.000650786f, 0.000652038f, 0.000653364f, 0.000654578f, 0.000655793f, + 0.000656962f, 0.000658102f, 0.000659212f, 0.000660270f, 0.000661321f, + 0.000662334f, 0.000663288f, 0.000664257f, 0.000665158f, 0.000666037f, + 0.000666894f, 0.000667714f, 0.000668481f, 0.000669241f, 0.000669979f, + 0.000670649f, 0.000671312f, 0.000671953f, 0.000672549f, 0.000673100f, + 0.000673652f, 0.000674143f, 0.000674628f, 0.000675075f, 0.000675432f, + 0.000675865f, 0.000676215f, 0.000676543f, 0.000676841f, 0.000677086f, + 0.000677340f, 0.000677533f, 0.000677712f, 0.000677854f, 0.000677958f, + 0.000678062f, 0.000678115f, 0.000678137f, 0.000678144f, 0.000678107f, + 0.000678040f, 0.000677980f, 0.000677846f, 0.000677705f, 0.000677541f, + 0.000677332f, 0.000677109f, 0.000676855f, 0.000676572f, 0.000676263f, + 0.000675920f, 0.000675563f, 0.000675112f, 0.000674754f, 0.000674292f, + 0.000673834f, 0.000673324f, 0.000672799f, 0.000672262f, 0.000671666f, + 0.000671066f, 0.000670440f, 0.000669774f, 0.000669103f, 0.000668388f, + 0.000667654f, 0.000666898f, 0.000666108f, 0.000665307f, 0.000664469f, + 0.000663612f, 0.000662729f, 0.000661820f, 0.000660881f, 0.000659931f, + 0.000658948f, 0.000657942f, 0.000656914f, 0.000655863f, 0.000654746f, + 0.000653688f, 0.000652563f, 0.000651423f, 0.000650249f, 0.000649061f, + 0.000647850f, 0.000646606f, 0.000645354f, 0.000644065f, 0.000642769f, + 0.000641439f, 0.000640094f, 0.000638723f, 0.000637334f, 0.000635926f, + 0.000634488f, 0.000633033f, 0.000631562f, 0.000630064f, 0.000628548f, + 0.000627011f, 0.000625454f, 0.000623874f, 0.000622276f, 0.000620661f, + 0.000619022f, 0.000617364f, 0.000615645f, 0.000613993f, 0.000612279f, + 0.000610547f, 0.000608791f, 0.000607023f, 0.000605229f, 0.000603424f, + 0.000601593f, 0.000599753f, 0.000597889f, 0.000596011f, 0.000594109f, + 0.000592194f, 0.000590262f, 0.000588313f, 0.000586346f, 0.000584361f, + 0.000582362f, 0.000580344f, 0.000578311f, 0.000576260f, 0.000574195f, + 0.000572114f, 0.000570015f, 0.000567904f, 0.000565774f, 0.000563630f, + 0.000561428f, 0.000559297f, 0.000557108f, 0.000554904f, 0.000552687f, + 0.000550454f, 0.000548207f, 0.000545946f, 0.000543671f, 0.000541383f, + 0.000539081f, 0.000536765f, 0.000534437f, 0.000532095f, 0.000529740f, + 0.000527372f, 0.000524992f, 0.000522598f, 0.000520193f, 0.000517776f, + 0.000515345f, 0.000512904f, 0.000510451f, 0.000507986f, 0.000505510f, + 0.000503022f, 0.000500523f, 0.000497975f, 0.000495494f, 0.000492963f, + 0.000490420f, 0.000487870f, 0.000485308f, 0.000482734f, 0.000480153f, + 0.000477560f, 0.000474961f, 0.000472347f, 0.000469729f, 0.000467099f, + 0.000464460f, 0.000461814f, 0.000459160f, 0.000456492f, 0.000453821f, + 0.000451141f, 0.000448450f, 0.000445757f, 0.000443047f, 0.000440339f, + 0.000437619f, 0.000434890f, 0.000432156f, 0.000429420f, 0.000426665f, + 0.000423878f, 0.000421155f, 0.000418384f, 0.000415608f, 0.000412831f, + 0.000410046f, 0.000407251f, 0.000404453f, 0.000401655f, 0.000398841f, + 0.000396032f, 0.000393212f, 0.000390388f, 0.000387559f, 0.000384722f, + 0.000381887f, 0.000379046f, 0.000376200f, 0.000373350f, 0.000370493f, + 0.000367636f, 0.000364775f, 0.000361912f, 0.000359036f, 0.000356171f, + 0.000353293f, 0.000350416f, 0.000347532f, 0.000344623f, 0.000341764f, + 0.000338878f, 0.000335984f, 0.000333097f, 0.000330199f, 0.000327300f, + 0.000324406f, 0.000321500f, 0.000318602f, 0.000315700f, 0.000312794f, + 0.000309892f, 0.000306983f, 0.000304081f, 0.000301171f, 0.000298265f, + 0.000295352f, 0.000292446f, 0.000289541f, 0.000286628f, 0.000283718f, + 0.000280812f, 0.000277914f, 0.000274993f, 0.000272095f, 0.000269186f, + 0.000266258f, 0.000263374f, 0.000260476f, 0.000257570f, 0.000254679f, + 0.000251777f, 0.000248875f, 0.000245985f, 0.000243090f, 0.000240199f, + 0.000237312f, 0.000234425f, 0.000231542f, 0.000228655f, 0.000225779f, + 0.000222903f, 0.000220031f, 0.000217155f, 0.000214294f, 0.000211425f, + 0.000208564f, 0.000205707f, 0.000202853f, 0.000200007f, 0.000197157f, + 0.000194311f, 0.000191480f, 0.000188638f, 0.000185791f, 0.000182983f, + 0.000180162f, 0.000177346f, 0.000174530f, 0.000171725f, 0.000168923f, + 0.000166126f, 0.000163332f, 0.000160541f, 0.000157762f, 0.000154987f, + 0.000152212f, 0.000149447f, 0.000146687f, 0.000143930f, 0.000141181f, + 0.000138439f, 0.000135705f, 0.000132974f, 0.000130247f, 0.000127535f, + 0.000124816f, 0.000122119f, 0.000119418f, 0.000116725f, 0.000114042f, + 0.000111364f, 0.000108674f, 0.000106033f, 0.000103373f, 0.000100728f, + 0.000098083f, 0.000095449f, 0.000092819f, 0.000090208f, 0.000087593f, + 0.000084992f, 0.000082392f, 0.000079807f, 0.000077233f, 0.000074655f, + 0.000072096f, 0.000069536f, 0.000066992f, 0.000064459f, 0.000061929f, + 0.000059403f, 0.000056893f, 0.000054389f, 0.000051897f, 0.000049412f, + 0.000046935f, 0.000044469f, 0.000042010f, 0.000039551f, 0.000037123f, + 0.000034694f, 0.000032268f, 0.000029862f, 0.000027459f, 0.000025064f, + 0.000022691f, 0.000020307f, 0.000017952f, 0.000015602f, 0.000013247f, + 0.000010934f, 0.000008594f, 0.000006288f, 0.000003986f, 0.000001695f, + -0.000000589f, -0.000002854f, -0.000005119f, -0.000007369f, -0.000009615f, + -0.000011832f, -0.000014052f, -0.000016265f, -0.000018459f, -0.000020642f, + -0.000022821f, -0.000024986f, -0.000027131f, -0.000029277f, -0.000031408f, + -0.000033524f, -0.000035629f, -0.000037737f, -0.000039808f, -0.000041891f, + -0.000043951f, -0.000046007f, -0.000048041f, -0.000050064f, -0.000052094f, + -0.000054091f, -0.000056084f, -0.000058070f, -0.000060037f, -0.000061993f, + -0.000063941f, -0.000065874f, -0.000067800f, -0.000069708f, -0.000071604f, + -0.000073489f, -0.000075370f, -0.000077229f, -0.000079080f, -0.000080917f, + -0.000082746f, -0.000084557f, -0.000086352f, -0.000088152f, -0.000089929f, + -0.000091687f, -0.000093438f, -0.000095177f, -0.000096913f, -0.000098623f, + -0.000100322f, -0.000102021f, -0.000103690f, -0.000105359f, -0.000107009f, + -0.000108648f, -0.000110280f, -0.000111893f, -0.000113495f, -0.000115078f, + -0.000116657f, -0.000118230f, -0.000119772f, -0.000121318f, -0.000122838f, + -0.000124350f, -0.000125848f, -0.000127345f, -0.000128813f, -0.000130277f, + -0.000131730f, -0.000133157f, -0.000134595f, -0.000135988f, -0.000137400f, + -0.000138778f, -0.000140157f, -0.000141505f, -0.000142857f, -0.000144191f, + -0.000145517f, -0.000146817f, -0.000148114f, -0.000149388f, -0.000150666f, + -0.000151921f, -0.000153165f, -0.000154395f, -0.000155609f, -0.000156820f, + -0.000158004f, -0.000159189f, -0.000160355f, -0.000161506f, -0.000162646f, + -0.000163775f, -0.000164881f, -0.000165988f, -0.000167083f, -0.000168145f, + -0.000169218f, -0.000170264f, -0.000171307f, -0.000172324f, -0.000173341f, + -0.000174336f, -0.000175327f, -0.000176292f, -0.000177257f, -0.000178207f, + -0.000179138f, -0.000180058f, -0.000180975f, -0.000181865f, -0.000182752f, + -0.000183623f, -0.000184480f, -0.000185326f, -0.000186164f, -0.000186980f, + -0.000187792f, -0.000188582f, -0.000189368f, -0.000190143f, -0.000190891f, + -0.000191648f, -0.000192374f, -0.000193097f, -0.000193801f, -0.000194505f, + -0.000195183f, -0.000195853f, -0.000196513f, -0.000197157f, -0.000197794f, + -0.000198420f, -0.000199001f, -0.000199623f, -0.000200208f, -0.000200782f, + -0.000201344f, -0.000201892f, -0.000202429f, -0.000202954f, -0.000203468f, + -0.000203967f, -0.000204455f, -0.000204936f, -0.000205394f, -0.000205856f, + -0.000206295f, -0.000206724f, -0.000207141f, -0.000207547f, -0.000207946f, + -0.000208326f, -0.000208698f, -0.000209058f, -0.000209408f, -0.000209745f, + -0.000210065f, -0.000210386f, -0.000210684f, -0.000210978f, -0.000211256f, + -0.000211528f, -0.000211783f, -0.000212030f, -0.000212263f, -0.000212491f, + -0.000212703f, -0.000212908f, -0.000213092f, -0.000213277f, -0.000213446f, + -0.000213604f, -0.000213752f, -0.000213886f, -0.000214016f, -0.000214130f, + -0.000214234f, -0.000214327f, -0.000214415f, -0.000214487f, -0.000214545f, + -0.000214605f, -0.000214642f, -0.000214674f, -0.000214696f, -0.000214709f, + -0.000214707f, -0.000214674f, -0.000214679f, -0.000214649f, -0.000214612f, + -0.000214560f, -0.000214502f, -0.000214435f, -0.000214357f, -0.000214268f, + -0.000214169f, -0.000214059f, -0.000213947f, -0.000213819f, -0.000213677f, + -0.000213537f, -0.000213381f, -0.000213215f, -0.000213042f, -0.000212861f, + -0.000212666f, -0.000212466f, -0.000212256f, -0.000212036f, -0.000211809f, + -0.000211569f, -0.000211326f, -0.000211067f, -0.000210807f, -0.000210535f, + -0.000210257f, -0.000209961f, -0.000209667f, -0.000209359f, -0.000209045f, + -0.000208722f, -0.000208389f, -0.000208050f, -0.000207704f, -0.000207344f, + -0.000206983f, -0.000206610f, -0.000206229f, -0.000205842f, -0.000205445f, + -0.000205044f, -0.000204630f, -0.000204211f, -0.000203785f, -0.000203351f, + -0.000202909f, -0.000202459f, -0.000202003f, -0.000201537f, -0.000201069f, + -0.000200586f, -0.000200078f, -0.000199611f, -0.000199108f, -0.000198605f, + -0.000198090f, -0.000197569f, -0.000197043f, -0.000196506f, -0.000195967f, + -0.000195420f, -0.000194865f, -0.000194305f, -0.000193738f, -0.000193163f, + -0.000192585f, -0.000191999f, -0.000191407f, -0.000190807f, -0.000190204f, + -0.000189591f, -0.000188977f, -0.000188354f, -0.000187725f, -0.000187092f, + -0.000186451f, -0.000185805f, -0.000185154f, -0.000184498f, -0.000183835f, + -0.000183167f, -0.000182495f, -0.000181816f, -0.000181132f, -0.000180443f, + -0.000179750f, -0.000179050f, -0.000178346f, -0.000177636f, -0.000176923f, + -0.000176203f, -0.000175480f, -0.000174752f, -0.000174019f, -0.000173280f, + -0.000172539f, -0.000171792f, -0.000171040f, -0.000170285f, -0.000169525f, + -0.000168761f, -0.000167992f, -0.000167220f, -0.000166443f, -0.000165662f, + -0.000164878f, -0.000164090f, -0.000163272f, -0.000162501f, -0.000161701f, + -0.000160898f, -0.000160091f, -0.000159280f, -0.000158466f, -0.000157648f, + -0.000156827f, -0.000156003f, -0.000155175f, -0.000154344f, -0.000153510f, + -0.000152673f, -0.000151833f, -0.000150990f, -0.000150144f, -0.000149295f, + -0.000148444f, -0.000147589f, -0.000146732f, -0.000145872f, -0.000145010f, + -0.000144145f, -0.000143277f, -0.000142408f, -0.000141536f, -0.000140661f, + -0.000139785f, -0.000138906f, -0.000138025f, -0.000137142f, -0.000136257f, + -0.000135370f, -0.000134481f, -0.000133590f, -0.000132697f, -0.000131803f, + -0.000130907f, -0.000130009f, -0.000129110f, -0.000128209f, -0.000127306f, + -0.000126403f, -0.000125497f, -0.000124591f, -0.000123683f, -0.000122774f, + -0.000121864f, -0.000120952f, -0.000120040f, -0.000119127f, -0.000118212f, + -0.000117297f, -0.000116381f, -0.000115445f, -0.000114546f, -0.000113628f, + -0.000112709f, -0.000111789f, -0.000110869f, -0.000109948f, -0.000109027f, + -0.000108106f, -0.000107184f, -0.000106262f, -0.000105340f, -0.000104415f, + -0.000103494f, -0.000102570f, -0.000101647f, -0.000100723f, -0.000099801f, + -0.000098877f, -0.000097955f, -0.000097031f, -0.000096109f, -0.000095187f, + -0.000094265f, -0.000093343f, -0.000092422f, -0.000091502f, -0.000090580f, + -0.000089660f, -0.000088741f, -0.000087823f, -0.000086904f, -0.000085988f, + -0.000085071f, -0.000084155f, -0.000083240f, -0.000082325f, -0.000081412f, + -0.000080500f, -0.000079590f, -0.000078678f, -0.000077770f, -0.000076862f, + -0.000075955f, -0.000075049f, -0.000074145f, -0.000073241f, -0.000072340f, + -0.000071440f, -0.000070541f, -0.000069643f, -0.000068747f, -0.000067852f, + -0.000066960f, -0.000066068f, -0.000065166f, -0.000064289f, -0.000063405f, + -0.000062519f, -0.000061636f, -0.000060757f, -0.000059876f, -0.000058998f, + -0.000058125f, -0.000057249f, -0.000056379f, -0.000055509f, -0.000054643f, + -0.000053776f, -0.000052913f, -0.000052053f, -0.000051194f, -0.000050337f, + -0.000049485f, -0.000048630f, -0.000047781f, -0.000046935f, -0.000046090f, + -0.000045246f, -0.000044407f, -0.000043570f, -0.000042734f, -0.000041903f, + -0.000041073f, -0.000040242f, -0.000039421f, -0.000038599f, -0.000037779f, + -0.000036962f, -0.000036148f, -0.000035339f, -0.000034529f, -0.000033723f, + -0.000032922f, -0.000032122f, -0.000031324f, -0.000030532f, -0.000029741f, + -0.000028951f, -0.000028169f, -0.000027386f, -0.000026607f, -0.000025833f, + -0.000025058f, -0.000024288f, -0.000023524f, -0.000022760f, -0.000022001f, + -0.000021243f, -0.000020491f, -0.000019740f, -0.000018986f, -0.000018249f, + -0.000017510f, -0.000016774f, -0.000016038f, -0.000015311f, -0.000014583f, + -0.000013859f, -0.000013139f, -0.000012424f, -0.000011712f, -0.000011003f, + -0.000010296f, -0.000009594f, -0.000008895f, -0.000008201f, -0.000007508f, + -0.000006821f, -0.000006137f, -0.000005458f, -0.000004780f, -0.000004107f, + -0.000003438f, -0.000002770f, -0.000002110f, -0.000001453f, -0.000000797f, + -0.000000146f, 0.000000501f, 0.000001144f, 0.000001782f, 0.000002420f, + 0.000003050f, 0.000003677f, 0.000004301f, 0.000004923f, 0.000005536f, + 0.000006150f, 0.000006758f, 0.000007361f, 0.000007963f, 0.000008560f, + 0.000009151f, 0.000009741f, 0.000010326f, 0.000010905f, 0.000011482f, + 0.000012054f, 0.000012624f, 0.000013188f, 0.000013747f, 0.000014306f, + 0.000014856f, 0.000015406f, 0.000015951f, 0.000016493f, 0.000017026f, + 0.000017560f, 0.000018085f, 0.000018612f, 0.000019130f, 0.000019647f, + 0.000020158f, 0.000020666f, 0.000021168f, 0.000021671f, 0.000022165f, + 0.000022653f, 0.000023143f, 0.000023624f, 0.000024104f, 0.000024579f, + 0.000025048f, 0.000025516f, 0.000025976f, 0.000026437f, 0.000026888f, + 0.000027340f, 0.000027785f, 0.000028226f, 0.000028664f, 0.000029097f, + 0.000029526f, 0.000029950f, 0.000030371f, 0.000030789f, 0.000031200f, + 0.000031610f, 0.000032012f, 0.000032413f, 0.000032808f, 0.000033202f, + 0.000033589f, 0.000033971f, 0.000034352f, 0.000034725f, 0.000035098f, + 0.000035464f, 0.000035828f, 0.000036187f, 0.000036540f, 0.000036892f, + 0.000037238f, 0.000037580f, 0.000037918f, 0.000038252f, 0.000038582f, + 0.000038907f, 0.000039231f, 0.000039549f, 0.000039860f, 0.000040172f, + 0.000040476f, 0.000040780f, 0.000041076f, 0.000041369f, 0.000041659f, + 0.000041946f, 0.000042226f, 0.000042504f, 0.000042778f, 0.000043048f, + 0.000043313f, 0.000043575f, 0.000043831f, 0.000044088f, 0.000044335f, + 0.000044581f, 0.000044825f, 0.000045061f, 0.000045295f, 0.000045526f, + 0.000045752f, 0.000045975f, 0.000046193f, 0.000046407f, 0.000046619f, + 0.000046826f, 0.000047030f, 0.000047228f, 0.000047424f, 0.000047616f, + 0.000047805f, 0.000047988f, 0.000048169f, 0.000048346f, 0.000048519f, + 0.000048689f, 0.000048853f, 0.000049016f, 0.000049174f, 0.000049329f, + 0.000049480f, 0.000049627f, 0.000049771f, 0.000049912f, 0.000050047f, + 0.000050181f, 0.000050310f, 0.000050437f, 0.000050558f, 0.000050677f, + 0.000050792f, 0.000050904f, 0.000051012f, 0.000051118f, 0.000051214f, + 0.000051316f, 0.000051410f, 0.000051503f, 0.000051589f, 0.000051674f, + 0.000051755f, 0.000051832f, 0.000051906f, 0.000051977f, 0.000052044f, + 0.000052109f, 0.000052171f, 0.000052229f, 0.000052283f, 0.000052333f, + 0.000052382f, 0.000052427f, 0.000052468f, 0.000052508f, 0.000052543f, + 0.000052574f, 0.000052604f, 0.000052631f, 0.000052653f, 0.000052674f, + 0.000052691f, 0.000052704f, 0.000052716f, 0.000052724f, 0.000052729f, + 0.000052730f, 0.000052730f, 0.000052726f, 0.000052720f, 0.000052710f, + 0.000052697f, 0.000052682f, 0.000052664f, 0.000052643f, 0.000052620f, + 0.000052593f, 0.000052564f, 0.000052531f, 0.000052498f, 0.000052460f, + 0.000052420f, 0.000052377f, 0.000052333f, 0.000052284f, 0.000052234f, + 0.000052180f, 0.000052125f, 0.000052067f, 0.000052006f, 0.000051938f, + 0.000051877f, 0.000051809f, 0.000051738f, 0.000051666f, 0.000051590f, + 0.000051512f, 0.000051432f, 0.000051349f, 0.000051265f, 0.000051177f, + 0.000051088f, 0.000050996f, 0.000050901f, 0.000050805f, 0.000050707f, + 0.000050606f, 0.000050503f, 0.000050398f, 0.000050291f, 0.000050182f, + 0.000050070f, 0.000049957f, 0.000049842f, 0.000049724f, 0.000049604f, + 0.000049483f, 0.000049358f, 0.000049234f, 0.000049105f, 0.000048977f, + 0.000048845f, 0.000048712f, 0.000048577f, 0.000048439f, 0.000048302f, + 0.000048161f, 0.000048019f, 0.000047874f, 0.000047728f, 0.000047581f, + 0.000047431f, 0.000047280f, 0.000047128f, 0.000046974f, 0.000046818f, + 0.000046660f, 0.000046501f, 0.000046341f, 0.000046178f, 0.000046015f, + 0.000045849f, 0.000045683f, 0.000045514f, 0.000045344f, 0.000045168f, + 0.000045001f, 0.000044827f, 0.000044652f, 0.000044475f, 0.000044297f, + 0.000044117f, 0.000043937f, 0.000043755f, 0.000043572f, 0.000043387f, + 0.000043201f, 0.000043015f, 0.000042827f, 0.000042638f, 0.000042447f, + 0.000042256f, 0.000042063f, 0.000041869f, 0.000041675f, 0.000041479f, + 0.000041282f, 0.000041084f, 0.000040885f, 0.000040685f, 0.000040484f, + 0.000040283f, 0.000040080f, 0.000039876f, 0.000039672f, 0.000039466f, + 0.000039260f, 0.000039053f, 0.000038845f, 0.000038636f, 0.000038427f, + 0.000038217f, 0.000038006f, 0.000037794f, 0.000037581f, 0.000037368f, + 0.000037155f, 0.000036940f, 0.000036725f, 0.000036509f, 0.000036293f, + 0.000036076f, 0.000035858f, 0.000035640f, 0.000035422f, 0.000035202f, + 0.000034983f, 0.000034763f, 0.000034542f, 0.000034321f, 0.000034100f, + 0.000033873f, 0.000033655f, 0.000033432f, 0.000033209f, 0.000032986f, + 0.000032762f, 0.000032538f, 0.000032313f, 0.000032089f, 0.000031864f, + 0.000031638f, 0.000031413f, 0.000031187f, 0.000030961f, 0.000030735f, + 0.000030508f, 0.000030282f, 0.000030055f, 0.000029828f, 0.000029601f, + 0.000029374f, 0.000029147f, 0.000028920f, 0.000028692f, 0.000028465f, + 0.000028237f, 0.000028010f, 0.000027782f, 0.000027555f, 0.000027328f, + 0.000027100f, 0.000026873f, 0.000026645f, 0.000026418f, 0.000026191f, + 0.000025964f, 0.000025737f, 0.000025510f, 0.000025283f, 0.000025057f, + 0.000024830f, 0.000024604f, 0.000024378f, 0.000024152f, 0.000023927f, + 0.000023702f, 0.000023476f, 0.000023252f, 0.000023027f, 0.000022803f, + 0.000022579f, 0.000022355f, 0.000022132f, 0.000021908f, 0.000021686f, + 0.000021460f, 0.000021241f, 0.000021020f, 0.000020798f, 0.000020578f, + 0.000020357f, 0.000020137f, 0.000019917f, 0.000019698f, 0.000019480f, + 0.000019261f, 0.000019044f, 0.000018826f, 0.000018609f, 0.000018393f, + 0.000018177f, 0.000017962f, 0.000017748f, 0.000017533f, 0.000017320f, + 0.000017107f, 0.000016894f, 0.000016682f, 0.000016471f, 0.000016260f, + 0.000016050f, 0.000015841f, 0.000015632f, 0.000015424f, 0.000015216f, + 0.000015009f, 0.000014803f, 0.000014597f, 0.000014393f, 0.000014188f, + 0.000013985f, 0.000013782f, 0.000013580f, 0.000013379f, 0.000013178f, + 0.000012978f, 0.000012779f, 0.000012581f, 0.000012383f, 0.000012186f, + 0.000011990f, 0.000011795f, 0.000011600f, 0.000011407f, 0.000011214f, + 0.000011022f, 0.000010830f, 0.000010640f, 0.000010450f, 0.000010262f, + 0.000010074f, 0.000009884f, 0.000009700f, 0.000009515f, 0.000009331f, + 0.000009147f, 0.000008964f, 0.000008782f, 0.000008601f, 0.000008421f, + 0.000008242f, 0.000008064f, 0.000007887f, 0.000007710f, 0.000007535f, + 0.000007360f, 0.000007186f, 0.000007014f, 0.000006842f, 0.000006671f, + 0.000006501f, 0.000006332f, 0.000006164f, 0.000005997f, 0.000005831f, + 0.000005667f, 0.000005502f, 0.000005339f, 0.000005177f, 0.000005016f, + 0.000004855f, 0.000004696f, 0.000004538f, 0.000004381f, 0.000004225f, + 0.000004070f, 0.000003916f, 0.000003763f, 0.000003610f, 0.000003459f, + 0.000003309f, 0.000003160f, 0.000003012f, 0.000002865f, 0.000002719f, + 0.000002574f, 0.000002430f, 0.000002287f, 0.000002146f, 0.000002005f, + 0.000001865f, 0.000001726f, 0.000001589f, 0.000001452f, 0.000001316f, + 0.000001182f, 0.000001047f, 0.000000916f, 0.000000785f, 0.000000654f, + 0.000000525f, 0.000000397f, 0.000000270f, 0.000000143f, 0.000000019f, + -0.000000106f, -0.000000228f, -0.000000351f, -0.000000471f, -0.000000591f, + -0.000000710f, -0.000000827f, -0.000000944f, -0.000001059f, -0.000001174f, + -0.000001287f, -0.000001399f, -0.000001511f, -0.000001621f, -0.000001730f, + -0.000001838f, -0.000001945f, -0.000002051f, -0.000002156f, -0.000002260f, + -0.000002363f, -0.000002465f, -0.000002565f, -0.000002665f, -0.000002763f, + -0.000002861f, -0.000002958f, -0.000003053f, -0.000003147f, -0.000003241f, + -0.000003333f, -0.000003424f, -0.000003514f, -0.000003604f, -0.000003692f, + -0.000003779f, -0.000003865f, -0.000003950f, -0.000004034f, -0.000004117f, + -0.000004199f, -0.000004280f, -0.000004360f, -0.000004439f, -0.000004517f, + -0.000004594f, -0.000004670f, -0.000004744f, -0.000004819f, -0.000004891f, + -0.000004963f, -0.000005034f, -0.000005104f, -0.000005173f, -0.000005240f, + -0.000005307f, -0.000005373f, -0.000005438f, -0.000005502f, -0.000005565f, + -0.000005627f, -0.000005688f, -0.000005748f, -0.000005807f, -0.000005866f, + -0.000005922f, -0.000005979f, -0.000006034f, -0.000006089f, -0.000006142f, + -0.000006194f, -0.000006246f, -0.000006297f, -0.000006346f, -0.000006395f, + -0.000006443f, -0.000006490f, -0.000006536f, -0.000006581f, -0.000006625f, + -0.000006668f, -0.000006711f, -0.000006752f, -0.000006793f, -0.000006833f, + -0.000006872f, -0.000006909f, -0.000006947f, -0.000006983f, -0.000007018f, + -0.000007053f, -0.000007086f, -0.000007119f, -0.000007151f, -0.000007183f, + -0.000007213f, -0.000007242f, -0.000007271f, -0.000007299f, -0.000007326f, + -0.000007352f, -0.000007377f, -0.000007402f, -0.000007426f, -0.000007449f, + -0.000007471f, -0.000007493f, -0.000007513f, -0.000007533f, -0.000007552f, + -0.000007570f, -0.000007588f, -0.000007605f, -0.000007621f, -0.000007636f, + -0.000007651f, -0.000007665f, -0.000007678f, -0.000007690f, -0.000007702f, + -0.000007713f, -0.000007723f, -0.000007733f, -0.000007742f, -0.000007750f, + -0.000007757f, -0.000007764f, -0.000007770f, -0.000007775f, -0.000007780f, + -0.000007784f, -0.000007788f, -0.000007791f, -0.000007793f, -0.000007794f, + -0.000007795f, -0.000007795f, -0.000007795f, -0.000007794f, -0.000007792f, + -0.000007790f, -0.000007787f, -0.000007784f, -0.000007780f, -0.000007775f, + -0.000007770f, -0.000007764f, -0.000007758f, -0.000007751f, -0.000007743f, + -0.000007735f, -0.000007726f, -0.000007717f, -0.000007708f, -0.000007698f, + -0.000007687f, -0.000007675f, -0.000007663f, -0.000007651f, -0.000007638f, + -0.000007625f, -0.000007611f, -0.000007597f, -0.000007582f, -0.000007567f, + -0.000007551f, -0.000007535f, -0.000007518f, -0.000007501f, -0.000007483f, + -0.000007465f, -0.000007446f, -0.000007427f, -0.000007408f, -0.000007388f, + -0.000007368f, -0.000007347f, -0.000007326f, -0.000007305f, -0.000007283f, + -0.000007261f, -0.000007238f, -0.000007215f, -0.000007191f, -0.000007168f, + -0.000007143f, -0.000007119f, -0.000007094f, -0.000007068f, -0.000007043f, + -0.000007017f, -0.000006991f, -0.000006964f, -0.000006937f, -0.000006909f, + -0.000006882f, -0.000006854f, -0.000006826f, -0.000006797f, -0.000006768f, + -0.000006739f, -0.000006710f, -0.000006680f, -0.000006650f, -0.000006620f, + -0.000006589f, -0.000006558f, -0.000006527f, -0.000006496f, -0.000006464f, + -0.000006432f, -0.000006400f, -0.000006368f, -0.000006336f, -0.000006303f, + -0.000006270f, -0.000006237f, -0.000006203f, -0.000006170f, -0.000006136f, + -0.000006102f, -0.000006068f, -0.000006033f, -0.000005999f, -0.000005964f, + -0.000005929f, -0.000005894f, -0.000005859f, -0.000005823f, -0.000005788f, + -0.000005752f, -0.000005716f, -0.000005680f, -0.000005644f, -0.000005608f, + -0.000005571f, -0.000005535f, -0.000005498f, -0.000005461f, -0.000005424f, + -0.000005388f, -0.000005350f, -0.000005313f, -0.000005276f, -0.000005239f, + -0.000005201f, -0.000005164f, -0.000005126f, -0.000005088f, -0.000005051f, + -0.000005013f, -0.000004975f, -0.000004937f, -0.000004899f, -0.000004861f, + -0.000004823f, -0.000004784f, -0.000004746f, -0.000004708f, -0.000004670f, + -0.000004632f, -0.000004593f, -0.000004555f, -0.000004517f, -0.000004478f, + -0.000004440f, -0.000004401f, -0.000004363f, -0.000004324f, -0.000004286f, + -0.000004248f, -0.000004210f, -0.000004171f, -0.000004133f, -0.000004095f, + -0.000004056f, -0.000004018f, -0.000003980f, -0.000003942f, -0.000003904f, + -0.000003865f, -0.000003827f, -0.000003789f, -0.000003751f, -0.000003714f, + -0.000003676f, -0.000003638f, -0.000003600f, -0.000003562f, -0.000003525f, + -0.000003487f, -0.000003450f, -0.000003412f, -0.000003375f, -0.000003338f, + -0.000003301f, -0.000003264f, -0.000003227f, -0.000003190f, -0.000003153f, + -0.000003117f, -0.000003080f, -0.000003044f, -0.000003007f, -0.000002971f, + -0.000002935f, -0.000002899f, -0.000002863f, -0.000002827f, -0.000002791f, + -0.000002756f, -0.000002720f, -0.000002685f, -0.000002650f, -0.000002615f, + -0.000002580f, -0.000002545f, -0.000002511f, -0.000002476f, -0.000002442f, + -0.000002408f, -0.000002373f, -0.000002340f, -0.000002306f, -0.000002272f, + -0.000002239f, -0.000002205f, -0.000002172f, -0.000002139f, -0.000002106f, + -0.000002074f, -0.000002041f, -0.000002009f, -0.000001977f, -0.000001945f, + -0.000001913f, -0.000001881f, -0.000001850f, -0.000001818f, -0.000001787f, + -0.000001756f, -0.000001726f, -0.000001695f, -0.000001665f, -0.000001634f, + -0.000001604f, -0.000001574f, -0.000001545f, -0.000001515f, -0.000001486f, + -0.000001457f, -0.000001428f, -0.000001399f, -0.000001371f, -0.000001342f, + -0.000001314f, -0.000001286f, -0.000001258f, -0.000001231f, -0.000001203f, + -0.000001176f, -0.000001149f, -0.000001123f, -0.000001096f, -0.000001070f, + 0.000000000f +}; + +/* vi: set ts=4 sw=4 expandtab: */ + diff -Nru libsdl2-2.0.22+dfsg/src/audio/SDL_sysaudio.h libsdl2-2.24.0+dfsg/src/audio/SDL_sysaudio.h --- libsdl2-2.0.22+dfsg/src/audio/SDL_sysaudio.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/audio/SDL_sysaudio.h 2022-08-13 03:48:10.000000000 +0000 @@ -78,6 +78,7 @@ void (*UnlockDevice) (_THIS); void (*FreeDeviceHandle) (void *handle); /**< SDL is done with handle from SDL_AddAudioDevice() */ void (*Deinitialize) (void); + int (*GetDefaultAudioInfo) (char **name, SDL_AudioSpec *spec, int iscapture); /* !!! FIXME: add pause(), so we can optimize instead of mixing silence. */ @@ -87,6 +88,7 @@ SDL_bool OnlyHasDefaultOutputDevice; SDL_bool OnlyHasDefaultCaptureDevice; SDL_bool AllowsArbitraryDeviceNames; + SDL_bool SupportsNonPow2Samples; } SDL_AudioDriverImpl; @@ -204,6 +206,7 @@ extern AudioBootStrap aaudio_bootstrap; extern AudioBootStrap openslES_bootstrap; extern AudioBootStrap ANDROIDAUDIO_bootstrap; +extern AudioBootStrap PS2AUDIO_bootstrap; extern AudioBootStrap PSPAUDIO_bootstrap; extern AudioBootStrap VITAAUD_bootstrap; extern AudioBootStrap EMSCRIPTENAUDIO_bootstrap; diff -Nru libsdl2-2.0.22+dfsg/src/audio/wasapi/SDL_wasapi.c libsdl2-2.24.0+dfsg/src/audio/wasapi/SDL_wasapi.c --- libsdl2-2.0.22+dfsg/src/audio/wasapi/SDL_wasapi.c 2022-04-21 17:37:37.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/audio/wasapi/SDL_wasapi.c 2022-08-13 03:48:10.000000000 +0000 @@ -23,13 +23,13 @@ #if SDL_AUDIO_DRIVER_WASAPI #include "../../core/windows/SDL_windows.h" +#include "../../core/windows/SDL_immdevice.h" #include "SDL_audio.h" #include "SDL_timer.h" #include "../SDL_audio_c.h" #include "../SDL_sysaudio.h" #define COBJMACROS -#include #include #include "SDL_wasapi.h" @@ -45,109 +45,9 @@ #define AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM 0x80000000 #endif -/* these increment as default devices change. Opened default devices pick up changes in their threads. */ -SDL_atomic_t WASAPI_DefaultPlaybackGeneration; -SDL_atomic_t WASAPI_DefaultCaptureGeneration; - -/* This is a list of device id strings we have inflight, so we have consistent pointers to the same device. */ -typedef struct DevIdList -{ - WCHAR *str; - struct DevIdList *next; -} DevIdList; - -static DevIdList *deviceid_list = NULL; - /* Some GUIDs we need to know without linking to libraries that aren't available before Vista. */ static const IID SDL_IID_IAudioRenderClient = { 0xf294acfc, 0x3146, 0x4483,{ 0xa7, 0xbf, 0xad, 0xdc, 0xa7, 0xc2, 0x60, 0xe2 } }; static const IID SDL_IID_IAudioCaptureClient = { 0xc8adbd64, 0xe71e, 0x48a0,{ 0xa4, 0xde, 0x18, 0x5c, 0x39, 0x5c, 0xd3, 0x17 } }; -static const GUID SDL_KSDATAFORMAT_SUBTYPE_PCM = { 0x00000001, 0x0000, 0x0010,{ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 } }; -static const GUID SDL_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT = { 0x00000003, 0x0000, 0x0010,{ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 } }; - - -void -WASAPI_RemoveDevice(const SDL_bool iscapture, LPCWSTR devid) -{ - DevIdList *i; - DevIdList *next; - DevIdList *prev = NULL; - for (i = deviceid_list; i; i = next) { - next = i->next; - if (SDL_wcscmp(i->str, devid) == 0) { - if (prev) { - prev->next = next; - } else { - deviceid_list = next; - } - SDL_RemoveAudioDevice(iscapture, i->str); - SDL_free(i->str); - SDL_free(i); - } - prev = i; - } -} - -static SDL_AudioFormat -WaveFormatToSDLFormat(WAVEFORMATEX *waveformat) -{ - if ((waveformat->wFormatTag == WAVE_FORMAT_IEEE_FLOAT) && (waveformat->wBitsPerSample == 32)) { - return AUDIO_F32SYS; - } else if ((waveformat->wFormatTag == WAVE_FORMAT_PCM) && (waveformat->wBitsPerSample == 16)) { - return AUDIO_S16SYS; - } else if ((waveformat->wFormatTag == WAVE_FORMAT_PCM) && (waveformat->wBitsPerSample == 32)) { - return AUDIO_S32SYS; - } else if (waveformat->wFormatTag == WAVE_FORMAT_EXTENSIBLE) { - const WAVEFORMATEXTENSIBLE *ext = (const WAVEFORMATEXTENSIBLE *) waveformat; - if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, sizeof (GUID)) == 0) && (waveformat->wBitsPerSample == 32)) { - return AUDIO_F32SYS; - } else if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_PCM, sizeof (GUID)) == 0) && (waveformat->wBitsPerSample == 16)) { - return AUDIO_S16SYS; - } else if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_PCM, sizeof (GUID)) == 0) && (waveformat->wBitsPerSample == 32)) { - return AUDIO_S32SYS; - } - } - return 0; -} - -void -WASAPI_AddDevice(const SDL_bool iscapture, const char *devname, WAVEFORMATEXTENSIBLE *fmt, LPCWSTR devid) -{ - DevIdList *devidlist; - SDL_AudioSpec spec; - - /* You can have multiple endpoints on a device that are mutually exclusive ("Speakers" vs "Line Out" or whatever). - In a perfect world, things that are unplugged won't be in this collection. The only gotcha is probably for - phones and tablets, where you might have an internal speaker and a headphone jack and expect both to be - available and switch automatically. (!!! FIXME...?) */ - - /* see if we already have this one. */ - for (devidlist = deviceid_list; devidlist; devidlist = devidlist->next) { - if (SDL_wcscmp(devidlist->str, devid) == 0) { - return; /* we already have this. */ - } - } - - devidlist = (DevIdList *) SDL_malloc(sizeof (*devidlist)); - if (!devidlist) { - return; /* oh well. */ - } - - devid = SDL_wcsdup(devid); - if (!devid) { - SDL_free(devidlist); - return; /* oh well. */ - } - - devidlist->str = (WCHAR *) devid; - devidlist->next = deviceid_list; - deviceid_list = devidlist; - - SDL_zero(spec); - spec.channels = (Uint8)fmt->Format.nChannels; - spec.freq = fmt->Format.nSamplesPerSec; - spec.format = WaveFormatToSDLFormat((WAVEFORMATEX *) fmt); - SDL_AddAudioDevice(iscapture, devname, &spec, (void *) devid); -} static void WASAPI_DetectDevices(void) @@ -235,7 +135,7 @@ ReleaseWasapiDevice(this); /* dump the lost device's handles. */ if (this->hidden->default_device_generation) { - this->hidden->default_device_generation = SDL_AtomicGet(this->iscapture ? &WASAPI_DefaultCaptureGeneration : &WASAPI_DefaultPlaybackGeneration); + this->hidden->default_device_generation = SDL_AtomicGet(this->iscapture ? &SDL_IMMDevice_DefaultCaptureGeneration : &SDL_IMMDevice_DefaultPlaybackGeneration); } /* this can fail for lots of reasons, but the most likely is we had a @@ -268,7 +168,7 @@ } if (!lost && (generation > 0)) { /* is a default device? */ - const int newgen = SDL_AtomicGet(this->iscapture ? &WASAPI_DefaultCaptureGeneration : &WASAPI_DefaultPlaybackGeneration); + const int newgen = SDL_AtomicGet(this->iscapture ? &SDL_IMMDevice_DefaultCaptureGeneration : &SDL_IMMDevice_DefaultPlaybackGeneration); if (generation != newgen) { /* the desired default device was changed, jump over to it. */ lost = SDL_TRUE; } @@ -519,7 +419,7 @@ SDL_assert(client != NULL); -#ifdef __WINRT__ /* CreateEventEx() arrived in Vista, so we need an #ifdef for XP. */ +#if defined(__WINRT__) || defined(__GDK__) /* CreateEventEx() arrived in Vista, so we need an #ifdef for XP. */ this->hidden->event = CreateEventEx(NULL, NULL, 0, EVENT_ALL_ACCESS); #else this->hidden->event = CreateEventW(NULL, 0, 0, NULL); @@ -655,7 +555,7 @@ WASAPI_RefDevice(this); /* so CloseDevice() will unref to zero. */ if (!devid) { /* is default device? */ - this->hidden->default_device_generation = SDL_AtomicGet(this->iscapture ? &WASAPI_DefaultCaptureGeneration : &WASAPI_DefaultPlaybackGeneration); + this->hidden->default_device_generation = SDL_AtomicGet(this->iscapture ? &SDL_IMMDevice_DefaultCaptureGeneration : &SDL_IMMDevice_DefaultPlaybackGeneration); } else { this->hidden->devid = SDL_wcsdup(devid); if (!this->hidden->devid) { @@ -693,25 +593,12 @@ static void WASAPI_Deinitialize(void) { - DevIdList *devidlist; - DevIdList *next; - WASAPI_PlatformDeinit(); - - for (devidlist = deviceid_list; devidlist; devidlist = next) { - next = devidlist->next; - SDL_free(devidlist->str); - SDL_free(devidlist); - } - deviceid_list = NULL; } static SDL_bool WASAPI_Init(SDL_AudioDriverImpl * impl) { - SDL_AtomicSet(&WASAPI_DefaultPlaybackGeneration, 1); - SDL_AtomicSet(&WASAPI_DefaultCaptureGeneration, 1); - if (WASAPI_PlatformInit() == -1) { return SDL_FALSE; } @@ -728,7 +615,9 @@ impl->FlushCapture = WASAPI_FlushCapture; impl->CloseDevice = WASAPI_CloseDevice; impl->Deinitialize = WASAPI_Deinitialize; + impl->GetDefaultAudioInfo = WASAPI_GetDefaultAudioInfo; impl->HasCaptureSupport = SDL_TRUE; + impl->SupportsNonPow2Samples = SDL_TRUE; return SDL_TRUE; /* this audio target is available. */ } diff -Nru libsdl2-2.0.22+dfsg/src/audio/wasapi/SDL_wasapi.h libsdl2-2.24.0+dfsg/src/audio/wasapi/SDL_wasapi.h --- libsdl2-2.0.22+dfsg/src/audio/wasapi/SDL_wasapi.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/audio/wasapi/SDL_wasapi.h 2022-08-13 03:48:10.000000000 +0000 @@ -55,21 +55,16 @@ SDL_atomic_t just_activated; }; -/* these increment as default devices change. Opened default devices pick up changes in their threads. */ -extern SDL_atomic_t WASAPI_DefaultPlaybackGeneration; -extern SDL_atomic_t WASAPI_DefaultCaptureGeneration; - /* win32 and winrt implementations call into these. */ int WASAPI_PrepDevice(_THIS, const SDL_bool updatestream); void WASAPI_RefDevice(_THIS); void WASAPI_UnrefDevice(_THIS); -void WASAPI_AddDevice(const SDL_bool iscapture, const char *devname, WAVEFORMATEXTENSIBLE *fmt, LPCWSTR devid); -void WASAPI_RemoveDevice(const SDL_bool iscapture, LPCWSTR devid); /* These are functions that are implemented differently for Windows vs WinRT. */ int WASAPI_PlatformInit(void); void WASAPI_PlatformDeinit(void); void WASAPI_EnumerateEndpoints(void); +int WASAPI_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int iscapture); int WASAPI_ActivateDevice(_THIS, const SDL_bool isrecovery); void WASAPI_PlatformThreadInit(_THIS); void WASAPI_PlatformThreadDeinit(_THIS); diff -Nru libsdl2-2.0.22+dfsg/src/audio/wasapi/SDL_wasapi_win32.c libsdl2-2.24.0+dfsg/src/audio/wasapi/SDL_wasapi_win32.c --- libsdl2-2.0.22+dfsg/src/audio/wasapi/SDL_wasapi_win32.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/audio/wasapi/SDL_wasapi_win32.c 2022-08-13 03:48:10.000000000 +0000 @@ -29,28 +29,16 @@ #if SDL_AUDIO_DRIVER_WASAPI && !defined(__WINRT__) #include "../../core/windows/SDL_windows.h" +#include "../../core/windows/SDL_immdevice.h" #include "SDL_audio.h" #include "SDL_timer.h" #include "../SDL_audio_c.h" #include "../SDL_sysaudio.h" -#define COBJMACROS -#include #include #include "SDL_wasapi.h" -static const ERole SDL_WASAPI_role = eConsole; /* !!! FIXME: should this be eMultimedia? Should be a hint? */ - -/* This is global to the WASAPI target, to handle hotplug and default device lookup. */ -static IMMDeviceEnumerator *enumerator = NULL; - -/* PropVariantInit() is an inline function/macro in PropIdl.h that calls the C runtime's memset() directly. Use ours instead, to avoid dependency. */ -#ifdef PropVariantInit -#undef PropVariantInit -#endif -#define PropVariantInit(p) SDL_zerop(p) - /* handle to Avrt.dll--Vista and later!--for flagging the callback thread as "Pro Audio" (low latency). */ static HMODULE libavrt = NULL; typedef HANDLE(WINAPI *pfnAvSetMmThreadCharacteristicsW)(LPCWSTR, LPDWORD); @@ -59,203 +47,13 @@ static pfnAvRevertMmThreadCharacteristics pAvRevertMmThreadCharacteristics = NULL; /* Some GUIDs we need to know without linking to libraries that aren't available before Vista. */ -static const CLSID SDL_CLSID_MMDeviceEnumerator = { 0xbcde0395, 0xe52f, 0x467c,{ 0x8e, 0x3d, 0xc4, 0x57, 0x92, 0x91, 0x69, 0x2e } }; -static const IID SDL_IID_IMMDeviceEnumerator = { 0xa95664d2, 0x9614, 0x4f35,{ 0xa7, 0x46, 0xde, 0x8d, 0xb6, 0x36, 0x17, 0xe6 } }; -static const IID SDL_IID_IMMNotificationClient = { 0x7991eec9, 0x7e89, 0x4d85,{ 0x83, 0x90, 0x6c, 0x70, 0x3c, 0xec, 0x60, 0xc0 } }; -static const IID SDL_IID_IMMEndpoint = { 0x1be09788, 0x6894, 0x4089,{ 0x85, 0x86, 0x9a, 0x2a, 0x6c, 0x26, 0x5a, 0xc5 } }; static const IID SDL_IID_IAudioClient = { 0x1cb9ad4c, 0xdbfa, 0x4c32,{ 0xb1, 0x78, 0xc2, 0xf5, 0x68, 0xa7, 0x03, 0xb2 } }; -static const PROPERTYKEY SDL_PKEY_Device_FriendlyName = { { 0xa45c254e, 0xdf1c, 0x4efd,{ 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, } }, 14 }; -static const PROPERTYKEY SDL_PKEY_AudioEngine_DeviceFormat = { { 0xf19f064d, 0x82c, 0x4e27,{ 0xbc, 0x73, 0x68, 0x82, 0xa1, 0xbb, 0x8e, 0x4c, } }, 0 }; - - -static void -GetWasapiDeviceInfo(IMMDevice *device, char **utf8dev, WAVEFORMATEXTENSIBLE *fmt) -{ - /* PKEY_Device_FriendlyName gives you "Speakers (SoundBlaster Pro)" which drives me nuts. I'd rather it be - "SoundBlaster Pro (Speakers)" but I guess that's developers vs users. Windows uses the FriendlyName in - its own UIs, like Volume Control, etc. */ - IPropertyStore *props = NULL; - *utf8dev = NULL; - SDL_zerop(fmt); - if (SUCCEEDED(IMMDevice_OpenPropertyStore(device, STGM_READ, &props))) { - PROPVARIANT var; - PropVariantInit(&var); - if (SUCCEEDED(IPropertyStore_GetValue(props, &SDL_PKEY_Device_FriendlyName, &var))) { - *utf8dev = WIN_StringToUTF8W(var.pwszVal); - } - PropVariantClear(&var); - if (SUCCEEDED(IPropertyStore_GetValue(props, &SDL_PKEY_AudioEngine_DeviceFormat, &var))) { - SDL_memcpy(fmt, var.blob.pBlobData, SDL_min(var.blob.cbSize, sizeof(WAVEFORMATEXTENSIBLE))); - } - PropVariantClear(&var); - IPropertyStore_Release(props); - } -} - - -/* We need a COM subclass of IMMNotificationClient for hotplug support, which is - easy in C++, but we have to tapdance more to make work in C. - Thanks to this page for coaching on how to make this work: - https://www.codeproject.com/Articles/13601/COM-in-plain-C */ - -typedef struct SDLMMNotificationClient -{ - const IMMNotificationClientVtbl *lpVtbl; - SDL_atomic_t refcount; -} SDLMMNotificationClient; - -static HRESULT STDMETHODCALLTYPE -SDLMMNotificationClient_QueryInterface(IMMNotificationClient *this, REFIID iid, void **ppv) -{ - if ((WIN_IsEqualIID(iid, &IID_IUnknown)) || (WIN_IsEqualIID(iid, &SDL_IID_IMMNotificationClient))) - { - *ppv = this; - this->lpVtbl->AddRef(this); - return S_OK; - } - - *ppv = NULL; - return E_NOINTERFACE; -} - -static ULONG STDMETHODCALLTYPE -SDLMMNotificationClient_AddRef(IMMNotificationClient *ithis) -{ - SDLMMNotificationClient *this = (SDLMMNotificationClient *) ithis; - return (ULONG) (SDL_AtomicIncRef(&this->refcount) + 1); -} - -static ULONG STDMETHODCALLTYPE -SDLMMNotificationClient_Release(IMMNotificationClient *ithis) -{ - /* this is a static object; we don't ever free it. */ - SDLMMNotificationClient *this = (SDLMMNotificationClient *) ithis; - const ULONG retval = SDL_AtomicDecRef(&this->refcount); - if (retval == 0) { - SDL_AtomicSet(&this->refcount, 0); /* uhh... */ - return 0; - } - return retval - 1; -} - -/* These are the entry points called when WASAPI device endpoints change. */ -static HRESULT STDMETHODCALLTYPE -SDLMMNotificationClient_OnDefaultDeviceChanged(IMMNotificationClient *ithis, EDataFlow flow, ERole role, LPCWSTR pwstrDeviceId) -{ - if (role != SDL_WASAPI_role) { - return S_OK; /* ignore it. */ - } - - /* Increment the "generation," so opened devices will pick this up in their threads. */ - switch (flow) { - case eRender: - SDL_AtomicAdd(&WASAPI_DefaultPlaybackGeneration, 1); - break; - - case eCapture: - SDL_AtomicAdd(&WASAPI_DefaultCaptureGeneration, 1); - break; - - case eAll: - SDL_AtomicAdd(&WASAPI_DefaultPlaybackGeneration, 1); - SDL_AtomicAdd(&WASAPI_DefaultCaptureGeneration, 1); - break; - - default: - SDL_assert(!"uhoh, unexpected OnDefaultDeviceChange flow!"); - break; - } - - return S_OK; -} - -static HRESULT STDMETHODCALLTYPE -SDLMMNotificationClient_OnDeviceAdded(IMMNotificationClient *ithis, LPCWSTR pwstrDeviceId) -{ - /* we ignore this; devices added here then progress to ACTIVE, if appropriate, in - OnDeviceStateChange, making that a better place to deal with device adds. More - importantly: the first time you plug in a USB audio device, this callback will - fire, but when you unplug it, it isn't removed (it's state changes to NOTPRESENT). - Plugging it back in won't fire this callback again. */ - return S_OK; -} - -static HRESULT STDMETHODCALLTYPE -SDLMMNotificationClient_OnDeviceRemoved(IMMNotificationClient *ithis, LPCWSTR pwstrDeviceId) -{ - /* See notes in OnDeviceAdded handler about why we ignore this. */ - return S_OK; -} - -static HRESULT STDMETHODCALLTYPE -SDLMMNotificationClient_OnDeviceStateChanged(IMMNotificationClient *ithis, LPCWSTR pwstrDeviceId, DWORD dwNewState) -{ - IMMDevice *device = NULL; - - if (SUCCEEDED(IMMDeviceEnumerator_GetDevice(enumerator, pwstrDeviceId, &device))) { - IMMEndpoint *endpoint = NULL; - if (SUCCEEDED(IMMDevice_QueryInterface(device, &SDL_IID_IMMEndpoint, (void **) &endpoint))) { - EDataFlow flow; - if (SUCCEEDED(IMMEndpoint_GetDataFlow(endpoint, &flow))) { - const SDL_bool iscapture = (flow == eCapture); - if (dwNewState == DEVICE_STATE_ACTIVE) { - char *utf8dev; - WAVEFORMATEXTENSIBLE fmt; - GetWasapiDeviceInfo(device, &utf8dev, &fmt); - if (utf8dev) { - WASAPI_AddDevice(iscapture, utf8dev, &fmt, pwstrDeviceId); - SDL_free(utf8dev); - } - } else { - WASAPI_RemoveDevice(iscapture, pwstrDeviceId); - } - } - IMMEndpoint_Release(endpoint); - } - IMMDevice_Release(device); - } - - return S_OK; -} - -static HRESULT STDMETHODCALLTYPE -SDLMMNotificationClient_OnPropertyValueChanged(IMMNotificationClient *this, LPCWSTR pwstrDeviceId, const PROPERTYKEY key) -{ - return S_OK; /* we don't care about these. */ -} - -static const IMMNotificationClientVtbl notification_client_vtbl = { - SDLMMNotificationClient_QueryInterface, - SDLMMNotificationClient_AddRef, - SDLMMNotificationClient_Release, - SDLMMNotificationClient_OnDeviceStateChanged, - SDLMMNotificationClient_OnDeviceAdded, - SDLMMNotificationClient_OnDeviceRemoved, - SDLMMNotificationClient_OnDefaultDeviceChanged, - SDLMMNotificationClient_OnPropertyValueChanged -}; - -static SDLMMNotificationClient notification_client = { ¬ification_client_vtbl, { 1 } }; - int WASAPI_PlatformInit(void) { - HRESULT ret; - - /* just skip the discussion with COM here. */ - if (!WIN_IsWindowsVistaOrGreater()) { - return SDL_SetError("WASAPI support requires Windows Vista or later"); - } - - if (FAILED(WIN_CoInitialize())) { - return SDL_SetError("WASAPI: CoInitialize() failed"); - } - - ret = CoCreateInstance(&SDL_CLSID_MMDeviceEnumerator, NULL, CLSCTX_INPROC_SERVER, &SDL_IID_IMMDeviceEnumerator, (LPVOID *) &enumerator); - if (FAILED(ret)) { - WIN_CoUninitialize(); - return WIN_SetErrorFromHRESULT("WASAPI CoCreateInstance(MMDeviceEnumerator)", ret); + if (SDL_IMMDevice_Init() < 0) { + return -1; /* This is set by SDL_IMMDevice_Init */ } libavrt = LoadLibrary(TEXT("avrt.dll")); /* this library is available in Vista and later. No WinXP, so have to LoadLibrary to use it for now! */ @@ -270,12 +68,6 @@ void WASAPI_PlatformDeinit(void) { - if (enumerator) { - IMMDeviceEnumerator_UnregisterEndpointNotificationCallback(enumerator, (IMMNotificationClient *) ¬ification_client); - IMMDeviceEnumerator_Release(enumerator); - enumerator = NULL; - } - if (libavrt) { FreeLibrary(libavrt); libavrt = NULL; @@ -284,7 +76,7 @@ pAvSetMmThreadCharacteristicsW = NULL; pAvRevertMmThreadCharacteristics = NULL; - WIN_CoUninitialize(); + SDL_IMMDevice_Quit(); } void @@ -320,21 +112,12 @@ int WASAPI_ActivateDevice(_THIS, const SDL_bool isrecovery) { - LPCWSTR devid = this->hidden->devid; IMMDevice *device = NULL; HRESULT ret; - if (devid == NULL) { - const EDataFlow dataflow = this->iscapture ? eCapture : eRender; - ret = IMMDeviceEnumerator_GetDefaultAudioEndpoint(enumerator, dataflow, SDL_WASAPI_role, &device); - } else { - ret = IMMDeviceEnumerator_GetDevice(enumerator, devid, &device); - } - - if (FAILED(ret)) { - SDL_assert(device == NULL); + if (SDL_IMMDevice_Get(this->hidden->devid, &device, this->iscapture) < 0) { this->hidden->client = NULL; - return WIN_SetErrorFromHRESULT("WASAPI can't find requested audio endpoint", ret); + return -1; /* This is already set by SDL_IMMDevice_Get */ } /* this is not async in standard win32, yay! */ @@ -354,99 +137,16 @@ return 0; /* good to go. */ } - -typedef struct -{ - LPWSTR devid; - char *devname; - WAVEFORMATEXTENSIBLE fmt; -} EndpointItem; - -static int sort_endpoints(const void *_a, const void *_b) -{ - LPWSTR a = ((const EndpointItem *) _a)->devid; - LPWSTR b = ((const EndpointItem *) _b)->devid; - if (!a && b) { - return -1; - } else if (a && !b) { - return 1; - } - - while (SDL_TRUE) { - if (*a < *b) { - return -1; - } else if (*a > *b) { - return 1; - } else if (*a == 0) { - break; - } - a++; - b++; - } - - return 0; -} - -static void -WASAPI_EnumerateEndpointsForFlow(const SDL_bool iscapture) -{ - IMMDeviceCollection *collection = NULL; - EndpointItem *items; - UINT i, total; - - /* Note that WASAPI separates "adapter devices" from "audio endpoint devices" - ...one adapter device ("SoundBlaster Pro") might have multiple endpoint devices ("Speakers", "Line-Out"). */ - - if (FAILED(IMMDeviceEnumerator_EnumAudioEndpoints(enumerator, iscapture ? eCapture : eRender, DEVICE_STATE_ACTIVE, &collection))) { - return; - } - - if (FAILED(IMMDeviceCollection_GetCount(collection, &total))) { - IMMDeviceCollection_Release(collection); - return; - } - - items = (EndpointItem *) SDL_calloc(total, sizeof (EndpointItem)); - if (!items) { - return; /* oh well. */ - } - - for (i = 0; i < total; i++) { - EndpointItem *item = items + i; - IMMDevice *device = NULL; - if (SUCCEEDED(IMMDeviceCollection_Item(collection, i, &device))) { - if (SUCCEEDED(IMMDevice_GetId(device, &item->devid))) { - GetWasapiDeviceInfo(device, &item->devname, &item->fmt); - } - IMMDevice_Release(device); - } - } - - /* sort the list of devices by their guid so list is consistent between runs */ - SDL_qsort(items, total, sizeof (*items), sort_endpoints); - - /* Send the sorted list on to the SDL's higher level. */ - for (i = 0; i < total; i++) { - EndpointItem *item = items + i; - if ((item->devid) && (item->devname)) { - WASAPI_AddDevice(iscapture, item->devname, &item->fmt, item->devid); - } - SDL_free(item->devname); - CoTaskMemFree(item->devid); - } - - SDL_free(items); - IMMDeviceCollection_Release(collection); -} - void WASAPI_EnumerateEndpoints(void) { - WASAPI_EnumerateEndpointsForFlow(SDL_FALSE); /* playback */ - WASAPI_EnumerateEndpointsForFlow(SDL_TRUE); /* capture */ + SDL_IMMDevice_EnumerateEndpoints(SDL_FALSE); +} - /* if this fails, we just won't get hotplug events. Carry on anyhow. */ - IMMDeviceEnumerator_RegisterEndpointNotificationCallback(enumerator, (IMMNotificationClient *) ¬ification_client); +int +WASAPI_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int iscapture) +{ + return SDL_IMMDevice_GetDefaultAudioInfo(name, spec, iscapture); } void diff -Nru libsdl2-2.0.22+dfsg/src/audio/wasapi/SDL_wasapi_winrt.cpp libsdl2-2.24.0+dfsg/src/audio/wasapi/SDL_wasapi_winrt.cpp --- libsdl2-2.0.22+dfsg/src/audio/wasapi/SDL_wasapi_winrt.cpp 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/audio/wasapi/SDL_wasapi_winrt.cpp 2022-08-13 03:48:10.000000000 +0000 @@ -55,6 +55,22 @@ static Platform::String^ SDL_PKEY_AudioEngine_DeviceFormat = L"{f19f064d-082c-4e27-bc73-6882a1bb8e4c} 0"; +static void WASAPI_AddDevice(const SDL_bool iscapture, const char *devname, WAVEFORMATEXTENSIBLE *fmt, LPCWSTR devid); +static void WASAPI_RemoveDevice(const SDL_bool iscapture, LPCWSTR devid); +extern "C" { + SDL_atomic_t SDL_IMMDevice_DefaultPlaybackGeneration; + SDL_atomic_t SDL_IMMDevice_DefaultCaptureGeneration; +} + +/* This is a list of device id strings we have inflight, so we have consistent pointers to the same device. */ +typedef struct DevIdList +{ + WCHAR *str; + struct DevIdList *next; +} DevIdList; + +static DevIdList *deviceid_list = NULL; + class SDL_WasapiDeviceEventHandler { public: @@ -174,14 +190,14 @@ SDL_WasapiDeviceEventHandler::OnDefaultRenderDeviceChanged(Platform::Object^ sender, DefaultAudioRenderDeviceChangedEventArgs^ args) { SDL_assert(this->iscapture); - SDL_AtomicAdd(&WASAPI_DefaultPlaybackGeneration, 1); + SDL_AtomicAdd(&SDL_IMMDevice_DefaultPlaybackGeneration, 1); } void SDL_WasapiDeviceEventHandler::OnDefaultCaptureDeviceChanged(Platform::Object^ sender, DefaultAudioCaptureDeviceChangedEventArgs^ args) { SDL_assert(!this->iscapture); - SDL_AtomicAdd(&WASAPI_DefaultCaptureGeneration, 1); + SDL_AtomicAdd(&SDL_IMMDevice_DefaultCaptureGeneration, 1); } @@ -190,15 +206,27 @@ int WASAPI_PlatformInit(void) { + SDL_AtomicSet(&SDL_IMMDevice_DefaultPlaybackGeneration, 1); + SDL_AtomicSet(&SDL_IMMDevice_DefaultCaptureGeneration, 1); return 0; } void WASAPI_PlatformDeinit(void) { + DevIdList *devidlist; + DevIdList *next; + delete playback_device_event_handler; playback_device_event_handler = nullptr; delete capture_device_event_handler; capture_device_event_handler = nullptr; + + for (devidlist = deviceid_list; devidlist; devidlist = next) { + next = devidlist->next; + SDL_free(devidlist->str); + SDL_free(devidlist); + } + deviceid_list = NULL; } void WASAPI_EnumerateEndpoints(void) @@ -235,6 +263,12 @@ } int +WASAPI_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int iscapture) +{ + return SDL_Unsupported(); +} + +int WASAPI_ActivateDevice(_THIS, const SDL_bool isrecovery) { LPCWSTR devid = _this->hidden->devid; @@ -317,6 +351,97 @@ // !!! FIXME: set this thread to "Pro Audio" priority. } +/* Everything below was copied from SDL_wasapi.c, before it got moved to SDL_immdevice.c! */ + +static const GUID SDL_KSDATAFORMAT_SUBTYPE_PCM = { 0x00000001, 0x0000, 0x0010,{ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 } }; +static const GUID SDL_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT = { 0x00000003, 0x0000, 0x0010,{ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 } }; + +extern "C" SDL_AudioFormat +WaveFormatToSDLFormat(WAVEFORMATEX *waveformat) +{ + if ((waveformat->wFormatTag == WAVE_FORMAT_IEEE_FLOAT) && (waveformat->wBitsPerSample == 32)) { + return AUDIO_F32SYS; + } else if ((waveformat->wFormatTag == WAVE_FORMAT_PCM) && (waveformat->wBitsPerSample == 16)) { + return AUDIO_S16SYS; + } else if ((waveformat->wFormatTag == WAVE_FORMAT_PCM) && (waveformat->wBitsPerSample == 32)) { + return AUDIO_S32SYS; + } else if (waveformat->wFormatTag == WAVE_FORMAT_EXTENSIBLE) { + const WAVEFORMATEXTENSIBLE *ext = (const WAVEFORMATEXTENSIBLE *)waveformat; + if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, sizeof(GUID)) == 0) && (waveformat->wBitsPerSample == 32)) { + return AUDIO_F32SYS; + } else if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_PCM, sizeof(GUID)) == 0) && (waveformat->wBitsPerSample == 16)) { + return AUDIO_S16SYS; + } else if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_PCM, sizeof(GUID)) == 0) && (waveformat->wBitsPerSample == 32)) { + return AUDIO_S32SYS; + } + } + return 0; +} + +static void +WASAPI_RemoveDevice(const SDL_bool iscapture, LPCWSTR devid) +{ + DevIdList *i; + DevIdList *next; + DevIdList *prev = NULL; + for (i = deviceid_list; i; i = next) { + next = i->next; + if (SDL_wcscmp(i->str, devid) == 0) { + if (prev) { + prev->next = next; + } + else { + deviceid_list = next; + } + SDL_RemoveAudioDevice(iscapture, i->str); + SDL_free(i->str); + SDL_free(i); + } else { + prev = i; + } + } +} + +static void +WASAPI_AddDevice(const SDL_bool iscapture, const char *devname, WAVEFORMATEXTENSIBLE *fmt, LPCWSTR devid) +{ + DevIdList *devidlist; + SDL_AudioSpec spec; + + /* You can have multiple endpoints on a device that are mutually exclusive ("Speakers" vs "Line Out" or whatever). + In a perfect world, things that are unplugged won't be in this collection. The only gotcha is probably for + phones and tablets, where you might have an internal speaker and a headphone jack and expect both to be + available and switch automatically. (!!! FIXME...?) */ + + /* see if we already have this one. */ + for (devidlist = deviceid_list; devidlist; devidlist = devidlist->next) { + if (SDL_wcscmp(devidlist->str, devid) == 0) { + return; /* we already have this. */ + } + } + + devidlist = (DevIdList *)SDL_malloc(sizeof(*devidlist)); + if (!devidlist) { + return; /* oh well. */ + } + + devid = SDL_wcsdup(devid); + if (!devid) { + SDL_free(devidlist); + return; /* oh well. */ + } + + devidlist->str = (WCHAR *)devid; + devidlist->next = deviceid_list; + deviceid_list = devidlist; + + SDL_zero(spec); + spec.channels = (Uint8)fmt->Format.nChannels; + spec.freq = fmt->Format.nSamplesPerSec; + spec.format = WaveFormatToSDLFormat((WAVEFORMATEX *)fmt); + SDL_AddAudioDevice(iscapture, devname, &spec, (void *)devid); +} + #endif // SDL_AUDIO_DRIVER_WASAPI && defined(__WINRT__) /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/core/android/keyinfotable.h libsdl2-2.24.0+dfsg/src/core/android/keyinfotable.h --- libsdl2-2.0.22+dfsg/src/core/android/keyinfotable.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/core/android/keyinfotable.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,175 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef _ANDROID_KeyInfo -#define _ANDROID_KeyInfo - -#include "SDL_scancode.h" -#include "SDL_keycode.h" - -/* - This file is used by the keyboard code in SDL_uikitview.m to convert between characters - passed in from the iPhone's virtual keyboard, and tuples of SDL_Scancode and SDL_keymods. - For example unicharToUIKeyInfoTable['a'] would give you the scan code and keymod for lower - case a. -*/ - -typedef struct -{ - SDL_Scancode code; - uint16_t mod; -} AndroidKeyInfo; - -/* So far only ASCII characters here */ -static AndroidKeyInfo unicharToAndroidKeyInfoTable[] = { -/* 0 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 1 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 2 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 3 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 4 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 5 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 6 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 7 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 8 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 9 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 10 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 11 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 12 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 13 */ { SDL_SCANCODE_RETURN, 0 }, -/* 14 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 15 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 16 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 17 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 18 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 19 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 20 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 21 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 22 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 23 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 24 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 25 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 26 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 27 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 28 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 29 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 30 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 31 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 32 */ { SDL_SCANCODE_SPACE, 0 }, -/* 33 */ { SDL_SCANCODE_1, KMOD_SHIFT }, /* plus shift modifier '!' */ -/* 34 */ { SDL_SCANCODE_APOSTROPHE, KMOD_SHIFT }, /* plus shift modifier '"' */ -/* 35 */ { SDL_SCANCODE_3, KMOD_SHIFT }, /* plus shift modifier '#' */ -/* 36 */ { SDL_SCANCODE_4, KMOD_SHIFT }, /* plus shift modifier '$' */ -/* 37 */ { SDL_SCANCODE_5, KMOD_SHIFT }, /* plus shift modifier '%' */ -/* 38 */ { SDL_SCANCODE_7, KMOD_SHIFT }, /* plus shift modifier '&' */ -/* 39 */ { SDL_SCANCODE_APOSTROPHE, 0 }, /* ''' */ -/* 40 */ { SDL_SCANCODE_9, KMOD_SHIFT }, /* plus shift modifier '(' */ -/* 41 */ { SDL_SCANCODE_0, KMOD_SHIFT }, /* plus shift modifier ')' */ -/* 42 */ { SDL_SCANCODE_8, KMOD_SHIFT }, /* '*' */ -/* 43 */ { SDL_SCANCODE_EQUALS, KMOD_SHIFT }, /* plus shift modifier '+' */ -/* 44 */ { SDL_SCANCODE_COMMA, 0 }, /* ',' */ -/* 45 */ { SDL_SCANCODE_MINUS, 0 }, /* '-' */ -/* 46 */ { SDL_SCANCODE_PERIOD, 0 }, /* '.' */ -/* 47 */ { SDL_SCANCODE_SLASH, 0 }, /* '/' */ -/* 48 */ { SDL_SCANCODE_0, 0 }, -/* 49 */ { SDL_SCANCODE_1, 0 }, -/* 50 */ { SDL_SCANCODE_2, 0 }, -/* 51 */ { SDL_SCANCODE_3, 0 }, -/* 52 */ { SDL_SCANCODE_4, 0 }, -/* 53 */ { SDL_SCANCODE_5, 0 }, -/* 54 */ { SDL_SCANCODE_6, 0 }, -/* 55 */ { SDL_SCANCODE_7, 0 }, -/* 56 */ { SDL_SCANCODE_8, 0 }, -/* 57 */ { SDL_SCANCODE_9, 0 }, -/* 58 */ { SDL_SCANCODE_SEMICOLON, KMOD_SHIFT }, /* plus shift modifier ';' */ -/* 59 */ { SDL_SCANCODE_SEMICOLON, 0 }, -/* 60 */ { SDL_SCANCODE_COMMA, KMOD_SHIFT }, /* plus shift modifier '<' */ -/* 61 */ { SDL_SCANCODE_EQUALS, 0 }, -/* 62 */ { SDL_SCANCODE_PERIOD, KMOD_SHIFT }, /* plus shift modifier '>' */ -/* 63 */ { SDL_SCANCODE_SLASH, KMOD_SHIFT }, /* plus shift modifier '?' */ -/* 64 */ { SDL_SCANCODE_2, KMOD_SHIFT }, /* plus shift modifier '@' */ -/* 65 */ { SDL_SCANCODE_A, KMOD_SHIFT }, /* all the following need shift modifiers */ -/* 66 */ { SDL_SCANCODE_B, KMOD_SHIFT }, -/* 67 */ { SDL_SCANCODE_C, KMOD_SHIFT }, -/* 68 */ { SDL_SCANCODE_D, KMOD_SHIFT }, -/* 69 */ { SDL_SCANCODE_E, KMOD_SHIFT }, -/* 70 */ { SDL_SCANCODE_F, KMOD_SHIFT }, -/* 71 */ { SDL_SCANCODE_G, KMOD_SHIFT }, -/* 72 */ { SDL_SCANCODE_H, KMOD_SHIFT }, -/* 73 */ { SDL_SCANCODE_I, KMOD_SHIFT }, -/* 74 */ { SDL_SCANCODE_J, KMOD_SHIFT }, -/* 75 */ { SDL_SCANCODE_K, KMOD_SHIFT }, -/* 76 */ { SDL_SCANCODE_L, KMOD_SHIFT }, -/* 77 */ { SDL_SCANCODE_M, KMOD_SHIFT }, -/* 78 */ { SDL_SCANCODE_N, KMOD_SHIFT }, -/* 79 */ { SDL_SCANCODE_O, KMOD_SHIFT }, -/* 80 */ { SDL_SCANCODE_P, KMOD_SHIFT }, -/* 81 */ { SDL_SCANCODE_Q, KMOD_SHIFT }, -/* 82 */ { SDL_SCANCODE_R, KMOD_SHIFT }, -/* 83 */ { SDL_SCANCODE_S, KMOD_SHIFT }, -/* 84 */ { SDL_SCANCODE_T, KMOD_SHIFT }, -/* 85 */ { SDL_SCANCODE_U, KMOD_SHIFT }, -/* 86 */ { SDL_SCANCODE_V, KMOD_SHIFT }, -/* 87 */ { SDL_SCANCODE_W, KMOD_SHIFT }, -/* 88 */ { SDL_SCANCODE_X, KMOD_SHIFT }, -/* 89 */ { SDL_SCANCODE_Y, KMOD_SHIFT }, -/* 90 */ { SDL_SCANCODE_Z, KMOD_SHIFT }, -/* 91 */ { SDL_SCANCODE_LEFTBRACKET, 0 }, -/* 92 */ { SDL_SCANCODE_BACKSLASH, 0 }, -/* 93 */ { SDL_SCANCODE_RIGHTBRACKET, 0 }, -/* 94 */ { SDL_SCANCODE_6, KMOD_SHIFT }, /* plus shift modifier '^' */ -/* 95 */ { SDL_SCANCODE_MINUS, KMOD_SHIFT }, /* plus shift modifier '_' */ -/* 96 */ { SDL_SCANCODE_GRAVE, KMOD_SHIFT }, /* '`' */ -/* 97 */ { SDL_SCANCODE_A, 0 }, -/* 98 */ { SDL_SCANCODE_B, 0 }, -/* 99 */ { SDL_SCANCODE_C, 0 }, -/* 100 */{ SDL_SCANCODE_D, 0 }, -/* 101 */{ SDL_SCANCODE_E, 0 }, -/* 102 */{ SDL_SCANCODE_F, 0 }, -/* 103 */{ SDL_SCANCODE_G, 0 }, -/* 104 */{ SDL_SCANCODE_H, 0 }, -/* 105 */{ SDL_SCANCODE_I, 0 }, -/* 106 */{ SDL_SCANCODE_J, 0 }, -/* 107 */{ SDL_SCANCODE_K, 0 }, -/* 108 */{ SDL_SCANCODE_L, 0 }, -/* 109 */{ SDL_SCANCODE_M, 0 }, -/* 110 */{ SDL_SCANCODE_N, 0 }, -/* 111 */{ SDL_SCANCODE_O, 0 }, -/* 112 */{ SDL_SCANCODE_P, 0 }, -/* 113 */{ SDL_SCANCODE_Q, 0 }, -/* 114 */{ SDL_SCANCODE_R, 0 }, -/* 115 */{ SDL_SCANCODE_S, 0 }, -/* 116 */{ SDL_SCANCODE_T, 0 }, -/* 117 */{ SDL_SCANCODE_U, 0 }, -/* 118 */{ SDL_SCANCODE_V, 0 }, -/* 119 */{ SDL_SCANCODE_W, 0 }, -/* 120 */{ SDL_SCANCODE_X, 0 }, -/* 121 */{ SDL_SCANCODE_Y, 0 }, -/* 122 */{ SDL_SCANCODE_Z, 0 }, -/* 123 */{ SDL_SCANCODE_LEFTBRACKET, KMOD_SHIFT }, /* plus shift modifier '{' */ -/* 124 */{ SDL_SCANCODE_BACKSLASH, KMOD_SHIFT }, /* plus shift modifier '|' */ -/* 125 */{ SDL_SCANCODE_RIGHTBRACKET, KMOD_SHIFT }, /* plus shift modifier '}' */ -/* 126 */{ SDL_SCANCODE_GRAVE, KMOD_SHIFT }, /* plus shift modifier '~' */ -/* 127 */{ SDL_SCANCODE_BACKSPACE, KMOD_SHIFT } -}; - -#endif /* _ANDROID_KeyInfo */ - -/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/core/android/SDL_android.c libsdl2-2.24.0+dfsg/src/core/android/SDL_android.c --- libsdl2-2.0.22+dfsg/src/core/android/SDL_android.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/core/android/SDL_android.c 2022-08-13 03:48:10.000000000 +0000 @@ -31,8 +31,6 @@ #include "SDL_system.h" #include "SDL_android.h" -#include "keyinfotable.h" - #include "../../events/SDL_events_c.h" #include "../../video/android/SDL_androidkeyboard.h" #include "../../video/android/SDL_androidmouse.h" @@ -511,9 +509,10 @@ /* Library init */ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { - mJavaVM = vm; JNIEnv *env = NULL; + mJavaVM = vm; + if ((*mJavaVM)->GetEnv(mJavaVM, (void **)&env, JNI_VERSION_1_4) != JNI_OK) { __android_log_print(ANDROID_LOG_ERROR, "SDL", "Failed to get JNI Env"); return JNI_VERSION_1_4; @@ -1269,29 +1268,7 @@ JNIEnv *env, jclass cls, jchar chUnicode) { - SDL_Scancode code = SDL_SCANCODE_UNKNOWN; - uint16_t mod = 0; - - /* We do not care about bigger than 127. */ - if (chUnicode < 127) { - AndroidKeyInfo info = unicharToAndroidKeyInfoTable[chUnicode]; - code = info.code; - mod = info.mod; - } - - if (mod & KMOD_SHIFT) { - /* If character uses shift, press shift down */ - SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LSHIFT); - } - - /* send a keydown and keyup even for the character */ - SDL_SendKeyboardKey(SDL_PRESSED, code); - SDL_SendKeyboardKey(SDL_RELEASED, code); - - if (mod & KMOD_SHIFT) { - /* If character uses shift, press shift back up */ - SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LSHIFT); - } + SDL_SendKeyboardUnicodeKey(chUnicode); } JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeSetComposingText)( @@ -2553,6 +2530,7 @@ SDL_bool Android_JNI_RequestPermission(const char *permission) { JNIEnv *env = Android_JNI_GetEnv(); + jstring jpermission; const int requestCode = 1; /* Wait for any pending request on another thread */ @@ -2561,7 +2539,7 @@ } SDL_AtomicSet(&bPermissionRequestPending, SDL_TRUE); - jstring jpermission = (*env)->NewStringUTF(env, permission); + jpermission = (*env)->NewStringUTF(env, permission); (*env)->CallStaticVoidMethod(env, mActivityClass, midRequestPermission, jpermission, requestCode); (*env)->DeleteLocalRef(env, jpermission); diff -Nru libsdl2-2.0.22+dfsg/src/core/gdk/SDL_gdk.cpp libsdl2-2.24.0+dfsg/src/core/gdk/SDL_gdk.cpp --- libsdl2-2.0.22+dfsg/src/core/gdk/SDL_gdk.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/core/gdk/SDL_gdk.cpp 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,177 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#include "SDL_system.h" +#include "../windows/SDL_windows.h" +#include "SDL_messagebox.h" +#include "SDL_main.h" +#include +#include +#include /* CommandLineToArgvW() */ + +static XTaskQueueHandle GDK_GlobalTaskQueue; + +extern "C" DECLSPEC int +SDL_GDKGetTaskQueue(XTaskQueueHandle * outTaskQueue) +{ + /* If this is the first call, first create the global task queue. */ + if (!GDK_GlobalTaskQueue) { + HRESULT hr; + + hr = XTaskQueueCreate(XTaskQueueDispatchMode::ThreadPool, + XTaskQueueDispatchMode::Manual, + &GDK_GlobalTaskQueue + ); + if (FAILED(hr)) { + SDL_SetError("[GDK] Could not create global task queue"); + return -1; + } + + /* The initial call gets the non-duplicated handle so they can clean it up */ + *outTaskQueue = GDK_GlobalTaskQueue; + } else { + /* Duplicate the global task queue handle into outTaskQueue */ + if (FAILED(XTaskQueueDuplicateHandle(GDK_GlobalTaskQueue, outTaskQueue))) { + SDL_SetError("[GDK] Unable to acquire global task queue"); + return -1; + } + } + + return 0; +} + +extern "C" void +GDK_DispatchTaskQueue(void) +{ + /* If there is no global task queue, don't do anything. + * This gives the option to opt-out for those who want to handle everything themselves. + */ + if (GDK_GlobalTaskQueue) { + /* Dispatch any callbacks which are ready. */ + while (XTaskQueueDispatch(GDK_GlobalTaskQueue, XTaskQueuePort::Completion, 0)) + ; + } +} + +/* Pop up an out of memory message, returns to Windows */ +extern "C" static BOOL +OutOfMemory(void) +{ + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal Error", "Out of memory - aborting", NULL); + return FALSE; +} + +/* Gets the arguments with GetCommandLine, converts them to argc and argv + and calls SDL_main */ +extern "C" DECLSPEC int +SDL_GDKRunApp(SDL_main_func mainFunction, void *reserved) +{ + LPWSTR *argvw; + char **argv; + int i, argc, result; + HRESULT hr; + XTaskQueueHandle taskQueue; + + argvw = CommandLineToArgvW(GetCommandLineW(), &argc); + if (argvw == NULL) { + return OutOfMemory(); + } + + /* Note that we need to be careful about how we allocate/free memory here. + * If the application calls SDL_SetMemoryFunctions(), we can't rely on + * SDL_free() to use the same allocator after SDL_main() returns. + */ + + /* Parse it into argv and argc */ + argv = (char **) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (argc + 1) * sizeof(*argv)); + if (!argv) { + return OutOfMemory(); + } + for (i = 0; i < argc; ++i) { + DWORD len; + char *arg = WIN_StringToUTF8W(argvw[i]); + if (!arg) { + return OutOfMemory(); + } + len = (DWORD) SDL_strlen(arg); + argv[i] = (char *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len + 1); + if (!argv[i]) { + return OutOfMemory(); + } + SDL_memcpy(argv[i], arg, len); + SDL_free(arg); + } + argv[i] = NULL; + LocalFree(argvw); + + hr = XGameRuntimeInitialize(); + + if (SUCCEEDED(hr) && SDL_GDKGetTaskQueue(&taskQueue) == 0) { + Uint32 titleid = 0; + char scidBuffer[64]; + XblInitArgs xblArgs; + + XTaskQueueSetCurrentProcessTaskQueue(taskQueue); + + /* Try to get the title ID and initialize Xbox Live */ + hr = XGameGetXboxTitleId(&titleid); + if (SUCCEEDED(hr)) { + SDL_zero(xblArgs); + xblArgs.queue = taskQueue; + SDL_snprintf(scidBuffer, 64, "00000000-0000-0000-0000-0000%08X", titleid); + xblArgs.scid = scidBuffer; + hr = XblInitialize(&xblArgs); + } else { + SDL_SetError("[GDK] Unable to get titleid. Will not call XblInitialize. Check MicrosoftGame.config!"); + } + + SDL_SetMainReady(); + + /* Run the application main() code */ + result = mainFunction(argc, argv); + + /* !!! FIXME: This follows the docs exactly, but for some reason still leaks handles on exit? */ + /* Terminate the task queue and dispatch any pending tasks */ + XTaskQueueTerminate(taskQueue, false, nullptr, nullptr); + while (XTaskQueueDispatch(taskQueue, XTaskQueuePort::Completion, 0)) + ; + + XTaskQueueCloseHandle(taskQueue); + + XGameRuntimeUninitialize(); + } else { +#ifdef __WINGDK__ + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal Error", "[GDK] Could not initialize - aborting", NULL); +#else + SDL_assert_always(0 && "[GDK] Could not initialize - aborting"); +#endif + result = -1; + } + + /* Free argv, to avoid memory leak */ + for (i = 0; i < argc; ++i) { + HeapFree(GetProcessHeap(), 0, argv[i]); + } + HeapFree(GetProcessHeap(), 0, argv); + + return result; +} diff -Nru libsdl2-2.0.22+dfsg/src/core/gdk/SDL_gdk.h libsdl2-2.24.0+dfsg/src/core/gdk/SDL_gdk.h --- libsdl2-2.0.22+dfsg/src/core/gdk/SDL_gdk.h 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/core/gdk/SDL_gdk.h 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,24 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +/* This is called from WIN_PumpEvents on GDK */ +extern void GDK_DispatchTaskQueue(void); diff -Nru libsdl2-2.0.22+dfsg/src/core/linux/SDL_dbus.c libsdl2-2.24.0+dfsg/src/core/linux/SDL_dbus.c --- libsdl2-2.0.22+dfsg/src/core/linux/SDL_dbus.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/core/linux/SDL_dbus.c 2022-06-02 02:01:57.000000000 +0000 @@ -22,6 +22,7 @@ #include "SDL_hints.h" #include "SDL_dbus.h" #include "SDL_atomic.h" +#include "../../stdlib/SDL_vacopy.h" #if SDL_USE_LIBDBUS /* we never link directly to libdbus. */ diff -Nru libsdl2-2.0.22+dfsg/src/core/linux/SDL_evdev.c libsdl2-2.24.0+dfsg/src/core/linux/SDL_evdev.c --- libsdl2-2.0.22+dfsg/src/core/linux/SDL_evdev.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/core/linux/SDL_evdev.c 2022-08-13 03:48:10.000000000 +0000 @@ -68,12 +68,12 @@ int fd; /* TODO: use this for every device, not just touchscreen */ - int out_of_sync; + SDL_bool out_of_sync; /* TODO: expand on this to have data for every possible class (mouse, keyboard, touchpad, etc.). Also there's probably some things in here we can pull out to the SDL_evdevlist_item i.e. name */ - int is_touchscreen; + SDL_bool is_touchscreen; struct { char* name; @@ -96,8 +96,12 @@ } * touchscreen_data; + /* Mouse state */ SDL_bool high_res_wheel; SDL_bool high_res_hwheel; + SDL_bool relative_mouse; + int mouse_x, mouse_y; + int mouse_wheel, mouse_hwheel; struct SDL_evdevlist_item *next; } SDL_evdevlist_item; @@ -119,8 +123,8 @@ static void SDL_EVDEV_sync_device(SDL_evdevlist_item *item); static int SDL_EVDEV_device_removed(const char *dev_path); -#if SDL_USE_LIBUDEV static int SDL_EVDEV_device_added(const char *dev_path, int udev_class); +#if SDL_USE_LIBUDEV static void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *dev_path); #endif /* SDL_USE_LIBUDEV */ @@ -171,7 +175,30 @@ /* Force a scan to build the initial device list */ SDL_UDEV_Scan(); #else - /* TODO: Scan the devices manually, like a caveman */ + { + /* Allow the user to specify a list of devices explicitly of + the form: + deviceclass:path[,deviceclass:path[,...]] + where device class is an integer representing the + SDL_UDEV_deviceclass and path is the full path to + the event device. */ + const char* devices = SDL_getenv("SDL_EVDEV_DEVICES"); + if (devices) { + /* Assume this is the old use of the env var and it is not in + ROM. */ + char* rest = (char*) devices; + char* spec; + while ((spec = strtok_r(rest, ",", &rest))) { + char* endofcls = 0; + long cls = strtol(spec, &endofcls, 0); + if (endofcls) + SDL_EVDEV_device_added(endofcls + 1, cls); + } + } + else { + /* TODO: Scan the devices manually, like a caveman */ + } + } #endif /* SDL_USE_LIBUDEV */ _this->kbd = SDL_EVDEV_kbd_init(); @@ -225,11 +252,7 @@ switch(udev_event) { case SDL_UDEV_DEVICEADDED: - if (udev_class & SDL_UDEV_DEVICE_TOUCHPAD) { - udev_class |= SDL_UDEV_DEVICE_TOUCHSCREEN; - } - - if (!(udev_class & (SDL_UDEV_DEVICE_MOUSE | SDL_UDEV_DEVICE_KEYBOARD | SDL_UDEV_DEVICE_TOUCHSCREEN))) + if (!(udev_class & (SDL_UDEV_DEVICE_MOUSE | SDL_UDEV_DEVICE_KEYBOARD | SDL_UDEV_DEVICE_TOUCHSCREEN | SDL_UDEV_DEVICE_TOUCHPAD))) return; if ((udev_class & SDL_UDEV_DEVICE_JOYSTICK)) @@ -283,9 +306,9 @@ if (events[i].code >= BTN_MOUSE && events[i].code < BTN_MOUSE + SDL_arraysize(EVDEV_MouseButtons)) { mouse_button = events[i].code - BTN_MOUSE; if (events[i].value == 0) { - SDL_SendMouseButton(mouse->focus, mouse->mouseID, SDL_RELEASED, EVDEV_MouseButtons[mouse_button]); + SDL_SendMouseButton(mouse->focus, (SDL_MouseID)item->fd, SDL_RELEASED, EVDEV_MouseButtons[mouse_button]); } else if (events[i].value == 1) { - SDL_SendMouseButton(mouse->focus, mouse->mouseID, SDL_PRESSED, EVDEV_MouseButtons[mouse_button]); + SDL_SendMouseButton(mouse->focus, (SDL_MouseID)item->fd, SDL_PRESSED, EVDEV_MouseButtons[mouse_button]); } break; } @@ -361,16 +384,20 @@ if (item->touchscreen_data->max_slots != 1) break; item->touchscreen_data->slots[0].x = events[i].value; - } else - SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_FALSE, events[i].value, mouse->y); + } else if (!item->relative_mouse) { + /* FIXME: Normalize to input device's reported input range (EVIOCGABS) */ + item->mouse_x = events[i].value; + } break; case ABS_Y: if (item->is_touchscreen) { if (item->touchscreen_data->max_slots != 1) break; item->touchscreen_data->slots[0].y = events[i].value; - } else - SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_FALSE, mouse->x, events[i].value); + } else if (!item->relative_mouse) { + /* FIXME: Normalize to input device's reported input range (EVIOCGABS) */ + item->mouse_y = events[i].value; + } break; default: break; @@ -379,26 +406,28 @@ case EV_REL: switch(events[i].code) { case REL_X: - SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_TRUE, events[i].value, 0); + if (item->relative_mouse) + item->mouse_x += events[i].value; break; case REL_Y: - SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_TRUE, 0, events[i].value); + if (item->relative_mouse) + item->mouse_y += events[i].value; break; case REL_WHEEL: if (!item->high_res_wheel) - SDL_SendMouseWheel(mouse->focus, mouse->mouseID, 0, events[i].value, SDL_MOUSEWHEEL_NORMAL); + item->mouse_wheel += events[i].value; break; case REL_WHEEL_HI_RES: SDL_assert(item->high_res_wheel); - SDL_SendMouseWheel(mouse->focus, mouse->mouseID, 0, events[i].value / 120.0f, SDL_MOUSEWHEEL_NORMAL); + item->mouse_wheel += events[i].value; break; case REL_HWHEEL: if (!item->high_res_hwheel) - SDL_SendMouseWheel(mouse->focus, mouse->mouseID, events[i].value, 0, SDL_MOUSEWHEEL_NORMAL); + item->mouse_hwheel += events[i].value; break; case REL_HWHEEL_HI_RES: SDL_assert(item->high_res_hwheel); - SDL_SendMouseWheel(mouse->focus, mouse->mouseID, events[i].value / 120.0f, 0, SDL_MOUSEWHEEL_NORMAL); + item->mouse_hwheel += events[i].value; break; default: break; @@ -407,6 +436,19 @@ case EV_SYN: switch (events[i].code) { case SYN_REPORT: + /* Send mouse axis changes together to ensure consistency and reduce event processing overhead */ + if (item->mouse_x != 0 || item->mouse_y != 0) { + SDL_SendMouseMotion(mouse->focus, (SDL_MouseID)item->fd, item->relative_mouse, item->mouse_x, item->mouse_y); + item->mouse_x = item->mouse_y = 0; + } + if (item->mouse_wheel != 0 || item->mouse_hwheel != 0) { + SDL_SendMouseWheel(mouse->focus, (SDL_MouseID)item->fd, + item->mouse_hwheel / (item->high_res_hwheel ? 120.0f : 1.0f), + item->mouse_wheel / (item->high_res_wheel ? 120.0f : 1.0f), + SDL_MOUSEWHEEL_NORMAL); + item->mouse_wheel = item->mouse_hwheel = 0; + } + if (!item->is_touchscreen) /* FIXME: temp hack */ break; @@ -447,11 +489,11 @@ } if (item->out_of_sync) - item->out_of_sync = 0; + item->out_of_sync = SDL_FALSE; break; case SYN_DROPPED: if (item->is_touchscreen) - item->out_of_sync = 1; + item->out_of_sync = SDL_TRUE; SDL_EVDEV_sync_device(item); break; default: @@ -488,9 +530,8 @@ return scancode; } -#ifdef SDL_USE_LIBUDEV static int -SDL_EVDEV_init_touchscreen(SDL_evdevlist_item* item) +SDL_EVDEV_init_touchscreen(SDL_evdevlist_item* item, int udev_class) { int ret, i; unsigned long xreq, yreq; @@ -577,7 +618,7 @@ } ret = SDL_AddTouch(item->fd, /* I guess our fd is unique enough */ - SDL_TOUCH_DEVICE_DIRECT, + (udev_class & SDL_UDEV_DEVICE_TOUCHPAD) ? SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE : SDL_TOUCH_DEVICE_DIRECT, item->touchscreen_data->name); if (ret < 0) { SDL_free(item->touchscreen_data->slots); @@ -588,7 +629,6 @@ return 0; } -#endif /* SDL_USE_LIBUDEV */ static void SDL_EVDEV_destroy_touchscreen(SDL_evdevlist_item* item) { @@ -726,7 +766,6 @@ #endif /* EVIOCGMTSLOTS */ } -#if SDL_USE_LIBUDEV static int SDL_EVDEV_device_added(const char *dev_path, int udev_class) { @@ -760,14 +799,16 @@ } if (ioctl(item->fd, EVIOCGBIT(EV_REL, sizeof(relbit)), relbit) >= 0) { + item->relative_mouse = test_bit(REL_X, relbit) && test_bit(REL_Y, relbit); item->high_res_wheel = test_bit(REL_WHEEL_HI_RES, relbit); item->high_res_hwheel = test_bit(REL_HWHEEL_HI_RES, relbit); } - if (udev_class & SDL_UDEV_DEVICE_TOUCHSCREEN) { - item->is_touchscreen = 1; + /* For now, we just treat a touchpad like a touchscreen */ + if (udev_class & (SDL_UDEV_DEVICE_TOUCHSCREEN | SDL_UDEV_DEVICE_TOUCHPAD)) { + item->is_touchscreen = SDL_TRUE; - if ((ret = SDL_EVDEV_init_touchscreen(item)) < 0) { + if ((ret = SDL_EVDEV_init_touchscreen(item, udev_class)) < 0) { close(item->fd); SDL_free(item->path); SDL_free(item); @@ -786,7 +827,6 @@ return _this->num_devices++; } -#endif /* SDL_USE_LIBUDEV */ static int SDL_EVDEV_device_removed(const char *dev_path) diff -Nru libsdl2-2.0.22+dfsg/src/core/linux/SDL_fcitx.c libsdl2-2.24.0+dfsg/src/core/linux/SDL_fcitx.c --- libsdl2-2.0.22+dfsg/src/core/linux/SDL_fcitx.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/core/linux/SDL_fcitx.c 2022-08-13 03:48:10.000000000 +0000 @@ -85,25 +85,56 @@ } static size_t -Fcitx_GetPreeditString(SDL_DBusContext *dbus, DBusMessage *msg, char **ret) { +Fcitx_GetPreeditString(SDL_DBusContext *dbus, + DBusMessage *msg, + char **ret, + Sint32 *start_pos, + Sint32 *end_pos) +{ char *text = NULL, *subtext; size_t text_bytes = 0; DBusMessageIter iter, array, sub; + Sint32 p_start_pos = -1; + Sint32 p_end_pos = -1; dbus->message_iter_init(msg, &iter); /* Message type is a(si)i, we only need string part */ if (dbus->message_iter_get_arg_type(&iter) == DBUS_TYPE_ARRAY) { + size_t pos = 0; /* First pass: calculate string length */ dbus->message_iter_recurse(&iter, &array); while (dbus->message_iter_get_arg_type(&array) == DBUS_TYPE_STRUCT) { dbus->message_iter_recurse(&array, &sub); + subtext = NULL; if (dbus->message_iter_get_arg_type(&sub) == DBUS_TYPE_STRING) { dbus->message_iter_get_basic(&sub, &subtext); if (subtext && *subtext) { text_bytes += SDL_strlen(subtext); } } + dbus->message_iter_next(&sub); + if (dbus->message_iter_get_arg_type(&sub) == DBUS_TYPE_INT32 && p_end_pos == -1) { + /* Type is a bit field defined as follows: */ + /* bit 3: Underline, bit 4: HighLight, bit 5: DontCommit, */ + /* bit 6: Bold, bit 7: Strike, bit 8: Italic */ + Sint32 type; + dbus->message_iter_get_basic(&sub, &type); + /* We only consider highlight */ + if (type & (1 << 4)) { + if (p_start_pos == -1) { + p_start_pos = pos; + } + } else if (p_start_pos != -1 && p_end_pos == -1) { + p_end_pos = pos; + } + } dbus->message_iter_next(&array); + if (subtext && *subtext) { + pos += SDL_utf8strlen(subtext); + } + } + if (p_start_pos != -1 && p_end_pos == -1) { + p_end_pos = pos; } if (text_bytes) { text = SDL_malloc(text_bytes + 1); @@ -129,10 +160,32 @@ text_bytes = 0; } } - *ret= text; + + *ret = text; + *start_pos = p_start_pos; + *end_pos = p_end_pos; return text_bytes; } +static Sint32 +Fcitx_GetPreeditCursorByte(SDL_DBusContext *dbus, DBusMessage *msg) +{ + Sint32 byte = -1; + DBusMessageIter iter; + + dbus->message_iter_init(msg, &iter); + + dbus->message_iter_next(&iter); + + if (dbus->message_iter_get_arg_type(&iter) != DBUS_TYPE_INT32) { + return -1; + } + + dbus->message_iter_get_basic(&iter, &byte); + + return byte; +} + static DBusHandlerResult DBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *data) { @@ -162,20 +215,28 @@ if (dbus->message_is_signal(msg, FCITX_IC_DBUS_INTERFACE, "UpdateFormattedPreedit")) { char *text = NULL; - size_t text_bytes = Fcitx_GetPreeditString(dbus, msg, &text); + Sint32 start_pos, end_pos; + size_t text_bytes = Fcitx_GetPreeditString(dbus, msg, &text, &start_pos, &end_pos); if (text_bytes) { - char buf[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; - size_t i = 0; - size_t cursor = 0; - - while (i < text_bytes) { - const size_t sz = SDL_utf8strlcpy(buf, text + i, sizeof(buf)); - const size_t chars = SDL_utf8strlen(buf); + if (SDL_GetHintBoolean(SDL_HINT_IME_SUPPORT_EXTENDED_TEXT, SDL_FALSE)) { + if (start_pos == -1) { + Sint32 byte_pos = Fcitx_GetPreeditCursorByte(dbus, msg); + start_pos = byte_pos >= 0 ? SDL_utf8strnlen(text, byte_pos) : -1; + } + SDL_SendEditingText(text, start_pos, end_pos >= 0 ? end_pos - start_pos : -1); + } else { + char buf[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; + size_t i = 0; + size_t cursor = 0; + while (i < text_bytes) { + const size_t sz = SDL_utf8strlcpy(buf, text + i, sizeof(buf)); + const size_t chars = SDL_utf8strlen(buf); - SDL_SendEditingText(buf, cursor, chars); + SDL_SendEditingText(buf, cursor, chars); - i += sz; - cursor += chars; + i += sz; + cursor += chars; + } } SDL_free(text); } else { @@ -363,7 +424,7 @@ } void -SDL_Fcitx_UpdateTextRect(SDL_Rect *rect) +SDL_Fcitx_UpdateTextRect(const SDL_Rect *rect) { SDL_Window *focused_win = NULL; SDL_SysWMinfo info; @@ -371,7 +432,7 @@ SDL_Rect *cursor = &fcitx_client.cursor_rect; if (rect) { - SDL_memcpy(cursor, rect, sizeof(SDL_Rect)); + SDL_copyp(cursor, rect); } focused_win = SDL_GetKeyboardFocus(); diff -Nru libsdl2-2.0.22+dfsg/src/core/linux/SDL_fcitx.h libsdl2-2.24.0+dfsg/src/core/linux/SDL_fcitx.h --- libsdl2-2.0.22+dfsg/src/core/linux/SDL_fcitx.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/core/linux/SDL_fcitx.h 2022-08-13 03:48:10.000000000 +0000 @@ -32,7 +32,7 @@ extern void SDL_Fcitx_SetFocus(SDL_bool focused); extern void SDL_Fcitx_Reset(void); extern SDL_bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state); -extern void SDL_Fcitx_UpdateTextRect(SDL_Rect *rect); +extern void SDL_Fcitx_UpdateTextRect(const SDL_Rect *rect); extern void SDL_Fcitx_PumpEvents(void); #endif /* SDL_fcitx_h_ */ diff -Nru libsdl2-2.0.22+dfsg/src/core/linux/SDL_ibus.c libsdl2-2.24.0+dfsg/src/core/linux/SDL_ibus.c --- libsdl2-2.0.22+dfsg/src/core/linux/SDL_ibus.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/core/linux/SDL_ibus.c 2022-08-13 03:48:10.000000000 +0000 @@ -22,6 +22,7 @@ #ifdef HAVE_IBUS_IBUS_H #include "SDL.h" +#include "SDL_hints.h" #include "SDL_syswm.h" #include "SDL_ibus.h" #include "SDL_dbus.h" @@ -66,107 +67,217 @@ return ibus_mods; } -static const char * -IBus_GetVariantText(DBusConnection *conn, DBusMessageIter *iter, SDL_DBusContext *dbus) +static SDL_bool +IBus_EnterVariant(DBusConnection *conn, DBusMessageIter *iter, SDL_DBusContext *dbus, + DBusMessageIter *inside, const char * struct_id, size_t id_size) { - /* The text we need is nested weirdly, use dbus-monitor to see the structure better */ - const char *text = NULL; - const char *struct_id = NULL; - DBusMessageIter sub1, sub2; - + DBusMessageIter sub; if (dbus->message_iter_get_arg_type(iter) != DBUS_TYPE_VARIANT) { - return NULL; + return SDL_FALSE; } - - dbus->message_iter_recurse(iter, &sub1); - - if (dbus->message_iter_get_arg_type(&sub1) != DBUS_TYPE_STRUCT) { - return NULL; + + dbus->message_iter_recurse(iter, &sub); + + if (dbus->message_iter_get_arg_type(&sub) != DBUS_TYPE_STRUCT) { + return SDL_FALSE; } - - dbus->message_iter_recurse(&sub1, &sub2); - - if (dbus->message_iter_get_arg_type(&sub2) != DBUS_TYPE_STRING) { - return NULL; + + dbus->message_iter_recurse(&sub, inside); + + if (dbus->message_iter_get_arg_type(inside) != DBUS_TYPE_STRING) { + return SDL_FALSE; } - - dbus->message_iter_get_basic(&sub2, &struct_id); - if (!struct_id || SDL_strncmp(struct_id, "IBusText", sizeof("IBusText")) != 0) { - return NULL; + + dbus->message_iter_get_basic(inside, &struct_id); + if (!struct_id || SDL_strncmp(struct_id, struct_id, id_size) != 0) { + return SDL_FALSE; } - + return SDL_TRUE; +} + +static SDL_bool +IBus_GetDecorationPosition(DBusConnection *conn, DBusMessageIter *iter, SDL_DBusContext *dbus, + Uint32 *start_pos, Uint32 *end_pos) +{ + DBusMessageIter sub1, sub2, array; + + if (!IBus_EnterVariant(conn, iter, dbus, &sub1, "IBusText", sizeof("IBusText"))) { + return SDL_FALSE; + } + + dbus->message_iter_next(&sub1); + dbus->message_iter_next(&sub1); + dbus->message_iter_next(&sub1); + + if (!IBus_EnterVariant(conn, &sub1, dbus, &sub2, "IBusAttrList", sizeof("IBusAttrList"))) { + return SDL_FALSE; + } + dbus->message_iter_next(&sub2); dbus->message_iter_next(&sub2); - - if (dbus->message_iter_get_arg_type(&sub2) != DBUS_TYPE_STRING) { + + if (dbus->message_iter_get_arg_type(&sub2) != DBUS_TYPE_ARRAY) { + return SDL_FALSE; + } + + dbus->message_iter_recurse(&sub2, &array); + + while (dbus->message_iter_get_arg_type(&array) == DBUS_TYPE_VARIANT) { + DBusMessageIter sub; + if (IBus_EnterVariant(conn, &array, dbus, &sub, "IBusAttribute", sizeof("IBusAttribute"))) { + Uint32 type; + + dbus->message_iter_next(&sub); + dbus->message_iter_next(&sub); + + /* From here on, the structure looks like this: */ + /* Uint32 type: 1=underline, 2=foreground, 3=background */ + /* Uint32 value: for underline it's 0=NONE, 1=SINGLE, 2=DOUBLE, */ + /* 3=LOW, 4=ERROR */ + /* for foreground and background it's a color */ + /* Uint32 start_index: starting position for the style (utf8-char) */ + /* Uint32 end_index: end position for the style (utf8-char) */ + + dbus->message_iter_get_basic(&sub, &type); + /* We only use the background type to determine the selection */ + if (type == 3) { + Uint32 start = -1; + dbus->message_iter_next(&sub); + dbus->message_iter_next(&sub); + if (dbus->message_iter_get_arg_type(&sub) == DBUS_TYPE_UINT32) { + dbus->message_iter_get_basic(&sub, &start); + dbus->message_iter_next(&sub); + if (dbus->message_iter_get_arg_type(&sub) == DBUS_TYPE_UINT32) { + dbus->message_iter_get_basic(&sub, end_pos); + *start_pos = start; + return SDL_TRUE; + } + } + } + } + dbus->message_iter_next(&array); + } + return SDL_FALSE; +} + +static const char * +IBus_GetVariantText(DBusConnection *conn, DBusMessageIter *iter, SDL_DBusContext *dbus) +{ + /* The text we need is nested weirdly, use dbus-monitor to see the structure better */ + const char *text = NULL; + DBusMessageIter sub; + + if (!IBus_EnterVariant(conn, iter, dbus, &sub, "IBusText", sizeof("IBusText"))) { return NULL; } - - dbus->message_iter_get_basic(&sub2, &text); - + + dbus->message_iter_next(&sub); + dbus->message_iter_next(&sub); + + if (dbus->message_iter_get_arg_type(&sub) != DBUS_TYPE_STRING) { + return NULL; + } + dbus->message_iter_get_basic(&sub, &text); + return text; } +static SDL_bool +IBus_GetVariantCursorPos(DBusConnection *conn, DBusMessageIter *iter, SDL_DBusContext *dbus, + Uint32 *pos) +{ + dbus->message_iter_next(iter); + + if (dbus->message_iter_get_arg_type(iter) != DBUS_TYPE_UINT32) { + return SDL_FALSE; + } + + dbus->message_iter_get_basic(iter, pos); + + return SDL_TRUE; +} + static DBusHandlerResult IBus_MessageHandler(DBusConnection *conn, DBusMessage *msg, void *user_data) { SDL_DBusContext *dbus = (SDL_DBusContext *)user_data; - + if (dbus->message_is_signal(msg, IBUS_INPUT_INTERFACE, "CommitText")) { DBusMessageIter iter; const char *text; dbus->message_iter_init(msg, &iter); - text = IBus_GetVariantText(conn, &iter, dbus); + if (text && *text) { char buf[SDL_TEXTINPUTEVENT_TEXT_SIZE]; size_t text_bytes = SDL_strlen(text), i = 0; - + while (i < text_bytes) { size_t sz = SDL_utf8strlcpy(buf, text+i, sizeof(buf)); SDL_SendKeyboardText(buf); - + i += sz; } } - + return DBUS_HANDLER_RESULT_HANDLED; } - + if (dbus->message_is_signal(msg, IBUS_INPUT_INTERFACE, "UpdatePreeditText")) { DBusMessageIter iter; const char *text; dbus->message_iter_init(msg, &iter); text = IBus_GetVariantText(conn, &iter, dbus); - + if (text) { - char buf[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; - size_t text_bytes = SDL_strlen(text), i = 0; - size_t cursor = 0; - - do { - const size_t sz = SDL_utf8strlcpy(buf, text+i, sizeof(buf)); - const size_t chars = SDL_utf8strlen(buf); - - SDL_SendEditingText(buf, cursor, chars); + if (SDL_GetHintBoolean(SDL_HINT_IME_SUPPORT_EXTENDED_TEXT, SDL_FALSE)) { + Uint32 pos, start_pos, end_pos; + SDL_bool has_pos = SDL_FALSE; + SDL_bool has_dec_pos = SDL_FALSE; + + dbus->message_iter_init(msg, &iter); + has_dec_pos = IBus_GetDecorationPosition(conn, &iter, dbus, &start_pos, &end_pos); + if (!has_dec_pos) + { + dbus->message_iter_init(msg, &iter); + has_pos = IBus_GetVariantCursorPos(conn, &iter, dbus, &pos); + } - i += sz; - cursor += chars; - } while (i < text_bytes); + if(has_dec_pos) { + SDL_SendEditingText(text, start_pos, end_pos - start_pos); + } else if (has_pos) { + SDL_SendEditingText(text, pos, -1); + } else { + SDL_SendEditingText(text, -1, -1); + } + } else { + char buf[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; + size_t text_bytes = SDL_strlen(text), i = 0; + size_t cursor = 0; + + do { + const size_t sz = SDL_utf8strlcpy(buf, text+i, sizeof(buf)); + const size_t chars = SDL_utf8strlen(buf); + + SDL_SendEditingText(buf, cursor, chars); + i += sz; + cursor += chars; + } while (i < text_bytes); + } } - + SDL_IBus_UpdateTextRect(NULL); - + return DBUS_HANDLER_RESULT_HANDLED; } - + if (dbus->message_is_signal(msg, IBUS_INPUT_INTERFACE, "HidePreeditText")) { SDL_SendEditingText("", 0, 0); return DBUS_HANDLER_RESULT_HANDLED; } - + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } @@ -528,7 +639,7 @@ } void -SDL_IBus_UpdateTextRect(SDL_Rect *rect) +SDL_IBus_UpdateTextRect(const SDL_Rect *rect) { SDL_Window *focused_win; SDL_SysWMinfo info; diff -Nru libsdl2-2.0.22+dfsg/src/core/linux/SDL_ibus.h libsdl2-2.24.0+dfsg/src/core/linux/SDL_ibus.h --- libsdl2-2.0.22+dfsg/src/core/linux/SDL_ibus.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/core/linux/SDL_ibus.h 2022-08-13 03:48:10.000000000 +0000 @@ -45,7 +45,7 @@ /* Update the position of IBus' candidate list. If rect is NULL then this will just reposition it relative to the focused window's new position. */ -extern void SDL_IBus_UpdateTextRect(SDL_Rect *window_relative_rect); +extern void SDL_IBus_UpdateTextRect(const SDL_Rect *window_relative_rect); /* Checks DBus for new IBus events, and calls SDL_SendKeyboardText / SDL_SendEditingText for each event it finds */ diff -Nru libsdl2-2.0.22+dfsg/src/core/linux/SDL_ime.c libsdl2-2.24.0+dfsg/src/core/linux/SDL_ime.c --- libsdl2-2.0.22+dfsg/src/core/linux/SDL_ime.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/core/linux/SDL_ime.c 2022-08-13 03:48:10.000000000 +0000 @@ -28,7 +28,7 @@ typedef void (*_SDL_IME_SetFocus)(SDL_bool); typedef void (*_SDL_IME_Reset)(void); typedef SDL_bool (*_SDL_IME_ProcessKeyEvent)(Uint32, Uint32, Uint8 state); -typedef void (*_SDL_IME_UpdateTextRect)(SDL_Rect *); +typedef void (*_SDL_IME_UpdateTextRect)(const SDL_Rect *); typedef void (*_SDL_IME_PumpEvents)(void); static _SDL_IME_Init SDL_IME_Init_Real = NULL; @@ -136,7 +136,7 @@ } void -SDL_IME_UpdateTextRect(SDL_Rect *rect) +SDL_IME_UpdateTextRect(const SDL_Rect *rect) { if (SDL_IME_UpdateTextRect_Real) SDL_IME_UpdateTextRect_Real(rect); diff -Nru libsdl2-2.0.22+dfsg/src/core/linux/SDL_ime.h libsdl2-2.24.0+dfsg/src/core/linux/SDL_ime.h --- libsdl2-2.0.22+dfsg/src/core/linux/SDL_ime.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/core/linux/SDL_ime.h 2022-08-13 03:48:10.000000000 +0000 @@ -32,7 +32,7 @@ extern void SDL_IME_SetFocus(SDL_bool focused); extern void SDL_IME_Reset(void); extern SDL_bool SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state); -extern void SDL_IME_UpdateTextRect(SDL_Rect *rect); +extern void SDL_IME_UpdateTextRect(const SDL_Rect *rect); extern void SDL_IME_PumpEvents(void); #endif /* SDL_ime_h_ */ diff -Nru libsdl2-2.0.22+dfsg/src/core/linux/SDL_threadprio.c libsdl2-2.24.0+dfsg/src/core/linux/SDL_threadprio.c --- libsdl2-2.0.22+dfsg/src/core/linux/SDL_threadprio.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/core/linux/SDL_threadprio.c 2022-08-19 15:46:21.000000000 +0000 @@ -30,6 +30,7 @@ #include #include #include +#include #include "SDL_system.h" /* RLIMIT_RTTIME requires kernel >= 2.6.25 and is in glibc >= 2.14 */ @@ -51,30 +52,87 @@ #define RTKIT_DBUS_PATH "/org/freedesktop/RealtimeKit1" #define RTKIT_DBUS_INTERFACE "org.freedesktop.RealtimeKit1" +/* d-bus queries to the XDG portal interface to RealtimeKit1 */ +#define XDG_PORTAL_DBUS_NODE "org.freedesktop.portal.Desktop" +#define XDG_PORTAL_DBUS_PATH "/org/freedesktop/portal/desktop" +#define XDG_PORTAL_DBUS_INTERFACE "org.freedesktop.portal.Realtime" + +static SDL_bool rtkit_use_session_conn; +static const char *rtkit_dbus_node; +static const char *rtkit_dbus_path; +static const char *rtkit_dbus_interface; + static pthread_once_t rtkit_initialize_once = PTHREAD_ONCE_INIT; static Sint32 rtkit_min_nice_level = -20; static Sint32 rtkit_max_realtime_priority = 99; static Sint64 rtkit_max_rttime_usec = 200000; +/* + * Checking that the RTTimeUSecMax property exists and is an int64 confirms that: + * - The desktop portal exists and supports the realtime interface. + * - The realtime interface is new enough to have the required bug fixes applied. + */ +static SDL_bool +realtime_portal_supported(DBusConnection *conn) +{ + Sint64 res; + return SDL_DBus_QueryPropertyOnConnection(conn, XDG_PORTAL_DBUS_NODE, XDG_PORTAL_DBUS_PATH, XDG_PORTAL_DBUS_INTERFACE, + "RTTimeUSecMax", DBUS_TYPE_INT64, &res); +} + static void -rtkit_initialize() +set_rtkit_interface() +{ + SDL_DBusContext *dbus = SDL_DBus_GetContext(); + + /* xdg-desktop-portal works in all instances, so check for it first. */ + if (dbus && realtime_portal_supported(dbus->session_conn)) { + rtkit_use_session_conn = SDL_TRUE; + rtkit_dbus_node = XDG_PORTAL_DBUS_NODE; + rtkit_dbus_path = XDG_PORTAL_DBUS_PATH; + rtkit_dbus_interface = XDG_PORTAL_DBUS_INTERFACE; + } else { /* Fall back to the standard rtkit interface in all other cases. */ + rtkit_use_session_conn = SDL_FALSE; + rtkit_dbus_node = RTKIT_DBUS_NODE; + rtkit_dbus_path = RTKIT_DBUS_PATH; + rtkit_dbus_interface = RTKIT_DBUS_INTERFACE; + } +} + +static DBusConnection* +get_rtkit_dbus_connection() { SDL_DBusContext *dbus = SDL_DBus_GetContext(); + if (dbus) { + return rtkit_use_session_conn ? dbus->session_conn : dbus->system_conn; + } + + return NULL; +} + +static void +rtkit_initialize() +{ + DBusConnection *dbus_conn; + + set_rtkit_interface(); + dbus_conn = get_rtkit_dbus_connection(); + /* Try getting minimum nice level: this is often greater than PRIO_MIN (-20). */ - if (!dbus || !SDL_DBus_QueryPropertyOnConnection(dbus->system_conn, RTKIT_DBUS_NODE, RTKIT_DBUS_PATH, RTKIT_DBUS_INTERFACE, "MinNiceLevel", + if (!dbus_conn || !SDL_DBus_QueryPropertyOnConnection(dbus_conn, rtkit_dbus_node, rtkit_dbus_path, rtkit_dbus_interface, "MinNiceLevel", DBUS_TYPE_INT32, &rtkit_min_nice_level)) { rtkit_min_nice_level = -20; } /* Try getting maximum realtime priority: this can be less than the POSIX default (99). */ - if (!dbus || !SDL_DBus_QueryPropertyOnConnection(dbus->system_conn, RTKIT_DBUS_NODE, RTKIT_DBUS_PATH, RTKIT_DBUS_INTERFACE, "MaxRealtimePriority", + if (!dbus_conn || !SDL_DBus_QueryPropertyOnConnection(dbus_conn, rtkit_dbus_node, rtkit_dbus_path, rtkit_dbus_interface, "MaxRealtimePriority", DBUS_TYPE_INT32, &rtkit_max_realtime_priority)) { rtkit_max_realtime_priority = 99; } /* Try getting maximum rttime allowed by rtkit: exceeding this value will result in SIGKILL */ - if (!dbus || !SDL_DBus_QueryPropertyOnConnection(dbus->system_conn, RTKIT_DBUS_NODE, RTKIT_DBUS_PATH, RTKIT_DBUS_INTERFACE, "RTTimeUSecMax", + if (!dbus_conn || !SDL_DBus_QueryPropertyOnConnection(dbus_conn, rtkit_dbus_node, rtkit_dbus_path, rtkit_dbus_interface, "RTTimeUSecMax", DBUS_TYPE_INT64, &rtkit_max_rttime_usec)) { rtkit_max_rttime_usec = 200000; } @@ -147,18 +205,20 @@ static SDL_bool rtkit_setpriority_nice(pid_t thread, int nice_level) { - Uint64 ui64 = (Uint64)thread; - Sint32 si32 = (Sint32)nice_level; - SDL_DBusContext *dbus = SDL_DBus_GetContext(); + DBusConnection *dbus_conn; + Uint64 pid = (Uint64)getpid(); + Uint64 tid = (Uint64)thread; + Sint32 nice = (Sint32)nice_level; pthread_once(&rtkit_initialize_once, rtkit_initialize); + dbus_conn = get_rtkit_dbus_connection(); - if (si32 < rtkit_min_nice_level) - si32 = rtkit_min_nice_level; + if (nice < rtkit_min_nice_level) + nice = rtkit_min_nice_level; - if (!dbus || !SDL_DBus_CallMethodOnConnection(dbus->system_conn, - RTKIT_DBUS_NODE, RTKIT_DBUS_PATH, RTKIT_DBUS_INTERFACE, "MakeThreadHighPriority", - DBUS_TYPE_UINT64, &ui64, DBUS_TYPE_INT32, &si32, DBUS_TYPE_INVALID, + if (!dbus_conn || !SDL_DBus_CallMethodOnConnection(dbus_conn, + rtkit_dbus_node, rtkit_dbus_path, rtkit_dbus_interface, "MakeThreadHighPriorityWithPID", + DBUS_TYPE_UINT64, &pid, DBUS_TYPE_UINT64, &tid, DBUS_TYPE_INT32, &nice, DBUS_TYPE_INVALID, DBUS_TYPE_INVALID)) { return SDL_FALSE; } @@ -168,14 +228,16 @@ static SDL_bool rtkit_setpriority_realtime(pid_t thread, int rt_priority) { - Uint64 ui64 = (Uint64)thread; - Uint32 ui32 = (Uint32)rt_priority; - SDL_DBusContext *dbus = SDL_DBus_GetContext(); + DBusConnection *dbus_conn; + Uint64 pid = (Uint64)getpid(); + Uint64 tid = (Uint64)thread; + Uint32 priority = (Uint32)rt_priority; pthread_once(&rtkit_initialize_once, rtkit_initialize); + dbus_conn = get_rtkit_dbus_connection(); - if (ui32 > rtkit_max_realtime_priority) - ui32 = rtkit_max_realtime_priority; + if (priority > rtkit_max_realtime_priority) + priority = rtkit_max_realtime_priority; // We always perform the thread state changes necessary for rtkit. // This wastes some system calls if the state is already set but @@ -185,9 +247,9 @@ // go through to determine whether it really needs to fail or not. rtkit_initialize_realtime_thread(); - if (!dbus || !SDL_DBus_CallMethodOnConnection(dbus->system_conn, - RTKIT_DBUS_NODE, RTKIT_DBUS_PATH, RTKIT_DBUS_INTERFACE, "MakeThreadRealtime", - DBUS_TYPE_UINT64, &ui64, DBUS_TYPE_UINT32, &ui32, DBUS_TYPE_INVALID, + if (!dbus_conn || !SDL_DBus_CallMethodOnConnection(dbus_conn, + rtkit_dbus_node, rtkit_dbus_path, rtkit_dbus_interface, "MakeThreadRealtimeWithPID", + DBUS_TYPE_UINT64, &pid, DBUS_TYPE_UINT64, &tid, DBUS_TYPE_UINT32, &priority, DBUS_TYPE_INVALID, DBUS_TYPE_INVALID)) { return SDL_FALSE; } diff -Nru libsdl2-2.0.22+dfsg/src/core/windows/SDL_hid.c libsdl2-2.24.0+dfsg/src/core/windows/SDL_hid.c --- libsdl2-2.0.22+dfsg/src/core/windows/SDL_hid.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/core/windows/SDL_hid.c 2022-06-02 02:01:57.000000000 +0000 @@ -27,8 +27,6 @@ HidD_GetString_t SDL_HidD_GetManufacturerString; HidD_GetString_t SDL_HidD_GetProductString; -HidD_GetPreparsedData_t SDL_HidD_GetPreparsedData; -HidD_FreePreparsedData_t SDL_HidD_FreePreparsedData; HidP_GetCaps_t SDL_HidP_GetCaps; HidP_GetButtonCaps_t SDL_HidP_GetButtonCaps; HidP_GetValueCaps_t SDL_HidP_GetValueCaps; @@ -58,15 +56,13 @@ SDL_HidD_GetManufacturerString = (HidD_GetString_t)GetProcAddress(s_pHIDDLL, "HidD_GetManufacturerString"); SDL_HidD_GetProductString = (HidD_GetString_t)GetProcAddress(s_pHIDDLL, "HidD_GetProductString"); - SDL_HidD_GetPreparsedData = (HidD_GetPreparsedData_t)GetProcAddress(s_pHIDDLL, "HidD_GetPreparsedData"); - SDL_HidD_FreePreparsedData = (HidD_FreePreparsedData_t)GetProcAddress(s_pHIDDLL, "HidD_FreePreparsedData"); SDL_HidP_GetCaps = (HidP_GetCaps_t)GetProcAddress(s_pHIDDLL, "HidP_GetCaps"); SDL_HidP_GetButtonCaps = (HidP_GetButtonCaps_t)GetProcAddress(s_pHIDDLL, "HidP_GetButtonCaps"); SDL_HidP_GetValueCaps = (HidP_GetValueCaps_t)GetProcAddress(s_pHIDDLL, "HidP_GetValueCaps"); SDL_HidP_MaxDataListLength = (HidP_MaxDataListLength_t)GetProcAddress(s_pHIDDLL, "HidP_MaxDataListLength"); SDL_HidP_GetData = (HidP_GetData_t)GetProcAddress(s_pHIDDLL, "HidP_GetData"); - if (!SDL_HidD_GetManufacturerString || !SDL_HidD_GetProductString || !SDL_HidD_GetPreparsedData || - !SDL_HidD_FreePreparsedData || !SDL_HidP_GetCaps || !SDL_HidP_GetButtonCaps || + if (!SDL_HidD_GetManufacturerString || !SDL_HidD_GetProductString || + !SDL_HidP_GetCaps || !SDL_HidP_GetButtonCaps || !SDL_HidP_GetValueCaps || !SDL_HidP_MaxDataListLength || !SDL_HidP_GetData) { WIN_UnloadHIDDLL(); return -1; diff -Nru libsdl2-2.0.22+dfsg/src/core/windows/SDL_hid.h libsdl2-2.24.0+dfsg/src/core/windows/SDL_hid.h --- libsdl2-2.0.22+dfsg/src/core/windows/SDL_hid.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/core/windows/SDL_hid.h 2022-06-02 02:01:57.000000000 +0000 @@ -183,8 +183,6 @@ extern void WIN_UnloadHIDDLL(void); typedef BOOLEAN (WINAPI *HidD_GetString_t)(HANDLE HidDeviceObject, PVOID Buffer, ULONG BufferLength); -typedef BOOLEAN (WINAPI *HidD_GetPreparsedData_t)(HANDLE HidDeviceObject, PHIDP_PREPARSED_DATA *PreparsedData); -typedef BOOLEAN (WINAPI *HidD_FreePreparsedData_t)(PHIDP_PREPARSED_DATA PreparsedData); typedef NTSTATUS (WINAPI *HidP_GetCaps_t)(PHIDP_PREPARSED_DATA PreparsedData, PHIDP_CAPS Capabilities); typedef NTSTATUS (WINAPI *HidP_GetButtonCaps_t)(HIDP_REPORT_TYPE ReportType, PHIDP_BUTTON_CAPS ButtonCaps, PUSHORT ButtonCapsLength, PHIDP_PREPARSED_DATA PreparsedData); typedef NTSTATUS (WINAPI *HidP_GetValueCaps_t)(HIDP_REPORT_TYPE ReportType, PHIDP_VALUE_CAPS ValueCaps, PUSHORT ValueCapsLength, PHIDP_PREPARSED_DATA PreparsedData); @@ -193,8 +191,6 @@ extern HidD_GetString_t SDL_HidD_GetManufacturerString; extern HidD_GetString_t SDL_HidD_GetProductString; -extern HidD_GetPreparsedData_t SDL_HidD_GetPreparsedData; -extern HidD_FreePreparsedData_t SDL_HidD_FreePreparsedData; extern HidP_GetCaps_t SDL_HidP_GetCaps; extern HidP_GetButtonCaps_t SDL_HidP_GetButtonCaps; extern HidP_GetValueCaps_t SDL_HidP_GetValueCaps; diff -Nru libsdl2-2.0.22+dfsg/src/core/windows/SDL_immdevice.c libsdl2-2.24.0+dfsg/src/core/windows/SDL_immdevice.c --- libsdl2-2.0.22+dfsg/src/core/windows/SDL_immdevice.c 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/core/windows/SDL_immdevice.c 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,543 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if (defined(__WIN32__) || defined(__GDK__)) && HAVE_MMDEVICEAPI_H + +#include "SDL_windows.h" +#include "SDL_immdevice.h" +#include "../../audio/SDL_sysaudio.h" +#include /* For CLSIDFromString */ + +static const ERole SDL_IMMDevice_role = eConsole; /* !!! FIXME: should this be eMultimedia? Should be a hint? */ + +/* This is global to the WASAPI target, to handle hotplug and default device lookup. */ +static IMMDeviceEnumerator *enumerator = NULL; + +/* PropVariantInit() is an inline function/macro in PropIdl.h that calls the C runtime's memset() directly. Use ours instead, to avoid dependency. */ +#ifdef PropVariantInit +#undef PropVariantInit +#endif +#define PropVariantInit(p) SDL_zerop(p) + +/* Some GUIDs we need to know without linking to libraries that aren't available before Vista. */ +static const CLSID SDL_CLSID_MMDeviceEnumerator = { 0xbcde0395, 0xe52f, 0x467c,{ 0x8e, 0x3d, 0xc4, 0x57, 0x92, 0x91, 0x69, 0x2e } }; +static const IID SDL_IID_IMMDeviceEnumerator = { 0xa95664d2, 0x9614, 0x4f35,{ 0xa7, 0x46, 0xde, 0x8d, 0xb6, 0x36, 0x17, 0xe6 } }; +static const IID SDL_IID_IMMNotificationClient = { 0x7991eec9, 0x7e89, 0x4d85,{ 0x83, 0x90, 0x6c, 0x70, 0x3c, 0xec, 0x60, 0xc0 } }; +static const IID SDL_IID_IMMEndpoint = { 0x1be09788, 0x6894, 0x4089,{ 0x85, 0x86, 0x9a, 0x2a, 0x6c, 0x26, 0x5a, 0xc5 } }; +static const PROPERTYKEY SDL_PKEY_Device_FriendlyName = { { 0xa45c254e, 0xdf1c, 0x4efd,{ 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, } }, 14 }; +static const PROPERTYKEY SDL_PKEY_AudioEngine_DeviceFormat = { { 0xf19f064d, 0x82c, 0x4e27,{ 0xbc, 0x73, 0x68, 0x82, 0xa1, 0xbb, 0x8e, 0x4c, } }, 0 }; +static const PROPERTYKEY SDL_PKEY_AudioEndpoint_GUID = { { 0x1da5d803, 0xd492, 0x4edd,{ 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e, } }, 4 }; +static const GUID SDL_KSDATAFORMAT_SUBTYPE_PCM = { 0x00000001, 0x0000, 0x0010,{ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 } }; +static const GUID SDL_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT = { 0x00000003, 0x0000, 0x0010,{ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 } }; + +/* these increment as default devices change. Opened default devices pick up changes in their threads. */ +SDL_atomic_t SDL_IMMDevice_DefaultPlaybackGeneration; +SDL_atomic_t SDL_IMMDevice_DefaultCaptureGeneration; + +static void +GetMMDeviceInfo(IMMDevice *device, char **utf8dev, WAVEFORMATEXTENSIBLE *fmt, GUID *guid) +{ + /* PKEY_Device_FriendlyName gives you "Speakers (SoundBlaster Pro)" which drives me nuts. I'd rather it be + "SoundBlaster Pro (Speakers)" but I guess that's developers vs users. Windows uses the FriendlyName in + its own UIs, like Volume Control, etc. */ + IPropertyStore *props = NULL; + *utf8dev = NULL; + SDL_zerop(fmt); + if (SUCCEEDED(IMMDevice_OpenPropertyStore(device, STGM_READ, &props))) { + PROPVARIANT var; + PropVariantInit(&var); + if (SUCCEEDED(IPropertyStore_GetValue(props, &SDL_PKEY_Device_FriendlyName, &var))) { + *utf8dev = WIN_StringToUTF8W(var.pwszVal); + } + PropVariantClear(&var); + if (SUCCEEDED(IPropertyStore_GetValue(props, &SDL_PKEY_AudioEngine_DeviceFormat, &var))) { + SDL_memcpy(fmt, var.blob.pBlobData, SDL_min(var.blob.cbSize, sizeof(WAVEFORMATEXTENSIBLE))); + } + PropVariantClear(&var); + if (SUCCEEDED(IPropertyStore_GetValue(props, &SDL_PKEY_AudioEndpoint_GUID, &var))) { + CLSIDFromString(var.pwszVal, guid); + } + PropVariantClear(&var); + IPropertyStore_Release(props); + } +} + +/* This is a list of device id strings we have inflight, so we have consistent pointers to the same device. */ +typedef struct DevIdList +{ + LPWSTR str; + LPGUID guid; + struct DevIdList *next; +} DevIdList; + +static DevIdList *deviceid_list = NULL; + +static void +SDL_IMMDevice_Remove(const SDL_bool iscapture, LPCWSTR devid, SDL_bool useguid) +{ + DevIdList *i; + DevIdList *next; + DevIdList *prev = NULL; + for (i = deviceid_list; i; i = next) { + next = i->next; + if (SDL_wcscmp(i->str, devid) == 0) { + if (prev) { + prev->next = next; + } else { + deviceid_list = next; + } + SDL_RemoveAudioDevice(iscapture, useguid ? ((void *) i->guid) : ((void *) i->str)); + SDL_free(i->str); + SDL_free(i); + } else { + prev = i; + } + } +} + +static void +SDL_IMMDevice_Add(const SDL_bool iscapture, const char *devname, WAVEFORMATEXTENSIBLE *fmt, LPCWSTR devid, GUID *dsoundguid, SDL_bool useguid) +{ + DevIdList *devidlist; + SDL_AudioSpec spec; + LPWSTR devidcopy; + LPGUID cpyguid; + LPVOID driverdata; + + /* You can have multiple endpoints on a device that are mutually exclusive ("Speakers" vs "Line Out" or whatever). + In a perfect world, things that are unplugged won't be in this collection. The only gotcha is probably for + phones and tablets, where you might have an internal speaker and a headphone jack and expect both to be + available and switch automatically. (!!! FIXME...?) */ + + /* see if we already have this one. */ + for (devidlist = deviceid_list; devidlist; devidlist = devidlist->next) { + if (SDL_wcscmp(devidlist->str, devid) == 0) { + return; /* we already have this. */ + } + } + + devidlist = (DevIdList *)SDL_malloc(sizeof(*devidlist)); + if (!devidlist) { + return; /* oh well. */ + } + + devidcopy = SDL_wcsdup(devid); + if (!devidcopy) { + SDL_free(devidlist); + return; /* oh well. */ + } + + if (useguid) { + /* This is freed by DSOUND_FreeDeviceData! */ + cpyguid = (LPGUID)SDL_malloc(sizeof(GUID)); + if (!cpyguid) { + SDL_free(devidlist); + SDL_free(devidcopy); + return; /* oh well. */ + } + SDL_memcpy(cpyguid, dsoundguid, sizeof(GUID)); + driverdata = cpyguid; + } else { + cpyguid = NULL; + driverdata = devidcopy; + } + + devidlist->str = devidcopy; + devidlist->guid = cpyguid; + devidlist->next = deviceid_list; + deviceid_list = devidlist; + + SDL_zero(spec); + spec.channels = (Uint8)fmt->Format.nChannels; + spec.freq = fmt->Format.nSamplesPerSec; + spec.format = WaveFormatToSDLFormat((WAVEFORMATEX *)fmt); + SDL_AddAudioDevice(iscapture, devname, &spec, driverdata); +} + +/* We need a COM subclass of IMMNotificationClient for hotplug support, which is + easy in C++, but we have to tapdance more to make work in C. + Thanks to this page for coaching on how to make this work: + https://www.codeproject.com/Articles/13601/COM-in-plain-C */ + +typedef struct SDLMMNotificationClient +{ + const IMMNotificationClientVtbl *lpVtbl; + SDL_atomic_t refcount; + SDL_bool useguid; +} SDLMMNotificationClient; + +static HRESULT STDMETHODCALLTYPE +SDLMMNotificationClient_QueryInterface(IMMNotificationClient *this, REFIID iid, void **ppv) +{ + if ((WIN_IsEqualIID(iid, &IID_IUnknown)) || (WIN_IsEqualIID(iid, &SDL_IID_IMMNotificationClient))) { + *ppv = this; + this->lpVtbl->AddRef(this); + return S_OK; + } + + *ppv = NULL; + return E_NOINTERFACE; +} + +static ULONG STDMETHODCALLTYPE +SDLMMNotificationClient_AddRef(IMMNotificationClient *ithis) +{ + SDLMMNotificationClient *this = (SDLMMNotificationClient *)ithis; + return (ULONG)(SDL_AtomicIncRef(&this->refcount) + 1); +} + +static ULONG STDMETHODCALLTYPE +SDLMMNotificationClient_Release(IMMNotificationClient *ithis) +{ + /* this is a static object; we don't ever free it. */ + SDLMMNotificationClient *this = (SDLMMNotificationClient *)ithis; + const ULONG retval = SDL_AtomicDecRef(&this->refcount); + if (retval == 0) { + SDL_AtomicSet(&this->refcount, 0); /* uhh... */ + return 0; + } + return retval - 1; +} + +/* These are the entry points called when WASAPI device endpoints change. */ +static HRESULT STDMETHODCALLTYPE +SDLMMNotificationClient_OnDefaultDeviceChanged(IMMNotificationClient *ithis, EDataFlow flow, ERole role, LPCWSTR pwstrDeviceId) +{ + if (role != SDL_IMMDevice_role) { + return S_OK; /* ignore it. */ + } + + /* Increment the "generation," so opened devices will pick this up in their threads. */ + switch (flow) { + case eRender: + SDL_AtomicAdd(&SDL_IMMDevice_DefaultPlaybackGeneration, 1); + break; + + case eCapture: + SDL_AtomicAdd(&SDL_IMMDevice_DefaultCaptureGeneration, 1); + break; + + case eAll: + SDL_AtomicAdd(&SDL_IMMDevice_DefaultPlaybackGeneration, 1); + SDL_AtomicAdd(&SDL_IMMDevice_DefaultCaptureGeneration, 1); + break; + + default: + SDL_assert(!"uhoh, unexpected OnDefaultDeviceChange flow!"); + break; + } + + return S_OK; +} + +static HRESULT STDMETHODCALLTYPE +SDLMMNotificationClient_OnDeviceAdded(IMMNotificationClient *ithis, LPCWSTR pwstrDeviceId) +{ + /* we ignore this; devices added here then progress to ACTIVE, if appropriate, in + OnDeviceStateChange, making that a better place to deal with device adds. More + importantly: the first time you plug in a USB audio device, this callback will + fire, but when you unplug it, it isn't removed (it's state changes to NOTPRESENT). + Plugging it back in won't fire this callback again. */ + return S_OK; +} + +static HRESULT STDMETHODCALLTYPE +SDLMMNotificationClient_OnDeviceRemoved(IMMNotificationClient *ithis, LPCWSTR pwstrDeviceId) +{ + /* See notes in OnDeviceAdded handler about why we ignore this. */ + return S_OK; +} + +static HRESULT STDMETHODCALLTYPE +SDLMMNotificationClient_OnDeviceStateChanged(IMMNotificationClient *ithis, LPCWSTR pwstrDeviceId, DWORD dwNewState) +{ + IMMDevice *device = NULL; + + if (SUCCEEDED(IMMDeviceEnumerator_GetDevice(enumerator, pwstrDeviceId, &device))) { + IMMEndpoint *endpoint = NULL; + if (SUCCEEDED(IMMDevice_QueryInterface(device, &SDL_IID_IMMEndpoint, (void **)&endpoint))) { + EDataFlow flow; + if (SUCCEEDED(IMMEndpoint_GetDataFlow(endpoint, &flow))) { + const SDL_bool iscapture = (flow == eCapture); + const SDLMMNotificationClient *client = (SDLMMNotificationClient*) ithis; + if (dwNewState == DEVICE_STATE_ACTIVE) { + char *utf8dev; + WAVEFORMATEXTENSIBLE fmt; + GUID dsoundguid; + GetMMDeviceInfo(device, &utf8dev, &fmt, &dsoundguid); + if (utf8dev) { + SDL_IMMDevice_Add(iscapture, utf8dev, &fmt, pwstrDeviceId, &dsoundguid, client->useguid); + SDL_free(utf8dev); + } + } else { + SDL_IMMDevice_Remove(iscapture, pwstrDeviceId, client->useguid); + } + } + IMMEndpoint_Release(endpoint); + } + IMMDevice_Release(device); + } + + return S_OK; +} + +static HRESULT STDMETHODCALLTYPE +SDLMMNotificationClient_OnPropertyValueChanged(IMMNotificationClient *this, LPCWSTR pwstrDeviceId, const PROPERTYKEY key) +{ + return S_OK; /* we don't care about these. */ +} + +static const IMMNotificationClientVtbl notification_client_vtbl = { + SDLMMNotificationClient_QueryInterface, + SDLMMNotificationClient_AddRef, + SDLMMNotificationClient_Release, + SDLMMNotificationClient_OnDeviceStateChanged, + SDLMMNotificationClient_OnDeviceAdded, + SDLMMNotificationClient_OnDeviceRemoved, + SDLMMNotificationClient_OnDefaultDeviceChanged, + SDLMMNotificationClient_OnPropertyValueChanged +}; + +static SDLMMNotificationClient notification_client = { ¬ification_client_vtbl, { 1 } }; + +int +SDL_IMMDevice_Init(void) +{ + HRESULT ret; + + SDL_AtomicSet(&SDL_IMMDevice_DefaultPlaybackGeneration, 1); + SDL_AtomicSet(&SDL_IMMDevice_DefaultCaptureGeneration, 1); + + /* just skip the discussion with COM here. */ + if (!WIN_IsWindowsVistaOrGreater()) { + return SDL_SetError("WASAPI support requires Windows Vista or later"); + } + + if (FAILED(WIN_CoInitialize())) { + return SDL_SetError("WASAPI: CoInitialize() failed"); + } + + ret = CoCreateInstance(&SDL_CLSID_MMDeviceEnumerator, NULL, CLSCTX_INPROC_SERVER, &SDL_IID_IMMDeviceEnumerator, (LPVOID *)&enumerator); + if (FAILED(ret)) { + WIN_CoUninitialize(); + return WIN_SetErrorFromHRESULT("WASAPI CoCreateInstance(MMDeviceEnumerator)", ret); + } + return 0; +} + +void +SDL_IMMDevice_Quit(void) +{ + DevIdList *devidlist; + DevIdList *next; + + if (enumerator) { + IMMDeviceEnumerator_UnregisterEndpointNotificationCallback(enumerator, (IMMNotificationClient *)¬ification_client); + IMMDeviceEnumerator_Release(enumerator); + enumerator = NULL; + } + + WIN_CoUninitialize(); + + for (devidlist = deviceid_list; devidlist; devidlist = next) { + next = devidlist->next; + SDL_free(devidlist->str); + SDL_free(devidlist); + } + deviceid_list = NULL; +} + +int +SDL_IMMDevice_Get(LPCWSTR devid, IMMDevice **device, SDL_bool iscapture) +{ + HRESULT ret; + + SDL_assert(device != NULL); + + if (devid == NULL) { + const EDataFlow dataflow = iscapture ? eCapture : eRender; + ret = IMMDeviceEnumerator_GetDefaultAudioEndpoint(enumerator, dataflow, SDL_IMMDevice_role, device); + } else { + ret = IMMDeviceEnumerator_GetDevice(enumerator, devid, device); + } + + if (FAILED(ret)) { + SDL_assert(*device == NULL); + return WIN_SetErrorFromHRESULT("WASAPI can't find requested audio endpoint", ret); + } + return 0; +} + +typedef struct +{ + LPWSTR devid; + char *devname; + WAVEFORMATEXTENSIBLE fmt; + GUID dsoundguid; +} EndpointItem; + +static int SDLCALL sort_endpoints(const void *_a, const void *_b) +{ + LPWSTR a = ((const EndpointItem *)_a)->devid; + LPWSTR b = ((const EndpointItem *)_b)->devid; + if (!a && b) { + return -1; + } else if (a && !b) { + return 1; + } + + while (SDL_TRUE) { + if (*a < *b) { + return -1; + } else if (*a > *b) { + return 1; + } else if (*a == 0) { + break; + } + a++; + b++; + } + + return 0; +} + +static void +EnumerateEndpointsForFlow(const SDL_bool iscapture) +{ + IMMDeviceCollection *collection = NULL; + EndpointItem *items; + UINT i, total; + + /* Note that WASAPI separates "adapter devices" from "audio endpoint devices" + ...one adapter device ("SoundBlaster Pro") might have multiple endpoint devices ("Speakers", "Line-Out"). */ + + if (FAILED(IMMDeviceEnumerator_EnumAudioEndpoints(enumerator, iscapture ? eCapture : eRender, DEVICE_STATE_ACTIVE, &collection))) { + return; + } + + if (FAILED(IMMDeviceCollection_GetCount(collection, &total))) { + IMMDeviceCollection_Release(collection); + return; + } + + items = (EndpointItem *)SDL_calloc(total, sizeof(EndpointItem)); + if (!items) { + return; /* oh well. */ + } + + for (i = 0; i < total; i++) { + EndpointItem *item = items + i; + IMMDevice *device = NULL; + if (SUCCEEDED(IMMDeviceCollection_Item(collection, i, &device))) { + if (SUCCEEDED(IMMDevice_GetId(device, &item->devid))) { + GetMMDeviceInfo(device, &item->devname, &item->fmt, &item->dsoundguid); + } + IMMDevice_Release(device); + } + } + + /* sort the list of devices by their guid so list is consistent between runs */ + SDL_qsort(items, total, sizeof(*items), sort_endpoints); + + /* Send the sorted list on to the SDL's higher level. */ + for (i = 0; i < total; i++) { + EndpointItem *item = items + i; + if ((item->devid) && (item->devname)) { + SDL_IMMDevice_Add(iscapture, item->devname, &item->fmt, item->devid, &item->dsoundguid, notification_client.useguid); + } + SDL_free(item->devname); + CoTaskMemFree(item->devid); + } + + SDL_free(items); + IMMDeviceCollection_Release(collection); +} + +void +SDL_IMMDevice_EnumerateEndpoints(SDL_bool useguid) +{ + notification_client.useguid = useguid; + + EnumerateEndpointsForFlow(SDL_FALSE); /* playback */ + EnumerateEndpointsForFlow(SDL_TRUE); /* capture */ + + /* if this fails, we just won't get hotplug events. Carry on anyhow. */ + IMMDeviceEnumerator_RegisterEndpointNotificationCallback(enumerator, (IMMNotificationClient *)¬ification_client); +} + +int +SDL_IMMDevice_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int iscapture) +{ + WAVEFORMATEXTENSIBLE fmt; + IMMDevice *device = NULL; + char *filler; + GUID morefiller; + const EDataFlow dataflow = iscapture ? eCapture : eRender; + HRESULT ret = IMMDeviceEnumerator_GetDefaultAudioEndpoint(enumerator, dataflow, SDL_IMMDevice_role, &device); + + if (FAILED(ret)) { + SDL_assert(device == NULL); + return WIN_SetErrorFromHRESULT("WASAPI can't find default audio endpoint", ret); + } + + if (name == NULL) { + name = &filler; + } + + SDL_zero(fmt); + GetMMDeviceInfo(device, name, &fmt, &morefiller); + IMMDevice_Release(device); + + if (name == &filler) { + SDL_free(filler); + } + + SDL_zerop(spec); + spec->channels = (Uint8)fmt.Format.nChannels; + spec->freq = fmt.Format.nSamplesPerSec; + spec->format = WaveFormatToSDLFormat((WAVEFORMATEX *) &fmt); + return 0; +} + +SDL_AudioFormat +WaveFormatToSDLFormat(WAVEFORMATEX *waveformat) +{ + if ((waveformat->wFormatTag == WAVE_FORMAT_IEEE_FLOAT) && (waveformat->wBitsPerSample == 32)) { + return AUDIO_F32SYS; + } else if ((waveformat->wFormatTag == WAVE_FORMAT_PCM) && (waveformat->wBitsPerSample == 16)) { + return AUDIO_S16SYS; + } else if ((waveformat->wFormatTag == WAVE_FORMAT_PCM) && (waveformat->wBitsPerSample == 32)) { + return AUDIO_S32SYS; + } else if (waveformat->wFormatTag == WAVE_FORMAT_EXTENSIBLE) { + const WAVEFORMATEXTENSIBLE *ext = (const WAVEFORMATEXTENSIBLE *)waveformat; + if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, sizeof(GUID)) == 0) && (waveformat->wBitsPerSample == 32)) { + return AUDIO_F32SYS; + } else if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_PCM, sizeof(GUID)) == 0) && (waveformat->wBitsPerSample == 16)) { + return AUDIO_S16SYS; + } else if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_PCM, sizeof(GUID)) == 0) && (waveformat->wBitsPerSample == 32)) { + return AUDIO_S32SYS; + } + } + return 0; +} + +#endif /* (defined(__WIN32__) || defined(__GDK__)) && HAVE_MMDEVICEAPI_H */ diff -Nru libsdl2-2.0.22+dfsg/src/core/windows/SDL_immdevice.h libsdl2-2.24.0+dfsg/src/core/windows/SDL_immdevice.h --- libsdl2-2.0.22+dfsg/src/core/windows/SDL_immdevice.h 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/core/windows/SDL_immdevice.h 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,44 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_IMMDEVICE_H +#define SDL_IMMDEVICE_H + +#include "SDL_atomic.h" +#include "SDL_audio.h" + +#define COBJMACROS +#include +#include + +int SDL_IMMDevice_Init(void); +void SDL_IMMDevice_Quit(void); +int SDL_IMMDevice_Get(LPCWSTR devid, IMMDevice **device, SDL_bool iscapture); +void SDL_IMMDevice_EnumerateEndpoints(SDL_bool useguid); +int SDL_IMMDevice_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int iscapture); + +SDL_AudioFormat WaveFormatToSDLFormat(WAVEFORMATEX *waveformat); + +/* these increment as default devices change. Opened default devices pick up changes in their threads. */ +extern SDL_atomic_t SDL_IMMDevice_DefaultPlaybackGeneration; +extern SDL_atomic_t SDL_IMMDevice_DefaultCaptureGeneration; + +#endif /* SDL_IMMDEVICE_H */ diff -Nru libsdl2-2.0.22+dfsg/src/core/windows/SDL_windows.c libsdl2-2.24.0+dfsg/src/core/windows/SDL_windows.c --- libsdl2-2.0.22+dfsg/src/core/windows/SDL_windows.c 2022-04-21 17:37:37.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/core/windows/SDL_windows.c 2022-08-13 03:48:10.000000000 +0000 @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if defined(__WIN32__) || defined(__WINRT__) +#if defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__) #include "SDL_windows.h" #include "SDL_error.h" @@ -96,6 +96,9 @@ attribute, which, AFAIK, should initialize COM. */ return S_OK; +#elif defined(__XBOXONE__) || defined(__XBOXSERIES__) + /* On Xbox, there's no need to call CoInitializeEx (and it's not implemented) */ + return S_OK; #else HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); if (hr == RPC_E_CHANGED_MODE) { @@ -179,7 +182,7 @@ #endif } -#ifndef __WINRT__ +#if !defined(__WINRT__) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) static BOOL IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor) { @@ -203,7 +206,7 @@ BOOL WIN_IsWindowsVistaOrGreater(void) { -#ifdef __WINRT__ +#if defined(__WINRT__) || defined(__XBOXONE__) || defined(__XBOXSERIES__) return TRUE; #else return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 0); @@ -212,7 +215,7 @@ BOOL WIN_IsWindows7OrGreater(void) { -#ifdef __WINRT__ +#if defined(__WINRT__) || defined(__XBOXONE__) || defined(__XBOXSERIES__) return TRUE; #else return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN7), LOBYTE(_WIN32_WINNT_WIN7), 0); @@ -221,7 +224,7 @@ BOOL WIN_IsWindows8OrGreater(void) { -#ifdef __WINRT__ +#if defined(__WINRT__) || defined(__XBOXONE__) || defined(__XBOXSERIES__) return TRUE; #else return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN8), LOBYTE(_WIN32_WINNT_WIN8), 0); @@ -252,8 +255,8 @@ char * WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid) { -#if __WINRT__ - return WIN_StringToUTF8(name); /* No registry access on WinRT/UWP, go with what we've got. */ +#if defined(__WINRT__) || defined(__XBOXONE__) || defined(__XBOXSERIES__) + return WIN_StringToUTF8(name); /* No registry access on WinRT/UWP and Xbox, go with what we've got. */ #else static const GUID nullguid = { 0 }; const unsigned char *ptr; @@ -338,6 +341,6 @@ winrect->bottom = sdlrect->y + sdlrect->h - 1; } -#endif /* __WIN32__ || __WINRT__ */ +#endif /* defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__) */ /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/core/windows/SDL_windows.h libsdl2-2.24.0+dfsg/src/core/windows/SDL_windows.h --- libsdl2-2.0.22+dfsg/src/core/windows/SDL_windows.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/core/windows/SDL_windows.h 2022-08-13 03:48:10.000000000 +0000 @@ -30,9 +30,41 @@ #ifndef UNICODE #define UNICODE 1 #endif +#undef WINVER #undef _WIN32_WINNT +#if defined(SDL_VIDEO_RENDER_D3D12) +#define _WIN32_WINNT 0xA00 /* For D3D12, 0xA00 is required */ +#elif defined(HAVE_SHELLSCALINGAPI_H) +#define _WIN32_WINNT 0x603 /* For DPI support */ +#else #define _WIN32_WINNT 0x501 /* Need 0x410 for AlphaBlend() and 0x500 for EnumDisplayDevices(), 0x501 for raw input */ #endif +#define WINVER _WIN32_WINNT +#elif defined(__WINGDK__) +#define WIN32_LEAN_AND_MEAN +#define STRICT +#ifndef UNICODE +#define UNICODE 1 +#endif +#undef WINVER +#undef _WIN32_WINNT +#define _WIN32_WINNT 0xA00 +#define WINVER _WIN32_WINNT +#elif defined(__XBOXONE__) || defined(__XBOXSERIES__) +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#ifndef STRICT +#define STRICT +#endif +#ifndef UNICODE +#define UNICODE 1 +#endif +#undef WINVER +#undef _WIN32_WINNT +#define _WIN32_WINNT 0xA00 +#define WINVER _WIN32_WINNT +#endif #include #include /* for REFIID with broken mingw.org headers */ @@ -57,6 +89,11 @@ #define SDL_tcsstr SDL_strstr #endif +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + /* Sets an error message based on a given HRESULT */ extern int WIN_SetErrorFromHRESULT(const char *prefix, HRESULT hr); @@ -96,6 +133,11 @@ extern void WIN_RECTToRect(const RECT *winrect, SDL_Rect *sdlrect); extern void WIN_RectToRECT(const SDL_Rect *sdlrect, RECT *winrect); +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif + #endif /* _INCLUDED_WINDOWS_H */ /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/core/windows/SDL_xinput.c libsdl2-2.24.0+dfsg/src/core/windows/SDL_xinput.c --- libsdl2-2.0.22+dfsg/src/core/windows/SDL_xinput.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/core/windows/SDL_xinput.c 2022-08-13 03:48:10.000000000 +0000 @@ -22,8 +22,10 @@ #include "SDL_xinput.h" - -#ifdef HAVE_XINPUT_H +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif XInputGetState_t SDL_XInputGetState = NULL; XInputSetState_t SDL_XInputSetState = NULL; @@ -35,7 +37,7 @@ static int s_XInputDLLRefCount = 0; -#ifdef __WINRT__ +#if defined(__WINRT__) || defined(__XBOXONE__) || defined(__XBOXSERIES__) int WIN_LoadXInputDLL(void) @@ -68,7 +70,7 @@ { } -#else /* !__WINRT__ */ +#else /* !(defined(__WINRT__) || defined(__XBOXONE__) || defined(__XBOXSERIES__)) */ int WIN_LoadXInputDLL(void) @@ -137,6 +139,10 @@ } #endif /* __WINRT__ */ -#endif /* HAVE_XINPUT_H */ + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/core/windows/SDL_xinput.h libsdl2-2.24.0+dfsg/src/core/windows/SDL_xinput.h --- libsdl2-2.0.22+dfsg/src/core/windows/SDL_xinput.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/core/windows/SDL_xinput.h 2022-08-13 03:48:10.000000000 +0000 @@ -23,10 +23,17 @@ #ifndef SDL_xinput_h_ #define SDL_xinput_h_ -#ifdef HAVE_XINPUT_H - #include "SDL_windows.h" + +#ifdef HAVE_XINPUT_H +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) +/* Xbox supports an XInput wrapper which is a C++-only header... */ +#include +using namespace XInputOnGameInput; +#else #include +#endif +#endif /* HAVE_XINPUT_H */ #ifndef XUSER_MAX_COUNT #define XUSER_MAX_COUNT 4 @@ -72,6 +79,53 @@ #define XINPUT_DEVSUBTYPE_ARCADE_PAD 0x13 #endif +#ifndef XINPUT_FLAG_GAMEPAD +#define XINPUT_FLAG_GAMEPAD 0x01 +#endif + +#ifndef XINPUT_GAMEPAD_DPAD_UP +#define XINPUT_GAMEPAD_DPAD_UP 0x0001 +#endif +#ifndef XINPUT_GAMEPAD_DPAD_DOWN +#define XINPUT_GAMEPAD_DPAD_DOWN 0x0002 +#endif +#ifndef XINPUT_GAMEPAD_DPAD_LEFT +#define XINPUT_GAMEPAD_DPAD_LEFT 0x0004 +#endif +#ifndef XINPUT_GAMEPAD_DPAD_RIGHT +#define XINPUT_GAMEPAD_DPAD_RIGHT 0x0008 +#endif +#ifndef XINPUT_GAMEPAD_START +#define XINPUT_GAMEPAD_START 0x0010 +#endif +#ifndef XINPUT_GAMEPAD_BACK +#define XINPUT_GAMEPAD_BACK 0x0020 +#endif +#ifndef XINPUT_GAMEPAD_LEFT_THUMB +#define XINPUT_GAMEPAD_LEFT_THUMB 0x0040 +#endif +#ifndef XINPUT_GAMEPAD_RIGHT_THUMB +#define XINPUT_GAMEPAD_RIGHT_THUMB 0x0080 +#endif +#ifndef XINPUT_GAMEPAD_LEFT_SHOULDER +#define XINPUT_GAMEPAD_LEFT_SHOULDER 0x0100 +#endif +#ifndef XINPUT_GAMEPAD_RIGHT_SHOULDER +#define XINPUT_GAMEPAD_RIGHT_SHOULDER 0x0200 +#endif +#ifndef XINPUT_GAMEPAD_A +#define XINPUT_GAMEPAD_A 0x1000 +#endif +#ifndef XINPUT_GAMEPAD_B +#define XINPUT_GAMEPAD_B 0x2000 +#endif +#ifndef XINPUT_GAMEPAD_X +#define XINPUT_GAMEPAD_X 0x4000 +#endif +#ifndef XINPUT_GAMEPAD_Y +#define XINPUT_GAMEPAD_Y 0x8000 +#endif + #ifndef XINPUT_GAMEPAD_GUIDE #define XINPUT_GAMEPAD_GUIDE 0x0400 #endif @@ -99,6 +153,11 @@ #define BATTERY_LEVEL_FULL 0x03 #endif +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + /* typedef's for XInput structs we use */ #ifndef HAVE_XINPUT_GAMEPAD_EX @@ -129,6 +188,36 @@ BYTE BatteryLevel; } XINPUT_BATTERY_INFORMATION_EX; +#ifndef HAVE_XINPUT_H + +typedef struct +{ + WORD wButtons; + BYTE bLeftTrigger; + BYTE bRightTrigger; + SHORT sThumbLX; + SHORT sThumbLY; + SHORT sThumbRX; + SHORT sThumbRY; +} XINPUT_GAMEPAD; + +typedef struct +{ + WORD wLeftMotorSpeed; + WORD wRightMotorSpeed; +} XINPUT_VIBRATION; + +typedef struct +{ + BYTE Type; + BYTE SubType; + WORD Flags; + XINPUT_GAMEPAD Gamepad; + XINPUT_VIBRATION Vibration; +} XINPUT_CAPABILITIES; + +#endif /* HAVE_XINPUT_H */ + /* Forward decl's for XInput API's we load dynamically and use if available */ typedef DWORD (WINAPI *XInputGetState_t) ( @@ -165,13 +254,16 @@ extern XInputGetBatteryInformation_t SDL_XInputGetBatteryInformation; extern DWORD SDL_XInputVersion; /* ((major << 16) & 0xFF00) | (minor & 0xFF) */ +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif + #define XINPUTGETSTATE SDL_XInputGetState #define XINPUTSETSTATE SDL_XInputSetState #define XINPUTGETCAPABILITIES SDL_XInputGetCapabilities #define XINPUTGETBATTERYINFORMATION SDL_XInputGetBatteryInformation -#endif /* HAVE_XINPUT_H */ - #endif /* SDL_xinput_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/cpuinfo/SDL_cpuinfo.c libsdl2-2.24.0+dfsg/src/cpuinfo/SDL_cpuinfo.c --- libsdl2-2.0.22+dfsg/src/cpuinfo/SDL_cpuinfo.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/cpuinfo/SDL_cpuinfo.c 2022-08-13 03:48:10.000000000 +0000 @@ -24,7 +24,7 @@ #include "../SDL_internal.h" #endif -#if defined(__WIN32__) || defined(__WINRT__) +#if defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__) #include "../core/windows/SDL_windows.h" #endif #if defined(__OS2__) @@ -51,7 +51,7 @@ #if defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__)) #include /* For AltiVec check */ #elif defined(__OpenBSD__) && defined(__powerpc__) -#include +#include #include /* For AltiVec check */ #include #elif defined(__FreeBSD__) && defined(__powerpc__) @@ -98,6 +98,10 @@ #include #endif +#ifdef __PS2__ +#include +#endif + #define CPU_HAS_RDTSC (1 << 0) #define CPU_HAS_ALTIVEC (1 << 1) #define CPU_HAS_MMX (1 << 2) @@ -112,6 +116,12 @@ #define CPU_HAS_NEON (1 << 11) #define CPU_HAS_AVX512F (1 << 12) #define CPU_HAS_ARM_SIMD (1 << 13) +#define CPU_HAS_LSX (1 << 14) +#define CPU_HAS_LASX (1 << 15) + +#define CPU_CFG2 0x2 +#define CPU_CFG2_LSX (1 << 6) +#define CPU_CFG2_LASX (1 << 7) #if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP && !__MACOSX__ && !__OpenBSD__ && !__FreeBSD__ /* This is the brute force way of detecting instruction sets... @@ -130,7 +140,7 @@ { int has_CPUID = 0; -/* *INDENT-OFF* */ +/* *INDENT-OFF* */ /* clang-format off */ #ifndef SDL_CPUINFO_DISABLED #if (defined(__GNUC__) || defined(__llvm__)) && defined(__i386__) __asm__ ( @@ -219,7 +229,7 @@ ); #endif #endif -/* *INDENT-ON* */ +/* *INDENT-ON* */ /* clang-format on */ return has_CPUID; } @@ -446,7 +456,7 @@ query the OS kernel in a platform-specific way. :/ */ #if defined(SDL_CPUINFO_DISABLED) return 0; /* disabled */ -#elif (defined(__WINDOWS__) || defined(__WINRT__)) && (defined(_M_ARM) || defined(_M_ARM64)) +#elif (defined(__WINDOWS__) || defined(__WINRT__) || defined(__GDK__)) && (defined(_M_ARM) || defined(_M_ARM64)) /* Visual Studio, for ARM, doesn't define __ARM_ARCH. Handle this first. */ /* Seems to have been removed */ # if !defined(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE) @@ -508,6 +518,23 @@ #endif } +static int +CPU_readCPUCFG(void) +{ + uint32_t cfg2 = 0; +#if defined __loongarch__ + __asm__ volatile( + "cpucfg %0, %1 \n\t" + : "+&r"(cfg2) + : "r"(CPU_CFG2) + ); +#endif + return cfg2; +} + +#define CPU_haveLSX() (CPU_readCPUCFG() & CPU_CFG2_LSX) +#define CPU_haveLASX() (CPU_readCPUCFG() & CPU_CFG2_LASX) + #if defined(__e2k__) inline int CPU_have3DNow(void) @@ -644,7 +671,7 @@ sysctlbyname("hw.ncpu", &SDL_CPUCount, &size, NULL, 0); } #endif -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__GDK__) if (SDL_CPUCount <= 0) { SYSTEM_INFO info; GetSystemInfo(&info); @@ -885,6 +912,14 @@ SDL_CPUFeatures |= CPU_HAS_NEON; SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 16); } + if (CPU_haveLSX()) { + SDL_CPUFeatures |= CPU_HAS_LSX; + SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 16); + } + if (CPU_haveLASX()) { + SDL_CPUFeatures |= CPU_HAS_LASX; + SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 32); + } } return SDL_CPUFeatures; } @@ -974,6 +1009,18 @@ return CPU_FEATURE_AVAILABLE(CPU_HAS_NEON); } +SDL_bool +SDL_HasLSX(void) +{ + return CPU_FEATURE_AVAILABLE(CPU_HAS_LSX); +} + +SDL_bool +SDL_HasLASX(void) +{ + return CPU_FEATURE_AVAILABLE(CPU_HAS_LASX); +} + static int SDL_SystemRAM = 0; int @@ -1006,7 +1053,7 @@ } } #endif -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__GDK__) if (SDL_SystemRAM <= 0) { MEMORYSTATUSEX stat; stat.dwLength = sizeof(stat); @@ -1038,6 +1085,12 @@ SDL_SystemRAM = 536870912; } #endif +#ifdef __PS2__ + if (SDL_SystemRAM <= 0) { + /* PlayStation 2 has 32MiB however there are some special models with 64 and 128 */ + SDL_SystemRAM = GetMemorySize(); + } +#endif #endif } return SDL_SystemRAM; @@ -1058,10 +1111,18 @@ SDL_SIMDAlloc(const size_t len) { const size_t alignment = SDL_SIMDGetAlignment(); - const size_t padding = alignment - (len % alignment); - const size_t padded = (padding != alignment) ? (len + padding) : len; + const size_t padding = (alignment - (len % alignment)) % alignment; Uint8 *retval = NULL; - Uint8 *ptr = (Uint8 *) SDL_malloc(padded + alignment + sizeof (void *)); + Uint8 *ptr; + size_t to_allocate; + + /* alignment + padding + sizeof (void *) is bounded (a few hundred + * bytes max), so no need to check for overflow within that argument */ + if (SDL_size_add_overflow(len, alignment + padding + sizeof (void *), &to_allocate)) { + return NULL; + } + + ptr = (Uint8 *) SDL_malloc(to_allocate); if (ptr) { /* store the actual allocated pointer right before our aligned pointer. */ retval = ptr + sizeof (void *); @@ -1075,12 +1136,18 @@ SDL_SIMDRealloc(void *mem, const size_t len) { const size_t alignment = SDL_SIMDGetAlignment(); - const size_t padding = alignment - (len % alignment); - const size_t padded = (padding != alignment) ? (len + padding) : len; + const size_t padding = (alignment - (len % alignment)) % alignment; Uint8 *retval = (Uint8*) mem; void *oldmem = mem; size_t memdiff = 0, ptrdiff; Uint8 *ptr; + size_t to_allocate; + + /* alignment + padding + sizeof (void *) is bounded (a few hundred + * bytes max), so no need to check for overflow within that argument */ + if (SDL_size_add_overflow(len, alignment + padding + sizeof (void *), &to_allocate)) { + return NULL; + } if (mem) { void **realptr = (void **) mem; @@ -1091,7 +1158,7 @@ memdiff = ((size_t) oldmem) - ((size_t) mem); } - ptr = (Uint8 *) SDL_realloc(mem, padded + alignment + sizeof (void *)); + ptr = (Uint8 *) SDL_realloc(mem, to_allocate); if (ptr == NULL) { return NULL; /* Out of memory, bail! */ @@ -1156,6 +1223,8 @@ printf("AVX-512F: %d\n", SDL_HasAVX512F()); printf("ARM SIMD: %d\n", SDL_HasARMSIMD()); printf("NEON: %d\n", SDL_HasNEON()); + printf("LSX: %d\n", SDL_HasLSX()); + printf("LASX: %d\n", SDL_HasLASX()); printf("RAM: %d MB\n", SDL_GetSystemRAM()); return 0; } diff -Nru libsdl2-2.0.22+dfsg/src/dynapi/gendynapi.pl libsdl2-2.24.0+dfsg/src/dynapi/gendynapi.pl --- libsdl2-2.0.22+dfsg/src/dynapi/gendynapi.pl 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/dynapi/gendynapi.pl 2022-06-02 02:01:57.000000000 +0000 @@ -33,6 +33,7 @@ chdir(dirname(__FILE__) . '/../..'); my $sdl_dynapi_procs_h = "src/dynapi/SDL_dynapi_procs.h"; my $sdl_dynapi_overrides_h = "src/dynapi/SDL_dynapi_overrides.h"; +my $sdl2_exports = "src/dynapi/SDL2.exports"; my %existing = (); if (-f $sdl_dynapi_procs_h) { @@ -47,6 +48,7 @@ open(SDL_DYNAPI_PROCS_H, '>>', $sdl_dynapi_procs_h) or die("Can't open $sdl_dynapi_procs_h: $!\n"); open(SDL_DYNAPI_OVERRIDES_H, '>>', $sdl_dynapi_overrides_h) or die("Can't open $sdl_dynapi_overrides_h: $!\n"); +open(SDL2_EXPORTS, '>>', $sdl2_exports) or die("Can't open $sdl2_exports: $!\n"); opendir(HEADERS, 'include') or die("Can't open include dir: $!\n"); while (my $d = readdir(HEADERS)) { @@ -133,6 +135,7 @@ print("NEW: $decl\n"); print SDL_DYNAPI_PROCS_H "SDL_DYNAPI_PROC($rc,$fn,$paramstr,$argstr,$retstr)\n"; print SDL_DYNAPI_OVERRIDES_H "#define $fn ${fn}_REAL\n"; + print SDL2_EXPORTS "++'_${fn}'.'SDL2.dll'.'${fn}'\n"; } else { print("Failed to parse decl [$decl]!\n"); } @@ -143,5 +146,6 @@ close(SDL_DYNAPI_PROCS_H); close(SDL_DYNAPI_OVERRIDES_H); +close(SDL2_EXPORTS); # vi: set ts=4 sw=4 expandtab: diff -Nru libsdl2-2.0.22+dfsg/src/dynapi/SDL2.exports libsdl2-2.24.0+dfsg/src/dynapi/SDL2.exports --- libsdl2-2.0.22+dfsg/src/dynapi/SDL2.exports 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/dynapi/SDL2.exports 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,860 @@ +# Windows exports file for Watcom +# DO NOT EDIT THIS FILE BY HAND. It is autogenerated by gendynapi.pl. +++'_SDL_DYNAPI_entry'.'SDL2.dll'.'SDL_DYNAPI_entry' +++'_SDL_SetError'.'SDL2.dll'.'SDL_SetError' +++'_SDL_Log'.'SDL2.dll'.'SDL_Log' +++'_SDL_LogVerbose'.'SDL2.dll'.'SDL_LogVerbose' +++'_SDL_LogDebug'.'SDL2.dll'.'SDL_LogDebug' +++'_SDL_LogInfo'.'SDL2.dll'.'SDL_LogInfo' +++'_SDL_LogWarn'.'SDL2.dll'.'SDL_LogWarn' +++'_SDL_LogError'.'SDL2.dll'.'SDL_LogError' +++'_SDL_LogCritical'.'SDL2.dll'.'SDL_LogCritical' +++'_SDL_LogMessage'.'SDL2.dll'.'SDL_LogMessage' +++'_SDL_sscanf'.'SDL2.dll'.'SDL_sscanf' +++'_SDL_snprintf'.'SDL2.dll'.'SDL_snprintf' +++'_SDL_CreateThread'.'SDL2.dll'.'SDL_CreateThread' +++'_SDL_RWFromFP'.'SDL2.dll'.'SDL_RWFromFP' +++'_SDL_RegisterApp'.'SDL2.dll'.'SDL_RegisterApp' +++'_SDL_UnregisterApp'.'SDL2.dll'.'SDL_UnregisterApp' +++'_SDL_Direct3D9GetAdapterIndex'.'SDL2.dll'.'SDL_Direct3D9GetAdapterIndex' +++'_SDL_RenderGetD3D9Device'.'SDL2.dll'.'SDL_RenderGetD3D9Device' +# ++'_SDL_iPhoneSetAnimationCallback'.'SDL2.dll'.'SDL_iPhoneSetAnimationCallback' +# ++'_SDL_iPhoneSetEventPump'.'SDL2.dll'.'SDL_iPhoneSetEventPump' +# ++'_SDL_AndroidGetJNIEnv'.'SDL2.dll'.'SDL_AndroidGetJNIEnv' +# ++'_SDL_AndroidGetActivity'.'SDL2.dll'.'SDL_AndroidGetActivity' +# ++'_SDL_AndroidGetInternalStoragePath'.'SDL2.dll'.'SDL_AndroidGetInternalStoragePath' +# ++'_SDL_AndroidGetExternalStorageState'.'SDL2.dll'.'SDL_AndroidGetExternalStorageState' +# ++'_SDL_AndroidGetExternalStoragePath'.'SDL2.dll'.'SDL_AndroidGetExternalStoragePath' +++'_SDL_Init'.'SDL2.dll'.'SDL_Init' +++'_SDL_InitSubSystem'.'SDL2.dll'.'SDL_InitSubSystem' +++'_SDL_QuitSubSystem'.'SDL2.dll'.'SDL_QuitSubSystem' +++'_SDL_WasInit'.'SDL2.dll'.'SDL_WasInit' +++'_SDL_Quit'.'SDL2.dll'.'SDL_Quit' +++'_SDL_ReportAssertion'.'SDL2.dll'.'SDL_ReportAssertion' +++'_SDL_SetAssertionHandler'.'SDL2.dll'.'SDL_SetAssertionHandler' +++'_SDL_GetAssertionReport'.'SDL2.dll'.'SDL_GetAssertionReport' +++'_SDL_ResetAssertionReport'.'SDL2.dll'.'SDL_ResetAssertionReport' +++'_SDL_AtomicTryLock'.'SDL2.dll'.'SDL_AtomicTryLock' +++'_SDL_AtomicLock'.'SDL2.dll'.'SDL_AtomicLock' +++'_SDL_AtomicUnlock'.'SDL2.dll'.'SDL_AtomicUnlock' +++'_SDL_AtomicCAS'.'SDL2.dll'.'SDL_AtomicCAS' +++'_SDL_AtomicSet'.'SDL2.dll'.'SDL_AtomicSet' +++'_SDL_AtomicGet'.'SDL2.dll'.'SDL_AtomicGet' +++'_SDL_AtomicAdd'.'SDL2.dll'.'SDL_AtomicAdd' +++'_SDL_AtomicCASPtr'.'SDL2.dll'.'SDL_AtomicCASPtr' +++'_SDL_AtomicSetPtr'.'SDL2.dll'.'SDL_AtomicSetPtr' +++'_SDL_AtomicGetPtr'.'SDL2.dll'.'SDL_AtomicGetPtr' +++'_SDL_GetNumAudioDrivers'.'SDL2.dll'.'SDL_GetNumAudioDrivers' +++'_SDL_GetAudioDriver'.'SDL2.dll'.'SDL_GetAudioDriver' +++'_SDL_AudioInit'.'SDL2.dll'.'SDL_AudioInit' +++'_SDL_AudioQuit'.'SDL2.dll'.'SDL_AudioQuit' +++'_SDL_GetCurrentAudioDriver'.'SDL2.dll'.'SDL_GetCurrentAudioDriver' +++'_SDL_OpenAudio'.'SDL2.dll'.'SDL_OpenAudio' +++'_SDL_GetNumAudioDevices'.'SDL2.dll'.'SDL_GetNumAudioDevices' +++'_SDL_GetAudioDeviceName'.'SDL2.dll'.'SDL_GetAudioDeviceName' +++'_SDL_OpenAudioDevice'.'SDL2.dll'.'SDL_OpenAudioDevice' +++'_SDL_GetAudioStatus'.'SDL2.dll'.'SDL_GetAudioStatus' +++'_SDL_GetAudioDeviceStatus'.'SDL2.dll'.'SDL_GetAudioDeviceStatus' +++'_SDL_PauseAudio'.'SDL2.dll'.'SDL_PauseAudio' +++'_SDL_PauseAudioDevice'.'SDL2.dll'.'SDL_PauseAudioDevice' +++'_SDL_LoadWAV_RW'.'SDL2.dll'.'SDL_LoadWAV_RW' +++'_SDL_FreeWAV'.'SDL2.dll'.'SDL_FreeWAV' +++'_SDL_BuildAudioCVT'.'SDL2.dll'.'SDL_BuildAudioCVT' +++'_SDL_ConvertAudio'.'SDL2.dll'.'SDL_ConvertAudio' +++'_SDL_MixAudio'.'SDL2.dll'.'SDL_MixAudio' +++'_SDL_MixAudioFormat'.'SDL2.dll'.'SDL_MixAudioFormat' +++'_SDL_LockAudio'.'SDL2.dll'.'SDL_LockAudio' +++'_SDL_LockAudioDevice'.'SDL2.dll'.'SDL_LockAudioDevice' +++'_SDL_UnlockAudio'.'SDL2.dll'.'SDL_UnlockAudio' +++'_SDL_UnlockAudioDevice'.'SDL2.dll'.'SDL_UnlockAudioDevice' +++'_SDL_CloseAudio'.'SDL2.dll'.'SDL_CloseAudio' +++'_SDL_CloseAudioDevice'.'SDL2.dll'.'SDL_CloseAudioDevice' +++'_SDL_SetClipboardText'.'SDL2.dll'.'SDL_SetClipboardText' +++'_SDL_GetClipboardText'.'SDL2.dll'.'SDL_GetClipboardText' +++'_SDL_HasClipboardText'.'SDL2.dll'.'SDL_HasClipboardText' +++'_SDL_GetCPUCount'.'SDL2.dll'.'SDL_GetCPUCount' +++'_SDL_GetCPUCacheLineSize'.'SDL2.dll'.'SDL_GetCPUCacheLineSize' +++'_SDL_HasRDTSC'.'SDL2.dll'.'SDL_HasRDTSC' +++'_SDL_HasAltiVec'.'SDL2.dll'.'SDL_HasAltiVec' +++'_SDL_HasMMX'.'SDL2.dll'.'SDL_HasMMX' +++'_SDL_Has3DNow'.'SDL2.dll'.'SDL_Has3DNow' +++'_SDL_HasSSE'.'SDL2.dll'.'SDL_HasSSE' +++'_SDL_HasSSE2'.'SDL2.dll'.'SDL_HasSSE2' +++'_SDL_HasSSE3'.'SDL2.dll'.'SDL_HasSSE3' +++'_SDL_HasSSE41'.'SDL2.dll'.'SDL_HasSSE41' +++'_SDL_HasSSE42'.'SDL2.dll'.'SDL_HasSSE42' +++'_SDL_GetSystemRAM'.'SDL2.dll'.'SDL_GetSystemRAM' +++'_SDL_GetError'.'SDL2.dll'.'SDL_GetError' +++'_SDL_ClearError'.'SDL2.dll'.'SDL_ClearError' +++'_SDL_Error'.'SDL2.dll'.'SDL_Error' +++'_SDL_PumpEvents'.'SDL2.dll'.'SDL_PumpEvents' +++'_SDL_PeepEvents'.'SDL2.dll'.'SDL_PeepEvents' +++'_SDL_HasEvent'.'SDL2.dll'.'SDL_HasEvent' +++'_SDL_HasEvents'.'SDL2.dll'.'SDL_HasEvents' +++'_SDL_FlushEvent'.'SDL2.dll'.'SDL_FlushEvent' +++'_SDL_FlushEvents'.'SDL2.dll'.'SDL_FlushEvents' +++'_SDL_PollEvent'.'SDL2.dll'.'SDL_PollEvent' +++'_SDL_WaitEvent'.'SDL2.dll'.'SDL_WaitEvent' +++'_SDL_WaitEventTimeout'.'SDL2.dll'.'SDL_WaitEventTimeout' +++'_SDL_PushEvent'.'SDL2.dll'.'SDL_PushEvent' +++'_SDL_SetEventFilter'.'SDL2.dll'.'SDL_SetEventFilter' +++'_SDL_GetEventFilter'.'SDL2.dll'.'SDL_GetEventFilter' +++'_SDL_AddEventWatch'.'SDL2.dll'.'SDL_AddEventWatch' +++'_SDL_DelEventWatch'.'SDL2.dll'.'SDL_DelEventWatch' +++'_SDL_FilterEvents'.'SDL2.dll'.'SDL_FilterEvents' +++'_SDL_EventState'.'SDL2.dll'.'SDL_EventState' +++'_SDL_RegisterEvents'.'SDL2.dll'.'SDL_RegisterEvents' +++'_SDL_GetBasePath'.'SDL2.dll'.'SDL_GetBasePath' +++'_SDL_GetPrefPath'.'SDL2.dll'.'SDL_GetPrefPath' +++'_SDL_GameControllerAddMapping'.'SDL2.dll'.'SDL_GameControllerAddMapping' +++'_SDL_GameControllerMappingForGUID'.'SDL2.dll'.'SDL_GameControllerMappingForGUID' +++'_SDL_GameControllerMapping'.'SDL2.dll'.'SDL_GameControllerMapping' +++'_SDL_IsGameController'.'SDL2.dll'.'SDL_IsGameController' +++'_SDL_GameControllerNameForIndex'.'SDL2.dll'.'SDL_GameControllerNameForIndex' +++'_SDL_GameControllerOpen'.'SDL2.dll'.'SDL_GameControllerOpen' +++'_SDL_GameControllerName'.'SDL2.dll'.'SDL_GameControllerName' +++'_SDL_GameControllerGetAttached'.'SDL2.dll'.'SDL_GameControllerGetAttached' +++'_SDL_GameControllerGetJoystick'.'SDL2.dll'.'SDL_GameControllerGetJoystick' +++'_SDL_GameControllerEventState'.'SDL2.dll'.'SDL_GameControllerEventState' +++'_SDL_GameControllerUpdate'.'SDL2.dll'.'SDL_GameControllerUpdate' +++'_SDL_GameControllerGetAxisFromString'.'SDL2.dll'.'SDL_GameControllerGetAxisFromString' +++'_SDL_GameControllerGetStringForAxis'.'SDL2.dll'.'SDL_GameControllerGetStringForAxis' +++'_SDL_GameControllerGetBindForAxis'.'SDL2.dll'.'SDL_GameControllerGetBindForAxis' +++'_SDL_GameControllerGetAxis'.'SDL2.dll'.'SDL_GameControllerGetAxis' +++'_SDL_GameControllerGetButtonFromString'.'SDL2.dll'.'SDL_GameControllerGetButtonFromString' +++'_SDL_GameControllerGetStringForButton'.'SDL2.dll'.'SDL_GameControllerGetStringForButton' +++'_SDL_GameControllerGetBindForButton'.'SDL2.dll'.'SDL_GameControllerGetBindForButton' +++'_SDL_GameControllerGetButton'.'SDL2.dll'.'SDL_GameControllerGetButton' +++'_SDL_GameControllerClose'.'SDL2.dll'.'SDL_GameControllerClose' +++'_SDL_RecordGesture'.'SDL2.dll'.'SDL_RecordGesture' +++'_SDL_SaveAllDollarTemplates'.'SDL2.dll'.'SDL_SaveAllDollarTemplates' +++'_SDL_SaveDollarTemplate'.'SDL2.dll'.'SDL_SaveDollarTemplate' +++'_SDL_LoadDollarTemplates'.'SDL2.dll'.'SDL_LoadDollarTemplates' +++'_SDL_NumHaptics'.'SDL2.dll'.'SDL_NumHaptics' +++'_SDL_HapticName'.'SDL2.dll'.'SDL_HapticName' +++'_SDL_HapticOpen'.'SDL2.dll'.'SDL_HapticOpen' +++'_SDL_HapticOpened'.'SDL2.dll'.'SDL_HapticOpened' +++'_SDL_HapticIndex'.'SDL2.dll'.'SDL_HapticIndex' +++'_SDL_MouseIsHaptic'.'SDL2.dll'.'SDL_MouseIsHaptic' +++'_SDL_HapticOpenFromMouse'.'SDL2.dll'.'SDL_HapticOpenFromMouse' +++'_SDL_JoystickIsHaptic'.'SDL2.dll'.'SDL_JoystickIsHaptic' +++'_SDL_HapticOpenFromJoystick'.'SDL2.dll'.'SDL_HapticOpenFromJoystick' +++'_SDL_HapticClose'.'SDL2.dll'.'SDL_HapticClose' +++'_SDL_HapticNumEffects'.'SDL2.dll'.'SDL_HapticNumEffects' +++'_SDL_HapticNumEffectsPlaying'.'SDL2.dll'.'SDL_HapticNumEffectsPlaying' +++'_SDL_HapticQuery'.'SDL2.dll'.'SDL_HapticQuery' +++'_SDL_HapticNumAxes'.'SDL2.dll'.'SDL_HapticNumAxes' +++'_SDL_HapticEffectSupported'.'SDL2.dll'.'SDL_HapticEffectSupported' +++'_SDL_HapticNewEffect'.'SDL2.dll'.'SDL_HapticNewEffect' +++'_SDL_HapticUpdateEffect'.'SDL2.dll'.'SDL_HapticUpdateEffect' +++'_SDL_HapticRunEffect'.'SDL2.dll'.'SDL_HapticRunEffect' +++'_SDL_HapticStopEffect'.'SDL2.dll'.'SDL_HapticStopEffect' +++'_SDL_HapticDestroyEffect'.'SDL2.dll'.'SDL_HapticDestroyEffect' +++'_SDL_HapticGetEffectStatus'.'SDL2.dll'.'SDL_HapticGetEffectStatus' +++'_SDL_HapticSetGain'.'SDL2.dll'.'SDL_HapticSetGain' +++'_SDL_HapticSetAutocenter'.'SDL2.dll'.'SDL_HapticSetAutocenter' +++'_SDL_HapticPause'.'SDL2.dll'.'SDL_HapticPause' +++'_SDL_HapticUnpause'.'SDL2.dll'.'SDL_HapticUnpause' +++'_SDL_HapticStopAll'.'SDL2.dll'.'SDL_HapticStopAll' +++'_SDL_HapticRumbleSupported'.'SDL2.dll'.'SDL_HapticRumbleSupported' +++'_SDL_HapticRumbleInit'.'SDL2.dll'.'SDL_HapticRumbleInit' +++'_SDL_HapticRumblePlay'.'SDL2.dll'.'SDL_HapticRumblePlay' +++'_SDL_HapticRumbleStop'.'SDL2.dll'.'SDL_HapticRumbleStop' +++'_SDL_SetHintWithPriority'.'SDL2.dll'.'SDL_SetHintWithPriority' +++'_SDL_SetHint'.'SDL2.dll'.'SDL_SetHint' +++'_SDL_GetHint'.'SDL2.dll'.'SDL_GetHint' +++'_SDL_AddHintCallback'.'SDL2.dll'.'SDL_AddHintCallback' +++'_SDL_DelHintCallback'.'SDL2.dll'.'SDL_DelHintCallback' +++'_SDL_ClearHints'.'SDL2.dll'.'SDL_ClearHints' +++'_SDL_NumJoysticks'.'SDL2.dll'.'SDL_NumJoysticks' +++'_SDL_JoystickNameForIndex'.'SDL2.dll'.'SDL_JoystickNameForIndex' +++'_SDL_JoystickOpen'.'SDL2.dll'.'SDL_JoystickOpen' +++'_SDL_JoystickName'.'SDL2.dll'.'SDL_JoystickName' +++'_SDL_JoystickGetDeviceGUID'.'SDL2.dll'.'SDL_JoystickGetDeviceGUID' +++'_SDL_JoystickGetGUID'.'SDL2.dll'.'SDL_JoystickGetGUID' +++'_SDL_JoystickGetGUIDString'.'SDL2.dll'.'SDL_JoystickGetGUIDString' +++'_SDL_JoystickGetGUIDFromString'.'SDL2.dll'.'SDL_JoystickGetGUIDFromString' +++'_SDL_JoystickGetAttached'.'SDL2.dll'.'SDL_JoystickGetAttached' +++'_SDL_JoystickInstanceID'.'SDL2.dll'.'SDL_JoystickInstanceID' +++'_SDL_JoystickNumAxes'.'SDL2.dll'.'SDL_JoystickNumAxes' +++'_SDL_JoystickNumBalls'.'SDL2.dll'.'SDL_JoystickNumBalls' +++'_SDL_JoystickNumHats'.'SDL2.dll'.'SDL_JoystickNumHats' +++'_SDL_JoystickNumButtons'.'SDL2.dll'.'SDL_JoystickNumButtons' +++'_SDL_JoystickUpdate'.'SDL2.dll'.'SDL_JoystickUpdate' +++'_SDL_JoystickEventState'.'SDL2.dll'.'SDL_JoystickEventState' +++'_SDL_JoystickGetAxis'.'SDL2.dll'.'SDL_JoystickGetAxis' +++'_SDL_JoystickGetHat'.'SDL2.dll'.'SDL_JoystickGetHat' +++'_SDL_JoystickGetBall'.'SDL2.dll'.'SDL_JoystickGetBall' +++'_SDL_JoystickGetButton'.'SDL2.dll'.'SDL_JoystickGetButton' +++'_SDL_JoystickClose'.'SDL2.dll'.'SDL_JoystickClose' +++'_SDL_GetKeyboardFocus'.'SDL2.dll'.'SDL_GetKeyboardFocus' +++'_SDL_GetKeyboardState'.'SDL2.dll'.'SDL_GetKeyboardState' +++'_SDL_GetModState'.'SDL2.dll'.'SDL_GetModState' +++'_SDL_SetModState'.'SDL2.dll'.'SDL_SetModState' +++'_SDL_GetKeyFromScancode'.'SDL2.dll'.'SDL_GetKeyFromScancode' +++'_SDL_GetScancodeFromKey'.'SDL2.dll'.'SDL_GetScancodeFromKey' +++'_SDL_GetScancodeName'.'SDL2.dll'.'SDL_GetScancodeName' +++'_SDL_GetScancodeFromName'.'SDL2.dll'.'SDL_GetScancodeFromName' +++'_SDL_GetKeyName'.'SDL2.dll'.'SDL_GetKeyName' +++'_SDL_GetKeyFromName'.'SDL2.dll'.'SDL_GetKeyFromName' +++'_SDL_StartTextInput'.'SDL2.dll'.'SDL_StartTextInput' +++'_SDL_IsTextInputActive'.'SDL2.dll'.'SDL_IsTextInputActive' +++'_SDL_StopTextInput'.'SDL2.dll'.'SDL_StopTextInput' +++'_SDL_SetTextInputRect'.'SDL2.dll'.'SDL_SetTextInputRect' +++'_SDL_HasScreenKeyboardSupport'.'SDL2.dll'.'SDL_HasScreenKeyboardSupport' +++'_SDL_IsScreenKeyboardShown'.'SDL2.dll'.'SDL_IsScreenKeyboardShown' +++'_SDL_LoadObject'.'SDL2.dll'.'SDL_LoadObject' +++'_SDL_LoadFunction'.'SDL2.dll'.'SDL_LoadFunction' +++'_SDL_UnloadObject'.'SDL2.dll'.'SDL_UnloadObject' +++'_SDL_LogSetAllPriority'.'SDL2.dll'.'SDL_LogSetAllPriority' +++'_SDL_LogSetPriority'.'SDL2.dll'.'SDL_LogSetPriority' +++'_SDL_LogGetPriority'.'SDL2.dll'.'SDL_LogGetPriority' +++'_SDL_LogResetPriorities'.'SDL2.dll'.'SDL_LogResetPriorities' +++'_SDL_LogMessageV'.'SDL2.dll'.'SDL_LogMessageV' +++'_SDL_LogGetOutputFunction'.'SDL2.dll'.'SDL_LogGetOutputFunction' +++'_SDL_LogSetOutputFunction'.'SDL2.dll'.'SDL_LogSetOutputFunction' +++'_SDL_SetMainReady'.'SDL2.dll'.'SDL_SetMainReady' +++'_SDL_ShowMessageBox'.'SDL2.dll'.'SDL_ShowMessageBox' +++'_SDL_ShowSimpleMessageBox'.'SDL2.dll'.'SDL_ShowSimpleMessageBox' +++'_SDL_GetMouseFocus'.'SDL2.dll'.'SDL_GetMouseFocus' +++'_SDL_GetMouseState'.'SDL2.dll'.'SDL_GetMouseState' +++'_SDL_GetRelativeMouseState'.'SDL2.dll'.'SDL_GetRelativeMouseState' +++'_SDL_WarpMouseInWindow'.'SDL2.dll'.'SDL_WarpMouseInWindow' +++'_SDL_SetRelativeMouseMode'.'SDL2.dll'.'SDL_SetRelativeMouseMode' +++'_SDL_GetRelativeMouseMode'.'SDL2.dll'.'SDL_GetRelativeMouseMode' +++'_SDL_CreateCursor'.'SDL2.dll'.'SDL_CreateCursor' +++'_SDL_CreateColorCursor'.'SDL2.dll'.'SDL_CreateColorCursor' +++'_SDL_CreateSystemCursor'.'SDL2.dll'.'SDL_CreateSystemCursor' +++'_SDL_SetCursor'.'SDL2.dll'.'SDL_SetCursor' +++'_SDL_GetCursor'.'SDL2.dll'.'SDL_GetCursor' +++'_SDL_GetDefaultCursor'.'SDL2.dll'.'SDL_GetDefaultCursor' +++'_SDL_FreeCursor'.'SDL2.dll'.'SDL_FreeCursor' +++'_SDL_ShowCursor'.'SDL2.dll'.'SDL_ShowCursor' +++'_SDL_CreateMutex'.'SDL2.dll'.'SDL_CreateMutex' +++'_SDL_LockMutex'.'SDL2.dll'.'SDL_LockMutex' +++'_SDL_TryLockMutex'.'SDL2.dll'.'SDL_TryLockMutex' +++'_SDL_UnlockMutex'.'SDL2.dll'.'SDL_UnlockMutex' +++'_SDL_DestroyMutex'.'SDL2.dll'.'SDL_DestroyMutex' +++'_SDL_CreateSemaphore'.'SDL2.dll'.'SDL_CreateSemaphore' +++'_SDL_DestroySemaphore'.'SDL2.dll'.'SDL_DestroySemaphore' +++'_SDL_SemWait'.'SDL2.dll'.'SDL_SemWait' +++'_SDL_SemTryWait'.'SDL2.dll'.'SDL_SemTryWait' +++'_SDL_SemWaitTimeout'.'SDL2.dll'.'SDL_SemWaitTimeout' +++'_SDL_SemPost'.'SDL2.dll'.'SDL_SemPost' +++'_SDL_SemValue'.'SDL2.dll'.'SDL_SemValue' +++'_SDL_CreateCond'.'SDL2.dll'.'SDL_CreateCond' +++'_SDL_DestroyCond'.'SDL2.dll'.'SDL_DestroyCond' +++'_SDL_CondSignal'.'SDL2.dll'.'SDL_CondSignal' +++'_SDL_CondBroadcast'.'SDL2.dll'.'SDL_CondBroadcast' +++'_SDL_CondWait'.'SDL2.dll'.'SDL_CondWait' +++'_SDL_CondWaitTimeout'.'SDL2.dll'.'SDL_CondWaitTimeout' +++'_SDL_GetPixelFormatName'.'SDL2.dll'.'SDL_GetPixelFormatName' +++'_SDL_PixelFormatEnumToMasks'.'SDL2.dll'.'SDL_PixelFormatEnumToMasks' +++'_SDL_MasksToPixelFormatEnum'.'SDL2.dll'.'SDL_MasksToPixelFormatEnum' +++'_SDL_AllocFormat'.'SDL2.dll'.'SDL_AllocFormat' +++'_SDL_FreeFormat'.'SDL2.dll'.'SDL_FreeFormat' +++'_SDL_AllocPalette'.'SDL2.dll'.'SDL_AllocPalette' +++'_SDL_SetPixelFormatPalette'.'SDL2.dll'.'SDL_SetPixelFormatPalette' +++'_SDL_SetPaletteColors'.'SDL2.dll'.'SDL_SetPaletteColors' +++'_SDL_FreePalette'.'SDL2.dll'.'SDL_FreePalette' +++'_SDL_MapRGB'.'SDL2.dll'.'SDL_MapRGB' +++'_SDL_MapRGBA'.'SDL2.dll'.'SDL_MapRGBA' +++'_SDL_GetRGB'.'SDL2.dll'.'SDL_GetRGB' +++'_SDL_GetRGBA'.'SDL2.dll'.'SDL_GetRGBA' +++'_SDL_CalculateGammaRamp'.'SDL2.dll'.'SDL_CalculateGammaRamp' +++'_SDL_GetPlatform'.'SDL2.dll'.'SDL_GetPlatform' +++'_SDL_GetPowerInfo'.'SDL2.dll'.'SDL_GetPowerInfo' +++'_SDL_HasIntersection'.'SDL2.dll'.'SDL_HasIntersection' +++'_SDL_IntersectRect'.'SDL2.dll'.'SDL_IntersectRect' +++'_SDL_UnionRect'.'SDL2.dll'.'SDL_UnionRect' +++'_SDL_EnclosePoints'.'SDL2.dll'.'SDL_EnclosePoints' +++'_SDL_IntersectRectAndLine'.'SDL2.dll'.'SDL_IntersectRectAndLine' +++'_SDL_GetNumRenderDrivers'.'SDL2.dll'.'SDL_GetNumRenderDrivers' +++'_SDL_GetRenderDriverInfo'.'SDL2.dll'.'SDL_GetRenderDriverInfo' +++'_SDL_CreateWindowAndRenderer'.'SDL2.dll'.'SDL_CreateWindowAndRenderer' +++'_SDL_CreateRenderer'.'SDL2.dll'.'SDL_CreateRenderer' +++'_SDL_CreateSoftwareRenderer'.'SDL2.dll'.'SDL_CreateSoftwareRenderer' +++'_SDL_GetRenderer'.'SDL2.dll'.'SDL_GetRenderer' +++'_SDL_GetRendererInfo'.'SDL2.dll'.'SDL_GetRendererInfo' +++'_SDL_GetRendererOutputSize'.'SDL2.dll'.'SDL_GetRendererOutputSize' +++'_SDL_CreateTexture'.'SDL2.dll'.'SDL_CreateTexture' +++'_SDL_CreateTextureFromSurface'.'SDL2.dll'.'SDL_CreateTextureFromSurface' +++'_SDL_QueryTexture'.'SDL2.dll'.'SDL_QueryTexture' +++'_SDL_SetTextureColorMod'.'SDL2.dll'.'SDL_SetTextureColorMod' +++'_SDL_GetTextureColorMod'.'SDL2.dll'.'SDL_GetTextureColorMod' +++'_SDL_SetTextureAlphaMod'.'SDL2.dll'.'SDL_SetTextureAlphaMod' +++'_SDL_GetTextureAlphaMod'.'SDL2.dll'.'SDL_GetTextureAlphaMod' +++'_SDL_SetTextureBlendMode'.'SDL2.dll'.'SDL_SetTextureBlendMode' +++'_SDL_GetTextureBlendMode'.'SDL2.dll'.'SDL_GetTextureBlendMode' +++'_SDL_UpdateTexture'.'SDL2.dll'.'SDL_UpdateTexture' +++'_SDL_UpdateYUVTexture'.'SDL2.dll'.'SDL_UpdateYUVTexture' +++'_SDL_LockTexture'.'SDL2.dll'.'SDL_LockTexture' +++'_SDL_UnlockTexture'.'SDL2.dll'.'SDL_UnlockTexture' +++'_SDL_RenderTargetSupported'.'SDL2.dll'.'SDL_RenderTargetSupported' +++'_SDL_SetRenderTarget'.'SDL2.dll'.'SDL_SetRenderTarget' +++'_SDL_GetRenderTarget'.'SDL2.dll'.'SDL_GetRenderTarget' +++'_SDL_RenderSetLogicalSize'.'SDL2.dll'.'SDL_RenderSetLogicalSize' +++'_SDL_RenderGetLogicalSize'.'SDL2.dll'.'SDL_RenderGetLogicalSize' +++'_SDL_RenderSetViewport'.'SDL2.dll'.'SDL_RenderSetViewport' +++'_SDL_RenderGetViewport'.'SDL2.dll'.'SDL_RenderGetViewport' +++'_SDL_RenderSetClipRect'.'SDL2.dll'.'SDL_RenderSetClipRect' +++'_SDL_RenderGetClipRect'.'SDL2.dll'.'SDL_RenderGetClipRect' +++'_SDL_RenderSetScale'.'SDL2.dll'.'SDL_RenderSetScale' +++'_SDL_RenderGetScale'.'SDL2.dll'.'SDL_RenderGetScale' +++'_SDL_SetRenderDrawColor'.'SDL2.dll'.'SDL_SetRenderDrawColor' +++'_SDL_GetRenderDrawColor'.'SDL2.dll'.'SDL_GetRenderDrawColor' +++'_SDL_SetRenderDrawBlendMode'.'SDL2.dll'.'SDL_SetRenderDrawBlendMode' +++'_SDL_GetRenderDrawBlendMode'.'SDL2.dll'.'SDL_GetRenderDrawBlendMode' +++'_SDL_RenderClear'.'SDL2.dll'.'SDL_RenderClear' +++'_SDL_RenderDrawPoint'.'SDL2.dll'.'SDL_RenderDrawPoint' +++'_SDL_RenderDrawPoints'.'SDL2.dll'.'SDL_RenderDrawPoints' +++'_SDL_RenderDrawLine'.'SDL2.dll'.'SDL_RenderDrawLine' +++'_SDL_RenderDrawLines'.'SDL2.dll'.'SDL_RenderDrawLines' +++'_SDL_RenderDrawRect'.'SDL2.dll'.'SDL_RenderDrawRect' +++'_SDL_RenderDrawRects'.'SDL2.dll'.'SDL_RenderDrawRects' +++'_SDL_RenderFillRect'.'SDL2.dll'.'SDL_RenderFillRect' +++'_SDL_RenderFillRects'.'SDL2.dll'.'SDL_RenderFillRects' +++'_SDL_RenderCopy'.'SDL2.dll'.'SDL_RenderCopy' +++'_SDL_RenderCopyEx'.'SDL2.dll'.'SDL_RenderCopyEx' +++'_SDL_RenderReadPixels'.'SDL2.dll'.'SDL_RenderReadPixels' +++'_SDL_RenderPresent'.'SDL2.dll'.'SDL_RenderPresent' +++'_SDL_DestroyTexture'.'SDL2.dll'.'SDL_DestroyTexture' +++'_SDL_DestroyRenderer'.'SDL2.dll'.'SDL_DestroyRenderer' +++'_SDL_GL_BindTexture'.'SDL2.dll'.'SDL_GL_BindTexture' +++'_SDL_GL_UnbindTexture'.'SDL2.dll'.'SDL_GL_UnbindTexture' +++'_SDL_RWFromFile'.'SDL2.dll'.'SDL_RWFromFile' +++'_SDL_RWFromMem'.'SDL2.dll'.'SDL_RWFromMem' +++'_SDL_RWFromConstMem'.'SDL2.dll'.'SDL_RWFromConstMem' +++'_SDL_AllocRW'.'SDL2.dll'.'SDL_AllocRW' +++'_SDL_FreeRW'.'SDL2.dll'.'SDL_FreeRW' +++'_SDL_ReadU8'.'SDL2.dll'.'SDL_ReadU8' +++'_SDL_ReadLE16'.'SDL2.dll'.'SDL_ReadLE16' +++'_SDL_ReadBE16'.'SDL2.dll'.'SDL_ReadBE16' +++'_SDL_ReadLE32'.'SDL2.dll'.'SDL_ReadLE32' +++'_SDL_ReadBE32'.'SDL2.dll'.'SDL_ReadBE32' +++'_SDL_ReadLE64'.'SDL2.dll'.'SDL_ReadLE64' +++'_SDL_ReadBE64'.'SDL2.dll'.'SDL_ReadBE64' +++'_SDL_WriteU8'.'SDL2.dll'.'SDL_WriteU8' +++'_SDL_WriteLE16'.'SDL2.dll'.'SDL_WriteLE16' +++'_SDL_WriteBE16'.'SDL2.dll'.'SDL_WriteBE16' +++'_SDL_WriteLE32'.'SDL2.dll'.'SDL_WriteLE32' +++'_SDL_WriteBE32'.'SDL2.dll'.'SDL_WriteBE32' +++'_SDL_WriteLE64'.'SDL2.dll'.'SDL_WriteLE64' +++'_SDL_WriteBE64'.'SDL2.dll'.'SDL_WriteBE64' +++'_SDL_CreateShapedWindow'.'SDL2.dll'.'SDL_CreateShapedWindow' +++'_SDL_IsShapedWindow'.'SDL2.dll'.'SDL_IsShapedWindow' +++'_SDL_SetWindowShape'.'SDL2.dll'.'SDL_SetWindowShape' +++'_SDL_GetShapedWindowMode'.'SDL2.dll'.'SDL_GetShapedWindowMode' +++'_SDL_malloc'.'SDL2.dll'.'SDL_malloc' +++'_SDL_calloc'.'SDL2.dll'.'SDL_calloc' +++'_SDL_realloc'.'SDL2.dll'.'SDL_realloc' +++'_SDL_free'.'SDL2.dll'.'SDL_free' +++'_SDL_getenv'.'SDL2.dll'.'SDL_getenv' +++'_SDL_setenv'.'SDL2.dll'.'SDL_setenv' +++'_SDL_qsort'.'SDL2.dll'.'SDL_qsort' +++'_SDL_abs'.'SDL2.dll'.'SDL_abs' +++'_SDL_isdigit'.'SDL2.dll'.'SDL_isdigit' +++'_SDL_isspace'.'SDL2.dll'.'SDL_isspace' +++'_SDL_toupper'.'SDL2.dll'.'SDL_toupper' +++'_SDL_tolower'.'SDL2.dll'.'SDL_tolower' +++'_SDL_memset'.'SDL2.dll'.'SDL_memset' +++'_SDL_memcpy'.'SDL2.dll'.'SDL_memcpy' +++'_SDL_memmove'.'SDL2.dll'.'SDL_memmove' +++'_SDL_memcmp'.'SDL2.dll'.'SDL_memcmp' +++'_SDL_wcslen'.'SDL2.dll'.'SDL_wcslen' +++'_SDL_wcslcpy'.'SDL2.dll'.'SDL_wcslcpy' +++'_SDL_wcslcat'.'SDL2.dll'.'SDL_wcslcat' +++'_SDL_strlen'.'SDL2.dll'.'SDL_strlen' +++'_SDL_strlcpy'.'SDL2.dll'.'SDL_strlcpy' +++'_SDL_utf8strlcpy'.'SDL2.dll'.'SDL_utf8strlcpy' +++'_SDL_strlcat'.'SDL2.dll'.'SDL_strlcat' +++'_SDL_strdup'.'SDL2.dll'.'SDL_strdup' +++'_SDL_strrev'.'SDL2.dll'.'SDL_strrev' +++'_SDL_strupr'.'SDL2.dll'.'SDL_strupr' +++'_SDL_strlwr'.'SDL2.dll'.'SDL_strlwr' +++'_SDL_strchr'.'SDL2.dll'.'SDL_strchr' +++'_SDL_strrchr'.'SDL2.dll'.'SDL_strrchr' +++'_SDL_strstr'.'SDL2.dll'.'SDL_strstr' +++'_SDL_itoa'.'SDL2.dll'.'SDL_itoa' +++'_SDL_uitoa'.'SDL2.dll'.'SDL_uitoa' +++'_SDL_ltoa'.'SDL2.dll'.'SDL_ltoa' +++'_SDL_ultoa'.'SDL2.dll'.'SDL_ultoa' +++'_SDL_lltoa'.'SDL2.dll'.'SDL_lltoa' +++'_SDL_ulltoa'.'SDL2.dll'.'SDL_ulltoa' +++'_SDL_atoi'.'SDL2.dll'.'SDL_atoi' +++'_SDL_atof'.'SDL2.dll'.'SDL_atof' +++'_SDL_strtol'.'SDL2.dll'.'SDL_strtol' +++'_SDL_strtoul'.'SDL2.dll'.'SDL_strtoul' +++'_SDL_strtoll'.'SDL2.dll'.'SDL_strtoll' +++'_SDL_strtoull'.'SDL2.dll'.'SDL_strtoull' +++'_SDL_strtod'.'SDL2.dll'.'SDL_strtod' +++'_SDL_strcmp'.'SDL2.dll'.'SDL_strcmp' +++'_SDL_strncmp'.'SDL2.dll'.'SDL_strncmp' +++'_SDL_strcasecmp'.'SDL2.dll'.'SDL_strcasecmp' +++'_SDL_strncasecmp'.'SDL2.dll'.'SDL_strncasecmp' +++'_SDL_vsnprintf'.'SDL2.dll'.'SDL_vsnprintf' +++'_SDL_acos'.'SDL2.dll'.'SDL_acos' +++'_SDL_asin'.'SDL2.dll'.'SDL_asin' +++'_SDL_atan'.'SDL2.dll'.'SDL_atan' +++'_SDL_atan2'.'SDL2.dll'.'SDL_atan2' +++'_SDL_ceil'.'SDL2.dll'.'SDL_ceil' +++'_SDL_copysign'.'SDL2.dll'.'SDL_copysign' +++'_SDL_cos'.'SDL2.dll'.'SDL_cos' +++'_SDL_cosf'.'SDL2.dll'.'SDL_cosf' +++'_SDL_fabs'.'SDL2.dll'.'SDL_fabs' +++'_SDL_floor'.'SDL2.dll'.'SDL_floor' +++'_SDL_log'.'SDL2.dll'.'SDL_log' +++'_SDL_pow'.'SDL2.dll'.'SDL_pow' +++'_SDL_scalbn'.'SDL2.dll'.'SDL_scalbn' +++'_SDL_sin'.'SDL2.dll'.'SDL_sin' +++'_SDL_sinf'.'SDL2.dll'.'SDL_sinf' +++'_SDL_sqrt'.'SDL2.dll'.'SDL_sqrt' +++'_SDL_iconv_open'.'SDL2.dll'.'SDL_iconv_open' +++'_SDL_iconv_close'.'SDL2.dll'.'SDL_iconv_close' +++'_SDL_iconv'.'SDL2.dll'.'SDL_iconv' +++'_SDL_iconv_string'.'SDL2.dll'.'SDL_iconv_string' +++'_SDL_CreateRGBSurface'.'SDL2.dll'.'SDL_CreateRGBSurface' +++'_SDL_CreateRGBSurfaceFrom'.'SDL2.dll'.'SDL_CreateRGBSurfaceFrom' +++'_SDL_FreeSurface'.'SDL2.dll'.'SDL_FreeSurface' +++'_SDL_SetSurfacePalette'.'SDL2.dll'.'SDL_SetSurfacePalette' +++'_SDL_LockSurface'.'SDL2.dll'.'SDL_LockSurface' +++'_SDL_UnlockSurface'.'SDL2.dll'.'SDL_UnlockSurface' +++'_SDL_LoadBMP_RW'.'SDL2.dll'.'SDL_LoadBMP_RW' +++'_SDL_SaveBMP_RW'.'SDL2.dll'.'SDL_SaveBMP_RW' +++'_SDL_SetSurfaceRLE'.'SDL2.dll'.'SDL_SetSurfaceRLE' +++'_SDL_SetColorKey'.'SDL2.dll'.'SDL_SetColorKey' +++'_SDL_GetColorKey'.'SDL2.dll'.'SDL_GetColorKey' +++'_SDL_SetSurfaceColorMod'.'SDL2.dll'.'SDL_SetSurfaceColorMod' +++'_SDL_GetSurfaceColorMod'.'SDL2.dll'.'SDL_GetSurfaceColorMod' +++'_SDL_SetSurfaceAlphaMod'.'SDL2.dll'.'SDL_SetSurfaceAlphaMod' +++'_SDL_GetSurfaceAlphaMod'.'SDL2.dll'.'SDL_GetSurfaceAlphaMod' +++'_SDL_SetSurfaceBlendMode'.'SDL2.dll'.'SDL_SetSurfaceBlendMode' +++'_SDL_GetSurfaceBlendMode'.'SDL2.dll'.'SDL_GetSurfaceBlendMode' +++'_SDL_SetClipRect'.'SDL2.dll'.'SDL_SetClipRect' +++'_SDL_GetClipRect'.'SDL2.dll'.'SDL_GetClipRect' +++'_SDL_ConvertSurface'.'SDL2.dll'.'SDL_ConvertSurface' +++'_SDL_ConvertSurfaceFormat'.'SDL2.dll'.'SDL_ConvertSurfaceFormat' +++'_SDL_ConvertPixels'.'SDL2.dll'.'SDL_ConvertPixels' +++'_SDL_FillRect'.'SDL2.dll'.'SDL_FillRect' +++'_SDL_FillRects'.'SDL2.dll'.'SDL_FillRects' +++'_SDL_UpperBlit'.'SDL2.dll'.'SDL_UpperBlit' +++'_SDL_LowerBlit'.'SDL2.dll'.'SDL_LowerBlit' +++'_SDL_SoftStretch'.'SDL2.dll'.'SDL_SoftStretch' +++'_SDL_UpperBlitScaled'.'SDL2.dll'.'SDL_UpperBlitScaled' +++'_SDL_LowerBlitScaled'.'SDL2.dll'.'SDL_LowerBlitScaled' +++'_SDL_GetWindowWMInfo'.'SDL2.dll'.'SDL_GetWindowWMInfo' +++'_SDL_GetThreadName'.'SDL2.dll'.'SDL_GetThreadName' +++'_SDL_ThreadID'.'SDL2.dll'.'SDL_ThreadID' +++'_SDL_GetThreadID'.'SDL2.dll'.'SDL_GetThreadID' +++'_SDL_SetThreadPriority'.'SDL2.dll'.'SDL_SetThreadPriority' +++'_SDL_WaitThread'.'SDL2.dll'.'SDL_WaitThread' +++'_SDL_DetachThread'.'SDL2.dll'.'SDL_DetachThread' +++'_SDL_TLSCreate'.'SDL2.dll'.'SDL_TLSCreate' +++'_SDL_TLSGet'.'SDL2.dll'.'SDL_TLSGet' +++'_SDL_TLSSet'.'SDL2.dll'.'SDL_TLSSet' +++'_SDL_GetTicks'.'SDL2.dll'.'SDL_GetTicks' +++'_SDL_GetPerformanceCounter'.'SDL2.dll'.'SDL_GetPerformanceCounter' +++'_SDL_GetPerformanceFrequency'.'SDL2.dll'.'SDL_GetPerformanceFrequency' +++'_SDL_Delay'.'SDL2.dll'.'SDL_Delay' +++'_SDL_AddTimer'.'SDL2.dll'.'SDL_AddTimer' +++'_SDL_RemoveTimer'.'SDL2.dll'.'SDL_RemoveTimer' +++'_SDL_GetNumTouchDevices'.'SDL2.dll'.'SDL_GetNumTouchDevices' +++'_SDL_GetTouchDevice'.'SDL2.dll'.'SDL_GetTouchDevice' +++'_SDL_GetNumTouchFingers'.'SDL2.dll'.'SDL_GetNumTouchFingers' +++'_SDL_GetTouchFinger'.'SDL2.dll'.'SDL_GetTouchFinger' +++'_SDL_GetVersion'.'SDL2.dll'.'SDL_GetVersion' +++'_SDL_GetRevision'.'SDL2.dll'.'SDL_GetRevision' +++'_SDL_GetRevisionNumber'.'SDL2.dll'.'SDL_GetRevisionNumber' +++'_SDL_GetNumVideoDrivers'.'SDL2.dll'.'SDL_GetNumVideoDrivers' +++'_SDL_GetVideoDriver'.'SDL2.dll'.'SDL_GetVideoDriver' +++'_SDL_VideoInit'.'SDL2.dll'.'SDL_VideoInit' +++'_SDL_VideoQuit'.'SDL2.dll'.'SDL_VideoQuit' +++'_SDL_GetCurrentVideoDriver'.'SDL2.dll'.'SDL_GetCurrentVideoDriver' +++'_SDL_GetNumVideoDisplays'.'SDL2.dll'.'SDL_GetNumVideoDisplays' +++'_SDL_GetDisplayName'.'SDL2.dll'.'SDL_GetDisplayName' +++'_SDL_GetDisplayBounds'.'SDL2.dll'.'SDL_GetDisplayBounds' +++'_SDL_GetDisplayDPI'.'SDL2.dll'.'SDL_GetDisplayDPI' +++'_SDL_GetNumDisplayModes'.'SDL2.dll'.'SDL_GetNumDisplayModes' +++'_SDL_GetDisplayMode'.'SDL2.dll'.'SDL_GetDisplayMode' +++'_SDL_GetDesktopDisplayMode'.'SDL2.dll'.'SDL_GetDesktopDisplayMode' +++'_SDL_GetCurrentDisplayMode'.'SDL2.dll'.'SDL_GetCurrentDisplayMode' +++'_SDL_GetClosestDisplayMode'.'SDL2.dll'.'SDL_GetClosestDisplayMode' +++'_SDL_GetWindowDisplayIndex'.'SDL2.dll'.'SDL_GetWindowDisplayIndex' +++'_SDL_SetWindowDisplayMode'.'SDL2.dll'.'SDL_SetWindowDisplayMode' +++'_SDL_GetWindowDisplayMode'.'SDL2.dll'.'SDL_GetWindowDisplayMode' +++'_SDL_GetWindowPixelFormat'.'SDL2.dll'.'SDL_GetWindowPixelFormat' +++'_SDL_CreateWindow'.'SDL2.dll'.'SDL_CreateWindow' +++'_SDL_CreateWindowFrom'.'SDL2.dll'.'SDL_CreateWindowFrom' +++'_SDL_GetWindowID'.'SDL2.dll'.'SDL_GetWindowID' +++'_SDL_GetWindowFromID'.'SDL2.dll'.'SDL_GetWindowFromID' +++'_SDL_GetWindowFlags'.'SDL2.dll'.'SDL_GetWindowFlags' +++'_SDL_SetWindowTitle'.'SDL2.dll'.'SDL_SetWindowTitle' +++'_SDL_GetWindowTitle'.'SDL2.dll'.'SDL_GetWindowTitle' +++'_SDL_SetWindowIcon'.'SDL2.dll'.'SDL_SetWindowIcon' +++'_SDL_SetWindowData'.'SDL2.dll'.'SDL_SetWindowData' +++'_SDL_GetWindowData'.'SDL2.dll'.'SDL_GetWindowData' +++'_SDL_SetWindowPosition'.'SDL2.dll'.'SDL_SetWindowPosition' +++'_SDL_GetWindowPosition'.'SDL2.dll'.'SDL_GetWindowPosition' +++'_SDL_SetWindowSize'.'SDL2.dll'.'SDL_SetWindowSize' +++'_SDL_GetWindowSize'.'SDL2.dll'.'SDL_GetWindowSize' +++'_SDL_SetWindowMinimumSize'.'SDL2.dll'.'SDL_SetWindowMinimumSize' +++'_SDL_GetWindowMinimumSize'.'SDL2.dll'.'SDL_GetWindowMinimumSize' +++'_SDL_SetWindowMaximumSize'.'SDL2.dll'.'SDL_SetWindowMaximumSize' +++'_SDL_GetWindowMaximumSize'.'SDL2.dll'.'SDL_GetWindowMaximumSize' +++'_SDL_SetWindowBordered'.'SDL2.dll'.'SDL_SetWindowBordered' +++'_SDL_ShowWindow'.'SDL2.dll'.'SDL_ShowWindow' +++'_SDL_HideWindow'.'SDL2.dll'.'SDL_HideWindow' +++'_SDL_RaiseWindow'.'SDL2.dll'.'SDL_RaiseWindow' +++'_SDL_MaximizeWindow'.'SDL2.dll'.'SDL_MaximizeWindow' +++'_SDL_MinimizeWindow'.'SDL2.dll'.'SDL_MinimizeWindow' +++'_SDL_RestoreWindow'.'SDL2.dll'.'SDL_RestoreWindow' +++'_SDL_SetWindowFullscreen'.'SDL2.dll'.'SDL_SetWindowFullscreen' +++'_SDL_GetWindowSurface'.'SDL2.dll'.'SDL_GetWindowSurface' +++'_SDL_UpdateWindowSurface'.'SDL2.dll'.'SDL_UpdateWindowSurface' +++'_SDL_UpdateWindowSurfaceRects'.'SDL2.dll'.'SDL_UpdateWindowSurfaceRects' +++'_SDL_SetWindowGrab'.'SDL2.dll'.'SDL_SetWindowGrab' +++'_SDL_GetWindowGrab'.'SDL2.dll'.'SDL_GetWindowGrab' +++'_SDL_SetWindowBrightness'.'SDL2.dll'.'SDL_SetWindowBrightness' +++'_SDL_GetWindowBrightness'.'SDL2.dll'.'SDL_GetWindowBrightness' +++'_SDL_SetWindowGammaRamp'.'SDL2.dll'.'SDL_SetWindowGammaRamp' +++'_SDL_GetWindowGammaRamp'.'SDL2.dll'.'SDL_GetWindowGammaRamp' +++'_SDL_DestroyWindow'.'SDL2.dll'.'SDL_DestroyWindow' +++'_SDL_IsScreenSaverEnabled'.'SDL2.dll'.'SDL_IsScreenSaverEnabled' +++'_SDL_EnableScreenSaver'.'SDL2.dll'.'SDL_EnableScreenSaver' +++'_SDL_DisableScreenSaver'.'SDL2.dll'.'SDL_DisableScreenSaver' +++'_SDL_GL_LoadLibrary'.'SDL2.dll'.'SDL_GL_LoadLibrary' +++'_SDL_GL_GetProcAddress'.'SDL2.dll'.'SDL_GL_GetProcAddress' +++'_SDL_GL_UnloadLibrary'.'SDL2.dll'.'SDL_GL_UnloadLibrary' +++'_SDL_GL_ExtensionSupported'.'SDL2.dll'.'SDL_GL_ExtensionSupported' +++'_SDL_GL_SetAttribute'.'SDL2.dll'.'SDL_GL_SetAttribute' +++'_SDL_GL_GetAttribute'.'SDL2.dll'.'SDL_GL_GetAttribute' +++'_SDL_GL_CreateContext'.'SDL2.dll'.'SDL_GL_CreateContext' +++'_SDL_GL_MakeCurrent'.'SDL2.dll'.'SDL_GL_MakeCurrent' +++'_SDL_GL_GetCurrentWindow'.'SDL2.dll'.'SDL_GL_GetCurrentWindow' +++'_SDL_GL_GetCurrentContext'.'SDL2.dll'.'SDL_GL_GetCurrentContext' +++'_SDL_GL_GetDrawableSize'.'SDL2.dll'.'SDL_GL_GetDrawableSize' +++'_SDL_GL_SetSwapInterval'.'SDL2.dll'.'SDL_GL_SetSwapInterval' +++'_SDL_GL_GetSwapInterval'.'SDL2.dll'.'SDL_GL_GetSwapInterval' +++'_SDL_GL_SwapWindow'.'SDL2.dll'.'SDL_GL_SwapWindow' +++'_SDL_GL_DeleteContext'.'SDL2.dll'.'SDL_GL_DeleteContext' +++'_SDL_vsscanf'.'SDL2.dll'.'SDL_vsscanf' +++'_SDL_GameControllerAddMappingsFromRW'.'SDL2.dll'.'SDL_GameControllerAddMappingsFromRW' +++'_SDL_GL_ResetAttributes'.'SDL2.dll'.'SDL_GL_ResetAttributes' +++'_SDL_HasAVX'.'SDL2.dll'.'SDL_HasAVX' +++'_SDL_GetDefaultAssertionHandler'.'SDL2.dll'.'SDL_GetDefaultAssertionHandler' +++'_SDL_GetAssertionHandler'.'SDL2.dll'.'SDL_GetAssertionHandler' +++'_SDL_DXGIGetOutputInfo'.'SDL2.dll'.'SDL_DXGIGetOutputInfo' +++'_SDL_RenderIsClipEnabled'.'SDL2.dll'.'SDL_RenderIsClipEnabled' +# ++'_SDL_WinRTRunApp'.'SDL2.dll'.'SDL_WinRTRunApp' +++'_SDL_WarpMouseGlobal'.'SDL2.dll'.'SDL_WarpMouseGlobal' +# ++'_SDL_WinRTGetFSPathUNICODE'.'SDL2.dll'.'SDL_WinRTGetFSPathUNICODE' +# ++'_SDL_WinRTGetFSPathUTF8'.'SDL2.dll'.'SDL_WinRTGetFSPathUTF8' +++'_SDL_sqrtf'.'SDL2.dll'.'SDL_sqrtf' +++'_SDL_tan'.'SDL2.dll'.'SDL_tan' +++'_SDL_tanf'.'SDL2.dll'.'SDL_tanf' +++'_SDL_CaptureMouse'.'SDL2.dll'.'SDL_CaptureMouse' +++'_SDL_SetWindowHitTest'.'SDL2.dll'.'SDL_SetWindowHitTest' +++'_SDL_GetGlobalMouseState'.'SDL2.dll'.'SDL_GetGlobalMouseState' +++'_SDL_HasAVX2'.'SDL2.dll'.'SDL_HasAVX2' +++'_SDL_QueueAudio'.'SDL2.dll'.'SDL_QueueAudio' +++'_SDL_GetQueuedAudioSize'.'SDL2.dll'.'SDL_GetQueuedAudioSize' +++'_SDL_ClearQueuedAudio'.'SDL2.dll'.'SDL_ClearQueuedAudio' +++'_SDL_GetGrabbedWindow'.'SDL2.dll'.'SDL_GetGrabbedWindow' +++'_SDL_SetWindowsMessageHook'.'SDL2.dll'.'SDL_SetWindowsMessageHook' +++'_SDL_JoystickCurrentPowerLevel'.'SDL2.dll'.'SDL_JoystickCurrentPowerLevel' +++'_SDL_GameControllerFromInstanceID'.'SDL2.dll'.'SDL_GameControllerFromInstanceID' +++'_SDL_JoystickFromInstanceID'.'SDL2.dll'.'SDL_JoystickFromInstanceID' +++'_SDL_GetDisplayUsableBounds'.'SDL2.dll'.'SDL_GetDisplayUsableBounds' +++'_SDL_GetWindowBordersSize'.'SDL2.dll'.'SDL_GetWindowBordersSize' +++'_SDL_SetWindowOpacity'.'SDL2.dll'.'SDL_SetWindowOpacity' +++'_SDL_GetWindowOpacity'.'SDL2.dll'.'SDL_GetWindowOpacity' +++'_SDL_SetWindowInputFocus'.'SDL2.dll'.'SDL_SetWindowInputFocus' +++'_SDL_SetWindowModalFor'.'SDL2.dll'.'SDL_SetWindowModalFor' +++'_SDL_RenderSetIntegerScale'.'SDL2.dll'.'SDL_RenderSetIntegerScale' +++'_SDL_RenderGetIntegerScale'.'SDL2.dll'.'SDL_RenderGetIntegerScale' +++'_SDL_DequeueAudio'.'SDL2.dll'.'SDL_DequeueAudio' +++'_SDL_SetWindowResizable'.'SDL2.dll'.'SDL_SetWindowResizable' +++'_SDL_CreateRGBSurfaceWithFormat'.'SDL2.dll'.'SDL_CreateRGBSurfaceWithFormat' +++'_SDL_CreateRGBSurfaceWithFormatFrom'.'SDL2.dll'.'SDL_CreateRGBSurfaceWithFormatFrom' +++'_SDL_GetHintBoolean'.'SDL2.dll'.'SDL_GetHintBoolean' +++'_SDL_JoystickGetDeviceVendor'.'SDL2.dll'.'SDL_JoystickGetDeviceVendor' +++'_SDL_JoystickGetDeviceProduct'.'SDL2.dll'.'SDL_JoystickGetDeviceProduct' +++'_SDL_JoystickGetDeviceProductVersion'.'SDL2.dll'.'SDL_JoystickGetDeviceProductVersion' +++'_SDL_JoystickGetVendor'.'SDL2.dll'.'SDL_JoystickGetVendor' +++'_SDL_JoystickGetProduct'.'SDL2.dll'.'SDL_JoystickGetProduct' +++'_SDL_JoystickGetProductVersion'.'SDL2.dll'.'SDL_JoystickGetProductVersion' +++'_SDL_GameControllerGetVendor'.'SDL2.dll'.'SDL_GameControllerGetVendor' +++'_SDL_GameControllerGetProduct'.'SDL2.dll'.'SDL_GameControllerGetProduct' +++'_SDL_GameControllerGetProductVersion'.'SDL2.dll'.'SDL_GameControllerGetProductVersion' +++'_SDL_HasNEON'.'SDL2.dll'.'SDL_HasNEON' +++'_SDL_GameControllerNumMappings'.'SDL2.dll'.'SDL_GameControllerNumMappings' +++'_SDL_GameControllerMappingForIndex'.'SDL2.dll'.'SDL_GameControllerMappingForIndex' +++'_SDL_JoystickGetAxisInitialState'.'SDL2.dll'.'SDL_JoystickGetAxisInitialState' +++'_SDL_JoystickGetDeviceType'.'SDL2.dll'.'SDL_JoystickGetDeviceType' +++'_SDL_JoystickGetType'.'SDL2.dll'.'SDL_JoystickGetType' +++'_SDL_MemoryBarrierReleaseFunction'.'SDL2.dll'.'SDL_MemoryBarrierReleaseFunction' +++'_SDL_MemoryBarrierAcquireFunction'.'SDL2.dll'.'SDL_MemoryBarrierAcquireFunction' +++'_SDL_JoystickGetDeviceInstanceID'.'SDL2.dll'.'SDL_JoystickGetDeviceInstanceID' +++'_SDL_utf8strlen'.'SDL2.dll'.'SDL_utf8strlen' +++'_SDL_LoadFile_RW'.'SDL2.dll'.'SDL_LoadFile_RW' +++'_SDL_wcscmp'.'SDL2.dll'.'SDL_wcscmp' +++'_SDL_ComposeCustomBlendMode'.'SDL2.dll'.'SDL_ComposeCustomBlendMode' +++'_SDL_DuplicateSurface'.'SDL2.dll'.'SDL_DuplicateSurface' +++'_SDL_Vulkan_LoadLibrary'.'SDL2.dll'.'SDL_Vulkan_LoadLibrary' +++'_SDL_Vulkan_GetVkGetInstanceProcAddr'.'SDL2.dll'.'SDL_Vulkan_GetVkGetInstanceProcAddr' +++'_SDL_Vulkan_UnloadLibrary'.'SDL2.dll'.'SDL_Vulkan_UnloadLibrary' +++'_SDL_Vulkan_GetInstanceExtensions'.'SDL2.dll'.'SDL_Vulkan_GetInstanceExtensions' +++'_SDL_Vulkan_CreateSurface'.'SDL2.dll'.'SDL_Vulkan_CreateSurface' +++'_SDL_Vulkan_GetDrawableSize'.'SDL2.dll'.'SDL_Vulkan_GetDrawableSize' +++'_SDL_LockJoysticks'.'SDL2.dll'.'SDL_LockJoysticks' +++'_SDL_UnlockJoysticks'.'SDL2.dll'.'SDL_UnlockJoysticks' +++'_SDL_GetMemoryFunctions'.'SDL2.dll'.'SDL_GetMemoryFunctions' +++'_SDL_SetMemoryFunctions'.'SDL2.dll'.'SDL_SetMemoryFunctions' +++'_SDL_GetNumAllocations'.'SDL2.dll'.'SDL_GetNumAllocations' +++'_SDL_NewAudioStream'.'SDL2.dll'.'SDL_NewAudioStream' +++'_SDL_AudioStreamPut'.'SDL2.dll'.'SDL_AudioStreamPut' +++'_SDL_AudioStreamGet'.'SDL2.dll'.'SDL_AudioStreamGet' +++'_SDL_AudioStreamClear'.'SDL2.dll'.'SDL_AudioStreamClear' +++'_SDL_AudioStreamAvailable'.'SDL2.dll'.'SDL_AudioStreamAvailable' +++'_SDL_FreeAudioStream'.'SDL2.dll'.'SDL_FreeAudioStream' +++'_SDL_AudioStreamFlush'.'SDL2.dll'.'SDL_AudioStreamFlush' +++'_SDL_acosf'.'SDL2.dll'.'SDL_acosf' +++'_SDL_asinf'.'SDL2.dll'.'SDL_asinf' +++'_SDL_atanf'.'SDL2.dll'.'SDL_atanf' +++'_SDL_atan2f'.'SDL2.dll'.'SDL_atan2f' +++'_SDL_ceilf'.'SDL2.dll'.'SDL_ceilf' +++'_SDL_copysignf'.'SDL2.dll'.'SDL_copysignf' +++'_SDL_fabsf'.'SDL2.dll'.'SDL_fabsf' +++'_SDL_floorf'.'SDL2.dll'.'SDL_floorf' +++'_SDL_logf'.'SDL2.dll'.'SDL_logf' +++'_SDL_powf'.'SDL2.dll'.'SDL_powf' +++'_SDL_scalbnf'.'SDL2.dll'.'SDL_scalbnf' +++'_SDL_fmod'.'SDL2.dll'.'SDL_fmod' +++'_SDL_fmodf'.'SDL2.dll'.'SDL_fmodf' +++'_SDL_SetYUVConversionMode'.'SDL2.dll'.'SDL_SetYUVConversionMode' +++'_SDL_GetYUVConversionMode'.'SDL2.dll'.'SDL_GetYUVConversionMode' +++'_SDL_GetYUVConversionModeForResolution'.'SDL2.dll'.'SDL_GetYUVConversionModeForResolution' +++'_SDL_RenderGetMetalLayer'.'SDL2.dll'.'SDL_RenderGetMetalLayer' +++'_SDL_RenderGetMetalCommandEncoder'.'SDL2.dll'.'SDL_RenderGetMetalCommandEncoder' +# ++'_SDL_IsAndroidTV'.'SDL2.dll'.'SDL_IsAndroidTV' +# ++'_SDL_WinRTGetDeviceFamily'.'SDL2.dll'.'SDL_WinRTGetDeviceFamily' +++'_SDL_log10'.'SDL2.dll'.'SDL_log10' +++'_SDL_log10f'.'SDL2.dll'.'SDL_log10f' +++'_SDL_GameControllerMappingForDeviceIndex'.'SDL2.dll'.'SDL_GameControllerMappingForDeviceIndex' +# ++'_SDL_LinuxSetThreadPriority'.'SDL2.dll'.'SDL_LinuxSetThreadPriority' +++'_SDL_HasAVX512F'.'SDL2.dll'.'SDL_HasAVX512F' +# ++'_SDL_IsChromebook'.'SDL2.dll'.'SDL_IsChromebook' +# ++'_SDL_IsDeXMode'.'SDL2.dll'.'SDL_IsDeXMode' +# ++'_SDL_AndroidBackButton'.'SDL2.dll'.'SDL_AndroidBackButton' +++'_SDL_exp'.'SDL2.dll'.'SDL_exp' +++'_SDL_expf'.'SDL2.dll'.'SDL_expf' +++'_SDL_wcsdup'.'SDL2.dll'.'SDL_wcsdup' +++'_SDL_GameControllerRumble'.'SDL2.dll'.'SDL_GameControllerRumble' +++'_SDL_JoystickRumble'.'SDL2.dll'.'SDL_JoystickRumble' +++'_SDL_NumSensors'.'SDL2.dll'.'SDL_NumSensors' +++'_SDL_SensorGetDeviceName'.'SDL2.dll'.'SDL_SensorGetDeviceName' +++'_SDL_SensorGetDeviceType'.'SDL2.dll'.'SDL_SensorGetDeviceType' +++'_SDL_SensorGetDeviceNonPortableType'.'SDL2.dll'.'SDL_SensorGetDeviceNonPortableType' +++'_SDL_SensorGetDeviceInstanceID'.'SDL2.dll'.'SDL_SensorGetDeviceInstanceID' +++'_SDL_SensorOpen'.'SDL2.dll'.'SDL_SensorOpen' +++'_SDL_SensorFromInstanceID'.'SDL2.dll'.'SDL_SensorFromInstanceID' +++'_SDL_SensorGetName'.'SDL2.dll'.'SDL_SensorGetName' +++'_SDL_SensorGetType'.'SDL2.dll'.'SDL_SensorGetType' +++'_SDL_SensorGetNonPortableType'.'SDL2.dll'.'SDL_SensorGetNonPortableType' +++'_SDL_SensorGetInstanceID'.'SDL2.dll'.'SDL_SensorGetInstanceID' +++'_SDL_SensorGetData'.'SDL2.dll'.'SDL_SensorGetData' +++'_SDL_SensorClose'.'SDL2.dll'.'SDL_SensorClose' +++'_SDL_SensorUpdate'.'SDL2.dll'.'SDL_SensorUpdate' +++'_SDL_IsTablet'.'SDL2.dll'.'SDL_IsTablet' +++'_SDL_GetDisplayOrientation'.'SDL2.dll'.'SDL_GetDisplayOrientation' +++'_SDL_HasColorKey'.'SDL2.dll'.'SDL_HasColorKey' +++'_SDL_CreateThreadWithStackSize'.'SDL2.dll'.'SDL_CreateThreadWithStackSize' +++'_SDL_JoystickGetDevicePlayerIndex'.'SDL2.dll'.'SDL_JoystickGetDevicePlayerIndex' +++'_SDL_JoystickGetPlayerIndex'.'SDL2.dll'.'SDL_JoystickGetPlayerIndex' +++'_SDL_GameControllerGetPlayerIndex'.'SDL2.dll'.'SDL_GameControllerGetPlayerIndex' +++'_SDL_RenderFlush'.'SDL2.dll'.'SDL_RenderFlush' +++'_SDL_RenderDrawPointF'.'SDL2.dll'.'SDL_RenderDrawPointF' +++'_SDL_RenderDrawPointsF'.'SDL2.dll'.'SDL_RenderDrawPointsF' +++'_SDL_RenderDrawLineF'.'SDL2.dll'.'SDL_RenderDrawLineF' +++'_SDL_RenderDrawLinesF'.'SDL2.dll'.'SDL_RenderDrawLinesF' +++'_SDL_RenderDrawRectF'.'SDL2.dll'.'SDL_RenderDrawRectF' +++'_SDL_RenderDrawRectsF'.'SDL2.dll'.'SDL_RenderDrawRectsF' +++'_SDL_RenderFillRectF'.'SDL2.dll'.'SDL_RenderFillRectF' +++'_SDL_RenderFillRectsF'.'SDL2.dll'.'SDL_RenderFillRectsF' +++'_SDL_RenderCopyF'.'SDL2.dll'.'SDL_RenderCopyF' +++'_SDL_RenderCopyExF'.'SDL2.dll'.'SDL_RenderCopyExF' +++'_SDL_GetTouchDeviceType'.'SDL2.dll'.'SDL_GetTouchDeviceType' +# ++'_SDL_UIKitRunApp'.'SDL2.dll'.'SDL_UIKitRunApp' +++'_SDL_SIMDGetAlignment'.'SDL2.dll'.'SDL_SIMDGetAlignment' +++'_SDL_SIMDAlloc'.'SDL2.dll'.'SDL_SIMDAlloc' +++'_SDL_SIMDFree'.'SDL2.dll'.'SDL_SIMDFree' +++'_SDL_RWsize'.'SDL2.dll'.'SDL_RWsize' +++'_SDL_RWseek'.'SDL2.dll'.'SDL_RWseek' +++'_SDL_RWtell'.'SDL2.dll'.'SDL_RWtell' +++'_SDL_RWread'.'SDL2.dll'.'SDL_RWread' +++'_SDL_RWwrite'.'SDL2.dll'.'SDL_RWwrite' +++'_SDL_RWclose'.'SDL2.dll'.'SDL_RWclose' +++'_SDL_LoadFile'.'SDL2.dll'.'SDL_LoadFile' +++'_SDL_Metal_CreateView'.'SDL2.dll'.'SDL_Metal_CreateView' +++'_SDL_Metal_DestroyView'.'SDL2.dll'.'SDL_Metal_DestroyView' +++'_SDL_LockTextureToSurface'.'SDL2.dll'.'SDL_LockTextureToSurface' +++'_SDL_HasARMSIMD'.'SDL2.dll'.'SDL_HasARMSIMD' +++'_SDL_strtokr'.'SDL2.dll'.'SDL_strtokr' +++'_SDL_wcsstr'.'SDL2.dll'.'SDL_wcsstr' +++'_SDL_wcsncmp'.'SDL2.dll'.'SDL_wcsncmp' +++'_SDL_GameControllerTypeForIndex'.'SDL2.dll'.'SDL_GameControllerTypeForIndex' +++'_SDL_GameControllerGetType'.'SDL2.dll'.'SDL_GameControllerGetType' +++'_SDL_GameControllerFromPlayerIndex'.'SDL2.dll'.'SDL_GameControllerFromPlayerIndex' +++'_SDL_GameControllerSetPlayerIndex'.'SDL2.dll'.'SDL_GameControllerSetPlayerIndex' +++'_SDL_JoystickFromPlayerIndex'.'SDL2.dll'.'SDL_JoystickFromPlayerIndex' +++'_SDL_JoystickSetPlayerIndex'.'SDL2.dll'.'SDL_JoystickSetPlayerIndex' +++'_SDL_SetTextureScaleMode'.'SDL2.dll'.'SDL_SetTextureScaleMode' +++'_SDL_GetTextureScaleMode'.'SDL2.dll'.'SDL_GetTextureScaleMode' +++'_SDL_OnApplicationWillTerminate'.'SDL2.dll'.'SDL_OnApplicationWillTerminate' +++'_SDL_OnApplicationDidReceiveMemoryWarning'.'SDL2.dll'.'SDL_OnApplicationDidReceiveMemoryWarning' +++'_SDL_OnApplicationWillResignActive'.'SDL2.dll'.'SDL_OnApplicationWillResignActive' +++'_SDL_OnApplicationDidEnterBackground'.'SDL2.dll'.'SDL_OnApplicationDidEnterBackground' +++'_SDL_OnApplicationWillEnterForeground'.'SDL2.dll'.'SDL_OnApplicationWillEnterForeground' +++'_SDL_OnApplicationDidBecomeActive'.'SDL2.dll'.'SDL_OnApplicationDidBecomeActive' +# ++'_SDL_OnApplicationDidChangeStatusBarOrientation'.'SDL2.dll'.'SDL_OnApplicationDidChangeStatusBarOrientation' +# ++'_SDL_GetAndroidSDKVersion'.'SDL2.dll'.'SDL_GetAndroidSDKVersion' +++'_SDL_isupper'.'SDL2.dll'.'SDL_isupper' +++'_SDL_islower'.'SDL2.dll'.'SDL_islower' +++'_SDL_JoystickAttachVirtual'.'SDL2.dll'.'SDL_JoystickAttachVirtual' +++'_SDL_JoystickDetachVirtual'.'SDL2.dll'.'SDL_JoystickDetachVirtual' +++'_SDL_JoystickIsVirtual'.'SDL2.dll'.'SDL_JoystickIsVirtual' +++'_SDL_JoystickSetVirtualAxis'.'SDL2.dll'.'SDL_JoystickSetVirtualAxis' +++'_SDL_JoystickSetVirtualButton'.'SDL2.dll'.'SDL_JoystickSetVirtualButton' +++'_SDL_JoystickSetVirtualHat'.'SDL2.dll'.'SDL_JoystickSetVirtualHat' +++'_SDL_GetErrorMsg'.'SDL2.dll'.'SDL_GetErrorMsg' +++'_SDL_LockSensors'.'SDL2.dll'.'SDL_LockSensors' +++'_SDL_UnlockSensors'.'SDL2.dll'.'SDL_UnlockSensors' +++'_SDL_Metal_GetLayer'.'SDL2.dll'.'SDL_Metal_GetLayer' +++'_SDL_Metal_GetDrawableSize'.'SDL2.dll'.'SDL_Metal_GetDrawableSize' +++'_SDL_trunc'.'SDL2.dll'.'SDL_trunc' +++'_SDL_truncf'.'SDL2.dll'.'SDL_truncf' +++'_SDL_GetPreferredLocales'.'SDL2.dll'.'SDL_GetPreferredLocales' +++'_SDL_SIMDRealloc'.'SDL2.dll'.'SDL_SIMDRealloc' +# ++'_SDL_AndroidRequestPermission'.'SDL2.dll'.'SDL_AndroidRequestPermission' +++'_SDL_OpenURL'.'SDL2.dll'.'SDL_OpenURL' +++'_SDL_HasSurfaceRLE'.'SDL2.dll'.'SDL_HasSurfaceRLE' +++'_SDL_GameControllerHasLED'.'SDL2.dll'.'SDL_GameControllerHasLED' +++'_SDL_GameControllerSetLED'.'SDL2.dll'.'SDL_GameControllerSetLED' +++'_SDL_JoystickHasLED'.'SDL2.dll'.'SDL_JoystickHasLED' +++'_SDL_JoystickSetLED'.'SDL2.dll'.'SDL_JoystickSetLED' +++'_SDL_GameControllerRumbleTriggers'.'SDL2.dll'.'SDL_GameControllerRumbleTriggers' +++'_SDL_JoystickRumbleTriggers'.'SDL2.dll'.'SDL_JoystickRumbleTriggers' +++'_SDL_GameControllerHasAxis'.'SDL2.dll'.'SDL_GameControllerHasAxis' +++'_SDL_GameControllerHasButton'.'SDL2.dll'.'SDL_GameControllerHasButton' +++'_SDL_GameControllerGetNumTouchpads'.'SDL2.dll'.'SDL_GameControllerGetNumTouchpads' +++'_SDL_GameControllerGetNumTouchpadFingers'.'SDL2.dll'.'SDL_GameControllerGetNumTouchpadFingers' +++'_SDL_GameControllerGetTouchpadFinger'.'SDL2.dll'.'SDL_GameControllerGetTouchpadFinger' +++'_SDL_crc32'.'SDL2.dll'.'SDL_crc32' +++'_SDL_GameControllerGetSerial'.'SDL2.dll'.'SDL_GameControllerGetSerial' +++'_SDL_JoystickGetSerial'.'SDL2.dll'.'SDL_JoystickGetSerial' +++'_SDL_GameControllerHasSensor'.'SDL2.dll'.'SDL_GameControllerHasSensor' +++'_SDL_GameControllerSetSensorEnabled'.'SDL2.dll'.'SDL_GameControllerSetSensorEnabled' +++'_SDL_GameControllerIsSensorEnabled'.'SDL2.dll'.'SDL_GameControllerIsSensorEnabled' +++'_SDL_GameControllerGetSensorData'.'SDL2.dll'.'SDL_GameControllerGetSensorData' +++'_SDL_wcscasecmp'.'SDL2.dll'.'SDL_wcscasecmp' +++'_SDL_wcsncasecmp'.'SDL2.dll'.'SDL_wcsncasecmp' +++'_SDL_round'.'SDL2.dll'.'SDL_round' +++'_SDL_roundf'.'SDL2.dll'.'SDL_roundf' +++'_SDL_lround'.'SDL2.dll'.'SDL_lround' +++'_SDL_lroundf'.'SDL2.dll'.'SDL_lroundf' +++'_SDL_SoftStretchLinear'.'SDL2.dll'.'SDL_SoftStretchLinear' +++'_SDL_RenderGetD3D11Device'.'SDL2.dll'.'SDL_RenderGetD3D11Device' +++'_SDL_UpdateNVTexture'.'SDL2.dll'.'SDL_UpdateNVTexture' +++'_SDL_SetWindowKeyboardGrab'.'SDL2.dll'.'SDL_SetWindowKeyboardGrab' +++'_SDL_SetWindowMouseGrab'.'SDL2.dll'.'SDL_SetWindowMouseGrab' +++'_SDL_GetWindowKeyboardGrab'.'SDL2.dll'.'SDL_GetWindowKeyboardGrab' +++'_SDL_GetWindowMouseGrab'.'SDL2.dll'.'SDL_GetWindowMouseGrab' +++'_SDL_isalpha'.'SDL2.dll'.'SDL_isalpha' +++'_SDL_isalnum'.'SDL2.dll'.'SDL_isalnum' +++'_SDL_isblank'.'SDL2.dll'.'SDL_isblank' +++'_SDL_iscntrl'.'SDL2.dll'.'SDL_iscntrl' +++'_SDL_isxdigit'.'SDL2.dll'.'SDL_isxdigit' +++'_SDL_ispunct'.'SDL2.dll'.'SDL_ispunct' +++'_SDL_isprint'.'SDL2.dll'.'SDL_isprint' +++'_SDL_isgraph'.'SDL2.dll'.'SDL_isgraph' +# ++'_SDL_AndroidShowToast'.'SDL2.dll'.'SDL_AndroidShowToast' +++'_SDL_GetAudioDeviceSpec'.'SDL2.dll'.'SDL_GetAudioDeviceSpec' +++'_SDL_TLSCleanup'.'SDL2.dll'.'SDL_TLSCleanup' +++'_SDL_SetWindowAlwaysOnTop'.'SDL2.dll'.'SDL_SetWindowAlwaysOnTop' +++'_SDL_FlashWindow'.'SDL2.dll'.'SDL_FlashWindow' +++'_SDL_GameControllerSendEffect'.'SDL2.dll'.'SDL_GameControllerSendEffect' +++'_SDL_JoystickSendEffect'.'SDL2.dll'.'SDL_JoystickSendEffect' +++'_SDL_GameControllerGetSensorDataRate'.'SDL2.dll'.'SDL_GameControllerGetSensorDataRate' +++'_SDL_SetTextureUserData'.'SDL2.dll'.'SDL_SetTextureUserData' +++'_SDL_GetTextureUserData'.'SDL2.dll'.'SDL_GetTextureUserData' +++'_SDL_RenderGeometry'.'SDL2.dll'.'SDL_RenderGeometry' +++'_SDL_RenderGeometryRaw'.'SDL2.dll'.'SDL_RenderGeometryRaw' +++'_SDL_RenderSetVSync'.'SDL2.dll'.'SDL_RenderSetVSync' +++'_SDL_asprintf'.'SDL2.dll'.'SDL_asprintf' +++'_SDL_vasprintf'.'SDL2.dll'.'SDL_vasprintf' +++'_SDL_GetWindowICCProfile'.'SDL2.dll'.'SDL_GetWindowICCProfile' +++'_SDL_GetTicks64'.'SDL2.dll'.'SDL_GetTicks64' +# ++'_SDL_LinuxSetThreadPriorityAndPolicy'.'SDL2.dll'.'SDL_LinuxSetThreadPriorityAndPolicy' +++'_SDL_GameControllerGetAppleSFSymbolsNameForButton'.'SDL2.dll'.'SDL_GameControllerGetAppleSFSymbolsNameForButton' +++'_SDL_GameControllerGetAppleSFSymbolsNameForAxis'.'SDL2.dll'.'SDL_GameControllerGetAppleSFSymbolsNameForAxis' +++'_SDL_hid_init'.'SDL2.dll'.'SDL_hid_init' +++'_SDL_hid_exit'.'SDL2.dll'.'SDL_hid_exit' +++'_SDL_hid_device_change_count'.'SDL2.dll'.'SDL_hid_device_change_count' +++'_SDL_hid_enumerate'.'SDL2.dll'.'SDL_hid_enumerate' +++'_SDL_hid_free_enumeration'.'SDL2.dll'.'SDL_hid_free_enumeration' +++'_SDL_hid_open'.'SDL2.dll'.'SDL_hid_open' +++'_SDL_hid_open_path'.'SDL2.dll'.'SDL_hid_open_path' +++'_SDL_hid_write'.'SDL2.dll'.'SDL_hid_write' +++'_SDL_hid_read_timeout'.'SDL2.dll'.'SDL_hid_read_timeout' +++'_SDL_hid_read'.'SDL2.dll'.'SDL_hid_read' +++'_SDL_hid_set_nonblocking'.'SDL2.dll'.'SDL_hid_set_nonblocking' +++'_SDL_hid_send_feature_report'.'SDL2.dll'.'SDL_hid_send_feature_report' +++'_SDL_hid_get_feature_report'.'SDL2.dll'.'SDL_hid_get_feature_report' +++'_SDL_hid_close'.'SDL2.dll'.'SDL_hid_close' +++'_SDL_hid_get_manufacturer_string'.'SDL2.dll'.'SDL_hid_get_manufacturer_string' +++'_SDL_hid_get_product_string'.'SDL2.dll'.'SDL_hid_get_product_string' +++'_SDL_hid_get_serial_number_string'.'SDL2.dll'.'SDL_hid_get_serial_number_string' +++'_SDL_hid_get_indexed_string'.'SDL2.dll'.'SDL_hid_get_indexed_string' +++'_SDL_SetWindowMouseRect'.'SDL2.dll'.'SDL_SetWindowMouseRect' +++'_SDL_GetWindowMouseRect'.'SDL2.dll'.'SDL_GetWindowMouseRect' +++'_SDL_RenderWindowToLogical'.'SDL2.dll'.'SDL_RenderWindowToLogical' +++'_SDL_RenderLogicalToWindow'.'SDL2.dll'.'SDL_RenderLogicalToWindow' +++'_SDL_JoystickHasRumble'.'SDL2.dll'.'SDL_JoystickHasRumble' +++'_SDL_JoystickHasRumbleTriggers'.'SDL2.dll'.'SDL_JoystickHasRumbleTriggers' +++'_SDL_GameControllerHasRumble'.'SDL2.dll'.'SDL_GameControllerHasRumble' +++'_SDL_GameControllerHasRumbleTriggers'.'SDL2.dll'.'SDL_GameControllerHasRumbleTriggers' +++'_SDL_hid_ble_scan'.'SDL2.dll'.'SDL_hid_ble_scan' +++'_SDL_PremultiplyAlpha'.'SDL2.dll'.'SDL_PremultiplyAlpha' +# ++'_SDL_AndroidSendMessage'.'SDL2.dll'.'SDL_AndroidSendMessage' +++'_SDL_GetTouchName'.'SDL2.dll'.'SDL_GetTouchName' +++'_SDL_ClearComposition'.'SDL2.dll'.'SDL_ClearComposition' +++'_SDL_IsTextInputShown'.'SDL2.dll'.'SDL_IsTextInputShown' +++'_SDL_HasIntersectionF'.'SDL2.dll'.'SDL_HasIntersectionF' +++'_SDL_IntersectFRect'.'SDL2.dll'.'SDL_IntersectFRect' +++'_SDL_UnionFRect'.'SDL2.dll'.'SDL_UnionFRect' +++'_SDL_EncloseFPoints'.'SDL2.dll'.'SDL_EncloseFPoints' +++'_SDL_IntersectFRectAndLine'.'SDL2.dll'.'SDL_IntersectFRectAndLine' +++'_SDL_RenderGetWindow'.'SDL2.dll'.'SDL_RenderGetWindow' +++'_SDL_bsearch'.'SDL2.dll'.'SDL_bsearch' +++'_SDL_GameControllerPathForIndex'.'SDL2.dll'.'SDL_GameControllerPathForIndex' +++'_SDL_GameControllerPath'.'SDL2.dll'.'SDL_GameControllerPath' +++'_SDL_JoystickPathForIndex'.'SDL2.dll'.'SDL_JoystickPathForIndex' +++'_SDL_JoystickPath'.'SDL2.dll'.'SDL_JoystickPath' +++'_SDL_JoystickAttachVirtualEx'.'SDL2.dll'.'SDL_JoystickAttachVirtualEx' +++'_SDL_GameControllerGetFirmwareVersion'.'SDL2.dll'.'SDL_GameControllerGetFirmwareVersion' +++'_SDL_JoystickGetFirmwareVersion'.'SDL2.dll'.'SDL_JoystickGetFirmwareVersion' +++'_SDL_GUIDToString'.'SDL2.dll'.'SDL_GUIDToString' +++'_SDL_GUIDFromString'.'SDL2.dll'.'SDL_GUIDFromString' +++'_SDL_HasLSX'.'SDL2.dll'.'SDL_HasLSX' +++'_SDL_HasLASX'.'SDL2.dll'.'SDL_HasLASX' +++'_SDL_RenderGetD3D12Device'.'SDL2.dll'.'SDL_RenderGetD3D12Device' +++'_SDL_utf8strnlen'.'SDL2.dll'.'SDL_utf8strnlen' +# ++'_SDL_GDKGetTaskQueue'.'SDL2.dll'.'SDL_GDKGetTaskQueue' +# ++'_SDL_GDKRunApp'.'SDL2.dll'.'SDL_GDKRunApp' +++'_SDL_GetOriginalMemoryFunctions'.'SDL2.dll'.'SDL_GetOriginalMemoryFunctions' +++'_SDL_ResetKeyboard'.'SDL2.dll'.'SDL_ResetKeyboard' +++'_SDL_GetDefaultAudioInfo'.'SDL2.dll'.'SDL_GetDefaultAudioInfo' +++'_SDL_GetPointDisplayIndex'.'SDL2.dll'.'SDL_GetPointDisplayIndex' +++'_SDL_GetRectDisplayIndex'.'SDL2.dll'.'SDL_GetRectDisplayIndex' +++'_SDL_ResetHint'.'SDL2.dll'.'SDL_ResetHint' +++'_SDL_crc16'.'SDL2.dll'.'SDL_crc16' diff -Nru libsdl2-2.0.22+dfsg/src/dynapi/SDL_dynapi.c libsdl2-2.24.0+dfsg/src/dynapi/SDL_dynapi.c --- libsdl2-2.0.22+dfsg/src/dynapi/SDL_dynapi.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/dynapi/SDL_dynapi.c 2022-08-13 03:48:10.000000000 +0000 @@ -71,11 +71,28 @@ #define SDL_DYNAPI_VARARGS(_static, name, initcall) \ _static int SDLCALL SDL_SetError##name(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ - char buf[512]; /* !!! FIXME: dynamic allocation */ \ - va_list ap; initcall; va_start(ap, fmt); \ - jump_table.SDL_vsnprintf(buf, sizeof (buf), fmt, ap); \ - va_end(ap); \ - return jump_table.SDL_SetError("%s", buf); \ + char buf[128], *str = buf; \ + int result; \ + va_list ap; initcall; \ + va_start(ap, fmt); \ + result = jump_table.SDL_vsnprintf(buf, sizeof(buf), fmt, ap); \ + va_end(ap); \ + if (result >= 0 && (size_t)result >= sizeof(buf)) { \ + size_t len = (size_t)result + 1; \ + str = (char *)jump_table.SDL_malloc(len); \ + if (str) { \ + va_start(ap, fmt); \ + result = jump_table.SDL_vsnprintf(str, len, fmt, ap); \ + va_end(ap); \ + } \ + } \ + if (result >= 0) { \ + result = jump_table.SDL_SetError("%s", str); \ + } \ + if (str != buf) { \ + jump_table.SDL_free(str); \ + } \ + return result; \ } \ _static int SDLCALL SDL_sscanf##name(const char *buf, SDL_SCANF_FORMAT_STRING const char *fmt, ...) { \ int retval; va_list ap; initcall; va_start(ap, fmt); \ @@ -274,7 +291,7 @@ { const char *caption = "SDL Dynamic API Failure!"; /* SDL_ShowSimpleMessageBox() is a too heavy for here. */ - #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) + #if (defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) MessageBoxA(NULL, msg, caption, MB_OK | MB_ICONERROR); #elif defined(HAVE_STDIO_H) fprintf(stderr, "\n\n%s\n%s\n\n", caption, msg); diff -Nru libsdl2-2.0.22+dfsg/src/dynapi/SDL_dynapi.h libsdl2-2.24.0+dfsg/src/dynapi/SDL_dynapi.h --- libsdl2-2.0.22+dfsg/src/dynapi/SDL_dynapi.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/dynapi/SDL_dynapi.h 2022-06-16 20:16:31.000000000 +0000 @@ -51,6 +51,8 @@ #define SDL_DYNAMIC_API 0 #elif defined(SDL_BUILDING_WINRT) && SDL_BUILDING_WINRT /* probably not useful on WinRT, given current .dll loading restrictions */ #define SDL_DYNAMIC_API 0 +#elif defined(__PS2__) && __PS2__ +#define SDL_DYNAMIC_API 0 #elif defined(__PSP__) && __PSP__ #define SDL_DYNAMIC_API 0 #elif defined(__riscos__) && __riscos__ /* probably not useful on RISC OS, since dlopen() can't be used when using static linking. */ @@ -59,6 +61,8 @@ #define SDL_DYNAMIC_API 0 /* Turn off for static analysis, so reports are more clear. */ #elif defined(__VITA__) #define SDL_DYNAMIC_API 0 /* vitasdk doesn't support dynamic linking */ +#elif defined(__NGAGE__) +#define SDL_DYNAMIC_API 0 /* The N-Gage doesn't support dynamic linking either */ #elif defined(DYNAPI_NEEDS_DLOPEN) && !defined(HAVE_DLOPEN) #define SDL_DYNAMIC_API 0 /* we need dlopen(), but don't have it.... */ #endif diff -Nru libsdl2-2.0.22+dfsg/src/dynapi/SDL_dynapi_overrides.h libsdl2-2.24.0+dfsg/src/dynapi/SDL_dynapi_overrides.h --- libsdl2-2.0.22+dfsg/src/dynapi/SDL_dynapi_overrides.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/dynapi/SDL_dynapi_overrides.h 2022-08-13 03:48:10.000000000 +0000 @@ -439,8 +439,6 @@ #define SDL_iconv_close SDL_iconv_close_REAL #define SDL_iconv SDL_iconv_REAL #define SDL_iconv_string SDL_iconv_string_REAL -#define SDL_CreateRGBSurfaceWithFormat SDL_CreateRGBSurfaceWithFormat_REAL -#define SDL_CreateRGBSurfaceWithFormatFrom SDL_CreateRGBSurfaceWithFormatFrom_REAL #define SDL_CreateRGBSurface SDL_CreateRGBSurface_REAL #define SDL_CreateRGBSurfaceFrom SDL_CreateRGBSurfaceFrom_REAL #define SDL_FreeSurface SDL_FreeSurface_REAL @@ -577,7 +575,6 @@ #define SDL_WarpMouseGlobal SDL_WarpMouseGlobal_REAL #define SDL_WinRTGetFSPathUNICODE SDL_WinRTGetFSPathUNICODE_REAL #define SDL_WinRTGetFSPathUTF8 SDL_WinRTGetFSPathUTF8_REAL -#define SDL_WinRTRunApp SDL_WinRTRunApp_REAL #define SDL_sqrtf SDL_sqrtf_REAL #define SDL_tan SDL_tan_REAL #define SDL_tanf SDL_tanf_REAL @@ -753,7 +750,6 @@ #define SDL_JoystickDetachVirtual SDL_JoystickDetachVirtual_REAL #define SDL_JoystickIsVirtual SDL_JoystickIsVirtual_REAL #define SDL_JoystickSetVirtualAxis SDL_JoystickSetVirtualAxis_REAL -#define SDL_JoystickSetVirtualBall SDL_JoystickSetVirtualBall_REAL #define SDL_JoystickSetVirtualButton SDL_JoystickSetVirtualButton_REAL #define SDL_JoystickSetVirtualHat SDL_JoystickSetVirtualHat_REAL #define SDL_GetErrorMsg SDL_GetErrorMsg_REAL @@ -865,3 +861,26 @@ #define SDL_EncloseFPoints SDL_EncloseFPoints_REAL #define SDL_IntersectFRectAndLine SDL_IntersectFRectAndLine_REAL #define SDL_RenderGetWindow SDL_RenderGetWindow_REAL +#define SDL_bsearch SDL_bsearch_REAL +#define SDL_GameControllerPathForIndex SDL_GameControllerPathForIndex_REAL +#define SDL_GameControllerPath SDL_GameControllerPath_REAL +#define SDL_JoystickPathForIndex SDL_JoystickPathForIndex_REAL +#define SDL_JoystickPath SDL_JoystickPath_REAL +#define SDL_JoystickAttachVirtualEx SDL_JoystickAttachVirtualEx_REAL +#define SDL_GameControllerGetFirmwareVersion SDL_GameControllerGetFirmwareVersion_REAL +#define SDL_JoystickGetFirmwareVersion SDL_JoystickGetFirmwareVersion_REAL +#define SDL_GUIDToString SDL_GUIDToString_REAL +#define SDL_GUIDFromString SDL_GUIDFromString_REAL +#define SDL_HasLSX SDL_HasLSX_REAL +#define SDL_HasLASX SDL_HasLASX_REAL +#define SDL_RenderGetD3D12Device SDL_RenderGetD3D12Device_REAL +#define SDL_utf8strnlen SDL_utf8strnlen_REAL +#define SDL_GDKGetTaskQueue SDL_GDKGetTaskQueue_REAL +#define SDL_GDKRunApp SDL_GDKRunApp_REAL +#define SDL_GetOriginalMemoryFunctions SDL_GetOriginalMemoryFunctions_REAL +#define SDL_ResetKeyboard SDL_ResetKeyboard_REAL +#define SDL_GetDefaultAudioInfo SDL_GetDefaultAudioInfo_REAL +#define SDL_GetPointDisplayIndex SDL_GetPointDisplayIndex_REAL +#define SDL_GetRectDisplayIndex SDL_GetRectDisplayIndex_REAL +#define SDL_ResetHint SDL_ResetHint_REAL +#define SDL_crc16 SDL_crc16_REAL diff -Nru libsdl2-2.0.22+dfsg/src/dynapi/SDL_dynapi_procs.h libsdl2-2.24.0+dfsg/src/dynapi/SDL_dynapi_procs.h --- libsdl2-2.0.22+dfsg/src/dynapi/SDL_dynapi_procs.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/dynapi/SDL_dynapi_procs.h 2022-08-13 03:48:10.000000000 +0000 @@ -48,7 +48,7 @@ #undef SDL_CreateThread #endif -#if defined(__WIN32__) +#if defined(__WIN32__) || defined(__GDK__) SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *b, void *c, pfnSDL_CurrentBeginThread d, pfnSDL_CurrentEndThread e),(a,b,c,d,e),return) #elif defined(__OS2__) SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *b, void *c, pfnSDL_CurrentBeginThread d, pfnSDL_CurrentEndThread e),(a,b,c,d,e),return) @@ -62,15 +62,18 @@ SDL_DYNAPI_PROC(SDL_RWops*,SDL_RWFromFP,(void *a, SDL_bool b),(a,b),return) #endif -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__GDK__) SDL_DYNAPI_PROC(int,SDL_RegisterApp,(const char *a, Uint32 b, void *c),(a,b,c),return) SDL_DYNAPI_PROC(void,SDL_UnregisterApp,(void),(),) +#endif + +#if defined(__WIN32__) || defined(__WINGDK__) SDL_DYNAPI_PROC(int,SDL_Direct3D9GetAdapterIndex,(int a),(a),return) SDL_DYNAPI_PROC(IDirect3DDevice9*,SDL_RenderGetD3D9Device,(SDL_Renderer *a),(a),return) #endif #ifdef __IPHONEOS__ -SDL_DYNAPI_PROC(int,SDL_iPhoneSetAnimationCallback,(SDL_Window *a, int b, void c, void *d),(a,b,c,d),return) +SDL_DYNAPI_PROC(int,SDL_iPhoneSetAnimationCallback,(SDL_Window *a, int b, void (SDLCALL *c)(void *), void *d),(a,b,c,d),return) SDL_DYNAPI_PROC(void,SDL_iPhoneSetEventPump,(SDL_bool a),(a),) #endif @@ -257,7 +260,7 @@ SDL_DYNAPI_PROC(void,SDL_StartTextInput,(void),(),) SDL_DYNAPI_PROC(SDL_bool,SDL_IsTextInputActive,(void),(),return) SDL_DYNAPI_PROC(void,SDL_StopTextInput,(void),(),) -SDL_DYNAPI_PROC(void,SDL_SetTextInputRect,(SDL_Rect *a),(a),) +SDL_DYNAPI_PROC(void,SDL_SetTextInputRect,(const SDL_Rect *a),(a),) SDL_DYNAPI_PROC(SDL_bool,SDL_HasScreenKeyboardSupport,(void),(),return) SDL_DYNAPI_PROC(SDL_bool,SDL_IsScreenKeyboardShown,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(void*,SDL_LoadObject,(const char *a),(a),return) @@ -408,7 +411,7 @@ SDL_DYNAPI_PROC(void,SDL_free,(void *a),(a),) SDL_DYNAPI_PROC(char*,SDL_getenv,(const char *a),(a),return) SDL_DYNAPI_PROC(int,SDL_setenv,(const char *a, const char *b, int c),(a,b,c),return) -SDL_DYNAPI_PROC(void,SDL_qsort,(void *a, size_t b, size_t c, int (*d)(const void *, const void *)),(a,b,c,d),) +SDL_DYNAPI_PROC(void,SDL_qsort,(void *a, size_t b, size_t c, int (SDLCALL *d)(const void *, const void *)),(a,b,c,d),) SDL_DYNAPI_PROC(int,SDL_abs,(int a),(a),return) SDL_DYNAPI_PROC(int,SDL_isdigit,(int a),(a),return) SDL_DYNAPI_PROC(int,SDL_isspace,(int a),(a),return) @@ -508,7 +511,7 @@ SDL_DYNAPI_PROC(void,SDL_DetachThread,(SDL_Thread *a),(a),) SDL_DYNAPI_PROC(SDL_TLSID,SDL_TLSCreate,(void),(),return) SDL_DYNAPI_PROC(void*,SDL_TLSGet,(SDL_TLSID a),(a),return) -SDL_DYNAPI_PROC(int,SDL_TLSSet,(SDL_TLSID a, const void *b, void (*c)(void*)),(a,b,c),return) +SDL_DYNAPI_PROC(int,SDL_TLSSet,(SDL_TLSID a, const void *b, void (SDLCALL *c)(void*)),(a,b,c),return) SDL_DYNAPI_PROC(Uint32,SDL_GetTicks,(void),(),return) SDL_DYNAPI_PROC(Uint64,SDL_GetPerformanceCounter,(void),(),return) SDL_DYNAPI_PROC(Uint64,SDL_GetPerformanceFrequency,(void),(),return) @@ -599,7 +602,7 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_HasAVX,(void),(),return) SDL_DYNAPI_PROC(SDL_AssertionHandler,SDL_GetDefaultAssertionHandler,(void),(),return) SDL_DYNAPI_PROC(SDL_AssertionHandler,SDL_GetAssertionHandler,(void **a),(a),return) -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__WINGDK__) SDL_DYNAPI_PROC(SDL_bool,SDL_DXGIGetOutputInfo,(int a,int *b, int *c),(a,b,c),return) #endif SDL_DYNAPI_PROC(SDL_bool,SDL_RenderIsClipEnabled,(SDL_Renderer *a),(a),return) @@ -620,7 +623,7 @@ SDL_DYNAPI_PROC(Uint32,SDL_GetQueuedAudioSize,(SDL_AudioDeviceID a),(a),return) SDL_DYNAPI_PROC(void,SDL_ClearQueuedAudio,(SDL_AudioDeviceID a),(a),) SDL_DYNAPI_PROC(SDL_Window*,SDL_GetGrabbedWindow,(void),(),return) -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__GDK__) SDL_DYNAPI_PROC(void,SDL_SetWindowsMessageHook,(SDL_WindowsMessageHook a, void *b),(a,b),) #endif SDL_DYNAPI_PROC(int,SDL_GetDisplayDPI,(int a, float *b, float *c, float *d),(a,b,c,d),return) @@ -744,7 +747,7 @@ #undef SDL_CreateThreadWithStackSize #endif -#if defined(__WIN32__) +#if defined(__WIN32__) || defined(__GDK__) SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThreadWithStackSize,(SDL_ThreadFunction a, const char *b, const size_t c, void *d, pfnSDL_CurrentBeginThread e, pfnSDL_CurrentEndThread f),(a,b,c,d,e,f),return) #elif defined(__OS2__) SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThreadWithStackSize,(SDL_ThreadFunction a, const char *b, const size_t c, void *d, pfnSDL_CurrentBeginThread e, pfnSDL_CurrentEndThread f),(a,b,c,d,e,f),return) @@ -854,7 +857,7 @@ SDL_DYNAPI_PROC(long,SDL_lround,(double a),(a),return) SDL_DYNAPI_PROC(long,SDL_lroundf,(float a),(a),return) SDL_DYNAPI_PROC(int,SDL_SoftStretchLinear,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, const SDL_Rect *d),(a,b,c,d),return) -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__WINGDK__) SDL_DYNAPI_PROC(ID3D11Device*,SDL_RenderGetD3D11Device,(SDL_Renderer *a),(a),return) #endif SDL_DYNAPI_PROC(int,SDL_UpdateNVTexture,(SDL_Texture *a, const SDL_Rect *b, const Uint8 *c, int d, const Uint8 *e, int f),(a,b,c,d,e,f),return) @@ -936,3 +939,31 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_EncloseFPoints,(const SDL_FPoint *a, int b, const SDL_FRect *c, SDL_FRect *d),(a,b,c,d),return) SDL_DYNAPI_PROC(SDL_bool,SDL_IntersectFRectAndLine,(const SDL_FRect *a, float *b, float *c, float *d, float *e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(SDL_Window*,SDL_RenderGetWindow,(SDL_Renderer *a),(a),return) +SDL_DYNAPI_PROC(void*,SDL_bsearch,(const void *a, const void *b, size_t c, size_t d, int (SDLCALL *e)(const void *, const void *)),(a,b,c,d,e),return) +SDL_DYNAPI_PROC(const char*,SDL_GameControllerPathForIndex,(int a),(a),return) +SDL_DYNAPI_PROC(const char*,SDL_GameControllerPath,(SDL_GameController *a),(a),return) +SDL_DYNAPI_PROC(const char*,SDL_JoystickPathForIndex,(int a),(a),return) +SDL_DYNAPI_PROC(const char*,SDL_JoystickPath,(SDL_Joystick *a),(a),return) +SDL_DYNAPI_PROC(int,SDL_JoystickAttachVirtualEx,(const SDL_VirtualJoystickDesc *a),(a),return) +SDL_DYNAPI_PROC(Uint16,SDL_GameControllerGetFirmwareVersion,(SDL_GameController *a),(a),return) +SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetFirmwareVersion,(SDL_Joystick *a),(a),return) +SDL_DYNAPI_PROC(void,SDL_GUIDToString,(SDL_GUID a, char *b, int c),(a,b,c),) +SDL_DYNAPI_PROC(SDL_GUID,SDL_GUIDFromString,(const char *a),(a),return) +SDL_DYNAPI_PROC(SDL_bool,SDL_HasLSX,(void),(),return) +SDL_DYNAPI_PROC(SDL_bool,SDL_HasLASX,(void),(),return) +#if defined(__WIN32__) || defined(__GDK__) +SDL_DYNAPI_PROC(ID3D12Device*,SDL_RenderGetD3D12Device,(SDL_Renderer *a),(a),return) +#endif +SDL_DYNAPI_PROC(size_t,SDL_utf8strnlen,(const char *a, size_t b),(a,b),return) + +#if defined(__GDK__) +SDL_DYNAPI_PROC(int,SDL_GDKGetTaskQueue,(XTaskQueueHandle *a),(a),return) +SDL_DYNAPI_PROC(int,SDL_GDKRunApp,(SDL_main_func a, void *b),(a,b),return) +#endif +SDL_DYNAPI_PROC(void,SDL_GetOriginalMemoryFunctions,(SDL_malloc_func *a, SDL_calloc_func *b, SDL_realloc_func *c, SDL_free_func *d),(a,b,c,d),) +SDL_DYNAPI_PROC(void,SDL_ResetKeyboard,(void),(),) +SDL_DYNAPI_PROC(int,SDL_GetDefaultAudioInfo,(char **a, SDL_AudioSpec *b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(int,SDL_GetPointDisplayIndex,(const SDL_Point *a),(a),return) +SDL_DYNAPI_PROC(int,SDL_GetRectDisplayIndex,(const SDL_Rect *a),(a),return) +SDL_DYNAPI_PROC(SDL_bool,SDL_ResetHint,(const char *a),(a),return) +SDL_DYNAPI_PROC(Uint16,SDL_crc16,(Uint16 a, const void *b, size_t c),(a,b,c),return) diff -Nru libsdl2-2.0.22+dfsg/src/events/scancodes_ascii.h libsdl2-2.24.0+dfsg/src/events/scancodes_ascii.h --- libsdl2-2.0.22+dfsg/src/events/scancodes_ascii.h 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/events/scancodes_ascii.h 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,170 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "SDL_scancode.h" +#include "SDL_keycode.h" + +/* + This file is used to convert between characters passed in from an ASCII + virtual keyboard in US layout and tuples of SDL_Scancode and SDL_keymods. + + For example ASCIIKeyInfoTable['a'] would give you the scan code and keymod + for lower case a. +*/ + +typedef struct +{ + SDL_Scancode code; + uint16_t mod; +} ASCIIKeyInfo; + +static ASCIIKeyInfo SDL_ASCIIKeyInfoTable[] = { +/* 0 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 1 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 2 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 3 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 4 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 5 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 6 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 7 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 8 */ { SDL_SCANCODE_BACKSPACE, 0 }, +/* 9 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 10 */ { SDL_SCANCODE_RETURN, 0 }, +/* 11 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 12 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 13 */ { SDL_SCANCODE_RETURN, 0 }, +/* 14 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 15 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 16 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 17 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 18 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 19 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 20 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 21 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 22 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 23 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 24 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 25 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 26 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 27 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 28 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 29 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 30 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 31 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 32 */ { SDL_SCANCODE_SPACE, 0 }, +/* 33 */ { SDL_SCANCODE_1, KMOD_SHIFT }, /* plus shift modifier '!' */ +/* 34 */ { SDL_SCANCODE_APOSTROPHE, KMOD_SHIFT }, /* plus shift modifier '"' */ +/* 35 */ { SDL_SCANCODE_3, KMOD_SHIFT }, /* plus shift modifier '#' */ +/* 36 */ { SDL_SCANCODE_4, KMOD_SHIFT }, /* plus shift modifier '$' */ +/* 37 */ { SDL_SCANCODE_5, KMOD_SHIFT }, /* plus shift modifier '%' */ +/* 38 */ { SDL_SCANCODE_7, KMOD_SHIFT }, /* plus shift modifier '&' */ +/* 39 */ { SDL_SCANCODE_APOSTROPHE, 0 }, /* ''' */ +/* 40 */ { SDL_SCANCODE_9, KMOD_SHIFT }, /* plus shift modifier '(' */ +/* 41 */ { SDL_SCANCODE_0, KMOD_SHIFT }, /* plus shift modifier ')' */ +/* 42 */ { SDL_SCANCODE_8, KMOD_SHIFT }, /* '*' */ +/* 43 */ { SDL_SCANCODE_EQUALS, KMOD_SHIFT }, /* plus shift modifier '+' */ +/* 44 */ { SDL_SCANCODE_COMMA, 0 }, /* ',' */ +/* 45 */ { SDL_SCANCODE_MINUS, 0 }, /* '-' */ +/* 46 */ { SDL_SCANCODE_PERIOD, 0 }, /* '.' */ +/* 47 */ { SDL_SCANCODE_SLASH, 0 }, /* '/' */ +/* 48 */ { SDL_SCANCODE_0, 0 }, +/* 49 */ { SDL_SCANCODE_1, 0 }, +/* 50 */ { SDL_SCANCODE_2, 0 }, +/* 51 */ { SDL_SCANCODE_3, 0 }, +/* 52 */ { SDL_SCANCODE_4, 0 }, +/* 53 */ { SDL_SCANCODE_5, 0 }, +/* 54 */ { SDL_SCANCODE_6, 0 }, +/* 55 */ { SDL_SCANCODE_7, 0 }, +/* 56 */ { SDL_SCANCODE_8, 0 }, +/* 57 */ { SDL_SCANCODE_9, 0 }, +/* 58 */ { SDL_SCANCODE_SEMICOLON, KMOD_SHIFT }, /* plus shift modifier ';' */ +/* 59 */ { SDL_SCANCODE_SEMICOLON, 0 }, +/* 60 */ { SDL_SCANCODE_COMMA, KMOD_SHIFT }, /* plus shift modifier '<' */ +/* 61 */ { SDL_SCANCODE_EQUALS, 0 }, +/* 62 */ { SDL_SCANCODE_PERIOD, KMOD_SHIFT }, /* plus shift modifier '>' */ +/* 63 */ { SDL_SCANCODE_SLASH, KMOD_SHIFT }, /* plus shift modifier '?' */ +/* 64 */ { SDL_SCANCODE_2, KMOD_SHIFT }, /* plus shift modifier '@' */ +/* 65 */ { SDL_SCANCODE_A, KMOD_SHIFT }, /* all the following need shift modifiers */ +/* 66 */ { SDL_SCANCODE_B, KMOD_SHIFT }, +/* 67 */ { SDL_SCANCODE_C, KMOD_SHIFT }, +/* 68 */ { SDL_SCANCODE_D, KMOD_SHIFT }, +/* 69 */ { SDL_SCANCODE_E, KMOD_SHIFT }, +/* 70 */ { SDL_SCANCODE_F, KMOD_SHIFT }, +/* 71 */ { SDL_SCANCODE_G, KMOD_SHIFT }, +/* 72 */ { SDL_SCANCODE_H, KMOD_SHIFT }, +/* 73 */ { SDL_SCANCODE_I, KMOD_SHIFT }, +/* 74 */ { SDL_SCANCODE_J, KMOD_SHIFT }, +/* 75 */ { SDL_SCANCODE_K, KMOD_SHIFT }, +/* 76 */ { SDL_SCANCODE_L, KMOD_SHIFT }, +/* 77 */ { SDL_SCANCODE_M, KMOD_SHIFT }, +/* 78 */ { SDL_SCANCODE_N, KMOD_SHIFT }, +/* 79 */ { SDL_SCANCODE_O, KMOD_SHIFT }, +/* 80 */ { SDL_SCANCODE_P, KMOD_SHIFT }, +/* 81 */ { SDL_SCANCODE_Q, KMOD_SHIFT }, +/* 82 */ { SDL_SCANCODE_R, KMOD_SHIFT }, +/* 83 */ { SDL_SCANCODE_S, KMOD_SHIFT }, +/* 84 */ { SDL_SCANCODE_T, KMOD_SHIFT }, +/* 85 */ { SDL_SCANCODE_U, KMOD_SHIFT }, +/* 86 */ { SDL_SCANCODE_V, KMOD_SHIFT }, +/* 87 */ { SDL_SCANCODE_W, KMOD_SHIFT }, +/* 88 */ { SDL_SCANCODE_X, KMOD_SHIFT }, +/* 89 */ { SDL_SCANCODE_Y, KMOD_SHIFT }, +/* 90 */ { SDL_SCANCODE_Z, KMOD_SHIFT }, +/* 91 */ { SDL_SCANCODE_LEFTBRACKET, 0 }, +/* 92 */ { SDL_SCANCODE_BACKSLASH, 0 }, +/* 93 */ { SDL_SCANCODE_RIGHTBRACKET, 0 }, +/* 94 */ { SDL_SCANCODE_6, KMOD_SHIFT }, /* plus shift modifier '^' */ +/* 95 */ { SDL_SCANCODE_MINUS, KMOD_SHIFT }, /* plus shift modifier '_' */ +/* 96 */ { SDL_SCANCODE_GRAVE, KMOD_SHIFT }, /* '`' */ +/* 97 */ { SDL_SCANCODE_A, 0 }, +/* 98 */ { SDL_SCANCODE_B, 0 }, +/* 99 */ { SDL_SCANCODE_C, 0 }, +/* 100 */ { SDL_SCANCODE_D, 0 }, +/* 101 */ { SDL_SCANCODE_E, 0 }, +/* 102 */ { SDL_SCANCODE_F, 0 }, +/* 103 */ { SDL_SCANCODE_G, 0 }, +/* 104 */ { SDL_SCANCODE_H, 0 }, +/* 105 */ { SDL_SCANCODE_I, 0 }, +/* 106 */ { SDL_SCANCODE_J, 0 }, +/* 107 */ { SDL_SCANCODE_K, 0 }, +/* 108 */ { SDL_SCANCODE_L, 0 }, +/* 109 */ { SDL_SCANCODE_M, 0 }, +/* 110 */ { SDL_SCANCODE_N, 0 }, +/* 111 */ { SDL_SCANCODE_O, 0 }, +/* 112 */ { SDL_SCANCODE_P, 0 }, +/* 113 */ { SDL_SCANCODE_Q, 0 }, +/* 114 */ { SDL_SCANCODE_R, 0 }, +/* 115 */ { SDL_SCANCODE_S, 0 }, +/* 116 */ { SDL_SCANCODE_T, 0 }, +/* 117 */ { SDL_SCANCODE_U, 0 }, +/* 118 */ { SDL_SCANCODE_V, 0 }, +/* 119 */ { SDL_SCANCODE_W, 0 }, +/* 120 */ { SDL_SCANCODE_X, 0 }, +/* 121 */ { SDL_SCANCODE_Y, 0 }, +/* 122 */ { SDL_SCANCODE_Z, 0 }, +/* 123 */ { SDL_SCANCODE_LEFTBRACKET, KMOD_SHIFT }, /* plus shift modifier '{' */ +/* 124 */ { SDL_SCANCODE_BACKSLASH, KMOD_SHIFT }, /* plus shift modifier '|' */ +/* 125 */ { SDL_SCANCODE_RIGHTBRACKET, KMOD_SHIFT }, /* plus shift modifier '}' */ +/* 126 */ { SDL_SCANCODE_GRAVE, KMOD_SHIFT }, /* plus shift modifier '~' */ +/* 127 */ { SDL_SCANCODE_BACKSPACE, KMOD_SHIFT } +}; + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/events/scancodes_darwin.h libsdl2-2.24.0+dfsg/src/events/scancodes_darwin.h --- libsdl2-2.0.22+dfsg/src/events/scancodes_darwin.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/events/scancodes_darwin.h 2022-06-02 02:01:57.000000000 +0000 @@ -25,7 +25,7 @@ - Apple USB keyboard driver source - experimentation on various ADB and USB ISO keyboards and one ADB ANSI keyboard */ -/* *INDENT-OFF* */ +/* *INDENT-OFF* */ /* clang-format off */ static const SDL_Scancode darwin_scancode_table[] = { /* 0 */ SDL_SCANCODE_A, /* 1 */ SDL_SCANCODE_S, @@ -156,4 +156,4 @@ /* 126 */ SDL_SCANCODE_UP, /* 127 */ SDL_SCANCODE_POWER }; -/* *INDENT-ON* */ +/* *INDENT-ON* */ /* clang-format on */ diff -Nru libsdl2-2.0.22+dfsg/src/events/scancodes_linux.h libsdl2-2.24.0+dfsg/src/events/scancodes_linux.h --- libsdl2-2.0.22+dfsg/src/events/scancodes_linux.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/events/scancodes_linux.h 2022-06-02 02:01:57.000000000 +0000 @@ -24,7 +24,7 @@ Sources: - Linux kernel source input.h */ -/* *INDENT-OFF* */ +/* *INDENT-OFF* */ /* clang-format off */ static SDL_Scancode const linux_scancode_table[] = { /* 0 */ SDL_SCANCODE_UNKNOWN, /* 1 */ SDL_SCANCODE_ESCAPE, @@ -260,4 +260,4 @@ /* 235 */ SDL_SCANCODE_UNKNOWN, /* KEY_DOCUMENTS */ /* 236 */ SDL_SCANCODE_UNKNOWN, /* KEY_BATTERY */ }; -/* *INDENT-ON* */ +/* *INDENT-ON* */ /* clang-format on */ diff -Nru libsdl2-2.0.22+dfsg/src/events/scancodes_windows.h libsdl2-2.24.0+dfsg/src/events/scancodes_windows.h --- libsdl2-2.0.22+dfsg/src/events/scancodes_windows.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/events/scancodes_windows.h 2022-06-02 02:01:57.000000000 +0000 @@ -23,7 +23,7 @@ /* Windows scancode to SDL scancode mapping table */ /* derived from Microsoft scan code document, http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/scancode.doc */ -/* *INDENT-OFF* */ +/* *INDENT-OFF* */ /* clang-format off */ static const SDL_Scancode windows_scancode_table[] = { /* 0 1 2 3 4 5 6 7 */ @@ -52,4 +52,4 @@ SDL_SCANCODE_INTERNATIONAL2, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_INTERNATIONAL1, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, /* 7 */ SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_INTERNATIONAL4, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_INTERNATIONAL5, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_INTERNATIONAL3, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN /* 7 */ }; -/* *INDENT-ON* */ +/* *INDENT-ON* */ /* clang-format on */ diff -Nru libsdl2-2.0.22+dfsg/src/events/scancodes_xfree86.h libsdl2-2.24.0+dfsg/src/events/scancodes_xfree86.h --- libsdl2-2.0.22+dfsg/src/events/scancodes_xfree86.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/events/scancodes_xfree86.h 2022-06-02 02:01:57.000000000 +0000 @@ -28,7 +28,7 @@ Sources: - atKeyNames.h from XFree86 source code */ -/* *INDENT-OFF* */ +/* *INDENT-OFF* */ /* clang-format off */ static const SDL_Scancode xfree86_scancode_table[] = { /* 0 */ SDL_SCANCODE_UNKNOWN, /* 1 */ SDL_SCANCODE_ESCAPE, @@ -509,4 +509,4 @@ #endif /* scancodes_xfree86_h_ */ -/* *INDENT-ON* */ +/* *INDENT-ON* */ /* clang-format on */ diff -Nru libsdl2-2.0.22+dfsg/src/events/SDL_events.c libsdl2-2.24.0+dfsg/src/events/SDL_events.c --- libsdl2-2.0.22+dfsg/src/events/SDL_events.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/events/SDL_events.c 2022-08-13 03:48:10.000000000 +0000 @@ -35,7 +35,7 @@ #include "SDL_syswm.h" #undef SDL_PRIs64 -#if defined(__WIN32__) && !defined(__CYGWIN__) +#if (defined(__WIN32__) || defined(__GDK__)) && !defined(__CYGWIN__) #define SDL_PRIs64 "I64d" #else #define SDL_PRIs64 "lld" @@ -102,9 +102,9 @@ static SDL_bool SDL_update_joysticks = SDL_TRUE; static void -SDL_CalculateShouldUpdateJoysticks() +SDL_CalculateShouldUpdateJoysticks(SDL_bool hint_value) { - if (SDL_GetHintBoolean(SDL_HINT_AUTO_UPDATE_JOYSTICKS, SDL_TRUE) && + if (hint_value && (!SDL_disabled_events[SDL_JOYAXISMOTION >> 8] || SDL_JoystickEventState(SDL_QUERY))) { SDL_update_joysticks = SDL_TRUE; } else { @@ -115,7 +115,7 @@ static void SDLCALL SDL_AutoUpdateJoysticksChanged(void *userdata, const char *name, const char *oldValue, const char *hint) { - SDL_CalculateShouldUpdateJoysticks(); + SDL_CalculateShouldUpdateJoysticks(SDL_GetStringBoolean(hint, SDL_TRUE)); } #endif /* !SDL_JOYSTICK_DISABLED */ @@ -126,9 +126,9 @@ static SDL_bool SDL_update_sensors = SDL_TRUE; static void -SDL_CalculateShouldUpdateSensors() +SDL_CalculateShouldUpdateSensors(SDL_bool hint_value) { - if (SDL_GetHintBoolean(SDL_HINT_AUTO_UPDATE_SENSORS, SDL_TRUE) && + if (hint_value && !SDL_disabled_events[SDL_SENSORUPDATE >> 8]) { SDL_update_sensors = SDL_TRUE; } else { @@ -139,7 +139,7 @@ static void SDLCALL SDL_AutoUpdateSensorsChanged(void *userdata, const char *name, const char *oldValue, const char *hint) { - SDL_CalculateShouldUpdateSensors(); + SDL_CalculateShouldUpdateSensors(SDL_GetStringBoolean(hint, SDL_TRUE)); } #endif /* !SDL_SENSOR_DISABLED */ @@ -150,13 +150,19 @@ SDL_EventState(SDL_POLLSENTINEL, SDL_GetStringBoolean(hint, SDL_TRUE) ? SDL_ENABLE : SDL_DISABLE); } -/* 0 (default) means no logging, 1 means logging, 2 means logging with mouse and finger motion */ -static int SDL_DoEventLogging = 0; +/** + * Verbosity of logged events as defined in SDL_HINT_EVENT_LOGGING: + * - 0: (default) no logging + * - 1: logging of most events + * - 2: as above, plus mouse and finger motion + * - 3: as above, plus SDL_SysWMEvents + */ +static int SDL_EventLoggingVerbosity = 0; static void SDLCALL SDL_EventLoggingChanged(void *userdata, const char *name, const char *oldValue, const char *hint) { - SDL_DoEventLogging = (hint && *hint) ? SDL_clamp(SDL_atoi(hint), 0, 2) : 0; + SDL_EventLoggingVerbosity = (hint && *hint) ? SDL_clamp(SDL_atoi(hint), 0, 3) : 0; } static void @@ -166,7 +172,7 @@ char details[128]; /* sensor/mouse/finger motion are spammy, ignore these if they aren't demanded. */ - if ( (SDL_DoEventLogging < 2) && + if ( (SDL_EventLoggingVerbosity < 2) && ( (event->type == SDL_MOUSEMOTION) || (event->type == SDL_FINGERMOTION) || (event->type == SDL_CONTROLLERTOUCHPADMOTION) || @@ -175,6 +181,11 @@ return; } + /* window manager events are even more spammy, and don't provide much useful info. */ + if ((SDL_EventLoggingVerbosity < 3) && (event->type == SDL_SYSWMEVENT)) { + return; + } + /* this is to make SDL_snprintf() calls cleaner. */ #define uint unsigned int @@ -590,7 +601,7 @@ SDL_EventQ.free = entry->next; } - if (SDL_DoEventLogging) { + if (SDL_EventLoggingVerbosity > 0) { SDL_LogEvent(event); } @@ -892,13 +903,12 @@ #if !SDL_JOYSTICK_DISABLED need_periodic_poll = - SDL_WasInit(SDL_INIT_JOYSTICK) && - (!SDL_disabled_events[SDL_JOYAXISMOTION >> 8] || SDL_JoystickEventState(SDL_QUERY)); + SDL_WasInit(SDL_INIT_JOYSTICK) && SDL_update_joysticks; #endif #if !SDL_SENSOR_DISABLED need_periodic_poll = need_periodic_poll || - (SDL_WasInit(SDL_INIT_SENSOR) && !SDL_disabled_events[SDL_SENSORUPDATE >> 8]); + (SDL_WasInit(SDL_INIT_SENSOR) && SDL_update_sensors); #endif return need_periodic_poll; @@ -962,7 +972,10 @@ status = _this->WaitEventTimeout(_this, loop_timeout); /* Set wakeup_window to NULL without holding the lock. */ _this->wakeup_window = NULL; - if (status <= 0) { + if (status == 0 && need_periodic_poll && loop_timeout == PERIODIC_POLL_INTERVAL_MS) { + /* We may have woken up to poll. Try again */ + continue; + } else if (status <= 0) { /* There is either an error or the timeout is elapsed: return */ return status; } @@ -980,13 +993,13 @@ #if !SDL_JOYSTICK_DISABLED need_polling = SDL_WasInit(SDL_INIT_JOYSTICK) && - (!SDL_disabled_events[SDL_JOYAXISMOTION >> 8] || SDL_JoystickEventState(SDL_QUERY)) && + SDL_update_joysticks && (SDL_NumJoysticks() > 0); #endif #if !SDL_SENSOR_DISABLED need_polling = need_polling || - (SDL_WasInit(SDL_INIT_SENSOR) && !SDL_disabled_events[SDL_SENSORUPDATE >> 8] && (SDL_NumSensors() > 0)); + (SDL_WasInit(SDL_INIT_SENSOR) && SDL_update_sensors && (SDL_NumSensors() > 0)); #endif return need_polling; @@ -1292,10 +1305,10 @@ } #if !SDL_JOYSTICK_DISABLED - SDL_CalculateShouldUpdateJoysticks(); + SDL_CalculateShouldUpdateJoysticks(SDL_GetHintBoolean(SDL_HINT_AUTO_UPDATE_JOYSTICKS, SDL_TRUE)); #endif #if !SDL_SENSOR_DISABLED - SDL_CalculateShouldUpdateSensors(); + SDL_CalculateShouldUpdateSensors(SDL_GetHintBoolean(SDL_HINT_AUTO_UPDATE_SENSORS, SDL_TRUE)); #endif } diff -Nru libsdl2-2.0.22+dfsg/src/events/SDL_gesture.c libsdl2-2.24.0+dfsg/src/events/SDL_gesture.c --- libsdl2-2.0.22+dfsg/src/events/SDL_gesture.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/events/SDL_gesture.c 2022-08-13 03:48:10.000000000 +0000 @@ -488,7 +488,7 @@ SDL_numGestureTouches--; if (i != SDL_numGestureTouches) { - SDL_memcpy(&SDL_gestureTouch[i], &SDL_gestureTouch[SDL_numGestureTouches], sizeof(SDL_gestureTouch[i])); + SDL_copyp(&SDL_gestureTouch[i], &SDL_gestureTouch[SDL_numGestureTouches]); } return 0; } diff -Nru libsdl2-2.0.22+dfsg/src/events/SDL_keyboard.c libsdl2-2.24.0+dfsg/src/events/SDL_keyboard.c --- libsdl2-2.0.22+dfsg/src/events/SDL_keyboard.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/events/SDL_keyboard.c 2022-08-13 03:48:10.000000000 +0000 @@ -27,6 +27,7 @@ #include "SDL_events.h" #include "SDL_events_c.h" #include "../video/SDL_sysvideo.h" +#include "scancodes_ascii.h" /* #define DEBUG_KEYBOARD */ @@ -282,6 +283,10 @@ SDLK_APP2, SDLK_AUDIOREWIND, SDLK_AUDIOFASTFORWARD, + SDLK_SOFTLEFT, + SDLK_SOFTRIGHT, + SDLK_CALL, + SDLK_ENDCALL, }; static const char *SDL_scancode_names[SDL_NUM_SCANCODES] = { @@ -518,6 +523,10 @@ "App2", "AudioRewind", "AudioFastForward", + "SoftLeft", + "SoftRight", + "Call", + "EndCall", }; /* Taken from SDL_iconv() */ @@ -551,11 +560,9 @@ int SDL_KeyboardInit(void) { - SDL_Keyboard *keyboard = &SDL_keyboard; - /* Set the default keymap */ - SDL_memcpy(keyboard->keymap, SDL_default_keymap, sizeof(SDL_default_keymap)); - return (0); + SDL_SetKeymap(0, SDL_default_keymap, SDL_NUM_SCANCODES, SDL_FALSE); + return 0; } void @@ -581,24 +588,36 @@ } void -SDL_SetKeymap(int start, SDL_Keycode * keys, int length) +SDL_SetKeymap(int start, const SDL_Keycode * keys, int length, SDL_bool send_event) { SDL_Keyboard *keyboard = &SDL_keyboard; SDL_Scancode scancode; + SDL_Keycode normalized_keymap[SDL_NUM_SCANCODES]; if (start < 0 || start + length > SDL_NUM_SCANCODES) { return; } - SDL_memcpy(&keyboard->keymap[start], keys, sizeof(*keys) * length); + SDL_memcpy(&normalized_keymap[start], keys, sizeof(*keys) * length); /* The number key scancodes always map to the number key keycodes. * On AZERTY layouts these technically are symbols, but users (and games) * always think of them and view them in UI as number keys. */ - keyboard->keymap[SDL_SCANCODE_0] = SDLK_0; + normalized_keymap[SDL_SCANCODE_0] = SDLK_0; for (scancode = SDL_SCANCODE_1; scancode <= SDL_SCANCODE_9; ++scancode) { - keyboard->keymap[scancode] = SDLK_1 + (scancode - SDL_SCANCODE_1); + normalized_keymap[scancode] = SDLK_1 + (scancode - SDL_SCANCODE_1); + } + + /* If the mapping didn't really change, we're done here */ + if (!SDL_memcmp(&keyboard->keymap[start], &normalized_keymap[start], sizeof(*keys) * length)) { + return; + } + + SDL_memcpy(&keyboard->keymap[start], &normalized_keymap[start], sizeof(*keys) * length); + + if (send_event) { + SDL_SendKeymapChangedEvent(); } } @@ -812,6 +831,33 @@ } int +SDL_SendKeyboardUnicodeKey(Uint32 ch) +{ + SDL_Scancode code = SDL_SCANCODE_UNKNOWN; + uint16_t mod = 0; + + if (ch < SDL_arraysize(SDL_ASCIIKeyInfoTable)) { + code = SDL_ASCIIKeyInfoTable[ch].code; + mod = SDL_ASCIIKeyInfoTable[ch].mod; + } + + if (mod & KMOD_SHIFT) { + /* If the character uses shift, press shift down */ + SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LSHIFT); + } + + /* Send a keydown and keyup for the character */ + SDL_SendKeyboardKey(SDL_PRESSED, code); + SDL_SendKeyboardKey(SDL_RELEASED, code); + + if (mod & KMOD_SHIFT) { + /* If the character uses shift, release shift */ + SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LSHIFT); + } + return 0; +} + +int SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode) { return SDL_SendKeyboardKeyInternal(KEYBOARD_HARDWARE, state, scancode); @@ -868,12 +914,16 @@ posted = 0; if (SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE) { SDL_Event event; - size_t i = 0, length = SDL_strlen(text); + size_t pos = 0, advance, length = SDL_strlen(text); event.text.type = SDL_TEXTINPUT; event.text.windowID = keyboard->focus ? keyboard->focus->id : 0; - while (i < length) { - i += SDL_utf8strlcpy(event.text.text, text + i, SDL_arraysize(event.text.text)); + while (pos < length) { + advance = SDL_utf8strlcpy(event.text.text, text + pos, SDL_arraysize(event.text.text)); + if (!advance) { + break; + } + pos += advance; posted |= (SDL_PushEvent(&event) > 0); } } diff -Nru libsdl2-2.0.22+dfsg/src/events/SDL_keyboard_c.h libsdl2-2.24.0+dfsg/src/events/SDL_keyboard_c.h --- libsdl2-2.0.22+dfsg/src/events/SDL_keyboard_c.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/events/SDL_keyboard_c.h 2022-08-13 03:48:10.000000000 +0000 @@ -29,14 +29,11 @@ /* Initialize the keyboard subsystem */ extern int SDL_KeyboardInit(void); -/* Clear the state of the keyboard */ -extern void SDL_ResetKeyboard(void); - /* Get the default keymap */ extern void SDL_GetDefaultKeymap(SDL_Keycode * keymap); /* Set the mapping of scancode to key codes */ -extern void SDL_SetKeymap(int start, SDL_Keycode * keys, int length); +extern void SDL_SetKeymap(int start, const SDL_Keycode * keys, int length, SDL_bool send_event); /* Set a platform-dependent key name, overriding the default platform-agnostic name. Encoded as UTF-8. The string is not copied, thus the pointer given to @@ -47,6 +44,11 @@ /* Set the keyboard focus window */ extern void SDL_SetKeyboardFocus(SDL_Window * window); +/* Send a character from an on-screen keyboard as scancode and modifier key events, + currently assuming ASCII characters on a US keyboard layout + */ +extern int SDL_SendKeyboardUnicodeKey(Uint32 ch); + /* Send a keyboard key event */ extern int SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode); extern int SDL_SendKeyboardKeyAutoRelease(SDL_Scancode scancode); diff -Nru libsdl2-2.0.22+dfsg/src/events/SDL_mouse.c libsdl2-2.24.0+dfsg/src/events/SDL_mouse.c --- libsdl2-2.0.22+dfsg/src/events/SDL_mouse.c 2022-04-23 17:37:35.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/events/SDL_mouse.c 2022-08-13 03:48:10.000000000 +0000 @@ -28,7 +28,7 @@ #include "SDL_events_c.h" #include "../SDL_hints_c.h" #include "../video/SDL_sysvideo.h" -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__GDK__) #include "../core/windows/SDL_windows.h" // For GetDoubleClickTime() #endif #if defined(__OS2__) @@ -55,7 +55,7 @@ if (hint && *hint) { mouse->double_click_time = SDL_atoi(hint); } else { -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__WINGDK__) mouse->double_click_time = GetDoubleClickTime(); #elif defined(__OS2__) mouse->double_click_time = WinQuerySysValue(HWND_DESKTOP, SV_DBLCLKTIME); @@ -161,6 +161,14 @@ } } +static void SDLCALL +SDL_MouseRelativeWarpMotionChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + SDL_Mouse *mouse = (SDL_Mouse *)userdata; + + mouse->relative_mode_warp_motion = SDL_GetStringBoolean(hint, SDL_FALSE); +} + /* Public functions */ int SDL_MouseInit(void) @@ -195,6 +203,9 @@ SDL_AddHintCallback(SDL_HINT_MOUSE_AUTO_CAPTURE, SDL_MouseAutoCaptureChanged, mouse); + SDL_AddHintCallback(SDL_HINT_MOUSE_RELATIVE_WARP_MOTION, + SDL_MouseRelativeWarpMotionChanged, mouse); + mouse->was_touch_mouse_events = SDL_FALSE; /* no touch to mouse movement event pending */ mouse->cursor_shown = SDL_TRUE; @@ -219,13 +230,15 @@ return &SDL_mouse; } -static Uint32 GetButtonState(SDL_Mouse *mouse) +static Uint32 GetButtonState(SDL_Mouse *mouse, SDL_bool include_touch) { int i; Uint32 buttonstate = 0; for (i = 0; i < mouse->num_sources; ++i) { - buttonstate |= mouse->sources[i].buttonstate; + if (include_touch || mouse->sources[i].mouseID != SDL_TOUCH_MOUSEID) { + buttonstate |= mouse->sources[i].buttonstate; + } } return buttonstate; } @@ -320,7 +333,7 @@ { if (window && !relative) { SDL_Mouse *mouse = SDL_GetMouse(); - if (!SDL_UpdateMouseFocus(window, x, y, GetButtonState(mouse), (mouseID == SDL_TOUCH_MOUSEID) ? SDL_FALSE : SDL_TRUE)) { + if (!SDL_UpdateMouseFocus(window, x, y, GetButtonState(mouse, SDL_TRUE), (mouseID == SDL_TOUCH_MOUSEID) ? SDL_FALSE : SDL_TRUE)) { return 0; } } @@ -377,13 +390,16 @@ if (x == center_x && y == center_y) { mouse->last_x = center_x; mouse->last_y = center_y; - return 0; - } - if (window && (window->flags & SDL_WINDOW_INPUT_FOCUS) != 0) { - if (mouse->WarpMouse) { - mouse->WarpMouse(window, center_x, center_y); - } else { - SDL_PrivateSendMouseMotion(window, mouseID, 0, center_x, center_y); + if (!mouse->relative_mode_warp_motion) { + return 0; + } + } else { + if (window && (window->flags & SDL_WINDOW_INPUT_FOCUS) != 0) { + if (mouse->WarpMouse) { + mouse->WarpMouse(window, center_x, center_y); + } else { + SDL_PrivateSendMouseMotion(window, mouseID, 0, center_x, center_y); + } } } } @@ -418,7 +434,7 @@ } /* Ignore relative motion positioning the first touch */ - if (mouseID == SDL_TOUCH_MOUSEID && !GetButtonState(mouse)) { + if (mouseID == SDL_TOUCH_MOUSEID && !GetButtonState(mouse, SDL_TRUE)) { xrel = 0; yrel = 0; } @@ -492,7 +508,7 @@ event.motion.which = mouseID; /* Set us pending (or clear during a normal mouse movement event) as having triggered */ mouse->was_touch_mouse_events = (mouseID == SDL_TOUCH_MOUSEID)? SDL_TRUE : SDL_FALSE; - event.motion.state = GetButtonState(mouse); + event.motion.state = GetButtonState(mouse, SDL_TRUE); event.motion.x = mouse->x; event.motion.y = mouse->y; event.motion.xrel = xrel; @@ -810,6 +826,9 @@ SDL_DelHintCallback(SDL_HINT_MOUSE_AUTO_CAPTURE, SDL_MouseAutoCaptureChanged, mouse); + + SDL_DelHintCallback(SDL_HINT_MOUSE_RELATIVE_WARP_MOTION, + SDL_MouseRelativeWarpMotionChanged, mouse); } Uint32 @@ -823,7 +842,7 @@ if (y) { *y = mouse->y; } - return GetButtonState(mouse); + return GetButtonState(mouse, SDL_TRUE); } Uint32 @@ -839,7 +858,7 @@ } mouse->xdelta = 0; mouse->ydelta = 0; - return GetButtonState(mouse); + return GetButtonState(mouse, SDL_TRUE); } Uint32 @@ -867,7 +886,7 @@ } void -SDL_WarpMouseInWindow(SDL_Window * window, int x, int y) +SDL_PerformWarpMouseInWindow(SDL_Window *window, int x, int y, SDL_bool ignore_relative_mode) { SDL_Mouse *mouse = SDL_GetMouse(); @@ -884,8 +903,26 @@ } /* Ignore the previous position when we warp */ + mouse->last_x = x; + mouse->last_y = y; mouse->has_position = SDL_FALSE; + if (mouse->relative_mode && !ignore_relative_mode) { + /* 2.0.22 made warping in relative mode actually functional, which + * surprised many applications that weren't expecting the additional + * mouse motion. + * + * So for now, warping in relative mode adjusts the absolution position + * but doesn't generate motion events, unless SDL_HINT_MOUSE_RELATIVE_WARP_MOTION is set. + */ + if (!mouse->relative_mode_warp_motion) { + mouse->x = x; + mouse->y = y; + mouse->has_position = SDL_TRUE; + return; + } + } + if (mouse->WarpMouse && (!mouse->relative_mode || mouse->relative_mode_warp)) { mouse->WarpMouse(window, x, y); @@ -894,6 +931,12 @@ } } +void +SDL_WarpMouseInWindow(SDL_Window * window, int x, int y) +{ + SDL_PerformWarpMouseInWindow(window, x, y, SDL_FALSE); +} + int SDL_WarpMouseGlobal(int x, int y) { @@ -953,8 +996,9 @@ if (enabled && focusWindow) { SDL_SetMouseFocus(focusWindow); - if (mouse->relative_mode_warp) - SDL_WarpMouseInWindow(focusWindow, focusWindow->w/2, focusWindow->h/2); + if (mouse->relative_mode_warp) { + SDL_PerformWarpMouseInWindow(focusWindow, focusWindow->w/2, focusWindow->h/2, SDL_TRUE); + } } if (focusWindow) { @@ -962,7 +1006,7 @@ /* Put the cursor back to where the application expects it */ if (!enabled) { - SDL_WarpMouseInWindow(focusWindow, mouse->x, mouse->y); + SDL_PerformWarpMouseInWindow(focusWindow, mouse->x, mouse->y, SDL_TRUE); } SDL_UpdateMouseCapture(SDL_FALSE); @@ -998,7 +1042,8 @@ } if (!force_release) { - if (mouse->capture_desired || (mouse->auto_capture && SDL_GetMouseState(NULL, NULL) != 0)) { + if (SDL_GetMessageBoxCount() == 0 && + (mouse->capture_desired || (mouse->auto_capture && GetButtonState(mouse, SDL_FALSE) != 0))) { if (!mouse->relative_mode) { capture_window = SDL_GetKeyboardFocus(); } @@ -1006,21 +1051,34 @@ } if (capture_window != mouse->capture_window) { - if (mouse->capture_window) { - mouse->CaptureMouse(NULL); - mouse->capture_window->flags &= ~SDL_WINDOW_MOUSE_CAPTURE; - mouse->capture_window = NULL; + /* We can get here recursively on Windows, so make sure we complete + * all of the window state operations before we change the capture state + * (e.g. https://github.com/libsdl-org/SDL/pull/5608) + */ + SDL_Window *previous_capture = mouse->capture_window; + + if (previous_capture) { + previous_capture->flags &= ~SDL_WINDOW_MOUSE_CAPTURE; } if (capture_window) { - if (mouse->CaptureMouse(capture_window) < 0) { - /* CaptureMouse() will have set an error */ - return -1; - } capture_window->flags |= SDL_WINDOW_MOUSE_CAPTURE; } mouse->capture_window = capture_window; + + if (mouse->CaptureMouse(capture_window) < 0) { + /* CaptureMouse() will have set an error, just restore the state */ + if (previous_capture) { + previous_capture->flags |= SDL_WINDOW_MOUSE_CAPTURE; + } + if (capture_window) { + capture_window->flags &= ~SDL_WINDOW_MOUSE_CAPTURE; + } + mouse->capture_window = previous_capture; + + return -1; + } } return 0; } @@ -1034,6 +1092,17 @@ return SDL_Unsupported(); } +#if defined(__WIN32__) || defined(__WINGDK__) + /* Windows mouse capture is tied to the current thread, and must be called + * from the thread that created the window being captured. Since we update + * the mouse capture state from the event processing, any application state + * changes must be processed on that thread as well. + */ + if (!SDL_OnVideoThread()) { + return SDL_SetError("SDL_CaptureMouse() must be called on the main thread"); + } +#endif /* defined(__WIN32__) || defined(__WINGDK__) */ + if (enabled && SDL_GetKeyboardFocus() == NULL) { return SDL_SetError("No window has focus"); } diff -Nru libsdl2-2.0.22+dfsg/src/events/SDL_mouse_c.h libsdl2-2.24.0+dfsg/src/events/SDL_mouse_c.h --- libsdl2-2.0.22+dfsg/src/events/SDL_mouse_c.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/events/SDL_mouse_c.h 2022-08-13 03:48:10.000000000 +0000 @@ -91,6 +91,7 @@ SDL_bool has_position; SDL_bool relative_mode; SDL_bool relative_mode_warp; + SDL_bool relative_mode_warp_motion; float normal_speed_scale; float relative_speed_scale; float scale_accum_x; @@ -152,6 +153,9 @@ /* Send a mouse wheel event */ extern int SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, float x, float y, SDL_MouseWheelDirection direction); +/* Warp the mouse within the window, potentially overriding relative mode */ +extern void SDL_PerformWarpMouseInWindow(SDL_Window *window, int x, int y, SDL_bool ignore_relative_mode); + /* Shutdown the mouse subsystem */ extern void SDL_MouseQuit(void); diff -Nru libsdl2-2.0.22+dfsg/src/events/SDL_sysevents.h libsdl2-2.24.0+dfsg/src/events/SDL_sysevents.h --- libsdl2-2.0.22+dfsg/src/events/SDL_sysevents.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/events/SDL_sysevents.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../SDL_internal.h" - -#include "../video/SDL_sysvideo.h" - -/* Useful functions and variables from SDL_sysevents.c */ - -#if defined(__HAIKU__) -/* The Haiku event loops run in a separate thread */ -#define MUST_THREAD_EVENTS -#endif - -#ifdef __WIN32__ /* Windows doesn't allow a separate event thread */ -#define CANT_THREAD_EVENTS -#endif - -/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/events/SDL_windowevents.c libsdl2-2.24.0+dfsg/src/events/SDL_windowevents.c --- libsdl2-2.0.22+dfsg/src/events/SDL_windowevents.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/events/SDL_windowevents.c 2022-08-13 03:48:10.000000000 +0000 @@ -27,15 +27,27 @@ #include "SDL_mouse_c.h" #include "SDL_hints.h" +typedef struct RemovePendingSizeChangedAndResizedEvents_Data +{ + const SDL_Event *new_event; + SDL_bool saw_resized; +} RemovePendingSizeChangedAndResizedEvents_Data; + static int SDLCALL -RemovePendingSizeChangedAndResizedEvents(void * userdata, SDL_Event *event) +RemovePendingSizeChangedAndResizedEvents(void *_userdata, SDL_Event *event) { - SDL_Event *new_event = (SDL_Event *)userdata; + RemovePendingSizeChangedAndResizedEvents_Data *userdata = (RemovePendingSizeChangedAndResizedEvents_Data *) _userdata; + const SDL_Event *new_event = userdata->new_event; if (event->type == SDL_WINDOWEVENT && (event->window.event == SDL_WINDOWEVENT_SIZE_CHANGED || event->window.event == SDL_WINDOWEVENT_RESIZED) && event->window.windowID == new_event->window.windowID) { + + if (event->window.event == SDL_WINDOWEVENT_RESIZED) { + userdata->saw_resized = SDL_TRUE; + } + /* We're about to post a new size event, drop the old one */ return 0; } @@ -188,7 +200,18 @@ /* Fixes queue overflow with resize events that aren't processed */ if (windowevent == SDL_WINDOWEVENT_SIZE_CHANGED) { - SDL_FilterEvents(RemovePendingSizeChangedAndResizedEvents, &event); + /* !!! FIXME: in SDL3, let's make RESIZED/SIZE_CHANGED into one event with a flag to distinguish between them, and remove all this tapdancing. */ + RemovePendingSizeChangedAndResizedEvents_Data userdata; + userdata.new_event = &event; + userdata.saw_resized = SDL_FALSE; + SDL_FilterEvents(RemovePendingSizeChangedAndResizedEvents, &userdata); + if (userdata.saw_resized) { /* if there was a pending resize, make sure one at the new dimensions remains. */ + event.window.event = SDL_WINDOWEVENT_RESIZED; + if (SDL_PushEvent(&event) <= 0) { + return 0; /* oh well. */ + } + event.window.event = SDL_WINDOWEVENT_SIZE_CHANGED; /* then push the actual event next. */ + } } if (windowevent == SDL_WINDOWEVENT_MOVED) { SDL_FilterEvents(RemovePendingMoveEvents, &event); @@ -207,7 +230,7 @@ } } - return (posted); + return posted; } /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/file/cocoa/SDL_rwopsbundlesupport.m libsdl2-2.24.0+dfsg/src/file/cocoa/SDL_rwopsbundlesupport.m --- libsdl2-2.0.22+dfsg/src/file/cocoa/SDL_rwopsbundlesupport.m 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/file/cocoa/SDL_rwopsbundlesupport.m 2022-08-13 03:48:10.000000000 +0000 @@ -36,18 +36,22 @@ { @autoreleasepool { FILE* fp = NULL; + NSFileManager* file_manager; + NSString* resource_path; + NSString* ns_string_file_component; + NSString* full_path_with_file_to_try; /* If the file mode is writable, skip all the bundle stuff because generally the bundle is read-only. */ if(strcmp("r", mode) && strcmp("rb", mode)) { return fopen(file, mode); } - NSFileManager* file_manager = [NSFileManager defaultManager]; - NSString* resource_path = [[NSBundle mainBundle] resourcePath]; + file_manager = [NSFileManager defaultManager]; + resource_path = [[NSBundle mainBundle] resourcePath]; - NSString* ns_string_file_component = [file_manager stringWithFileSystemRepresentation:file length:strlen(file)]; + ns_string_file_component = [file_manager stringWithFileSystemRepresentation:file length:strlen(file)]; - NSString* full_path_with_file_to_try = [resource_path stringByAppendingPathComponent:ns_string_file_component]; + full_path_with_file_to_try = [resource_path stringByAppendingPathComponent:ns_string_file_component]; if([file_manager fileExistsAtPath:full_path_with_file_to_try]) { fp = fopen([full_path_with_file_to_try fileSystemRepresentation], mode); } else { diff -Nru libsdl2-2.0.22+dfsg/src/file/SDL_rwops.c libsdl2-2.24.0+dfsg/src/file/SDL_rwops.c --- libsdl2-2.0.22+dfsg/src/file/SDL_rwops.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/file/SDL_rwops.c 2022-08-13 03:48:10.000000000 +0000 @@ -30,7 +30,7 @@ #include "../SDL_internal.h" -#if defined(__WIN32__) +#if defined(__WIN32__) || defined(__GDK__) #include "../core/windows/SDL_windows.h" #endif @@ -62,236 +62,7 @@ #include "nacl_io/nacl_io.h" #endif -#ifdef __VITA__ - -#include -#include - -#define READAHEAD_BUFFER_SIZE 1024 -static int SDLCALL -vita_file_open(SDL_RWops * context, const char *filename, const char *mode) -{ - int h; - int open_flags; - SDL_bool has_r; - SDL_bool has_w; - SDL_bool has_a; - SDL_bool has_plus; - - if (!context) - return -1; /* failed (invalid call) */ - - context->hidden.vitaio.h = -1; /* mark this as unusable */ - context->hidden.vitaio.buffer.data = NULL; - context->hidden.vitaio.buffer.size = 0; - context->hidden.vitaio.buffer.left = 0; - - open_flags = 0; - - /* "r" = reading, file must exist */ - /* "w" = writing, truncate existing, file may not exist */ - /* "r+"= reading or writing, file must exist */ - /* "a" = writing, append file may not exist */ - /* "a+"= append + read, file may not exist */ - /* "w+" = read, write, truncate. file may not exist */ - - has_r = SDL_strchr(mode, 'r') != NULL; - has_w = SDL_strchr(mode, 'w') != NULL; - has_a = SDL_strchr(mode, 'a') != NULL; - has_plus = SDL_strchr(mode, '+') != NULL; - - if (has_plus) - { - if (has_r || has_w || has_a) - { - open_flags |= SCE_O_RDWR; - } - } - else - { - if (has_r) - { - open_flags |= SCE_O_RDONLY; - } - if (has_w || has_a) - { - open_flags |= SCE_O_WRONLY; - } - } - if (has_w || has_a) - { - open_flags |= SCE_O_CREAT; - } - if (has_w) - { - open_flags |= SCE_O_TRUNC; - } - if (has_a) - { - open_flags |= SCE_O_APPEND; - } - - context->hidden.vitaio.buffer.data = - (char *) SDL_malloc(READAHEAD_BUFFER_SIZE); - if (!context->hidden.vitaio.buffer.data) { - return SDL_OutOfMemory(); - } - - /* Try to open the file on the filesystem first */ - h = sceIoOpen(filename, open_flags, 0777); - - if (h < 0) { - /* Try opening it from app0:/ container if it's a relative path */ - char path[4096]; - SDL_snprintf(path, 4096, "app0:/%s", filename); - h = sceIoOpen(path, open_flags, 0777); - } - - if (h < 0) { - SDL_free(context->hidden.vitaio.buffer.data); - context->hidden.vitaio.buffer.data = NULL; - SDL_SetError("Couldn't open %s", filename); - return -2; /* failed (sceIoOpen) */ - } - context->hidden.vitaio.h = h; - - return 0; /* ok */ -} - -static Sint64 SDLCALL -vita_file_size(SDL_RWops * context) -{ - SceIoStat st; - if (!context || context->hidden.vitaio.h < 0) { - return SDL_SetError("vita_file_size: invalid context/file not opened"); - } - - if (sceIoGetstatByFd(context->hidden.vitaio.h, &st) < 0) { - return SDL_SetError("vita_file_size: could not get file size"); - } - return st.st_size; -} - -static Sint64 SDLCALL -vita_file_seek(SDL_RWops * context, Sint64 offset, int whence) -{ - int vitawhence; - - if (!context || context->hidden.vitaio.h < 0) { - return SDL_SetError("vita_file_seek: invalid context/file not opened"); - } - - /* FIXME: We may be able to satisfy the seek within buffered data */ - if (whence == RW_SEEK_CUR && context->hidden.vitaio.buffer.left) { - offset -= (long)context->hidden.vitaio.buffer.left; - } - context->hidden.vitaio.buffer.left = 0; - - switch (whence) { - case RW_SEEK_SET: - vitawhence = SCE_SEEK_SET; - break; - case RW_SEEK_CUR: - vitawhence = SCE_SEEK_CUR; - break; - case RW_SEEK_END: - vitawhence = SCE_SEEK_END; - break; - default: - return SDL_SetError("vita_file_seek: Unknown value for 'whence'"); - } - - return sceIoLseek(context->hidden.vitaio.h, offset, vitawhence); -} - -static size_t SDLCALL -vita_file_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum) -{ - size_t total_need; - size_t total_read = 0; - size_t read_ahead; - size_t byte_read; - - total_need = size * maxnum; - - if (!context || context->hidden.vitaio.h < 0 || !total_need) { - return 0; - } - - if (context->hidden.vitaio.buffer.left > 0) { - void *data = (char *) context->hidden.vitaio.buffer.data + - context->hidden.vitaio.buffer.size - - context->hidden.vitaio.buffer.left; - read_ahead = - SDL_min(total_need, context->hidden.vitaio.buffer.left); - SDL_memcpy(ptr, data, read_ahead); - context->hidden.vitaio.buffer.left -= read_ahead; - - if (read_ahead == total_need) { - return maxnum; - } - ptr = (char *) ptr + read_ahead; - total_need -= read_ahead; - total_read += read_ahead; - } - - if (total_need < READAHEAD_BUFFER_SIZE) { - byte_read = sceIoRead(context->hidden.vitaio.h, context->hidden.vitaio.buffer.data, READAHEAD_BUFFER_SIZE); - read_ahead = SDL_min(total_need, (int) byte_read); - SDL_memcpy(ptr, context->hidden.vitaio.buffer.data, read_ahead); - context->hidden.vitaio.buffer.size = byte_read; - context->hidden.vitaio.buffer.left = byte_read - read_ahead; - total_read += read_ahead; - } else { - byte_read = sceIoRead(context->hidden.vitaio.h, ptr, total_need); - total_read += byte_read; - } - return (total_read / size); -} - -static size_t SDLCALL -vita_file_write(SDL_RWops * context, const void *ptr, size_t size, - size_t num) -{ - - size_t total_bytes; - size_t byte_written; - size_t nwritten; - - total_bytes = size * num; - - if (!context || context->hidden.vitaio.h < 0 || !size || !total_bytes) { - return 0; - } - - if (context->hidden.vitaio.buffer.left) { - sceIoLseek(context->hidden.vitaio.h, -(SceOff)context->hidden.vitaio.buffer.left, SCE_SEEK_CUR); - context->hidden.vitaio.buffer.left = 0; - } - - byte_written = sceIoWrite(context->hidden.vitaio.h, ptr, total_bytes); - - nwritten = byte_written / size; - return nwritten; -} - -static int SDLCALL -vita_file_close(SDL_RWops * context) -{ - if (context) { - if (context->hidden.vitaio.h >= 0) { - sceIoClose(context->hidden.vitaio.h); - context->hidden.vitaio.h = -1; /* to be sure */ - } - SDL_free(context->hidden.vitaio.buffer.data); - context->hidden.vitaio.buffer.data = NULL; - SDL_FreeRW(context); - } - return 0; -} -#endif - -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__GDK__) /* Functions to read/write Win32 API file pointers */ @@ -304,7 +75,9 @@ static int SDLCALL windows_file_open(SDL_RWops * context, const char *filename, const char *mode) { +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) UINT old_error_mode; +#endif HANDLE h; DWORD r_right, w_right; DWORD must_exist, truncate; @@ -341,9 +114,11 @@ if (!context->hidden.windowsio.buffer.data) { return SDL_OutOfMemory(); } +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) /* Do not open a dialog box if failure */ old_error_mode = SetErrorMode(SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS); +#endif { LPTSTR tstr = WIN_UTF8ToString(filename); @@ -354,8 +129,10 @@ SDL_free(tstr); } +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) /* restore old behavior */ SetErrorMode(old_error_mode); +#endif if (h == INVALID_HANDLE_VALUE) { SDL_free(context->hidden.windowsio.buffer.data); @@ -532,7 +309,7 @@ } return 0; } -#endif /* __WIN32__ */ +#endif /* defined(__WIN32__) || defined(__GDK__) */ #ifdef HAVE_STDIO_H @@ -803,7 +580,7 @@ rwops->close = Android_JNI_FileClose; rwops->type = SDL_RWOPS_JNIFILE; -#elif defined(__WIN32__) +#elif defined(__WIN32__) || defined(__GDK__) rwops = SDL_AllocRW(); if (!rwops) return NULL; /* SDL_SetError already setup by SDL_AllocRW() */ @@ -817,20 +594,6 @@ rwops->write = windows_file_write; rwops->close = windows_file_close; rwops->type = SDL_RWOPS_WINFILE; -#elif defined(__VITA__) - rwops = SDL_AllocRW(); - if (!rwops) - return NULL; /* SDL_SetError already setup by SDL_AllocRW() */ - if (vita_file_open(rwops, file, mode) < 0) { - SDL_FreeRW(rwops); - return NULL; - } - rwops->size = vita_file_size; - rwops->seek = vita_file_seek; - rwops->read = vita_file_read; - rwops->write = vita_file_write; - rwops->close = vita_file_close; - rwops->type = SDL_RWOPS_VITAFILE; #elif HAVE_STDIO_H { #if __APPLE__ && !SDL_FILE_DISABLED // TODO: add dummy? diff -Nru libsdl2-2.0.22+dfsg/src/filesystem/cocoa/SDL_sysfilesystem.m libsdl2-2.24.0+dfsg/src/filesystem/cocoa/SDL_sysfilesystem.m --- libsdl2-2.0.22+dfsg/src/filesystem/cocoa/SDL_sysfilesystem.m 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/filesystem/cocoa/SDL_sysfilesystem.m 2022-08-13 03:48:10.000000000 +0000 @@ -71,6 +71,9 @@ SDL_GetPrefPath(const char *org, const char *app) { @autoreleasepool { + char *retval = NULL; + NSArray *array; + if (!app) { SDL_InvalidParamError("app"); return NULL; @@ -79,9 +82,8 @@ org = ""; } - char *retval = NULL; #if !TARGET_OS_TV - NSArray *array = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); + array = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); #else /* tvOS does not have persistent local storage! * The only place on-device where we can store data is @@ -91,15 +93,16 @@ * between sessions. If you want your app's save data to * actually stick around, you'll need to use iCloud storage. */ - - static SDL_bool shown = SDL_FALSE; - if (!shown) { - shown = SDL_TRUE; - SDL_LogCritical(SDL_LOG_CATEGORY_SYSTEM, "tvOS does not have persistent local storage! Use iCloud storage if you want your data to persist between sessions.\n"); + static SDL_bool shown = SDL_FALSE; + if (!shown) + { + shown = SDL_TRUE; + SDL_LogCritical(SDL_LOG_CATEGORY_SYSTEM, "tvOS does not have persistent local storage! Use iCloud storage if you want your data to persist between sessions.\n"); + } } - NSArray *array = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); + array = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); #endif /* !TARGET_OS_TV */ if ([array count] > 0) { /* we only want the first item in the list. */ diff -Nru libsdl2-2.0.22+dfsg/src/filesystem/ps2/SDL_sysfilesystem.c libsdl2-2.24.0+dfsg/src/filesystem/ps2/SDL_sysfilesystem.c --- libsdl2-2.0.22+dfsg/src/filesystem/ps2/SDL_sysfilesystem.c 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/filesystem/ps2/SDL_sysfilesystem.c 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,108 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#include +#include + +#if defined(SDL_FILESYSTEM_PS2) + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* System dependent filesystem routines */ + +#include "SDL_error.h" +#include "SDL_filesystem.h" + +char * +SDL_GetBasePath(void) +{ + char *retval; + size_t len; + char cwd[FILENAME_MAX]; + + getcwd(cwd, sizeof(cwd)); + len = SDL_strlen(cwd) + 1; + retval = (char *) SDL_malloc(len); + if (retval) + SDL_memcpy(retval, cwd, len); + + return retval; +} + +/* Do a recursive mkdir of parents folders */ +static void recursive_mkdir(const char *dir) { + char tmp[FILENAME_MAX]; + char *base = SDL_GetBasePath(); + char *p = NULL; + size_t len; + + snprintf(tmp, sizeof(tmp),"%s",dir); + len = strlen(tmp); + if (tmp[len - 1] == '/') + tmp[len - 1] = 0; + + for (p = tmp + 1; *p; p++) { + if (*p == '/') { + *p = 0; + // Just creating subfolders from current path + if (strstr(tmp, base) != NULL) + mkdir(tmp, S_IRWXU); + + *p = '/'; + } + } + + free(base); + mkdir(tmp, S_IRWXU); +} + +char * +SDL_GetPrefPath(const char *org, const char *app) +{ + char *retval = NULL; + size_t len; + char *base = SDL_GetBasePath(); + if (!app) { + SDL_InvalidParamError("app"); + return NULL; + } + if(!org) { + org = ""; + } + + len = SDL_strlen(base) + SDL_strlen(org) + SDL_strlen(app) + 4; + retval = (char *) SDL_malloc(len); + + if (*org) { + SDL_snprintf(retval, len, "%s%s/%s/", base, org, app); + } else { + SDL_snprintf(retval, len, "%s%s/", base, app); + } + free(base); + + recursive_mkdir(retval); + + return retval; +} + +#endif /* SDL_FILESYSTEM_PS2 */ + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/filesystem/psp/SDL_sysfilesystem.c libsdl2-2.24.0+dfsg/src/filesystem/psp/SDL_sysfilesystem.c --- libsdl2-2.0.22+dfsg/src/filesystem/psp/SDL_sysfilesystem.c 2022-01-08 21:13:56.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/filesystem/psp/SDL_sysfilesystem.c 2022-06-02 02:01:57.000000000 +0000 @@ -34,44 +34,44 @@ char * SDL_GetBasePath(void) { - char *retval = NULL; - size_t len; - char cwd[FILENAME_MAX]; - - getcwd(cwd, sizeof(cwd)); - len = SDL_strlen(cwd) + 2; - retval = (char *) SDL_malloc(len); - SDL_snprintf(retval, len, "%s/", cwd); + char *retval = NULL; + size_t len; + char cwd[FILENAME_MAX]; + + getcwd(cwd, sizeof(cwd)); + len = SDL_strlen(cwd) + 2; + retval = (char *) SDL_malloc(len); + SDL_snprintf(retval, len, "%s/", cwd); - return retval; + return retval; } char * SDL_GetPrefPath(const char *org, const char *app) { - char *retval = NULL; - size_t len; - char *base = SDL_GetBasePath(); - if (!app) { - SDL_InvalidParamError("app"); - return NULL; - } - if(!org) { - org = ""; - } - - len = SDL_strlen(base) + SDL_strlen(org) + SDL_strlen(app) + 4; - retval = (char *) SDL_malloc(len); - - if (*org) { - SDL_snprintf(retval, len, "%s%s/%s/", base, org, app); - } else { - SDL_snprintf(retval, len, "%s%s/", base, app); - } - free(base); + char *retval = NULL; + size_t len; + char *base = SDL_GetBasePath(); + if (!app) { + SDL_InvalidParamError("app"); + return NULL; + } + if(!org) { + org = ""; + } + + len = SDL_strlen(base) + SDL_strlen(org) + SDL_strlen(app) + 4; + retval = (char *) SDL_malloc(len); + + if (*org) { + SDL_snprintf(retval, len, "%s%s/%s/", base, org, app); + } else { + SDL_snprintf(retval, len, "%s%s/", base, app); + } + free(base); - mkdir(retval, 0755); - return retval; + mkdir(retval, 0755); + return retval; } #endif /* SDL_FILESYSTEM_PSP */ diff -Nru libsdl2-2.0.22+dfsg/src/filesystem/unix/SDL_sysfilesystem.c libsdl2-2.24.0+dfsg/src/filesystem/unix/SDL_sysfilesystem.c --- libsdl2-2.0.22+dfsg/src/filesystem/unix/SDL_sysfilesystem.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/filesystem/unix/SDL_sysfilesystem.c 2022-08-13 03:48:10.000000000 +0000 @@ -150,12 +150,12 @@ } #endif #if defined(__OPENBSD__) - /* Please note that this will fail if the process was launched with a relative path and the cwd has changed, or argv is altered. So don't do that. Or add a new sysctl to OpenBSD. */ + /* Please note that this will fail if the process was launched with a relative path and $PWD + the cwd have changed, or argv is altered. So don't do that. Or add a new sysctl to OpenBSD. */ char **cmdline; size_t len; const int mib[] = { CTL_KERN, KERN_PROC_ARGS, getpid(), KERN_PROC_ARGV }; if (sysctl(mib, 4, NULL, &len, NULL, 0) != -1) { - char *exe; + char *exe, *pwddst; char *realpathbuf = (char *) SDL_malloc(PATH_MAX + 1); if (!realpathbuf) { SDL_OutOfMemory(); @@ -172,13 +172,28 @@ sysctl(mib, 4, cmdline, &len, NULL, 0); exe = cmdline[0]; + pwddst = NULL; if (SDL_strchr(exe, '/') == NULL) { /* not a relative or absolute path, check $PATH for it */ exe = search_path_for_binary(cmdline[0]); + } else { + if (exe && *exe == '.') { + const char *pwd = SDL_getenv("PWD"); + if (pwd && *pwd) { + SDL_asprintf(&pwddst, "%s/%s", pwd, exe); + } + } } if (exe) { - if (realpath(exe, realpathbuf) != NULL) { - retval = realpathbuf; + if (pwddst == NULL) { + if (realpath(exe, realpathbuf) != NULL) { + retval = realpathbuf; + } + } else { + if (realpath(pwddst, realpathbuf) != NULL) { + retval = realpathbuf; + } + SDL_free(pwddst); } if (exe != cmdline[0]) { diff -Nru libsdl2-2.0.22+dfsg/src/filesystem/windows/SDL_sysfilesystem.c libsdl2-2.24.0+dfsg/src/filesystem/windows/SDL_sysfilesystem.c --- libsdl2-2.0.22+dfsg/src/filesystem/windows/SDL_sysfilesystem.c 2022-04-21 17:37:37.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/filesystem/windows/SDL_sysfilesystem.c 2022-08-13 03:48:10.000000000 +0000 @@ -172,4 +172,23 @@ #endif /* SDL_FILESYSTEM_WINDOWS */ +#ifdef SDL_FILESYSTEM_XBOX +#include "SDL_filesystem.h" +#include "SDL_error.h" +char * +SDL_GetBasePath(void) +{ + SDL_Unsupported(); + return NULL; +} + +char * +SDL_GetPrefPath(const char *org, const char *app) +{ + SDL_Unsupported(); + return NULL; +} +#endif /* SDL_FILESYSTEM_XBOX */ + + /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/haptic/SDL_syshaptic.h libsdl2-2.24.0+dfsg/src/haptic/SDL_syshaptic.h --- libsdl2-2.0.22+dfsg/src/haptic/SDL_syshaptic.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/haptic/SDL_syshaptic.h 2022-08-13 03:48:10.000000000 +0000 @@ -26,6 +26,10 @@ #include "SDL_haptic.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif struct haptic_effect { @@ -203,6 +207,11 @@ */ extern int SDL_SYS_HapticStopAll(SDL_Haptic * haptic); +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif + #endif /* SDL_syshaptic_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/haptic/windows/SDL_dinputhaptic.c libsdl2-2.24.0+dfsg/src/haptic/windows/SDL_dinputhaptic.c --- libsdl2-2.0.22+dfsg/src/haptic/windows/SDL_dinputhaptic.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/haptic/windows/SDL_dinputhaptic.c 2022-08-13 03:48:10.000000000 +0000 @@ -27,6 +27,7 @@ #if SDL_HAPTIC_DINPUT +#include "SDL_hints.h" #include "SDL_stdinc.h" #include "SDL_timer.h" #include "SDL_windowshaptic_c.h" @@ -77,6 +78,11 @@ return SDL_SetError("Haptic: SubSystem already open."); } + if (!SDL_GetHintBoolean(SDL_HINT_DIRECTINPUT_ENABLED, SDL_TRUE)) { + /* In some environments, IDirectInput8_Initialize / _EnumDevices can take a minute even with no controllers. */ + return 0; + } + ret = WIN_CoInitialize(); if (FAILED(ret)) { return DI_SetError("Coinitialize", ret); diff -Nru libsdl2-2.0.22+dfsg/src/haptic/windows/SDL_dinputhaptic_c.h libsdl2-2.24.0+dfsg/src/haptic/windows/SDL_dinputhaptic_c.h --- libsdl2-2.0.22+dfsg/src/haptic/windows/SDL_dinputhaptic_c.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/haptic/windows/SDL_dinputhaptic_c.h 2022-08-13 03:48:10.000000000 +0000 @@ -23,6 +23,10 @@ #include "SDL_haptic.h" #include "SDL_windowshaptic_c.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif extern int SDL_DINPUT_HapticInit(void); extern int SDL_DINPUT_HapticMaybeAddDevice(const DIDEVICEINSTANCE *pdidInstance); @@ -44,4 +48,9 @@ extern int SDL_DINPUT_HapticUnpause(SDL_Haptic * haptic); extern int SDL_DINPUT_HapticStopAll(SDL_Haptic * haptic); +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif + /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/haptic/windows/SDL_windowshaptic.c libsdl2-2.24.0+dfsg/src/haptic/windows/SDL_windowshaptic.c --- libsdl2-2.0.22+dfsg/src/haptic/windows/SDL_windowshaptic.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/haptic/windows/SDL_windowshaptic.c 2022-08-13 03:48:10.000000000 +0000 @@ -37,6 +37,10 @@ #include "SDL_dinputhaptic_c.h" #include "SDL_xinputhaptic_c.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif /* * Internal stuff. @@ -466,6 +470,11 @@ } } +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif + #endif /* SDL_HAPTIC_DINPUT || SDL_HAPTIC_XINPUT */ /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/haptic/windows/SDL_windowshaptic_c.h libsdl2-2.24.0+dfsg/src/haptic/windows/SDL_windowshaptic_c.h --- libsdl2-2.0.22+dfsg/src/haptic/windows/SDL_windowshaptic_c.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/haptic/windows/SDL_windowshaptic_c.h 2022-08-13 03:48:10.000000000 +0000 @@ -28,6 +28,11 @@ #include "../../core/windows/SDL_directx.h" #include "../../core/windows/SDL_xinput.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + /* * Haptic system hardware data. */ @@ -84,6 +89,11 @@ extern int SDL_SYS_AddHapticDevice(SDL_hapticlist_item *item); extern int SDL_SYS_RemoveHapticDevice(SDL_hapticlist_item *prev, SDL_hapticlist_item *item); +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif + #endif /* SDL_windowshaptic_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/haptic/windows/SDL_xinputhaptic.c libsdl2-2.24.0+dfsg/src/haptic/windows/SDL_xinputhaptic.c --- libsdl2-2.0.22+dfsg/src/haptic/windows/SDL_xinputhaptic.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/haptic/windows/SDL_xinputhaptic.c 2022-08-13 03:48:10.000000000 +0000 @@ -35,6 +35,11 @@ #include "../../joystick/windows/SDL_windowsjoystick_c.h" #include "../../thread/SDL_systhread.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + /* * Internal stuff. */ @@ -45,7 +50,7 @@ SDL_XINPUT_HapticInit(void) { if (SDL_GetHintBoolean(SDL_HINT_XINPUT_ENABLED, SDL_TRUE)) { - loaded_xinput = (WIN_LoadXInputDLL() == 0); + loaded_xinput = (WIN_LoadXInputDLL() == 0) ? SDL_TRUE : SDL_FALSE; } /* If the joystick subsystem is active, it will manage adding XInput haptic devices */ @@ -365,6 +370,11 @@ return (XINPUTSETSTATE(haptic->hwdata->userid, &vibration) == ERROR_SUCCESS) ? 0 : -1; } +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif + #else /* !SDL_HAPTIC_XINPUT */ #include "../../core/windows/SDL_windows.h" diff -Nru libsdl2-2.0.22+dfsg/src/haptic/windows/SDL_xinputhaptic_c.h libsdl2-2.24.0+dfsg/src/haptic/windows/SDL_xinputhaptic_c.h --- libsdl2-2.0.22+dfsg/src/haptic/windows/SDL_xinputhaptic_c.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/haptic/windows/SDL_xinputhaptic_c.h 2022-08-13 03:48:10.000000000 +0000 @@ -23,6 +23,10 @@ #include "SDL_haptic.h" #include "SDL_windowshaptic_c.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif extern int SDL_XINPUT_HapticInit(void); extern int SDL_XINPUT_HapticMaybeAddDevice(const DWORD dwUserid); @@ -44,4 +48,9 @@ extern int SDL_XINPUT_HapticUnpause(SDL_Haptic * haptic); extern int SDL_XINPUT_HapticStopAll(SDL_Haptic * haptic); +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif + /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/hidapi/libusb/hid.c libsdl2-2.24.0+dfsg/src/hidapi/libusb/hid.c --- libsdl2-2.0.22+dfsg/src/hidapi/libusb/hid.c 2022-04-23 17:37:35.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/hidapi/libusb/hid.c 2022-08-13 03:48:10.000000000 +0000 @@ -529,6 +529,22 @@ return new_entry; } +static int usb_string_can_cache(uint16_t vid, uint16_t pid) +{ + if (!vid || !pid) { + /* We can't cache these, they aren't unique */ + return 0; + } + + if (vid == 0x0f0d && pid == 0x00dc) { + /* HORI reuses this VID/PID for many different products */ + return 0; + } + + /* We can cache these strings */ + return 1; +} + static const struct usb_string_cache_entry *usb_string_cache_find(struct libusb_device_descriptor *desc, struct libusb_device_handle *handle) { struct usb_string_cache_entry *entry = NULL; @@ -635,6 +651,7 @@ 0x1bad, /* Harmonix */ 0x20d6, /* PowerA */ 0x24c6, /* PowerA */ + 0x2c22, /* Qanba */ }; if (intf_desc->bInterfaceClass == LIBUSB_CLASS_VENDOR_SPEC && @@ -663,6 +680,7 @@ 0x1532, /* Razer Wildcat */ 0x20d6, /* PowerA */ 0x24c6, /* PowerA */ + 0x2dc8, /* 8BitDo */ 0x2e24, /* Hyperkin */ }; @@ -682,6 +700,8 @@ static int should_enumerate_interface(unsigned short vendor_id, const struct libusb_interface_descriptor *intf_desc) { + //printf("Checking interface 0x%x %d/%d/%d/%d\n", vendor_id, intf_desc->bInterfaceNumber, intf_desc->bInterfaceClass, intf_desc->bInterfaceSubClass, intf_desc->bInterfaceProtocol); + if (intf_desc->bInterfaceClass == LIBUSB_CLASS_HID) return 1; @@ -764,7 +784,7 @@ get_usb_string(handle, desc.iSerialNumber); /* Manufacturer and Product strings */ - if (dev_vid && dev_pid) { + if (usb_string_can_cache(dev_vid, dev_pid)) { string_cache = usb_string_cache_find(&desc, handle); if (string_cache) { if (string_cache->vendor) { @@ -994,7 +1014,7 @@ } -static int read_thread(void *param) +static int SDLCALL read_thread(void *param) { hid_device *dev = (hid_device *)param; uint8_t *buf; @@ -1065,6 +1085,20 @@ return 0; } +static void init_xbox360(libusb_device_handle *device_handle, unsigned short idVendor, unsigned short idProduct, struct libusb_config_descriptor *conf_desc) +{ + if ((idVendor == 0x05ac && idProduct == 0x055b) /* Gamesir-G3w */ || + (idVendor == 0x0f0d && idProduct == 0x00dc) /* HORIPAD */) { + unsigned char data[20]; + + /* The HORIPAD FPS for Nintendo Switch requires this to enable input reports. + This VID/PID is also shared with other HORI controllers, but they all seem + to be fine with this as well. + */ + libusb_control_transfer(device_handle, 0xC1, 0x01, 0x100, 0x0, data, sizeof(data), 100); + } +} + static void init_xboxone(libusb_device_handle *device_handle, unsigned short idVendor, unsigned short idProduct, struct libusb_config_descriptor *conf_desc) { static const int VENDOR_MICROSOFT = 0x045e; @@ -1184,6 +1218,11 @@ break; } + /* Initialize XBox 360 controllers */ + if (is_xbox360(desc.idVendor, intf_desc)) { + init_xbox360(dev->device_handle, desc.idVendor, desc.idProduct, conf_desc); + } + /* Initialize XBox One controllers */ if (is_xboxone(desc.idVendor, intf_desc)) { init_xboxone(dev->device_handle, desc.idVendor, desc.idProduct, conf_desc); diff -Nru libsdl2-2.0.22+dfsg/src/hidapi/linux/hid.c libsdl2-2.24.0+dfsg/src/hidapi/linux/hid.c --- libsdl2-2.0.22+dfsg/src/hidapi/linux/hid.c 2021-11-26 16:03:45.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/hidapi/linux/hid.c 2022-08-13 03:48:10.000000000 +0000 @@ -219,7 +219,7 @@ unsigned short *vendor_id, unsigned short *product_id, char **serial_number_utf8, char **product_name_utf8) { - char *tmp = strdup(uevent); + char *tmp; char *saveptr = NULL; char *line; char *key; @@ -229,6 +229,15 @@ int found_serial = 0; int found_name = 0; + if (!uevent) { + return 0; + } + + tmp = strdup(uevent); + if (!tmp) { + return 0; + } + line = strtok_r(tmp, "\n", &saveptr); while (line != NULL) { /* line: "KEY=value" */ diff -Nru libsdl2-2.0.22+dfsg/src/hidapi/mac/hid.c libsdl2-2.24.0+dfsg/src/hidapi/mac/hid.c --- libsdl2-2.0.22+dfsg/src/hidapi/mac/hid.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/hidapi/mac/hid.c 2022-08-13 03:48:10.000000000 +0000 @@ -156,11 +156,12 @@ static void free_hid_device(hid_device *dev) { + struct input_report *rpt; if (!dev) return; /* Delete any input reports still left over. */ - struct input_report *rpt = dev->input_reports; + rpt = dev->input_reports; while (rpt) { struct input_report *next = rpt->next; free(rpt->data); @@ -260,14 +261,12 @@ buf[0] = 0; if (str && CFGetTypeID(str) == CFStringGetTypeID()) { - len --; - - CFIndex str_len = CFStringGetLength(str); + CFIndex used_buf_len, chars_copied; CFRange range; + CFIndex str_len = CFStringGetLength(str); + len --; range.location = 0; range.length = (str_len > len)? len: str_len; - CFIndex used_buf_len; - CFIndex chars_copied; chars_copied = CFStringGetBytes(str, range, kCFStringEncodingUTF32LE, @@ -299,14 +298,12 @@ buf[0] = 0; if (str && CFGetTypeID(str) == CFStringGetTypeID()) { - len--; - - CFIndex str_len = CFStringGetLength(str); + CFIndex used_buf_len, chars_copied; CFRange range; + CFIndex str_len = CFStringGetLength(str); + len--; range.location = 0; range.length = (str_len > len)? len: str_len; - CFIndex used_buf_len; - CFIndex chars_copied; chars_copied = CFStringGetBytes(str, range, kCFStringEncodingUTF8, @@ -517,6 +514,8 @@ struct hid_device_info *root = NULL; // return object struct hid_device_info *cur_dev = NULL; CFIndex num_devices; + CFSetRef device_set; + IOHIDDeviceRef *device_array; int i; /* Set up the HID Manager if it hasn't been done */ @@ -527,7 +526,7 @@ process_pending_events(); /* Get a list of the Devices */ - CFSetRef device_set = IOHIDManagerCopyDevices(hid_mgr); + device_set = IOHIDManagerCopyDevices(hid_mgr); if (!device_set) return NULL; @@ -537,7 +536,7 @@ CFRelease(device_set); return NULL; } - IOHIDDeviceRef *device_array = (IOHIDDeviceRef*)calloc(num_devices, sizeof(IOHIDDeviceRef)); + device_array = (IOHIDDeviceRef*)calloc(num_devices, sizeof(IOHIDDeviceRef)); CFSetGetValues(device_set, (const void **) device_array); /* Iterate over each device, making an entry for it. */ @@ -733,13 +732,14 @@ static void *read_thread(void *param) { hid_device *dev = (hid_device *)param; + CFRunLoopSourceContext ctx; + SInt32 code; /* Move the device's run loop to this thread. */ IOHIDDeviceScheduleWithRunLoop(dev->device_handle, CFRunLoopGetCurrent(), dev->run_loop_mode); /* Create the RunLoopSource which is used to signal the event loop to stop when hid_close() is called. */ - CFRunLoopSourceContext ctx; memset(&ctx, 0, sizeof(ctx)); ctx.version = 0; ctx.info = dev; @@ -756,7 +756,6 @@ /* Run the Event Loop. CFRunLoopRunInMode() will dispatch HID input reports into the hid_report_callback(). */ - SInt32 code; while (!dev->shutdown_thread && !dev->disconnected) { code = CFRunLoopRunInMode(dev->run_loop_mode, 1000/*sec*/, FALSE); /* Return if the device has been disconnected */ @@ -796,10 +795,12 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path, int bExclusive) { - int i; + int i; hid_device *dev = NULL; CFIndex num_devices; - + CFSetRef device_set; + IOHIDDeviceRef *device_array; + dev = new_hid_device(); /* Set up the HID Manager if it hasn't been done */ @@ -809,10 +810,10 @@ /* give the IOHIDManager a chance to update itself */ process_pending_events(); - CFSetRef device_set = IOHIDManagerCopyDevices(hid_mgr); + device_set = IOHIDManagerCopyDevices(hid_mgr); num_devices = CFSetGetCount(device_set); - IOHIDDeviceRef *device_array = (IOHIDDeviceRef *)calloc(num_devices, sizeof(IOHIDDeviceRef)); + device_array = (IOHIDDeviceRef *)calloc(num_devices, sizeof(IOHIDDeviceRef)); CFSetGetValues(device_set, (const void **) device_array); for (i = 0; i < num_devices; i++) { char cbuf[BUF_LEN]; @@ -824,6 +825,7 @@ IOReturn ret = IOHIDDeviceOpen(os_dev, kIOHIDOptionsTypeNone); if (ret == kIOReturnSuccess) { char str[32]; + struct hid_device_list_node *node; free(device_array); CFRelease(device_set); @@ -845,7 +847,7 @@ os_dev, dev->input_report_buf, dev->max_input_report_len, &hid_report_callback, dev); - struct hid_device_list_node *node = (struct hid_device_list_node *)calloc(1, sizeof(struct hid_device_list_node)); + node = (struct hid_device_list_node *)calloc(1, sizeof(struct hid_device_list_node)); node->dev = dev; node->next = device_list; device_list = node; @@ -1083,13 +1085,13 @@ { CFIndex len = length; IOReturn res; - + int skipped_report_id = 0, report_number; + /* Return if the device has been unplugged. */ if (dev->disconnected) return -1; - int skipped_report_id = 0; - int report_number = data[0]; + report_number = data[0]; if (report_number == 0x0) { /* Offset the return buffer by 1, so that the report ID will remain in byte 0. */ diff -Nru libsdl2-2.0.22+dfsg/src/hidapi/SDL_hidapi.c libsdl2-2.24.0+dfsg/src/hidapi/SDL_hidapi.c --- libsdl2-2.0.22+dfsg/src/hidapi/SDL_hidapi.c 2022-04-21 17:37:37.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/hidapi/SDL_hidapi.c 2022-08-13 03:48:10.000000000 +0000 @@ -37,7 +37,7 @@ #if !SDL_HIDAPI_DISABLED -#if defined(__WIN32__) +#if defined(__WIN32__) || defined(__WINGDK__) #include "../core/windows/SDL_windows.h" #endif @@ -89,7 +89,7 @@ SDL_bool m_bCanGetNotifications; Uint32 m_unLastDetect; -#if defined(__WIN32__) +#if defined(__WIN32__) || defined(__WINGDK__) SDL_threadID m_nThreadID; WNDCLASSEXA m_wndClass; HWND m_hwndMsg; @@ -110,7 +110,7 @@ } SDL_HIDAPI_discovery; -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__WINGDK__) struct _DEV_BROADCAST_HDR { DWORD dbch_size; @@ -156,7 +156,7 @@ return DefWindowProc(hwnd, message, wParam, lParam); } -#endif /* __WIN32__ */ +#endif /* defined(__WIN32__) || defined(__WINGDK__) */ #if defined(__MACOSX__) @@ -219,7 +219,7 @@ SDL_HIDAPI_discovery.m_bCanGetNotifications = SDL_FALSE; SDL_HIDAPI_discovery.m_unLastDetect = 0; -#if defined(__WIN32__) +#if defined(__WIN32__) || defined(__WINGDK__) SDL_HIDAPI_discovery.m_nThreadID = SDL_ThreadID(); SDL_zero(SDL_HIDAPI_discovery.m_wndClass); @@ -246,7 +246,7 @@ SDL_HIDAPI_discovery.m_hNotify = RegisterDeviceNotification( SDL_HIDAPI_discovery.m_hwndMsg, &devBroadcast, DEVICE_NOTIFY_WINDOW_HANDLE | DEVICE_NOTIFY_ALL_INTERFACE_CLASSES ); SDL_HIDAPI_discovery.m_bCanGetNotifications = ( SDL_HIDAPI_discovery.m_hNotify != 0 ); } -#endif /* __WIN32__ */ +#endif /* defined(__WIN32__) || defined(__WINGDK__) */ #if defined(__MACOSX__) SDL_HIDAPI_discovery.m_notificationPort = IONotificationPortCreate(kIOMasterPortDefault); @@ -369,7 +369,7 @@ return; } -#if defined(__WIN32__) +#if defined(__WIN32__) || defined(__WINGDK__) #if 0 /* just let the usual SDL_PumpEvents loop dispatch these, fixing bug 4286. --ryan. */ /* We'll only get messages on the same thread that created the window */ if (SDL_ThreadID() == SDL_HIDAPI_discovery.m_nThreadID) { @@ -382,7 +382,7 @@ } } #endif -#endif /* __WIN32__ */ +#endif /* defined(__WIN32__) || defined(__WINGDK__) */ #if defined(__MACOSX__) if (SDL_HIDAPI_discovery.m_notificationPort) { @@ -474,7 +474,7 @@ return; } -#if defined(__WIN32__) +#if defined(__WIN32__) || defined(__WINGDK__) if (SDL_HIDAPI_discovery.m_hNotify) UnregisterDeviceNotification(SDL_HIDAPI_discovery.m_hNotify); @@ -578,7 +578,7 @@ #include "mac/hid.c" #define HAVE_PLATFORM_BACKEND 1 #define udev_ctx 1 -#elif __WINDOWS__ +#elif __WINDOWS__ || __WINGDK__ #include "windows/hid.c" #define HAVE_PLATFORM_BACKEND 1 #define udev_ctx 1 @@ -1034,54 +1034,60 @@ #endif #ifdef SDL_LIBUSB_DYNAMIC - ++attempts; - libusb_ctx.libhandle = SDL_LoadObject(SDL_LIBUSB_DYNAMIC); - if (libusb_ctx.libhandle != NULL) { - SDL_bool loaded = SDL_TRUE; - #ifdef __OS2__ - #define LOAD_LIBUSB_SYMBOL(func) \ - if (!(libusb_ctx.func = SDL_LoadFunction(libusb_ctx.libhandle,"_libusb_" #func))) {loaded = SDL_FALSE;} - #else - #define LOAD_LIBUSB_SYMBOL(func) \ - if (!(libusb_ctx.func = SDL_LoadFunction(libusb_ctx.libhandle, "libusb_" #func))) {loaded = SDL_FALSE;} - #endif - LOAD_LIBUSB_SYMBOL(init) - LOAD_LIBUSB_SYMBOL(exit) - LOAD_LIBUSB_SYMBOL(get_device_list) - LOAD_LIBUSB_SYMBOL(free_device_list) - LOAD_LIBUSB_SYMBOL(get_device_descriptor) - LOAD_LIBUSB_SYMBOL(get_active_config_descriptor) - LOAD_LIBUSB_SYMBOL(get_config_descriptor) - LOAD_LIBUSB_SYMBOL(free_config_descriptor) - LOAD_LIBUSB_SYMBOL(get_bus_number) - LOAD_LIBUSB_SYMBOL(get_device_address) - LOAD_LIBUSB_SYMBOL(open) - LOAD_LIBUSB_SYMBOL(close) - LOAD_LIBUSB_SYMBOL(claim_interface) - LOAD_LIBUSB_SYMBOL(release_interface) - LOAD_LIBUSB_SYMBOL(kernel_driver_active) - LOAD_LIBUSB_SYMBOL(detach_kernel_driver) - LOAD_LIBUSB_SYMBOL(attach_kernel_driver) - LOAD_LIBUSB_SYMBOL(set_interface_alt_setting) - LOAD_LIBUSB_SYMBOL(alloc_transfer) - LOAD_LIBUSB_SYMBOL(submit_transfer) - LOAD_LIBUSB_SYMBOL(cancel_transfer) - LOAD_LIBUSB_SYMBOL(free_transfer) - LOAD_LIBUSB_SYMBOL(control_transfer) - LOAD_LIBUSB_SYMBOL(interrupt_transfer) - LOAD_LIBUSB_SYMBOL(handle_events) - LOAD_LIBUSB_SYMBOL(handle_events_completed) - #undef LOAD_LIBUSB_SYMBOL - - if (!loaded) { - SDL_UnloadObject(libusb_ctx.libhandle); - libusb_ctx.libhandle = NULL; - /* SDL_LogWarn(SDL_LOG_CATEGORY_INPUT, SDL_LIBUSB_DYNAMIC " found but could not load function"); */ - } else if (LIBUSB_hid_init() < 0) { - SDL_UnloadObject(libusb_ctx.libhandle); - libusb_ctx.libhandle = NULL; - } else { - ++success; + if (SDL_getenv("SDL_HIDAPI_DISABLE_LIBUSB") != NULL) { + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + "libusb disabled by SDL_HIDAPI_DISABLE_LIBUSB"); + libusb_ctx.libhandle = NULL; + } else { + ++attempts; + libusb_ctx.libhandle = SDL_LoadObject(SDL_LIBUSB_DYNAMIC); + if (libusb_ctx.libhandle != NULL) { + SDL_bool loaded = SDL_TRUE; + #ifdef __OS2__ + #define LOAD_LIBUSB_SYMBOL(func) \ + if (!(libusb_ctx.func = SDL_LoadFunction(libusb_ctx.libhandle,"_libusb_" #func))) {loaded = SDL_FALSE;} + #else + #define LOAD_LIBUSB_SYMBOL(func) \ + if (!(libusb_ctx.func = SDL_LoadFunction(libusb_ctx.libhandle, "libusb_" #func))) {loaded = SDL_FALSE;} + #endif + LOAD_LIBUSB_SYMBOL(init) + LOAD_LIBUSB_SYMBOL(exit) + LOAD_LIBUSB_SYMBOL(get_device_list) + LOAD_LIBUSB_SYMBOL(free_device_list) + LOAD_LIBUSB_SYMBOL(get_device_descriptor) + LOAD_LIBUSB_SYMBOL(get_active_config_descriptor) + LOAD_LIBUSB_SYMBOL(get_config_descriptor) + LOAD_LIBUSB_SYMBOL(free_config_descriptor) + LOAD_LIBUSB_SYMBOL(get_bus_number) + LOAD_LIBUSB_SYMBOL(get_device_address) + LOAD_LIBUSB_SYMBOL(open) + LOAD_LIBUSB_SYMBOL(close) + LOAD_LIBUSB_SYMBOL(claim_interface) + LOAD_LIBUSB_SYMBOL(release_interface) + LOAD_LIBUSB_SYMBOL(kernel_driver_active) + LOAD_LIBUSB_SYMBOL(detach_kernel_driver) + LOAD_LIBUSB_SYMBOL(attach_kernel_driver) + LOAD_LIBUSB_SYMBOL(set_interface_alt_setting) + LOAD_LIBUSB_SYMBOL(alloc_transfer) + LOAD_LIBUSB_SYMBOL(submit_transfer) + LOAD_LIBUSB_SYMBOL(cancel_transfer) + LOAD_LIBUSB_SYMBOL(free_transfer) + LOAD_LIBUSB_SYMBOL(control_transfer) + LOAD_LIBUSB_SYMBOL(interrupt_transfer) + LOAD_LIBUSB_SYMBOL(handle_events) + LOAD_LIBUSB_SYMBOL(handle_events_completed) + #undef LOAD_LIBUSB_SYMBOL + + if (!loaded) { + SDL_UnloadObject(libusb_ctx.libhandle); + libusb_ctx.libhandle = NULL; + /* SDL_LogWarn(SDL_LOG_CATEGORY_INPUT, SDL_LIBUSB_DYNAMIC " found but could not load function"); */ + } else if (LIBUSB_hid_init() < 0) { + SDL_UnloadObject(libusb_ctx.libhandle); + libusb_ctx.libhandle = NULL; + } else { + ++success; + } } } #endif /* SDL_LIBUSB_DYNAMIC */ @@ -1524,7 +1530,7 @@ void SDL_hid_ble_scan(SDL_bool active) { -#if __IPHONEOS__ || __TVOS__ +#if !SDL_HIDAPI_DISABLED && (__IPHONEOS__ || __TVOS__) hid_ble_scan(active); #endif } diff -Nru libsdl2-2.0.22+dfsg/src/hidapi/windows/hid.c libsdl2-2.24.0+dfsg/src/hidapi/windows/hid.c --- libsdl2-2.0.22+dfsg/src/hidapi/windows/hid.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/hidapi/windows/hid.c 2022-06-02 02:01:57.000000000 +0000 @@ -43,21 +43,6 @@ typedef LONG NTSTATUS; #endif -/* SDL C runtime functions */ -#include "SDL_stdinc.h" - -#define calloc SDL_calloc -#define free SDL_free -#define malloc SDL_malloc -#define memcpy SDL_memcpy -#define memset SDL_memset -#define strcmp SDL_strcmp -#define strlen SDL_strlen -#define strstr SDL_strstr -#define strtol SDL_strtol -#define wcscmp SDL_wcscmp -#define _wcsdup SDL_wcsdup - /* The maximum number of characters that can be passed into the HidD_Get*String() functions without it failing.*/ #define MAX_STRING_WCHARS 0xFFF @@ -94,11 +79,26 @@ } /* extern "C" */ #endif +#include "../hidapi/hidapi.h" + /*#include */ /*#include */ +/* SDL C runtime functions */ +#include "SDL_stdinc.h" + +#define calloc SDL_calloc +#define free SDL_free +#define malloc SDL_malloc +#define memcpy SDL_memcpy +#define memset SDL_memset +#define strcmp SDL_strcmp +#define strlen SDL_strlen +#define strstr SDL_strstr +#define strtol SDL_strtol +#define wcscmp SDL_wcscmp +#define _wcsdup SDL_wcsdup -#include "../hidapi/hidapi.h" #undef MIN #define MIN(x,y) ((x) < (y)? (x): (y)) diff -Nru libsdl2-2.0.22+dfsg/src/joystick/android/SDL_sysjoystick.c libsdl2-2.24.0+dfsg/src/joystick/android/SDL_sysjoystick.c --- libsdl2-2.0.22+dfsg/src/joystick/android/SDL_sysjoystick.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/android/SDL_sysjoystick.c 2022-06-02 02:01:57.000000000 +0000 @@ -558,6 +558,12 @@ return JoystickByDevIndex(device_index)->name; } +static const char * +ANDROID_JoystickGetDevicePath(int device_index) +{ + return NULL; +} + static int ANDROID_JoystickGetDevicePlayerIndex(int device_index) { @@ -713,6 +719,7 @@ ANDROID_JoystickGetCount, ANDROID_JoystickDetect, ANDROID_JoystickGetDeviceName, + ANDROID_JoystickGetDevicePath, ANDROID_JoystickGetDevicePlayerIndex, ANDROID_JoystickSetDevicePlayerIndex, ANDROID_JoystickGetDeviceGUID, diff -Nru libsdl2-2.0.22+dfsg/src/joystick/bsd/SDL_bsdjoystick.c libsdl2-2.24.0+dfsg/src/joystick/bsd/SDL_bsdjoystick.c --- libsdl2-2.0.22+dfsg/src/joystick/bsd/SDL_bsdjoystick.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/bsd/SDL_bsdjoystick.c 2022-06-02 02:01:57.000000000 +0000 @@ -268,9 +268,15 @@ BSD_JoystickGetDeviceName(int device_index) { if (joydevnames[device_index] != NULL) { - return (joydevnames[device_index]); + return joydevnames[device_index]; } - return (joynames[device_index]); + return joynames[device_index]; +} + +static const char * +BSD_JoystickGetDevicePath(int device_index) +{ + return joynames[device_index]; } static int @@ -807,6 +813,7 @@ BSD_JoystickGetCount, BSD_JoystickDetect, BSD_JoystickGetDeviceName, + BSD_JoystickGetDevicePath, BSD_JoystickGetDevicePlayerIndex, BSD_JoystickSetDevicePlayerIndex, BSD_JoystickGetDeviceGUID, diff -Nru libsdl2-2.0.22+dfsg/src/joystick/controller_type.c libsdl2-2.24.0+dfsg/src/joystick/controller_type.c --- libsdl2-2.0.22+dfsg/src/joystick/controller_type.c 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/controller_type.c 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,696 @@ +/* + Copyright (C) Valve Corporation + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../SDL_internal.h" + +#include "SDL_hints.h" +#include "SDL_gamecontroller.h" + +#include "controller_type.h" + + +#define MAKE_CONTROLLER_ID( nVID, nPID ) (unsigned int)( (unsigned int)nVID << 16 | (unsigned int)nPID ) + +static const ControllerDescription_t arrControllers[] = { + { MAKE_CONTROLLER_ID( 0x0079, 0x181a ), k_eControllerType_PS3Controller, NULL }, // Venom Arcade Stick + { MAKE_CONTROLLER_ID( 0x0079, 0x1844 ), k_eControllerType_PS3Controller, NULL }, // From SDL + { MAKE_CONTROLLER_ID( 0x044f, 0xb315 ), k_eControllerType_PS3Controller, NULL }, // Firestorm Dual Analog 3 + { MAKE_CONTROLLER_ID( 0x044f, 0xd007 ), k_eControllerType_PS3Controller, NULL }, // Thrustmaster wireless 3-1 + { MAKE_CONTROLLER_ID( 0x054c, 0x0268 ), k_eControllerType_PS3Controller, NULL }, // Sony PS3 Controller + { MAKE_CONTROLLER_ID( 0x056e, 0x200f ), k_eControllerType_PS3Controller, NULL }, // From SDL + { MAKE_CONTROLLER_ID( 0x056e, 0x2013 ), k_eControllerType_PS3Controller, NULL }, // JC-U4113SBK + { MAKE_CONTROLLER_ID( 0x05b8, 0x1004 ), k_eControllerType_PS3Controller, NULL }, // From SDL + { MAKE_CONTROLLER_ID( 0x05b8, 0x1006 ), k_eControllerType_PS3Controller, NULL }, // JC-U3412SBK + { MAKE_CONTROLLER_ID( 0x06a3, 0xf622 ), k_eControllerType_PS3Controller, NULL }, // Cyborg V3 + { MAKE_CONTROLLER_ID( 0x0738, 0x3180 ), k_eControllerType_PS3Controller, NULL }, // Mad Catz Alpha PS3 mode + { MAKE_CONTROLLER_ID( 0x0738, 0x3250 ), k_eControllerType_PS3Controller, NULL }, // madcats fightpad pro ps3 + { MAKE_CONTROLLER_ID( 0x0738, 0x8180 ), k_eControllerType_PS3Controller, NULL }, // Mad Catz Alpha PS4 mode (no touchpad on device) + { MAKE_CONTROLLER_ID( 0x0738, 0x8838 ), k_eControllerType_PS3Controller, NULL }, // Madcatz Fightstick Pro + { MAKE_CONTROLLER_ID( 0x0810, 0x0001 ), k_eControllerType_PS3Controller, NULL }, // actually ps2 - maybe break out later + { MAKE_CONTROLLER_ID( 0x0810, 0x0003 ), k_eControllerType_PS3Controller, NULL }, // actually ps2 - maybe break out later + { MAKE_CONTROLLER_ID( 0x0925, 0x0005 ), k_eControllerType_PS3Controller, NULL }, // Sony PS3 Controller + { MAKE_CONTROLLER_ID( 0x0925, 0x8866 ), k_eControllerType_PS3Controller, NULL }, // PS2 maybe break out later + { MAKE_CONTROLLER_ID( 0x0925, 0x8888 ), k_eControllerType_PS3Controller, NULL }, // Actually ps2 -maybe break out later Lakeview Research WiseGroup Ltd, MP-8866 Dual Joypad + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0109 ), k_eControllerType_PS3Controller, NULL }, // PDP Versus Fighting Pad + { MAKE_CONTROLLER_ID( 0x0e6f, 0x011e ), k_eControllerType_PS3Controller, NULL }, // Rock Candy PS4 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0128 ), k_eControllerType_PS3Controller, NULL }, // Rock Candy PS3 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0203 ), k_eControllerType_PS3Controller, NULL }, // Victrix Pro FS (PS4 peripheral but no trackpad/lightbar) + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0214 ), k_eControllerType_PS3Controller, NULL }, // afterglow ps3 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x1314 ), k_eControllerType_PS3Controller, NULL }, // PDP Afterglow Wireless PS3 controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x6302 ), k_eControllerType_PS3Controller, NULL }, // From SDL + { MAKE_CONTROLLER_ID( 0x0e8f, 0x0008 ), k_eControllerType_PS3Controller, NULL }, // Green Asia + { MAKE_CONTROLLER_ID( 0x0e8f, 0x3075 ), k_eControllerType_PS3Controller, NULL }, // SpeedLink Strike FX + { MAKE_CONTROLLER_ID( 0x0e8f, 0x310d ), k_eControllerType_PS3Controller, NULL }, // From SDL + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0009 ), k_eControllerType_PS3Controller, NULL }, // HORI BDA GP1 + { MAKE_CONTROLLER_ID( 0x0f0d, 0x004d ), k_eControllerType_PS3Controller, NULL }, // Horipad 3 + { MAKE_CONTROLLER_ID( 0x0f0d, 0x005e ), k_eControllerType_PS3Controller, NULL }, // HORI Fighting commander ps4 + { MAKE_CONTROLLER_ID( 0x0f0d, 0x005f ), k_eControllerType_PS3Controller, NULL }, // HORI Fighting commander ps3 + { MAKE_CONTROLLER_ID( 0x0f0d, 0x006a ), k_eControllerType_PS3Controller, NULL }, // Real Arcade Pro 4 + { MAKE_CONTROLLER_ID( 0x0f0d, 0x006e ), k_eControllerType_PS3Controller, NULL }, // HORI horipad4 ps3 + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0085 ), k_eControllerType_PS3Controller, NULL }, // HORI Fighting Commander PS3 + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0086 ), k_eControllerType_PS3Controller, NULL }, // HORI Fighting Commander PC (Uses the Xbox 360 protocol, but has PS3 buttons) + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0088 ), k_eControllerType_PS3Controller, NULL }, // HORI Fighting Stick mini 4 + { MAKE_CONTROLLER_ID( 0x0f30, 0x1100 ), k_eControllerType_PS3Controller, NULL }, // Qanba Q1 fight stick + { MAKE_CONTROLLER_ID( 0x11ff, 0x3331 ), k_eControllerType_PS3Controller, NULL }, // SRXJ-PH2400 + { MAKE_CONTROLLER_ID( 0x1345, 0x1000 ), k_eControllerType_PS3Controller, NULL }, // PS2 ACME GA-D5 + { MAKE_CONTROLLER_ID( 0x1345, 0x6005 ), k_eControllerType_PS3Controller, NULL }, // ps2 maybe break out later + { MAKE_CONTROLLER_ID( 0x146b, 0x0603 ), k_eControllerType_PS3Controller, NULL }, // From SDL + { MAKE_CONTROLLER_ID( 0x146b, 0x5500 ), k_eControllerType_PS3Controller, NULL }, // From SDL + { MAKE_CONTROLLER_ID( 0x1a34, 0x0836 ), k_eControllerType_PS3Controller, NULL }, // Afterglow PS3 + { MAKE_CONTROLLER_ID( 0x20bc, 0x5500 ), k_eControllerType_PS3Controller, NULL }, // ShanWan PS3 + { MAKE_CONTROLLER_ID( 0x20d6, 0x576d ), k_eControllerType_PS3Controller, NULL }, // Power A PS3 + { MAKE_CONTROLLER_ID( 0x20d6, 0xca6d ), k_eControllerType_PS3Controller, NULL }, // From SDL + { MAKE_CONTROLLER_ID( 0x2563, 0x0523 ), k_eControllerType_PS3Controller, NULL }, // Digiflip GP006 + { MAKE_CONTROLLER_ID( 0x2563, 0x0575 ), k_eControllerType_PS3Controller, NULL }, // From SDL + { MAKE_CONTROLLER_ID( 0x25f0, 0x83c3 ), k_eControllerType_PS3Controller, NULL }, // gioteck vx2 + { MAKE_CONTROLLER_ID( 0x25f0, 0xc121 ), k_eControllerType_PS3Controller, NULL }, // + { MAKE_CONTROLLER_ID( 0x2c22, 0x2000 ), k_eControllerType_PS3Controller, NULL }, // Qanba Drone + { MAKE_CONTROLLER_ID( 0x2c22, 0x2003 ), k_eControllerType_PS3Controller, NULL }, // From SDL + { MAKE_CONTROLLER_ID( 0x2c22, 0x2302 ), k_eControllerType_PS3Controller, NULL }, // Qanba Obsidian + { MAKE_CONTROLLER_ID( 0x2c22, 0x2502 ), k_eControllerType_PS3Controller, NULL }, // Qanba Dragon + { MAKE_CONTROLLER_ID( 0x8380, 0x0003 ), k_eControllerType_PS3Controller, NULL }, // BTP 2163 + { MAKE_CONTROLLER_ID( 0x8888, 0x0308 ), k_eControllerType_PS3Controller, NULL }, // Sony PS3 Controller + + { MAKE_CONTROLLER_ID( 0x0079, 0x181b ), k_eControllerType_PS4Controller, NULL }, // Venom Arcade Stick - XXX:this may not work and may need to be called a ps3 controller + { MAKE_CONTROLLER_ID( 0x054c, 0x05c4 ), k_eControllerType_PS4Controller, NULL }, // Sony PS4 Controller + { MAKE_CONTROLLER_ID( 0x054c, 0x05c5 ), k_eControllerType_PS4Controller, NULL }, // STRIKEPAD PS4 Grip Add-on + { MAKE_CONTROLLER_ID( 0x054c, 0x09cc ), k_eControllerType_PS4Controller, NULL }, // Sony PS4 Slim Controller + { MAKE_CONTROLLER_ID( 0x054c, 0x0ba0 ), k_eControllerType_PS4Controller, NULL }, // Sony PS4 Controller (Wireless dongle) + { MAKE_CONTROLLER_ID( 0x0738, 0x8250 ), k_eControllerType_PS4Controller, NULL }, // Mad Catz FightPad Pro PS4 + { MAKE_CONTROLLER_ID( 0x0738, 0x8384 ), k_eControllerType_PS4Controller, NULL }, // Mad Catz FightStick TE S+ PS4 + { MAKE_CONTROLLER_ID( 0x0738, 0x8480 ), k_eControllerType_PS4Controller, NULL }, // Mad Catz FightStick TE 2 PS4 + { MAKE_CONTROLLER_ID( 0x0738, 0x8481 ), k_eControllerType_PS4Controller, NULL }, // Mad Catz FightStick TE 2+ PS4 + { MAKE_CONTROLLER_ID( 0x0C12, 0x0E10 ), k_eControllerType_PS4Controller, NULL }, // Armor Armor 3 Pad PS4 + { MAKE_CONTROLLER_ID( 0x0C12, 0x1CF6 ), k_eControllerType_PS4Controller, NULL }, // EMIO PS4 Elite Controller + { MAKE_CONTROLLER_ID( 0x0c12, 0x0e15 ), k_eControllerType_PS4Controller, NULL }, // Game:Pad 4 + { MAKE_CONTROLLER_ID( 0x0c12, 0x0ef6 ), k_eControllerType_PS4Controller, NULL }, // Hitbox Arcade Stick + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0055 ), k_eControllerType_PS4Controller, NULL }, // HORIPAD 4 FPS + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0066 ), k_eControllerType_PS4Controller, NULL }, // HORIPAD 4 FPS Plus + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0084 ), k_eControllerType_PS4Controller, NULL }, // HORI Fighting Commander PS4 + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0087 ), k_eControllerType_PS4Controller, NULL }, // HORI Fighting Stick mini 4 + { MAKE_CONTROLLER_ID( 0x0f0d, 0x008a ), k_eControllerType_PS4Controller, NULL }, // HORI Real Arcade Pro 4 + { MAKE_CONTROLLER_ID( 0x0f0d, 0x009c ), k_eControllerType_PS4Controller, NULL }, // HORI TAC PRO mousething + { MAKE_CONTROLLER_ID( 0x0f0d, 0x00a0 ), k_eControllerType_PS4Controller, NULL }, // HORI TAC4 mousething + { MAKE_CONTROLLER_ID( 0x0f0d, 0x00ee ), k_eControllerType_PS4Controller, NULL }, // Hori mini wired https://www.playstation.com/en-us/explore/accessories/gaming-controllers/mini-wired-gamepad/ + { MAKE_CONTROLLER_ID( 0x11c0, 0x4001 ), k_eControllerType_PS4Controller, NULL }, // "PS4 Fun Controller" added from user log + { MAKE_CONTROLLER_ID( 0x146b, 0x0d01 ), k_eControllerType_PS4Controller, NULL }, // Nacon Revolution Pro Controller - has gyro + { MAKE_CONTROLLER_ID( 0x146b, 0x0d02 ), k_eControllerType_PS4Controller, NULL }, // Nacon Revolution Pro Controller v2 - has gyro + { MAKE_CONTROLLER_ID( 0x146b, 0x0d10 ), k_eControllerType_PS4Controller, NULL }, // NACON Revolution Infinite - has gyro + { MAKE_CONTROLLER_ID( 0x1532, 0X0401 ), k_eControllerType_PS4Controller, NULL }, // Razer Panthera PS4 Controller + { MAKE_CONTROLLER_ID( 0x1532, 0x1000 ), k_eControllerType_PS4Controller, NULL }, // Razer Raiju PS4 Controller + { MAKE_CONTROLLER_ID( 0x1532, 0x1004 ), k_eControllerType_PS4Controller, NULL }, // Razer Raiju 2 Ultimate USB + { MAKE_CONTROLLER_ID( 0x1532, 0x1007 ), k_eControllerType_PS4Controller, NULL }, // Razer Raiju 2 Tournament edition USB + { MAKE_CONTROLLER_ID( 0x1532, 0x1008 ), k_eControllerType_PS4Controller, NULL }, // Razer Panthera Evo Fightstick + { MAKE_CONTROLLER_ID( 0x1532, 0x1009 ), k_eControllerType_PS4Controller, NULL }, // Razer Raiju 2 Ultimate BT + { MAKE_CONTROLLER_ID( 0x1532, 0x100A ), k_eControllerType_PS4Controller, NULL }, // Razer Raiju 2 Tournament edition BT + { MAKE_CONTROLLER_ID( 0x1532, 0x1100 ), k_eControllerType_PS4Controller, NULL }, // Razer RAION Fightpad - Trackpad, no gyro, lightbar hardcoded to green + { MAKE_CONTROLLER_ID( 0x20d6, 0x792a ), k_eControllerType_PS4Controller, NULL }, // PowerA Fusion Fight Pad + { MAKE_CONTROLLER_ID( 0x2c22, 0x2300 ), k_eControllerType_PS4Controller, "Qanba Obsidian Arcade Joystick" }, // Qanba Obsidian + { MAKE_CONTROLLER_ID( 0x2c22, 0x2500 ), k_eControllerType_PS4Controller, "Qanba Dragon Arcade Joystick" }, // Qanba Dragon + { MAKE_CONTROLLER_ID( 0x7545, 0x0104 ), k_eControllerType_PS4Controller, NULL }, // Armor 3 or Level Up Cobra - At least one variant has gyro + { MAKE_CONTROLLER_ID( 0x9886, 0x0025 ), k_eControllerType_PS4Controller, NULL }, // Astro C40 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0207 ), k_eControllerType_PS4Controller, NULL }, // Victrix Pro Fightstick w/ Touchpad for PS4 + // Removing the Giotek because there were a bunch of help tickets from users w/ issues including from non-PS4 controller users. This VID/PID is probably used in different FW's +// { MAKE_CONTROLLER_ID( 0x7545, 0x1122 ), k_eControllerType_PS4Controller, NULL }, // Giotek VX4 - trackpad/gyro don't work. Had to not filter on interface info. Light bar is flaky, but works. + { MAKE_CONTROLLER_ID( 0x044f, 0xd00e ), k_eControllerType_PS4Controller, NULL }, // Thrustmast Eswap Pro - No gyro and lightbar doesn't change color. Works otherwise + { MAKE_CONTROLLER_ID( 0x0c12, 0x1e10 ), k_eControllerType_PS4Controller, NULL }, // P4 Wired Gamepad generic knock off - lightbar but not trackpad or gyro + { MAKE_CONTROLLER_ID( 0x146b, 0x0d09 ), k_eControllerType_PS4Controller, NULL }, // NACON Daija Fight Stick - touchpad but no gyro/rumble + { MAKE_CONTROLLER_ID( 0x146b, 0x0d10 ), k_eControllerType_PS4Controller, NULL }, // NACON Revolution Unlimited + { MAKE_CONTROLLER_ID( 0x146b, 0x0d08 ), k_eControllerType_PS4Controller, NULL }, // NACON Revolution Unlimited Wireless Dongle + { MAKE_CONTROLLER_ID( 0x146b, 0x0d06 ), k_eControllerType_PS4Controller, NULL }, // NACON Asymetrical Controller Wireless Dongle -- show up as ps4 until you connect controller to it then it reboots into Xbox controller with different vvid/pid + { MAKE_CONTROLLER_ID( 0x146b, 0x1103 ), k_eControllerType_PS4Controller, NULL }, // NACON Asymetrical Controller -- on windows this doesn't enumerate + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0123 ), k_eControllerType_PS4Controller, NULL }, // HORI Wireless Controller Light (Japan only) - only over bt- over usb is xbox and pid 0x0124 + { MAKE_CONTROLLER_ID( 0x146b, 0x0d13 ), k_eControllerType_PS4Controller, NULL }, // NACON Revolution 3 + { MAKE_CONTROLLER_ID( 0x0c12, 0x0e20 ), k_eControllerType_PS4Controller, NULL }, // Brook Mars Controller - needs FW update to show up as Ps4 controller on PC. Has Gyro but touchpad is a single button. + + { MAKE_CONTROLLER_ID( 0x054c, 0x0ce6 ), k_eControllerType_PS5Controller, NULL }, // Sony PS5 Controller + + { MAKE_CONTROLLER_ID( 0x0079, 0x0006 ), k_eControllerType_UnknownNonSteamController, NULL }, // DragonRise Generic USB PCB, sometimes configured as a PC Twin Shock Controller - looks like a DS3 but the face buttons are 1-4 instead of symbols + + { MAKE_CONTROLLER_ID( 0x0079, 0x18d4 ), k_eControllerType_XBox360Controller, NULL }, // GPD Win 2 X-Box Controller + { MAKE_CONTROLLER_ID( 0x03eb, 0xff02 ), k_eControllerType_XBox360Controller, NULL }, // Wooting Two + { MAKE_CONTROLLER_ID( 0x044f, 0xb326 ), k_eControllerType_XBox360Controller, NULL }, // Thrustmaster Gamepad GP XID + { MAKE_CONTROLLER_ID( 0x045e, 0x028e ), k_eControllerType_XBox360Controller, "Xbox 360 Controller" }, // Microsoft X-Box 360 pad + { MAKE_CONTROLLER_ID( 0x045e, 0x028f ), k_eControllerType_XBox360Controller, "Xbox 360 Controller" }, // Microsoft X-Box 360 pad v2 + { MAKE_CONTROLLER_ID( 0x045e, 0x0291 ), k_eControllerType_XBox360Controller, "Xbox 360 Wireless Controller" }, // Xbox 360 Wireless Receiver (XBOX) + { MAKE_CONTROLLER_ID( 0x045e, 0x02a0 ), k_eControllerType_XBox360Controller, NULL }, // Microsoft X-Box 360 Big Button IR + { MAKE_CONTROLLER_ID( 0x045e, 0x02a1 ), k_eControllerType_XBox360Controller, NULL }, // Microsoft X-Box 360 Wireless Controller with XUSB driver on Windows + { MAKE_CONTROLLER_ID( 0x045e, 0x02a9 ), k_eControllerType_XBox360Controller, "Xbox 360 Wireless Controller" }, // Xbox 360 Wireless Receiver (third party knockoff) + { MAKE_CONTROLLER_ID( 0x045e, 0x0719 ), k_eControllerType_XBox360Controller, "Xbox 360 Wireless Controller" }, // Xbox 360 Wireless Receiver + { MAKE_CONTROLLER_ID( 0x046d, 0xc21d ), k_eControllerType_XBox360Controller, NULL }, // Logitech Gamepad F310 + { MAKE_CONTROLLER_ID( 0x046d, 0xc21e ), k_eControllerType_XBox360Controller, NULL }, // Logitech Gamepad F510 + { MAKE_CONTROLLER_ID( 0x046d, 0xc21f ), k_eControllerType_XBox360Controller, NULL }, // Logitech Gamepad F710 + { MAKE_CONTROLLER_ID( 0x046d, 0xc242 ), k_eControllerType_XBox360Controller, NULL }, // Logitech Chillstream Controller + { MAKE_CONTROLLER_ID( 0x056e, 0x2004 ), k_eControllerType_XBox360Controller, NULL }, // Elecom JC-U3613M + { MAKE_CONTROLLER_ID( 0x06a3, 0xf51a ), k_eControllerType_XBox360Controller, NULL }, // Saitek P3600 + { MAKE_CONTROLLER_ID( 0x0738, 0x4716 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Wired Xbox 360 Controller + { MAKE_CONTROLLER_ID( 0x0738, 0x4718 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Street Fighter IV FightStick SE + { MAKE_CONTROLLER_ID( 0x0738, 0x4726 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Xbox 360 Controller + { MAKE_CONTROLLER_ID( 0x0738, 0x4728 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Street Fighter IV FightPad + { MAKE_CONTROLLER_ID( 0x0738, 0x4736 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz MicroCon Gamepad + { MAKE_CONTROLLER_ID( 0x0738, 0x4738 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Wired Xbox 360 Controller (SFIV) + { MAKE_CONTROLLER_ID( 0x0738, 0x4740 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Beat Pad + { MAKE_CONTROLLER_ID( 0x0738, 0xb726 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Xbox controller - MW2 + { MAKE_CONTROLLER_ID( 0x0738, 0xbeef ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz JOYTECH NEO SE Advanced GamePad + { MAKE_CONTROLLER_ID( 0x0738, 0xcb02 ), k_eControllerType_XBox360Controller, NULL }, // Saitek Cyborg Rumble Pad - PC/Xbox 360 + { MAKE_CONTROLLER_ID( 0x0738, 0xcb03 ), k_eControllerType_XBox360Controller, NULL }, // Saitek P3200 Rumble Pad - PC/Xbox 360 + { MAKE_CONTROLLER_ID( 0x0738, 0xf738 ), k_eControllerType_XBox360Controller, NULL }, // Super SFIV FightStick TE S + { MAKE_CONTROLLER_ID( 0x0955, 0x7210 ), k_eControllerType_XBox360Controller, NULL }, // Nvidia Shield local controller + { MAKE_CONTROLLER_ID( 0x0955, 0xb400 ), k_eControllerType_XBox360Controller, NULL }, // NVIDIA Shield streaming controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0105 ), k_eControllerType_XBox360Controller, NULL }, // HSM3 Xbox360 dancepad + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0113 ), k_eControllerType_XBox360Controller, "PDP Xbox 360 Afterglow" }, // PDP Afterglow Gamepad for Xbox 360 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x011f ), k_eControllerType_XBox360Controller, "PDP Xbox 360 Rock Candy" }, // PDP Rock Candy Gamepad for Xbox 360 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0125 ), k_eControllerType_XBox360Controller, "PDP INJUSTICE FightStick" }, // PDP INJUSTICE FightStick for Xbox 360 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0127 ), k_eControllerType_XBox360Controller, "PDP INJUSTICE FightPad" }, // PDP INJUSTICE FightPad for Xbox 360 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0131 ), k_eControllerType_XBox360Controller, "PDP EA Soccer Controller" }, // PDP EA Soccer Gamepad + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0133 ), k_eControllerType_XBox360Controller, "PDP Battlefield 4 Controller" }, // PDP Battlefield 4 Gamepad + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0143 ), k_eControllerType_XBox360Controller, "PDP MK X Fight Stick" }, // PDP MK X Fight Stick for Xbox 360 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0147 ), k_eControllerType_XBox360Controller, "PDP Xbox 360 Marvel Controller" }, // PDP Marvel Controller for Xbox 360 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0201 ), k_eControllerType_XBox360Controller, "PDP Xbox 360 Controller" }, // PDP Gamepad for Xbox 360 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0213 ), k_eControllerType_XBox360Controller, "PDP Xbox 360 Afterglow" }, // PDP Afterglow Gamepad for Xbox 360 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x021f ), k_eControllerType_XBox360Controller, "PDP Xbox 360 Rock Candy" }, // PDP Rock Candy Gamepad for Xbox 360 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0301 ), k_eControllerType_XBox360Controller, "PDP Xbox 360 Controller" }, // PDP Gamepad for Xbox 360 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0313 ), k_eControllerType_XBox360Controller, "PDP Xbox 360 Afterglow" }, // PDP Afterglow Gamepad for Xbox 360 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0314 ), k_eControllerType_XBox360Controller, "PDP Xbox 360 Afterglow" }, // PDP Afterglow Gamepad for Xbox 360 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0401 ), k_eControllerType_XBox360Controller, "PDP Xbox 360 Controller" }, // PDP Gamepad for Xbox 360 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0413 ), k_eControllerType_XBox360Controller, NULL }, // PDP Afterglow AX.1 (unlisted) + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0501 ), k_eControllerType_XBox360Controller, NULL }, // PDP Xbox 360 Controller (unlisted) + { MAKE_CONTROLLER_ID( 0x0e6f, 0xf900 ), k_eControllerType_XBox360Controller, NULL }, // PDP Afterglow AX.1 (unlisted) + { MAKE_CONTROLLER_ID( 0x0f0d, 0x000a ), k_eControllerType_XBox360Controller, NULL }, // Hori Co. DOA4 FightStick + { MAKE_CONTROLLER_ID( 0x0f0d, 0x000c ), k_eControllerType_XBox360Controller, NULL }, // Hori PadEX Turbo + { MAKE_CONTROLLER_ID( 0x0f0d, 0x000d ), k_eControllerType_XBox360Controller, NULL }, // Hori Fighting Stick EX2 + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0016 ), k_eControllerType_XBox360Controller, NULL }, // Hori Real Arcade Pro.EX + { MAKE_CONTROLLER_ID( 0x0f0d, 0x001b ), k_eControllerType_XBox360Controller, NULL }, // Hori Real Arcade Pro VX + { MAKE_CONTROLLER_ID( 0x0f0d, 0x008c ), k_eControllerType_XBox360Controller, NULL }, // Hori Real Arcade Pro 4 + { MAKE_CONTROLLER_ID( 0x0f0d, 0x00db ), k_eControllerType_XBox360Controller, "HORI Slime Controller" }, // Hori Dragon Quest Slime Controller + { MAKE_CONTROLLER_ID( 0x1038, 0x1430 ), k_eControllerType_XBox360Controller, "SteelSeries Stratus Duo" }, // SteelSeries Stratus Duo + { MAKE_CONTROLLER_ID( 0x1038, 0x1431 ), k_eControllerType_XBox360Controller, "SteelSeries Stratus Duo" }, // SteelSeries Stratus Duo + { MAKE_CONTROLLER_ID( 0x1038, 0xb360 ), k_eControllerType_XBox360Controller, NULL }, // SteelSeries Nimbus/Stratus XL + { MAKE_CONTROLLER_ID( 0x11c9, 0x55f0 ), k_eControllerType_XBox360Controller, NULL }, // Nacon GC-100XF + { MAKE_CONTROLLER_ID( 0x12ab, 0x0004 ), k_eControllerType_XBox360Controller, NULL }, // Honey Bee Xbox360 dancepad + { MAKE_CONTROLLER_ID( 0x12ab, 0x0301 ), k_eControllerType_XBox360Controller, NULL }, // PDP AFTERGLOW AX.1 + { MAKE_CONTROLLER_ID( 0x12ab, 0x0303 ), k_eControllerType_XBox360Controller, NULL }, // Mortal Kombat Klassic FightStick + { MAKE_CONTROLLER_ID( 0x1430, 0x02a0 ), k_eControllerType_XBox360Controller, NULL }, // RedOctane Controller Adapter + { MAKE_CONTROLLER_ID( 0x1430, 0x4748 ), k_eControllerType_XBox360Controller, NULL }, // RedOctane Guitar Hero X-plorer + { MAKE_CONTROLLER_ID( 0x1430, 0xf801 ), k_eControllerType_XBox360Controller, NULL }, // RedOctane Controller + { MAKE_CONTROLLER_ID( 0x146b, 0x0601 ), k_eControllerType_XBox360Controller, NULL }, // BigBen Interactive XBOX 360 Controller +// { MAKE_CONTROLLER_ID( 0x1532, 0x0037 ), k_eControllerType_XBox360Controller, NULL }, // Razer Sabertooth + { MAKE_CONTROLLER_ID( 0x15e4, 0x3f00 ), k_eControllerType_XBox360Controller, NULL }, // Power A Mini Pro Elite + { MAKE_CONTROLLER_ID( 0x15e4, 0x3f0a ), k_eControllerType_XBox360Controller, NULL }, // Xbox Airflo wired controller + { MAKE_CONTROLLER_ID( 0x15e4, 0x3f10 ), k_eControllerType_XBox360Controller, NULL }, // Batarang Xbox 360 controller + { MAKE_CONTROLLER_ID( 0x162e, 0xbeef ), k_eControllerType_XBox360Controller, NULL }, // Joytech Neo-Se Take2 + { MAKE_CONTROLLER_ID( 0x1689, 0xfd00 ), k_eControllerType_XBox360Controller, NULL }, // Razer Onza Tournament Edition + { MAKE_CONTROLLER_ID( 0x1689, 0xfd01 ), k_eControllerType_XBox360Controller, NULL }, // Razer Onza Classic Edition + { MAKE_CONTROLLER_ID( 0x1689, 0xfe00 ), k_eControllerType_XBox360Controller, NULL }, // Razer Sabertooth + { MAKE_CONTROLLER_ID( 0x1949, 0x041a ), k_eControllerType_XBox360Controller, "Amazon Luna Controller" }, // Amazon Luna Controller + { MAKE_CONTROLLER_ID( 0x1bad, 0x0002 ), k_eControllerType_XBox360Controller, NULL }, // Harmonix Rock Band Guitar + { MAKE_CONTROLLER_ID( 0x1bad, 0x0003 ), k_eControllerType_XBox360Controller, NULL }, // Harmonix Rock Band Drumkit + { MAKE_CONTROLLER_ID( 0x1bad, 0xf016 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Xbox 360 Controller + { MAKE_CONTROLLER_ID( 0x1bad, 0xf018 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Street Fighter IV SE Fighting Stick + { MAKE_CONTROLLER_ID( 0x1bad, 0xf019 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Brawlstick for Xbox 360 + { MAKE_CONTROLLER_ID( 0x1bad, 0xf021 ), k_eControllerType_XBox360Controller, NULL }, // Mad Cats Ghost Recon FS GamePad + { MAKE_CONTROLLER_ID( 0x1bad, 0xf023 ), k_eControllerType_XBox360Controller, NULL }, // MLG Pro Circuit Controller (Xbox) + { MAKE_CONTROLLER_ID( 0x1bad, 0xf025 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Call Of Duty + { MAKE_CONTROLLER_ID( 0x1bad, 0xf027 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz FPS Pro + { MAKE_CONTROLLER_ID( 0x1bad, 0xf028 ), k_eControllerType_XBox360Controller, NULL }, // Street Fighter IV FightPad + { MAKE_CONTROLLER_ID( 0x1bad, 0xf02e ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Fightpad + { MAKE_CONTROLLER_ID( 0x1bad, 0xf036 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz MicroCon GamePad Pro + { MAKE_CONTROLLER_ID( 0x1bad, 0xf038 ), k_eControllerType_XBox360Controller, NULL }, // Street Fighter IV FightStick TE + { MAKE_CONTROLLER_ID( 0x1bad, 0xf039 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz MvC2 TE + { MAKE_CONTROLLER_ID( 0x1bad, 0xf03a ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz SFxT Fightstick Pro + { MAKE_CONTROLLER_ID( 0x1bad, 0xf03d ), k_eControllerType_XBox360Controller, NULL }, // Street Fighter IV Arcade Stick TE - Chun Li + { MAKE_CONTROLLER_ID( 0x1bad, 0xf03e ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz MLG FightStick TE + { MAKE_CONTROLLER_ID( 0x1bad, 0xf03f ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz FightStick SoulCaliber + { MAKE_CONTROLLER_ID( 0x1bad, 0xf042 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz FightStick TES+ + { MAKE_CONTROLLER_ID( 0x1bad, 0xf080 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz FightStick TE2 + { MAKE_CONTROLLER_ID( 0x1bad, 0xf501 ), k_eControllerType_XBox360Controller, NULL }, // HoriPad EX2 Turbo + { MAKE_CONTROLLER_ID( 0x1bad, 0xf502 ), k_eControllerType_XBox360Controller, NULL }, // Hori Real Arcade Pro.VX SA + { MAKE_CONTROLLER_ID( 0x1bad, 0xf503 ), k_eControllerType_XBox360Controller, NULL }, // Hori Fighting Stick VX + { MAKE_CONTROLLER_ID( 0x1bad, 0xf504 ), k_eControllerType_XBox360Controller, NULL }, // Hori Real Arcade Pro. EX + { MAKE_CONTROLLER_ID( 0x1bad, 0xf505 ), k_eControllerType_XBox360Controller, NULL }, // Hori Fighting Stick EX2B + { MAKE_CONTROLLER_ID( 0x1bad, 0xf506 ), k_eControllerType_XBox360Controller, NULL }, // Hori Real Arcade Pro.EX Premium VLX + { MAKE_CONTROLLER_ID( 0x1bad, 0xf900 ), k_eControllerType_XBox360Controller, NULL }, // Harmonix Xbox 360 Controller + { MAKE_CONTROLLER_ID( 0x1bad, 0xf901 ), k_eControllerType_XBox360Controller, NULL }, // Gamestop Xbox 360 Controller + { MAKE_CONTROLLER_ID( 0x1bad, 0xf902 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Gamepad2 + { MAKE_CONTROLLER_ID( 0x1bad, 0xf903 ), k_eControllerType_XBox360Controller, NULL }, // Tron Xbox 360 controller + { MAKE_CONTROLLER_ID( 0x1bad, 0xf904 ), k_eControllerType_XBox360Controller, NULL }, // PDP Versus Fighting Pad + { MAKE_CONTROLLER_ID( 0x1bad, 0xf906 ), k_eControllerType_XBox360Controller, NULL }, // MortalKombat FightStick + { MAKE_CONTROLLER_ID( 0x1bad, 0xfa01 ), k_eControllerType_XBox360Controller, NULL }, // MadCatz GamePad + { MAKE_CONTROLLER_ID( 0x1bad, 0xfd00 ), k_eControllerType_XBox360Controller, NULL }, // Razer Onza TE + { MAKE_CONTROLLER_ID( 0x1bad, 0xfd01 ), k_eControllerType_XBox360Controller, NULL }, // Razer Onza + { MAKE_CONTROLLER_ID( 0x24c6, 0x5000 ), k_eControllerType_XBox360Controller, NULL }, // Razer Atrox Arcade Stick + { MAKE_CONTROLLER_ID( 0x24c6, 0x5300 ), k_eControllerType_XBox360Controller, NULL }, // PowerA MINI PROEX Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x5303 ), k_eControllerType_XBox360Controller, NULL }, // Xbox Airflo wired controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x530a ), k_eControllerType_XBox360Controller, NULL }, // Xbox 360 Pro EX Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x531a ), k_eControllerType_XBox360Controller, NULL }, // PowerA Pro Ex + { MAKE_CONTROLLER_ID( 0x24c6, 0x5397 ), k_eControllerType_XBox360Controller, NULL }, // FUS1ON Tournament Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x5500 ), k_eControllerType_XBox360Controller, NULL }, // Hori XBOX 360 EX 2 with Turbo + { MAKE_CONTROLLER_ID( 0x24c6, 0x5501 ), k_eControllerType_XBox360Controller, NULL }, // Hori Real Arcade Pro VX-SA + { MAKE_CONTROLLER_ID( 0x24c6, 0x5502 ), k_eControllerType_XBox360Controller, NULL }, // Hori Fighting Stick VX Alt + { MAKE_CONTROLLER_ID( 0x24c6, 0x5503 ), k_eControllerType_XBox360Controller, NULL }, // Hori Fighting Edge + { MAKE_CONTROLLER_ID( 0x24c6, 0x5506 ), k_eControllerType_XBox360Controller, NULL }, // Hori SOULCALIBUR V Stick + { MAKE_CONTROLLER_ID( 0x24c6, 0x550d ), k_eControllerType_XBox360Controller, NULL }, // Hori GEM Xbox controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x550e ), k_eControllerType_XBox360Controller, NULL }, // Hori Real Arcade Pro V Kai 360 + { MAKE_CONTROLLER_ID( 0x24c6, 0x5508 ), k_eControllerType_XBox360Controller, NULL }, // Hori PAD A + { MAKE_CONTROLLER_ID( 0x24c6, 0x5510 ), k_eControllerType_XBox360Controller, NULL }, // Hori Fighting Commander ONE + { MAKE_CONTROLLER_ID( 0x24c6, 0x5b00 ), k_eControllerType_XBox360Controller, NULL }, // ThrustMaster Ferrari Italia 458 Racing Wheel + { MAKE_CONTROLLER_ID( 0x24c6, 0x5b02 ), k_eControllerType_XBox360Controller, NULL }, // Thrustmaster, Inc. GPX Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x5b03 ), k_eControllerType_XBox360Controller, NULL }, // Thrustmaster Ferrari 458 Racing Wheel + { MAKE_CONTROLLER_ID( 0x24c6, 0x5d04 ), k_eControllerType_XBox360Controller, NULL }, // Razer Sabertooth + { MAKE_CONTROLLER_ID( 0x24c6, 0xfafa ), k_eControllerType_XBox360Controller, NULL }, // Aplay Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0xfafb ), k_eControllerType_XBox360Controller, NULL }, // Aplay Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0xfafc ), k_eControllerType_XBox360Controller, NULL }, // Afterglow Gamepad 1 + { MAKE_CONTROLLER_ID( 0x24c6, 0xfafd ), k_eControllerType_XBox360Controller, NULL }, // Afterglow Gamepad 3 + { MAKE_CONTROLLER_ID( 0x24c6, 0xfafe ), k_eControllerType_XBox360Controller, NULL }, // Rock Candy Gamepad for Xbox 360 + { MAKE_CONTROLLER_ID( 0x2c22, 0x2303 ), k_eControllerType_XInputPS4Controller, "Qanba Obsidian Arcade Joystick" }, // Qanba Obsidian Arcade Joystick + { MAKE_CONTROLLER_ID( 0x2c22, 0x2503 ), k_eControllerType_XInputPS4Controller, "Qanba Dragon Arcade Joystick" }, // Qanba Dragon Arcade Joystick + + { MAKE_CONTROLLER_ID( 0x045e, 0x02d1 ), k_eControllerType_XBoxOneController, "Xbox One Controller" }, // Microsoft X-Box One pad + { MAKE_CONTROLLER_ID( 0x045e, 0x02dd ), k_eControllerType_XBoxOneController, "Xbox One Controller" }, // Microsoft X-Box One pad (Firmware 2015) + { MAKE_CONTROLLER_ID( 0x045e, 0x02e0 ), k_eControllerType_XBoxOneController, "Xbox One S Controller" }, // Microsoft X-Box One S pad (Bluetooth) + { MAKE_CONTROLLER_ID( 0x045e, 0x02e3 ), k_eControllerType_XBoxOneController, "Xbox One Elite Controller" }, // Microsoft X-Box One Elite pad + { MAKE_CONTROLLER_ID( 0x045e, 0x02ea ), k_eControllerType_XBoxOneController, "Xbox One S Controller" }, // Microsoft X-Box One S pad + { MAKE_CONTROLLER_ID( 0x045e, 0x02fd ), k_eControllerType_XBoxOneController, "Xbox One S Controller" }, // Microsoft X-Box One S pad (Bluetooth) + { MAKE_CONTROLLER_ID( 0x045e, 0x02ff ), k_eControllerType_XBoxOneController, NULL }, // Microsoft X-Box One controller with XBOXGIP driver on Windows + { MAKE_CONTROLLER_ID( 0x045e, 0x0b00 ), k_eControllerType_XBoxOneController, "Xbox One Elite 2 Controller" }, // Microsoft X-Box One Elite Series 2 pad +// { MAKE_CONTROLLER_ID( 0x045e, 0x0b02 ), k_eControllerType_XBoxOneController, "Xbox One Elite 2 Controller" }, // The virtual keyboard generated by XboxGip drivers for Xbox One Controllers (see https://github.com/libsdl-org/SDL/pull/5121 for details) + { MAKE_CONTROLLER_ID( 0x045e, 0x0b05 ), k_eControllerType_XBoxOneController, "Xbox One Elite 2 Controller" }, // Microsoft X-Box One Elite Series 2 pad (Bluetooth) + { MAKE_CONTROLLER_ID( 0x045e, 0x0b0a ), k_eControllerType_XBoxOneController, "Xbox Adaptive Controller" }, // Microsoft X-Box Adaptive pad + { MAKE_CONTROLLER_ID( 0x045e, 0x0b0c ), k_eControllerType_XBoxOneController, "Xbox Adaptive Controller" }, // Microsoft X-Box Adaptive pad (Bluetooth) + { MAKE_CONTROLLER_ID( 0x045e, 0x0b12 ), k_eControllerType_XBoxOneController, "Xbox Series X Controller" }, // Microsoft X-Box Series X pad + { MAKE_CONTROLLER_ID( 0x045e, 0x0b13 ), k_eControllerType_XBoxOneController, "Xbox Series X Controller" }, // Microsoft X-Box Series X pad (BLE) + { MAKE_CONTROLLER_ID( 0x045e, 0x0b20 ), k_eControllerType_XBoxOneController, "Xbox One S Controller" }, // Microsoft X-Box One S pad (BLE) + { MAKE_CONTROLLER_ID( 0x045e, 0x0b21 ), k_eControllerType_XBoxOneController, "Xbox Adaptive Controller" }, // Microsoft X-Box Adaptive pad (BLE) + { MAKE_CONTROLLER_ID( 0x045e, 0x0b22 ), k_eControllerType_XBoxOneController, "Xbox One Elite 2 Controller" }, // Microsoft X-Box One Elite Series 2 pad (BLE) + { MAKE_CONTROLLER_ID( 0x0738, 0x4a01 ), k_eControllerType_XBoxOneController, NULL }, // Mad Catz FightStick TE 2 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0139 ), k_eControllerType_XBoxOneController, "PDP Xbox One Afterglow" }, // PDP Afterglow Wired Controller for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x013B ), k_eControllerType_XBoxOneController, "PDP Xbox One Face-Off Controller" }, // PDP Face-Off Gamepad for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x013a ), k_eControllerType_XBoxOneController, NULL }, // PDP Xbox One Controller (unlisted) + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0145 ), k_eControllerType_XBoxOneController, "PDP MK X Fight Pad" }, // PDP MK X Fight Pad for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0146 ), k_eControllerType_XBoxOneController, "PDP Xbox One Rock Candy" }, // PDP Rock Candy Wired Controller for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x015b ), k_eControllerType_XBoxOneController, "PDP Fallout 4 Vault Boy Controller" }, // PDP Fallout 4 Vault Boy Wired Controller for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x015c ), k_eControllerType_XBoxOneController, "PDP Xbox One @Play Controller" }, // PDP @Play Wired Controller for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x015d ), k_eControllerType_XBoxOneController, "PDP Mirror's Edge Controller" }, // PDP Mirror's Edge Wired Controller for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x015f ), k_eControllerType_XBoxOneController, "PDP Metallic Controller" }, // PDP Metallic Wired Controller for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0160 ), k_eControllerType_XBoxOneController, "PDP NFL Face-Off Controller" }, // PDP NFL Official Face-Off Wired Controller for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0161 ), k_eControllerType_XBoxOneController, "PDP Xbox One Camo" }, // PDP Camo Wired Controller for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0162 ), k_eControllerType_XBoxOneController, "PDP Xbox One Controller" }, // PDP Wired Controller for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0163 ), k_eControllerType_XBoxOneController, "PDP Deliverer of Truth" }, // PDP Legendary Collection: Deliverer of Truth + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0164 ), k_eControllerType_XBoxOneController, "PDP Battlefield 1 Controller" }, // PDP Battlefield 1 Official Wired Controller for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0165 ), k_eControllerType_XBoxOneController, "PDP Titanfall 2 Controller" }, // PDP Titanfall 2 Official Wired Controller for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0166 ), k_eControllerType_XBoxOneController, "PDP Mass Effect: Andromeda Controller" }, // PDP Mass Effect: Andromeda Official Wired Controller for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0167 ), k_eControllerType_XBoxOneController, "PDP Halo Wars 2 Face-Off Controller" }, // PDP Halo Wars 2 Official Face-Off Wired Controller for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0205 ), k_eControllerType_XBoxOneController, "PDP Victrix Pro Fight Stick" }, // PDP Victrix Pro Fight Stick + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0206 ), k_eControllerType_XBoxOneController, "PDP Mortal Kombat Controller" }, // PDP Mortal Kombat 25 Anniversary Edition Stick (Xbox One) + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0246 ), k_eControllerType_XBoxOneController, "PDP Xbox One Rock Candy" }, // PDP Rock Candy Wired Controller for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0261 ), k_eControllerType_XBoxOneController, "PDP Xbox One Camo" }, // PDP Camo Wired Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0262 ), k_eControllerType_XBoxOneController, "PDP Xbox One Controller" }, // PDP Wired Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02a0 ), k_eControllerType_XBoxOneController, "PDP Xbox One Midnight Blue" }, // PDP Wired Controller for Xbox One - Midnight Blue + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02a1 ), k_eControllerType_XBoxOneController, "PDP Xbox One Verdant Green" }, // PDP Wired Controller for Xbox One - Verdant Green + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02a2 ), k_eControllerType_XBoxOneController, "PDP Xbox One Crimson Red" }, // PDP Wired Controller for Xbox One - Crimson Red + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02a3 ), k_eControllerType_XBoxOneController, "PDP Xbox One Arctic White" }, // PDP Wired Controller for Xbox One - Arctic White + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02a4 ), k_eControllerType_XBoxOneController, "PDP Xbox One Phantom Black" }, // PDP Wired Controller for Xbox One - Stealth Series | Phantom Black + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02a5 ), k_eControllerType_XBoxOneController, "PDP Xbox One Ghost White" }, // PDP Wired Controller for Xbox One - Stealth Series | Ghost White + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02a6 ), k_eControllerType_XBoxOneController, "PDP Xbox One Revenant Blue" }, // PDP Wired Controller for Xbox One - Stealth Series | Revenant Blue + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02a7 ), k_eControllerType_XBoxOneController, "PDP Xbox One Raven Black" }, // PDP Wired Controller for Xbox One - Raven Black + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02a8 ), k_eControllerType_XBoxOneController, "PDP Xbox One Arctic White" }, // PDP Wired Controller for Xbox One - Arctic White + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02a9 ), k_eControllerType_XBoxOneController, "PDP Xbox One Midnight Blue" }, // PDP Wired Controller for Xbox One - Midnight Blue + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02aa ), k_eControllerType_XBoxOneController, "PDP Xbox One Verdant Green" }, // PDP Wired Controller for Xbox One - Verdant Green + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02ab ), k_eControllerType_XBoxOneController, "PDP Xbox One Crimson Red" }, // PDP Wired Controller for Xbox One - Crimson Red + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02ac ), k_eControllerType_XBoxOneController, "PDP Xbox One Ember Orange" }, // PDP Wired Controller for Xbox One - Ember Orange + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02ad ), k_eControllerType_XBoxOneController, "PDP Xbox One Phantom Black" }, // PDP Wired Controller for Xbox One - Stealth Series | Phantom Black + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02ae ), k_eControllerType_XBoxOneController, "PDP Xbox One Ghost White" }, // PDP Wired Controller for Xbox One - Stealth Series | Ghost White + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02af ), k_eControllerType_XBoxOneController, "PDP Xbox One Revenant Blue" }, // PDP Wired Controller for Xbox One - Stealth Series | Revenant Blue + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02b0 ), k_eControllerType_XBoxOneController, "PDP Xbox One Raven Black" }, // PDP Wired Controller for Xbox One - Raven Black + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02b1 ), k_eControllerType_XBoxOneController, "PDP Xbox One Arctic White" }, // PDP Wired Controller for Xbox One - Arctic White + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02b3 ), k_eControllerType_XBoxOneController, "PDP Xbox One Afterglow" }, // PDP Afterglow Prismatic Wired Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02b5 ), k_eControllerType_XBoxOneController, "PDP Xbox One GAMEware Controller" }, // PDP GAMEware Wired Controller Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02b6 ), k_eControllerType_XBoxOneController, NULL }, // PDP One-Handed Joystick Adaptive Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02bd ), k_eControllerType_XBoxOneController, "PDP Xbox One Royal Purple" }, // PDP Wired Controller for Xbox One - Royal Purple + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02be ), k_eControllerType_XBoxOneController, "PDP Xbox One Raven Black" }, // PDP Deluxe Wired Controller for Xbox One - Raven Black + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02bf ), k_eControllerType_XBoxOneController, "PDP Xbox One Midnight Blue" }, // PDP Deluxe Wired Controller for Xbox One - Midnight Blue + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02c0 ), k_eControllerType_XBoxOneController, "PDP Xbox One Phantom Black" }, // PDP Deluxe Wired Controller for Xbox One - Stealth Series | Phantom Black + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02c1 ), k_eControllerType_XBoxOneController, "PDP Xbox One Ghost White" }, // PDP Deluxe Wired Controller for Xbox One - Stealth Series | Ghost White + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02c2 ), k_eControllerType_XBoxOneController, "PDP Xbox One Revenant Blue" }, // PDP Deluxe Wired Controller for Xbox One - Stealth Series | Revenant Blue + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02c3 ), k_eControllerType_XBoxOneController, "PDP Xbox One Verdant Green" }, // PDP Deluxe Wired Controller for Xbox One - Verdant Green + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02c4 ), k_eControllerType_XBoxOneController, "PDP Xbox One Ember Orange" }, // PDP Deluxe Wired Controller for Xbox One - Ember Orange + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02c5 ), k_eControllerType_XBoxOneController, "PDP Xbox One Royal Purple" }, // PDP Deluxe Wired Controller for Xbox One - Royal Purple + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02c6 ), k_eControllerType_XBoxOneController, "PDP Xbox One Crimson Red" }, // PDP Deluxe Wired Controller for Xbox One - Crimson Red + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02c7 ), k_eControllerType_XBoxOneController, "PDP Xbox One Arctic White" }, // PDP Deluxe Wired Controller for Xbox One - Arctic White + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02c8 ), k_eControllerType_XBoxOneController, "PDP Kingdom Hearts Controller" }, // PDP Kingdom Hearts Wired Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02c9 ), k_eControllerType_XBoxOneController, "PDP Xbox One Phantasm Red" }, // PDP Deluxe Wired Controller for Xbox One - Stealth Series | Phantasm Red + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02ca ), k_eControllerType_XBoxOneController, "PDP Xbox One Specter Violet" }, // PDP Deluxe Wired Controller for Xbox One - Stealth Series | Specter Violet + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02cb ), k_eControllerType_XBoxOneController, "PDP Xbox One Specter Violet" }, // PDP Wired Controller for Xbox One - Stealth Series | Specter Violet + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02cd ), k_eControllerType_XBoxOneController, "PDP Xbox One Blu-merang" }, // PDP Rock Candy Wired Controller for Xbox One - Blu-merang + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02ce ), k_eControllerType_XBoxOneController, "PDP Xbox One Cranblast" }, // PDP Rock Candy Wired Controller for Xbox One - Cranblast + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02cf ), k_eControllerType_XBoxOneController, "PDP Xbox One Aqualime" }, // PDP Rock Candy Wired Controller for Xbox One - Aqualime + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02d5 ), k_eControllerType_XBoxOneController, "PDP Xbox One Red Camo" }, // PDP Wired Controller for Xbox One - Red Camo + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0346 ), k_eControllerType_XBoxOneController, "PDP Xbox One RC Gamepad" }, // PDP RC Gamepad for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0446 ), k_eControllerType_XBoxOneController, "PDP Xbox One RC Gamepad" }, // PDP RC Gamepad for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02da ), k_eControllerType_XBoxOneController, "PDP Xbox Series X Afterglow" }, // PDP Xbox Series X Afterglow + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02d6 ), k_eControllerType_XBoxOneController, "Victrix Gambit Tournament Controller" }, // Victrix Gambit Tournament Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02d9 ), k_eControllerType_XBoxOneController, "PDP Xbox Series X Midnight Blue" }, // PDP Xbox Series X Midnight Blue + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0063 ), k_eControllerType_XBoxOneController, NULL }, // Hori Real Arcade Pro Hayabusa (USA) Xbox One + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0067 ), k_eControllerType_XBoxOneController, NULL }, // HORIPAD ONE + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0078 ), k_eControllerType_XBoxOneController, NULL }, // Hori Real Arcade Pro V Kai Xbox One + { MAKE_CONTROLLER_ID( 0x0f0d, 0x00c5 ), k_eControllerType_XBoxOneController, NULL }, // HORI Fighting Commander + { MAKE_CONTROLLER_ID( 0x1532, 0x0a00 ), k_eControllerType_XBoxOneController, NULL }, // Razer Atrox Arcade Stick + { MAKE_CONTROLLER_ID( 0x1532, 0x0a03 ), k_eControllerType_XBoxOneController, NULL }, // Razer Wildcat + { MAKE_CONTROLLER_ID( 0x1532, 0x0a14 ), k_eControllerType_XBoxOneController, NULL }, // Razer Wolverine Ultimate + { MAKE_CONTROLLER_ID( 0x1532, 0x0a15 ), k_eControllerType_XBoxOneController, NULL }, // Razer Wolverine Tournament Edition + { MAKE_CONTROLLER_ID( 0x20d6, 0x2001 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller - Black Inline + { MAKE_CONTROLLER_ID( 0x20d6, 0x2002 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Gray/White Inline + { MAKE_CONTROLLER_ID( 0x20d6, 0x2003 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Green Inline + { MAKE_CONTROLLER_ID( 0x20d6, 0x2004 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Pink inline + { MAKE_CONTROLLER_ID( 0x20d6, 0x2005 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X Wired Controller Core - Black + { MAKE_CONTROLLER_ID( 0x20d6, 0x2006 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X Wired Controller Core - White + { MAKE_CONTROLLER_ID( 0x20d6, 0x2009 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Red inline + { MAKE_CONTROLLER_ID( 0x20d6, 0x200a ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Blue inline + { MAKE_CONTROLLER_ID( 0x20d6, 0x200b ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Camo Metallic Red + { MAKE_CONTROLLER_ID( 0x20d6, 0x200c ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Camo Metallic Blue + { MAKE_CONTROLLER_ID( 0x20d6, 0x200d ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Seafoam Fade + { MAKE_CONTROLLER_ID( 0x20d6, 0x200e ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Midnight Blue + { MAKE_CONTROLLER_ID( 0x20d6, 0x200f ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Soldier Green + { MAKE_CONTROLLER_ID( 0x20d6, 0x2011 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired - Metallic Ice + { MAKE_CONTROLLER_ID( 0x20d6, 0x2012 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X Cuphead EnWired Controller - Mugman + { MAKE_CONTROLLER_ID( 0x20d6, 0x2015 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller - Blue Hint + { MAKE_CONTROLLER_ID( 0x20d6, 0x2016 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller - Green Hint + { MAKE_CONTROLLER_ID( 0x20d6, 0x2017 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Cntroller - Arctic Camo + { MAKE_CONTROLLER_ID( 0x20d6, 0x2018 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Arc Lightning + { MAKE_CONTROLLER_ID( 0x20d6, 0x2019 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Royal Purple + { MAKE_CONTROLLER_ID( 0x20d6, 0x201a ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Nebula + { MAKE_CONTROLLER_ID( 0x20d6, 0x4001 ), k_eControllerType_XBoxOneController, "PowerA Fusion Pro 2 Controller" }, // PowerA Fusion Pro 2 Wired Controller (Xbox Series X style) + { MAKE_CONTROLLER_ID( 0x20d6, 0x4002 ), k_eControllerType_XBoxOneController, "PowerA Spectra Infinity Controller" }, // PowerA Spectra Infinity Wired Controller (Xbox Series X style) + { MAKE_CONTROLLER_ID( 0x24c6, 0x541a ), k_eControllerType_XBoxOneController, NULL }, // PowerA Xbox One Mini Wired Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x542a ), k_eControllerType_XBoxOneController, NULL }, // Xbox ONE spectra + { MAKE_CONTROLLER_ID( 0x24c6, 0x543a ), k_eControllerType_XBoxOneController, "PowerA Xbox One Controller" }, // PowerA Xbox ONE liquid metal controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x551a ), k_eControllerType_XBoxOneController, NULL }, // PowerA FUSION Pro Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x561a ), k_eControllerType_XBoxOneController, NULL }, // PowerA FUSION Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x581a ), k_eControllerType_XBoxOneController, NULL }, // BDA XB1 Classic Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x591a ), k_eControllerType_XBoxOneController, NULL }, // PowerA FUSION Pro Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x592a ), k_eControllerType_XBoxOneController, NULL }, // BDA XB1 Spectra Pro + { MAKE_CONTROLLER_ID( 0x24c6, 0x791a ), k_eControllerType_XBoxOneController, NULL }, // PowerA Fusion Fight Pad + { MAKE_CONTROLLER_ID( 0x2dc8, 0x2002 ), k_eControllerType_XBoxOneController, NULL }, // 8BitDo Ultimate Wired Controller for Xbox + { MAKE_CONTROLLER_ID( 0x2e24, 0x0652 ), k_eControllerType_XBoxOneController, NULL }, // Hyperkin Duke + { MAKE_CONTROLLER_ID( 0x2e24, 0x1618 ), k_eControllerType_XBoxOneController, NULL }, // Hyperkin Duke + { MAKE_CONTROLLER_ID( 0x2e24, 0x1688 ), k_eControllerType_XBoxOneController, NULL }, // Hyperkin X91 + { MAKE_CONTROLLER_ID( 0x146b, 0x0611 ), k_eControllerType_XBoxOneController, NULL }, // Xbox Controller Mode for NACON Revolution 3 + + // These have been added via Minidump for unrecognized Xinput controller assert + { MAKE_CONTROLLER_ID( 0x0000, 0x0000 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x045e, 0x02a2 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller - Microsoft VID + { MAKE_CONTROLLER_ID( 0x0e6f, 0x1414 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0159 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0xfaff ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0f0d, 0x006d ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0f0d, 0x00a4 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0079, 0x1832 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0079, 0x187f ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0079, 0x1883 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x03eb, 0xff01 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0c12, 0x0ef8 ), k_eControllerType_XBox360Controller, NULL }, // Homemade fightstick based on brook pcb (with XInput driver??) + { MAKE_CONTROLLER_ID( 0x046d, 0x1000 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x1345, 0x6006 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + + { MAKE_CONTROLLER_ID( 0x056e, 0x2012 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x146b, 0x0602 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0f0d, 0x00ae ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x046d, 0x0401 ), k_eControllerType_XBox360Controller, NULL }, // logitech xinput + { MAKE_CONTROLLER_ID( 0x046d, 0x0301 ), k_eControllerType_XBox360Controller, NULL }, // logitech xinput + { MAKE_CONTROLLER_ID( 0x046d, 0xcaa3 ), k_eControllerType_XBox360Controller, NULL }, // logitech xinput + { MAKE_CONTROLLER_ID( 0x046d, 0xc261 ), k_eControllerType_XBox360Controller, NULL }, // logitech xinput + { MAKE_CONTROLLER_ID( 0x046d, 0x0291 ), k_eControllerType_XBox360Controller, NULL }, // logitech xinput + { MAKE_CONTROLLER_ID( 0x0079, 0x18d3 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0f0d, 0x00b1 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0001, 0x0001 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0079, 0x188e ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0079, 0x187c ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0079, 0x189c ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0079, 0x1874 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + + { MAKE_CONTROLLER_ID( 0x2f24, 0x0050 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x2f24, 0x2e ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x9886, 0x24 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x2f24, 0x91 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x1430, 0x719 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xf0d, 0xed ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xf0d, 0xc0 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe6f, 0x152 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe6f, 0x2a7 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x46d, 0x1007 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe6f, 0x2b8 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe6f, 0x2a8 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x79, 0x18a1 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + + /* Added from Minidumps 10-9-19 */ + { MAKE_CONTROLLER_ID( 0x0, 0x6686 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x11ff, 0x511 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x12ab, 0x304 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x1430, 0x291 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x1430, 0x2a9 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x1430, 0x70b ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x146b, 0x604 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x146b, 0x605 ), k_eControllerType_XBoxOneController, NULL }, // NACON PS4 controller in Xbox mode - might also be other bigben brand xbox controllers + { MAKE_CONTROLLER_ID( 0x146b, 0x606 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x146b, 0x609 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x1bad, 0x28e ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x1bad, 0x2a0 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x1bad, 0x5500 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x20ab, 0x55ef ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x5509 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x2516, 0x69 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x25b1, 0x360 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x2c22, 0x2203 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x2f24, 0x11 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x2f24, 0x53 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x2f24, 0xb7 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x46d, 0x0 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x46d, 0x1004 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x46d, 0x1008 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x46d, 0xf301 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x738, 0x2a0 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x738, 0x7263 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x738, 0xb738 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x738, 0xcb29 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x738, 0xf401 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x79, 0x18c2 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x79, 0x18c8 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x79, 0x18cf ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xc12, 0xe17 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xc12, 0xe1c ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xc12, 0xe22 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xc12, 0xe30 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xd2d2, 0xd2d2 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xd62, 0x9a1a ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xd62, 0x9a1b ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe00, 0xe00 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe6f, 0x12a ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe6f, 0x2a1 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe6f, 0x2a2 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe6f, 0x2a5 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe6f, 0x2b2 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe6f, 0x2bd ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe6f, 0x2bf ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe6f, 0x2c0 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe6f, 0x2c6 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xf0d, 0x97 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xf0d, 0xba ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xf0d, 0xd8 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xfff, 0x2a1 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x45e, 0x867 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + // Added 12-17-2020 + { MAKE_CONTROLLER_ID( 0x16d0, 0xf3f ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x2f24, 0x8f ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe6f, 0xf501 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + + //{ MAKE_CONTROLLER_ID( 0x1949, 0x0402 ), /*android*/, NULL }, // Unknown Controller + + { MAKE_CONTROLLER_ID( 0x05ac, 0x0001 ), k_eControllerType_AppleController, NULL }, // MFI Extended Gamepad (generic entry for iOS/tvOS) + { MAKE_CONTROLLER_ID( 0x05ac, 0x0002 ), k_eControllerType_AppleController, NULL }, // MFI Standard Gamepad (generic entry for iOS/tvOS) + + { MAKE_CONTROLLER_ID( 0x057e, 0x2006 ), k_eControllerType_SwitchJoyConLeft, NULL }, // Nintendo Switch Joy-Con (Left) + { MAKE_CONTROLLER_ID( 0x057e, 0x2007 ), k_eControllerType_SwitchJoyConRight, NULL }, // Nintendo Switch Joy-Con (Right) + { MAKE_CONTROLLER_ID( 0x057e, 0x2008 ), k_eControllerType_SwitchJoyConPair, NULL }, // Nintendo Switch Joy-Con (Left+Right Combined) + + // This same controller ID is spoofed by many 3rd-party Switch controllers. + // The ones we currently know of are: + // * Any 8bitdo controller with Switch support + // * ORTZ Gaming Wireless Pro Controller + // * ZhiXu Gamepad Wireless + // * Sunwaytek Wireless Motion Controller for Nintendo Switch + { MAKE_CONTROLLER_ID( 0x057e, 0x2009 ), k_eControllerType_SwitchProController, NULL }, // Nintendo Switch Pro Controller + //{ MAKE_CONTROLLER_ID( 0x057e, 0x2017 ), k_eControllerType_SwitchProController, NULL }, // Nintendo Online SNES Controller + //{ MAKE_CONTROLLER_ID( 0x057e, 0x2019 ), k_eControllerType_SwitchProController, NULL }, // Nintendo Online N64 Controller + //{ MAKE_CONTROLLER_ID( 0x057e, 0x201e ), k_eControllerType_SwitchProController, NULL }, // Nintendo Online SEGA Genesis Controller + + { MAKE_CONTROLLER_ID( 0x0f0d, 0x00c1 ), k_eControllerType_SwitchInputOnlyController, NULL }, // HORIPAD for Nintendo Switch + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0092 ), k_eControllerType_SwitchInputOnlyController, NULL }, // HORI Pokken Tournament DX Pro Pad + { MAKE_CONTROLLER_ID( 0x0f0d, 0x00f6 ), k_eControllerType_SwitchProController, NULL }, // HORI Wireless Switch Pad + // The HORIPAD S, which comes in multiple styles: + // - NSW-108, classic GameCube controller + // - NSW-244, Fighting Commander arcade pad + // - NSW-278, Hori Pad Mini gamepad + // - NSW-326, HORIPAD FPS for Nintendo Switch + // + // The first two, at least, shouldn't have their buttons remapped, and since we + // can't tell which model we're actually using, we won't do any button remapping + // for any of them. + { MAKE_CONTROLLER_ID( 0x0f0d, 0x00dc ), k_eControllerType_XInputSwitchController, NULL }, // HORIPAD S - Looks like a Switch controller but uses the Xbox 360 controller protocol + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0180 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PDP Faceoff Wired Pro Controller for Nintendo Switch + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0181 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PDP Faceoff Deluxe Wired Pro Controller for Nintendo Switch + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0184 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PDP Faceoff Wired Deluxe+ Audio Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0185 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PDP Wired Fight Pad Pro for Nintendo Switch + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0186 ), k_eControllerType_SwitchProController, NULL }, // PDP Afterglow Wireless Switch Controller - working gyro. USB is for charging only. Many later "Wireless" line devices w/ gyro also use this vid/pid + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0187 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PDP Rockcandy Wired Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0188 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PDP Afterglow Wired Deluxe+ Audio Controller + { MAKE_CONTROLLER_ID( 0x0f0d, 0x00aa ), k_eControllerType_SwitchInputOnlyController, NULL }, // HORI Real Arcade Pro V Hayabusa in Switch Mode + { MAKE_CONTROLLER_ID( 0x20d6, 0xa711 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PowerA Wired Controller Plus/PowerA Wired Controller Nintendo GameCube Style + { MAKE_CONTROLLER_ID( 0x20d6, 0xa712 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PowerA Nintendo Switch Fusion Fight Pad + { MAKE_CONTROLLER_ID( 0x20d6, 0xa713 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PowerA Super Mario Controller + { MAKE_CONTROLLER_ID( 0x20d6, 0xa714 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PowerA Nintendo Switch Spectra Controller + { MAKE_CONTROLLER_ID( 0x20d6, 0xa715 ), k_eControllerType_SwitchInputOnlyController, NULL }, // Power A Fusion Wireless Arcade Stick (USB Mode) Over BT is shows up as 057e 2009 + { MAKE_CONTROLLER_ID( 0x20d6, 0xa716 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PowerA Nintendo Switch Fusion Pro Controller - USB requires toggling switch on back of device + + // Valve products + { MAKE_CONTROLLER_ID( 0x0000, 0x11fb ), k_eControllerType_MobileTouch, NULL }, // Streaming mobile touch virtual controls + { MAKE_CONTROLLER_ID( 0x28de, 0x1101 ), k_eControllerType_SteamController, NULL }, // Valve Legacy Steam Controller (CHELL) + { MAKE_CONTROLLER_ID( 0x28de, 0x1102 ), k_eControllerType_SteamController, NULL }, // Valve wired Steam Controller (D0G) + { MAKE_CONTROLLER_ID( 0x28de, 0x1105 ), k_eControllerType_SteamController, NULL }, // Valve Bluetooth Steam Controller (D0G) + { MAKE_CONTROLLER_ID( 0x28de, 0x1106 ), k_eControllerType_SteamController, NULL }, // Valve Bluetooth Steam Controller (D0G) + { MAKE_CONTROLLER_ID( 0x28de, 0x1142 ), k_eControllerType_SteamController, NULL }, // Valve wireless Steam Controller + { MAKE_CONTROLLER_ID( 0x28de, 0x1201 ), k_eControllerType_SteamControllerV2, NULL }, // Valve wired Steam Controller (HEADCRAB) + { MAKE_CONTROLLER_ID( 0x28de, 0x1202 ), k_eControllerType_SteamControllerV2, NULL }, // Valve Bluetooth Steam Controller (HEADCRAB) +}; + +static const char *GetControllerTypeOverride( int nVID, int nPID ) +{ + const char *hint = SDL_GetHint(SDL_HINT_GAMECONTROLLERTYPE); + if (hint) { + char key[32]; + const char *spot = NULL; + + SDL_snprintf(key, sizeof(key), "0x%.4x/0x%.4x=", nVID, nPID); + spot = SDL_strstr(hint, key); + if (!spot) { + SDL_snprintf(key, sizeof(key), "0x%.4X/0x%.4X=", nVID, nPID); + spot = SDL_strstr(hint, key); + } + if (spot) { + spot += SDL_strlen(key); + if (SDL_strncmp(spot, "k_eControllerType_", 18) == 0) { + spot += 18; + } + return spot; + } + } + return NULL; +} + + +EControllerType GuessControllerType( int nVID, int nPID ) +{ +#if 0//def _DEBUG + // Verify that there are no duplicates in the controller list + // If the list were sorted, we could do this much more efficiently, as well as improve lookup speed. + static bool s_bCheckedForDuplicates; + if ( !s_bCheckedForDuplicates ) + { + s_bCheckedForDuplicates = true; + int i, j; + for ( i = 0; i < sizeof( arrControllers ) / sizeof( arrControllers[ 0 ] ); ++i ) + { + for ( j = i + 1; j < sizeof( arrControllers ) / sizeof( arrControllers[ 0 ] ); ++j ) + { + if ( arrControllers[ i ].m_unDeviceID == arrControllers[ j ].m_unDeviceID ) + { + Log( "Duplicate controller entry found for VID 0x%.4x PID 0x%.4x\n", ( arrControllers[ i ].m_unDeviceID >> 16 ), arrControllers[ i ].m_unDeviceID & 0xFFFF ); + } + } + } + } +#endif // _DEBUG + + unsigned int unDeviceID = MAKE_CONTROLLER_ID( nVID, nPID ); + int iIndex; + + const char *pszOverride = GetControllerTypeOverride( nVID, nPID ); + if ( pszOverride ) + { + if ( SDL_strncasecmp( pszOverride, "Xbox360", 7 ) == 0 ) + { + return k_eControllerType_XBox360Controller; + } + if ( SDL_strncasecmp( pszOverride, "XboxOne", 7 ) == 0 ) + { + return k_eControllerType_XBoxOneController; + } + if ( SDL_strncasecmp( pszOverride, "PS3", 3 ) == 0 ) + { + return k_eControllerType_PS3Controller; + } + if ( SDL_strncasecmp( pszOverride, "PS4", 3 ) == 0 ) + { + return k_eControllerType_PS4Controller; + } + if ( SDL_strncasecmp( pszOverride, "PS5", 3 ) == 0 ) + { + return k_eControllerType_PS5Controller; + } + if ( SDL_strncasecmp( pszOverride, "SwitchPro", 9 ) == 0 ) + { + return k_eControllerType_SwitchProController; + } + if ( SDL_strncasecmp( pszOverride, "Steam", 5 ) == 0 ) + { + return k_eControllerType_SteamController; + } + return k_eControllerType_UnknownNonSteamController; + } + + for ( iIndex = 0; iIndex < sizeof( arrControllers ) / sizeof( arrControllers[0] ); ++iIndex ) + { + if ( unDeviceID == arrControllers[ iIndex ].m_unDeviceID ) + { + return arrControllers[ iIndex ].m_eControllerType; + } + } + + return k_eControllerType_UnknownNonSteamController; + +} + +const char *GuessControllerName( int nVID, int nPID ) +{ + unsigned int unDeviceID = MAKE_CONTROLLER_ID( nVID, nPID ); + int iIndex; + for ( iIndex = 0; iIndex < sizeof( arrControllers ) / sizeof( arrControllers[0] ); ++iIndex ) + { + if ( unDeviceID == arrControllers[ iIndex ].m_unDeviceID ) + { + return arrControllers[ iIndex ].m_pszName; + } + } + + return NULL; + +} + +#undef MAKE_CONTROLLER_ID + +/* vi: set ts=4 sw=4 noexpandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/joystick/controller_type.h libsdl2-2.24.0+dfsg/src/joystick/controller_type.h --- libsdl2-2.0.22+dfsg/src/joystick/controller_type.h 2021-11-26 16:03:45.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/controller_type.h 2022-06-16 20:16:31.000000000 +0000 @@ -53,8 +53,9 @@ k_eControllerType_SwitchJoyConPair = 41, k_eControllerType_SwitchInputOnlyController = 42, k_eControllerType_MobileTouch = 43, - k_eControllerType_XInputSwitchController = 44, // Client-side only, used to mark Switch-compatible controllers as not supporting Switch controller protocol + k_eControllerType_XInputSwitchController = 44, // Client-side only, used to mark Nintendo Switch style controllers as using XInput instead of the Nintendo Switch protocol k_eControllerType_PS5Controller = 45, + k_eControllerType_XInputPS4Controller = 46, // Client-side only, used to mark DualShock 4 style controllers using XInput instead of the DualShock 4 controller protocol k_eControllerType_LastController, // Don't add game controllers below this enumeration - this enumeration can change value // Keyboards and Mice @@ -62,7 +63,6 @@ k_eControllertype_GenericMouse = 800, } EControllerType; -#define MAKE_CONTROLLER_ID( nVID, nPID ) (unsigned int)( (unsigned int)nVID << 16 | (unsigned int)nPID ) typedef struct { unsigned int m_unDeviceID; @@ -70,683 +70,10 @@ const char *m_pszName; } ControllerDescription_t; -static const ControllerDescription_t arrControllers[] = { - { MAKE_CONTROLLER_ID( 0x0079, 0x181a ), k_eControllerType_PS3Controller, NULL }, // Venom Arcade Stick - { MAKE_CONTROLLER_ID( 0x0079, 0x1844 ), k_eControllerType_PS3Controller, NULL }, // From SDL - { MAKE_CONTROLLER_ID( 0x044f, 0xb315 ), k_eControllerType_PS3Controller, NULL }, // Firestorm Dual Analog 3 - { MAKE_CONTROLLER_ID( 0x044f, 0xd007 ), k_eControllerType_PS3Controller, NULL }, // Thrustmaster wireless 3-1 - { MAKE_CONTROLLER_ID( 0x054c, 0x0268 ), k_eControllerType_PS3Controller, NULL }, // Sony PS3 Controller - { MAKE_CONTROLLER_ID( 0x056e, 0x200f ), k_eControllerType_PS3Controller, NULL }, // From SDL - { MAKE_CONTROLLER_ID( 0x056e, 0x2013 ), k_eControllerType_PS3Controller, NULL }, // JC-U4113SBK - { MAKE_CONTROLLER_ID( 0x05b8, 0x1004 ), k_eControllerType_PS3Controller, NULL }, // From SDL - { MAKE_CONTROLLER_ID( 0x05b8, 0x1006 ), k_eControllerType_PS3Controller, NULL }, // JC-U3412SBK - { MAKE_CONTROLLER_ID( 0x06a3, 0xf622 ), k_eControllerType_PS3Controller, NULL }, // Cyborg V3 - { MAKE_CONTROLLER_ID( 0x0738, 0x3180 ), k_eControllerType_PS3Controller, NULL }, // Mad Catz Alpha PS3 mode - { MAKE_CONTROLLER_ID( 0x0738, 0x3250 ), k_eControllerType_PS3Controller, NULL }, // madcats fightpad pro ps3 - { MAKE_CONTROLLER_ID( 0x0738, 0x8180 ), k_eControllerType_PS3Controller, NULL }, // Mad Catz Alpha PS4 mode (no touchpad on device) - { MAKE_CONTROLLER_ID( 0x0738, 0x8838 ), k_eControllerType_PS3Controller, NULL }, // Madcatz Fightstick Pro - { MAKE_CONTROLLER_ID( 0x0810, 0x0001 ), k_eControllerType_PS3Controller, NULL }, // actually ps2 - maybe break out later - { MAKE_CONTROLLER_ID( 0x0810, 0x0003 ), k_eControllerType_PS3Controller, NULL }, // actually ps2 - maybe break out later - { MAKE_CONTROLLER_ID( 0x0925, 0x0005 ), k_eControllerType_PS3Controller, NULL }, // Sony PS3 Controller - { MAKE_CONTROLLER_ID( 0x0925, 0x8866 ), k_eControllerType_PS3Controller, NULL }, // PS2 maybe break out later - { MAKE_CONTROLLER_ID( 0x0925, 0x8888 ), k_eControllerType_PS3Controller, NULL }, // Actually ps2 -maybe break out later Lakeview Research WiseGroup Ltd, MP-8866 Dual Joypad - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0109 ), k_eControllerType_PS3Controller, NULL }, // PDP Versus Fighting Pad - { MAKE_CONTROLLER_ID( 0x0e6f, 0x011e ), k_eControllerType_PS3Controller, NULL }, // Rock Candy PS4 - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0128 ), k_eControllerType_PS3Controller, NULL }, // Rock Candy PS3 - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0203 ), k_eControllerType_PS3Controller, NULL }, // Victrix Pro FS (PS4 peripheral but no trackpad/lightbar) - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0214 ), k_eControllerType_PS3Controller, NULL }, // afterglow ps3 - { MAKE_CONTROLLER_ID( 0x0e6f, 0x1314 ), k_eControllerType_PS3Controller, NULL }, // PDP Afterglow Wireless PS3 controller - { MAKE_CONTROLLER_ID( 0x0e6f, 0x6302 ), k_eControllerType_PS3Controller, NULL }, // From SDL - { MAKE_CONTROLLER_ID( 0x0e8f, 0x0008 ), k_eControllerType_PS3Controller, NULL }, // Green Asia - { MAKE_CONTROLLER_ID( 0x0e8f, 0x3075 ), k_eControllerType_PS3Controller, NULL }, // SpeedLink Strike FX - { MAKE_CONTROLLER_ID( 0x0e8f, 0x310d ), k_eControllerType_PS3Controller, NULL }, // From SDL - { MAKE_CONTROLLER_ID( 0x0f0d, 0x0009 ), k_eControllerType_PS3Controller, NULL }, // HORI BDA GP1 - { MAKE_CONTROLLER_ID( 0x0f0d, 0x004d ), k_eControllerType_PS3Controller, NULL }, // Horipad 3 - { MAKE_CONTROLLER_ID( 0x0f0d, 0x005e ), k_eControllerType_PS3Controller, NULL }, // HORI Fighting commander ps4 - { MAKE_CONTROLLER_ID( 0x0f0d, 0x005f ), k_eControllerType_PS3Controller, NULL }, // HORI Fighting commander ps3 - { MAKE_CONTROLLER_ID( 0x0f0d, 0x006a ), k_eControllerType_PS3Controller, NULL }, // Real Arcade Pro 4 - { MAKE_CONTROLLER_ID( 0x0f0d, 0x006e ), k_eControllerType_PS3Controller, NULL }, // HORI horipad4 ps3 - { MAKE_CONTROLLER_ID( 0x0f0d, 0x0085 ), k_eControllerType_PS3Controller, NULL }, // HORI Fighting Commander PS3 - { MAKE_CONTROLLER_ID( 0x0f0d, 0x0086 ), k_eControllerType_PS3Controller, NULL }, // HORI Fighting Commander PC (Uses the Xbox 360 protocol, but has PS3 buttons) - { MAKE_CONTROLLER_ID( 0x0f0d, 0x0087 ), k_eControllerType_PS3Controller, NULL }, // HORI fighting mini stick - { MAKE_CONTROLLER_ID( 0x0f30, 0x1100 ), k_eControllerType_PS3Controller, NULL }, // Quanba Q1 fight stick - { MAKE_CONTROLLER_ID( 0x11ff, 0x3331 ), k_eControllerType_PS3Controller, NULL }, // SRXJ-PH2400 - { MAKE_CONTROLLER_ID( 0x1345, 0x1000 ), k_eControllerType_PS3Controller, NULL }, // PS2 ACME GA-D5 - { MAKE_CONTROLLER_ID( 0x1345, 0x6005 ), k_eControllerType_PS3Controller, NULL }, // ps2 maybe break out later - { MAKE_CONTROLLER_ID( 0x146b, 0x0603 ), k_eControllerType_PS3Controller, NULL }, // From SDL - { MAKE_CONTROLLER_ID( 0x146b, 0x5500 ), k_eControllerType_PS3Controller, NULL }, // From SDL - { MAKE_CONTROLLER_ID( 0x1a34, 0x0836 ), k_eControllerType_PS3Controller, NULL }, // Afterglow PS3 - { MAKE_CONTROLLER_ID( 0x20bc, 0x5500 ), k_eControllerType_PS3Controller, NULL }, // ShanWan PS3 - { MAKE_CONTROLLER_ID( 0x20d6, 0x576d ), k_eControllerType_PS3Controller, NULL }, // Power A PS3 - { MAKE_CONTROLLER_ID( 0x20d6, 0xca6d ), k_eControllerType_PS3Controller, NULL }, // From SDL - { MAKE_CONTROLLER_ID( 0x2563, 0x0523 ), k_eControllerType_PS3Controller, NULL }, // Digiflip GP006 - { MAKE_CONTROLLER_ID( 0x2563, 0x0575 ), k_eControllerType_PS3Controller, NULL }, // From SDL - { MAKE_CONTROLLER_ID( 0x25f0, 0x83c3 ), k_eControllerType_PS3Controller, NULL }, // gioteck vx2 - { MAKE_CONTROLLER_ID( 0x25f0, 0xc121 ), k_eControllerType_PS3Controller, NULL }, // - { MAKE_CONTROLLER_ID( 0x2c22, 0x2000 ), k_eControllerType_PS3Controller, NULL }, // Quanba Drone - { MAKE_CONTROLLER_ID( 0x2c22, 0x2003 ), k_eControllerType_PS3Controller, NULL }, // From SDL - { MAKE_CONTROLLER_ID( 0x8380, 0x0003 ), k_eControllerType_PS3Controller, NULL }, // BTP 2163 - { MAKE_CONTROLLER_ID( 0x8888, 0x0308 ), k_eControllerType_PS3Controller, NULL }, // Sony PS3 Controller - { MAKE_CONTROLLER_ID( 0x0079, 0x181b ), k_eControllerType_PS4Controller, NULL }, // Venom Arcade Stick - XXX:this may not work and may need to be called a ps3 controller - { MAKE_CONTROLLER_ID( 0x054c, 0x05c4 ), k_eControllerType_PS4Controller, NULL }, // Sony PS4 Controller - { MAKE_CONTROLLER_ID( 0x054c, 0x05c5 ), k_eControllerType_PS4Controller, NULL }, // STRIKEPAD PS4 Grip Add-on - { MAKE_CONTROLLER_ID( 0x054c, 0x09cc ), k_eControllerType_PS4Controller, NULL }, // Sony PS4 Slim Controller - { MAKE_CONTROLLER_ID( 0x054c, 0x0ba0 ), k_eControllerType_PS4Controller, NULL }, // Sony PS4 Controller (Wireless dongle) - { MAKE_CONTROLLER_ID( 0x0738, 0x8250 ), k_eControllerType_PS4Controller, NULL }, // Mad Catz FightPad Pro PS4 - { MAKE_CONTROLLER_ID( 0x0738, 0x8384 ), k_eControllerType_PS4Controller, NULL }, // Mad Catz FightStick TE S+ PS4 - { MAKE_CONTROLLER_ID( 0x0738, 0x8480 ), k_eControllerType_PS4Controller, NULL }, // Mad Catz FightStick TE 2 PS4 - { MAKE_CONTROLLER_ID( 0x0738, 0x8481 ), k_eControllerType_PS4Controller, NULL }, // Mad Catz FightStick TE 2+ PS4 - { MAKE_CONTROLLER_ID( 0x0C12, 0x0E10 ), k_eControllerType_PS4Controller, NULL }, // Armor Armor 3 Pad PS4 - { MAKE_CONTROLLER_ID( 0x0C12, 0x1CF6 ), k_eControllerType_PS4Controller, NULL }, // EMIO PS4 Elite Controller - { MAKE_CONTROLLER_ID( 0x0c12, 0x0e15 ), k_eControllerType_PS4Controller, NULL }, // Game:Pad 4 - { MAKE_CONTROLLER_ID( 0x0c12, 0x0ef6 ), k_eControllerType_PS4Controller, NULL }, // Hitbox Arcade Stick - { MAKE_CONTROLLER_ID( 0x0f0d, 0x0055 ), k_eControllerType_PS4Controller, NULL }, // HORIPAD 4 FPS - { MAKE_CONTROLLER_ID( 0x0f0d, 0x0066 ), k_eControllerType_PS4Controller, NULL }, // HORIPAD 4 FPS Plus - { MAKE_CONTROLLER_ID( 0x0f0d, 0x0084 ), k_eControllerType_PS4Controller, NULL }, // HORI Fighting Commander PS4 - { MAKE_CONTROLLER_ID( 0x0f0d, 0x008a ), k_eControllerType_PS4Controller, NULL }, // HORI Real Arcade Pro 4 - { MAKE_CONTROLLER_ID( 0x0f0d, 0x009c ), k_eControllerType_PS4Controller, NULL }, // HORI TAC PRO mousething - { MAKE_CONTROLLER_ID( 0x0f0d, 0x00a0 ), k_eControllerType_PS4Controller, NULL }, // HORI TAC4 mousething - { MAKE_CONTROLLER_ID( 0x0f0d, 0x00ee ), k_eControllerType_PS4Controller, NULL }, // Hori mini wired https://www.playstation.com/en-us/explore/accessories/gaming-controllers/mini-wired-gamepad/ - { MAKE_CONTROLLER_ID( 0x11c0, 0x4001 ), k_eControllerType_PS4Controller, NULL }, // "PS4 Fun Controller" added from user log - { MAKE_CONTROLLER_ID( 0x146b, 0x0d01 ), k_eControllerType_PS4Controller, NULL }, // Nacon Revolution Pro Controller - has gyro - { MAKE_CONTROLLER_ID( 0x146b, 0x0d02 ), k_eControllerType_PS4Controller, NULL }, // Nacon Revolution Pro Controller v2 - has gyro - { MAKE_CONTROLLER_ID( 0x146b, 0x0d10 ), k_eControllerType_PS4Controller, NULL }, // NACON Revolution Infinite - has gyro - { MAKE_CONTROLLER_ID( 0x1532, 0X0401 ), k_eControllerType_PS4Controller, NULL }, // Razer Panthera PS4 Controller - { MAKE_CONTROLLER_ID( 0x1532, 0x1000 ), k_eControllerType_PS4Controller, NULL }, // Razer Raiju PS4 Controller - { MAKE_CONTROLLER_ID( 0x1532, 0x1004 ), k_eControllerType_PS4Controller, NULL }, // Razer Raiju 2 Ultimate USB - { MAKE_CONTROLLER_ID( 0x1532, 0x1007 ), k_eControllerType_PS4Controller, NULL }, // Razer Raiju 2 Tournament edition USB - { MAKE_CONTROLLER_ID( 0x1532, 0x1008 ), k_eControllerType_PS4Controller, NULL }, // Razer Panthera Evo Fightstick - { MAKE_CONTROLLER_ID( 0x1532, 0x1009 ), k_eControllerType_PS4Controller, NULL }, // Razer Raiju 2 Ultimate BT - { MAKE_CONTROLLER_ID( 0x1532, 0x100A ), k_eControllerType_PS4Controller, NULL }, // Razer Raiju 2 Tournament edition BT - { MAKE_CONTROLLER_ID( 0x1532, 0x1100 ), k_eControllerType_PS4Controller, NULL }, // Razer RAION Fightpad - Trackpad, no gyro, lightbar hardcoded to green - { MAKE_CONTROLLER_ID( 0x20d6, 0x792a ), k_eControllerType_PS4Controller, NULL }, // PowerA Fusion Fight Pad - { MAKE_CONTROLLER_ID( 0x7545, 0x0104 ), k_eControllerType_PS4Controller, NULL }, // Armor 3 or Level Up Cobra - At least one variant has gyro - { MAKE_CONTROLLER_ID( 0x9886, 0x0025 ), k_eControllerType_PS4Controller, NULL }, // Astro C40 - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0207 ), k_eControllerType_PS4Controller, NULL }, // Victrix Pro Fightstick w/ Touchpad for PS4 - // Removing the Giotek because there were a bunch of help tickets from users w/ issues including from non-PS4 controller users. This VID/PID is probably used in different FW's - // { MAKE_CONTROLLER_ID( 0x7545, 0x1122 ), k_eControllerType_PS4Controller, NULL }, // Giotek VX4 - trackpad/gyro don't work. Had to not filter on interface info. Light bar is flaky, but works. - { MAKE_CONTROLLER_ID( 0x044f, 0xd00e ), k_eControllerType_PS4Controller, NULL }, // Thrustmast Eswap Pro - No gyro and lightbar doesn't change color. Works otherwise - { MAKE_CONTROLLER_ID( 0x0c12, 0x1e10 ), k_eControllerType_PS4Controller, NULL }, // P4 Wired Gamepad generic knock off - lightbar but not trackpad or gyro - { MAKE_CONTROLLER_ID( 0x146b, 0x0d09 ), k_eControllerType_PS4Controller, NULL }, // NACON Daija Fight Stick - touchpad but no gyro/rumble - { MAKE_CONTROLLER_ID( 0x146b, 0x0d10 ), k_eControllerType_PS4Controller, NULL }, // NACON Revolution Unlimited - { MAKE_CONTROLLER_ID( 0x146b, 0x0d08 ), k_eControllerType_PS4Controller, NULL }, // NACON Revolution Unlimited Wireless Dongle - { MAKE_CONTROLLER_ID( 0x146b, 0x0d06 ), k_eControllerType_PS4Controller, NULL }, // NACON Asymetrical Controller Wireless Dongle -- show up as ps4 until you connect controller to it then it reboots into Xbox controller with different vvid/pid - { MAKE_CONTROLLER_ID( 0x146b, 0x1103 ), k_eControllerType_PS4Controller, NULL }, // NACON Asymetrical Controller -- on windows this doesn't enumerate - { MAKE_CONTROLLER_ID( 0x0f0d, 0x0123 ), k_eControllerType_PS4Controller, NULL }, // HORI Wireless Controller Light (Japan only) - only over bt- over usb is xbox and pid 0x0124 - { MAKE_CONTROLLER_ID( 0x146b, 0x0d13 ), k_eControllerType_PS4Controller, NULL }, // NACON Revolution 3 - { MAKE_CONTROLLER_ID( 0x0c12, 0x0e20 ), k_eControllerType_PS4Controller, NULL }, // Brook Mars Controller - needs FW update to show up as Ps4 controller on PC. Has Gyro but touchpad is a single button. +extern EControllerType GuessControllerType( int nVID, int nPID ); +extern const char *GuessControllerName( int nVID, int nPID ); - { MAKE_CONTROLLER_ID( 0x054c, 0x0ce6 ), k_eControllerType_PS5Controller, NULL }, // Sony PS5 Controller - - { MAKE_CONTROLLER_ID( 0x0079, 0x0006 ), k_eControllerType_UnknownNonSteamController, NULL }, // DragonRise Generic USB PCB, sometimes configured as a PC Twin Shock Controller - looks like a DS3 but the face buttons are 1-4 instead of symbols - - { MAKE_CONTROLLER_ID( 0x0079, 0x18d4 ), k_eControllerType_XBox360Controller, NULL }, // GPD Win 2 X-Box Controller - { MAKE_CONTROLLER_ID( 0x03eb, 0xff02 ), k_eControllerType_XBox360Controller, NULL }, // Wooting Two - { MAKE_CONTROLLER_ID( 0x044f, 0xb326 ), k_eControllerType_XBox360Controller, NULL }, // Thrustmaster Gamepad GP XID - { MAKE_CONTROLLER_ID( 0x045e, 0x028e ), k_eControllerType_XBox360Controller, "Xbox 360 Controller" }, // Microsoft X-Box 360 pad - { MAKE_CONTROLLER_ID( 0x045e, 0x028f ), k_eControllerType_XBox360Controller, "Xbox 360 Controller" }, // Microsoft X-Box 360 pad v2 - { MAKE_CONTROLLER_ID( 0x045e, 0x0291 ), k_eControllerType_XBox360Controller, "Xbox 360 Wireless Controller" }, // Xbox 360 Wireless Receiver (XBOX) - { MAKE_CONTROLLER_ID( 0x045e, 0x02a0 ), k_eControllerType_XBox360Controller, NULL }, // Microsoft X-Box 360 Big Button IR - { MAKE_CONTROLLER_ID( 0x045e, 0x02a1 ), k_eControllerType_XBox360Controller, NULL }, // Microsoft X-Box 360 Wireless Controller with XUSB driver on Windows - { MAKE_CONTROLLER_ID( 0x045e, 0x02a9 ), k_eControllerType_XBox360Controller, "Xbox 360 Wireless Controller" }, // Xbox 360 Wireless Receiver (third party knockoff) - { MAKE_CONTROLLER_ID( 0x045e, 0x0719 ), k_eControllerType_XBox360Controller, "Xbox 360 Wireless Controller" }, // Xbox 360 Wireless Receiver - { MAKE_CONTROLLER_ID( 0x046d, 0xc21d ), k_eControllerType_XBox360Controller, NULL }, // Logitech Gamepad F310 - { MAKE_CONTROLLER_ID( 0x046d, 0xc21e ), k_eControllerType_XBox360Controller, NULL }, // Logitech Gamepad F510 - { MAKE_CONTROLLER_ID( 0x046d, 0xc21f ), k_eControllerType_XBox360Controller, NULL }, // Logitech Gamepad F710 - { MAKE_CONTROLLER_ID( 0x046d, 0xc242 ), k_eControllerType_XBox360Controller, NULL }, // Logitech Chillstream Controller - { MAKE_CONTROLLER_ID( 0x056e, 0x2004 ), k_eControllerType_XBox360Controller, NULL }, // Elecom JC-U3613M - { MAKE_CONTROLLER_ID( 0x06a3, 0xf51a ), k_eControllerType_XBox360Controller, NULL }, // Saitek P3600 - { MAKE_CONTROLLER_ID( 0x0738, 0x4716 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Wired Xbox 360 Controller - { MAKE_CONTROLLER_ID( 0x0738, 0x4718 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Street Fighter IV FightStick SE - { MAKE_CONTROLLER_ID( 0x0738, 0x4726 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Xbox 360 Controller - { MAKE_CONTROLLER_ID( 0x0738, 0x4728 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Street Fighter IV FightPad - { MAKE_CONTROLLER_ID( 0x0738, 0x4736 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz MicroCon Gamepad - { MAKE_CONTROLLER_ID( 0x0738, 0x4738 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Wired Xbox 360 Controller (SFIV) - { MAKE_CONTROLLER_ID( 0x0738, 0x4740 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Beat Pad - { MAKE_CONTROLLER_ID( 0x0738, 0xb726 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Xbox controller - MW2 - { MAKE_CONTROLLER_ID( 0x0738, 0xbeef ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz JOYTECH NEO SE Advanced GamePad - { MAKE_CONTROLLER_ID( 0x0738, 0xcb02 ), k_eControllerType_XBox360Controller, NULL }, // Saitek Cyborg Rumble Pad - PC/Xbox 360 - { MAKE_CONTROLLER_ID( 0x0738, 0xcb03 ), k_eControllerType_XBox360Controller, NULL }, // Saitek P3200 Rumble Pad - PC/Xbox 360 - { MAKE_CONTROLLER_ID( 0x0738, 0xf738 ), k_eControllerType_XBox360Controller, NULL }, // Super SFIV FightStick TE S - { MAKE_CONTROLLER_ID( 0x0955, 0x7210 ), k_eControllerType_XBox360Controller, NULL }, // Nvidia Shield local controller - { MAKE_CONTROLLER_ID( 0x0955, 0xb400 ), k_eControllerType_XBox360Controller, NULL }, // NVIDIA Shield streaming controller - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0105 ), k_eControllerType_XBox360Controller, NULL }, // HSM3 Xbox360 dancepad - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0113 ), k_eControllerType_XBox360Controller, "PDP Xbox 360 Afterglow" }, // PDP Afterglow Gamepad for Xbox 360 - { MAKE_CONTROLLER_ID( 0x0e6f, 0x011f ), k_eControllerType_XBox360Controller, "PDP Xbox 360 Rock Candy" }, // PDP Rock Candy Gamepad for Xbox 360 - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0125 ), k_eControllerType_XBox360Controller, "PDP INJUSTICE FightStick" }, // PDP INJUSTICE FightStick for Xbox 360 - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0127 ), k_eControllerType_XBox360Controller, "PDP INJUSTICE FightPad" }, // PDP INJUSTICE FightPad for Xbox 360 - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0131 ), k_eControllerType_XBox360Controller, "PDP EA Soccer Controller" }, // PDP EA Soccer Gamepad - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0133 ), k_eControllerType_XBox360Controller, "PDP Battlefield 4 Controller" }, // PDP Battlefield 4 Gamepad - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0143 ), k_eControllerType_XBox360Controller, "PDP MK X Fight Stick" }, // PDP MK X Fight Stick for Xbox 360 - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0147 ), k_eControllerType_XBox360Controller, "PDP Xbox 360 Marvel Controller" }, // PDP Marvel Controller for Xbox 360 - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0201 ), k_eControllerType_XBox360Controller, "PDP Xbox 360 Controller" }, // PDP Gamepad for Xbox 360 - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0213 ), k_eControllerType_XBox360Controller, "PDP Xbox 360 Afterglow" }, // PDP Afterglow Gamepad for Xbox 360 - { MAKE_CONTROLLER_ID( 0x0e6f, 0x021f ), k_eControllerType_XBox360Controller, "PDP Xbox 360 Rock Candy" }, // PDP Rock Candy Gamepad for Xbox 360 - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0301 ), k_eControllerType_XBox360Controller, "PDP Xbox 360 Controller" }, // PDP Gamepad for Xbox 360 - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0313 ), k_eControllerType_XBox360Controller, "PDP Xbox 360 Afterglow" }, // PDP Afterglow Gamepad for Xbox 360 - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0314 ), k_eControllerType_XBox360Controller, "PDP Xbox 360 Afterglow" }, // PDP Afterglow Gamepad for Xbox 360 - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0401 ), k_eControllerType_XBox360Controller, "PDP Xbox 360 Controller" }, // PDP Gamepad for Xbox 360 - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0413 ), k_eControllerType_XBox360Controller, NULL }, // PDP Afterglow AX.1 (unlisted) - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0501 ), k_eControllerType_XBox360Controller, NULL }, // PDP Xbox 360 Controller (unlisted) - { MAKE_CONTROLLER_ID( 0x0e6f, 0xf900 ), k_eControllerType_XBox360Controller, NULL }, // PDP Afterglow AX.1 (unlisted) - { MAKE_CONTROLLER_ID( 0x0f0d, 0x000a ), k_eControllerType_XBox360Controller, NULL }, // Hori Co. DOA4 FightStick - { MAKE_CONTROLLER_ID( 0x0f0d, 0x000c ), k_eControllerType_XBox360Controller, NULL }, // Hori PadEX Turbo - { MAKE_CONTROLLER_ID( 0x0f0d, 0x000d ), k_eControllerType_XBox360Controller, NULL }, // Hori Fighting Stick EX2 - { MAKE_CONTROLLER_ID( 0x0f0d, 0x0016 ), k_eControllerType_XBox360Controller, NULL }, // Hori Real Arcade Pro.EX - { MAKE_CONTROLLER_ID( 0x0f0d, 0x001b ), k_eControllerType_XBox360Controller, NULL }, // Hori Real Arcade Pro VX - { MAKE_CONTROLLER_ID( 0x0f0d, 0x008c ), k_eControllerType_XBox360Controller, NULL }, // Hori Real Arcade Pro 4 - { MAKE_CONTROLLER_ID( 0x0f0d, 0x00db ), k_eControllerType_XBox360Controller, "HORI Slime Controller" }, // Hori Dragon Quest Slime Controller - { MAKE_CONTROLLER_ID( 0x1038, 0x1430 ), k_eControllerType_XBox360Controller, "SteelSeries Stratus Duo" }, // SteelSeries Stratus Duo - { MAKE_CONTROLLER_ID( 0x1038, 0x1431 ), k_eControllerType_XBox360Controller, "SteelSeries Stratus Duo" }, // SteelSeries Stratus Duo - { MAKE_CONTROLLER_ID( 0x1038, 0xb360 ), k_eControllerType_XBox360Controller, NULL }, // SteelSeries Nimbus/Stratus XL - { MAKE_CONTROLLER_ID( 0x11c9, 0x55f0 ), k_eControllerType_XBox360Controller, NULL }, // Nacon GC-100XF - { MAKE_CONTROLLER_ID( 0x12ab, 0x0004 ), k_eControllerType_XBox360Controller, NULL }, // Honey Bee Xbox360 dancepad - { MAKE_CONTROLLER_ID( 0x12ab, 0x0301 ), k_eControllerType_XBox360Controller, NULL }, // PDP AFTERGLOW AX.1 - { MAKE_CONTROLLER_ID( 0x12ab, 0x0303 ), k_eControllerType_XBox360Controller, NULL }, // Mortal Kombat Klassic FightStick - { MAKE_CONTROLLER_ID( 0x1430, 0x02a0 ), k_eControllerType_XBox360Controller, NULL }, // RedOctane Controller Adapter - { MAKE_CONTROLLER_ID( 0x1430, 0x4748 ), k_eControllerType_XBox360Controller, NULL }, // RedOctane Guitar Hero X-plorer - { MAKE_CONTROLLER_ID( 0x1430, 0xf801 ), k_eControllerType_XBox360Controller, NULL }, // RedOctane Controller - { MAKE_CONTROLLER_ID( 0x146b, 0x0601 ), k_eControllerType_XBox360Controller, NULL }, // BigBen Interactive XBOX 360 Controller -// { MAKE_CONTROLLER_ID( 0x1532, 0x0037 ), k_eControllerType_XBox360Controller, NULL }, // Razer Sabertooth - { MAKE_CONTROLLER_ID( 0x15e4, 0x3f00 ), k_eControllerType_XBox360Controller, NULL }, // Power A Mini Pro Elite - { MAKE_CONTROLLER_ID( 0x15e4, 0x3f0a ), k_eControllerType_XBox360Controller, NULL }, // Xbox Airflo wired controller - { MAKE_CONTROLLER_ID( 0x15e4, 0x3f10 ), k_eControllerType_XBox360Controller, NULL }, // Batarang Xbox 360 controller - { MAKE_CONTROLLER_ID( 0x162e, 0xbeef ), k_eControllerType_XBox360Controller, NULL }, // Joytech Neo-Se Take2 - { MAKE_CONTROLLER_ID( 0x1689, 0xfd00 ), k_eControllerType_XBox360Controller, NULL }, // Razer Onza Tournament Edition - { MAKE_CONTROLLER_ID( 0x1689, 0xfd01 ), k_eControllerType_XBox360Controller, NULL }, // Razer Onza Classic Edition - { MAKE_CONTROLLER_ID( 0x1689, 0xfe00 ), k_eControllerType_XBox360Controller, NULL }, // Razer Sabertooth - { MAKE_CONTROLLER_ID( 0x1949, 0x041a ), k_eControllerType_XBox360Controller, "Amazon Luna Controller" }, // Amazon Luna Controller - { MAKE_CONTROLLER_ID( 0x1bad, 0x0002 ), k_eControllerType_XBox360Controller, NULL }, // Harmonix Rock Band Guitar - { MAKE_CONTROLLER_ID( 0x1bad, 0x0003 ), k_eControllerType_XBox360Controller, NULL }, // Harmonix Rock Band Drumkit - { MAKE_CONTROLLER_ID( 0x1bad, 0xf016 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Xbox 360 Controller - { MAKE_CONTROLLER_ID( 0x1bad, 0xf018 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Street Fighter IV SE Fighting Stick - { MAKE_CONTROLLER_ID( 0x1bad, 0xf019 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Brawlstick for Xbox 360 - { MAKE_CONTROLLER_ID( 0x1bad, 0xf021 ), k_eControllerType_XBox360Controller, NULL }, // Mad Cats Ghost Recon FS GamePad - { MAKE_CONTROLLER_ID( 0x1bad, 0xf023 ), k_eControllerType_XBox360Controller, NULL }, // MLG Pro Circuit Controller (Xbox) - { MAKE_CONTROLLER_ID( 0x1bad, 0xf025 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Call Of Duty - { MAKE_CONTROLLER_ID( 0x1bad, 0xf027 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz FPS Pro - { MAKE_CONTROLLER_ID( 0x1bad, 0xf028 ), k_eControllerType_XBox360Controller, NULL }, // Street Fighter IV FightPad - { MAKE_CONTROLLER_ID( 0x1bad, 0xf02e ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Fightpad - { MAKE_CONTROLLER_ID( 0x1bad, 0xf036 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz MicroCon GamePad Pro - { MAKE_CONTROLLER_ID( 0x1bad, 0xf038 ), k_eControllerType_XBox360Controller, NULL }, // Street Fighter IV FightStick TE - { MAKE_CONTROLLER_ID( 0x1bad, 0xf039 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz MvC2 TE - { MAKE_CONTROLLER_ID( 0x1bad, 0xf03a ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz SFxT Fightstick Pro - { MAKE_CONTROLLER_ID( 0x1bad, 0xf03d ), k_eControllerType_XBox360Controller, NULL }, // Street Fighter IV Arcade Stick TE - Chun Li - { MAKE_CONTROLLER_ID( 0x1bad, 0xf03e ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz MLG FightStick TE - { MAKE_CONTROLLER_ID( 0x1bad, 0xf03f ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz FightStick SoulCaliber - { MAKE_CONTROLLER_ID( 0x1bad, 0xf042 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz FightStick TES+ - { MAKE_CONTROLLER_ID( 0x1bad, 0xf080 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz FightStick TE2 - { MAKE_CONTROLLER_ID( 0x1bad, 0xf501 ), k_eControllerType_XBox360Controller, NULL }, // HoriPad EX2 Turbo - { MAKE_CONTROLLER_ID( 0x1bad, 0xf502 ), k_eControllerType_XBox360Controller, NULL }, // Hori Real Arcade Pro.VX SA - { MAKE_CONTROLLER_ID( 0x1bad, 0xf503 ), k_eControllerType_XBox360Controller, NULL }, // Hori Fighting Stick VX - { MAKE_CONTROLLER_ID( 0x1bad, 0xf504 ), k_eControllerType_XBox360Controller, NULL }, // Hori Real Arcade Pro. EX - { MAKE_CONTROLLER_ID( 0x1bad, 0xf505 ), k_eControllerType_XBox360Controller, NULL }, // Hori Fighting Stick EX2B - { MAKE_CONTROLLER_ID( 0x1bad, 0xf506 ), k_eControllerType_XBox360Controller, NULL }, // Hori Real Arcade Pro.EX Premium VLX - { MAKE_CONTROLLER_ID( 0x1bad, 0xf900 ), k_eControllerType_XBox360Controller, NULL }, // Harmonix Xbox 360 Controller - { MAKE_CONTROLLER_ID( 0x1bad, 0xf901 ), k_eControllerType_XBox360Controller, NULL }, // Gamestop Xbox 360 Controller - { MAKE_CONTROLLER_ID( 0x1bad, 0xf902 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Gamepad2 - { MAKE_CONTROLLER_ID( 0x1bad, 0xf903 ), k_eControllerType_XBox360Controller, NULL }, // Tron Xbox 360 controller - { MAKE_CONTROLLER_ID( 0x1bad, 0xf904 ), k_eControllerType_XBox360Controller, NULL }, // PDP Versus Fighting Pad - { MAKE_CONTROLLER_ID( 0x1bad, 0xf906 ), k_eControllerType_XBox360Controller, NULL }, // MortalKombat FightStick - { MAKE_CONTROLLER_ID( 0x1bad, 0xfa01 ), k_eControllerType_XBox360Controller, NULL }, // MadCatz GamePad - { MAKE_CONTROLLER_ID( 0x1bad, 0xfd00 ), k_eControllerType_XBox360Controller, NULL }, // Razer Onza TE - { MAKE_CONTROLLER_ID( 0x1bad, 0xfd01 ), k_eControllerType_XBox360Controller, NULL }, // Razer Onza - { MAKE_CONTROLLER_ID( 0x24c6, 0x5000 ), k_eControllerType_XBox360Controller, NULL }, // Razer Atrox Arcade Stick - { MAKE_CONTROLLER_ID( 0x24c6, 0x5300 ), k_eControllerType_XBox360Controller, NULL }, // PowerA MINI PROEX Controller - { MAKE_CONTROLLER_ID( 0x24c6, 0x5303 ), k_eControllerType_XBox360Controller, NULL }, // Xbox Airflo wired controller - { MAKE_CONTROLLER_ID( 0x24c6, 0x530a ), k_eControllerType_XBox360Controller, NULL }, // Xbox 360 Pro EX Controller - { MAKE_CONTROLLER_ID( 0x24c6, 0x531a ), k_eControllerType_XBox360Controller, NULL }, // PowerA Pro Ex - { MAKE_CONTROLLER_ID( 0x24c6, 0x5397 ), k_eControllerType_XBox360Controller, NULL }, // FUS1ON Tournament Controller - { MAKE_CONTROLLER_ID( 0x24c6, 0x5500 ), k_eControllerType_XBox360Controller, NULL }, // Hori XBOX 360 EX 2 with Turbo - { MAKE_CONTROLLER_ID( 0x24c6, 0x5501 ), k_eControllerType_XBox360Controller, NULL }, // Hori Real Arcade Pro VX-SA - { MAKE_CONTROLLER_ID( 0x24c6, 0x5502 ), k_eControllerType_XBox360Controller, NULL }, // Hori Fighting Stick VX Alt - { MAKE_CONTROLLER_ID( 0x24c6, 0x5503 ), k_eControllerType_XBox360Controller, NULL }, // Hori Fighting Edge - { MAKE_CONTROLLER_ID( 0x24c6, 0x5506 ), k_eControllerType_XBox360Controller, NULL }, // Hori SOULCALIBUR V Stick - { MAKE_CONTROLLER_ID( 0x24c6, 0x550d ), k_eControllerType_XBox360Controller, NULL }, // Hori GEM Xbox controller - { MAKE_CONTROLLER_ID( 0x24c6, 0x550e ), k_eControllerType_XBox360Controller, NULL }, // Hori Real Arcade Pro V Kai 360 - { MAKE_CONTROLLER_ID( 0x24c6, 0x5508 ), k_eControllerType_XBox360Controller, NULL }, // Hori PAD A - { MAKE_CONTROLLER_ID( 0x24c6, 0x5510 ), k_eControllerType_XBox360Controller, NULL }, // Hori Fighting Commander ONE - { MAKE_CONTROLLER_ID( 0x24c6, 0x5b00 ), k_eControllerType_XBox360Controller, NULL }, // ThrustMaster Ferrari Italia 458 Racing Wheel - { MAKE_CONTROLLER_ID( 0x24c6, 0x5b02 ), k_eControllerType_XBox360Controller, NULL }, // Thrustmaster, Inc. GPX Controller - { MAKE_CONTROLLER_ID( 0x24c6, 0x5b03 ), k_eControllerType_XBox360Controller, NULL }, // Thrustmaster Ferrari 458 Racing Wheel - { MAKE_CONTROLLER_ID( 0x24c6, 0x5d04 ), k_eControllerType_XBox360Controller, NULL }, // Razer Sabertooth - { MAKE_CONTROLLER_ID( 0x24c6, 0xfafa ), k_eControllerType_XBox360Controller, NULL }, // Aplay Controller - { MAKE_CONTROLLER_ID( 0x24c6, 0xfafb ), k_eControllerType_XBox360Controller, NULL }, // Aplay Controller - { MAKE_CONTROLLER_ID( 0x24c6, 0xfafc ), k_eControllerType_XBox360Controller, NULL }, // Afterglow Gamepad 1 - { MAKE_CONTROLLER_ID( 0x24c6, 0xfafd ), k_eControllerType_XBox360Controller, NULL }, // Afterglow Gamepad 3 - { MAKE_CONTROLLER_ID( 0x24c6, 0xfafe ), k_eControllerType_XBox360Controller, NULL }, // Rock Candy Gamepad for Xbox 360 - - { MAKE_CONTROLLER_ID( 0x045e, 0x02d1 ), k_eControllerType_XBoxOneController, "Xbox One Controller" }, // Microsoft X-Box One pad - { MAKE_CONTROLLER_ID( 0x045e, 0x02dd ), k_eControllerType_XBoxOneController, "Xbox One Controller" }, // Microsoft X-Box One pad (Firmware 2015) - { MAKE_CONTROLLER_ID( 0x045e, 0x02e0 ), k_eControllerType_XBoxOneController, "Xbox One S Controller" }, // Microsoft X-Box One S pad (Bluetooth) - { MAKE_CONTROLLER_ID( 0x045e, 0x02e3 ), k_eControllerType_XBoxOneController, "Xbox One Elite Controller" }, // Microsoft X-Box One Elite pad - { MAKE_CONTROLLER_ID( 0x045e, 0x02ea ), k_eControllerType_XBoxOneController, "Xbox One S Controller" }, // Microsoft X-Box One S pad - { MAKE_CONTROLLER_ID( 0x045e, 0x02fd ), k_eControllerType_XBoxOneController, "Xbox One S Controller" }, // Microsoft X-Box One S pad (Bluetooth) - { MAKE_CONTROLLER_ID( 0x045e, 0x02ff ), k_eControllerType_XBoxOneController, NULL }, // Microsoft X-Box One controller with XBOXGIP driver on Windows - { MAKE_CONTROLLER_ID( 0x045e, 0x0b00 ), k_eControllerType_XBoxOneController, "Xbox One Elite 2 Controller" }, // Microsoft X-Box One Elite Series 2 pad - { MAKE_CONTROLLER_ID( 0x045e, 0x0b02 ), k_eControllerType_XBoxOneController, "Xbox One Elite 2 Controller" }, // Microsoft X-Box One Elite Series 2 pad (Bluetooth) - { MAKE_CONTROLLER_ID( 0x045e, 0x0b05 ), k_eControllerType_XBoxOneController, "Xbox One Elite 2 Controller" }, // Microsoft X-Box One Elite Series 2 pad (Bluetooth) - { MAKE_CONTROLLER_ID( 0x045e, 0x0b0a ), k_eControllerType_XBoxOneController, "Xbox Adaptive Controller" }, // Microsoft X-Box Adaptive pad - { MAKE_CONTROLLER_ID( 0x045e, 0x0b0c ), k_eControllerType_XBoxOneController, "Xbox Adaptive Controller" }, // Microsoft X-Box Adaptive pad (Bluetooth) - { MAKE_CONTROLLER_ID( 0x045e, 0x0b12 ), k_eControllerType_XBoxOneController, "Xbox Series X Controller" }, // Microsoft X-Box Series X pad - { MAKE_CONTROLLER_ID( 0x045e, 0x0b13 ), k_eControllerType_XBoxOneController, "Xbox Series X Controller" }, // Microsoft X-Box Series X pad (BLE) - { MAKE_CONTROLLER_ID( 0x045e, 0x0b20 ), k_eControllerType_XBoxOneController, "Xbox One S Controller" }, // Microsoft X-Box One S pad (BLE) - { MAKE_CONTROLLER_ID( 0x045e, 0x0b21 ), k_eControllerType_XBoxOneController, "Xbox Adaptive Controller" }, // Microsoft X-Box Adaptive pad (BLE) - { MAKE_CONTROLLER_ID( 0x045e, 0x0b22 ), k_eControllerType_XBoxOneController, "Xbox One Elite 2 Controller" }, // Microsoft X-Box One Elite Series 2 pad (BLE) - { MAKE_CONTROLLER_ID( 0x0738, 0x4a01 ), k_eControllerType_XBoxOneController, NULL }, // Mad Catz FightStick TE 2 - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0139 ), k_eControllerType_XBoxOneController, "PDP Xbox One Afterglow" }, // PDP Afterglow Wired Controller for Xbox One - { MAKE_CONTROLLER_ID( 0x0e6f, 0x013B ), k_eControllerType_XBoxOneController, "PDP Xbox One Face-Off Controller" }, // PDP Face-Off Gamepad for Xbox One - { MAKE_CONTROLLER_ID( 0x0e6f, 0x013a ), k_eControllerType_XBoxOneController, NULL }, // PDP Xbox One Controller (unlisted) - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0145 ), k_eControllerType_XBoxOneController, "PDP MK X Fight Pad" }, // PDP MK X Fight Pad for Xbox One - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0146 ), k_eControllerType_XBoxOneController, "PDP Xbox One Rock Candy" }, // PDP Rock Candy Wired Controller for Xbox One - { MAKE_CONTROLLER_ID( 0x0e6f, 0x015b ), k_eControllerType_XBoxOneController, "PDP Fallout 4 Vault Boy Controller" }, // PDP Fallout 4 Vault Boy Wired Controller for Xbox One - { MAKE_CONTROLLER_ID( 0x0e6f, 0x015c ), k_eControllerType_XBoxOneController, "PDP Xbox One @Play Controller" }, // PDP @Play Wired Controller for Xbox One - { MAKE_CONTROLLER_ID( 0x0e6f, 0x015d ), k_eControllerType_XBoxOneController, "PDP Mirror's Edge Controller" }, // PDP Mirror's Edge Wired Controller for Xbox One - { MAKE_CONTROLLER_ID( 0x0e6f, 0x015f ), k_eControllerType_XBoxOneController, "PDP Metallic Controller" }, // PDP Metallic Wired Controller for Xbox One - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0160 ), k_eControllerType_XBoxOneController, "PDP NFL Face-Off Controller" }, // PDP NFL Official Face-Off Wired Controller for Xbox One - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0161 ), k_eControllerType_XBoxOneController, "PDP Xbox One Camo" }, // PDP Camo Wired Controller for Xbox One - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0162 ), k_eControllerType_XBoxOneController, "PDP Xbox One Controller" }, // PDP Wired Controller for Xbox One - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0163 ), k_eControllerType_XBoxOneController, "PDP Deliverer of Truth" }, // PDP Legendary Collection: Deliverer of Truth - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0164 ), k_eControllerType_XBoxOneController, "PDP Battlefield 1 Controller" }, // PDP Battlefield 1 Official Wired Controller for Xbox One - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0165 ), k_eControllerType_XBoxOneController, "PDP Titanfall 2 Controller" }, // PDP Titanfall 2 Official Wired Controller for Xbox One - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0166 ), k_eControllerType_XBoxOneController, "PDP Mass Effect: Andromeda Controller" }, // PDP Mass Effect: Andromeda Official Wired Controller for Xbox One - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0167 ), k_eControllerType_XBoxOneController, "PDP Halo Wars 2 Face-Off Controller" }, // PDP Halo Wars 2 Official Face-Off Wired Controller for Xbox One - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0205 ), k_eControllerType_XBoxOneController, "PDP Victrix Pro Fight Stick" }, // PDP Victrix Pro Fight Stick - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0206 ), k_eControllerType_XBoxOneController, "PDP Mortal Kombat Controller" }, // PDP Mortal Kombat 25 Anniversary Edition Stick (Xbox One) - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0246 ), k_eControllerType_XBoxOneController, "PDP Xbox One Rock Candy" }, // PDP Rock Candy Wired Controller for Xbox One - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0261 ), k_eControllerType_XBoxOneController, "PDP Xbox One Camo" }, // PDP Camo Wired Controller - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0262 ), k_eControllerType_XBoxOneController, "PDP Xbox One Controller" }, // PDP Wired Controller - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02a0 ), k_eControllerType_XBoxOneController, "PDP Xbox One Midnight Blue" }, // PDP Wired Controller for Xbox One - Midnight Blue - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02a1 ), k_eControllerType_XBoxOneController, "PDP Xbox One Verdant Green" }, // PDP Wired Controller for Xbox One - Verdant Green - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02a2 ), k_eControllerType_XBoxOneController, "PDP Xbox One Crimson Red" }, // PDP Wired Controller for Xbox One - Crimson Red - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02a3 ), k_eControllerType_XBoxOneController, "PDP Xbox One Arctic White" }, // PDP Wired Controller for Xbox One - Arctic White - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02a4 ), k_eControllerType_XBoxOneController, "PDP Xbox One Phantom Black" }, // PDP Wired Controller for Xbox One - Stealth Series | Phantom Black - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02a5 ), k_eControllerType_XBoxOneController, "PDP Xbox One Ghost White" }, // PDP Wired Controller for Xbox One - Stealth Series | Ghost White - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02a6 ), k_eControllerType_XBoxOneController, "PDP Xbox One Revenant Blue" }, // PDP Wired Controller for Xbox One - Stealth Series | Revenant Blue - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02a7 ), k_eControllerType_XBoxOneController, "PDP Xbox One Raven Black" }, // PDP Wired Controller for Xbox One - Raven Black - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02a8 ), k_eControllerType_XBoxOneController, "PDP Xbox One Arctic White" }, // PDP Wired Controller for Xbox One - Arctic White - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02a9 ), k_eControllerType_XBoxOneController, "PDP Xbox One Midnight Blue" }, // PDP Wired Controller for Xbox One - Midnight Blue - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02aa ), k_eControllerType_XBoxOneController, "PDP Xbox One Verdant Green" }, // PDP Wired Controller for Xbox One - Verdant Green - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02ab ), k_eControllerType_XBoxOneController, "PDP Xbox One Crimson Red" }, // PDP Wired Controller for Xbox One - Crimson Red - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02ac ), k_eControllerType_XBoxOneController, "PDP Xbox One Ember Orange" }, // PDP Wired Controller for Xbox One - Ember Orange - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02ad ), k_eControllerType_XBoxOneController, "PDP Xbox One Phantom Black" }, // PDP Wired Controller for Xbox One - Stealth Series | Phantom Black - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02ae ), k_eControllerType_XBoxOneController, "PDP Xbox One Ghost White" }, // PDP Wired Controller for Xbox One - Stealth Series | Ghost White - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02af ), k_eControllerType_XBoxOneController, "PDP Xbox One Revenant Blue" }, // PDP Wired Controller for Xbox One - Stealth Series | Revenant Blue - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02b0 ), k_eControllerType_XBoxOneController, "PDP Xbox One Raven Black" }, // PDP Wired Controller for Xbox One - Raven Black - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02b1 ), k_eControllerType_XBoxOneController, "PDP Xbox One Arctic White" }, // PDP Wired Controller for Xbox One - Arctic White - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02b3 ), k_eControllerType_XBoxOneController, "PDP Xbox One Afterglow" }, // PDP Afterglow Prismatic Wired Controller - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02b5 ), k_eControllerType_XBoxOneController, "PDP Xbox One GAMEware Controller" }, // PDP GAMEware Wired Controller Xbox One - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02b6 ), k_eControllerType_XBoxOneController, NULL }, // PDP One-Handed Joystick Adaptive Controller - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02bd ), k_eControllerType_XBoxOneController, "PDP Xbox One Royal Purple" }, // PDP Wired Controller for Xbox One - Royal Purple - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02be ), k_eControllerType_XBoxOneController, "PDP Xbox One Raven Black" }, // PDP Deluxe Wired Controller for Xbox One - Raven Black - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02bf ), k_eControllerType_XBoxOneController, "PDP Xbox One Midnight Blue" }, // PDP Deluxe Wired Controller for Xbox One - Midnight Blue - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02c0 ), k_eControllerType_XBoxOneController, "PDP Xbox One Phantom Black" }, // PDP Deluxe Wired Controller for Xbox One - Stealth Series | Phantom Black - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02c1 ), k_eControllerType_XBoxOneController, "PDP Xbox One Ghost White" }, // PDP Deluxe Wired Controller for Xbox One - Stealth Series | Ghost White - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02c2 ), k_eControllerType_XBoxOneController, "PDP Xbox One Revenant Blue" }, // PDP Deluxe Wired Controller for Xbox One - Stealth Series | Revenant Blue - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02c3 ), k_eControllerType_XBoxOneController, "PDP Xbox One Verdant Green" }, // PDP Deluxe Wired Controller for Xbox One - Verdant Green - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02c4 ), k_eControllerType_XBoxOneController, "PDP Xbox One Ember Orange" }, // PDP Deluxe Wired Controller for Xbox One - Ember Orange - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02c5 ), k_eControllerType_XBoxOneController, "PDP Xbox One Royal Purple" }, // PDP Deluxe Wired Controller for Xbox One - Royal Purple - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02c6 ), k_eControllerType_XBoxOneController, "PDP Xbox One Crimson Red" }, // PDP Deluxe Wired Controller for Xbox One - Crimson Red - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02c7 ), k_eControllerType_XBoxOneController, "PDP Xbox One Arctic White" }, // PDP Deluxe Wired Controller for Xbox One - Arctic White - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02c8 ), k_eControllerType_XBoxOneController, "PDP Kingdom Hearts Controller" }, // PDP Kingdom Hearts Wired Controller - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02c9 ), k_eControllerType_XBoxOneController, "PDP Xbox One Phantasm Red" }, // PDP Deluxe Wired Controller for Xbox One - Stealth Series | Phantasm Red - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02ca ), k_eControllerType_XBoxOneController, "PDP Xbox One Specter Violet" }, // PDP Deluxe Wired Controller for Xbox One - Stealth Series | Specter Violet - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02cb ), k_eControllerType_XBoxOneController, "PDP Xbox One Specter Violet" }, // PDP Wired Controller for Xbox One - Stealth Series | Specter Violet - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02cd ), k_eControllerType_XBoxOneController, "PDP Xbox One Blu-merang" }, // PDP Rock Candy Wired Controller for Xbox One - Blu-merang - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02ce ), k_eControllerType_XBoxOneController, "PDP Xbox One Cranblast" }, // PDP Rock Candy Wired Controller for Xbox One - Cranblast - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02cf ), k_eControllerType_XBoxOneController, "PDP Xbox One Aqualime" }, // PDP Rock Candy Wired Controller for Xbox One - Aqualime - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02d5 ), k_eControllerType_XBoxOneController, "PDP Xbox One Red Camo" }, // PDP Wired Controller for Xbox One - Red Camo - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0346 ), k_eControllerType_XBoxOneController, "PDP Xbox One RC Gamepad" }, // PDP RC Gamepad for Xbox One - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0446 ), k_eControllerType_XBoxOneController, "PDP Xbox One RC Gamepad" }, // PDP RC Gamepad for Xbox One - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02da ), k_eControllerType_XBoxOneController, "PDP Xbox Series X Afterglow" }, // PDP Xbox Series X Afterglow - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02d6 ), k_eControllerType_XBoxOneController, "Victrix Gambit Tournament Controller" }, // Victrix Gambit Tournament Controller - { MAKE_CONTROLLER_ID( 0x0e6f, 0x02d9 ), k_eControllerType_XBoxOneController, "PDP Xbox Series X Midnight Blue" }, // PDP Xbox Series X Midnight Blue - { MAKE_CONTROLLER_ID( 0x0f0d, 0x0063 ), k_eControllerType_XBoxOneController, NULL }, // Hori Real Arcade Pro Hayabusa (USA) Xbox One - { MAKE_CONTROLLER_ID( 0x0f0d, 0x0067 ), k_eControllerType_XBoxOneController, NULL }, // HORIPAD ONE - { MAKE_CONTROLLER_ID( 0x0f0d, 0x0078 ), k_eControllerType_XBoxOneController, NULL }, // Hori Real Arcade Pro V Kai Xbox One - { MAKE_CONTROLLER_ID( 0x0f0d, 0x00c5 ), k_eControllerType_XBoxOneController, NULL }, // HORI Fighting Commander - { MAKE_CONTROLLER_ID( 0x1532, 0x0a00 ), k_eControllerType_XBoxOneController, NULL }, // Razer Atrox Arcade Stick - { MAKE_CONTROLLER_ID( 0x1532, 0x0a03 ), k_eControllerType_XBoxOneController, NULL }, // Razer Wildcat - { MAKE_CONTROLLER_ID( 0x1532, 0x0a14 ), k_eControllerType_XBoxOneController, NULL }, // Razer Wolverine Ultimate - { MAKE_CONTROLLER_ID( 0x1532, 0x0a15 ), k_eControllerType_XBoxOneController, NULL }, // Razer Wolverine Tournament Edition - { MAKE_CONTROLLER_ID( 0x20d6, 0x2001 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller - Black Inline - { MAKE_CONTROLLER_ID( 0x20d6, 0x2002 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Gray/White Inline - { MAKE_CONTROLLER_ID( 0x20d6, 0x2003 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Green Inline - { MAKE_CONTROLLER_ID( 0x20d6, 0x2004 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Pink inline - { MAKE_CONTROLLER_ID( 0x20d6, 0x2005 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X Wired Controller Core - Black - { MAKE_CONTROLLER_ID( 0x20d6, 0x2006 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X Wired Controller Core - White - { MAKE_CONTROLLER_ID( 0x20d6, 0x2009 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Red inline - { MAKE_CONTROLLER_ID( 0x20d6, 0x200a ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Blue inline - { MAKE_CONTROLLER_ID( 0x20d6, 0x200b ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Camo Metallic Red - { MAKE_CONTROLLER_ID( 0x20d6, 0x200c ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Camo Metallic Blue - { MAKE_CONTROLLER_ID( 0x20d6, 0x200d ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Seafoam Fade - { MAKE_CONTROLLER_ID( 0x20d6, 0x200e ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Midnight Blue - { MAKE_CONTROLLER_ID( 0x20d6, 0x200f ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Soldier Green - { MAKE_CONTROLLER_ID( 0x20d6, 0x2011 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired - Metallic Ice - { MAKE_CONTROLLER_ID( 0x20d6, 0x2012 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X Cuphead EnWired Controller - Mugman - { MAKE_CONTROLLER_ID( 0x20d6, 0x2015 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller - Blue Hint - { MAKE_CONTROLLER_ID( 0x20d6, 0x2016 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller - Green Hint - { MAKE_CONTROLLER_ID( 0x20d6, 0x2017 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Cntroller - Arctic Camo - { MAKE_CONTROLLER_ID( 0x20d6, 0x2018 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Arc Lightning - { MAKE_CONTROLLER_ID( 0x20d6, 0x2019 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Royal Purple - { MAKE_CONTROLLER_ID( 0x20d6, 0x201a ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Nebula - { MAKE_CONTROLLER_ID( 0x20d6, 0x4001 ), k_eControllerType_XBoxOneController, "PowerA Fusion Pro 2 Controller" }, // PowerA Fusion Pro 2 Wired Controller (Xbox Series X style) - { MAKE_CONTROLLER_ID( 0x20d6, 0x4002 ), k_eControllerType_XBoxOneController, "PowerA Spectra Infinity Controller" }, // PowerA Spectra Infinity Wired Controller (Xbox Series X style) - { MAKE_CONTROLLER_ID( 0x24c6, 0x541a ), k_eControllerType_XBoxOneController, NULL }, // PowerA Xbox One Mini Wired Controller - { MAKE_CONTROLLER_ID( 0x24c6, 0x542a ), k_eControllerType_XBoxOneController, NULL }, // Xbox ONE spectra - { MAKE_CONTROLLER_ID( 0x24c6, 0x543a ), k_eControllerType_XBoxOneController, "PowerA Xbox One Controller" }, // PowerA Xbox ONE liquid metal controller - { MAKE_CONTROLLER_ID( 0x24c6, 0x551a ), k_eControllerType_XBoxOneController, NULL }, // PowerA FUSION Pro Controller - { MAKE_CONTROLLER_ID( 0x24c6, 0x561a ), k_eControllerType_XBoxOneController, NULL }, // PowerA FUSION Controller - { MAKE_CONTROLLER_ID( 0x24c6, 0x581a ), k_eControllerType_XBoxOneController, NULL }, // BDA XB1 Classic Controller - { MAKE_CONTROLLER_ID( 0x24c6, 0x591a ), k_eControllerType_XBoxOneController, NULL }, // PowerA FUSION Pro Controller - { MAKE_CONTROLLER_ID( 0x24c6, 0x592a ), k_eControllerType_XBoxOneController, NULL }, // BDA XB1 Spectra Pro - { MAKE_CONTROLLER_ID( 0x24c6, 0x791a ), k_eControllerType_XBoxOneController, NULL }, // PowerA Fusion Fight Pad - { MAKE_CONTROLLER_ID( 0x2e24, 0x0652 ), k_eControllerType_XBoxOneController, NULL }, // Hyperkin Duke - { MAKE_CONTROLLER_ID( 0x2e24, 0x1618 ), k_eControllerType_XBoxOneController, NULL }, // Hyperkin Duke - { MAKE_CONTROLLER_ID( 0x2e24, 0x1688 ), k_eControllerType_XBoxOneController, NULL }, // Hyperkin X91 - { MAKE_CONTROLLER_ID( 0x146b, 0x0611 ), k_eControllerType_XBoxOneController, NULL }, // Xbox Controller Mode for NACON Revolution 3 - - // These have been added via Minidump for unrecognized Xinput controller assert - { MAKE_CONTROLLER_ID( 0x0000, 0x0000 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x045e, 0x02a2 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller - Microsoft VID - { MAKE_CONTROLLER_ID( 0x0e6f, 0x1414 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0159 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x24c6, 0xfaff ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x0f0d, 0x006d ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x0f0d, 0x00a4 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x0079, 0x1832 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x0079, 0x187f ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x0079, 0x1883 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x03eb, 0xff01 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x2c22, 0x2303 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x0c12, 0x0ef8 ), k_eControllerType_XBox360Controller, NULL }, // Homemade fightstick based on brook pcb (with XInput driver??) - { MAKE_CONTROLLER_ID( 0x046d, 0x1000 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x1345, 0x6006 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller - - { MAKE_CONTROLLER_ID( 0x056e, 0x2012 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x146b, 0x0602 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x0f0d, 0x00ae ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x046d, 0x0401 ), k_eControllerType_XBox360Controller, NULL }, // logitech xinput - { MAKE_CONTROLLER_ID( 0x046d, 0x0301 ), k_eControllerType_XBox360Controller, NULL }, // logitech xinput - { MAKE_CONTROLLER_ID( 0x046d, 0xcaa3 ), k_eControllerType_XBox360Controller, NULL }, // logitech xinput - { MAKE_CONTROLLER_ID( 0x046d, 0xc261 ), k_eControllerType_XBox360Controller, NULL }, // logitech xinput - { MAKE_CONTROLLER_ID( 0x046d, 0x0291 ), k_eControllerType_XBox360Controller, NULL }, // logitech xinput - { MAKE_CONTROLLER_ID( 0x0079, 0x18d3 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x0f0d, 0x00b1 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x0001, 0x0001 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x0079, 0x188e ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x0079, 0x187c ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x0079, 0x189c ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x0079, 0x1874 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller - - { MAKE_CONTROLLER_ID( 0x2f24, 0x0050 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x2f24, 0x2e ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x9886, 0x24 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x2f24, 0x91 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x1430, 0x719 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0xf0d, 0xed ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0xf0d, 0xc0 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0xe6f, 0x152 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0xe6f, 0x2a7 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x46d, 0x1007 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0xe6f, 0x2b8 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0xe6f, 0x2a8 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x2c22, 0x2503 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x79, 0x18a1 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - - /* Added from Minidumps 10-9-19 */ - { MAKE_CONTROLLER_ID( 0x0, 0x6686 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x11ff, 0x511 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x12ab, 0x304 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x1430, 0x291 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x1430, 0x2a9 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x1430, 0x70b ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x146b, 0x604 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x146b, 0x605 ), k_eControllerType_XBoxOneController, NULL }, // NACON PS4 controller in Xbox mode - might also be other bigben brand xbox controllers - { MAKE_CONTROLLER_ID( 0x146b, 0x606 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x146b, 0x609 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x1bad, 0x28e ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x1bad, 0x2a0 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x1bad, 0x5500 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x20ab, 0x55ef ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x24c6, 0x5509 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x2516, 0x69 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x25b1, 0x360 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x2c22, 0x2203 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x2f24, 0x11 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x2f24, 0x53 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x2f24, 0xb7 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x46d, 0x0 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x46d, 0x1004 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x46d, 0x1008 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x46d, 0xf301 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x738, 0x2a0 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x738, 0x7263 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x738, 0xb738 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x738, 0xcb29 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x738, 0xf401 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x79, 0x18c2 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x79, 0x18c8 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x79, 0x18cf ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0xc12, 0xe17 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0xc12, 0xe1c ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0xc12, 0xe22 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0xc12, 0xe30 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0xd2d2, 0xd2d2 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0xd62, 0x9a1a ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0xd62, 0x9a1b ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0xe00, 0xe00 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0xe6f, 0x12a ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0xe6f, 0x2a1 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0xe6f, 0x2a2 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0xe6f, 0x2a5 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0xe6f, 0x2b2 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0xe6f, 0x2bd ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0xe6f, 0x2bf ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0xe6f, 0x2c0 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0xe6f, 0x2c6 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0xf0d, 0x97 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0xf0d, 0xba ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0xf0d, 0xd8 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0xfff, 0x2a1 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x45e, 0x867 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - // Added 12-17-2020 - { MAKE_CONTROLLER_ID( 0x16d0, 0xf3f ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0x2f24, 0x8f ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - { MAKE_CONTROLLER_ID( 0xe6f, 0xf501 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller - - //{ MAKE_CONTROLLER_ID( 0x1949, 0x0402 ), /*android*/, NULL }, // Unknown Controller - - { MAKE_CONTROLLER_ID( 0x05ac, 0x0001 ), k_eControllerType_AppleController, NULL }, // MFI Extended Gamepad (generic entry for iOS/tvOS) - { MAKE_CONTROLLER_ID( 0x05ac, 0x0002 ), k_eControllerType_AppleController, NULL }, // MFI Standard Gamepad (generic entry for iOS/tvOS) - - // We now support Joy-Cons if SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS is set to "1", but they won't be combined into one controller. - { MAKE_CONTROLLER_ID( 0x057e, 0x2006 ), k_eControllerType_SwitchJoyConLeft, NULL }, // Nintendo Switch Joy-Con (Left) - { MAKE_CONTROLLER_ID( 0x057e, 0x2007 ), k_eControllerType_SwitchJoyConRight, NULL }, // Nintendo Switch Joy-Con (Right) - - // This same controller ID is spoofed by many 3rd-party Switch controllers. - // The ones we currently know of are: - // * Any 8bitdo controller with Switch support - // * ORTZ Gaming Wireless Pro Controller - // * ZhiXu Gamepad Wireless - // * Sunwaytek Wireless Motion Controller for Nintendo Switch - { MAKE_CONTROLLER_ID( 0x057e, 0x2009 ), k_eControllerType_SwitchProController, NULL }, // Nintendo Switch Pro Controller - - { MAKE_CONTROLLER_ID( 0x0f0d, 0x00c1 ), k_eControllerType_SwitchInputOnlyController, NULL }, // HORIPAD for Nintendo Switch - { MAKE_CONTROLLER_ID( 0x0f0d, 0x0092 ), k_eControllerType_SwitchInputOnlyController, NULL }, // HORI Pokken Tournament DX Pro Pad - { MAKE_CONTROLLER_ID( 0x0f0d, 0x00f6 ), k_eControllerType_SwitchProController, NULL }, // HORI Wireless Switch Pad -#ifdef _WIN32 - { MAKE_CONTROLLER_ID( 0x0f0d, 0x00dc ), k_eControllerType_XInputSwitchController, NULL }, // HORI Fighting Commander - Is a Switch controller but shows up through XInput on Windows. -#else - { MAKE_CONTROLLER_ID( 0x0f0d, 0x00dc ), k_eControllerType_SwitchProController, "HORI Fighting Commander" }, -#endif - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0180 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PDP Faceoff Wired Pro Controller for Nintendo Switch - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0181 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PDP Faceoff Deluxe Wired Pro Controller for Nintendo Switch - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0184 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PDP Faceoff Wired Deluxe+ Audio Controller - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0185 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PDP Wired Fight Pad Pro for Nintendo Switch - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0186 ), k_eControllerType_SwitchProController, NULL }, // PDP Afterglow Wireless Switch Controller - working gyro. USB is for charging only. Many later "Wireless" line devices w/ gyro also use this vid/pid - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0187 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PDP Rockcandy Wired Controller - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0188 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PDP Afterglow Wired Deluxe+ Audio Controller - { MAKE_CONTROLLER_ID( 0x0f0d, 0x00aa ), k_eControllerType_SwitchInputOnlyController, NULL }, // HORI Real Arcade Pro V Hayabusa in Switch Mode - { MAKE_CONTROLLER_ID( 0x20d6, 0xa711 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PowerA Wired Controller Plus/PowerA Wired Controller Nintendo GameCube Style - { MAKE_CONTROLLER_ID( 0x20d6, 0xa712 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PowerA Nintendo Switch Fusion Fight Pad - { MAKE_CONTROLLER_ID( 0x20d6, 0xa713 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PowerA Super Mario Controller - { MAKE_CONTROLLER_ID( 0x20d6, 0xa714 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PowerA Nintendo Switch Spectra Controller - { MAKE_CONTROLLER_ID( 0x20d6, 0xa715 ), k_eControllerType_SwitchInputOnlyController, NULL }, // Power A Fusion Wireless Arcade Stick (USB Mode) Over BT is shows up as 057e 2009 - { MAKE_CONTROLLER_ID( 0x20d6, 0xa716 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PowerA Nintendo Switch Fusion Pro Controller - USB requires toggling switch on back of device - - // Valve products - { MAKE_CONTROLLER_ID( 0x0000, 0x11fb ), k_eControllerType_MobileTouch, NULL }, // Streaming mobile touch virtual controls - { MAKE_CONTROLLER_ID( 0x28de, 0x1101 ), k_eControllerType_SteamController, NULL }, // Valve Legacy Steam Controller (CHELL) - { MAKE_CONTROLLER_ID( 0x28de, 0x1102 ), k_eControllerType_SteamController, NULL }, // Valve wired Steam Controller (D0G) - { MAKE_CONTROLLER_ID( 0x28de, 0x1105 ), k_eControllerType_SteamController, NULL }, // Valve Bluetooth Steam Controller (D0G) - { MAKE_CONTROLLER_ID( 0x28de, 0x1106 ), k_eControllerType_SteamController, NULL }, // Valve Bluetooth Steam Controller (D0G) - { MAKE_CONTROLLER_ID( 0x28de, 0x1142 ), k_eControllerType_SteamController, NULL }, // Valve wireless Steam Controller - { MAKE_CONTROLLER_ID( 0x28de, 0x1201 ), k_eControllerType_SteamControllerV2, NULL }, // Valve wired Steam Controller (HEADCRAB) - { MAKE_CONTROLLER_ID( 0x28de, 0x1202 ), k_eControllerType_SteamControllerV2, NULL }, // Valve Bluetooth Steam Controller (HEADCRAB) -}; - -static SDL_INLINE const char *GetControllerTypeOverride( int nVID, int nPID ) -{ - const char *hint = SDL_GetHint(SDL_HINT_GAMECONTROLLERTYPE); - if (hint) { - char key[32]; - const char *spot = NULL; - - SDL_snprintf(key, sizeof(key), "0x%.4x/0x%.4x=", nVID, nPID); - spot = SDL_strstr(hint, key); - if (!spot) { - SDL_snprintf(key, sizeof(key), "0x%.4X/0x%.4X=", nVID, nPID); - spot = SDL_strstr(hint, key); - } - if (spot) { - spot += SDL_strlen(key); - if (SDL_strncmp(spot, "k_eControllerType_", 18) == 0) { - spot += 18; - } - return spot; - } - } - return NULL; -} - -static SDL_INLINE EControllerType GuessControllerType( int nVID, int nPID ) -{ -#if 0//def _DEBUG - // Verify that there are no duplicates in the controller list - // If the list were sorted, we could do this much more efficiently, as well as improve lookup speed. - static bool s_bCheckedForDuplicates; - if ( !s_bCheckedForDuplicates ) - { - s_bCheckedForDuplicates = true; - int i, j; - for ( i = 0; i < sizeof( arrControllers ) / sizeof( arrControllers[ 0 ] ); ++i ) - { - for ( j = i + 1; j < sizeof( arrControllers ) / sizeof( arrControllers[ 0 ] ); ++j ) - { - if ( arrControllers[ i ].m_unDeviceID == arrControllers[ j ].m_unDeviceID ) - { - Log( "Duplicate controller entry found for VID 0x%.4x PID 0x%.4x\n", ( arrControllers[ i ].m_unDeviceID >> 16 ), arrControllers[ i ].m_unDeviceID & 0xFFFF ); - } - } - } - } -#endif // _DEBUG - - unsigned int unDeviceID = MAKE_CONTROLLER_ID( nVID, nPID ); - int iIndex; - - const char *pszOverride = GetControllerTypeOverride( nVID, nPID ); - if ( pszOverride ) - { - if ( SDL_strncasecmp( pszOverride, "Xbox360", 7 ) == 0 ) - { - return k_eControllerType_XBox360Controller; - } - if ( SDL_strncasecmp( pszOverride, "XboxOne", 7 ) == 0 ) - { - return k_eControllerType_XBoxOneController; - } - if ( SDL_strncasecmp( pszOverride, "PS3", 3 ) == 0 ) - { - return k_eControllerType_PS3Controller; - } - if ( SDL_strncasecmp( pszOverride, "PS4", 3 ) == 0 ) - { - return k_eControllerType_PS4Controller; - } - if ( SDL_strncasecmp( pszOverride, "PS5", 3 ) == 0 ) - { - return k_eControllerType_PS5Controller; - } - if ( SDL_strncasecmp( pszOverride, "SwitchPro", 9 ) == 0 ) - { - return k_eControllerType_SwitchProController; - } - if ( SDL_strncasecmp( pszOverride, "Steam", 5 ) == 0 ) - { - return k_eControllerType_SteamController; - } - return k_eControllerType_UnknownNonSteamController; - } - - for ( iIndex = 0; iIndex < sizeof( arrControllers ) / sizeof( arrControllers[0] ); ++iIndex ) - { - if ( unDeviceID == arrControllers[ iIndex ].m_unDeviceID ) - { - return arrControllers[ iIndex ].m_eControllerType; - } - } - - return k_eControllerType_UnknownNonSteamController; - -} - -static SDL_INLINE const char *GuessControllerName( int nVID, int nPID ) -{ - unsigned int unDeviceID = MAKE_CONTROLLER_ID( nVID, nPID ); - int iIndex; - for ( iIndex = 0; iIndex < sizeof( arrControllers ) / sizeof( arrControllers[0] ); ++iIndex ) - { - if ( unDeviceID == arrControllers[ iIndex ].m_unDeviceID ) - { - return arrControllers[ iIndex ].m_pszName; - } - } - - return NULL; - -} - -#undef MAKE_CONTROLLER_ID - -static SDL_INLINE int GetDefaultDeadzoneSizeForControllerType( EControllerType eControllerType ) -{ - switch ( eControllerType ) - { - case k_eControllerType_UnknownNonSteamController: - case k_eControllerType_XBoxOneController: - case k_eControllerType_XBox360Controller: - case k_eControllerType_AppleController: - case k_eControllerType_AndroidController: - case k_eControllerType_PS3Controller: - case k_eControllerType_PS5Controller: - return 10000; - case k_eControllerType_SteamControllerV2: - return 8192; - case k_eControllerType_PS4Controller: - return 4096; - case k_eControllerType_SwitchJoyConLeft: - case k_eControllerType_SwitchJoyConRight: - case k_eControllerType_SwitchJoyConPair: - return 8192; // Actual dead-zone should be 15% of full-scale, but we use this to account for variances in 3rd-party controllers - case k_eControllerType_SwitchProController: - return 8192; // Actual dead-zone should be closer to 10% of full-scale, but we use this to account for variances in 3rd-party controllers - default: - return 8192; - } -} - -#endif // CONSTANTS_H +#endif // CONTROLLER_TYPE_H +/* vi: set ts=4 sw=4 noexpandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/joystick/darwin/SDL_iokitjoystick.c libsdl2-2.24.0+dfsg/src/joystick/darwin/SDL_iokitjoystick.c --- libsdl2-2.0.22+dfsg/src/joystick/darwin/SDL_iokitjoystick.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/darwin/SDL_iokitjoystick.c 2022-08-13 03:48:10.000000000 +0000 @@ -744,7 +744,6 @@ } } -/* Function to get the device-dependent name of a joystick */ const char * DARWIN_JoystickGetDeviceName(int device_index) { @@ -752,6 +751,12 @@ return device ? device->product : "UNKNOWN"; } +const char * +DARWIN_JoystickGetDevicePath(int device_index) +{ + return NULL; +} + static int DARWIN_JoystickGetDevicePlayerIndex(int device_index) { @@ -980,7 +985,7 @@ recDevice *device = joystick->hwdata; recElement *element; SInt32 value, range; - int i; + int i, goodRead = SDL_FALSE; if (!device) { return; @@ -996,7 +1001,6 @@ element = device->firstAxis; i = 0; - int goodRead = SDL_FALSE; while (element) { goodRead = GetHIDScaledCalibratedState(device, element, -32768, 32767, &value); if (goodRead) { @@ -1115,6 +1119,7 @@ DARWIN_JoystickGetCount, DARWIN_JoystickDetect, DARWIN_JoystickGetDeviceName, + DARWIN_JoystickGetDevicePath, DARWIN_JoystickGetDevicePlayerIndex, DARWIN_JoystickSetDevicePlayerIndex, DARWIN_JoystickGetDeviceGUID, diff -Nru libsdl2-2.0.22+dfsg/src/joystick/dummy/SDL_sysjoystick.c libsdl2-2.24.0+dfsg/src/joystick/dummy/SDL_sysjoystick.c --- libsdl2-2.0.22+dfsg/src/joystick/dummy/SDL_sysjoystick.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/dummy/SDL_sysjoystick.c 2022-06-02 02:01:57.000000000 +0000 @@ -52,6 +52,12 @@ return NULL; } +static const char * +DUMMY_JoystickGetDevicePath(int device_index) +{ + return NULL; +} + static int DUMMY_JoystickGetDevicePlayerIndex(int device_index) { @@ -146,6 +152,7 @@ DUMMY_JoystickGetCount, DUMMY_JoystickDetect, DUMMY_JoystickGetDeviceName, + DUMMY_JoystickGetDevicePath, DUMMY_JoystickGetDevicePlayerIndex, DUMMY_JoystickSetDevicePlayerIndex, DUMMY_JoystickGetDeviceGUID, diff -Nru libsdl2-2.0.22+dfsg/src/joystick/emscripten/SDL_sysjoystick.c libsdl2-2.24.0+dfsg/src/joystick/emscripten/SDL_sysjoystick.c --- libsdl2-2.0.22+dfsg/src/joystick/emscripten/SDL_sysjoystick.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/emscripten/SDL_sysjoystick.c 2022-06-02 02:01:57.000000000 +0000 @@ -280,6 +280,12 @@ return JoystickByDeviceIndex(device_index)->name; } +static const char * +EMSCRIPTEN_JoystickGetDevicePath(int device_index) +{ + return NULL; +} + static int EMSCRIPTEN_JoystickGetDevicePlayerIndex(int device_index) { @@ -444,6 +450,7 @@ EMSCRIPTEN_JoystickGetCount, EMSCRIPTEN_JoystickDetect, EMSCRIPTEN_JoystickGetDeviceName, + EMSCRIPTEN_JoystickGetDevicePath, EMSCRIPTEN_JoystickGetDevicePlayerIndex, EMSCRIPTEN_JoystickSetDevicePlayerIndex, EMSCRIPTEN_JoystickGetDeviceGUID, diff -Nru libsdl2-2.0.22+dfsg/src/joystick/haiku/SDL_haikujoystick.cc libsdl2-2.24.0+dfsg/src/joystick/haiku/SDL_haikujoystick.cc --- libsdl2-2.0.22+dfsg/src/joystick/haiku/SDL_haikujoystick.cc 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/haiku/SDL_haikujoystick.cc 2022-06-02 02:01:57.000000000 +0000 @@ -64,15 +64,15 @@ char name[B_OS_NAME_LENGTH]; /* Search for attached joysticks */ - nports = joystick.CountDevices(); - numjoysticks = 0; - SDL_memset(SDL_joyport, 0, (sizeof SDL_joyport)); - SDL_memset(SDL_joyname, 0, (sizeof SDL_joyname)); + nports = joystick.CountDevices(); + numjoysticks = 0; + SDL_memset(SDL_joyport, 0, (sizeof SDL_joyport)); + SDL_memset(SDL_joyname, 0, (sizeof SDL_joyname)); for (i = 0; (numjoysticks < MAX_JOYSTICKS) && (i < nports); ++i) { if (joystick.GetDeviceName(i, name) == B_OK) { if (joystick.Open(name) != B_ERROR) { - BString stick_name; + BString stick_name; joystick.GetControllerName(&stick_name); SDL_joyport[numjoysticks] = SDL_strdup(name); SDL_joyname[numjoysticks] = SDL_CreateJoystickName(0, 0, NULL, stick_name.String()); @@ -93,12 +93,16 @@ { } -/* Function to get the device-dependent name of a joystick */ static const char *HAIKU_JoystickGetDeviceName(int device_index) { return SDL_joyname[device_index]; } + static const char *HAIKU_JoystickGetDevicePath(int device_index) + { + return SDL_joyport[device_index]; + } + static int HAIKU_JoystickGetDevicePlayerIndex(int device_index) { return -1; @@ -298,6 +302,7 @@ HAIKU_JoystickGetCount, HAIKU_JoystickDetect, HAIKU_JoystickGetDeviceName, + HAIKU_JoystickGetDevicePath, HAIKU_JoystickGetDevicePlayerIndex, HAIKU_JoystickSetDevicePlayerIndex, HAIKU_JoystickGetDeviceGUID, diff -Nru libsdl2-2.0.22+dfsg/src/joystick/hidapi/SDL_hidapi_combined.c libsdl2-2.24.0+dfsg/src/joystick/hidapi/SDL_hidapi_combined.c --- libsdl2-2.0.22+dfsg/src/joystick/hidapi/SDL_hidapi_combined.c 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/hidapi/SDL_hidapi_combined.c 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,244 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +/* This driver supports the Nintendo Switch Joy-Cons pair controllers */ +#include "../../SDL_internal.h" + +#ifdef SDL_JOYSTICK_HIDAPI + +#include "SDL_hints.h" +#include "SDL_joystick.h" +#include "SDL_gamecontroller.h" +#include "SDL_hidapijoystick_c.h" +#include "../SDL_sysjoystick.h" + +static SDL_bool +HIDAPI_DriverCombined_IsSupportedDevice(const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol) +{ + /* This is always explicitly created for combined devices */ + return SDL_FALSE; +} + +static const char * +HIDAPI_DriverCombined_GetDeviceName(const char *name, Uint16 vendor_id, Uint16 product_id) +{ + return NULL; +} + +static SDL_bool +HIDAPI_DriverCombined_InitDevice(SDL_HIDAPI_Device *device) +{ + return HIDAPI_JoystickConnected(device, NULL); +} + +static int +HIDAPI_DriverCombined_GetDevicePlayerIndex(SDL_HIDAPI_Device *device, SDL_JoystickID instance_id) +{ + return -1; +} + +static void +HIDAPI_DriverCombined_SetDevicePlayerIndex(SDL_HIDAPI_Device *device, SDL_JoystickID instance_id, int player_index) +{ +} + +static SDL_bool +HIDAPI_DriverCombined_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joystick) +{ + int i; + char *serial = NULL, *new_serial; + size_t serial_length = 0, new_length; + + for (i = 0; i < device->num_children; ++i) { + SDL_HIDAPI_Device *child = device->children[i]; + if (!child->driver->OpenJoystick(child, joystick)) { + while (i-- > 0) { + child = device->children[i]; + child->driver->CloseJoystick(child, joystick); + } + if (serial) { + SDL_free(serial); + } + return SDL_FALSE; + } + + /* Extend the serial number with the child serial number */ + if (joystick->serial) { + new_length = serial_length + 1 + SDL_strlen(joystick->serial); + new_serial = (char *)SDL_realloc(serial, new_length); + if (new_serial) { + if (serial) { + SDL_strlcat(new_serial, ",", new_length); + SDL_strlcat(new_serial, joystick->serial, new_length); + } else { + SDL_strlcpy(new_serial, joystick->serial, new_length); + } + serial = new_serial; + serial_length = new_length; + } + SDL_free(joystick->serial); + joystick->serial = NULL; + } + } + + /* Update the joystick with the combined serial numbers */ + if (joystick->serial) { + SDL_free(joystick->serial); + } + joystick->serial = serial; + + return SDL_TRUE; +} + +static int +HIDAPI_DriverCombined_RumbleJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble) +{ + int i; + int result = -1; + + for (i = 0; i < device->num_children; ++i) { + SDL_HIDAPI_Device *child = device->children[i]; + if (child->driver->RumbleJoystick(child, joystick, low_frequency_rumble, high_frequency_rumble) == 0) { + result = 0; + } + } + return result; +} + +static int +HIDAPI_DriverCombined_RumbleJoystickTriggers(SDL_HIDAPI_Device *device, SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble) +{ + int i; + int result = -1; + + for (i = 0; i < device->num_children; ++i) { + SDL_HIDAPI_Device *child = device->children[i]; + if (child->driver->RumbleJoystickTriggers(child, joystick, left_rumble, right_rumble) == 0) { + result = 0; + } + } + return result; +} + +static Uint32 +HIDAPI_DriverCombined_GetJoystickCapabilities(SDL_HIDAPI_Device *device, SDL_Joystick *joystick) +{ + int i; + Uint32 caps = 0; + + for (i = 0; i < device->num_children; ++i) { + SDL_HIDAPI_Device *child = device->children[i]; + caps |= child->driver->GetJoystickCapabilities(child, joystick); + } + return caps; +} + +static int +HIDAPI_DriverCombined_SetJoystickLED(SDL_HIDAPI_Device *device, SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue) +{ + int i; + int result = -1; + + for (i = 0; i < device->num_children; ++i) { + SDL_HIDAPI_Device *child = device->children[i]; + if (child->driver->SetJoystickLED(child, joystick, red, green, blue) == 0) { + result = 0; + } + } + return result; +} + +static int +HIDAPI_DriverCombined_SendJoystickEffect(SDL_HIDAPI_Device *device, SDL_Joystick *joystick, const void *data, int size) +{ + return SDL_Unsupported(); +} + +static int +HIDAPI_DriverCombined_SetJoystickSensorsEnabled(SDL_HIDAPI_Device *device, SDL_Joystick *joystick, SDL_bool enabled) +{ + int i; + int result = -1; + + for (i = 0; i < device->num_children; ++i) { + SDL_HIDAPI_Device *child = device->children[i]; + if (child->driver->SetJoystickSensorsEnabled(child, joystick, enabled) == 0) { + result = 0; + } + } + return result; +} + +static SDL_bool +HIDAPI_DriverCombined_UpdateDevice(SDL_HIDAPI_Device *device) +{ + int i; + int result = SDL_TRUE; + + for (i = 0; i < device->num_children; ++i) { + SDL_HIDAPI_Device *child = device->children[i]; + if (!child->driver->UpdateDevice(child)) { + result = SDL_FALSE; + } + } + return result; +} + +static void +HIDAPI_DriverCombined_CloseJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joystick) +{ + int i; + + for (i = 0; i < device->num_children; ++i) { + SDL_HIDAPI_Device *child = device->children[i]; + child->driver->CloseJoystick(child, joystick); + } +} + +static void +HIDAPI_DriverCombined_FreeDevice(SDL_HIDAPI_Device *device) +{ +} + +SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverCombined = +{ + SDL_HINT_JOYSTICK_HIDAPI, + SDL_TRUE, + SDL_TRUE, + HIDAPI_DriverCombined_IsSupportedDevice, + HIDAPI_DriverCombined_GetDeviceName, + HIDAPI_DriverCombined_InitDevice, + HIDAPI_DriverCombined_GetDevicePlayerIndex, + HIDAPI_DriverCombined_SetDevicePlayerIndex, + HIDAPI_DriverCombined_UpdateDevice, + HIDAPI_DriverCombined_OpenJoystick, + HIDAPI_DriverCombined_RumbleJoystick, + HIDAPI_DriverCombined_RumbleJoystickTriggers, + HIDAPI_DriverCombined_GetJoystickCapabilities, + HIDAPI_DriverCombined_SetJoystickLED, + HIDAPI_DriverCombined_SendJoystickEffect, + HIDAPI_DriverCombined_SetJoystickSensorsEnabled, + HIDAPI_DriverCombined_CloseJoystick, + HIDAPI_DriverCombined_FreeDevice, +}; + +#endif /* SDL_JOYSTICK_HIDAPI */ + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/joystick/hidapi/SDL_hidapi_gamecube.c libsdl2-2.24.0+dfsg/src/joystick/hidapi/SDL_hidapi_gamecube.c --- libsdl2-2.0.22+dfsg/src/joystick/hidapi/SDL_hidapi_gamecube.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/hidapi/SDL_hidapi_gamecube.c 2022-06-16 20:16:31.000000000 +0000 @@ -71,7 +71,7 @@ } static const char * -HIDAPI_DriverGameCube_GetDeviceName(Uint16 vendor_id, Uint16 product_id) +HIDAPI_DriverGameCube_GetDeviceName(const char *name, Uint16 vendor_id, Uint16 product_id) { return "Nintendo GameCube Controller"; } diff -Nru libsdl2-2.0.22+dfsg/src/joystick/hidapi/SDL_hidapijoystick.c libsdl2-2.24.0+dfsg/src/joystick/hidapi/SDL_hidapijoystick.c --- libsdl2-2.0.22+dfsg/src/joystick/hidapi/SDL_hidapijoystick.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/hidapi/SDL_hidapijoystick.c 2022-08-19 15:46:21.000000000 +0000 @@ -32,7 +32,7 @@ #include "SDL_hidapi_rumble.h" #include "../../SDL_hints_c.h" -#if defined(__WIN32__) +#if defined(__WIN32__) || defined(__WINGDK__) #include "../windows/SDL_rawinputjoystick_c.h" #endif @@ -49,6 +49,9 @@ #ifdef SDL_JOYSTICK_HIDAPI_LUNA &SDL_HIDAPI_DriverLuna, #endif +#ifdef SDL_JOYSTICK_HIDAPI_SHIELD + &SDL_HIDAPI_DriverShield, +#endif #ifdef SDL_JOYSTICK_HIDAPI_PS4 &SDL_HIDAPI_DriverPS4, #endif @@ -62,6 +65,8 @@ &SDL_HIDAPI_DriverSteam, #endif #ifdef SDL_JOYSTICK_HIDAPI_SWITCH + &SDL_HIDAPI_DriverNintendoClassic, + &SDL_HIDAPI_DriverJoyCons, &SDL_HIDAPI_DriverSwitch, #endif #ifdef SDL_JOYSTICK_HIDAPI_XBOX360 @@ -77,6 +82,7 @@ static Uint32 SDL_HIDAPI_change_count = 0; static SDL_HIDAPI_Device *SDL_HIDAPI_devices; static int SDL_HIDAPI_numjoysticks = 0; +static SDL_bool SDL_HIDAPI_combine_joycons = SDL_TRUE; static SDL_bool initialized = SDL_FALSE; static SDL_bool shutting_down = SDL_FALSE; @@ -110,11 +116,97 @@ static void HIDAPI_JoystickDetect(void); static void HIDAPI_JoystickClose(SDL_Joystick *joystick); +static SDL_GameControllerType +SDL_GetJoystickGameControllerProtocol(const char *name, Uint16 vendor, Uint16 product, int interface_number, int interface_class, int interface_subclass, int interface_protocol) +{ + static const int LIBUSB_CLASS_VENDOR_SPEC = 0xFF; + static const int XB360_IFACE_SUBCLASS = 93; + static const int XB360_IFACE_PROTOCOL = 1; /* Wired */ + static const int XB360W_IFACE_PROTOCOL = 129; /* Wireless */ + static const int XBONE_IFACE_SUBCLASS = 71; + static const int XBONE_IFACE_PROTOCOL = 208; + + SDL_GameControllerType type = SDL_CONTROLLER_TYPE_UNKNOWN; + + /* This code should match the checks in libusb/hid.c and HIDDeviceManager.java */ + if (interface_class == LIBUSB_CLASS_VENDOR_SPEC && + interface_subclass == XB360_IFACE_SUBCLASS && + (interface_protocol == XB360_IFACE_PROTOCOL || + interface_protocol == XB360W_IFACE_PROTOCOL)) { + + static const int SUPPORTED_VENDORS[] = { + 0x0079, /* GPD Win 2 */ + 0x044f, /* Thrustmaster */ + 0x045e, /* Microsoft */ + 0x046d, /* Logitech */ + 0x056e, /* Elecom */ + 0x06a3, /* Saitek */ + 0x0738, /* Mad Catz */ + 0x07ff, /* Mad Catz */ + 0x0e6f, /* PDP */ + 0x0f0d, /* Hori */ + 0x1038, /* SteelSeries */ + 0x11c9, /* Nacon */ + 0x12ab, /* Unknown */ + 0x1430, /* RedOctane */ + 0x146b, /* BigBen */ + 0x1532, /* Razer */ + 0x15e4, /* Numark */ + 0x162e, /* Joytech */ + 0x1689, /* Razer Onza */ + 0x1949, /* Lab126, Inc. */ + 0x1bad, /* Harmonix */ + 0x20d6, /* PowerA */ + 0x24c6, /* PowerA */ + 0x2c22, /* Qanba */ + }; + + int i; + for (i = 0; i < SDL_arraysize(SUPPORTED_VENDORS); ++i) { + if (vendor == SUPPORTED_VENDORS[i]) { + type = SDL_CONTROLLER_TYPE_XBOX360; + break; + } + } + } + + if (interface_number == 0 && + interface_class == LIBUSB_CLASS_VENDOR_SPEC && + interface_subclass == XBONE_IFACE_SUBCLASS && + interface_protocol == XBONE_IFACE_PROTOCOL) { + + static const int SUPPORTED_VENDORS[] = { + 0x045e, /* Microsoft */ + 0x0738, /* Mad Catz */ + 0x0e6f, /* PDP */ + 0x0f0d, /* Hori */ + 0x1532, /* Razer */ + 0x20d6, /* PowerA */ + 0x24c6, /* PowerA */ + 0x2dc8, /* 8BitDo */ + 0x2e24, /* Hyperkin */ + }; + + int i; + for (i = 0; i < SDL_arraysize(SUPPORTED_VENDORS); ++i) { + if (vendor == SUPPORTED_VENDORS[i]) { + type = SDL_CONTROLLER_TYPE_XBOXONE; + break; + } + } + } + + if (type == SDL_CONTROLLER_TYPE_UNKNOWN) { + type = SDL_GetJoystickGameControllerTypeFromVIDPID(vendor, product, name, SDL_FALSE); + } + return type; +} + static SDL_bool HIDAPI_IsDeviceSupported(Uint16 vendor_id, Uint16 product_id, Uint16 version, const char *name) { int i; - SDL_GameControllerType type = SDL_GetJoystickGameControllerType(name, vendor_id, product_id, -1, 0, 0, 0); + SDL_GameControllerType type = SDL_GetJoystickGameControllerProtocol(name, vendor_id, product_id, -1, 0, 0, 0); for (i = 0; i < SDL_arraysize(SDL_HIDAPI_drivers); ++i) { SDL_HIDAPI_DeviceDriver *driver = SDL_HIDAPI_drivers[i]; @@ -134,14 +226,12 @@ const Uint16 USAGE_MULTIAXISCONTROLLER = 0x0008; int i; SDL_GameControllerType type; - SDL_JoystickGUID check_guid; - /* Make sure we have a generic GUID here, otherwise if we pass a HIDAPI - guid, this call will create a game controller mapping for the device. - */ - check_guid = device->guid; - check_guid.data[14] = 0; - if (SDL_ShouldIgnoreJoystick(device->name, check_guid)) { + if (device->num_children > 0) { + return &SDL_HIDAPI_DriverCombined; + } + + if (SDL_ShouldIgnoreJoystick(device->name, device->guid)) { return NULL; } @@ -154,7 +244,7 @@ } } - type = SDL_GetJoystickGameControllerType(device->name, device->vendor_id, device->product_id, device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol); + type = SDL_GetJoystickGameControllerProtocol(device->name, device->vendor_id, device->product_id, device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol); for (i = 0; i < SDL_arraysize(SDL_HIDAPI_drivers); ++i) { SDL_HIDAPI_DeviceDriver *driver = SDL_HIDAPI_drivers[i]; if (driver->enabled && driver->IsSupportedDevice(device->name, type, device->vendor_id, device->product_id, device->version, device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol)) { @@ -167,8 +257,12 @@ static SDL_HIDAPI_Device * HIDAPI_GetDeviceByIndex(int device_index, SDL_JoystickID *pJoystickID) { - SDL_HIDAPI_Device *device = SDL_HIDAPI_devices; - while (device) { + SDL_HIDAPI_Device *device; + + for (device = SDL_HIDAPI_devices; device; device = device->next) { + if (device->parent) { + continue; + } if (device->driver) { if (device_index < device->num_joysticks) { if (pJoystickID) { @@ -178,7 +272,6 @@ } device_index -= device->num_joysticks; } - device = device->next; } return NULL; } @@ -186,28 +279,65 @@ static SDL_HIDAPI_Device * HIDAPI_GetJoystickByInfo(const char *path, Uint16 vendor_id, Uint16 product_id) { - SDL_HIDAPI_Device *device = SDL_HIDAPI_devices; - while (device) { + SDL_HIDAPI_Device *device; + + for (device = SDL_HIDAPI_devices; device; device = device->next) { if (device->vendor_id == vendor_id && device->product_id == product_id && SDL_strcmp(device->path, path) == 0) { break; } - device = device->next; } return device; } static void +HIDAPI_CleanupDeviceDriver(SDL_HIDAPI_Device *device) +{ + if (!device->driver) { + return; /* Already cleaned up */ + } + + /* Disconnect any joysticks */ + while (device->num_joysticks && device->joysticks) { + HIDAPI_JoystickDisconnected(device, device->joysticks[0]); + } + + device->driver->FreeDevice(device); + device->driver = NULL; +} + +static void HIDAPI_SetupDeviceDriver(SDL_HIDAPI_Device *device) { if (device->driver) { + SDL_bool enabled; + + if (device->vendor_id == USB_VENDOR_NINTENDO && device->product_id == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_PAIR) { + enabled = SDL_HIDAPI_combine_joycons; + } else { + enabled = device->driver->enabled; + } + if (device->children) { + int i; + + for (i = 0; i < device->num_children; ++i) { + SDL_HIDAPI_Device *child = device->children[i]; + if (!child->driver || !child->driver->enabled) { + enabled = SDL_FALSE; + break; + } + } + } + if (!enabled) { + HIDAPI_CleanupDeviceDriver(device); + } return; /* Already setup */ } device->driver = HIDAPI_GetDeviceDriver(device); if (device->driver) { - const char *name = device->driver->GetDeviceName(device->vendor_id, device->product_id); - if (name) { + const char *name = device->driver->GetDeviceName(device->name, device->vendor_id, device->product_id); + if (name && name != device->name) { SDL_free(device->name); device->name = SDL_strdup(name); } @@ -219,22 +349,6 @@ } } -static void -HIDAPI_CleanupDeviceDriver(SDL_HIDAPI_Device *device) -{ - if (!device->driver) { - return; /* Already cleaned up */ - } - - /* Disconnect any joysticks */ - while (device->num_joysticks && device->joysticks) { - HIDAPI_JoystickDisconnected(device, device->joysticks[0]); - } - - device->driver->FreeDevice(device); - device->driver = NULL; -} - static void SDLCALL SDL_HIDAPIDriverHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint) { @@ -247,6 +361,8 @@ SDL_HIDAPI_DeviceDriver *driver = SDL_HIDAPI_drivers[i]; driver->enabled = SDL_GetHintBoolean(driver->hint, enabled); } + } else if (SDL_strcmp(name, SDL_HINT_JOYSTICK_HIDAPI_COMBINE_JOY_CONS) == 0) { + SDL_HIDAPI_combine_joycons = enabled; } else { for (i = 0; i < SDL_arraysize(SDL_HIDAPI_drivers); ++i) { SDL_HIDAPI_DeviceDriver *driver = SDL_HIDAPI_drivers[i]; @@ -268,12 +384,12 @@ SDL_LockJoysticks(); for (device = SDL_HIDAPI_devices; device; device = device->next) { - if (device->driver && !device->driver->enabled) { - HIDAPI_CleanupDeviceDriver(device); - } HIDAPI_SetupDeviceDriver(device); } + /* Update the device list again to pick up any new devices */ + SDL_HIDAPI_change_count = 0; + SDL_UnlockJoysticks(); } @@ -316,6 +432,8 @@ SDL_HIDAPI_DeviceDriver *driver = SDL_HIDAPI_drivers[i]; SDL_AddHintCallback(driver->hint, SDL_HIDAPIDriverHintChanged, NULL); } + SDL_AddHintCallback(SDL_HINT_JOYSTICK_HIDAPI_COMBINE_JOY_CONS, + SDL_HIDAPIDriverHintChanged, NULL); SDL_AddHintCallback(SDL_HINT_JOYSTICK_HIDAPI, SDL_HIDAPIDriverHintChanged, NULL); HIDAPI_JoystickDetect(); @@ -326,18 +444,70 @@ return 0; } -SDL_bool -HIDAPI_JoystickConnected(SDL_HIDAPI_Device *device, SDL_JoystickID *pJoystickID) +static SDL_bool +HIDAPI_AddJoystickInstanceToDevice(SDL_HIDAPI_Device *device, SDL_JoystickID joystickID) { - SDL_JoystickID joystickID; SDL_JoystickID *joysticks = (SDL_JoystickID *)SDL_realloc(device->joysticks, (device->num_joysticks + 1)*sizeof(*device->joysticks)); if (!joysticks) { return SDL_FALSE; } - joystickID = SDL_GetNextJoystickInstanceID(); device->joysticks = joysticks; device->joysticks[device->num_joysticks++] = joystickID; + return SDL_TRUE; +} + +static SDL_bool +HIDAPI_DelJoystickInstanceFromDevice(SDL_HIDAPI_Device *device, SDL_JoystickID joystickID) +{ + int i, size; + + for (i = 0; i < device->num_joysticks; ++i) { + if (device->joysticks[i] == joystickID) { + size = (device->num_joysticks - i - 1) * sizeof(SDL_JoystickID); + SDL_memmove(&device->joysticks[i], &device->joysticks[i+1], size); + --device->num_joysticks; + if (device->num_joysticks == 0) { + SDL_free(device->joysticks); + device->joysticks = NULL; + } + return SDL_TRUE; + } + } + return SDL_FALSE; +} + +static SDL_bool +HIDAPI_JoystickInstanceIsUnique(SDL_HIDAPI_Device *device, SDL_JoystickID joystickID) +{ + if (device->parent && device->num_joysticks == 1 && device->parent->num_joysticks == 1 && + device->joysticks[0] == device->parent->joysticks[0]) { + return SDL_FALSE; + } + return SDL_TRUE; +} + +SDL_bool +HIDAPI_JoystickConnected(SDL_HIDAPI_Device *device, SDL_JoystickID *pJoystickID) +{ + int i, j; + SDL_JoystickID joystickID; + + for (i = 0; i < device->num_children; ++i) { + SDL_HIDAPI_Device *child = device->children[i]; + for (j = child->num_joysticks; j--; ) { + HIDAPI_JoystickDisconnected(child, child->joysticks[j]); + } + } + + joystickID = SDL_GetNextJoystickInstanceID(); + HIDAPI_AddJoystickInstanceToDevice(device, joystickID); + + for (i = 0; i < device->num_children; ++i) { + SDL_HIDAPI_Device *child = device->children[i]; + HIDAPI_AddJoystickInstanceToDevice(child, joystickID); + } + ++SDL_HIDAPI_numjoysticks; SDL_PrivateJoystickAdded(joystickID); @@ -351,7 +521,14 @@ void HIDAPI_JoystickDisconnected(SDL_HIDAPI_Device *device, SDL_JoystickID joystickID) { - int i, size; + int i, j; + + SDL_LockJoysticks(); + + if (!HIDAPI_JoystickInstanceIsUnique(device, joystickID)) { + /* Disconnecting a child always disconnects the parent */ + device = device->parent; + } for (i = 0; i < device->num_joysticks; ++i) { if (device->joysticks[i] == joystickID) { @@ -360,22 +537,25 @@ HIDAPI_JoystickClose(joystick); } - size = (device->num_joysticks - i - 1) * sizeof(SDL_JoystickID); - SDL_memmove(&device->joysticks[i], &device->joysticks[i+1], size); - --device->num_joysticks; + HIDAPI_DelJoystickInstanceFromDevice(device, joystickID); - --SDL_HIDAPI_numjoysticks; - if (device->num_joysticks == 0) { - SDL_free(device->joysticks); - device->joysticks = NULL; + for (j = 0; j < device->num_children; ++j) { + SDL_HIDAPI_Device *child = device->children[j]; + HIDAPI_DelJoystickInstanceFromDevice(child, joystickID); } + --SDL_HIDAPI_numjoysticks; + if (!shutting_down) { SDL_PrivateJoystickRemoved(joystickID); } - return; } } + + /* Rescan the device list in case device state has changed */ + SDL_HIDAPI_change_count = 0; + + SDL_UnlockJoysticks(); } static int @@ -405,8 +585,8 @@ return string; } -static void -HIDAPI_AddDevice(struct SDL_hid_device_info *info) +static SDL_HIDAPI_Device * +HIDAPI_AddDevice(const struct SDL_hid_device_info *info, int num_children, SDL_HIDAPI_Device **children) { SDL_HIDAPI_Device *device; SDL_HIDAPI_Device *curr, *last = NULL; @@ -417,12 +597,12 @@ device = (SDL_HIDAPI_Device *)SDL_calloc(1, sizeof(*device)); if (!device) { - return; + return NULL; } device->path = SDL_strdup(info->path); if (!device->path) { SDL_free(device); - return; + return NULL; } device->seen = SDL_TRUE; device->vendor_id = info->vendor_id; @@ -463,38 +643,6 @@ char *serial_number = HIDAPI_ConvertString(info->serial_number); device->name = SDL_CreateJoystickName(device->vendor_id, device->product_id, manufacturer_string, product_string); - if (SDL_strncmp(device->name, "0x", 2) == 0) { - /* Couldn't find a controller name, try to give it one based on device type */ - const char *name = NULL; - - switch (SDL_GetJoystickGameControllerType(NULL, device->vendor_id, device->product_id, device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol)) { - case SDL_CONTROLLER_TYPE_XBOX360: - name = "Xbox 360 Controller"; - break; - case SDL_CONTROLLER_TYPE_XBOXONE: - name = "Xbox One Controller"; - break; - case SDL_CONTROLLER_TYPE_PS3: - name = "PS3 Controller"; - break; - case SDL_CONTROLLER_TYPE_PS4: - name = "PS4 Controller"; - break; - case SDL_CONTROLLER_TYPE_PS5: - name = "PS5 Controller"; - break; - case SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO: - name = "Nintendo Switch Pro Controller"; - break; - default: - break; - } - - if (name) { - SDL_free(device->name); - device->name = SDL_strdup(name); - } - } if (manufacturer_string) { SDL_free(manufacturer_string); @@ -513,7 +661,17 @@ SDL_free(device->serial); SDL_free(device->path); SDL_free(device); - return; + return NULL; + } + } + + if (num_children > 0) { + int i; + + device->num_children = num_children; + device->children = children; + for (i = 0; i < num_children; ++i) { + children[i]->parent = device; } } @@ -529,6 +687,8 @@ #ifdef DEBUG_HIDAPI SDL_Log("Added HIDAPI device '%s' VID 0x%.4x, PID 0x%.4x, version %d, serial %s, interface %d, interface_class %d, interface_subclass %d, interface_protocol %d, usage page 0x%.4x, usage 0x%.4x, path = %s, driver = %s (%s)\n", device->name, device->vendor_id, device->product_id, device->version, device->serial ? device->serial : "NONE", device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol, device->usage_page, device->usage, device->path, device->driver ? device->driver->hint : "NONE", device->driver && device->driver->enabled ? "ENABLED" : "DISABLED"); #endif + + return device; } @@ -560,12 +720,78 @@ SDL_free(device->serial); SDL_free(device->name); SDL_free(device->path); + SDL_free(device->children); SDL_free(device); return; } } } +static SDL_bool +HIDAPI_CreateCombinedJoyCons() +{ + SDL_HIDAPI_Device *device, *combined; + SDL_HIDAPI_Device *joycons[2] = { NULL, NULL }; + + if (!SDL_HIDAPI_combine_joycons) { + return SDL_FALSE; + } + + for (device = SDL_HIDAPI_devices; device; device = device->next) { + if (!device->driver) { + /* Unsupported device */ + continue; + } + if (device->parent) { + /* This device is already part of a combined device */ + continue; + } + + if (!joycons[0] && + (SDL_IsJoystickNintendoSwitchJoyConLeft(device->vendor_id, device->product_id) || + (SDL_IsJoystickNintendoSwitchJoyConGrip(device->vendor_id, device->product_id) && + SDL_strstr(device->name, "(L)") != NULL))) { + joycons[0] = device; + } + if (!joycons[1] && + (SDL_IsJoystickNintendoSwitchJoyConRight(device->vendor_id, device->product_id) || + (SDL_IsJoystickNintendoSwitchJoyConGrip(device->vendor_id, device->product_id) && + SDL_strstr(device->name, "(R)") != NULL))) { + joycons[1] = device; + } + if (joycons[0] && joycons[1]) { + SDL_hid_device_info info; + SDL_HIDAPI_Device **children = (SDL_HIDAPI_Device **)SDL_malloc(2 * sizeof(SDL_HIDAPI_Device *)); + if (!children) { + return SDL_FALSE; + } + children[0] = joycons[0]; + children[1] = joycons[1]; + + SDL_zero(info); + info.path = "nintendo_joycons_combined"; + info.vendor_id = USB_VENDOR_NINTENDO; + info.product_id = USB_PRODUCT_NINTENDO_SWITCH_JOYCON_PAIR; + info.interface_number = -1; + info.usage_page = USB_USAGEPAGE_GENERIC_DESKTOP; + info.usage = USB_USAGE_GENERIC_GAMEPAD; + info.manufacturer_string = L"Nintendo"; + info.product_string = L"Switch Joy-Con (L/R)"; + + combined = HIDAPI_AddDevice(&info, 2, children); + if (combined && combined->driver) { + return SDL_TRUE; + } else { + if (!combined) { + SDL_free(children); + } + return SDL_FALSE; + } + } + } + return SDL_FALSE; +} + static void HIDAPI_UpdateDeviceList(void) { @@ -575,10 +801,11 @@ SDL_LockJoysticks(); /* Prepare the existing device list */ - device = SDL_HIDAPI_devices; - while (device) { + for (device = SDL_HIDAPI_devices; device; device = device->next) { + if (device->children) { + continue; + } device->seen = SDL_FALSE; - device = device->next; } /* Enumerate the devices */ @@ -590,7 +817,7 @@ if (device) { device->seen = SDL_TRUE; } else { - HIDAPI_AddDevice(info); + HIDAPI_AddDevice(info, 0, NULL); } } SDL_hid_free_enumeration(devs); @@ -598,17 +825,39 @@ } /* Remove any devices that weren't seen or have been disconnected due to read errors */ +check_removed: device = SDL_HIDAPI_devices; while (device) { SDL_HIDAPI_Device *next = device->next; if (!device->seen || - (device->driver && device->num_joysticks == 0 && !device->dev)) { - HIDAPI_DelDevice(device); + ((device->driver || device->children) && device->num_joysticks == 0 && !device->dev)) { + if (device->parent) { + /* When a child device goes away, so does the parent */ + int i; + device = device->parent; + for (i = 0; i < device->num_children; ++i) { + HIDAPI_DelDevice(device->children[i]); + } + HIDAPI_DelDevice(device); + + /* Update the device list again to pick up any children left */ + SDL_HIDAPI_change_count = 0; + + /* We deleted more than one device here, restart the loop */ + goto check_removed; + } else { + HIDAPI_DelDevice(device); + } } device = next; } + /* See if we can create any combined Joy-Con controllers */ + while (HIDAPI_CreateCombinedJoyCons()) { + continue; + } + SDL_UnlockJoysticks(); } @@ -627,13 +876,13 @@ /* If we're looking for the raw input Xbox One controller, match it against any other Xbox One controller */ if (product_id == USB_PRODUCT_XBOX_ONE_XBOXGIP_CONTROLLER && - SDL_GetJoystickGameControllerType(device->name, device->vendor_id, device->product_id, device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol) == SDL_CONTROLLER_TYPE_XBOXONE) { + SDL_GetJoystickGameControllerProtocol(device->name, device->vendor_id, device->product_id, device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol) == SDL_CONTROLLER_TYPE_XBOXONE) { return SDL_TRUE; } /* If we're looking for an XInput controller, match it against any other Xbox controller */ if (product_id == USB_PRODUCT_XBOX_ONE_XINPUT_CONTROLLER) { - SDL_GameControllerType type = SDL_GetJoystickGameControllerType(device->name, device->vendor_id, device->product_id, device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol); + SDL_GameControllerType type = SDL_GetJoystickGameControllerProtocol(device->name, device->vendor_id, device->product_id, device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol); if (type == SDL_CONTROLLER_TYPE_XBOX360 || type == SDL_CONTROLLER_TYPE_XBOXONE) { return SDL_TRUE; } @@ -659,14 +908,12 @@ } SDL_LockJoysticks(); - device = SDL_HIDAPI_devices; - while (device) { + for (device = SDL_HIDAPI_devices; device; device = device->next) { if (device->driver && - SDL_GetJoystickGameControllerType(device->name, device->vendor_id, device->product_id, device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol) == type) { + SDL_GetJoystickGameControllerProtocol(device->name, device->vendor_id, device->product_id, device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol) == type) { result = SDL_TRUE; break; } - device = device->next; } SDL_UnlockJoysticks(); @@ -713,14 +960,12 @@ and we have something similar in our device list, mark it as present. */ SDL_LockJoysticks(); - device = SDL_HIDAPI_devices; - while (device) { + for (device = SDL_HIDAPI_devices; device; device = device->next) { if (device->driver && HIDAPI_IsEquivalentToDevice(vendor_id, product_id, device)) { result = SDL_TRUE; break; } - device = device->next; } SDL_UnlockJoysticks(); @@ -736,8 +981,8 @@ if (SDL_AtomicTryLock(&SDL_HIDAPI_spinlock)) { Uint32 count = SDL_hid_device_change_count(); if (SDL_HIDAPI_change_count != count) { - HIDAPI_UpdateDeviceList(); SDL_HIDAPI_change_count = count; + HIDAPI_UpdateDeviceList(); } SDL_AtomicUnlock(&SDL_HIDAPI_spinlock); } @@ -752,8 +997,10 @@ /* Prepare the existing device list */ if (SDL_AtomicTryLock(&SDL_HIDAPI_spinlock)) { - device = SDL_HIDAPI_devices; - while (device) { + for (device = SDL_HIDAPI_devices; device; device = device->next) { + if (device->parent) { + continue; + } if (device->driver) { if (SDL_TryLockMutex(device->dev_lock) == 0) { device->updating = SDL_TRUE; @@ -762,7 +1009,6 @@ SDL_UnlockMutex(device->dev_lock); } } - device = device->next; } SDL_AtomicUnlock(&SDL_HIDAPI_spinlock); } @@ -783,6 +1029,21 @@ return name; } +static const char * +HIDAPI_JoystickGetDevicePath(int device_index) +{ + SDL_HIDAPI_Device *device; + const char *path = NULL; + + device = HIDAPI_GetDeviceByIndex(device_index, NULL); + if (device) { + /* FIXME: The device could be freed after this path is returned... */ + path = device->path; + } + + return path; +} + static int HIDAPI_JoystickGetDevicePlayerIndex(int device_index) { @@ -837,10 +1098,15 @@ static int HIDAPI_JoystickOpen(SDL_Joystick *joystick, int device_index) { - SDL_JoystickID joystickID; + SDL_JoystickID joystickID = -1; SDL_HIDAPI_Device *device = HIDAPI_GetDeviceByIndex(device_index, &joystickID); struct joystick_hwdata *hwdata; + if (!device || !device->driver) { + /* This should never happen - validated before being called */ + return SDL_SetError("Couldn't find HIDAPI device at index %d\n", device_index); + } + hwdata = (struct joystick_hwdata *)SDL_calloc(1, sizeof(*hwdata)); if (!hwdata) { return SDL_OutOfMemory(); @@ -848,6 +1114,8 @@ hwdata->device = device; if (!device->driver->OpenJoystick(device, joystick)) { + /* The open failed, mark this device as disconnected and update devices */ + HIDAPI_JoystickDisconnected(device, joystickID); SDL_free(hwdata); return -1; } @@ -999,7 +1267,17 @@ SDL_HIDAPI_QuitRumble(); while (SDL_HIDAPI_devices) { - HIDAPI_DelDevice(SDL_HIDAPI_devices); + SDL_HIDAPI_Device *device = SDL_HIDAPI_devices; + if (device->parent) { + /* When a child device goes away, so does the parent */ + device = device->parent; + for (i = 0; i < device->num_children; ++i) { + HIDAPI_DelDevice(device->children[i]); + } + HIDAPI_DelDevice(device); + } else { + HIDAPI_DelDevice(device); + } } /* Make sure the drivers cleaned up properly */ @@ -1009,11 +1287,14 @@ SDL_HIDAPI_DeviceDriver *driver = SDL_HIDAPI_drivers[i]; SDL_DelHintCallback(driver->hint, SDL_HIDAPIDriverHintChanged, NULL); } + SDL_DelHintCallback(SDL_HINT_JOYSTICK_HIDAPI_COMBINE_JOY_CONS, + SDL_HIDAPIDriverHintChanged, NULL); SDL_DelHintCallback(SDL_HINT_JOYSTICK_HIDAPI, SDL_HIDAPIDriverHintChanged, NULL); SDL_hid_exit(); + SDL_HIDAPI_change_count = 0; shutting_down = SDL_FALSE; initialized = SDL_FALSE; } @@ -1030,6 +1311,7 @@ HIDAPI_JoystickGetCount, HIDAPI_JoystickDetect, HIDAPI_JoystickGetDeviceName, + HIDAPI_JoystickGetDevicePath, HIDAPI_JoystickGetDevicePlayerIndex, HIDAPI_JoystickSetDevicePlayerIndex, HIDAPI_JoystickGetDeviceGUID, diff -Nru libsdl2-2.0.22+dfsg/src/joystick/hidapi/SDL_hidapijoystick_c.h libsdl2-2.24.0+dfsg/src/joystick/hidapi/SDL_hidapijoystick_c.h --- libsdl2-2.0.22+dfsg/src/joystick/hidapi/SDL_hidapijoystick_c.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/hidapi/SDL_hidapijoystick_c.h 2022-08-13 03:48:10.000000000 +0000 @@ -39,6 +39,7 @@ #define SDL_JOYSTICK_HIDAPI_SWITCH #define SDL_JOYSTICK_HIDAPI_XBOX360 #define SDL_JOYSTICK_HIDAPI_XBOXONE +#define SDL_JOYSTICK_HIDAPI_SHIELD #if defined(__IPHONEOS__) || defined(__TVOS__) || defined(__ANDROID__) /* Very basic Steam Controller support on mobile devices */ @@ -81,6 +82,10 @@ /* Used to flag that the device is being updated */ SDL_bool updating; + struct _SDL_HIDAPI_Device *parent; + int num_children; + struct _SDL_HIDAPI_Device **children; + struct _SDL_HIDAPI_Device *next; } SDL_HIDAPI_Device; @@ -90,7 +95,7 @@ SDL_bool enabled; SDL_bool enabled_default; SDL_bool (*IsSupportedDevice)(const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol); - const char *(*GetDeviceName)(Uint16 vendor_id, Uint16 product_id); + const char *(*GetDeviceName)(const char *name, Uint16 vendor_id, Uint16 product_id); SDL_bool (*InitDevice)(SDL_HIDAPI_Device *device); int (*GetDevicePlayerIndex)(SDL_HIDAPI_Device *device, SDL_JoystickID instance_id); void (*SetDevicePlayerIndex)(SDL_HIDAPI_Device *device, SDL_JoystickID instance_id, int player_index); @@ -109,10 +114,14 @@ /* HIDAPI device support */ +extern SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverCombined; extern SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverGameCube; +extern SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverJoyCons; extern SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverLuna; +extern SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverNintendoClassic; extern SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverPS4; extern SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverPS5; +extern SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverShield; extern SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverStadia; extern SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverSteam; extern SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverSwitch; diff -Nru libsdl2-2.0.22+dfsg/src/joystick/hidapi/SDL_hidapi_luna.c libsdl2-2.24.0+dfsg/src/joystick/hidapi/SDL_hidapi_luna.c --- libsdl2-2.0.22+dfsg/src/joystick/hidapi/SDL_hidapi_luna.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/hidapi/SDL_hidapi_luna.c 2022-06-16 20:16:31.000000000 +0000 @@ -54,7 +54,7 @@ } static const char * -HIDAPI_DriverLuna_GetDeviceName(Uint16 vendor_id, Uint16 product_id) +HIDAPI_DriverLuna_GetDeviceName(const char *name, Uint16 vendor_id, Uint16 product_id) { return "Amazon Luna Controller"; } @@ -267,16 +267,16 @@ /* Battery level report */ int level = data[1] * 100 / 0xFF; if (level == 0) { - joystick->epowerlevel = SDL_JOYSTICK_POWER_EMPTY; + SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_EMPTY); } else if (level <= 20) { - joystick->epowerlevel = SDL_JOYSTICK_POWER_LOW; + SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_LOW); } else if (level <= 70) { - joystick->epowerlevel = SDL_JOYSTICK_POWER_MEDIUM; + SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_MEDIUM); } else { - joystick->epowerlevel = SDL_JOYSTICK_POWER_FULL; + SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_FULL); } return; diff -Nru libsdl2-2.0.22+dfsg/src/joystick/hidapi/SDL_hidapi_ps4.c libsdl2-2.24.0+dfsg/src/joystick/hidapi/SDL_hidapi_ps4.c --- libsdl2-2.0.22+dfsg/src/joystick/hidapi/SDL_hidapi_ps4.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/hidapi/SDL_hidapi_ps4.c 2022-06-16 20:16:31.000000000 +0000 @@ -155,7 +155,7 @@ } static const char * -HIDAPI_DriverPS4_GetDeviceName(Uint16 vendor_id, Uint16 product_id) +HIDAPI_DriverPS4_GetDeviceName(const char *name, Uint16 vendor_id, Uint16 product_id) { if (vendor_id == USB_VENDOR_SONY) { return "PS4 Controller"; @@ -801,18 +801,18 @@ SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis); if (packet->ucBatteryLevel & 0x10) { - joystick->epowerlevel = SDL_JOYSTICK_POWER_WIRED; + SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_WIRED); } else { /* Battery level ranges from 0 to 10 */ int level = (packet->ucBatteryLevel & 0xF); if (level == 0) { - joystick->epowerlevel = SDL_JOYSTICK_POWER_EMPTY; + SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_EMPTY); } else if (level <= 2) { - joystick->epowerlevel = SDL_JOYSTICK_POWER_LOW; + SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_LOW); } else if (level <= 7) { - joystick->epowerlevel = SDL_JOYSTICK_POWER_MEDIUM; + SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_MEDIUM); } else { - joystick->epowerlevel = SDL_JOYSTICK_POWER_FULL; + SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_FULL); } } diff -Nru libsdl2-2.0.22+dfsg/src/joystick/hidapi/SDL_hidapi_ps5.c libsdl2-2.24.0+dfsg/src/joystick/hidapi/SDL_hidapi_ps5.c --- libsdl2-2.0.22+dfsg/src/joystick/hidapi/SDL_hidapi_ps5.c 2022-04-23 17:37:35.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/hidapi/SDL_hidapi_ps5.c 2022-08-13 03:48:10.000000000 +0000 @@ -59,6 +59,7 @@ { k_EPS5FeatureReportIdCalibration = 0x05, k_EPS5FeatureReportIdSerialNumber = 0x09, + k_EPS5FeatureReportIdFirmwareInfo = 0x20, } EPS5FeatureReportId; typedef struct @@ -119,7 +120,7 @@ Uint8 rgucRightTriggerEffect[11]; /* 10 */ Uint8 rgucLeftTriggerEffect[11]; /* 21 */ Uint8 rgucUnknown1[6]; /* 32 */ - Uint8 ucLedFlags; /* 38 */ + Uint8 ucEnableBits3; /* 38 */ Uint8 rgucUnknown2[2]; /* 39 */ Uint8 ucLedAnim; /* 41 */ Uint8 ucLedBrightness; /* 42 */ @@ -157,6 +158,7 @@ SDL_bool report_sensors; SDL_bool hardware_calibration; IMUCalibrationData calibration[6]; + Uint16 firmware_version; Uint32 last_packet; int player_index; SDL_bool player_lights; @@ -184,7 +186,7 @@ } static const char * -HIDAPI_DriverPS5_GetDeviceName(Uint16 vendor_id, Uint16 product_id) +HIDAPI_DriverPS5_GetDeviceName(const char *name, Uint16 vendor_id, Uint16 product_id) { if (vendor_id == USB_VENDOR_SONY) { return "PS5 Controller"; @@ -236,8 +238,9 @@ 0x1B }; - if (player_index >= 0 && player_index < SDL_arraysize(lights)) { + if (player_index >= 0) { /* Bitmask, 0x1F enables all lights, 0x20 changes instantly instead of fade */ + player_index %= SDL_arraysize(lights); effects->ucPadLights = lights[player_index] | 0x20; } else { effects->ucPadLights = 0x00; @@ -395,12 +398,19 @@ } if (ctx->rumble_left || ctx->rumble_right) { - effects.ucEnableBits1 |= 0x01; /* Enable rumble emulation */ - effects.ucEnableBits1 |= 0x02; /* Disable audio haptics */ + if (ctx->firmware_version < 0x0224) { + effects.ucEnableBits1 |= 0x01; /* Enable rumble emulation */ - /* Shift to reduce effective rumble strength to match Xbox controllers */ - effects.ucRumbleLeft = ctx->rumble_left >> 1; - effects.ucRumbleRight = ctx->rumble_right >> 1; + /* Shift to reduce effective rumble strength to match Xbox controllers */ + effects.ucRumbleLeft = ctx->rumble_left >> 1; + effects.ucRumbleRight = ctx->rumble_right >> 1; + } else { + effects.ucEnableBits3 |= 0x04; /* Enable improved rumble emulation on 2.24 firmware and newer */ + + effects.ucRumbleLeft = ctx->rumble_left; + effects.ucRumbleRight = ctx->rumble_right; + } + effects.ucEnableBits1 |= 0x02; /* Disable audio haptics */ } else { /* Leaving emulated rumble bits off will restore audio haptics */ } @@ -601,6 +611,14 @@ data[6], data[5], data[4], data[3], data[2], data[1]); joystick->serial = SDL_strdup(serial); } + + /* Read the firmware version + This will also enable enhanced reports over Bluetooth + */ + if (ReadFeatureReport(device->dev, k_EPS5FeatureReportIdFirmwareInfo, data, USB_PACKET_LENGTH) >= 46) { + ctx->firmware_version = (Uint16)data[44] | ((Uint16)data[45] << 8); + joystick->firmware_version = ctx->firmware_version; + } } if (!joystick->serial && device->serial && SDL_strlen(device->serial) == 12) { diff -Nru libsdl2-2.0.22+dfsg/src/joystick/hidapi/SDL_hidapi_rumble.c libsdl2-2.24.0+dfsg/src/joystick/hidapi/SDL_hidapi_rumble.c --- libsdl2-2.0.22+dfsg/src/joystick/hidapi/SDL_hidapi_rumble.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/hidapi/SDL_hidapi_rumble.c 2022-06-02 02:01:57.000000000 +0000 @@ -53,7 +53,7 @@ static SDL_HIDAPI_RumbleContext rumble_context; -static int SDL_HIDAPI_RumbleThread(void *data) +static int SDLCALL SDL_HIDAPI_RumbleThread(void *data) { SDL_HIDAPI_RumbleContext *ctx = (SDL_HIDAPI_RumbleContext *)data; diff -Nru libsdl2-2.0.22+dfsg/src/joystick/hidapi/SDL_hidapi_shield.c libsdl2-2.24.0+dfsg/src/joystick/hidapi/SDL_hidapi_shield.c --- libsdl2-2.0.22+dfsg/src/joystick/hidapi/SDL_hidapi_shield.c 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/hidapi/SDL_hidapi_shield.c 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,470 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifdef SDL_JOYSTICK_HIDAPI + +#include "SDL_hints.h" +#include "SDL_events.h" +#include "SDL_timer.h" +#include "SDL_joystick.h" +#include "SDL_gamecontroller.h" +#include "../SDL_sysjoystick.h" +#include "SDL_hidapijoystick_c.h" +#include "SDL_hidapi_rumble.h" + + +#ifdef SDL_JOYSTICK_HIDAPI_SHIELD + +/* Define this if you want to log all packets from the controller */ +/*#define DEBUG_SHIELD_PROTOCOL*/ + +#define CMD_BATTERY_STATE 0x07 +#define CMD_RUMBLE 0x39 +#define CMD_CHARGE_STATE 0x3A + +/* Milliseconds between polls of battery state */ +#define BATTERY_POLL_INTERVAL_MS 60000 + +/* Milliseconds between retransmission of rumble to keep motors running */ +#define RUMBLE_REFRESH_INTERVAL_MS 500 + +/* Reports that are too small are dropped over Bluetooth */ +#define HID_REPORT_SIZE 33 + +typedef enum { + k_ShieldReportIdControllerState = 0x01, + k_ShieldReportIdCommandResponse = 0x03, + k_ShieldReportIdCommandRequest = 0x04, +} EShieldReportId; + +/* This same report structure is used for both requests and responses */ +typedef struct { + Uint8 report_id; + Uint8 cmd; + Uint8 seq_num; + Uint8 payload[HID_REPORT_SIZE - 3]; +} ShieldCommandReport_t; +SDL_COMPILE_TIME_ASSERT(ShieldCommandReport_t, sizeof(ShieldCommandReport_t) == HID_REPORT_SIZE); + +typedef struct { + Uint8 seq_num; + + SDL_JoystickPowerLevel battery_level; + SDL_bool charging; + Uint32 last_battery_query_time; + + SDL_bool rumble_report_pending; + SDL_bool rumble_update_pending; + Uint8 left_motor_amplitude; + Uint8 right_motor_amplitude; + Uint32 last_rumble_time; + + Uint8 last_state[USB_PACKET_LENGTH]; +} SDL_DriverShield_Context; + + +static SDL_bool +HIDAPI_DriverShield_IsSupportedDevice(const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol) +{ + return (type == SDL_CONTROLLER_TYPE_NVIDIA_SHIELD) ? SDL_TRUE : SDL_FALSE; +} + +static const char * +HIDAPI_DriverShield_GetDeviceName(const char *name, Uint16 vendor_id, Uint16 product_id) +{ + return "NVIDIA SHIELD Controller"; +} + +static SDL_bool +HIDAPI_DriverShield_InitDevice(SDL_HIDAPI_Device *device) +{ + return HIDAPI_JoystickConnected(device, NULL); +} + +static int +HIDAPI_DriverShield_GetDevicePlayerIndex(SDL_HIDAPI_Device *device, SDL_JoystickID instance_id) +{ + return -1; +} + +static void +HIDAPI_DriverShield_SetDevicePlayerIndex(SDL_HIDAPI_Device *device, SDL_JoystickID instance_id, int player_index) +{ +} + +static int +HIDAPI_DriverShield_SendCommand(SDL_HIDAPI_Device *device, Uint8 cmd, const void *data, int size) +{ + SDL_DriverShield_Context *ctx = device->context; + ShieldCommandReport_t cmd_pkt; + + if (size > sizeof(cmd_pkt.payload)) { + return SDL_SetError("Command data exceeds HID report size"); + } + + if (SDL_HIDAPI_LockRumble() < 0) { + return -1; + } + + cmd_pkt.report_id = k_ShieldReportIdCommandRequest; + cmd_pkt.cmd = cmd; + cmd_pkt.seq_num = ctx->seq_num++; + if (data) { + SDL_memcpy(cmd_pkt.payload, data, size); + } + + /* Zero unused data in the payload */ + SDL_memset(&cmd_pkt.payload[size], 0, sizeof(cmd_pkt.payload) - size); + + if (SDL_HIDAPI_SendRumbleAndUnlock(device, (Uint8*)&cmd_pkt, sizeof(cmd_pkt)) != sizeof(cmd_pkt)) { + return SDL_SetError("Couldn't send command packet"); + } + + return 0; +} + +static SDL_bool +HIDAPI_DriverShield_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joystick) +{ + SDL_DriverShield_Context *ctx; + + ctx = (SDL_DriverShield_Context *)SDL_calloc(1, sizeof(*ctx)); + if (!ctx) { + SDL_OutOfMemory(); + return SDL_FALSE; + } + + device->dev = SDL_hid_open_path(device->path, 0); + if (!device->dev) { + SDL_SetError("Couldn't open %s", device->path); + SDL_free(ctx); + return SDL_FALSE; + } + device->context = ctx; + + /* Initialize the joystick capabilities */ + joystick->nbuttons = 16; + joystick->naxes = SDL_CONTROLLER_AXIS_MAX; + joystick->epowerlevel = SDL_JOYSTICK_POWER_UNKNOWN; + + /* Request battery and charging info */ + ctx->battery_level = SDL_JOYSTICK_POWER_UNKNOWN; + ctx->last_battery_query_time = SDL_GetTicks(); + HIDAPI_DriverShield_SendCommand(device, CMD_CHARGE_STATE, NULL, 0); + HIDAPI_DriverShield_SendCommand(device, CMD_BATTERY_STATE, NULL, 0); + + return SDL_TRUE; +} + +static int +HIDAPI_DriverShield_SendNextRumble(SDL_HIDAPI_Device *device) +{ + SDL_DriverShield_Context *ctx = device->context; + Uint8 rumble_data[3]; + + if (!ctx->rumble_update_pending) { + return 0; + } + + rumble_data[0] = 0x01; /* enable */ + rumble_data[1] = ctx->left_motor_amplitude; + rumble_data[2] = ctx->right_motor_amplitude; + + ctx->rumble_update_pending = SDL_FALSE; + ctx->last_rumble_time = SDL_GetTicks(); + + return HIDAPI_DriverShield_SendCommand(device, CMD_RUMBLE, rumble_data, sizeof(rumble_data)); +} + +static int +HIDAPI_DriverShield_RumbleJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble) +{ + SDL_DriverShield_Context *ctx = device->context; + + /* The rumble motors are quite intense, so tone down the intensity like the official driver does */ + ctx->left_motor_amplitude = low_frequency_rumble >> 11; + ctx->right_motor_amplitude = high_frequency_rumble >> 11; + ctx->rumble_update_pending = SDL_TRUE; + + if (ctx->rumble_report_pending) { + /* We will service this after the hardware acknowledges the previous request */ + return 0; + } + + return HIDAPI_DriverShield_SendNextRumble(device); +} + +static int +HIDAPI_DriverShield_RumbleJoystickTriggers(SDL_HIDAPI_Device *device, SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble) +{ + return SDL_Unsupported(); +} + +static Uint32 +HIDAPI_DriverShield_GetJoystickCapabilities(SDL_HIDAPI_Device *device, SDL_Joystick *joystick) +{ + return SDL_JOYCAP_RUMBLE; +} + +static int +HIDAPI_DriverShield_SetJoystickLED(SDL_HIDAPI_Device *device, SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue) +{ + return SDL_Unsupported(); +} + +static int +HIDAPI_DriverShield_SendJoystickEffect(SDL_HIDAPI_Device *device, SDL_Joystick *joystick, const void *data, int size) +{ + const Uint8 *data_bytes = data; + + if (size > 1) { + /* Single command byte followed by a variable length payload */ + return HIDAPI_DriverShield_SendCommand(device, data_bytes[0], &data_bytes[1], size - 1); + } else if (size == 1) { + /* Single command byte with no payload */ + return HIDAPI_DriverShield_SendCommand(device, data_bytes[0], NULL, 0); + } else { + return SDL_SetError("Effect data must at least contain a command byte"); + } +} + +static int +HIDAPI_DriverShield_SetJoystickSensorsEnabled(SDL_HIDAPI_Device *device, SDL_Joystick *joystick, SDL_bool enabled) +{ + return SDL_Unsupported(); +} + +static void +HIDAPI_DriverShield_HandleStatePacket(SDL_Joystick *joystick, SDL_DriverShield_Context *ctx, Uint8 *data, int size) +{ + if (size < 23) { + return; + } + + if (ctx->last_state[2] != data[2]) { + SDL_bool dpad_up = SDL_FALSE; + SDL_bool dpad_down = SDL_FALSE; + SDL_bool dpad_left = SDL_FALSE; + SDL_bool dpad_right = SDL_FALSE; + + switch (data[2]) { + case 0: + dpad_up = SDL_TRUE; + break; + case 1: + dpad_up = SDL_TRUE; + dpad_right = SDL_TRUE; + break; + case 2: + dpad_right = SDL_TRUE; + break; + case 3: + dpad_right = SDL_TRUE; + dpad_down = SDL_TRUE; + break; + case 4: + dpad_down = SDL_TRUE; + break; + case 5: + dpad_left = SDL_TRUE; + dpad_down = SDL_TRUE; + break; + case 6: + dpad_left = SDL_TRUE; + break; + case 7: + dpad_up = SDL_TRUE; + dpad_left = SDL_TRUE; + break; + default: + break; + } + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, dpad_down); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, dpad_up); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, dpad_right); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, dpad_left); + } + + if (ctx->last_state[3] != data[3]) { + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_A, (data[3] & 0x01) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_B, (data[3] & 0x02) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_X, (data[3] & 0x04) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_Y, (data[3] & 0x08) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data[3] & 0x10) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data[3] & 0x20) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data[3] & 0x40) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_RIGHTSTICK, (data[3] & 0x80) ? SDL_PRESSED : SDL_RELEASED); + } + + if (ctx->last_state[4] != data[4]) { + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_START, (data[4] & 0x01) ? SDL_PRESSED : SDL_RELEASED); + } + + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTX, SDL_SwapLE16(*(Sint16*)&data[9]) - 0x8000); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTY, SDL_SwapLE16(*(Sint16*)&data[11]) - 0x8000); + + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTX, SDL_SwapLE16(*(Sint16*)&data[13]) - 0x8000); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, SDL_SwapLE16(*(Sint16*)&data[15]) - 0x8000); + + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, SDL_SwapLE16(*(Sint16*)&data[19]) - 0x8000); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, SDL_SwapLE16(*(Sint16*)&data[21]) - 0x8000); + + if (ctx->last_state[17] != data[17]) { + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_MISC1, (data[17] & 0x01) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_BACK, (data[17] & 0x02) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data[17] & 0x04) ? SDL_PRESSED : SDL_RELEASED); + } + + SDL_memcpy(ctx->last_state, data, SDL_min(size, sizeof(ctx->last_state))); +} + +static SDL_bool +HIDAPI_DriverShield_UpdateDevice(SDL_HIDAPI_Device *device) +{ + SDL_DriverShield_Context *ctx = (SDL_DriverShield_Context *)device->context; + SDL_Joystick *joystick = NULL; + Uint8 data[USB_PACKET_LENGTH]; + int size = 0; + ShieldCommandReport_t *cmd_resp_report; + + if (device->num_joysticks > 0) { + joystick = SDL_JoystickFromInstanceID(device->joysticks[0]); + } + if (!joystick) { + return SDL_FALSE; + } + + while ((size = SDL_hid_read_timeout(device->dev, data, sizeof(data), 0)) > 0) { +#ifdef DEBUG_SHIELD_PROTOCOL + HIDAPI_DumpPacket("NVIDIA SHIELD packet: size = %d", data, size); +#endif + /* Byte 0 is HID report ID */ + switch (data[0]) { + case k_ShieldReportIdControllerState: + HIDAPI_DriverShield_HandleStatePacket(joystick, ctx, data, size); + break; + case k_ShieldReportIdCommandResponse: + cmd_resp_report = (ShieldCommandReport_t*)data; + switch (cmd_resp_report->cmd) { + case CMD_RUMBLE: + ctx->rumble_report_pending = SDL_FALSE; + HIDAPI_DriverShield_SendNextRumble(device); + break; + case CMD_CHARGE_STATE: + ctx->charging = cmd_resp_report->payload[0] != 0; + SDL_PrivateJoystickBatteryLevel(joystick, ctx->charging ? SDL_JOYSTICK_POWER_WIRED : ctx->battery_level); + break; + case CMD_BATTERY_STATE: + switch (cmd_resp_report->payload[2]) { + case 0: + ctx->battery_level = SDL_JOYSTICK_POWER_EMPTY; + break; + case 1: + ctx->battery_level = SDL_JOYSTICK_POWER_LOW; + break; + case 2: /* 40% */ + case 3: /* 60% */ + case 4: /* 80% */ + ctx->battery_level = SDL_JOYSTICK_POWER_MEDIUM; + break; + case 5: + ctx->battery_level = SDL_JOYSTICK_POWER_FULL; + break; + default: + ctx->battery_level = SDL_JOYSTICK_POWER_UNKNOWN; + break; + } + SDL_PrivateJoystickBatteryLevel(joystick, ctx->charging ? SDL_JOYSTICK_POWER_WIRED : ctx->battery_level); + break; + } + break; + } + } + + /* Ask for battery state again if we're due for an update */ + if (SDL_TICKS_PASSED(SDL_GetTicks(), ctx->last_battery_query_time + BATTERY_POLL_INTERVAL_MS)) { + ctx->last_battery_query_time = SDL_GetTicks(); + HIDAPI_DriverShield_SendCommand(device, CMD_BATTERY_STATE, NULL, 0); + } + + /* Retransmit rumble packets if they've lasted longer than the hardware supports */ + if ((ctx->left_motor_amplitude != 0 || ctx->right_motor_amplitude != 0) && + SDL_TICKS_PASSED(SDL_GetTicks(), ctx->last_rumble_time + RUMBLE_REFRESH_INTERVAL_MS)) { + ctx->rumble_update_pending = SDL_TRUE; + HIDAPI_DriverShield_SendNextRumble(device); + } + + if (size < 0) { + /* Read error, device is disconnected */ + HIDAPI_JoystickDisconnected(device, joystick->instance_id); + } + return (size >= 0); +} + +static void +HIDAPI_DriverShield_CloseJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joystick) +{ + SDL_LockMutex(device->dev_lock); + { + if (device->dev) { + SDL_hid_close(device->dev); + device->dev = NULL; + } + + SDL_free(device->context); + device->context = NULL; + } + SDL_UnlockMutex(device->dev_lock); +} + +static void +HIDAPI_DriverShield_FreeDevice(SDL_HIDAPI_Device *device) +{ +} + +SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverShield = +{ + SDL_HINT_JOYSTICK_HIDAPI_SHIELD, + SDL_TRUE, + SDL_TRUE, + HIDAPI_DriverShield_IsSupportedDevice, + HIDAPI_DriverShield_GetDeviceName, + HIDAPI_DriverShield_InitDevice, + HIDAPI_DriverShield_GetDevicePlayerIndex, + HIDAPI_DriverShield_SetDevicePlayerIndex, + HIDAPI_DriverShield_UpdateDevice, + HIDAPI_DriverShield_OpenJoystick, + HIDAPI_DriverShield_RumbleJoystick, + HIDAPI_DriverShield_RumbleJoystickTriggers, + HIDAPI_DriverShield_GetJoystickCapabilities, + HIDAPI_DriverShield_SetJoystickLED, + HIDAPI_DriverShield_SendJoystickEffect, + HIDAPI_DriverShield_SetJoystickSensorsEnabled, + HIDAPI_DriverShield_CloseJoystick, + HIDAPI_DriverShield_FreeDevice, +}; + +#endif /* SDL_JOYSTICK_HIDAPI_SHIELD */ + +#endif /* SDL_JOYSTICK_HIDAPI */ + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/joystick/hidapi/SDL_hidapi_stadia.c libsdl2-2.24.0+dfsg/src/joystick/hidapi/SDL_hidapi_stadia.c --- libsdl2-2.0.22+dfsg/src/joystick/hidapi/SDL_hidapi_stadia.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/hidapi/SDL_hidapi_stadia.c 2022-06-16 20:16:31.000000000 +0000 @@ -55,7 +55,7 @@ } static const char * -HIDAPI_DriverStadia_GetDeviceName(Uint16 vendor_id, Uint16 product_id) +HIDAPI_DriverStadia_GetDeviceName(const char *name, Uint16 vendor_id, Uint16 product_id) { return "Google Stadia Controller"; } diff -Nru libsdl2-2.0.22+dfsg/src/joystick/hidapi/SDL_hidapi_steam.c libsdl2-2.24.0+dfsg/src/joystick/hidapi/SDL_hidapi_steam.c --- libsdl2-2.0.22+dfsg/src/joystick/hidapi/SDL_hidapi_steam.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/hidapi/SDL_hidapi_steam.c 2022-06-16 20:16:31.000000000 +0000 @@ -1004,7 +1004,7 @@ } static const char * -HIDAPI_DriverSteam_GetDeviceName(Uint16 vendor_id, Uint16 product_id) +HIDAPI_DriverSteam_GetDeviceName(const char *name, Uint16 vendor_id, Uint16 product_id) { return "Steam Controller"; } diff -Nru libsdl2-2.0.22+dfsg/src/joystick/hidapi/SDL_hidapi_switch.c libsdl2-2.24.0+dfsg/src/joystick/hidapi/SDL_hidapi_switch.c --- libsdl2-2.0.22+dfsg/src/joystick/hidapi/SDL_hidapi_switch.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/hidapi/SDL_hidapi_switch.c 2022-08-13 03:48:10.000000000 +0000 @@ -63,6 +63,11 @@ #define SWITCH_GYRO_SCALE 14.2842f #define SWITCH_ACCEL_SCALE 4096.f +#define SWITCH_GYRO_SCALE_OFFSET 13371.0f +#define SWITCH_GYRO_SCALE_MULT 936.0f +#define SWITCH_ACCEL_SCALE_OFFSET 16384.0f +#define SWITCH_ACCEL_SCALE_MULT 4.0f + typedef enum { k_eSwitchInputReportIDs_SubcommandReply = 0x21, k_eSwitchInputReportIDs_FullControllerState = 0x30, @@ -99,10 +104,15 @@ } ESwitchProprietaryCommandIDs; typedef enum { - k_eSwitchDeviceInfoControllerType_Unknown = 0x0, - k_eSwitchDeviceInfoControllerType_JoyConLeft = 0x1, - k_eSwitchDeviceInfoControllerType_JoyConRight = 0x2, - k_eSwitchDeviceInfoControllerType_ProController = 0x3, + k_eSwitchDeviceInfoControllerType_Unknown = 0, + k_eSwitchDeviceInfoControllerType_JoyConLeft = 1, + k_eSwitchDeviceInfoControllerType_JoyConRight = 2, + k_eSwitchDeviceInfoControllerType_ProController = 3, + k_eSwitchDeviceInfoControllerType_NESLeft = 9, + k_eSwitchDeviceInfoControllerType_NESRight = 10, + k_eSwitchDeviceInfoControllerType_SNES = 11, + k_eSwitchDeviceInfoControllerType_N64 = 12, + k_eSwitchDeviceInfoControllerType_SEGA_Genesis = 13, } ESwitchDeviceInfoControllerType; #define k_unSwitchOutputPacketDataLength 49 @@ -114,6 +124,14 @@ #define k_unSPIStickCalibrationEndOffset 0x604E #define k_unSPIStickCalibrationLength (k_unSPIStickCalibrationEndOffset - k_unSPIStickCalibrationStartOffset + 1) +#define k_unSPIIMUScaleStartOffset 0x6020 +#define k_unSPIIMUScaleEndOffset 0x6037 +#define k_unSPIIMUScaleLength (k_unSPIIMUScaleEndOffset - k_unSPIIMUScaleStartOffset + 1) + +#define k_unSPIIMUUserScaleStartOffset 0x8026 +#define k_unSPIIMUUserScaleEndOffset 0x8039 +#define k_unSPIIMUUserScaleLength (k_unSPIIMUUserScaleEndOffset - k_unSPIIMUUserScaleStartOffset + 1) + #pragma pack(1) typedef struct { @@ -231,10 +249,13 @@ typedef struct { SDL_HIDAPI_Device *device; SDL_bool m_bInputOnly; - SDL_bool m_bHasHomeLED; SDL_bool m_bUsingBluetooth; SDL_bool m_bIsGameCube; SDL_bool m_bUseButtonLabels; + SDL_bool m_bPlayerLights; + int m_nPlayerIndex; + SDL_bool m_bSyncWrite; + int m_nMaxWriteAttempts; ESwitchDeviceInfoControllerType m_eControllerType; Uint8 m_rgucMACAddress[6]; Uint8 m_nCommandNumber; @@ -247,6 +268,9 @@ Uint32 m_unRumblePending; SDL_bool m_bHasSensors; SDL_bool m_bReportSensors; + SDL_bool m_bHasSensorData; + Uint32 m_unLastInput; + Uint32 m_unLastIMUReset; SwitchInputOnlyControllerStatePacket_t m_lastInputOnlyState; SwitchSimpleStatePacket_t m_lastSimpleState; @@ -266,12 +290,25 @@ Sint16 sMax; } axis[2]; } m_StickExtents[2]; + + struct IMUScaleData { + float fAccelScaleX; + float fAccelScaleY; + float fAccelScaleZ; + + float fGyroScaleX; + float fGyroScaleY; + float fGyroScaleZ; + } m_IMUScaleData; } SDL_DriverSwitch_Context; static SDL_bool -HasHomeLED(int vendor_id, int product_id) +HasHomeLED(SDL_DriverSwitch_Context *ctx) { + Uint16 vendor_id = ctx->device->vendor_id; + Uint16 product_id = ctx->device->product_id; + /* The Power A Nintendo Switch Pro controllers don't have a Home LED */ if (vendor_id == 0 && product_id == 0) { return SDL_FALSE; @@ -282,10 +319,31 @@ return SDL_FALSE; } + /* The Nintendo Online classic controllers don't have a Home LED */ + if (vendor_id == USB_VENDOR_NINTENDO && + ctx->m_eControllerType > k_eSwitchDeviceInfoControllerType_ProController) { + return SDL_FALSE; + } + return SDL_TRUE; } static SDL_bool +AlwaysUsesLabels(int vendor_id, int product_id, ESwitchDeviceInfoControllerType eControllerType) +{ + /* These controllers don't have a diamond button configuration, so always use labels */ + switch (eControllerType) { + case k_eSwitchDeviceInfoControllerType_NESLeft: + case k_eSwitchDeviceInfoControllerType_NESRight: + case k_eSwitchDeviceInfoControllerType_N64: + case k_eSwitchDeviceInfoControllerType_SEGA_Genesis: + return SDL_TRUE; + default: + return SDL_FALSE; + } +} + +static SDL_bool IsGameCubeFormFactor(int vendor_id, int product_id) { static Uint32 gamecube_formfactor[] = { @@ -304,6 +362,45 @@ } static SDL_bool +HIDAPI_DriverNintendoClassic_IsSupportedDevice(const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol) +{ + if (vendor_id == USB_VENDOR_NINTENDO) { + if (product_id == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_RIGHT) { + if (SDL_strncmp(name, "NES Controller", 14) == 0) { + return SDL_TRUE; + } + } + + if (product_id == USB_PRODUCT_NINTENDO_N64_CONTROLLER) { + return SDL_TRUE; + } + + if (product_id == USB_PRODUCT_NINTENDO_SEGA_GENESIS_CONTROLLER) { + return SDL_TRUE; + } + + if (product_id == USB_PRODUCT_NINTENDO_SNES_CONTROLLER) { + return SDL_TRUE; + } + } + + return SDL_FALSE; +} + +static SDL_bool +HIDAPI_DriverJoyCons_IsSupportedDevice(const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol) +{ + if (vendor_id == USB_VENDOR_NINTENDO) { + if (product_id == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_LEFT || + product_id == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_RIGHT || + product_id == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_GRIP) { + return SDL_TRUE; + } + } + return SDL_FALSE; +} + +static SDL_bool HIDAPI_DriverSwitch_IsSupportedDevice(const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol) { /* The HORI Wireless Switch Pad enumerates as a HID device when connected via USB @@ -315,24 +412,54 @@ if (SDL_strcmp(name, "HORI Wireless Switch Pad") == 0) { return SDL_FALSE; } + + /* If it's handled by another driver, it's not handled here */ + if (HIDAPI_DriverNintendoClassic_IsSupportedDevice(name, type, vendor_id, product_id, version, interface_number, interface_class, interface_subclass, interface_protocol) || + HIDAPI_DriverJoyCons_IsSupportedDevice(name, type, vendor_id, product_id, version, interface_number, interface_class, interface_subclass, interface_protocol)) { + return SDL_FALSE; + } + return (type == SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO) ? SDL_TRUE : SDL_FALSE; } static const char * -HIDAPI_DriverSwitch_GetDeviceName(Uint16 vendor_id, Uint16 product_id) +HIDAPI_DriverSwitch_GetDeviceName(const char *name, Uint16 vendor_id, Uint16 product_id) { /* Give a user friendly name for this controller */ if (vendor_id == USB_VENDOR_NINTENDO) { - if (product_id == USB_PRODUCT_NINTENDO_SWITCH_JOY_CON_GRIP) { - return "Nintendo Switch Joy-Con Grip"; + if (product_id == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_GRIP) { + /* We don't know if this is left or right, just leave it alone */ + return NULL; } - if (product_id == USB_PRODUCT_NINTENDO_SWITCH_JOY_CON_LEFT) { - return "Nintendo Switch Joy-Con Left"; + if (product_id == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_LEFT) { + return "Nintendo Switch Joy-Con (L)"; } - if (product_id == USB_PRODUCT_NINTENDO_SWITCH_JOY_CON_RIGHT) { - return "Nintendo Switch Joy-Con Right"; + if (product_id == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_RIGHT) { + if (SDL_strncmp(name, "NES Controller", 14) == 0) { + if (SDL_strstr(name, "(L)") != 0) { + return "Nintendo NES Controller (L)"; + } else if (SDL_strstr(name, "(R)") != 0) { + return "Nintendo NES Controller (R)"; + } else { + /* Not sure what this is, just leave it alone */ + return NULL; + } + } + return "Nintendo Switch Joy-Con (R)"; + } + + if (product_id == USB_PRODUCT_NINTENDO_N64_CONTROLLER) { + return "Nintendo N64 Controller"; + } + + if (product_id == USB_PRODUCT_NINTENDO_SEGA_GENESIS_CONTROLLER) { + return "Nintendo SEGA Genesis Controller"; + } + + if (product_id == USB_PRODUCT_NINTENDO_SNES_CONTROLLER) { + return "Nintendo SNES Controller"; } } @@ -421,7 +548,9 @@ SDL_memcpy(outPacket->commonData.rumbleData, ctx->m_RumblePacket.rumbleData, sizeof(ctx->m_RumblePacket.rumbleData)); outPacket->ucSubcommandID = ucCommandID; - SDL_memcpy(outPacket->rgucSubcommandData, pBuf, ucLen); + if (pBuf) { + SDL_memcpy(outPacket->rgucSubcommandData, pBuf, ucLen); + } ctx->m_nCommandNumber = (ctx->m_nCommandNumber + 1) & 0xF; } @@ -441,15 +570,19 @@ pBuf = rgucBuf; ucLen = (Uint8)unWriteSize; } - return (WriteOutput(ctx, (Uint8 *)pBuf, ucLen) >= 0); + if (ctx->m_bSyncWrite) { + return (SDL_hid_write(ctx->device->dev, (Uint8 *)pBuf, ucLen) >= 0); + } else { + return (WriteOutput(ctx, (Uint8 *)pBuf, ucLen) >= 0); + } } static SDL_bool WriteSubcommand(SDL_DriverSwitch_Context *ctx, ESwitchSubcommandIDs ucCommandID, Uint8 *pBuf, Uint8 ucLen, SwitchSubcommandInputPacket_t **ppReply) { - int nRetries = 5; SwitchSubcommandInputPacket_t *reply = NULL; + int nTries; - while (!reply && nRetries--) { + for (nTries = 1; !reply && nTries <= ctx->m_nMaxWriteAttempts; ++nTries) { SwitchSubcommandOutputPacket_t commandPacket; ConstructSubcommand(ctx, ucCommandID, pBuf, ucLen, &commandPacket); @@ -468,9 +601,9 @@ static SDL_bool WriteProprietary(SDL_DriverSwitch_Context *ctx, ESwitchProprietaryCommandIDs ucCommand, Uint8 *pBuf, Uint8 ucLen, SDL_bool waitForReply) { - int nRetries = 5; + int nTries; - while (nRetries--) { + for (nTries = 1; nTries <= ctx->m_nMaxWriteAttempts; ++nTries) { SwitchProprietaryOutputPacket_t packet; if ((!pBuf && ucLen > 0) || ucLen > sizeof(packet.rgucProprietaryData)) { @@ -489,9 +622,11 @@ } if (!waitForReply || ReadProprietaryReply(ctx, ucCommand)) { +//SDL_Log("Succeeded%s after %d tries\n", ctx->m_bSyncWrite ? " (sync)" : "", nTries); return SDL_TRUE; } } +//SDL_Log("Failed%s after %d tries\n", ctx->m_bSyncWrite ? " (sync)" : "", nTries); return SDL_FALSE; } @@ -608,6 +743,13 @@ size_t i; ctx->m_eControllerType = (ESwitchDeviceInfoControllerType)status->ucDeviceType; + + /* The N64 controller reports as a Pro controller over USB */ + if (ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_ProController && + ctx->device->product_id == USB_PRODUCT_NINTENDO_N64_CONTROLLER) { + ctx->m_eControllerType = k_eSwitchDeviceInfoControllerType_N64; + } + for (i = 0; i < sizeof (ctx->m_rgucMACAddress); ++i) ctx->m_rgucMACAddress[i] = status->rgucMACAddress[ sizeof(ctx->m_rgucMACAddress) - i - 1 ]; @@ -686,10 +828,46 @@ return WriteSubcommand(ctx, k_eSwitchSubcommandIDs_SetHomeLight, rgucBuffer, sizeof(rgucBuffer), NULL); } -static SDL_bool SetSlotLED(SDL_DriverSwitch_Context *ctx, Uint8 slot) +static void SDLCALL SDL_HomeLEDHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + SDL_DriverSwitch_Context *ctx = (SDL_DriverSwitch_Context *)userdata; + + if (hint && *hint) { + int value; + + if (SDL_strchr(hint, '.') != NULL) { + value = (int)(100.0f * SDL_atof(hint)); + } else if (SDL_GetStringBoolean(hint, SDL_TRUE)) { + value = 100; + } else { + value = 0; + } + SetHomeLED(ctx, value); + } +} + +static void UpdateSlotLED(SDL_DriverSwitch_Context *ctx) +{ + if (!ctx->m_bInputOnly) { + Uint8 led_data = 0; + + if (ctx->m_bPlayerLights && ctx->m_nPlayerIndex >= 0) { + led_data = (1 << (ctx->m_nPlayerIndex % 4)); + } + WriteSubcommand(ctx, k_eSwitchSubcommandIDs_SetPlayerLights, &led_data, sizeof(led_data), NULL); + } +} + +static void SDLCALL SDL_PlayerLEDHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint) { - Uint8 led_data = (1 << slot); - return WriteSubcommand(ctx, k_eSwitchSubcommandIDs_SetPlayerLights, &led_data, sizeof(led_data), NULL); + SDL_DriverSwitch_Context *ctx = (SDL_DriverSwitch_Context *)userdata; + SDL_bool bPlayerLights = SDL_GetStringBoolean(hint, SDL_TRUE); + + if (bPlayerLights != ctx->m_bPlayerLights) { + ctx->m_bPlayerLights = bPlayerLights; + + UpdateSlotLED(ctx); + } } static SDL_bool SetIMUEnabled(SDL_DriverSwitch_Context* ctx, SDL_bool enabled) @@ -769,6 +947,72 @@ return SDL_TRUE; } +static SDL_bool LoadIMUCalibration(SDL_DriverSwitch_Context* ctx) +{ + Uint8* pIMUScale; + SwitchSubcommandInputPacket_t* reply = NULL; + Sint16 sAccelRawX, sAccelRawY, sAccelRawZ, sGyroRawX, sGyroRawY, sGyroRawZ; + + /* Read Calibration Info */ + SwitchSPIOpData_t readParams; + readParams.unAddress = k_unSPIIMUScaleStartOffset; + readParams.ucLength = k_unSPIIMUScaleLength; + + if (!WriteSubcommand(ctx, k_eSwitchSubcommandIDs_SPIFlashRead, (uint8_t*)&readParams, sizeof(readParams), &reply)) { + const float accelScale = SDL_STANDARD_GRAVITY / SWITCH_ACCEL_SCALE; + const float gyroScale = (float)M_PI / 180.0f / SWITCH_GYRO_SCALE; + + ctx->m_IMUScaleData.fAccelScaleX = accelScale; + ctx->m_IMUScaleData.fAccelScaleY = accelScale; + ctx->m_IMUScaleData.fAccelScaleZ = accelScale; + + ctx->m_IMUScaleData.fGyroScaleX = gyroScale; + ctx->m_IMUScaleData.fGyroScaleY = gyroScale; + ctx->m_IMUScaleData.fGyroScaleZ = gyroScale; + + return SDL_FALSE; + } + + /* IMU scale gives us multipliers for converting raw values to real world values */ + pIMUScale = reply->spiReadData.rgucReadData; + + sAccelRawX = ((pIMUScale[1] << 8) & 0xF00) | pIMUScale[0]; + sAccelRawY = ((pIMUScale[3] << 8) & 0xF00) | pIMUScale[2]; + sAccelRawZ = ((pIMUScale[5] << 8) & 0xF00) | pIMUScale[4]; + + sGyroRawX = ((pIMUScale[13] << 8) & 0xF00) | pIMUScale[12]; + sGyroRawY = ((pIMUScale[15] << 8) & 0xF00) | pIMUScale[14]; + sGyroRawZ = ((pIMUScale[17] << 8) & 0xF00) | pIMUScale[16]; + + /* Check for user calibration data. If it's present and set, it'll override the factory settings */ + readParams.unAddress = k_unSPIIMUUserScaleStartOffset; + readParams.ucLength = k_unSPIIMUUserScaleLength; + if (WriteSubcommand(ctx, k_eSwitchSubcommandIDs_SPIFlashRead, (uint8_t*)&readParams, sizeof(readParams), &reply) && (pIMUScale[0] | pIMUScale[1] << 8) == 0xA1B2) { + pIMUScale = reply->spiReadData.rgucReadData; + + sAccelRawX = ((pIMUScale[3] << 8) & 0xF00) | pIMUScale[2]; + sAccelRawY = ((pIMUScale[5] << 8) & 0xF00) | pIMUScale[4]; + sAccelRawZ = ((pIMUScale[7] << 8) & 0xF00) | pIMUScale[6]; + + sGyroRawX = ((pIMUScale[15] << 8) & 0xF00) | pIMUScale[14]; + sGyroRawY = ((pIMUScale[17] << 8) & 0xF00) | pIMUScale[16]; + sGyroRawZ = ((pIMUScale[19] << 8) & 0xF00) | pIMUScale[18]; + } + + /* Accelerometer scale */ + ctx->m_IMUScaleData.fAccelScaleX = SWITCH_ACCEL_SCALE_MULT / (float)(SWITCH_ACCEL_SCALE_OFFSET - (float)sAccelRawX) * SDL_STANDARD_GRAVITY; + ctx->m_IMUScaleData.fAccelScaleY = SWITCH_ACCEL_SCALE_MULT / (float)(SWITCH_ACCEL_SCALE_OFFSET - (float)sAccelRawY) * SDL_STANDARD_GRAVITY; + ctx->m_IMUScaleData.fAccelScaleZ = SWITCH_ACCEL_SCALE_MULT / (float)(SWITCH_ACCEL_SCALE_OFFSET - (float)sAccelRawZ) * SDL_STANDARD_GRAVITY; + + /* Gyro scale */ + ctx->m_IMUScaleData.fGyroScaleX = SWITCH_GYRO_SCALE_MULT / (float)(SWITCH_GYRO_SCALE_OFFSET - (float)sGyroRawX) * (float)M_PI / 180.0f; + ctx->m_IMUScaleData.fGyroScaleY = SWITCH_GYRO_SCALE_MULT / (float)(SWITCH_GYRO_SCALE_OFFSET - (float)sGyroRawY) * (float)M_PI / 180.0f; + ctx->m_IMUScaleData.fGyroScaleZ = SWITCH_GYRO_SCALE_MULT / (float)(SWITCH_GYRO_SCALE_OFFSET - (float)sGyroRawZ) * (float)M_PI / 180.0f; + + return SDL_TRUE; +} + + static Sint16 ApplyStickCalibrationCentered(SDL_DriverSwitch_Context *ctx, int nStick, int nAxis, Sint16 sRawValue, Sint16 sCenter) { sRawValue -= sCenter; @@ -825,9 +1069,125 @@ return button; } +static int +GetMaxWriteAttempts(SDL_HIDAPI_Device *device) +{ + if (device->vendor_id == USB_VENDOR_NINTENDO && + device->product_id == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_GRIP) { + /* This device is a little slow and we know we're always on USB */ + return 20; + } else { + return 5; + } +} + +static ESwitchDeviceInfoControllerType +ReadJoyConControllerType(SDL_HIDAPI_Device *device) +{ + ESwitchDeviceInfoControllerType eControllerType = k_eSwitchDeviceInfoControllerType_Unknown; + + /* Create enough of a context to read the controller type from the device */ + SDL_DriverSwitch_Context *ctx = (SDL_DriverSwitch_Context *)SDL_calloc(1, sizeof(*ctx)); + if (ctx) { + ctx->device = device; + ctx->m_bSyncWrite = SDL_TRUE; + ctx->m_nMaxWriteAttempts = GetMaxWriteAttempts(device); + + device->dev = SDL_hid_open_path(device->path, 0); + if (device->dev) { + if (WriteProprietary(ctx, k_eSwitchProprietaryCommandIDs_Status, NULL, 0, SDL_TRUE)) { + SwitchProprietaryStatusPacket_t *status = (SwitchProprietaryStatusPacket_t *)&ctx->m_rgucReadBuffer[0]; + + eControllerType = (ESwitchDeviceInfoControllerType) status->ucDeviceType; + + /* The N64 controller reports as a Pro controller over USB */ + if (eControllerType == k_eSwitchDeviceInfoControllerType_ProController && + device->product_id == USB_PRODUCT_NINTENDO_N64_CONTROLLER) { + eControllerType = k_eSwitchDeviceInfoControllerType_N64; + } + } else { + SwitchSubcommandInputPacket_t *reply = NULL; + + ctx->m_bUsingBluetooth = SDL_TRUE; + if (WriteSubcommand(ctx, k_eSwitchSubcommandIDs_RequestDeviceInfo, NULL, 0, &reply)) { + eControllerType = (ESwitchDeviceInfoControllerType)reply->deviceInfo.ucDeviceType; + } + } + SDL_hid_close(device->dev); + device->dev = NULL; + } + SDL_free(ctx); + } + return eControllerType; +} + +static void +UpdateDeviceName(SDL_HIDAPI_Device *device, ESwitchDeviceInfoControllerType eControllerType) +{ + const char *name = NULL; + + switch (eControllerType) { + case k_eSwitchDeviceInfoControllerType_JoyConLeft: + name = "Nintendo Switch Joy-Con (L)"; + break; + case k_eSwitchDeviceInfoControllerType_JoyConRight: + name = "Nintendo Switch Joy-Con (R)"; + break; + case k_eSwitchDeviceInfoControllerType_ProController: + name = "Nintendo Switch Pro Controller"; + break; + case k_eSwitchDeviceInfoControllerType_NESLeft: + name = "Nintendo NES Controller (L)"; + break; + case k_eSwitchDeviceInfoControllerType_NESRight: + name = "Nintendo NES Controller (R)"; + break; + case k_eSwitchDeviceInfoControllerType_SNES: + name = "Nintendo SNES Controller"; + break; + case k_eSwitchDeviceInfoControllerType_N64: + name = "Nintendo N64 Controller"; + break; + case k_eSwitchDeviceInfoControllerType_SEGA_Genesis: + name = "Nintendo SEGA Genesis Controller"; + break; + default: + break; + } + + if (name && (!name || SDL_strcmp(name, device->name) != 0)) { + SDL_free(device->name); + device->name = SDL_strdup(name); + } +} + static SDL_bool HIDAPI_DriverSwitch_InitDevice(SDL_HIDAPI_Device *device) { + /* The NES controllers need additional fix up, since we can't detect them without opening the device */ + if (device->vendor_id == USB_VENDOR_NINTENDO) { + ESwitchDeviceInfoControllerType eControllerType = ReadJoyConControllerType(device); + switch (eControllerType) { + case k_eSwitchDeviceInfoControllerType_Unknown: + /* This might be a Joy-Con that's missing from a charging grip slot */ + if (device->product_id == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_GRIP) { + if (device->interface_number == 1) { + SDL_free(device->name); + device->name = SDL_strdup("Nintendo Switch Joy-Con (L)"); + device->guid.data[15] = k_eSwitchDeviceInfoControllerType_JoyConLeft; + } else { + SDL_free(device->name); + device->name = SDL_strdup("Nintendo Switch Joy-Con (R)"); + device->guid.data[15] = k_eSwitchDeviceInfoControllerType_JoyConRight; + } + } + break; + default: + UpdateDeviceName(device, eControllerType); + device->guid.data[15] = eControllerType; + break; + } + } return HIDAPI_JoystickConnected(device, NULL); } @@ -840,6 +1200,15 @@ static void HIDAPI_DriverSwitch_SetDevicePlayerIndex(SDL_HIDAPI_Device *device, SDL_JoystickID instance_id, int player_index) { + SDL_DriverSwitch_Context *ctx = (SDL_DriverSwitch_Context *)device->context; + + if (!ctx) { + return; + } + + ctx->m_nPlayerIndex = player_index; + + UpdateSlotLED(ctx); } static SDL_bool @@ -861,12 +1230,12 @@ SDL_SetError("Couldn't open %s", device->path); goto error; } + ctx->m_nMaxWriteAttempts = GetMaxWriteAttempts(device); + ctx->m_bSyncWrite = SDL_TRUE; /* Find out whether or not we can send output reports */ ctx->m_bInputOnly = SDL_IsJoystickNintendoSwitchProInputOnly(device->vendor_id, device->product_id); if (!ctx->m_bInputOnly) { - ctx->m_bHasHomeLED = HasHomeLED(device->vendor_id, device->product_id); - /* Initialize rumble data */ SetNeutralRumble(&ctx->m_RumblePacket.rumbleData[0]); SetNeutralRumble(&ctx->m_RumblePacket.rumbleData[1]); @@ -895,18 +1264,23 @@ * HandleFullControllerState is completely pointless. We need full state if we want battery * level and we only care about battery level over bluetooth anyway. */ - if (device->vendor_id == USB_VENDOR_NINTENDO && - (device->product_id == USB_PRODUCT_NINTENDO_SWITCH_PRO || - device->product_id == USB_PRODUCT_NINTENDO_SWITCH_JOY_CON_GRIP || - device->product_id == USB_PRODUCT_NINTENDO_SWITCH_JOY_CON_LEFT || - device->product_id == USB_PRODUCT_NINTENDO_SWITCH_JOY_CON_RIGHT)) { + if (device->vendor_id == USB_VENDOR_NINTENDO) { input_mode = k_eSwitchInputReportIDs_FullControllerState; } - if (input_mode == k_eSwitchInputReportIDs_FullControllerState) { - SDL_PrivateJoystickAddSensor(joystick, SDL_SENSOR_GYRO, 200.0f); - SDL_PrivateJoystickAddSensor(joystick, SDL_SENSOR_ACCEL, 200.0f); - ctx->m_bHasSensors = SDL_TRUE; + if (input_mode == k_eSwitchInputReportIDs_FullControllerState && + ctx->m_eControllerType != k_eSwitchDeviceInfoControllerType_NESLeft && + ctx->m_eControllerType != k_eSwitchDeviceInfoControllerType_NESRight && + ctx->m_eControllerType != k_eSwitchDeviceInfoControllerType_SNES && + ctx->m_eControllerType != k_eSwitchDeviceInfoControllerType_N64 && + ctx->m_eControllerType != k_eSwitchDeviceInfoControllerType_SEGA_Genesis) { + /* Use the right sensor in the combined Joy-Con pair */ + if (!device->parent || + ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConRight) { + SDL_PrivateJoystickAddSensor(joystick, SDL_SENSOR_GYRO, 200.0f); + SDL_PrivateJoystickAddSensor(joystick, SDL_SENSOR_ACCEL, 200.0f); + ctx->m_bHasSensors = SDL_TRUE; + } } if (!LoadStickCalibration(ctx, input_mode)) { @@ -914,6 +1288,11 @@ goto error; } + if (!LoadIMUCalibration(ctx)) { + SDL_SetError("Couldn't load sensor calibration"); + goto error; + } + if (!SetVibrationEnabled(ctx, 1)) { SDL_SetError("Couldn't enable vibration"); goto error; @@ -935,17 +1314,16 @@ } /* Set the LED state */ - if (ctx->m_bHasHomeLED) { - const char *hint = SDL_GetHint(SDL_HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED); - if (hint && *hint) { - if (SDL_GetStringBoolean(hint, SDL_TRUE)) { - SetHomeLED(ctx, 100); - } else { - SetHomeLED(ctx, 0); - } + if (HasHomeLED(ctx)) { + if (ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConLeft || + ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConRight) { + SDL_AddHintCallback(SDL_HINT_JOYSTICK_HIDAPI_JOYCON_HOME_LED, + SDL_HomeLEDHintChanged, ctx); + } else { + SDL_AddHintCallback(SDL_HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED, + SDL_HomeLEDHintChanged, ctx); } } - SetSlotLED(ctx, (joystick->instance_id % 4)); /* Set the serial number */ { @@ -958,6 +1336,9 @@ ctx->m_rgucMACAddress[3], ctx->m_rgucMACAddress[4], ctx->m_rgucMACAddress[5]); + if (joystick->serial) { + SDL_free(joystick->serial); + } joystick->serial = SDL_strdup(serial); } } @@ -967,18 +1348,29 @@ ctx->m_bIsGameCube = SDL_TRUE; } - SDL_AddHintCallback(SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS, - SDL_GameControllerButtonReportingHintChanged, ctx); - - /* Initialize the joystick capabilities */ - if (ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConLeft || - ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConRight) { - joystick->nbuttons = 20; + if (AlwaysUsesLabels(device->vendor_id, device->product_id, ctx->m_eControllerType)) { + ctx->m_bUseButtonLabels = SDL_TRUE; } else { - joystick->nbuttons = 16; + SDL_AddHintCallback(SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS, + SDL_GameControllerButtonReportingHintChanged, ctx); } + + /* Initialize player index (needed for setting LEDs) */ + ctx->m_nPlayerIndex = SDL_JoystickGetPlayerIndex(joystick); + ctx->m_bPlayerLights = SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED, SDL_TRUE); + UpdateSlotLED(ctx); + + SDL_AddHintCallback(SDL_HINT_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED, + SDL_PlayerLEDHintChanged, ctx); + + /* Initialize the joystick capabilities */ + joystick->nbuttons = 16; joystick->naxes = SDL_CONTROLLER_AXIS_MAX; - joystick->epowerlevel = SDL_JOYSTICK_POWER_WIRED; + joystick->epowerlevel = ctx->m_bUsingBluetooth ? SDL_JOYSTICK_POWER_UNKNOWN : SDL_JOYSTICK_POWER_WIRED; + + /* Set up for input */ + ctx->m_bSyncWrite = SDL_FALSE; + ctx->m_unLastIMUReset = ctx->m_unLastInput = SDL_GetTicks(); return SDL_TRUE; @@ -1069,6 +1461,16 @@ return SDL_Unsupported(); } + if (device->parent) { + if (ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConLeft) { + /* Just handle low frequency rumble */ + high_frequency_rumble = 0; + } else if (ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConRight) { + /* Just handle high frequency rumble */ + low_frequency_rumble = 0; + } + } + if (ctx->m_bRumblePending) { if (HIDAPI_DriverSwitch_SendPendingRumble(ctx) < 0) { return -1; @@ -1146,20 +1548,6 @@ return 0; } -static float -HIDAPI_DriverSwitch_ScaleGyro(Sint16 value) -{ - float result = (value / SWITCH_GYRO_SCALE) * (float)M_PI / 180.0f; - return result; -} - -static float -HIDAPI_DriverSwitch_ScaleAccel(Sint16 value) -{ - float result = (value / SWITCH_ACCEL_SCALE) * SDL_STANDARD_GRAVITY; - return result; -} - static void HandleInputOnlyControllerState(SDL_Joystick *joystick, SDL_DriverSwitch_Context *ctx, SwitchInputOnlyControllerStatePacket_t *packet) { Sint16 axis; @@ -1357,13 +1745,13 @@ * users will want consistent axis mappings across devices. */ if (type == SDL_SENSOR_GYRO) { - data[0] = -HIDAPI_DriverSwitch_ScaleGyro(values[1]); - data[1] = HIDAPI_DriverSwitch_ScaleGyro(values[2]); - data[2] = -HIDAPI_DriverSwitch_ScaleGyro(values[0]); + data[0] = -(ctx->m_IMUScaleData.fGyroScaleY * (float)values[1]); + data[1] = ctx->m_IMUScaleData.fGyroScaleZ * (float)values[2]; + data[2] = -(ctx->m_IMUScaleData.fGyroScaleX * (float)values[0]); } else { - data[0] = -HIDAPI_DriverSwitch_ScaleAccel(values[1]); - data[1] = HIDAPI_DriverSwitch_ScaleAccel(values[2]); - data[2] = -HIDAPI_DriverSwitch_ScaleAccel(values[0]); + data[0] = -(ctx->m_IMUScaleData.fAccelScaleY * (float)values[1]); + data[1] = ctx->m_IMUScaleData.fAccelScaleZ * (float)values[2]; + data[2] = -(ctx->m_IMUScaleData.fAccelScaleX * (float)values[0]); } /* Right Joy-Con flips some axes, so let's flip them back for consistency */ @@ -1372,36 +1760,33 @@ data[1] = -data[1]; } + if (ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConLeft && + !ctx->device->parent) { + /* Mini-gamepad mode, swap some axes around */ + float tmp = data[2]; + data[2] = -data[0]; + data[0] = tmp; + } + + if (ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConRight && + !ctx->device->parent) { + /* Mini-gamepad mode, swap some axes around */ + float tmp = data[2]; + data[2] = data[0]; + data[0] = -tmp; + } + SDL_PrivateJoystickSensor(joystick, type, data, 3); } -static void HandleFullControllerState(SDL_Joystick *joystick, SDL_DriverSwitch_Context *ctx, SwitchStatePacket_t *packet) +static void HandleCombinedControllerStateL(SDL_Joystick *joystick, SDL_DriverSwitch_Context *ctx, SwitchStatePacket_t *packet) { Sint16 axis; - if (packet->controllerState.rgucButtons[0] != ctx->m_lastFullState.controllerState.rgucButtons[0]) { - Uint8 data = packet->controllerState.rgucButtons[0]; - SDL_PrivateJoystickButton(joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_A), (data & 0x08) ? SDL_PRESSED : SDL_RELEASED); - SDL_PrivateJoystickButton(joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_B), (data & 0x04) ? SDL_PRESSED : SDL_RELEASED); - SDL_PrivateJoystickButton(joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_X), (data & 0x02) ? SDL_PRESSED : SDL_RELEASED); - SDL_PrivateJoystickButton(joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_Y), (data & 0x01) ? SDL_PRESSED : SDL_RELEASED); - if (ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConRight) { - SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_PADDLE1, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED); - SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_PADDLE3, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED); - } - SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED); - axis = (data & 0x80) ? 32767 : -32768; - SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis); - } - if (packet->controllerState.rgucButtons[1] != ctx->m_lastFullState.controllerState.rgucButtons[1]) { Uint8 data = packet->controllerState.rgucButtons[1]; SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_BACK, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED); - SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_START, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED); - SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_RIGHTSTICK, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED); SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data & 0x08) ? SDL_PRESSED : SDL_RELEASED); - - SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED); SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_MISC1, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED); } @@ -1411,10 +1796,6 @@ SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED); SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED); SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, (data & 0x08) ? SDL_PRESSED : SDL_RELEASED); - if (ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConLeft) { - SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_PADDLE4, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED); - SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_PADDLE2, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED); - } SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED); axis = (data & 0x80) ? 32767 : -32768; SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis); @@ -1427,6 +1808,59 @@ axis = ((packet->controllerState.rgucJoystickLeft[1] & 0xF0) >> 4) | (packet->controllerState.rgucJoystickLeft[2] << 4); axis = ApplyStickCalibration(ctx, 0, 1, axis); SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTY, ~axis); +} + +static void HandleMiniControllerStateL(SDL_Joystick *joystick, SDL_DriverSwitch_Context *ctx, SwitchStatePacket_t *packet) +{ + Sint16 axis; + + if (packet->controllerState.rgucButtons[1] != ctx->m_lastFullState.controllerState.rgucButtons[1]) { + Uint8 data = packet->controllerState.rgucButtons[1]; + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_START, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data & 0x08) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED); + } + + if (packet->controllerState.rgucButtons[2] != ctx->m_lastFullState.controllerState.rgucButtons[2]) { + Uint8 data = packet->controllerState.rgucButtons[2]; + SDL_PrivateJoystickButton(joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_A), (data & 0x01) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_Y), (data & 0x02) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_X), (data & 0x04) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_B), (data & 0x08) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED); + } + + axis = packet->controllerState.rgucJoystickLeft[0] | ((packet->controllerState.rgucJoystickLeft[1] & 0xF) << 8); + axis = ApplyStickCalibration(ctx, 0, 0, axis); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTY, ~axis); + + axis = ((packet->controllerState.rgucJoystickLeft[1] & 0xF0) >> 4) | (packet->controllerState.rgucJoystickLeft[2] << 4); + axis = ApplyStickCalibration(ctx, 0, 1, axis); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTX, ~axis); +} + +static void HandleCombinedControllerStateR(SDL_Joystick *joystick, SDL_DriverSwitch_Context *ctx, SwitchStatePacket_t *packet) +{ + Sint16 axis; + + if (packet->controllerState.rgucButtons[0] != ctx->m_lastFullState.controllerState.rgucButtons[0]) { + Uint8 data = packet->controllerState.rgucButtons[0]; + SDL_PrivateJoystickButton(joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_A), (data & 0x08) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_B), (data & 0x04) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_X), (data & 0x02) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_Y), (data & 0x01) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED); + axis = (data & 0x80) ? 32767 : -32768; + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis); + } + + if (packet->controllerState.rgucButtons[1] != ctx->m_lastFullState.controllerState.rgucButtons[1]) { + Uint8 data = packet->controllerState.rgucButtons[1]; + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_START, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_RIGHTSTICK, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED); + } axis = packet->controllerState.rgucJoystickRight[0] | ((packet->controllerState.rgucJoystickRight[1] & 0xF) << 8); axis = ApplyStickCalibration(ctx, 1, 0, axis); @@ -1435,36 +1869,164 @@ axis = ((packet->controllerState.rgucJoystickRight[1] & 0xF0) >> 4) | (packet->controllerState.rgucJoystickRight[2] << 4); axis = ApplyStickCalibration(ctx, 1, 1, axis); SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, ~axis); +} + +static void HandleMiniControllerStateR(SDL_Joystick *joystick, SDL_DriverSwitch_Context *ctx, SwitchStatePacket_t *packet) +{ + Sint16 axis; + + if (packet->controllerState.rgucButtons[0] != ctx->m_lastFullState.controllerState.rgucButtons[0]) { + Uint8 data = packet->controllerState.rgucButtons[0]; + SDL_PrivateJoystickButton(joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_B), (data & 0x08) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_Y), (data & 0x04) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_A), (data & 0x02) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_X), (data & 0x01) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED); + } + + if (packet->controllerState.rgucButtons[1] != ctx->m_lastFullState.controllerState.rgucButtons[1]) { + Uint8 data = packet->controllerState.rgucButtons[1]; + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_START, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED); + } + + axis = packet->controllerState.rgucJoystickRight[0] | ((packet->controllerState.rgucJoystickRight[1] & 0xF) << 8); + axis = ApplyStickCalibration(ctx, 1, 0, axis); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTY, axis); + + axis = ((packet->controllerState.rgucJoystickRight[1] & 0xF0) >> 4) | (packet->controllerState.rgucJoystickRight[2] << 4); + axis = ApplyStickCalibration(ctx, 1, 1, axis); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTX, axis); +} + +static void HandleFullControllerState(SDL_Joystick *joystick, SDL_DriverSwitch_Context *ctx, SwitchStatePacket_t *packet) +{ + if (ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConLeft) { + if (ctx->device->parent) { + HandleCombinedControllerStateL(joystick, ctx, packet); + } else { + HandleMiniControllerStateL(joystick, ctx, packet); + } + } else if (ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConRight) { + if (ctx->device->parent) { + HandleCombinedControllerStateR(joystick, ctx, packet); + } else { + HandleMiniControllerStateR(joystick, ctx, packet); + } + } else { + Sint16 axis; + + if (packet->controllerState.rgucButtons[0] != ctx->m_lastFullState.controllerState.rgucButtons[0]) { + Uint8 data = packet->controllerState.rgucButtons[0]; + SDL_PrivateJoystickButton(joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_A), (data & 0x08) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_B), (data & 0x04) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_X), (data & 0x02) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, RemapButton(ctx, SDL_CONTROLLER_BUTTON_Y), (data & 0x01) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED); + axis = (data & 0x80) ? 32767 : -32768; + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis); + } + + if (packet->controllerState.rgucButtons[1] != ctx->m_lastFullState.controllerState.rgucButtons[1]) { + Uint8 data = packet->controllerState.rgucButtons[1]; + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_BACK, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_START, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_RIGHTSTICK, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, (data & 0x08) ? SDL_PRESSED : SDL_RELEASED); + + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data & 0x10) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_MISC1, (data & 0x20) ? SDL_PRESSED : SDL_RELEASED); + } + + if (packet->controllerState.rgucButtons[2] != ctx->m_lastFullState.controllerState.rgucButtons[2]) { + Uint8 data = packet->controllerState.rgucButtons[2]; + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, (data & 0x04) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, (data & 0x08) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, (data & 0x40) ? SDL_PRESSED : SDL_RELEASED); + axis = (data & 0x80) ? 32767 : -32768; + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis); + } + + axis = packet->controllerState.rgucJoystickLeft[0] | ((packet->controllerState.rgucJoystickLeft[1] & 0xF) << 8); + axis = ApplyStickCalibration(ctx, 0, 0, axis); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTX, axis); + + axis = ((packet->controllerState.rgucJoystickLeft[1] & 0xF0) >> 4) | (packet->controllerState.rgucJoystickLeft[2] << 4); + axis = ApplyStickCalibration(ctx, 0, 1, axis); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTY, ~axis); + + axis = packet->controllerState.rgucJoystickRight[0] | ((packet->controllerState.rgucJoystickRight[1] & 0xF) << 8); + axis = ApplyStickCalibration(ctx, 1, 0, axis); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTX, axis); + + axis = ((packet->controllerState.rgucJoystickRight[1] & 0xF0) >> 4) | (packet->controllerState.rgucJoystickRight[2] << 4); + axis = ApplyStickCalibration(ctx, 1, 1, axis); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, ~axis); + } /* High nibble of battery/connection byte is battery level, low nibble is connection status * LSB of connection nibble is USB/Switch connection status */ if (packet->controllerState.ucBatteryAndConnection & 0x1) { - joystick->epowerlevel = SDL_JOYSTICK_POWER_WIRED; + SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_WIRED); } else { /* LSB of the battery nibble is used to report charging. * The battery level is reported from 0(empty)-8(full) */ int level = (packet->controllerState.ucBatteryAndConnection & 0xE0) >> 4; if (level == 0) { - joystick->epowerlevel = SDL_JOYSTICK_POWER_EMPTY; + SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_EMPTY); } else if (level <= 2) { - joystick->epowerlevel = SDL_JOYSTICK_POWER_LOW; + SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_LOW); } else if (level <= 6) { - joystick->epowerlevel = SDL_JOYSTICK_POWER_MEDIUM; + SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_MEDIUM); } else { - joystick->epowerlevel = SDL_JOYSTICK_POWER_FULL; + SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_FULL); } } if (ctx->m_bReportSensors) { - SendSensorUpdate(joystick, ctx, SDL_SENSOR_GYRO, &packet->imuState[2].sGyroX); - SendSensorUpdate(joystick, ctx, SDL_SENSOR_GYRO, &packet->imuState[1].sGyroX); - SendSensorUpdate(joystick, ctx, SDL_SENSOR_GYRO, &packet->imuState[0].sGyroX); - - SendSensorUpdate(joystick, ctx, SDL_SENSOR_ACCEL, &packet->imuState[2].sAccelX); - SendSensorUpdate(joystick, ctx, SDL_SENSOR_ACCEL, &packet->imuState[1].sAccelX); - SendSensorUpdate(joystick, ctx, SDL_SENSOR_ACCEL, &packet->imuState[0].sAccelX); + SDL_bool bHasSensorData = (packet->imuState[0].sAccelZ != 0 || + packet->imuState[0].sAccelY != 0 || + packet->imuState[0].sAccelX != 0); + if (bHasSensorData) { + ctx->m_bHasSensorData = SDL_TRUE; + + SendSensorUpdate(joystick, ctx, SDL_SENSOR_GYRO, &packet->imuState[2].sGyroX); + SendSensorUpdate(joystick, ctx, SDL_SENSOR_GYRO, &packet->imuState[1].sGyroX); + SendSensorUpdate(joystick, ctx, SDL_SENSOR_GYRO, &packet->imuState[0].sGyroX); + + SendSensorUpdate(joystick, ctx, SDL_SENSOR_ACCEL, &packet->imuState[2].sAccelX); + SendSensorUpdate(joystick, ctx, SDL_SENSOR_ACCEL, &packet->imuState[1].sAccelX); + SendSensorUpdate(joystick, ctx, SDL_SENSOR_ACCEL, &packet->imuState[0].sAccelX); + + } else if (ctx->m_bHasSensorData) { + /* Uh oh, someone turned off the IMU? */ + const Uint32 IMU_RESET_DELAY_MS = 3000; + Uint32 now = SDL_GetTicks(); + + if (SDL_TICKS_PASSED(now, ctx->m_unLastIMUReset + IMU_RESET_DELAY_MS)) { + SDL_HIDAPI_Device *device = ctx->device; + + if (device->updating) { + SDL_UnlockMutex(device->dev_lock); + } + + SetIMUEnabled(ctx, SDL_TRUE); + + if (device->updating) { + SDL_LockMutex(device->dev_lock); + } + ctx->m_unLastIMUReset = now; + } + + } else { + /* We have never gotten IMU data, probably not supported on this device */ + } } ctx->m_lastFullState = *packet; @@ -1476,6 +2038,7 @@ SDL_DriverSwitch_Context *ctx = (SDL_DriverSwitch_Context *)device->context; SDL_Joystick *joystick = NULL; int size; + Uint32 now; if (device->num_joysticks > 0) { joystick = SDL_JoystickFromInstanceID(device->joysticks[0]); @@ -1484,6 +2047,8 @@ return SDL_FALSE; } + now = SDL_GetTicks(); + while ((size = ReadInput(ctx)) > 0) { #ifdef DEBUG_SWITCH_PROTOCOL HIDAPI_DumpPacket("Nintendo Switch packet: size = %d", ctx->m_rgucReadBuffer, size); @@ -1502,14 +2067,30 @@ break; } } + ctx->m_unLastInput = now; + } + + if (!ctx->m_bInputOnly && !ctx->m_bUsingBluetooth && + ctx->device->product_id != USB_PRODUCT_NINTENDO_SWITCH_JOYCON_GRIP) { + const Uint32 INPUT_WAIT_TIMEOUT_MS = 100; + if (SDL_TICKS_PASSED(now, ctx->m_unLastInput + INPUT_WAIT_TIMEOUT_MS)) { + /* Steam may have put the controller back into non-reporting mode */ + WriteProprietary(ctx, k_eSwitchProprietaryCommandIDs_ForceUSB, NULL, 0, SDL_FALSE); + } + } else if (ctx->m_bUsingBluetooth) { + const Uint32 INPUT_WAIT_TIMEOUT_MS = 3000; + if (SDL_TICKS_PASSED(now, ctx->m_unLastInput + INPUT_WAIT_TIMEOUT_MS)) { + /* Bluetooth may have disconnected, try reopening the controller */ + size = -1; + } } if (ctx->m_bRumblePending || ctx->m_bRumbleZeroPending) { HIDAPI_DriverSwitch_SendPendingRumble(ctx); } else if (ctx->m_bRumbleActive && - SDL_TICKS_PASSED(SDL_GetTicks(), ctx->m_unRumbleSent + RUMBLE_REFRESH_FREQUENCY_MS)) { + SDL_TICKS_PASSED(now, ctx->m_unRumbleSent + RUMBLE_REFRESH_FREQUENCY_MS)) { #ifdef DEBUG_RUMBLE - SDL_Log("Sent continuing rumble, %d ms after previous rumble\n", SDL_GetTicks() - ctx->m_unRumbleSent); + SDL_Log("Sent continuing rumble, %d ms after previous rumble\n", now - ctx->m_unRumbleSent); #endif WriteRumble(ctx); } @@ -1534,6 +2115,18 @@ SDL_DelHintCallback(SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS, SDL_GameControllerButtonReportingHintChanged, ctx); + if (ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConLeft || + ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConRight) { + SDL_DelHintCallback(SDL_HINT_JOYSTICK_HIDAPI_JOYCON_HOME_LED, + SDL_HomeLEDHintChanged, ctx); + } else { + SDL_DelHintCallback(SDL_HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED, + SDL_HomeLEDHintChanged, ctx); + } + + SDL_DelHintCallback(SDL_HINT_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED, + SDL_PlayerLEDHintChanged, ctx); + SDL_LockMutex(device->dev_lock); { SDL_hid_close(device->dev); @@ -1550,6 +2143,50 @@ { } +SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverNintendoClassic = +{ + SDL_HINT_JOYSTICK_HIDAPI_NINTENDO_CLASSIC, + SDL_TRUE, + SDL_TRUE, + HIDAPI_DriverNintendoClassic_IsSupportedDevice, + HIDAPI_DriverSwitch_GetDeviceName, + HIDAPI_DriverSwitch_InitDevice, + HIDAPI_DriverSwitch_GetDevicePlayerIndex, + HIDAPI_DriverSwitch_SetDevicePlayerIndex, + HIDAPI_DriverSwitch_UpdateDevice, + HIDAPI_DriverSwitch_OpenJoystick, + HIDAPI_DriverSwitch_RumbleJoystick, + HIDAPI_DriverSwitch_RumbleJoystickTriggers, + HIDAPI_DriverSwitch_GetJoystickCapabilities, + HIDAPI_DriverSwitch_SetJoystickLED, + HIDAPI_DriverSwitch_SendJoystickEffect, + HIDAPI_DriverSwitch_SetJoystickSensorsEnabled, + HIDAPI_DriverSwitch_CloseJoystick, + HIDAPI_DriverSwitch_FreeDevice, +}; + +SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverJoyCons = +{ + SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, + SDL_TRUE, + SDL_TRUE, + HIDAPI_DriverJoyCons_IsSupportedDevice, + HIDAPI_DriverSwitch_GetDeviceName, + HIDAPI_DriverSwitch_InitDevice, + HIDAPI_DriverSwitch_GetDevicePlayerIndex, + HIDAPI_DriverSwitch_SetDevicePlayerIndex, + HIDAPI_DriverSwitch_UpdateDevice, + HIDAPI_DriverSwitch_OpenJoystick, + HIDAPI_DriverSwitch_RumbleJoystick, + HIDAPI_DriverSwitch_RumbleJoystickTriggers, + HIDAPI_DriverSwitch_GetJoystickCapabilities, + HIDAPI_DriverSwitch_SetJoystickLED, + HIDAPI_DriverSwitch_SendJoystickEffect, + HIDAPI_DriverSwitch_SetJoystickSensorsEnabled, + HIDAPI_DriverSwitch_CloseJoystick, + HIDAPI_DriverSwitch_FreeDevice, +}; + SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverSwitch = { SDL_HINT_JOYSTICK_HIDAPI_SWITCH, diff -Nru libsdl2-2.0.22+dfsg/src/joystick/hidapi/SDL_hidapi_xbox360.c libsdl2-2.24.0+dfsg/src/joystick/hidapi/SDL_hidapi_xbox360.c --- libsdl2-2.0.22+dfsg/src/joystick/hidapi/SDL_hidapi_xbox360.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/hidapi/SDL_hidapi_xbox360.c 2022-08-13 03:48:10.000000000 +0000 @@ -83,7 +83,7 @@ } static const char * -HIDAPI_DriverXbox360_GetDeviceName(Uint16 vendor_id, Uint16 product_id) +HIDAPI_DriverXbox360_GetDeviceName(const char *name, Uint16 vendor_id, Uint16 product_id) { return NULL; } @@ -263,16 +263,16 @@ SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis); axis = ((int)data[5] * 257) - 32768; SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis); - axis = *(Sint16*)(&data[6]); + axis = SDL_SwapLE16(*(Sint16*)(&data[6])); SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTX, axis); - axis = *(Sint16*)(&data[8]); + axis = SDL_SwapLE16(*(Sint16*)(&data[8])); if (invert_y_axes) { axis = ~axis; } SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTY, axis); - axis = *(Sint16*)(&data[10]); + axis = SDL_SwapLE16(*(Sint16*)(&data[10])); SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTX, axis); - axis = *(Sint16*)(&data[12]); + axis = SDL_SwapLE16(*(Sint16*)(&data[12])); if (invert_y_axes) { axis = ~axis; } diff -Nru libsdl2-2.0.22+dfsg/src/joystick/hidapi/SDL_hidapi_xbox360w.c libsdl2-2.24.0+dfsg/src/joystick/hidapi/SDL_hidapi_xbox360w.c --- libsdl2-2.0.22+dfsg/src/joystick/hidapi/SDL_hidapi_xbox360w.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/hidapi/SDL_hidapi_xbox360w.c 2022-08-13 03:48:10.000000000 +0000 @@ -57,7 +57,7 @@ } static const char * -HIDAPI_DriverXbox360W_GetDeviceName(Uint16 vendor_id, Uint16 product_id) +HIDAPI_DriverXbox360W_GetDeviceName(const char *name, Uint16 vendor_id, Uint16 product_id) { return "Xbox 360 Wireless Controller"; } @@ -81,13 +81,13 @@ float normalized_level = (float)level / 255.0f; if (normalized_level <= 0.05f) { - joystick->epowerlevel = SDL_JOYSTICK_POWER_EMPTY; + SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_EMPTY); } else if (normalized_level <= 0.20f) { - joystick->epowerlevel = SDL_JOYSTICK_POWER_LOW; + SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_LOW); } else if (normalized_level <= 0.70f) { - joystick->epowerlevel = SDL_JOYSTICK_POWER_MEDIUM; + SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_MEDIUM); } else { - joystick->epowerlevel = SDL_JOYSTICK_POWER_FULL; + SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_FULL); } } @@ -229,16 +229,16 @@ SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis); axis = ((int)data[5] * 257) - 32768; SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis); - axis = *(Sint16*)(&data[6]); + axis = SDL_SwapLE16(*(Sint16*)(&data[6])); SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTX, axis); - axis = *(Sint16*)(&data[8]); + axis = SDL_SwapLE16(*(Sint16*)(&data[8])); if (invert_y_axes) { axis = ~axis; } SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTY, axis); - axis = *(Sint16*)(&data[10]); + axis = SDL_SwapLE16(*(Sint16*)(&data[10])); SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTX, axis); - axis = *(Sint16*)(&data[12]); + axis = SDL_SwapLE16(*(Sint16*)(&data[12])); if (invert_y_axes) { axis = ~axis; } diff -Nru libsdl2-2.0.22+dfsg/src/joystick/hidapi/SDL_hidapi_xboxone.c libsdl2-2.24.0+dfsg/src/joystick/hidapi/SDL_hidapi_xboxone.c --- libsdl2-2.0.22+dfsg/src/joystick/hidapi/SDL_hidapi_xboxone.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/hidapi/SDL_hidapi_xboxone.c 2022-08-13 03:48:10.000000000 +0000 @@ -156,7 +156,7 @@ static void SendAckIfNeeded(SDL_HIDAPI_Device *device, Uint8 *data, int size) { -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__WINGDK__) /* The Windows driver is taking care of acks */ #else if ((data[1] & 0x30) == 0x30) { @@ -179,7 +179,7 @@ SDL_SetError("Couldn't send ack packet"); } } -#endif /* __WIN32__ */ +#endif /* defined(__WIN32__) || defined(__WINGDK__ */ } #if 0 @@ -285,7 +285,7 @@ } static const char * -HIDAPI_DriverXboxOne_GetDeviceName(Uint16 vendor_id, Uint16 product_id) +HIDAPI_DriverXboxOne_GetDeviceName(const char *name, Uint16 vendor_id, Uint16 product_id) { return NULL; } @@ -605,7 +605,7 @@ } } - axis = ((int)*(Sint16*)(&data[6]) * 64) - 32768; + axis = ((int)SDL_SwapLE16(*(Sint16*)(&data[6])) * 64) - 32768; if (axis == 32704) { axis = 32767; } @@ -614,7 +614,7 @@ } SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis); - axis = ((int)*(Sint16*)(&data[8]) * 64) - 32768; + axis = ((int)SDL_SwapLE16(*(Sint16*)(&data[8])) * 64) - 32768; if (axis == -32768 && size == 30 && (data[22] & 0x40) != 0) { axis = 32767; } @@ -623,13 +623,13 @@ } SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis); - axis = *(Sint16*)(&data[10]); + axis = SDL_SwapLE16(*(Sint16*)(&data[10])); SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTX, axis); - axis = *(Sint16*)(&data[12]); + axis = SDL_SwapLE16(*(Sint16*)(&data[12])); SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTY, ~axis); - axis = *(Sint16*)(&data[14]); + axis = SDL_SwapLE16(*(Sint16*)(&data[14])); SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTX, axis); - axis = *(Sint16*)(&data[16]); + axis = SDL_SwapLE16(*(Sint16*)(&data[16])); SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, ~axis); SDL_memcpy(ctx->last_state, data, SDL_min(size, sizeof(ctx->last_state))); @@ -826,25 +826,25 @@ SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, dpad_left); } - axis = ((int)*(Sint16*)(&data[9]) * 64) - 32768; + axis = ((int)SDL_SwapLE16(*(Sint16*)(&data[9])) * 64) - 32768; if (axis == 32704) { axis = 32767; } SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis); - axis = ((int)*(Sint16*)(&data[11]) * 64) - 32768; + axis = ((int)SDL_SwapLE16(*(Sint16*)(&data[11])) * 64) - 32768; if (axis == 32704) { axis = 32767; } SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis); - axis = (int)*(Uint16*)(&data[1]) - 0x8000; + axis = (int)SDL_SwapLE16(*(Uint16*)(&data[1])) - 0x8000; SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTX, axis); - axis = (int)*(Uint16*)(&data[3]) - 0x8000; + axis = (int)SDL_SwapLE16(*(Uint16*)(&data[3])) - 0x8000; SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTY, axis); - axis = (int)*(Uint16*)(&data[5]) - 0x8000; + axis = (int)SDL_SwapLE16(*(Uint16*)(&data[5])) - 0x8000; SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTX, axis); - axis = (int)*(Uint16*)(&data[7]) - 0x8000; + axis = (int)SDL_SwapLE16(*(Uint16*)(&data[7])) - 0x8000; SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis); SDL_memcpy(ctx->last_state, data, SDL_min(size, sizeof(ctx->last_state))); @@ -912,7 +912,7 @@ switch (ctx->init_state) { case XBOX_ONE_INIT_STATE_START_NEGOTIATING: -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__WINGDK__) /* The Windows driver is taking care of negotiation */ SetInitState(ctx, XBOX_ONE_INIT_STATE_COMPLETE); #else diff -Nru libsdl2-2.0.22+dfsg/src/joystick/iphoneos/SDL_mfijoystick.m libsdl2-2.24.0+dfsg/src/joystick/iphoneos/SDL_mfijoystick.m --- libsdl2-2.0.22+dfsg/src/joystick/iphoneos/SDL_mfijoystick.m 2022-04-23 17:37:35.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/iphoneos/SDL_mfijoystick.m 2022-08-13 03:48:10.000000000 +0000 @@ -178,14 +178,60 @@ return FALSE; } static BOOL +IsControllerSwitchPro(GCController *controller) +{ + if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, *)) { + if ([controller.productCategory isEqualToString:@"Switch Pro Controller"]) { + return TRUE; + } + } + return FALSE; +} +static BOOL +IsControllerSwitchJoyConL(GCController *controller) +{ + if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, *)) { + if ([controller.productCategory isEqualToString:@"Nintendo Switch Joy-Con (L)"]) { + return TRUE; + } + } + return FALSE; +} +static BOOL +IsControllerSwitchJoyConR(GCController *controller) +{ + if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, *)) { + if ([controller.productCategory isEqualToString:@"Nintendo Switch Joy-Con (R)"]) { + return TRUE; + } + } + return FALSE; +} +static BOOL +IsControllerSwitchJoyConPair(GCController *controller) +{ + if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, *)) { + if ([controller.productCategory isEqualToString:@"Nintendo Switch Joy-Con (L/R)"]) { + return TRUE; + } + } + return FALSE; +} +static BOOL IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCController *controller) { Uint16 *guid16 = (Uint16 *)device->guid.data; Uint16 vendor = 0; Uint16 product = 0; Uint8 subtype = 0; - const char *name = NULL; + + if (@available(macOS 11.3, iOS 14.5, tvOS 14.5, *)) { + if (!GCController.shouldMonitorBackgroundEvents) { + GCController.shouldMonitorBackgroundEvents = YES; + } + } + /* Explicitly retain the controller because SDL_JoystickDeviceItem is a * struct, and ARC doesn't work with structs. */ device->controller = (__bridge GCController *) CFBridgingRetain(controller); @@ -200,20 +246,37 @@ device->name = SDL_CreateJoystickName(0, 0, NULL, name); +#ifdef DEBUG_CONTROLLER_PROFILE + if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { + if (controller.physicalInputProfile) { + for (id key in controller.physicalInputProfile.buttons) { + NSLog(@"Button %@ available\n", key); + } + for (id key in controller.physicalInputProfile.axes) { + NSLog(@"Axis %@ available\n", key); + } + } + } +#endif + if (controller.extendedGamepad) { GCExtendedGamepad *gamepad = controller.extendedGamepad; BOOL is_xbox = IsControllerXbox(controller); BOOL is_ps4 = IsControllerPS4(controller); BOOL is_ps5 = IsControllerPS5(controller); + BOOL is_switch_pro = IsControllerSwitchPro(controller); + BOOL is_switch_joycon_pair = IsControllerSwitchJoyConPair(controller); #if TARGET_OS_TV - BOOL is_MFi = (!is_xbox && !is_ps4 && !is_ps5); + BOOL is_MFi = (!is_xbox && !is_ps4 && !is_ps5 && !is_switch_pro && !is_switch_joycon_pair); #endif int nbuttons = 0; + BOOL has_direct_menu; #ifdef SDL_JOYSTICK_HIDAPI if ((is_xbox && HIDAPI_IsDeviceTypePresent(SDL_CONTROLLER_TYPE_XBOXONE)) || (is_ps4 && HIDAPI_IsDeviceTypePresent(SDL_CONTROLLER_TYPE_PS4)) || - (is_ps5 && HIDAPI_IsDeviceTypePresent(SDL_CONTROLLER_TYPE_PS5))) { + (is_ps5 && HIDAPI_IsDeviceTypePresent(SDL_CONTROLLER_TYPE_PS5)) || + (is_switch_pro && HIDAPI_IsDeviceTypePresent(SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO))) { /* The HIDAPI driver is taking care of this device */ return FALSE; } @@ -243,11 +306,12 @@ device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_BACK); ++nbuttons; } - if ([gamepad respondsToSelector:@selector(buttonHome)] && gamepad.buttonHome) { + /* The Nintendo Switch JoyCon home button doesn't ever show as being held down */ + if ([gamepad respondsToSelector:@selector(buttonHome)] && gamepad.buttonHome && !is_switch_joycon_pair) { device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_GUIDE); ++nbuttons; } - BOOL has_direct_menu = [gamepad respondsToSelector:@selector(buttonMenu)] && gamepad.buttonMenu; + has_direct_menu = [gamepad respondsToSelector:@selector(buttonMenu)] && gamepad.buttonMenu; #if TARGET_OS_TV /* On tvOS MFi controller menu button brings you to the home screen */ if (is_MFi) { @@ -324,6 +388,14 @@ vendor = USB_VENDOR_SONY; product = USB_PRODUCT_SONY_DS5; subtype = 0; + } else if (is_switch_pro) { + vendor = USB_VENDOR_NINTENDO; + product = USB_PRODUCT_NINTENDO_SWITCH_PRO; + subtype = 0; + } else if (is_switch_joycon_pair) { + vendor = USB_VENDOR_NINTENDO; + product = USB_PRODUCT_NINTENDO_SWITCH_JOYCON_PAIR; + subtype = 0; } else { vendor = USB_VENDOR_APPLE; product = 1; @@ -331,11 +403,7 @@ } if (SDL_strcmp(name, "Backbone One") == 0) { - /* The Backbone app uses the guide and share buttons */ - if ((device->button_mask & (1 << SDL_CONTROLLER_BUTTON_GUIDE)) != 0) { - device->button_mask &= ~(1 << SDL_CONTROLLER_BUTTON_GUIDE); - --nbuttons; - } + /* The Backbone app uses share button */ if ((device->button_mask & (1 << SDL_CONTROLLER_BUTTON_MISC1)) != 0) { device->button_mask &= ~(1 << SDL_CONTROLLER_BUTTON_MISC1); --nbuttons; @@ -348,8 +416,24 @@ device->nbuttons = nbuttons; } else if (controller.gamepad) { + BOOL is_switch_joyconL = IsControllerSwitchJoyConL(controller); + BOOL is_switch_joyconR = IsControllerSwitchJoyConR(controller); int nbuttons = 0; + if (is_switch_joyconL) { + vendor = USB_VENDOR_NINTENDO; + product = USB_PRODUCT_NINTENDO_SWITCH_JOYCON_LEFT; + subtype = 0; + } else if (is_switch_joyconR) { + vendor = USB_VENDOR_NINTENDO; + product = USB_PRODUCT_NINTENDO_SWITCH_JOYCON_RIGHT; + subtype = 0; + } else { + vendor = USB_VENDOR_APPLE; + product = 2; + subtype = 2; + } + /* These buttons are part of the original MFi spec */ device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_A); device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_B); @@ -361,9 +445,6 @@ nbuttons += 7; device->uses_pause_handler = SDL_TRUE; - vendor = USB_VENDOR_APPLE; - product = 2; - subtype = 2; device->naxes = 0; /* no traditional analog inputs */ device->nhats = 1; /* d-pad */ device->nbuttons = nbuttons; @@ -575,6 +656,9 @@ #endif @autoreleasepool { +#ifdef SDL_JOYSTICK_MFI + NSNotificationCenter *center; +#endif #ifdef SDL_JOYSTICK_iOS_ACCELEROMETER if (SDL_GetHintBoolean(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, SDL_TRUE)) { /* Default behavior, accelerometer as joystick */ @@ -588,10 +672,6 @@ return 0; } - if (@available(macOS 11.3, iOS 14.5, tvOS 14.5, *)) { - GCController.shouldMonitorBackgroundEvents = YES; - } - /* For whatever reason, this always returns an empty array on macOS 11.0.1 */ for (GCController *controller in [GCController controllers]) { @@ -603,7 +683,7 @@ SDL_AppleTVRemoteRotationHintChanged, NULL); #endif /* TARGET_OS_TV */ - NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; + center = [NSNotificationCenter defaultCenter]; connectObserver = [center addObserverForName:GCControllerDidConnectNotification object:nil @@ -651,6 +731,12 @@ return device ? device->name : "Unknown"; } +static const char * +IOS_JoystickGetDevicePath(int device_index) +{ + return NULL; +} + static int IOS_JoystickGetDevicePlayerIndex(int device_index) { @@ -739,7 +825,7 @@ } #ifdef ENABLE_MFI_SENSORS - if (@available(macOS 11.0, iOS 14.0, tvOS 14.0, *)) { + if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { GCController *controller = joystick->hwdata->controller; GCMotion *motion = controller.motion; if (motion && motion.hasRotationRate) { @@ -752,7 +838,7 @@ #endif /* ENABLE_MFI_SENSORS */ #ifdef ENABLE_MFI_SYSTEM_GESTURE_STATE - if (@available(macOS 11.0, iOS 14.0, tvOS 14.0, *)) { + if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { GCController *controller = joystick->hwdata->controller; for (id key in controller.physicalInputProfile.buttons) { GCControllerButtonInput *button = controller.physicalInputProfile.buttons[key]; @@ -853,6 +939,23 @@ int i; int pause_button_index = 0; +#ifdef DEBUG_CONTROLLER_STATE + if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { + if (controller.physicalInputProfile) { + for (id key in controller.physicalInputProfile.buttons) { + GCControllerButtonInput *button = controller.physicalInputProfile.buttons[key]; + if (button.isPressed) + NSLog(@"Button %@ = %s\n", key, button.isPressed ? "pressed" : "released"); + } + for (id key in controller.physicalInputProfile.axes) { + GCControllerAxisInput *axis = controller.physicalInputProfile.axes[key]; + if (axis.value != 0.0f) + NSLog(@"Axis %@ = %.2f\n", key, axis.value); + } + } + } +#endif + if (controller.extendedGamepad) { GCExtendedGamepad *gamepad = controller.extendedGamepad; @@ -905,9 +1008,8 @@ #ifdef ENABLE_PHYSICAL_INPUT_PROFILE if (joystick->hwdata->has_dualshock_touchpad) { - buttons[button_count++] = controller.physicalInputProfile.buttons[GCInputDualShockTouchpadButton].isPressed; - GCControllerDirectionPad *dpad; + buttons[button_count++] = controller.physicalInputProfile.buttons[GCInputDualShockTouchpadButton].isPressed; dpad = controller.physicalInputProfile.dpads[GCInputDualShockTouchpadOne]; if (dpad.xAxis.value || dpad.yAxis.value) { @@ -964,7 +1066,7 @@ } #ifdef ENABLE_MFI_SENSORS - if (@available(macOS 11.0, iOS 14.0, tvOS 14.0, *)) { + if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { GCMotion *motion = controller.motion; if (motion && motion.sensorsActive) { float data[3]; @@ -1057,7 +1159,7 @@ } #ifdef ENABLE_MFI_BATTERY - if (@available(macos 11.0, iOS 14.0, tvOS 14.0, *)) { + if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { GCDeviceBattery *battery = controller.battery; if (battery) { SDL_JoystickPowerLevel ePowerLevel = SDL_JOYSTICK_POWER_UNKNOWN; @@ -1098,8 +1200,8 @@ #ifdef ENABLE_MFI_RUMBLE @interface SDL_RumbleMotor : NSObject - @property(nonatomic,strong) CHHapticEngine *engine API_AVAILABLE(macos(11.0), ios(13.0), tvos(14.0)); - @property(nonatomic,strong) id player API_AVAILABLE(macos(11.0), ios(13.0), tvos(14.0)); + @property(nonatomic,strong) CHHapticEngine *engine API_AVAILABLE(macos(10.16), ios(13.0), tvos(14.0)); + @property(nonatomic,strong) id player API_AVAILABLE(macos(10.16), ios(13.0), tvos(14.0)); @property bool active; @end @@ -1109,7 +1211,7 @@ -(void)cleanup { @autoreleasepool { - if (@available(macos 11.0, iOS 14.0, tvOS 14.0, *)) { + if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { if (self.player != nil) { [self.player cancelAndReturnError:nil]; self.player = nil; @@ -1125,8 +1227,9 @@ -(int)setIntensity:(float)intensity { @autoreleasepool { - if (@available(macos 11.0, iOS 14.0, tvOS 14.0, *)) { + if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { NSError *error = nil; + CHHapticDynamicParameter *param; if (self.engine == nil) { return SDL_SetError("Haptics engine was stopped"); @@ -1141,8 +1244,8 @@ } if (self.player == nil) { - CHHapticEventParameter *param = [[CHHapticEventParameter alloc] initWithParameterID:CHHapticEventParameterIDHapticIntensity value:1.0f]; - CHHapticEvent *event = [[CHHapticEvent alloc] initWithEventType:CHHapticEventTypeHapticContinuous parameters:[NSArray arrayWithObjects:param, nil] relativeTime:0 duration:GCHapticDurationInfinite]; + CHHapticEventParameter *event_param = [[CHHapticEventParameter alloc] initWithParameterID:CHHapticEventParameterIDHapticIntensity value:1.0f]; + CHHapticEvent *event = [[CHHapticEvent alloc] initWithEventType:CHHapticEventTypeHapticContinuous parameters:[NSArray arrayWithObjects:event_param, nil] relativeTime:0 duration:GCHapticDurationInfinite]; CHHapticPattern *pattern = [[CHHapticPattern alloc] initWithEvents:[NSArray arrayWithObject:event] parameters:[[NSArray alloc] init] error:&error]; if (error != nil) { return SDL_SetError("Couldn't create haptic pattern: %s", [error.localizedDescription UTF8String]); @@ -1155,7 +1258,7 @@ self.active = false; } - CHHapticDynamicParameter *param = [[CHHapticDynamicParameter alloc] initWithParameterID:CHHapticDynamicParameterIDHapticIntensityControl value:intensity relativeTime:0]; + param = [[CHHapticDynamicParameter alloc] initWithParameterID:CHHapticDynamicParameterIDHapticIntensityControl value:intensity relativeTime:0]; [self.player sendParameters:[NSArray arrayWithObject:param] atTime:0 error:&error]; if (error != nil) { return SDL_SetError("Couldn't update haptic player: %s", [error.localizedDescription UTF8String]); @@ -1171,11 +1274,13 @@ } } --(id) initWithController:(GCController*)controller locality:(GCHapticsLocality)locality API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0)) +-(id) initWithController:(GCController*)controller locality:(GCHapticsLocality)locality API_AVAILABLE(macos(10.16), ios(14.0), tvos(14.0)) { @autoreleasepool { - self = [super init]; NSError *error; + __weak __typeof(self) weakSelf; + self = [super init]; + weakSelf = self; self.engine = [controller.haptics createEngineWithLocality:locality]; if (self.engine == nil) { @@ -1189,7 +1294,6 @@ return nil; } - __weak __typeof(self) weakSelf = self; self.engine.stoppedHandler = ^(CHHapticEngineStoppedReason stoppedReason) { SDL_RumbleMotor *_this = weakSelf; if (_this == nil) { @@ -1271,7 +1375,7 @@ static SDL_RumbleContext *IOS_JoystickInitRumble(GCController *controller) { @autoreleasepool { - if (@available(macOS 11.0, iOS 14.0, tvOS 14.0, *)) { + if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { SDL_RumbleMotor *low_frequency_motor = [[SDL_RumbleMotor alloc] initWithController:controller locality:GCHapticsLocalityLeftHandle]; SDL_RumbleMotor *high_frequency_motor = [[SDL_RumbleMotor alloc] initWithController:controller locality:GCHapticsLocalityRightHandle]; SDL_RumbleMotor *left_trigger_motor = [[SDL_RumbleMotor alloc] initWithController:controller locality:GCHapticsLocalityLeftTrigger]; @@ -1299,7 +1403,7 @@ return SDL_SetError("Controller is no longer connected"); } - if (@available(macOS 11.0, iOS 14.0, tvOS 14.0, *)) { + if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { if (!device->rumble && device->controller && device->controller.haptics) { SDL_RumbleContext *rumble = IOS_JoystickInitRumble(device->controller); if (rumble) { @@ -1329,7 +1433,7 @@ return SDL_SetError("Controller is no longer connected"); } - if (@available(macOS 11.0, iOS 14.0, tvOS 14.0, *)) { + if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { if (!device->rumble && device->controller && device->controller.haptics) { SDL_RumbleContext *rumble = IOS_JoystickInitRumble(device->controller); if (rumble) { @@ -1362,7 +1466,7 @@ return 0; } - if (@available(macos 11.0, iOS 14.0, tvOS 14.0, *)) { + if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { GCController *controller = device->controller; #ifdef ENABLE_MFI_LIGHT if (controller.light) { @@ -1399,7 +1503,7 @@ return SDL_SetError("Controller is no longer connected"); } - if (@available(macos 11.0, iOS 14.0, tvOS 14.0, *)) { + if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { GCController *controller = device->controller; GCDeviceLight *light = controller.light; if (light) { @@ -1432,7 +1536,7 @@ return SDL_SetError("Controller is no longer connected"); } - if (@available(macOS 11.0, iOS 14.0, tvOS 14.0, *)) { + if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { GCController *controller = device->controller; GCMotion *motion = controller.motion; if (motion) { @@ -1495,7 +1599,7 @@ controller.playerIndex = -1; #ifdef ENABLE_MFI_SYSTEM_GESTURE_STATE - if (@available(macOS 11.0, iOS 14.0, tvOS 14.0, *)) { + if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { for (id key in controller.physicalInputProfile.buttons) { GCControllerButtonInput *button = controller.physicalInputProfile.buttons[key]; if ([button isBoundToSystemGesture]) { @@ -1593,7 +1697,7 @@ static void GetAppleSFSymbolsNameForElement(GCControllerElement *element, char *name) { - if (@available(macos 11.0, iOS 14.0, tvOS 14.0, *)) { + if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { if (element) { [element.sfSymbolsName getCString: name maxLength: 255 encoding: NSASCIIStringEncoding]; } @@ -1627,7 +1731,7 @@ elementName[0] = '\0'; #if defined(SDL_JOYSTICK_MFI) && defined(ENABLE_PHYSICAL_INPUT_PROFILE) if (gamecontroller && SDL_GameControllerGetJoystick(gamecontroller)->driver == &SDL_IOS_JoystickDriver) { - if (@available(iOS 14.0, tvOS 14.0, macOS 11.0, *)) { + if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { GCController *controller = SDL_GameControllerGetJoystick(gamecontroller)->hwdata->controller; if ([controller respondsToSelector:@selector(physicalInputProfile)]) { NSDictionary *elements = controller.physicalInputProfile.elements; @@ -1740,7 +1844,7 @@ elementName[0] = '\0'; #if defined(SDL_JOYSTICK_MFI) && defined(ENABLE_PHYSICAL_INPUT_PROFILE) if (gamecontroller && SDL_GameControllerGetJoystick(gamecontroller)->driver == &SDL_IOS_JoystickDriver) { - if (@available(iOS 14.0, tvOS 14.0, macOS 11.0, *)) { + if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { GCController *controller = SDL_GameControllerGetJoystick(gamecontroller)->hwdata->controller; if ([controller respondsToSelector:@selector(physicalInputProfile)]) { NSDictionary *elements = controller.physicalInputProfile.elements; @@ -1781,6 +1885,7 @@ IOS_JoystickGetCount, IOS_JoystickDetect, IOS_JoystickGetDeviceName, + IOS_JoystickGetDevicePath, IOS_JoystickGetDevicePlayerIndex, IOS_JoystickSetDevicePlayerIndex, IOS_JoystickGetDeviceGUID, diff -Nru libsdl2-2.0.22+dfsg/src/joystick/linux/SDL_sysjoystick.c libsdl2-2.24.0+dfsg/src/joystick/linux/SDL_sysjoystick.c --- libsdl2-2.0.22+dfsg/src/joystick/linux/SDL_sysjoystick.c 2022-04-21 17:37:37.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/linux/SDL_sysjoystick.c 2022-06-02 02:01:57.000000000 +0000 @@ -82,6 +82,10 @@ #define DEBUG_INPUT_EVENTS 1 #endif +#if 0 +#define DEBUG_GAMEPAD_MAPPING 1 +#endif + typedef enum { ENUMERATION_UNSET, @@ -493,21 +497,6 @@ } } -#ifdef HAVE_INOTIFY -#ifdef HAVE_INOTIFY_INIT1 -static int SDL_inotify_init1(void) { - return inotify_init1(IN_NONBLOCK | IN_CLOEXEC); -} -#else -static int SDL_inotify_init1(void) { - int fd = inotify_init(); - if (fd < 0) return -1; - fcntl(fd, F_SETFL, O_NONBLOCK); - fcntl(fd, F_SETFD, FD_CLOEXEC); - return fd; -} -#endif - static int StrHasPrefix(const char *string, const char *prefix) { @@ -562,6 +551,21 @@ } } +#ifdef HAVE_INOTIFY +#ifdef HAVE_INOTIFY_INIT1 +static int SDL_inotify_init1(void) { + return inotify_init1(IN_NONBLOCK | IN_CLOEXEC); +} +#else +static int SDL_inotify_init1(void) { + int fd = inotify_init(); + if (fd < 0) return -1; + fcntl(fd, F_SETFL, O_NONBLOCK); + fcntl(fd, F_SETFD, FD_CLOEXEC); + return fd; +} +#endif + static void LINUX_InotifyJoystickDetect(void) { @@ -854,13 +858,18 @@ return item; } -/* Function to get the device-dependent name of a joystick */ static const char * LINUX_JoystickGetDeviceName(int device_index) { return JoystickByDevIndex(device_index)->name; } +static const char * +LINUX_JoystickGetDevicePath(int device_index) +{ + return JoystickByDevIndex(device_index)->path; +} + static int LINUX_JoystickGetDevicePlayerIndex(int device_index) { @@ -921,6 +930,37 @@ return (0); } +static SDL_bool +GuessIfAxesAreDigitalHat(struct input_absinfo *absinfo_x, struct input_absinfo *absinfo_y) +{ + /* A "hat" is assumed to be a digital input with at most 9 possible states + * (3 per axis: negative/zero/positive), as opposed to a true "axis" which + * can report a continuous range of possible values. Unfortunately the Linux + * joystick interface makes no distinction between digital hat axes and any + * other continuous analog axis, so we have to guess. */ + + /* If both axes are missing, they're not anything. */ + if (!absinfo_x && !absinfo_y) + return SDL_FALSE; + + /* If the hint says so, treat all hats as digital. */ + if (SDL_GetHintBoolean(SDL_HINT_LINUX_DIGITAL_HATS, SDL_FALSE)) + return SDL_TRUE; + + /* If both axes have ranges constrained between -1 and 1, they're definitely digital. */ + if ((!absinfo_x || (absinfo_x->minimum == -1 && absinfo_x->maximum == 1)) && + (!absinfo_y || (absinfo_y->minimum == -1 && absinfo_y->maximum == 1))) + return SDL_TRUE; + + /* If both axes lack fuzz, flat, and resolution values, they're probably digital. */ + if ((!absinfo_x || (!absinfo_x->fuzz && !absinfo_x->flat && !absinfo_x->resolution)) && + (!absinfo_y || (!absinfo_y->fuzz && !absinfo_y->flat && !absinfo_y->resolution))) + return SDL_TRUE; + + /* Otherwise, treat them as analog. */ + return SDL_FALSE; +} + static void ConfigJoystick(SDL_Joystick *joystick, int fd) { @@ -931,6 +971,7 @@ unsigned long ffbit[NBITS(FF_MAX)] = { 0 }; Uint8 key_pam_size, abs_pam_size; SDL_bool use_deadzones = SDL_GetHintBoolean(SDL_HINT_LINUX_JOYSTICK_DEADZONES, SDL_FALSE); + SDL_bool use_hat_deadzones = SDL_GetHintBoolean(SDL_HINT_LINUX_HAT_DEADZONES, SDL_TRUE); /* See if this device uses the new unified event API */ if ((ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(keybit)), keybit) >= 0) && @@ -958,10 +999,45 @@ ++joystick->nbuttons; } } + for (i = ABS_HAT0X; i <= ABS_HAT3Y; i += 2) { + int hat_x = -1; + int hat_y = -1; + struct input_absinfo absinfo_x; + struct input_absinfo absinfo_y; + if (test_bit(i, absbit)) + hat_x = ioctl(fd, EVIOCGABS(i), &absinfo_x); + if (test_bit(i + 1, absbit)) + hat_y = ioctl(fd, EVIOCGABS(i + 1), &absinfo_y); + if (GuessIfAxesAreDigitalHat((hat_x < 0 ? (void*)0 : &absinfo_x), + (hat_y < 0 ? (void*)0 : &absinfo_y))) { + const int hat_index = (i - ABS_HAT0X) / 2; + struct hat_axis_correct *correct = &joystick->hwdata->hat_correct[hat_index]; +#ifdef DEBUG_INPUT_EVENTS + SDL_Log("Joystick has digital hat: #%d\n", hat_index); + if (hat_x >= 0) { + SDL_Log("X Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }\n", + absinfo_x.value, absinfo_x.minimum, absinfo_x.maximum, + absinfo_x.fuzz, absinfo_x.flat, absinfo_x.resolution); + } + if (hat_y >= 0) { + SDL_Log("Y Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }\n", + absinfo_y.value, absinfo_y.minimum, absinfo_y.maximum, + absinfo_y.fuzz, absinfo_y.flat, absinfo_y.resolution); + } +#endif /* DEBUG_INPUT_EVENTS */ + joystick->hwdata->hats_indices[hat_index] = joystick->nhats; + joystick->hwdata->has_hat[hat_index] = SDL_TRUE; + correct->use_deadzones = use_hat_deadzones; + correct->minimum[0] = (hat_x < 0) ? -1 : absinfo_x.minimum; + correct->maximum[0] = (hat_x < 0) ? 1 : absinfo_x.maximum; + correct->minimum[1] = (hat_y < 0) ? -1 : absinfo_y.minimum; + correct->maximum[1] = (hat_y < 0) ? 1 : absinfo_y.maximum; + ++joystick->nhats; + } + } for (i = 0; i < ABS_MAX; ++i) { - /* Skip hats */ - if (i == ABS_HAT0X) { - i = ABS_HAT3Y; + /* Skip digital hats */ + if (joystick->hwdata->has_hat[(i - ABS_HAT0X) / 2]) { continue; } if (test_bit(i, absbit)) { @@ -973,9 +1049,9 @@ } #ifdef DEBUG_INPUT_EVENTS SDL_Log("Joystick has absolute axis: 0x%.2x\n", i); - SDL_Log("Values = { %d, %d, %d, %d, %d }\n", + SDL_Log("Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }\n", absinfo.value, absinfo.minimum, absinfo.maximum, - absinfo.fuzz, absinfo.flat); + absinfo.fuzz, absinfo.flat, absinfo.resolution); #endif /* DEBUG_INPUT_EVENTS */ joystick->hwdata->abs_map[i] = joystick->naxes; joystick->hwdata->has_abs[i] = SDL_TRUE; @@ -1003,24 +1079,6 @@ ++joystick->naxes; } } - for (i = ABS_HAT0X; i <= ABS_HAT3Y; i += 2) { - if (test_bit(i, absbit) || test_bit(i + 1, absbit)) { - struct input_absinfo absinfo; - int hat_index = (i - ABS_HAT0X) / 2; - - if (ioctl(fd, EVIOCGABS(i), &absinfo) < 0) { - continue; - } -#ifdef DEBUG_INPUT_EVENTS - SDL_Log("Joystick has hat %d\n", hat_index); - SDL_Log("Values = { %d, %d, %d, %d, %d }\n", - absinfo.value, absinfo.minimum, absinfo.maximum, - absinfo.fuzz, absinfo.flat); -#endif /* DEBUG_INPUT_EVENTS */ - joystick->hwdata->hats_indices[hat_index] = joystick->nhats++; - joystick->hwdata->has_hat[hat_index] = SDL_TRUE; - } - } if (test_bit(REL_X, relbit) || test_bit(REL_Y, relbit)) { ++joystick->nballs; } @@ -1066,14 +1124,19 @@ for (i = 0; i < abs_pam_size; ++i) { Uint8 code = joystick->hwdata->abs_pam[i]; + // TODO: is there any way to detect analog hats in advance via this API? if (code >= ABS_HAT0X && code <= ABS_HAT3Y) { int hat_index = (code - ABS_HAT0X) / 2; if (!joystick->hwdata->has_hat[hat_index]) { #ifdef DEBUG_INPUT_EVENTS - SDL_Log("Joystick has hat %d\n", hat_index); + SDL_Log("Joystick has digital hat: #%d\n", hat_index); #endif joystick->hwdata->hats_indices[hat_index] = joystick->nhats++; joystick->hwdata->has_hat[hat_index] = SDL_TRUE; + joystick->hwdata->hat_correct[hat_index].minimum[0] = -1; + joystick->hwdata->hat_correct[hat_index].maximum[0] = 1; + joystick->hwdata->hat_correct[hat_index].minimum[1] = -1; + joystick->hwdata->hat_correct[hat_index].maximum[1] = 1; } } else { #ifdef DEBUG_INPUT_EVENTS @@ -1272,26 +1335,48 @@ } static void -HandleHat(SDL_Joystick *stick, Uint8 hat, int axis, int value) +HandleHat(SDL_Joystick *stick, int hatidx, int axis, int value) { + const int hatnum = stick->hwdata->hats_indices[hatidx]; struct hwdata_hat *the_hat; + struct hat_axis_correct *correct; const Uint8 position_map[3][3] = { {SDL_HAT_LEFTUP, SDL_HAT_UP, SDL_HAT_RIGHTUP}, {SDL_HAT_LEFT, SDL_HAT_CENTERED, SDL_HAT_RIGHT}, {SDL_HAT_LEFTDOWN, SDL_HAT_DOWN, SDL_HAT_RIGHTDOWN} }; - the_hat = &stick->hwdata->hats[hat]; + the_hat = &stick->hwdata->hats[hatnum]; + correct = &stick->hwdata->hat_correct[hatidx]; + /* Hopefully we detected any analog axes and left them as is rather than trying + * to use them as digital hats, but just in case, the deadzones here will + * prevent the slightest of twitches on an analog axis from registering as a hat + * movement. If the axes really are digital, this won't hurt since they should + * only ever be sending min, 0, or max anyway. */ if (value < 0) { - value = 0; - } else if (value == 0) { - value = 1; + if (value <= correct->minimum[axis]) { + correct->minimum[axis] = value; + value = 0; + } else if (!correct->use_deadzones || value < correct->minimum[axis] / 3) { + value = 0; + } else { + value = 1; + } } else if (value > 0) { - value = 2; + if (value >= correct->maximum[axis]) { + correct->maximum[axis] = value; + value = 2; + } else if (!correct->use_deadzones || value > correct->maximum[axis] / 3) { + value = 2; + } else { + value = 1; + } + } else { // value == 0 + value = 1; } if (value != the_hat->axis[axis]) { the_hat->axis[axis] = value; - SDL_PrivateJoystickHat(stick, hat, + SDL_PrivateJoystickHat(stick, hatnum, position_map[the_hat->axis[1]][the_hat->axis[0]]); } } @@ -1346,10 +1431,7 @@ /* Poll all axis */ for (i = ABS_X; i < ABS_MAX; i++) { - if (i == ABS_HAT0X) { /* we handle hats in the next loop, skip them for now. */ - i = ABS_HAT3Y; - continue; - } + /* We don't need to test for digital hats here, they won't have has_abs[] set */ if (joystick->hwdata->has_abs[i]) { if (ioctl(joystick->hwdata->fd, EVIOCGABS(i), &absinfo) >= 0) { absinfo.value = AxisCorrect(joystick, i, absinfo.value); @@ -1365,15 +1447,16 @@ } } - /* Poll all hats */ + /* Poll all digital hats */ for (i = ABS_HAT0X; i <= ABS_HAT3Y; i++) { const int baseaxis = i - ABS_HAT0X; const int hatidx = baseaxis / 2; SDL_assert(hatidx < SDL_arraysize(joystick->hwdata->has_hat)); + /* We don't need to test for analog axes here, they won't have has_hat[] set */ if (joystick->hwdata->has_hat[hatidx]) { if (ioctl(joystick->hwdata->fd, EVIOCGABS(i), &absinfo) >= 0) { const int hataxis = baseaxis % 2; - HandleHat(joystick, joystick->hwdata->hats_indices[hatidx], hataxis, absinfo.value); + HandleHat(joystick, hatidx, hataxis, absinfo.value); } } } @@ -1401,7 +1484,7 @@ HandleInputEvents(SDL_Joystick *joystick) { struct input_event events[32]; - int i, len, code; + int i, len, code, hat_index; if (joystick->hwdata->fresh) { PollAllValues(joystick); @@ -1436,9 +1519,11 @@ case ABS_HAT2Y: case ABS_HAT3X: case ABS_HAT3Y: - code -= ABS_HAT0X; - HandleHat(joystick, joystick->hwdata->hats_indices[code / 2], code % 2, events[i].value); - break; + hat_index = (code - ABS_HAT0X) / 2; + if (joystick->hwdata->has_hat[hat_index]) { + HandleHat(joystick, hat_index, code % 2, events[i].value); + break; + } default: events[i].value = AxisCorrect(joystick, code, events[i].value); SDL_PrivateJoystickAxis(joystick, @@ -1491,7 +1576,7 @@ HandleClassicEvents(SDL_Joystick *joystick) { struct js_event events[32]; - int i, len, code; + int i, len, code, hat_index; joystick->hwdata->fresh = SDL_FALSE; while ((len = read(joystick->hwdata->fd, events, (sizeof events))) > 0) { @@ -1515,9 +1600,11 @@ case ABS_HAT2Y: case ABS_HAT3X: case ABS_HAT3Y: - code -= ABS_HAT0X; - HandleHat(joystick, joystick->hwdata->hats_indices[code / 2], code % 2, events[i].value); - break; + hat_index = (code - ABS_HAT0X) / 2; + if (joystick->hwdata->has_hat[hat_index]) { + HandleHat(joystick, hat_index, code % 2, events[i].value); + break; + } default: SDL_PrivateJoystickAxis(joystick, joystick->hwdata->abs_map[code], @@ -1623,10 +1710,14 @@ { SDL_Joystick *joystick; SDL_joylist_item *item = JoystickByDevIndex(device_index); + unsigned int mapped; if (item->checked_mapping) { if (item->mapping) { SDL_memcpy(out, item->mapping, sizeof(*out)); +#ifdef DEBUG_GAMEPAD_MAPPING + SDL_Log("Prior mapping for device %d", device_index); +#endif return SDL_TRUE; } else { return SDL_FALSE; @@ -1674,11 +1765,17 @@ if (joystick->hwdata->has_key[BTN_A]) { out->a.kind = EMappingKind_Button; out->a.target = joystick->hwdata->key_map[BTN_A]; +#ifdef DEBUG_GAMEPAD_MAPPING + SDL_Log("Mapped A to button %d (BTN_A)", out->a.target); +#endif } if (joystick->hwdata->has_key[BTN_B]) { out->b.kind = EMappingKind_Button; out->b.target = joystick->hwdata->key_map[BTN_B]; +#ifdef DEBUG_GAMEPAD_MAPPING + SDL_Log("Mapped B to button %d (BTN_B)", out->b.target); +#endif } /* Xbox controllers use BTN_X and BTN_Y, and PS4 controllers use BTN_WEST and BTN_NORTH */ @@ -1686,47 +1783,74 @@ if (joystick->hwdata->has_key[BTN_WEST]) { out->x.kind = EMappingKind_Button; out->x.target = joystick->hwdata->key_map[BTN_WEST]; +#ifdef DEBUG_GAMEPAD_MAPPING + SDL_Log("Mapped X to button %d (BTN_WEST)", out->x.target); +#endif } if (joystick->hwdata->has_key[BTN_NORTH]) { out->y.kind = EMappingKind_Button; out->y.target = joystick->hwdata->key_map[BTN_NORTH]; +#ifdef DEBUG_GAMEPAD_MAPPING + SDL_Log("Mapped Y to button %d (BTN_NORTH)", out->y.target); +#endif } } else { if (joystick->hwdata->has_key[BTN_X]) { out->x.kind = EMappingKind_Button; out->x.target = joystick->hwdata->key_map[BTN_X]; +#ifdef DEBUG_GAMEPAD_MAPPING + SDL_Log("Mapped X to button %d (BTN_X)", out->x.target); +#endif } if (joystick->hwdata->has_key[BTN_Y]) { out->y.kind = EMappingKind_Button; out->y.target = joystick->hwdata->key_map[BTN_Y]; +#ifdef DEBUG_GAMEPAD_MAPPING + SDL_Log("Mapped Y to button %d (BTN_Y)", out->y.target); +#endif } } if (joystick->hwdata->has_key[BTN_SELECT]) { out->back.kind = EMappingKind_Button; out->back.target = joystick->hwdata->key_map[BTN_SELECT]; +#ifdef DEBUG_GAMEPAD_MAPPING + SDL_Log("Mapped BACK to button %d (BTN_SELECT)", out->back.target); +#endif } if (joystick->hwdata->has_key[BTN_START]) { out->start.kind = EMappingKind_Button; out->start.target = joystick->hwdata->key_map[BTN_START]; +#ifdef DEBUG_GAMEPAD_MAPPING + SDL_Log("Mapped START to button %d (BTN_START)", out->start.target); +#endif } if (joystick->hwdata->has_key[BTN_THUMBL]) { out->leftstick.kind = EMappingKind_Button; out->leftstick.target = joystick->hwdata->key_map[BTN_THUMBL]; +#ifdef DEBUG_GAMEPAD_MAPPING + SDL_Log("Mapped LEFTSTICK to button %d (BTN_THUMBL)", out->leftstick.target); +#endif } if (joystick->hwdata->has_key[BTN_THUMBR]) { out->rightstick.kind = EMappingKind_Button; out->rightstick.target = joystick->hwdata->key_map[BTN_THUMBR]; +#ifdef DEBUG_GAMEPAD_MAPPING + SDL_Log("Mapped RIGHTSTICK to button %d (BTN_THUMBR)", out->rightstick.target); +#endif } if (joystick->hwdata->has_key[BTN_MODE]) { out->guide.kind = EMappingKind_Button; out->guide.target = joystick->hwdata->key_map[BTN_MODE]; +#ifdef DEBUG_GAMEPAD_MAPPING + SDL_Log("Mapped GUIDE to button %d (BTN_MODE)", out->guide.target); +#endif } /* @@ -1734,84 +1858,191 @@ can be digital, or analog, or both at the same time. */ - /* Prefer digital shoulder buttons, but settle for analog if missing. */ + /* Prefer digital shoulder buttons, but settle for digital or analog hat. */ + mapped = 0; + if (joystick->hwdata->has_key[BTN_TL]) { out->leftshoulder.kind = EMappingKind_Button; out->leftshoulder.target = joystick->hwdata->key_map[BTN_TL]; + mapped |= 0x1; +#ifdef DEBUG_GAMEPAD_MAPPING + SDL_Log("Mapped LEFTSHOULDER to button %d (BTN_TL)", out->leftshoulder.target); +#endif } if (joystick->hwdata->has_key[BTN_TR]) { out->rightshoulder.kind = EMappingKind_Button; out->rightshoulder.target = joystick->hwdata->key_map[BTN_TR]; + mapped |= 0x2; +#ifdef DEBUG_GAMEPAD_MAPPING + SDL_Log("Mapped RIGHTSHOULDER to button %d (BTN_TR)", out->rightshoulder.target); +#endif } - if (joystick->hwdata->has_hat[1] && /* Check if ABS_HAT1{X, Y} is available. */ - (!joystick->hwdata->has_key[BTN_TL] || !joystick->hwdata->has_key[BTN_TR])) { + if (mapped != 0x3 && joystick->hwdata->has_hat[1]) { int hat = joystick->hwdata->hats_indices[1] << 4; out->leftshoulder.kind = EMappingKind_Hat; out->rightshoulder.kind = EMappingKind_Hat; out->leftshoulder.target = hat | 0x4; out->rightshoulder.target = hat | 0x2; + mapped |= 0x3; +#ifdef DEBUG_GAMEPAD_MAPPING + SDL_Log("Mapped LEFT+RIGHTSHOULDER to hat 1 (ABS_HAT1X, ABS_HAT1Y)"); +#endif + } + + if (!(mapped & 0x1) && joystick->hwdata->has_abs[ABS_HAT1Y]) { + out->leftshoulder.kind = EMappingKind_Axis; + out->leftshoulder.target = joystick->hwdata->abs_map[ABS_HAT1Y]; + mapped |= 0x1; +#ifdef DEBUG_GAMEPAD_MAPPING + SDL_Log("Mapped LEFTSHOULDER to axis %d (ABS_HAT1Y)", out->leftshoulder.target); +#endif + } + + if (!(mapped & 0x2) && joystick->hwdata->has_abs[ABS_HAT1X]) { + out->rightshoulder.kind = EMappingKind_Axis; + out->rightshoulder.target = joystick->hwdata->abs_map[ABS_HAT1X]; + mapped |= 0x2; +#ifdef DEBUG_GAMEPAD_MAPPING + SDL_Log("Mapped RIGHTSHOULDER to axis %d (ABS_HAT1X)", out->rightshoulder.target); +#endif + } + + /* Prefer analog triggers, but settle for digital hat or buttons. */ + mapped = 0; + + if (joystick->hwdata->has_abs[ABS_HAT2Y]) { + out->lefttrigger.kind = EMappingKind_Axis; + out->lefttrigger.target = joystick->hwdata->abs_map[ABS_HAT2Y]; + mapped |= 0x1; +#ifdef DEBUG_GAMEPAD_MAPPING + SDL_Log("Mapped LEFTTRIGGER to axis %d (ABS_HAT2Y)", out->lefttrigger.target); +#endif + } else if (joystick->hwdata->has_abs[ABS_Z]) { + out->lefttrigger.kind = EMappingKind_Axis; + out->lefttrigger.target = joystick->hwdata->abs_map[ABS_Z]; + mapped |= 0x1; +#ifdef DEBUG_GAMEPAD_MAPPING + SDL_Log("Mapped LEFTTRIGGER to axis %d (ABS_Z)", out->lefttrigger.target); +#endif } - /* Prefer analog triggers, but settle for digital if missing. */ - if (joystick->hwdata->has_hat[2]) { /* Check if ABS_HAT2{X,Y} is available. */ + if (joystick->hwdata->has_abs[ABS_HAT2X]) { + out->righttrigger.kind = EMappingKind_Axis; + out->righttrigger.target = joystick->hwdata->abs_map[ABS_HAT2X]; + mapped |= 0x2; +#ifdef DEBUG_GAMEPAD_MAPPING + SDL_Log("Mapped RIGHTTRIGGER to axis %d (ABS_HAT2X)", out->righttrigger.target); +#endif + } else if (joystick->hwdata->has_abs[ABS_RZ]) { + out->righttrigger.kind = EMappingKind_Axis; + out->righttrigger.target = joystick->hwdata->abs_map[ABS_RZ]; + mapped |= 0x2; +#ifdef DEBUG_GAMEPAD_MAPPING + SDL_Log("Mapped RIGHTTRIGGER to axis %d (ABS_RZ)", out->righttrigger.target); +#endif + } + + if (mapped != 0x3 && joystick->hwdata->has_hat[2]) { int hat = joystick->hwdata->hats_indices[2] << 4; out->lefttrigger.kind = EMappingKind_Hat; out->righttrigger.kind = EMappingKind_Hat; out->lefttrigger.target = hat | 0x4; out->righttrigger.target = hat | 0x2; - } else { - if (joystick->hwdata->has_abs[ABS_Z]) { - out->lefttrigger.kind = EMappingKind_Axis; - out->lefttrigger.target = joystick->hwdata->abs_map[ABS_Z]; - } else if (joystick->hwdata->has_key[BTN_TL2]) { - out->lefttrigger.kind = EMappingKind_Button; - out->lefttrigger.target = joystick->hwdata->key_map[BTN_TL2]; - } + mapped |= 0x3; +#ifdef DEBUG_GAMEPAD_MAPPING + SDL_Log("Mapped LEFT+RIGHTTRIGGER to hat 2 (ABS_HAT2X, ABS_HAT2Y)"); +#endif + } - if (joystick->hwdata->has_abs[ABS_RZ]) { - out->righttrigger.kind = EMappingKind_Axis; - out->righttrigger.target = joystick->hwdata->abs_map[ABS_RZ]; - } else if (joystick->hwdata->has_key[BTN_TR2]) { - out->righttrigger.kind = EMappingKind_Button; - out->righttrigger.target = joystick->hwdata->key_map[BTN_TR2]; - } + if (!(mapped & 0x1) && joystick->hwdata->has_key[BTN_TL2]) { + out->lefttrigger.kind = EMappingKind_Button; + out->lefttrigger.target = joystick->hwdata->key_map[BTN_TL2]; + mapped |= 0x1; +#ifdef DEBUG_GAMEPAD_MAPPING + SDL_Log("Mapped LEFTTRIGGER to button %d (BTN_TL2)", out->lefttrigger.target); +#endif + } + + if (!(mapped & 0x2) && joystick->hwdata->has_key[BTN_TR2]) { + out->righttrigger.kind = EMappingKind_Button; + out->righttrigger.target = joystick->hwdata->key_map[BTN_TR2]; + mapped |= 0x2; +#ifdef DEBUG_GAMEPAD_MAPPING + SDL_Log("Mapped RIGHTTRIGGER to button %d (BTN_TR2)", out->righttrigger.target); +#endif } - /* Prefer digital D-Pad, but settle for analog if missing. */ + /* Prefer digital D-Pad buttons, but settle for digital or analog hat. */ + mapped = 0; + if (joystick->hwdata->has_key[BTN_DPAD_UP]) { out->dpup.kind = EMappingKind_Button; out->dpup.target = joystick->hwdata->key_map[BTN_DPAD_UP]; + mapped |= 0x1; +#ifdef DEBUG_GAMEPAD_MAPPING + SDL_Log("Mapped DPUP to button %d (BTN_DPAD_UP)", out->dpup.target); +#endif } if (joystick->hwdata->has_key[BTN_DPAD_DOWN]) { out->dpdown.kind = EMappingKind_Button; out->dpdown.target = joystick->hwdata->key_map[BTN_DPAD_DOWN]; + mapped |= 0x2; +#ifdef DEBUG_GAMEPAD_MAPPING + SDL_Log("Mapped DPDOWN to button %d (BTN_DPAD_DOWN)", out->dpdown.target); +#endif } if (joystick->hwdata->has_key[BTN_DPAD_LEFT]) { out->dpleft.kind = EMappingKind_Button; out->dpleft.target = joystick->hwdata->key_map[BTN_DPAD_LEFT]; + mapped |= 0x4; +#ifdef DEBUG_GAMEPAD_MAPPING + SDL_Log("Mapped DPLEFT to button %d (BTN_DPAD_LEFT)", out->dpleft.target); +#endif } if (joystick->hwdata->has_key[BTN_DPAD_RIGHT]) { out->dpright.kind = EMappingKind_Button; out->dpright.target = joystick->hwdata->key_map[BTN_DPAD_RIGHT]; + mapped |= 0x8; +#ifdef DEBUG_GAMEPAD_MAPPING + SDL_Log("Mapped DPRIGHT to button %d (BTN_DPAD_RIGHT)", out->dpright.target); +#endif } - if (joystick->hwdata->has_hat[0] && /* Check if ABS_HAT0{X,Y} is available. */ - (!joystick->hwdata->has_key[BTN_DPAD_LEFT] || !joystick->hwdata->has_key[BTN_DPAD_RIGHT] || - !joystick->hwdata->has_key[BTN_DPAD_UP] || !joystick->hwdata->has_key[BTN_DPAD_DOWN])) { - int hat = joystick->hwdata->hats_indices[0] << 4; - out->dpleft.kind = EMappingKind_Hat; - out->dpright.kind = EMappingKind_Hat; - out->dpup.kind = EMappingKind_Hat; - out->dpdown.kind = EMappingKind_Hat; - out->dpleft.target = hat | 0x8; - out->dpright.target = hat | 0x2; - out->dpup.target = hat | 0x1; - out->dpdown.target = hat | 0x4; + if (mapped != 0xF) { + if (joystick->hwdata->has_hat[0]) { + int hat = joystick->hwdata->hats_indices[0] << 4; + out->dpleft.kind = EMappingKind_Hat; + out->dpright.kind = EMappingKind_Hat; + out->dpup.kind = EMappingKind_Hat; + out->dpdown.kind = EMappingKind_Hat; + out->dpleft.target = hat | 0x8; + out->dpright.target = hat | 0x2; + out->dpup.target = hat | 0x1; + out->dpdown.target = hat | 0x4; + mapped |= 0xF; +#ifdef DEBUG_GAMEPAD_MAPPING + SDL_Log("Mapped DPUP+DOWN+LEFT+RIGHT to hat 0 (ABS_HAT0X, ABS_HAT0Y)"); +#endif + } else if (joystick->hwdata->has_abs[ABS_HAT0X] && joystick->hwdata->has_abs[ABS_HAT0Y]) { + out->dpleft.kind = EMappingKind_Axis; + out->dpright.kind = EMappingKind_Axis; + out->dpup.kind = EMappingKind_Axis; + out->dpdown.kind = EMappingKind_Axis; + out->dpleft.target = joystick->hwdata->abs_map[ABS_HAT0X]; + out->dpright.target = joystick->hwdata->abs_map[ABS_HAT0X]; + out->dpup.target = joystick->hwdata->abs_map[ABS_HAT0Y]; + out->dpdown.target = joystick->hwdata->abs_map[ABS_HAT0Y]; + mapped |= 0xF; +#ifdef DEBUG_GAMEPAD_MAPPING + SDL_Log("Mapped DPUP+DOWN to axis %d (ABS_HAT0Y)", out->dpup.target); + SDL_Log("Mapped DPLEFT+RIGHT to axis %d (ABS_HAT0X)", out->dpleft.target); +#endif + } } if (joystick->hwdata->has_abs[ABS_X] && joystick->hwdata->has_abs[ABS_Y]) { @@ -1819,6 +2050,10 @@ out->lefty.kind = EMappingKind_Axis; out->leftx.target = joystick->hwdata->abs_map[ABS_X]; out->lefty.target = joystick->hwdata->abs_map[ABS_Y]; +#ifdef DEBUG_GAMEPAD_MAPPING + SDL_Log("Mapped LEFTX to axis %d (ABS_X)", out->leftx.target); + SDL_Log("Mapped LEFTY to axis %d (ABS_Y)", out->lefty.target); +#endif } if (joystick->hwdata->has_abs[ABS_RX] && joystick->hwdata->has_abs[ABS_RY]) { @@ -1826,6 +2061,10 @@ out->righty.kind = EMappingKind_Axis; out->rightx.target = joystick->hwdata->abs_map[ABS_RX]; out->righty.target = joystick->hwdata->abs_map[ABS_RY]; +#ifdef DEBUG_GAMEPAD_MAPPING + SDL_Log("Mapped RIGHTX to axis %d (ABS_RX)", out->rightx.target); + SDL_Log("Mapped RIGHTY to axis %d (ABS_RY)", out->righty.target); +#endif } LINUX_JoystickClose(joystick); @@ -1836,6 +2075,9 @@ if (item->mapping) { SDL_memcpy(item->mapping, out, sizeof(*out)); } +#ifdef DEBUG_GAMEPAD_MAPPING + SDL_Log("Generated mapping for device %d", device_index); +#endif return SDL_TRUE; } @@ -1846,6 +2088,7 @@ LINUX_JoystickGetCount, LINUX_JoystickDetect, LINUX_JoystickGetDeviceName, + LINUX_JoystickGetDevicePath, LINUX_JoystickGetDevicePlayerIndex, LINUX_JoystickSetDevicePlayerIndex, LINUX_JoystickGetDeviceGUID, diff -Nru libsdl2-2.0.22+dfsg/src/joystick/linux/SDL_sysjoystick_c.h libsdl2-2.24.0+dfsg/src/joystick/linux/SDL_sysjoystick_c.h --- libsdl2-2.0.22+dfsg/src/joystick/linux/SDL_sysjoystick_c.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/linux/SDL_sysjoystick_c.h 2022-06-02 02:01:57.000000000 +0000 @@ -83,6 +83,12 @@ /* 4 = (ABS_HAT3X-ABS_HAT0X)/2 (see input-event-codes.h in kernel) */ int hats_indices[4]; SDL_bool has_hat[4]; + struct hat_axis_correct + { + SDL_bool use_deadzones; + int minimum[2]; + int maximum[2]; + } hat_correct[4]; /* Set when gamepad is pending removal due to ENODEV read error */ SDL_bool gone; diff -Nru libsdl2-2.0.22+dfsg/src/joystick/os2/SDL_os2joystick.c libsdl2-2.24.0+dfsg/src/joystick/os2/SDL_os2joystick.c --- libsdl2-2.0.22+dfsg/src/joystick/os2/SDL_os2joystick.c 2022-01-09 19:28:24.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/os2/SDL_os2joystick.c 2022-06-02 02:01:57.000000000 +0000 @@ -377,15 +377,17 @@ { } -/***********************************************************/ -/* Function to get the device-dependent name of a joystick */ -/***********************************************************/ static const char *OS2_JoystickGetDeviceName(int device_index) { /* No need to verify if device exists, already done in upper layer */ return SYS_JoyData[device_index].szDeviceName; } +static const char *OS2_JoystickGetDevicePath(int device_index) +{ + return NULL; +} + static int OS2_JoystickGetDevicePlayerIndex(int device_index) { return -1; @@ -779,6 +781,7 @@ OS2_NumJoysticks, OS2_JoystickDetect, OS2_JoystickGetDeviceName, + OS2_JoystickGetDevicePath, OS2_JoystickGetDevicePlayerIndex, OS2_JoystickSetDevicePlayerIndex, OS2_JoystickGetDeviceGUID, diff -Nru libsdl2-2.0.22+dfsg/src/joystick/ps2/SDL_sysjoystick.c libsdl2-2.24.0+dfsg/src/joystick/ps2/SDL_sysjoystick.c --- libsdl2-2.0.22+dfsg/src/joystick/ps2/SDL_sysjoystick.c 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/ps2/SDL_sysjoystick.c 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,361 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_JOYSTICK_PS2 + +/* This is the PS2 implementation of the SDL joystick API */ +#include +#include +#include + +#include /* For the definition of NULL */ +#include +#include + +#include "../SDL_sysjoystick.h" +#include "../SDL_joystick_c.h" + +#include "SDL_events.h" +#include "SDL_error.h" + +#define PS2_MAX_PORT 2 /* each ps2 has 2 ports */ +#define PS2_MAX_SLOT 4 /* maximum - 4 slots in one multitap */ +#define MAX_CONTROLLERS (PS2_MAX_PORT * PS2_MAX_SLOT) +#define PS2_ANALOG_STICKS 2 +#define PS2_ANALOG_AXIS 2 +#define PS2_BUTTONS 16 +#define PS2_TOTAL_AXIS (PS2_ANALOG_STICKS * PS2_ANALOG_AXIS) + +struct JoyInfo { + uint8_t padBuf[256]; + uint16_t btns; + uint8_t analog_state[PS2_TOTAL_AXIS]; + uint8_t port; + uint8_t slot; + int8_t rumble_ready; + int8_t opened; +} __attribute__ ((aligned (64))); + +static uint8_t enabled_pads = 0; +static struct JoyInfo joyInfo[MAX_CONTROLLERS]; + +static inline int16_t convert_u8_to_s16(uint8_t val) +{ + if (val == 0) + return -0x7fff; + return val * 0x0101 - 0x8000; +} + +static inline uint8_t rumble_status(uint8_t index) +{ + char actAlign[6]; + int res; + struct JoyInfo *info = &joyInfo[index]; + + if (info->rumble_ready == 0) { + actAlign[0] = 0; + actAlign[1] = 1; + actAlign[2] = 0xff; + actAlign[3] = 0xff; + actAlign[4] = 0xff; + actAlign[5] = 0xff; + + res = padSetActAlign(info->port, info->slot, actAlign); + info->rumble_ready = res <= 0 ? -1 : 1; + } + + return info->rumble_ready == 1; +} + +/* Function to scan the system for joysticks. +* Joystick 0 should be the system default joystick. +* This function should return 0, or -1 on an unrecoverable error. +*/ +static int PS2_JoystickInit(void) +{ + uint32_t port = 0; + uint32_t slot = 0; + + if(init_joystick_driver(true) < 0) + return -1; + + for (port = 0; port < PS2_MAX_PORT; port++) + mtapPortOpen(port); + /* it can fail - we dont care, we will check it more strictly when padPortOpen */ + + for (slot = 0; slot < PS2_MAX_SLOT; slot++) { + for (port = 0; port < PS2_MAX_PORT; port++) { + /* 2 main controller ports acts the same with and without multitap + Port 0,0 -> Connector 1 - the same as Port 0 + Port 1,0 -> Connector 2 - the same as Port 1 + Port 0,1 -> Connector 3 + Port 1,1 -> Connector 4 + Port 0,2 -> Connector 5 + Port 1,2 -> Connector 6 + Port 0,3 -> Connector 7 + Port 1,3 -> Connector 8 + */ + + struct JoyInfo *info = &joyInfo[enabled_pads]; + if(padPortOpen(port, slot, (void *)info->padBuf) > 0) { + info->port = (uint8_t)port; + info->slot = (uint8_t)slot; + info->opened = 1; + enabled_pads++; + } + } + } + + return enabled_pads > 0 ? 0 : -1; +} + +/* Function to return the number of joystick devices plugged in right now */ +static int PS2_JoystickGetCount() +{ + return (int)enabled_pads; +} + +/* Function to cause any queued joystick insertions to be processed */ +static void PS2_JoystickDetect() +{ +} + +/* Function to get the device-dependent name of a joystick */ +static const char *PS2_JoystickGetDeviceName(int index) +{ + if (index >= 0 && index < enabled_pads) + return "PS2 Controller"; + + SDL_SetError("No joystick available with that index"); + return NULL; +} + +/* Function to get the device-dependent path of a joystick */ +static const char *PS2_JoystickGetDevicePath(int index) +{ + return NULL; +} + +/* Function to get the player index of a joystick */ +static int PS2_JoystickGetDevicePlayerIndex(int device_index) +{ + return -1; +} + +/* Function to set the player index of a joystick */ +static void PS2_JoystickSetDevicePlayerIndex(int device_index, int player_index) +{ +} + +/* Function to return the stable GUID for a plugged in device */ +static SDL_JoystickGUID PS2_JoystickGetDeviceGUID( int device_index ) +{ + SDL_JoystickGUID guid; + /* the GUID is just the first 16 chars of the name for now */ + const char *name = PS2_JoystickGetDeviceName(device_index); + SDL_zero(guid); + SDL_memcpy(&guid, name, SDL_min(sizeof(guid), SDL_strlen(name))); + return guid; +} + +/* Function to get the current instance id of the joystick located at device_index */ +static SDL_JoystickID PS2_JoystickGetDeviceInstanceID(int device_index) +{ + return device_index; +} + +/* Function to open a joystick for use. + The joystick to open is specified by the device index. + This should fill the nbuttons and naxes fields of the joystick structure. + It returns 0, or -1 if there is an error. +*/ +static int PS2_JoystickOpen(SDL_Joystick *joystick, int device_index) +{ + int index = joystick->instance_id; + struct JoyInfo *info = &joyInfo[index]; + + if (!info->opened) { + if (padPortOpen(info->port, info->slot, (void *)info->padBuf) > 0) { + info->opened = 1; + } else { + return -1; + } + } + joystick->nbuttons = PS2_BUTTONS; + joystick->naxes = PS2_TOTAL_AXIS; + joystick->nhats = 0; + joystick->instance_id = device_index; + + return 0; +} + +/* Rumble functionality */ +static int PS2_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble) +{ + char actAlign[6]; + int res; + int index = joystick->instance_id; + struct JoyInfo *info = &joyInfo[index]; + + if (!rumble_status(index)) { + return -1; + } + + // Initial value + actAlign[0] = low_frequency_rumble >> 8; // Enable small engine + actAlign[1] = high_frequency_rumble >> 8; // Enable big engine + actAlign[2] = 0xff; + actAlign[3] = 0xff; + actAlign[4] = 0xff; + actAlign[5] = 0xff; + + res = padSetActDirect(info->port, info->slot, actAlign); + return res == 1 ? 0 : -1; +} + +/* Rumble functionality */ +static int PS2_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left, Uint16 right) +{ + return -1; +} + +/* Capability detection */ +static Uint32 PS2_JoystickGetCapabilities(SDL_Joystick *joystick) +{ + return SDL_JOYCAP_RUMBLE; +} + +/* LED functionality */ +static int PS2_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue) +{ + return -1; +} + +/* General effects */ +static int PS2_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int size) +{ + return -1; +} + +/* Sensor functionality */ +static int PS2_JoystickSetSensorsEnabled(SDL_Joystick *joystick, SDL_bool enabled) +{ + return -1; +} + +/* Function to update the state of a joystick - called as a device poll. +* This function shouldn't update the joystick structure directly, +* but instead should call SDL_PrivateJoystick*() to deliver events +* and update joystick device state. +*/ +static void PS2_JoystickUpdate(SDL_Joystick *joystick) +{ + uint8_t i; + uint8_t previous_axis, current_axis; + uint16_t mask, previous, current; + struct padButtonStatus buttons; + uint8_t all_axis[PS2_TOTAL_AXIS]; + int index = joystick->instance_id; + struct JoyInfo *info = &joyInfo[index]; + int state = padGetState(info->port, info->slot); + + if (state != PAD_STATE_DISCONN || state != PAD_STATE_EXECCMD || state != PAD_STATE_ERROR) { + int ret = padRead(info->port, info->slot, &buttons); /* port, slot, buttons */ + if (ret != 0) { + /* Buttons */ + int32_t pressed_buttons = 0xffff ^ buttons.btns;; + if (info->btns != pressed_buttons) { + for (i = 0; i < PS2_BUTTONS; i++) { + mask = (1 << i); + previous = info->btns & mask; + current = pressed_buttons & mask; + if (previous != current) + SDL_PrivateJoystickButton(joystick, i, current ? SDL_PRESSED : SDL_RELEASED); + } + } + info->btns = pressed_buttons; + + /* Analog */ + all_axis[0] = buttons.ljoy_h; + all_axis[1] = buttons.ljoy_v; + all_axis[2] = buttons.rjoy_h; + all_axis[3] = buttons.rjoy_v; + + for (i = 0; i < PS2_TOTAL_AXIS; i++) { + previous_axis = info->analog_state[i]; + current_axis = all_axis[i]; + if (previous_axis != current_axis) + SDL_PrivateJoystickAxis(joystick, i, convert_u8_to_s16(current_axis)); + + info->analog_state[i] = current_axis; + } + } + } +} + +/* Function to close a joystick after use */ +static void PS2_JoystickClose(SDL_Joystick *joystick) +{ + int index = joystick->instance_id; + struct JoyInfo *info = &joyInfo[index]; + padPortClose(info->port, info->slot); + info->opened = 0; +} + +/* Function to perform any system-specific joystick related cleanup */ +static void PS2_JoystickQuit(void) +{ + deinit_joystick_driver(true); +} + +static SDL_bool PS2_GetGamepadMapping(int device_index, SDL_GamepadMapping * out) +{ + return SDL_FALSE; +} + +SDL_JoystickDriver SDL_PS2_JoystickDriver = +{ + PS2_JoystickInit, + PS2_JoystickGetCount, + PS2_JoystickDetect, + PS2_JoystickGetDeviceName, + PS2_JoystickGetDevicePath, + PS2_JoystickGetDevicePlayerIndex, + PS2_JoystickSetDevicePlayerIndex, + PS2_JoystickGetDeviceGUID, + PS2_JoystickGetDeviceInstanceID, + PS2_JoystickOpen, + PS2_JoystickRumble, + PS2_JoystickRumbleTriggers, + PS2_JoystickGetCapabilities, + PS2_JoystickSetLED, + PS2_JoystickSendEffect, + PS2_JoystickSetSensorsEnabled, + PS2_JoystickUpdate, + PS2_JoystickClose, + PS2_JoystickQuit, + PS2_GetGamepadMapping, +}; + +#endif /* SDL_JOYSTICK_PS2 */ + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/joystick/psp/SDL_sysjoystick.c libsdl2-2.24.0+dfsg/src/joystick/psp/SDL_sysjoystick.c --- libsdl2-2.0.22+dfsg/src/joystick/psp/SDL_sysjoystick.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/psp/SDL_sysjoystick.c 2022-08-13 03:48:10.000000000 +0000 @@ -24,7 +24,6 @@ /* This is the PSP implementation of the SDL joystick API */ #include -#include #include /* For the definition of NULL */ #include @@ -34,15 +33,9 @@ #include "SDL_events.h" #include "SDL_error.h" -#include "SDL_mutex.h" -#include "SDL_timer.h" -#include "../../thread/SDL_systhread.h" /* Current pad state */ static SceCtrlData pad = { .Lx = 0, .Ly = 0, .Buttons = 0 }; -static SDL_sem *pad_sem = NULL; -static SDL_Thread *thread = NULL; -static int running = 0; static const enum PspCtrlButtons button_map[] = { PSP_CTRL_TRIANGLE, PSP_CTRL_CIRCLE, PSP_CTRL_CROSS, PSP_CTRL_SQUARE, PSP_CTRL_LTRIGGER, PSP_CTRL_RTRIGGER, @@ -82,23 +75,6 @@ return dest.y; } -/* - * Collect pad data about once per frame - */ -int JoystickUpdate(void *data) -{ - while (running) { - SDL_SemWait(pad_sem); - sceCtrlPeekBufferPositive(&pad, 1); - SDL_SemPost(pad_sem); - /* Delay 1/60th of a second */ - sceKernelDelayThread(1000000 / 60); - } - return 0; -} - - - /* Function to scan the system for joysticks. * Joystick 0 should be the system default joystick. * It should return number of joysticks, or -1 on an unrecoverable fatal error. @@ -111,15 +87,6 @@ sceCtrlSetSamplingCycle(0); sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG); - /* Start thread to read data */ - if((pad_sem = SDL_CreateSemaphore(1)) == NULL) { - return SDL_SetError("Can't create input semaphore"); - } - running = 1; - if((thread = SDL_CreateThreadInternal(JoystickUpdate, "JoystickThread", 4096, NULL)) == NULL) { - return SDL_SetError("Can't create input thread"); - } - /* Create an accurate map from analog inputs (0 to 255) to SDL joystick positions (-32768 to 32767) */ for (i = 0; i < 128; i++) @@ -132,7 +99,7 @@ return 1; } -static int PSP_NumJoysticks(void) +static int PSP_JoystickGetCount(void) { return 1; } @@ -141,20 +108,19 @@ { } -#if 0 /* Function to get the device-dependent name of a joystick */ -static const char *PSP_JoystickName(int idx) +static const char *PSP_JoystickGetDeviceName(int device_index) { - if (idx == 0) return "PSP controller"; + if (device_index == 0) + return "PSP builtin joypad"; + SDL_SetError("No joystick available with that index"); - return NULL; + return(NULL); } -#endif -/* Function to get the device-dependent name of a joystick */ -static const char *PSP_JoystickGetDeviceName(int device_index) +static const char *PSP_JoystickGetDevicePath(int index) { - return "PSP builtin joypad"; + return NULL; } static int PSP_JoystickGetDevicePlayerIndex(int device_index) @@ -162,8 +128,7 @@ return -1; } -static void -PSP_JoystickSetDevicePlayerIndex(int device_index, int player_index) +static void PSP_JoystickSetDevicePlayerIndex(int device_index, int player_index) { } @@ -190,21 +155,20 @@ */ static int PSP_JoystickOpen(SDL_Joystick *joystick, int device_index) { - joystick->nbuttons = 14; + joystick->nbuttons = SDL_arraysize(button_map); joystick->naxes = 2; joystick->nhats = 0; + joystick->instance_id = device_index; return 0; } -static int -PSP_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble) +static int PSP_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble) { return SDL_Unsupported(); } -static int -PSP_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble) +static int PSP_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble) { return SDL_Unsupported(); } @@ -214,14 +178,12 @@ return 0; } -static int -PSP_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue) +static int PSP_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue) { return SDL_Unsupported(); } -static int -PSP_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int size) +static int PSP_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int size) { return SDL_Unsupported(); } @@ -245,11 +207,10 @@ static enum PspCtrlButtons old_buttons = 0; static unsigned char old_x = 0, old_y = 0; - SDL_SemWait(pad_sem); + sceCtrlReadBufferPositive(&pad, 1); buttons = pad.Buttons; x = pad.Lx; y = pad.Ly; - SDL_SemPost(pad_sem); /* Axes */ if(old_x != x) { @@ -265,8 +226,8 @@ changed = old_buttons ^ buttons; old_buttons = buttons; if(changed) { - for(i=0; idpdown); SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "dpleft", &raw_map->dpleft); SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "dpright", &raw_map->dpright); + SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "misc1", &raw_map->misc1); + SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "paddle1", &raw_map->paddle1); + SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "paddle2", &raw_map->paddle2); + SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "paddle3", &raw_map->paddle3); + SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "paddle4", &raw_map->paddle4); SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "leftx", &raw_map->leftx); SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "lefty", &raw_map->lefty); SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "rightx", &raw_map->rightx); @@ -1583,6 +1615,7 @@ } --mapping_index; } + SDL_SetError("Mapping not available"); return NULL; } @@ -1595,6 +1628,8 @@ ControllerMapping_t *mapping = SDL_PrivateGetControllerMappingForGUID(guid, SDL_FALSE); if (mapping) { return CreateMappingString(mapping, guid); + } else { + SDL_SetError("Mapping not available"); } return NULL; } @@ -1732,6 +1767,20 @@ } +/* + * Get the implementation dependent path of a controller + */ +const char * +SDL_GameControllerPathForIndex(int device_index) +{ + ControllerMapping_t *pSupportedController = SDL_PrivateGetControllerMapping(device_index); + if (pSupportedController) { + return SDL_JoystickPathForIndex(device_index); + } + return NULL; +} + + /** * Get the type of a game controller. */ @@ -1820,12 +1869,10 @@ } #endif -#if defined(__ANDROID__) if (name && SDL_strcmp(name, "uinput-fpc") == 0) { /* The Google Pixel fingerprint sensor reports itself as a joystick */ return SDL_TRUE; } -#endif if (SDL_allowed_controllers.num_entries == 0 && SDL_ignored_controllers.num_entries == 0) { @@ -2294,6 +2341,15 @@ } } +const char * +SDL_GameControllerPath(SDL_GameController *gamecontroller) +{ + if (!gamecontroller) + return NULL; + + return SDL_JoystickPath(SDL_GameControllerGetJoystick(gamecontroller)); +} + SDL_GameControllerType SDL_GameControllerGetType(SDL_GameController *gamecontroller) { @@ -2333,6 +2389,12 @@ return SDL_JoystickGetProductVersion(SDL_GameControllerGetJoystick(gamecontroller)); } +Uint16 +SDL_GameControllerGetFirmwareVersion(SDL_GameController *gamecontroller) +{ + return SDL_JoystickGetFirmwareVersion(SDL_GameControllerGetJoystick(gamecontroller)); +} + const char * SDL_GameControllerGetSerial(SDL_GameController *gamecontroller) { @@ -2685,6 +2747,7 @@ const Uint32 event_list[] = { SDL_CONTROLLERAXISMOTION, SDL_CONTROLLERBUTTONDOWN, SDL_CONTROLLERBUTTONUP, SDL_CONTROLLERDEVICEADDED, SDL_CONTROLLERDEVICEREMOVED, SDL_CONTROLLERDEVICEREMAPPED, + SDL_CONTROLLERTOUCHPADDOWN, SDL_CONTROLLERTOUCHPADMOTION, SDL_CONTROLLERTOUCHPADUP, SDL_CONTROLLERSENSORUPDATE, }; unsigned int i; diff -Nru libsdl2-2.0.22+dfsg/src/joystick/SDL_gamecontrollerdb.h libsdl2-2.24.0+dfsg/src/joystick/SDL_gamecontrollerdb.h --- libsdl2-2.0.22+dfsg/src/joystick/SDL_gamecontrollerdb.h 2022-04-21 17:37:37.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/SDL_gamecontrollerdb.h 2022-08-13 03:48:10.000000000 +0000 @@ -66,6 +66,8 @@ "03000000203800000900000000000000,8BitDo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "03000000c82d00002038000000000000,8BitDo NES30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "03000000c82d00002038000000000000,8BitDo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "03000000c82d00000660000000000000,8BitDo Pro 2,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "03000000c82d00000660000000000000,8BitDo Pro 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "03000000c82d00000060000000000000,8BitDo SF30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "03000000c82d00000060000000000000,8BitDo SF30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "03000000c82d00000061000000000000,8BitDo SF30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", @@ -130,8 +132,6 @@ "03000000b80500000610000000000000,Elecom Gamepad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b1,", "03000000852100000201000000000000,FF-GP1,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "030000000d0f00002700000000000000,FIGHTING STICK V3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,", - "030000000d0f00008700000000000000,Fighting Stick mini 4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,", - "030000000d0f00008800000000000000,Fighting Stick mini 4,a:b1,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b8,x:b0,y:b3,", "78696e70757403000000000000000000,Fightstick TES,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,start:b7,x:b2,y:b3,", "03000000151900004000000000000000,Flydigi Vader 2,a:b11,b:b10,back:b3,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b7,leftstick:b1,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b0,righttrigger:b4,rightx:a3,righty:a4,start:b2,x:b9,y:b8,", "03000000b40400001124000000000000,Flydigi Vader 2,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b12,lefttrigger:b8,leftx:a0,lefty:a1,paddle1:b4,paddle2:b5,paddle4:b17,rightshoulder:b7,rightstick:b13,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b2,y:b3,", @@ -158,6 +158,8 @@ "03000000632500002605000000000000,HJD-X,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,", "030000000d0f00008400000000000000,HORI Fighting Commander,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "030000000d0f00008500000000000000,HORI Fighting Commander,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000000d0f00008800000000000000,HORI Fighting Stick mini 4 (PS3),a:b1,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b8,x:b0,y:b3,", + "030000000d0f00008700000000000000,HORI Fighting Stick mini 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,", "030000000d0f00006e00000000000000,HORIPAD 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "030000000d0f00006600000000000000,HORIPAD 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "030000000d0f0000ee00000000000000,HORIPAD mini4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", @@ -262,8 +264,9 @@ "03000000300f00001611000000000000,QanBa Arcade JoyStick 4018,a:b1,b:b2,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b8,x:b0,y:b3,", "03000000300f00001210000000000000,QanBa Joystick Plus,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,rightshoulder:b5,start:b9,x:b2,y:b3,", "03000000341a00000104000000000000,QanBa Joystick Q4RAF,a:b5,b:b6,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b0,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b3,righttrigger:b7,start:b9,x:b1,y:b2,", - "03000000222c00000223000000000000,Qanba Obsidian Arcade Joystick PS3 Mode,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", - "03000000222c00000023000000000000,Qanba Obsidian Arcade Joystick PS4 Mode,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000222c00000025000000000000,Qanba Dragon Arcade Joystick,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000222c00000223000000000000,Qanba Obsidian Arcade Joystick (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000222c00000023000000000000,Qanba Obsidian Arcade Joystick (PS4),a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "030000000d0f00001100000000000000,REAL ARCADE PRO.3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,", "030000000d0f00007000000000000000,REAL ARCADE PRO.4 VLX,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,", "030000000d0f00002200000000000000,REAL ARCADE Pro.V3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", @@ -373,6 +376,8 @@ "03000000022000000090000001000000,8BitDo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "03000000203800000900000000010000,8BitDo NES30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "03000000203800000900000000010000,8BitDo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "03000000c82d00000660000000020000,8BitDo Pro 2,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "03000000c82d00000660000000020000,8BitDo Pro 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "03000000102800000900000000000000,8BitDo SFC30 Gamepad,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "03000000102800000900000000000000,8BitDo SFC30 Gamepad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "03000000c82d00001290000001000000,8BitDo SN30 Gamepad,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", @@ -410,6 +415,8 @@ "03000000d11800000094000000010000,Google Stadia Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,", "030000000d0f00005f00000000000000,HORI Fighting Commander 4 PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "030000000d0f00005e00000000000000,HORI Fighting Commander 4 PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000000d0f00008800000000010000,HORI Fighting Stick mini 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,", + "030000000d0f00008700000000010000,HORI Fighting Stick mini 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,", "030000000d0f00004d00000000000000,HORI Gem Pad 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "030000000d0f0000aa00000072050000,HORI Real Arcade Pro,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", "030000000d0f00006e00000000010000,HORIPAD 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", @@ -448,6 +455,7 @@ "030000004c050000cc09000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "050000004c050000e60c000000010000,PS5 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,misc1:b13,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "030000008f0e00000300000000000000,Piranha xtreme,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,", + "03000000222c00000225000000010000,Qanba Dragon Arcade Joystick (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "030000008916000000fd000000000000,Razer Onza TE,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", "03000000321500000204000000010000,Razer Panthera (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "03000000321500000104000000010000,Razer Panthera (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", @@ -523,6 +531,10 @@ "05000000203800000900000000010000,8BitDo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "05000000c82d00002038000000010000,8BitDo NES30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "05000000c82d00002038000000010000,8BitDo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "03000000c82d00000660000011010000,8BitDo Pro 2,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "03000000c82d00000660000011010000,8BitDo Pro 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "05000000c82d00000660000000010000,8BitDo Pro 2,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "05000000c82d00000660000000010000,8BitDo Pro 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "05000000c82d00000061000000010000,8BitDo SF30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "05000000c82d00000061000000010000,8BitDo SF30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "05000000102800000900000000010000,8BitDo SFC30 Gamepad,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", @@ -601,6 +613,8 @@ "030000000d0f00005001000009040000,HORI Fighting Commander OCTA,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "030000000d0f00008400000011010000,HORI Fighting Commander,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "030000000d0f00008500000010010000,HORI Fighting Commander,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000000d0f00008800000011010000,HORI Fighting Stick mini 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,", + "030000000d0f00008700000011010000,HORI Fighting Stick mini 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,rightshoulder:b5,rightstick:b11,righttrigger:a4,start:b9,x:b0,y:b3,", "030000000d0f0000d800000072056800,HORI Real Arcade Pro S,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", "030000000d0f0000aa00000011010000,HORI Real Arcade Pro,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", "030000000d0f00006e00000011010000,HORIPAD 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", @@ -667,9 +681,28 @@ "03000000790000004318000010010000,Nintendo GameCube Controller,a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "03000000790000004318000010010000,Nintendo GameCube Controller,a:b1,b:b0,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b2,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "030000007e0500003703000000016800,Nintendo GameCube Controller,a:b0,b:b2,dpdown:b6,dpleft:b4,dpright:b5,dpup:b7,lefttrigger:a4,leftx:a0,lefty:a1~,rightshoulder:b9,righttrigger:a5,rightx:a2,righty:a3~,start:b8,x:b1,y:b3,", + "050000004c69632050726f20436f6e00,Nintendo Switch Controller,a:b1,b:b0,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "050000004c69632050726f20436f6e00,Nintendo Switch Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "050000007e0500000620000001800000,Nintendo Switch Joy-Con (L),a:b15,b:b16,guide:b4,leftshoulder:b6,leftstick:b12,leftx:a1,lefty:a0~,rightshoulder:b8,start:b9,x:b17,y:b14,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "050000007e0500000620000001800000,Nintendo Switch Joy-Con (L),a:b16,b:b15,guide:b4,leftshoulder:b6,leftstick:b12,leftx:a1,lefty:a0~,rightshoulder:b8,start:b9,x:b14,y:b17,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "060000007e0500000620000000000000,Nintendo Switch Joy-Con (L/R),a:b1,b:b0,back:b9,dpdown:b15,dpleft:b16,dpright:b17,dpup:b14,leftshoulder:b5,leftstick:b12,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "060000007e0500000620000000000000,Nintendo Switch Joy-Con (L/R),a:b0,b:b1,back:b9,dpdown:b15,dpleft:b16,dpright:b17,dpup:b14,leftshoulder:b5,leftstick:b12,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "060000007e0500000820000000000000,Nintendo Switch Joy-Con (L/R),a:b1,b:b0,back:b9,dpdown:b15,dpleft:b16,dpright:b17,dpup:b14,guide:b11,leftshoulder:b5,leftstick:b12,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "060000007e0500000820000000000000,Nintendo Switch Joy-Con (L/R),a:b0,b:b1,back:b9,dpdown:b15,dpleft:b16,dpright:b17,dpup:b14,guide:b11,leftshoulder:b5,leftstick:b12,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "050000007e0500000720000001800000,Nintendo Switch Joy-Con (R),a:b2,b:b1,guide:b9,leftshoulder:b4,leftstick:b10,leftx:a1~,lefty:a0,rightshoulder:b6,start:b8,x:b3,y:b0,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "050000007e0500000720000001800000,Nintendo Switch Joy-Con (R),a:b1,b:b2,guide:b9,leftshoulder:b4,leftstick:b10,leftx:a1~,lefty:a0,rightshoulder:b6,start:b8,x:b0,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "03000000d620000013a7000011010000,Nintendo Switch PowerA Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "03000000d620000013a7000011010000,Nintendo Switch PowerA Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "03000000d620000011a7000011010000,Nintendo Switch PowerA Core Plus Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "03000000d620000011a7000011010000,Nintendo Switch PowerA Core Plus Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "030000007e0500000920000011810000,Nintendo Switch Pro Controller,a:b1,b:b0,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b11,leftshoulder:b5,leftstick:b12,lefttrigger:b7,leftx:a0,lefty:a1,misc1:b4,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "030000007e0500000920000011810000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b11,leftshoulder:b5,leftstick:b12,lefttrigger:b7,leftx:a0,lefty:a1,misc1:b4,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "050000007e0500000920000001000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "050000007e0500000920000001000000,Nintendo Switch Pro Controller,a:b1,b:b0,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", - "050000007e0500003003000001000000,Nintendo Wii Remote Pro Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,", + "050000007e0500000920000001800000,Nintendo Switch Pro Controller,a:b1,b:b0,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b11,leftshoulder:b5,leftstick:b12,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "050000007e0500000920000001800000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b11,leftshoulder:b5,leftstick:b12,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "050000007e0500003003000001000000,Nintendo Wii Remote Pro Controller,a:b1,b:b0,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "050000007e0500003003000001000000,Nintendo Wii Remote Pro Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "05000000010000000100000003000000,Nintendo Wiimote,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", "030000000d0500000308000010010000,Nostromo n45 Dual Analog Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b12,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b10,x:b2,y:b3,", "05000000362800000100000002010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,", @@ -712,6 +745,10 @@ "03000000c62400003a54000001010000,PowerA XBox One Controller,a:b0,b:b1,back:b6,dpdown:h0.7,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "03000000c62400000053000000010000,PowerA,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "03000000300f00001211000011010000,QanBa Arcade JoyStick,a:b2,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b5,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b6,start:b9,x:b1,y:b3,", + "03000000222c00000225000011010000,Qanba Dragon Arcade Joystick (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000222c00000025000011010000,Qanba Dragon Arcade Joystick (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000222c00000223000011010000,Qanba Obsidian Arcade Joystick (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000222c00000023000011010000,Qanba Obsidian Arcade Joystick (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "030000008916000001fd000024010000,Razer Onza Classic Edition,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "030000008916000000fd000024010000,Razer Onza Tournament Edition,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "03000000321500000204000011010000,Razer Panthera (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", @@ -748,8 +785,11 @@ "030000005e0400008e02000020200000,SpeedLink XEOX Pro Analog Gamepad pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "030000005e0400008e02000073050000,Speedlink TORID Wireless Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "03000000de2800000112000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", + "03000000de2800000112000011010000,Steam Controller,a:b2,b:b3,back:b10,dpdown:+a5,dpleft:-a4,dpright:+a4,dpup:-a5,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a7,leftx:a0,lefty:a1,paddle1:b15,paddle2:b16,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a3,start:b11,x:b4,y:b5,", "03000000de2800000211000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", + "03000000de2800000211000011010000,Steam Controller,a:b2,b:b3,back:b10,dpdown:+a5,dpleft:-a4,dpright:+a4,dpup:-a5,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a7,leftx:a0,lefty:a1,paddle1:b15,paddle2:b16,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a3,start:b11,x:b4,y:b5,", "03000000de2800004211000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", + "03000000de2800004211000011010000,Steam Controller,a:b2,b:b3,back:b10,dpdown:+a5,dpleft:-a4,dpright:+a4,dpup:-a5,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a7,leftx:a0,lefty:a1,paddle1:b15,paddle2:b16,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a3,start:b11,x:b4,y:b5,", "03000000de280000fc11000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "05000000de2800000212000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", "05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", @@ -847,8 +887,10 @@ "050000005509000003720000cf7f3f00,NVIDIA Controller v01.01,a:b0,b:b1,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", "050000005509000010720000ffff3f00,NVIDIA Controller v01.03,a:b0,b:b1,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", "050000005509000014720000df7f3f00,NVIDIA Controller v01.04,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a4,rightx:a2,righty:a5,start:b6,x:b2,y:b3,", - "050000007e05000009200000ffff0f00,Nintendo Switch Pro Controller,a:b1,b:b0,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:b15,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:b16,rightx:a2,righty:a3,start:b6,x:b3,y:b2,sdk>=:29,", - "050000007e05000009200000ffff0f00,Nintendo Switch Pro Controller,a:b0,b:b1,back:b15,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b3,leftstick:b4,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b6,righttrigger:b10,rightx:a2,righty:a3,start:b16,x:b17,y:b2,sdk<=:28,", /* Extremely slow in Bluetooth mode on Android */ + "050000007e05000009200000ffff0f00,Nintendo Switch Pro Controller,a:b1,b:b0,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:b15,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:b16,rightx:a2,righty:a3,start:b6,x:b3,y:b2,sdk>=:29,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "050000007e05000009200000ffff0f00,Nintendo Switch Pro Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:b15,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:b16,rightx:a2,righty:a3,start:b6,x:b2,y:b3,sdk>=:29,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "050000007e05000009200000ffff0f00,Nintendo Switch Pro Controller,a:b0,b:b1,back:b15,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b3,leftstick:b4,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b6,righttrigger:b10,rightx:a2,righty:a3,start:b16,x:b17,y:b2,sdk<=:28,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", /* Extremely slow in Bluetooth mode on Android */ + "050000007e05000009200000ffff0f00,Nintendo Switch Pro Controller,a:b1,b:b0,back:b15,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b3,leftstick:b4,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b6,righttrigger:b10,rightx:a2,righty:a3,start:b16,x:b2,y:b17,sdk<=:28,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", /* Extremely slow in Bluetooth mode on Android */ "050000004c05000068020000dfff3f00,PS3 Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", "030000004c050000cc09000000006800,PS4 Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", "050000004c050000c405000000783f00,PS4 Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", @@ -882,6 +924,14 @@ "05000000ac05000001000000df076d01,*,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b2,y:b3,", "05000000ac05000001000000ff076d01,*,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b10,x:b2,y:b3,", "05000000ac050000020000004f066d02,*,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,leftshoulder:b4,rightshoulder:b5,x:b2,y:b3,", + "050000007e050000062000004f060000,Nintendo Switch Joy-Con (L),+leftx:h0.2,+lefty:h0.4,-leftx:h0.8,-lefty:h0.1,a:b2,b:b0,guide:b6,leftshoulder:b4,rightshoulder:b5,x:b3,y:b1,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "050000007e050000062000004f060000,Nintendo Switch Joy-Con (L),+leftx:h0.2,+lefty:h0.4,-leftx:h0.8,-lefty:h0.1,a:b0,b:b2,guide:b6,leftshoulder:b4,rightshoulder:b5,x:b1,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "050000007e05000008200000df070000,Nintendo Switch Joy-Con (L/R),a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "050000007e05000008200000df070000,Nintendo Switch Joy-Con (L/R),a:b1,b:b0,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "050000007e050000072000004f060000,Nintendo Switch Joy-Con (R),+leftx:h0.2,+lefty:h0.4,-leftx:h0.8,-lefty:h0.1,a:b2,b:b0,guide:b6,leftshoulder:b4,rightshoulder:b5,x:b3,y:b1,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "050000007e050000072000004f060000,Nintendo Switch Joy-Con (R),+leftx:h0.2,+lefty:h0.4,-leftx:h0.8,-lefty:h0.1,a:b0,b:b2,guide:b6,leftshoulder:b4,rightshoulder:b5,x:b1,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "050000007e05000009200000ff870000,Nintendo Switch Pro Controller,a:b1,b:b0,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,misc1:b11,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b10,x:b3,y:b2,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", + "050000007e05000009200000ff870000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,misc1:b11,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b10,x:b2,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "050000004c050000cc090000df070000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b2,y:b3,", "050000004c050000cc090000df870001,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b2,y:b3,", "050000004c050000cc090000ff070000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b10,x:b2,y:b3,", @@ -896,9 +946,6 @@ "050000005e040000e0020000df070000,Xbox Wireless Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b2,y:b3,", "050000005e040000e0020000ff070000,Xbox Wireless Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b10,x:b2,y:b3,", #endif -#if defined(SDL_JOYSTICK_VIRTUAL) - "00000000000000000000000000007601,Virtual Joystick,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", -#endif #if defined(SDL_JOYSTICK_EMSCRIPTEN) "default,Standard Gamepad,a:b0,b:b1,back:b8,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b16,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", #endif @@ -908,6 +955,9 @@ #if defined(SDL_JOYSTICK_PSP) "505350206275696c74696e206a6f7970,PSP builtin joypad,a:b2,b:b1,back:b10,dpdown:b6,dpleft:b7,dpright:b9,dpup:b8,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,rightx:a2,righty:a3,start:b11,x:b3,y:b0,", #endif +#if defined(SDL_JOYSTICK_PS2) + "50533220436f6e74726f6c6c65720000,PS2 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", +#endif "hidapi,*,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", NULL }; diff -Nru libsdl2-2.0.22+dfsg/src/joystick/SDL_joystick.c libsdl2-2.24.0+dfsg/src/joystick/SDL_joystick.c --- libsdl2-2.0.22+dfsg/src/joystick/SDL_joystick.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/SDL_joystick.c 2022-08-19 15:46:21.000000000 +0000 @@ -27,6 +27,7 @@ #include "SDL_events.h" #include "SDL_sysjoystick.h" #include "SDL_hints.h" +#include "../SDL_hints_c.h" #if !SDL_EVENTS_DISABLED #include "../events/SDL_events_c.h" @@ -37,7 +38,7 @@ /* This is included in only one place because it has a large static list of controllers */ #include "controller_type.h" -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__WINGDK__) /* Needed for checking for input remapping programs */ #include "../core/windows/SDL_windows.h" @@ -89,6 +90,9 @@ #ifdef SDL_JOYSTICK_OS2 &SDL_OS2_JoystickDriver, #endif +#ifdef SDL_JOYSTICK_PS2 + &SDL_PS2_JoystickDriver, +#endif #ifdef SDL_JOYSTICK_PSP &SDL_PSP_JoystickDriver, #endif @@ -182,7 +186,7 @@ SDL_joystick_players = new_players; SDL_memset(&SDL_joystick_players[SDL_joystick_player_count], 0xFF, (player_index - SDL_joystick_player_count + 1) * sizeof(SDL_joystick_players[0])); SDL_joystick_player_count = player_index + 1; - } else if (SDL_joystick_players[player_index] == instance_id) { + } else if (player_index >= 0 && SDL_joystick_players[player_index] == instance_id) { /* Joystick is already assigned the requested player index */ return SDL_TRUE; } @@ -213,7 +217,7 @@ static void SDLCALL SDL_JoystickAllowBackgroundEventsChanged(void *userdata, const char *name, const char *oldValue, const char *hint) { - if (hint && *hint == '1') { + if (SDL_GetStringBoolean(hint, SDL_FALSE)) { SDL_joystick_allows_background_events = SDL_TRUE; } else { SDL_joystick_allows_background_events = SDL_FALSE; @@ -321,6 +325,28 @@ } /* + * Get the implementation dependent path of a joystick + */ +const char * +SDL_JoystickPathForIndex(int device_index) +{ + SDL_JoystickDriver *driver; + const char *path = NULL; + + SDL_LockJoysticks(); + if (SDL_GetDriverAndJoystickIndex(device_index, &driver, &device_index)) { + path = driver->GetDevicePath(device_index); + } + SDL_UnlockJoysticks(); + + /* FIXME: Really we should reference count this path so it doesn't go away after unlock */ + if (!path) { + SDL_Unsupported(); + } + return path; +} + +/* * Get the player index of a joystick, or -1 if it's not available */ int @@ -386,6 +412,8 @@ SDL_Joystick *joystick; SDL_Joystick *joysticklist; const char *joystickname = NULL; + const char *joystickpath = NULL; + SDL_JoystickPowerLevel initial_power_level; SDL_LockJoysticks(); @@ -435,6 +463,13 @@ joystick->name = NULL; } + joystickpath = driver->GetDevicePath(device_index); + if (joystickpath) { + joystick->path = SDL_strdup(joystickpath); + } else { + joystick->path = NULL; + } + joystick->guid = driver->GetDeviceGUID(device_index); if (joystick->naxes > 0) { @@ -478,6 +513,11 @@ SDL_UnlockJoysticks(); + /* send initial battery event */ + initial_power_level = joystick->epowerlevel; + joystick->epowerlevel = SDL_JOYSTICK_POWER_UNKNOWN; + SDL_PrivateJoystickBatteryLevel(joystick, initial_power_level); + driver->Update(joystick); return joystick; @@ -487,8 +527,22 @@ SDL_JoystickAttachVirtual(SDL_JoystickType type, int naxes, int nbuttons, int nhats) { + SDL_VirtualJoystickDesc desc; + + SDL_zero(desc); + desc.version = SDL_VIRTUAL_JOYSTICK_DESC_VERSION; + desc.type = (Uint16)type; + desc.naxes = (Uint16)naxes; + desc.nbuttons = (Uint16)nbuttons; + desc.nhats = (Uint16)nhats; + return SDL_JoystickAttachVirtualEx(&desc); +} + +int +SDL_JoystickAttachVirtualEx(const SDL_VirtualJoystickDesc *desc) +{ #if SDL_JOYSTICK_VIRTUAL - return SDL_JoystickAttachVirtualInner(type, naxes, nbuttons, nhats); + return SDL_JoystickAttachVirtualInner(desc); #else return SDL_SetError("SDL not built with virtual-joystick support"); #endif @@ -834,6 +888,23 @@ return joystick->name; } +/* + * Get the implementation dependent path of this joystick + */ +const char * +SDL_JoystickPath(SDL_Joystick *joystick) +{ + if (!SDL_PrivateJoystickValid(joystick)) { + return NULL; + } + + if (!joystick->path) { + SDL_Unsupported(); + return NULL; + } + return joystick->path; +} + /** * Get the player index of an opened joystick, or -1 if it's not available */ @@ -1006,14 +1077,13 @@ SDL_LockJoysticks(); isfreshvalue = red != joystick->led_red || - green != joystick->led_green || - blue != joystick->led_blue; + green != joystick->led_green || + blue != joystick->led_blue; - if ( isfreshvalue || SDL_TICKS_PASSED( SDL_GetTicks(), joystick->led_expiration ) ) { + if (isfreshvalue || SDL_TICKS_PASSED(SDL_GetTicks(), joystick->led_expiration)) { result = joystick->driver->SetLED(joystick, red, green, blue); joystick->led_expiration = SDL_GetTicks() + SDL_LED_MIN_REPEAT_MS; - } - else { + } else { /* Avoid spamming the driver */ result = 0; } @@ -1100,6 +1170,7 @@ } SDL_free(joystick->name); + SDL_free(joystick->path); SDL_free(joystick->serial); /* Free the data associated with this joystick */ @@ -1261,13 +1332,13 @@ * to have the right value for which, because the number of controllers in * the system is now one less. */ -static void UpdateEventsForDeviceRemoval(int device_index) +static void UpdateEventsForDeviceRemoval(int device_index, Uint32 type) { int i, num_events; SDL_Event *events; SDL_bool isstack; - num_events = SDL_PeepEvents(NULL, 0, SDL_PEEKEVENT, SDL_JOYDEVICEADDED, SDL_JOYDEVICEADDED); + num_events = SDL_PeepEvents(NULL, 0, SDL_PEEKEVENT, type, type); if (num_events <= 0) { return; } @@ -1277,20 +1348,38 @@ return; } - num_events = SDL_PeepEvents(events, num_events, SDL_GETEVENT, SDL_JOYDEVICEADDED, SDL_JOYDEVICEADDED); + num_events = SDL_PeepEvents(events, num_events, SDL_GETEVENT, type, type); for (i = 0; i < num_events; ++i) { - if (events[i].cdevice.which < device_index) { - /* No change for index values lower than the removed device */ + Sint32 which = -1; + switch (type) { + case SDL_JOYDEVICEADDED: + which = events[i].jdevice.which; + break; + case SDL_CONTROLLERDEVICEADDED: + which = events[i].cdevice.which; + break; + default: + break; } - else if (events[i].cdevice.which == device_index) { + if (which < device_index) { + /* No change for index values lower than the removed device */ + } else if (which == device_index) { /* Drop this event entirely */ SDL_memmove(&events[i], &events[i + 1], sizeof(*events) * (num_events - (i + 1))); --num_events; --i; - } - else { + } else { /* Fix up the device index if greater than the removed device */ - --events[i].cdevice.which; + switch (type) { + case SDL_JOYDEVICEADDED: + --events[i].jdevice.which; + break; + case SDL_CONTROLLERDEVICEADDED: + --events[i].cdevice.which; + break; + default: + break; + } } } SDL_PeepEvents(events, num_events, SDL_ADDEVENT, 0, 0); @@ -1357,7 +1446,8 @@ SDL_PushEvent(&event); } - UpdateEventsForDeviceRemoval(device_index); + UpdateEventsForDeviceRemoval(device_index, SDL_JOYDEVICEADDED); + UpdateEventsForDeviceRemoval(device_index, SDL_CONTROLLERDEVICEADDED); #endif /* !SDL_EVENTS_DISABLED */ SDL_LockJoysticks(); @@ -1653,7 +1743,8 @@ #else const Uint32 event_list[] = { SDL_JOYAXISMOTION, SDL_JOYBALLMOTION, SDL_JOYHATMOTION, - SDL_JOYBUTTONDOWN, SDL_JOYBUTTONUP, SDL_JOYDEVICEADDED, SDL_JOYDEVICEREMOVED + SDL_JOYBUTTONDOWN, SDL_JOYBUTTONUP, SDL_JOYDEVICEADDED, SDL_JOYDEVICEREMOVED, + SDL_JOYBATTERYUPDATED }; unsigned int i; @@ -1689,15 +1780,15 @@ /* guid16[4] is product ID */ guid16[5] == 0x0000 /* guid16[6] is product version */ - ) { + ) { if (vendor) { - *vendor = guid16[2]; + *vendor = SDL_SwapLE16(guid16[2]); } if (product) { - *product = guid16[4]; + *product = SDL_SwapLE16(guid16[4]); } if (version) { - *version = guid16[6]; + *version = SDL_SwapLE16(guid16[6]); } } else { if (vendor) { @@ -1765,23 +1856,48 @@ if (*vendor_name && *product_name) { len = (SDL_strlen(vendor_name) + 1 + SDL_strlen(product_name) + 1); name = (char *)SDL_malloc(len); - if (!name) { - return NULL; + if (name) { + SDL_snprintf(name, len, "%s %s", vendor_name, product_name); } - SDL_snprintf(name, len, "%s %s", vendor_name, product_name); } else if (*product_name) { name = SDL_strdup(product_name); } else if (vendor || product) { - len = (6 + 1 + 6 + 1); - name = (char *)SDL_malloc(len); - if (!name) { - return NULL; + /* Couldn't find a controller name, try to give it one based on device type */ + switch (SDL_GetJoystickGameControllerTypeFromVIDPID(vendor, product, NULL, SDL_TRUE)) { + case SDL_CONTROLLER_TYPE_XBOX360: + name = SDL_strdup("Xbox 360 Controller"); + break; + case SDL_CONTROLLER_TYPE_XBOXONE: + name = SDL_strdup("Xbox One Controller"); + break; + case SDL_CONTROLLER_TYPE_PS3: + name = SDL_strdup("PS3 Controller"); + break; + case SDL_CONTROLLER_TYPE_PS4: + name = SDL_strdup("PS4 Controller"); + break; + case SDL_CONTROLLER_TYPE_PS5: + name = SDL_strdup("PS5 Controller"); + break; + case SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO: + name = SDL_strdup("Nintendo Switch Pro Controller"); + break; + default: + len = (6 + 1 + 6 + 1); + name = (char *)SDL_malloc(len); + if (name) { + SDL_snprintf(name, len, "0x%.4x/0x%.4x", vendor, product); + } + break; } - SDL_snprintf(name, len, "0x%.4x/0x%.4x", vendor, product); } else { name = SDL_strdup("Controller"); } + if (!name) { + return NULL; + } + /* Trim trailing whitespace */ for (len = SDL_strlen(name); (len > 0 && name[len - 1] == ' '); --len) { /* continue */ @@ -1830,9 +1946,97 @@ } SDL_GameControllerType -SDL_GetJoystickGameControllerTypeFromVIDPID(Uint16 vendor, Uint16 product) +SDL_GetJoystickGameControllerTypeFromVIDPID(Uint16 vendor, Uint16 product, const char *name, SDL_bool forUI) { - return SDL_GetJoystickGameControllerType(NULL, vendor, product, -1, 0, 0, 0); + SDL_GameControllerType type = SDL_CONTROLLER_TYPE_UNKNOWN; + + if (vendor == 0x0000 && product == 0x0000) { + /* Some devices are only identifiable by their name */ + if (name && + (SDL_strcmp(name, "Lic Pro Controller") == 0 || + SDL_strcmp(name, "Nintendo Wireless Gamepad") == 0 || + SDL_strcmp(name, "Wireless Gamepad") == 0)) { + /* HORI or PowerA Switch Pro Controller clone */ + type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO; + } + + } else if (vendor == 0x0001 && product == 0x0001) { + type = SDL_CONTROLLER_TYPE_UNKNOWN; + + } else if (vendor == USB_VENDOR_MICROSOFT && product == USB_PRODUCT_XBOX_ONE_XINPUT_CONTROLLER) { + type = SDL_CONTROLLER_TYPE_XBOXONE; + + } else if ((vendor == USB_VENDOR_AMAZON && product == USB_PRODUCT_AMAZON_LUNA_CONTROLLER) || + (vendor == BLUETOOTH_VENDOR_AMAZON && product == BLUETOOTH_PRODUCT_LUNA_CONTROLLER)) { + type = SDL_CONTROLLER_TYPE_AMAZON_LUNA; + + } else if (vendor == USB_VENDOR_GOOGLE && product == USB_PRODUCT_GOOGLE_STADIA_CONTROLLER) { + type = SDL_CONTROLLER_TYPE_GOOGLE_STADIA; + + } else if (vendor == USB_VENDOR_NINTENDO && product == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_LEFT) { + type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_LEFT; + + } else if (vendor == USB_VENDOR_NINTENDO && product == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_RIGHT) { + if (name && SDL_strstr(name, "NES Controller") != NULL) { + /* We don't have a type for the Nintendo Online NES Controller */ + type = SDL_CONTROLLER_TYPE_UNKNOWN; + } else { + type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT; + } + + } else if (vendor == USB_VENDOR_NINTENDO && product == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_GRIP) { + if (name && SDL_strstr(name, "(L)") != NULL) { + type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_LEFT; + } else { + type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT; + } + + } else if (vendor == USB_VENDOR_NINTENDO && product == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_PAIR) { + type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR; + + } else if (vendor == USB_VENDOR_NVIDIA && product == USB_PRODUCT_NVIDIA_SHIELD_CONTROLLER) { + type = SDL_CONTROLLER_TYPE_NVIDIA_SHIELD; + + } else { + switch (GuessControllerType(vendor, product)) { + case k_eControllerType_XBox360Controller: + type = SDL_CONTROLLER_TYPE_XBOX360; + break; + case k_eControllerType_XBoxOneController: + type = SDL_CONTROLLER_TYPE_XBOXONE; + break; + case k_eControllerType_PS3Controller: + type = SDL_CONTROLLER_TYPE_PS3; + break; + case k_eControllerType_PS4Controller: + type = SDL_CONTROLLER_TYPE_PS4; + break; + case k_eControllerType_PS5Controller: + type = SDL_CONTROLLER_TYPE_PS5; + break; + case k_eControllerType_XInputPS4Controller: + if (forUI) { + type = SDL_CONTROLLER_TYPE_PS4; + } else { + type = SDL_CONTROLLER_TYPE_UNKNOWN; + } + break; + case k_eControllerType_SwitchProController: + case k_eControllerType_SwitchInputOnlyController: + type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO; + break; + case k_eControllerType_XInputSwitchController: + if (forUI) { + type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO; + } else { + type = SDL_CONTROLLER_TYPE_UNKNOWN; + } + break; + default: + break; + } + } + return type; } SDL_GameControllerType @@ -1842,157 +2046,24 @@ Uint16 vendor, product; SDL_GetJoystickGUIDInfo(guid, &vendor, &product, NULL); - type = SDL_GetJoystickGameControllerType(name, vendor, product, -1, 0, 0, 0); + type = SDL_GetJoystickGameControllerTypeFromVIDPID(vendor, product, name, SDL_TRUE); if (type == SDL_CONTROLLER_TYPE_UNKNOWN) { if (SDL_IsJoystickXInput(guid)) { /* This is probably an Xbox One controller */ return SDL_CONTROLLER_TYPE_XBOXONE; } + if (SDL_IsJoystickVirtual(guid)) { + return SDL_CONTROLLER_TYPE_VIRTUAL; + } } return type; } -SDL_GameControllerType -SDL_GetJoystickGameControllerType(const char *name, Uint16 vendor, Uint16 product, int interface_number, int interface_class, int interface_subclass, int interface_protocol) +SDL_bool +SDL_IsJoystickXboxOne(Uint16 vendor_id, Uint16 product_id) { - static const int LIBUSB_CLASS_VENDOR_SPEC = 0xFF; - static const int XB360_IFACE_SUBCLASS = 93; - static const int XB360_IFACE_PROTOCOL = 1; /* Wired */ - static const int XB360W_IFACE_PROTOCOL = 129; /* Wireless */ - static const int XBONE_IFACE_SUBCLASS = 71; - static const int XBONE_IFACE_PROTOCOL = 208; - - SDL_GameControllerType type = SDL_CONTROLLER_TYPE_UNKNOWN; - - /* This code should match the checks in libusb/hid.c and HIDDeviceManager.java */ - if (interface_class == LIBUSB_CLASS_VENDOR_SPEC && - interface_subclass == XB360_IFACE_SUBCLASS && - (interface_protocol == XB360_IFACE_PROTOCOL || - interface_protocol == XB360W_IFACE_PROTOCOL)) { - - static const int SUPPORTED_VENDORS[] = { - 0x0079, /* GPD Win 2 */ - 0x044f, /* Thrustmaster */ - 0x045e, /* Microsoft */ - 0x046d, /* Logitech */ - 0x056e, /* Elecom */ - 0x06a3, /* Saitek */ - 0x0738, /* Mad Catz */ - 0x07ff, /* Mad Catz */ - 0x0e6f, /* PDP */ - 0x0f0d, /* Hori */ - 0x1038, /* SteelSeries */ - 0x11c9, /* Nacon */ - 0x12ab, /* Unknown */ - 0x1430, /* RedOctane */ - 0x146b, /* BigBen */ - 0x1532, /* Razer */ - 0x15e4, /* Numark */ - 0x162e, /* Joytech */ - 0x1689, /* Razer Onza */ - 0x1949, /* Lab126, Inc. */ - 0x1bad, /* Harmonix */ - 0x20d6, /* PowerA */ - 0x24c6, /* PowerA */ - }; - - int i; - for (i = 0; i < SDL_arraysize(SUPPORTED_VENDORS); ++i) { - if (vendor == SUPPORTED_VENDORS[i]) { - type = SDL_CONTROLLER_TYPE_XBOX360; - break; - } - } - } - - if (interface_number == 0 && - interface_class == LIBUSB_CLASS_VENDOR_SPEC && - interface_subclass == XBONE_IFACE_SUBCLASS && - interface_protocol == XBONE_IFACE_PROTOCOL) { - - static const int SUPPORTED_VENDORS[] = { - 0x045e, /* Microsoft */ - 0x0738, /* Mad Catz */ - 0x0e6f, /* PDP */ - 0x0f0d, /* Hori */ - 0x1532, /* Razer */ - 0x20d6, /* PowerA */ - 0x24c6, /* PowerA */ - 0x2e24, /* Hyperkin */ - }; - - int i; - for (i = 0; i < SDL_arraysize(SUPPORTED_VENDORS); ++i) { - if (vendor == SUPPORTED_VENDORS[i]) { - type = SDL_CONTROLLER_TYPE_XBOXONE; - break; - } - } - } - - if (type == SDL_CONTROLLER_TYPE_UNKNOWN) { - if (vendor == 0x0000 && product == 0x0000) { - /* Some devices are only identifiable by their name */ - if (name && - (SDL_strcmp(name, "Lic Pro Controller") == 0 || - SDL_strcmp(name, "Nintendo Wireless Gamepad") == 0 || - SDL_strcmp(name, "Wireless Gamepad") == 0)) { - /* HORI or PowerA Switch Pro Controller clone */ - type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO; - } else if (name && SDL_strcmp(name, "Virtual Joystick") == 0) { - type = SDL_CONTROLLER_TYPE_VIRTUAL; - } else { - type = SDL_CONTROLLER_TYPE_UNKNOWN; - } - - } else if (vendor == 0x0001 && product == 0x0001) { - type = SDL_CONTROLLER_TYPE_UNKNOWN; - - } else if (vendor == USB_VENDOR_MICROSOFT && product == USB_PRODUCT_XBOX_ONE_XINPUT_CONTROLLER) { - type = SDL_CONTROLLER_TYPE_XBOXONE; - - } else if ((vendor == USB_VENDOR_AMAZON && product == USB_PRODUCT_AMAZON_LUNA_CONTROLLER) || - (vendor == BLUETOOTH_VENDOR_AMAZON && product == BLUETOOTH_PRODUCT_LUNA_CONTROLLER)) { - type = SDL_CONTROLLER_TYPE_AMAZON_LUNA; - - } else if (vendor == USB_VENDOR_GOOGLE && product == USB_PRODUCT_GOOGLE_STADIA_CONTROLLER) { - type = SDL_CONTROLLER_TYPE_GOOGLE_STADIA; - - } else if (vendor == USB_VENDOR_NINTENDO && product == USB_PRODUCT_NINTENDO_SWITCH_JOY_CON_GRIP) { - type = SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, SDL_FALSE) ? SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO : SDL_CONTROLLER_TYPE_UNKNOWN; - - } else { - switch (GuessControllerType(vendor, product)) { - case k_eControllerType_XBox360Controller: - type = SDL_CONTROLLER_TYPE_XBOX360; - break; - case k_eControllerType_XBoxOneController: - type = SDL_CONTROLLER_TYPE_XBOXONE; - break; - case k_eControllerType_PS3Controller: - type = SDL_CONTROLLER_TYPE_PS3; - break; - case k_eControllerType_PS4Controller: - type = SDL_CONTROLLER_TYPE_PS4; - break; - case k_eControllerType_PS5Controller: - type = SDL_CONTROLLER_TYPE_PS5; - break; - case k_eControllerType_SwitchProController: - case k_eControllerType_SwitchInputOnlyController: - type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO; - break; - case k_eControllerType_SwitchJoyConLeft: - case k_eControllerType_SwitchJoyConRight: - type = SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, SDL_FALSE) ? SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO : SDL_CONTROLLER_TYPE_UNKNOWN; - break; - default: - type = SDL_CONTROLLER_TYPE_UNKNOWN; - break; - } - } - } - return type; + EControllerType eType = GuessControllerType(vendor_id, product_id); + return (eType == k_eControllerType_XBoxOneController); } SDL_bool @@ -2031,6 +2102,11 @@ return SDL_TRUE; } } + if (vendor_id == USB_VENDOR_8BITDO) { + if (product_id == USB_PRODUCT_8BITDO_XBOX_CONTROLLER) { + return SDL_TRUE; + } + } return SDL_FALSE; } @@ -2071,8 +2147,7 @@ { EControllerType eType = GuessControllerType(vendor_id, product_id); return (eType == k_eControllerType_SwitchProController || - eType == k_eControllerType_SwitchInputOnlyController || - (vendor_id == USB_VENDOR_NINTENDO && product_id == USB_PRODUCT_NINTENDO_SWITCH_JOY_CON_GRIP)); + eType == k_eControllerType_SwitchInputOnlyController); } SDL_bool @@ -2105,6 +2180,18 @@ } SDL_bool +SDL_IsJoystickNintendoSwitchJoyConGrip(Uint16 vendor_id, Uint16 product_id) +{ + return (vendor_id == USB_VENDOR_NINTENDO && product_id == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_GRIP); +} + +SDL_bool +SDL_IsJoystickNintendoSwitchJoyConPair(Uint16 vendor_id, Uint16 product_id) +{ + return (vendor_id == USB_VENDOR_NINTENDO && product_id == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_PAIR); +} + +SDL_bool SDL_IsJoystickSteamController(Uint16 vendor_id, Uint16 product_id) { EControllerType eType = GuessControllerType(vendor_id, product_id); @@ -2182,25 +2269,32 @@ { static Uint32 arcadestick_joysticks[] = { MAKE_VIDPID(0x0079, 0x181a), /* Venom Arcade Stick */ - MAKE_VIDPID(0x0f0d, 0x006a), /* Real Arcade Pro 4 */ MAKE_VIDPID(0x0079, 0x181b), /* Venom Arcade Stick */ MAKE_VIDPID(0x0c12, 0x0ef6), /* Hitbox Arcade Stick */ - MAKE_VIDPID(0x0f0d, 0x008a), /* HORI Real Arcade Pro 4 */ + MAKE_VIDPID(0x0e6f, 0x0109), /* PDP Versus Fighting Pad */ MAKE_VIDPID(0x0f0d, 0x0016), /* Hori Real Arcade Pro.EX */ MAKE_VIDPID(0x0f0d, 0x001b), /* Hori Real Arcade Pro VX */ + MAKE_VIDPID(0x0f0d, 0x0063), /* Hori Real Arcade Pro Hayabusa (USA) Xbox One */ + MAKE_VIDPID(0x0f0d, 0x006a), /* Real Arcade Pro 4 */ + MAKE_VIDPID(0x0f0d, 0x0078), /* Hori Real Arcade Pro V Kai Xbox One */ + MAKE_VIDPID(0x0f0d, 0x008a), /* HORI Real Arcade Pro 4 */ MAKE_VIDPID(0x0f0d, 0x008c), /* Hori Real Arcade Pro 4 */ + MAKE_VIDPID(0x0f0d, 0x00aa), /* HORI Real Arcade Pro V Hayabusa in Switch Mode */ + MAKE_VIDPID(0x1532, 0x0a00), /* Razer Atrox Arcade Stick */ MAKE_VIDPID(0x1bad, 0xf03d), /* Street Fighter IV Arcade Stick TE - Chun Li */ MAKE_VIDPID(0x1bad, 0xf502), /* Hori Real Arcade Pro.VX SA */ MAKE_VIDPID(0x1bad, 0xf504), /* Hori Real Arcade Pro. EX */ MAKE_VIDPID(0x1bad, 0xf506), /* Hori Real Arcade Pro.EX Premium VLX */ + MAKE_VIDPID(0x20d6, 0xa715), /* PowerA Nintendo Switch Fusion Arcade Stick */ MAKE_VIDPID(0x24c6, 0x5000), /* Razer Atrox Arcade Stick */ MAKE_VIDPID(0x24c6, 0x5501), /* Hori Real Arcade Pro VX-SA */ MAKE_VIDPID(0x24c6, 0x550e), /* Hori Real Arcade Pro V Kai 360 */ - MAKE_VIDPID(0x0f0d, 0x0063), /* Hori Real Arcade Pro Hayabusa (USA) Xbox One */ - MAKE_VIDPID(0x0f0d, 0x0078), /* Hori Real Arcade Pro V Kai Xbox One */ - MAKE_VIDPID(0x1532, 0x0a00), /* Razer Atrox Arcade Stick */ - MAKE_VIDPID(0x0f0d, 0x00aa), /* HORI Real Arcade Pro V Hayabusa in Switch Mode */ - MAKE_VIDPID(0x20d6, 0xa715), /* PowerA Nintendo Switch Fusion Arcade Stick */ + MAKE_VIDPID(0x2c22, 0x2300), /* Qanba Obsidian Arcade Joystick in PS4 Mode */ + MAKE_VIDPID(0x2c22, 0x2302), /* Qanba Obsidian Arcade Joystick in PS3 Mode */ + MAKE_VIDPID(0x2c22, 0x2303), /* Qanba Obsidian Arcade Joystick in PC Mode */ + MAKE_VIDPID(0x2c22, 0x2500), /* Qanba Dragon Arcade Joystick in PS4 Mode */ + MAKE_VIDPID(0x2c22, 0x2502), /* Qanba Dragon Arcade Joystick in PS3 Mode */ + MAKE_VIDPID(0x2c22, 0x2503), /* Qanba Dragon Arcade Joystick in PC Mode */ }; int i; @@ -2313,7 +2407,7 @@ static SDL_bool SDL_IsPS4RemapperRunning(void) { -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__WINGDK__) const char *mapper_processes[] = { "DS4Windows.exe", "InputMapper.exe", @@ -2490,13 +2584,12 @@ } } - type = SDL_GetJoystickGameControllerType(name, vendor, product, -1, 0, 0, 0); + type = SDL_GetJoystickGameControllerTypeFromVIDPID(vendor, product, name, SDL_FALSE); if ((type == SDL_CONTROLLER_TYPE_PS4 || type == SDL_CONTROLLER_TYPE_PS5) && SDL_IsPS4RemapperRunning()) { return SDL_TRUE; } - if (SDL_IsGameControllerNameAndGUID(name, guid) && - SDL_ShouldIgnoreGameController(name, guid)) { + if (SDL_ShouldIgnoreGameController(name, guid)) { return SDL_TRUE; } @@ -2629,6 +2722,14 @@ return version; } +Uint16 SDL_JoystickGetFirmwareVersion(SDL_Joystick *joystick) +{ + if (!SDL_PrivateJoystickValid(joystick)) { + return 0; + } + return joystick->firmware_version; +} + const char *SDL_JoystickGetSerial(SDL_Joystick *joystick) { if (!SDL_PrivateJoystickValid(joystick)) { @@ -2654,74 +2755,31 @@ /* convert the guid to a printable string */ void SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID) { - static const char k_rgchHexToASCII[] = "0123456789abcdef"; - int i; - - if ((pszGUID == NULL) || (cbGUID <= 0)) { - return; - } - - for (i = 0; i < sizeof(guid.data) && i < (cbGUID-1)/2; i++) { - /* each input byte writes 2 ascii chars, and might write a null byte. */ - /* If we don't have room for next input byte, stop */ - unsigned char c = guid.data[i]; - - *pszGUID++ = k_rgchHexToASCII[c >> 4]; - *pszGUID++ = k_rgchHexToASCII[c & 0x0F]; - } - *pszGUID = '\0'; -} - -/*----------------------------------------------------------------------------- - * Purpose: Returns the 4 bit nibble for a hex character - * Input : c - - * Output : unsigned char - *-----------------------------------------------------------------------------*/ -static unsigned char nibble(unsigned char c) -{ - if ((c >= '0') && (c <= '9')) { - return (c - '0'); - } - - if ((c >= 'A') && (c <= 'F')) { - return (c - 'A' + 0x0a); - } - - if ((c >= 'a') && (c <= 'f')) { - return (c - 'a' + 0x0a); - } - - /* received an invalid character, and no real way to return an error */ - /* AssertMsg1(false, "Q_nibble invalid hex character '%c' ", c); */ - return 0; + SDL_GUIDToString(guid, pszGUID, cbGUID); } /* convert the string version of a joystick guid to the struct */ SDL_JoystickGUID SDL_JoystickGetGUIDFromString(const char *pchGUID) { - SDL_JoystickGUID guid; - int maxoutputbytes= sizeof(guid); - size_t len = SDL_strlen(pchGUID); - Uint8 *p; - size_t i; - - /* Make sure it's even */ - len = (len) & ~0x1; - - SDL_memset(&guid, 0x00, sizeof(guid)); - - p = (Uint8 *)&guid; - for (i = 0; (i < len) && ((p - (Uint8 *)&guid) < maxoutputbytes); i+=2, p++) { - *p = (nibble((unsigned char)pchGUID[i]) << 4) | nibble((unsigned char)pchGUID[i+1]); - } - - return guid; + return SDL_GUIDFromString(pchGUID); } /* update the power level for this joystick */ void SDL_PrivateJoystickBatteryLevel(SDL_Joystick *joystick, SDL_JoystickPowerLevel ePowerLevel) { - joystick->epowerlevel = ePowerLevel; + SDL_assert(joystick->ref_count); /* make sure we are calling this only for update, not for initialisation */ + if (ePowerLevel != joystick->epowerlevel) { +#if !SDL_EVENTS_DISABLED + if (SDL_GetEventState(SDL_JOYBATTERYUPDATED) == SDL_ENABLE) { + SDL_Event event; + event.type = SDL_JOYBATTERYUPDATED; + event.jbattery.which = joystick->instance_id; + event.jbattery.level = ePowerLevel; + SDL_PushEvent(&event); + } +#endif /* !SDL_EVENTS_DISABLED */ + joystick->epowerlevel = ePowerLevel; + } } /* return its power level */ diff -Nru libsdl2-2.0.22+dfsg/src/joystick/SDL_joystick_c.h libsdl2-2.24.0+dfsg/src/joystick/SDL_joystick_c.h --- libsdl2-2.0.22+dfsg/src/joystick/SDL_joystick_c.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/SDL_joystick_c.h 2022-08-13 03:48:10.000000000 +0000 @@ -28,6 +28,11 @@ #include "SDL_gamecontroller.h" #include "SDL_joystick.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + struct _SDL_JoystickDriver; /* Initialization and shutdown functions */ @@ -58,9 +63,11 @@ extern char *SDL_CreateJoystickName(Uint16 vendor, Uint16 product, const char *vendor_name, const char *product_name); /* Function to return the type of a controller */ -extern SDL_GameControllerType SDL_GetJoystickGameControllerTypeFromVIDPID(Uint16 vendor, Uint16 product); +extern SDL_GameControllerType SDL_GetJoystickGameControllerTypeFromVIDPID(Uint16 vendor, Uint16 product, const char *name, SDL_bool forUI); extern SDL_GameControllerType SDL_GetJoystickGameControllerTypeFromGUID(SDL_JoystickGUID guid, const char *name); -extern SDL_GameControllerType SDL_GetJoystickGameControllerType(const char *name, Uint16 vendor, Uint16 product, int interface_number, int interface_class, int interface_subclass, int interface_protocol); + +/* Function to return whether a joystick is an Xbox One controller */ +extern SDL_bool SDL_IsJoystickXboxOne(Uint16 vendor_id, Uint16 product_id); /* Function to return whether a joystick is an Xbox One Elite controller */ extern SDL_bool SDL_IsJoystickXboxOneElite(Uint16 vendor_id, Uint16 product_id); @@ -83,6 +90,8 @@ extern SDL_bool SDL_IsJoystickNintendoSwitchJoyCon(Uint16 vendor_id, Uint16 product_id); extern SDL_bool SDL_IsJoystickNintendoSwitchJoyConLeft(Uint16 vendor_id, Uint16 product_id); extern SDL_bool SDL_IsJoystickNintendoSwitchJoyConRight(Uint16 vendor_id, Uint16 product_id); +extern SDL_bool SDL_IsJoystickNintendoSwitchJoyConGrip(Uint16 vendor_id, Uint16 product_id); +extern SDL_bool SDL_IsJoystickNintendoSwitchJoyConPair(Uint16 vendor_id, Uint16 product_id); /* Function to return whether a joystick is a Steam Controller */ extern SDL_bool SDL_IsJoystickSteamController(Uint16 vendor_id, Uint16 product_id); @@ -168,6 +177,11 @@ SDL_InputMapping dpdown; SDL_InputMapping dpleft; SDL_InputMapping dpright; + SDL_InputMapping misc1; + SDL_InputMapping paddle1; + SDL_InputMapping paddle2; + SDL_InputMapping paddle3; + SDL_InputMapping paddle4; SDL_InputMapping leftx; SDL_InputMapping lefty; SDL_InputMapping rightx; @@ -180,6 +194,11 @@ extern SDL_bool SDL_PrivateJoystickGetAutoGamepadMapping(int device_index, SDL_GamepadMapping *out); +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif + #endif /* SDL_joystick_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/joystick/SDL_sysjoystick.h libsdl2-2.24.0+dfsg/src/joystick/SDL_sysjoystick.h --- libsdl2-2.0.22+dfsg/src/joystick/SDL_sysjoystick.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/SDL_sysjoystick.h 2022-08-13 03:48:10.000000000 +0000 @@ -27,6 +27,11 @@ #include "SDL_joystick.h" #include "SDL_joystick_c.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + /* The SDL joystick structure */ typedef struct _SDL_JoystickAxisInfo { @@ -65,8 +70,10 @@ { SDL_JoystickID instance_id; /* Device instance, monotonically increasing from 0 */ char *name; /* Joystick name - system dependent */ + char *path; /* Joystick path - system dependent */ char *serial; /* Joystick serial */ SDL_JoystickGUID guid; /* Joystick guid */ + Uint16 firmware_version; /* Firmware version, if available */ int naxes; /* Number of axis controls on the joystick */ SDL_JoystickAxisInfo *axes; @@ -118,6 +125,7 @@ }; /* Device bus definitions */ +#define SDL_HARDWARE_BUS_VIRTUAL 0x00 #define SDL_HARDWARE_BUS_USB 0x03 #define SDL_HARDWARE_BUS_BLUETOOTH 0x05 @@ -146,10 +154,13 @@ /* Function to get the device-dependent name of a joystick */ const char *(*GetDeviceName)(int device_index); + /* Function to get the device-dependent path of a joystick */ + const char *(*GetDevicePath)(int device_index); + /* Function to get the player index of a joystick */ int (*GetDevicePlayerIndex)(int device_index); - /* Function to get the player index of a joystick */ + /* Function to set the player index of a joystick */ void (*SetDevicePlayerIndex)(int device_index, int player_index); /* Function to return the stable GUID for a plugged in device */ @@ -220,9 +231,15 @@ extern SDL_JoystickDriver SDL_WINDOWS_JoystickDriver; extern SDL_JoystickDriver SDL_WINMM_JoystickDriver; extern SDL_JoystickDriver SDL_OS2_JoystickDriver; +extern SDL_JoystickDriver SDL_PS2_JoystickDriver; extern SDL_JoystickDriver SDL_PSP_JoystickDriver; extern SDL_JoystickDriver SDL_VITA_JoystickDriver; +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif + #endif /* SDL_sysjoystick_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/joystick/sort_controllers.py libsdl2-2.24.0+dfsg/src/joystick/sort_controllers.py --- libsdl2-2.0.22+dfsg/src/joystick/sort_controllers.py 2021-07-27 14:52:29.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/sort_controllers.py 2022-08-13 03:48:10.000000000 +0000 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Script to sort the game controller database entries in SDL_gamecontroller.c @@ -7,7 +7,7 @@ filename = "SDL_gamecontrollerdb.h" input = open(filename) -output = open(filename + ".new", "w") +output = open(f"{filename}.new", "w") parsing_controllers = False controllers = [] controller_guids = {} @@ -57,14 +57,14 @@ print("Warning: entry '%s' is duplicate of entry '%s'" % (current_name, existing_name)) if (not current_name.startswith("(DUPE)")): - entry[2] = "(DUPE) " + current_name + entry[2] = f"(DUPE) {current_name}" if (not existing_name.startswith("(DUPE)")): - controller_guids[entry[1]][2] = "(DUPE) " + existing_name + controller_guids[entry[1]][2] = f"(DUPE) {existing_name}" controller_guids[entry[1]] = entry - for entry in sorted(controllers, key=lambda entry: entry[2]+"-"+entry[1]): + for entry in sorted(controllers, key=lambda entry: f"{entry[2]}-{entry[1]}"): line = "".join(entry) + "\n" line = line.replace("\t", " ") if not line.endswith(",\n") and not line.endswith("*/\n") and not line.endswith(",\r\n") and not line.endswith("*/\r\n"): @@ -75,7 +75,7 @@ controller_guids = {} for line in input: - if (parsing_controllers): + if parsing_controllers: if (line.startswith("{")): output.write(line) elif (line.startswith(" NULL")): @@ -83,7 +83,7 @@ write_controllers() output.write(line) elif (line.startswith("#if")): - print("Parsing " + line.strip()) + print(f"Parsing {line.strip()}") output.write(line) elif (line.startswith("#endif")): write_controllers() @@ -97,4 +97,4 @@ output.write(line) output.close() -print("Finished writing %s.new" % filename) +print(f"Finished writing {filename}.new") diff -Nru libsdl2-2.0.22+dfsg/src/joystick/usb_ids.h libsdl2-2.24.0+dfsg/src/joystick/usb_ids.h --- libsdl2-2.0.22+dfsg/src/joystick/usb_ids.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/usb_ids.h 2022-08-13 03:48:10.000000000 +0000 @@ -24,6 +24,7 @@ /* Definitions of useful USB VID/PID values */ +#define USB_VENDOR_8BITDO 0x2dc8 #define USB_VENDOR_AMAZON 0x1949 #define USB_VENDOR_APPLE 0x05ac #define USB_VENDOR_GOOGLE 0x18d1 @@ -39,14 +40,20 @@ #define USB_VENDOR_SONY 0x054c #define USB_VENDOR_VALVE 0x28de +#define USB_PRODUCT_8BITDO_XBOX_CONTROLLER 0x2002 #define USB_PRODUCT_AMAZON_LUNA_CONTROLLER 0x0419 #define USB_PRODUCT_GOOGLE_STADIA_CONTROLLER 0x9400 #define USB_PRODUCT_EVORETRO_GAMECUBE_ADAPTER 0x1846 #define USB_PRODUCT_NINTENDO_GAMECUBE_ADAPTER 0x0337 +#define USB_PRODUCT_NINTENDO_N64_CONTROLLER 0x2019 +#define USB_PRODUCT_NINTENDO_SEGA_GENESIS_CONTROLLER 0x201e +#define USB_PRODUCT_NINTENDO_SNES_CONTROLLER 0x2017 +#define USB_PRODUCT_NINTENDO_SWITCH_JOYCON_GRIP 0x200e +#define USB_PRODUCT_NINTENDO_SWITCH_JOYCON_LEFT 0x2006 +#define USB_PRODUCT_NINTENDO_SWITCH_JOYCON_PAIR 0x2008 /* Used by joycond */ +#define USB_PRODUCT_NINTENDO_SWITCH_JOYCON_RIGHT 0x2007 #define USB_PRODUCT_NINTENDO_SWITCH_PRO 0x2009 -#define USB_PRODUCT_NINTENDO_SWITCH_JOY_CON_LEFT 0x2006 -#define USB_PRODUCT_NINTENDO_SWITCH_JOY_CON_RIGHT 0x2007 -#define USB_PRODUCT_NINTENDO_SWITCH_JOY_CON_GRIP 0x200e +#define USB_PRODUCT_NVIDIA_SHIELD_CONTROLLER 0x7214 #define USB_PRODUCT_RAZER_PANTHERA 0x0401 #define USB_PRODUCT_RAZER_PANTHERA_EVO 0x1008 #define USB_PRODUCT_RAZER_ATROX 0x0a00 @@ -55,7 +62,7 @@ #define USB_PRODUCT_SONY_DS4_SLIM 0x09cc #define USB_PRODUCT_SONY_DS5 0x0ce6 #define USB_PRODUCT_VICTRIX_FS_PRO_V2 0x0207 -#define USB_PRODUCT_XBOX360_XUSB_CONTROLLER 0x02a1 /* XUSB driver software PID */ +#define USB_PRODUCT_XBOX360_XUSB_CONTROLLER 0x02a1 /* XUSB driver software PID */ #define USB_PRODUCT_XBOX360_WIRED_CONTROLLER 0x028e #define USB_PRODUCT_XBOX360_WIRELESS_RECEIVER 0x0719 #define USB_PRODUCT_XBOX_ONE_ADAPTIVE 0x0b0a @@ -76,8 +83,8 @@ #define USB_PRODUCT_XBOX_SERIES_X_PDP_AFTERGLOW 0x02da #define USB_PRODUCT_XBOX_SERIES_X_POWERA_FUSION_PRO2 0x4001 #define USB_PRODUCT_XBOX_SERIES_X_POWERA_SPECTRA 0x4002 -#define USB_PRODUCT_XBOX_ONE_XBOXGIP_CONTROLLER 0x02ff /* XBOXGIP driver software PID */ -#define USB_PRODUCT_XBOX_ONE_XINPUT_CONTROLLER 0x02fe /* Made up product ID for XInput */ +#define USB_PRODUCT_XBOX_ONE_XBOXGIP_CONTROLLER 0x02ff /* XBOXGIP driver software PID */ +#define USB_PRODUCT_XBOX_ONE_XINPUT_CONTROLLER 0x02fe /* Made up product ID for XInput */ #define USB_PRODUCT_STEAM_VIRTUAL_GAMEPAD 0x11ff /* USB usage pages */ diff -Nru libsdl2-2.0.22+dfsg/src/joystick/virtual/SDL_virtualjoystick.c libsdl2-2.24.0+dfsg/src/joystick/virtual/SDL_virtualjoystick.c --- libsdl2-2.0.22+dfsg/src/joystick/virtual/SDL_virtualjoystick.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/virtual/SDL_virtualjoystick.c 2022-06-02 02:01:57.000000000 +0000 @@ -24,11 +24,11 @@ /* This is the virtual implementation of the SDL joystick API */ +#include "SDL_endian.h" #include "SDL_virtualjoystick_c.h" #include "../SDL_sysjoystick.h" #include "../SDL_joystick_c.h" -extern SDL_JoystickDriver SDL_VIRTUAL_JoystickDriver; static joystick_hwdata * g_VJoys = NULL; @@ -56,18 +56,6 @@ if (!hwdata) { return; } - if (hwdata->axes) { - SDL_free((void *)hwdata->axes); - hwdata->axes = NULL; - } - if (hwdata->buttons) { - SDL_free((void *)hwdata->buttons); - hwdata->buttons = NULL; - } - if (hwdata->hats) { - SDL_free(hwdata->hats); - hwdata->hats = NULL; - } /* Remove hwdata from SDL-global list */ while (cur) { @@ -83,51 +71,170 @@ cur = cur->next; } + if (hwdata->joystick) { + hwdata->joystick->hwdata = NULL; + hwdata->joystick = NULL; + } + if (hwdata->name) { + SDL_free(hwdata->name); + hwdata->name = NULL; + } + if (hwdata->axes) { + SDL_free((void *)hwdata->axes); + hwdata->axes = NULL; + } + if (hwdata->buttons) { + SDL_free((void *)hwdata->buttons); + hwdata->buttons = NULL; + } + if (hwdata->hats) { + SDL_free(hwdata->hats); + hwdata->hats = NULL; + } SDL_free(hwdata); } int -SDL_JoystickAttachVirtualInner(SDL_JoystickType type, - int naxes, - int nbuttons, - int nhats) +SDL_JoystickAttachVirtualInner(const SDL_VirtualJoystickDesc *desc) { joystick_hwdata *hwdata = NULL; int device_index = -1; + const char *name = NULL; + Uint16 *guid16; + int axis_triggerleft = -1; + int axis_triggerright = -1; + + if (!desc) { + return SDL_InvalidParamError("desc"); + } + if (desc->version != SDL_VIRTUAL_JOYSTICK_DESC_VERSION) { + /* Is this an old version that we can support? */ + return SDL_SetError("Unsupported virtual joystick description version %d", desc->version); + } hwdata = SDL_calloc(1, sizeof(joystick_hwdata)); if (!hwdata) { VIRTUAL_FreeHWData(hwdata); return SDL_OutOfMemory(); } + SDL_memcpy(&hwdata->desc, desc, sizeof(*desc)); + + if (hwdata->desc.name) { + name = hwdata->desc.name; + } else { + switch (hwdata->desc.type) { + case SDL_JOYSTICK_TYPE_GAMECONTROLLER: + name = "Virtual Controller"; + break; + case SDL_JOYSTICK_TYPE_WHEEL: + name = "Virtual Wheel"; + break; + case SDL_JOYSTICK_TYPE_ARCADE_STICK: + name = "Virtual Arcade Stick"; + break; + case SDL_JOYSTICK_TYPE_FLIGHT_STICK: + name = "Virtual Flight Stick"; + break; + case SDL_JOYSTICK_TYPE_DANCE_PAD: + name = "Virtual Dance Pad"; + break; + case SDL_JOYSTICK_TYPE_GUITAR: + name = "Virtual Guitar"; + break; + case SDL_JOYSTICK_TYPE_DRUM_KIT: + name = "Virtual Drum Kit"; + break; + case SDL_JOYSTICK_TYPE_ARCADE_PAD: + name = "Virtual Arcade Pad"; + break; + case SDL_JOYSTICK_TYPE_THROTTLE: + name = "Virtual Throttle"; + break; + default: + name = "Virtual Joystick"; + break; + } + } + hwdata->name = SDL_strdup(name); + + if (hwdata->desc.type == SDL_JOYSTICK_TYPE_GAMECONTROLLER) { + int i, axis; + + if (hwdata->desc.button_mask == 0) { + for (i = 0; i < hwdata->desc.nbuttons && i < sizeof(hwdata->desc.button_mask)*8; ++i) { + hwdata->desc.button_mask |= (1 << i); + } + } + + if (hwdata->desc.axis_mask == 0) { + if (hwdata->desc.naxes >= 2) { + hwdata->desc.axis_mask |= ((1 << SDL_CONTROLLER_AXIS_LEFTX) | (1 << SDL_CONTROLLER_AXIS_LEFTY)); + } + if (hwdata->desc.naxes >= 4) { + hwdata->desc.axis_mask |= ((1 << SDL_CONTROLLER_AXIS_RIGHTX) | (1 << SDL_CONTROLLER_AXIS_RIGHTY)); + } + if (hwdata->desc.naxes >= 6) { + hwdata->desc.axis_mask |= ((1 << SDL_CONTROLLER_AXIS_TRIGGERLEFT) | (1 << SDL_CONTROLLER_AXIS_TRIGGERRIGHT)); + } + } + + /* Find the trigger axes */ + axis = 0; + for (i = 0; axis < hwdata->desc.naxes && i < SDL_CONTROLLER_AXIS_MAX; ++i) { + if (hwdata->desc.axis_mask & (1 << i)) { + if (i == SDL_CONTROLLER_AXIS_TRIGGERLEFT) { + axis_triggerleft = axis; + } + if (i == SDL_CONTROLLER_AXIS_TRIGGERRIGHT) { + axis_triggerright = axis; + } + ++axis; + } + } + } - hwdata->naxes = naxes; - hwdata->nbuttons = nbuttons; - hwdata->nhats = nhats; - hwdata->name = "Virtual Joystick"; + /* We only need 16 bits for each of these; space them out to fill 128. */ + /* Byteswap so devices get same GUID on little/big endian platforms. */ + guid16 = (Uint16 *)hwdata->guid.data; + *guid16++ = SDL_SwapLE16(SDL_HARDWARE_BUS_VIRTUAL); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16(hwdata->desc.vendor_id); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16(hwdata->desc.product_id); + *guid16++ = 0; + *guid16++ = 0; + *guid16++ = 0; /* This will be overwritten below with the virtual controller signature */ /* Note that this is a Virtual device and what subtype it is */ hwdata->guid.data[14] = 'v'; - hwdata->guid.data[15] = (Uint8)type; + hwdata->guid.data[15] = (Uint8)hwdata->desc.type; /* Allocate fields for different control-types */ - if (naxes > 0) { - hwdata->axes = SDL_calloc(naxes, sizeof(Sint16)); + if (hwdata->desc.naxes > 0) { + hwdata->axes = SDL_calloc(hwdata->desc.naxes, sizeof(Sint16)); if (!hwdata->axes) { VIRTUAL_FreeHWData(hwdata); return SDL_OutOfMemory(); } + + /* Trigger axes are at minimum value at rest */ + if (axis_triggerleft >= 0) { + hwdata->axes[axis_triggerleft] = SDL_JOYSTICK_AXIS_MIN; + } + if (axis_triggerright >= 0) { + hwdata->axes[axis_triggerright] = SDL_JOYSTICK_AXIS_MIN; + } } - if (nbuttons > 0) { - hwdata->buttons = SDL_calloc(nbuttons, sizeof(Uint8)); + if (hwdata->desc.nbuttons > 0) { + hwdata->buttons = SDL_calloc(hwdata->desc.nbuttons, sizeof(Uint8)); if (!hwdata->buttons) { VIRTUAL_FreeHWData(hwdata); return SDL_OutOfMemory(); } } - if (nhats > 0) { - hwdata->hats = SDL_calloc(nhats, sizeof(Uint8)); + if (hwdata->desc.nhats > 0) { + hwdata->hats = SDL_calloc(hwdata->desc.nhats, sizeof(Uint8)); if (!hwdata->hats) { VIRTUAL_FreeHWData(hwdata); return SDL_OutOfMemory(); @@ -138,8 +245,16 @@ hwdata->instance_id = SDL_GetNextJoystickInstanceID(); /* Add virtual joystick to SDL-global lists */ - hwdata->next = g_VJoys; - g_VJoys = hwdata; + if (g_VJoys) { + joystick_hwdata *last; + + for (last = g_VJoys; last->next; last = last->next) { + continue; + } + last->next = hwdata; + } else { + g_VJoys = hwdata; + } SDL_PrivateJoystickAdded(hwdata->instance_id); /* Return the new virtual-device's index */ @@ -176,7 +291,7 @@ } hwdata = (joystick_hwdata *)joystick->hwdata; - if (axis < 0 || axis >= hwdata->naxes) { + if (axis < 0 || axis >= hwdata->desc.naxes) { SDL_UnlockJoysticks(); return SDL_SetError("Invalid axis index"); } @@ -201,7 +316,7 @@ } hwdata = (joystick_hwdata *)joystick->hwdata; - if (button < 0 || button >= hwdata->nbuttons) { + if (button < 0 || button >= hwdata->desc.nbuttons) { SDL_UnlockJoysticks(); return SDL_SetError("Invalid button index"); } @@ -226,7 +341,7 @@ } hwdata = (joystick_hwdata *)joystick->hwdata; - if (hat < 0 || hat >= hwdata->nhats) { + if (hat < 0 || hat >= hwdata->desc.nhats) { SDL_UnlockJoysticks(); return SDL_SetError("Invalid hat index"); } @@ -271,7 +386,14 @@ if (!hwdata) { return NULL; } - return hwdata->name ? hwdata->name : ""; + return hwdata->name; +} + + +static const char * +VIRTUAL_JoystickGetDevicePath(int device_index) +{ + return NULL; } @@ -285,6 +407,11 @@ static void VIRTUAL_JoystickSetDevicePlayerIndex(int device_index, int player_index) { + joystick_hwdata *hwdata = VIRTUAL_HWDataForIndex(device_index); + + if (hwdata && hwdata->desc.SetPlayerIndex) { + hwdata->desc.SetPlayerIndex(hwdata->desc.userdata, player_index); + } } @@ -319,15 +446,12 @@ if (!hwdata) { return SDL_SetError("No such device"); } - if (hwdata->opened) { - return SDL_SetError("Joystick already opened"); - } joystick->instance_id = hwdata->instance_id; joystick->hwdata = hwdata; - joystick->naxes = hwdata->naxes; - joystick->nbuttons = hwdata->nbuttons; - joystick->nhats = hwdata->nhats; - hwdata->opened = SDL_TRUE; + joystick->naxes = hwdata->desc.naxes; + joystick->nbuttons = hwdata->desc.nbuttons; + joystick->nhats = hwdata->desc.nhats; + hwdata->joystick = joystick; return 0; } @@ -335,33 +459,99 @@ static int VIRTUAL_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble) { - return SDL_Unsupported(); + int result; + + if (joystick->hwdata) { + joystick_hwdata *hwdata = joystick->hwdata; + if (hwdata->desc.Rumble) { + result = hwdata->desc.Rumble(hwdata->desc.userdata, low_frequency_rumble, high_frequency_rumble); + } else { + result = SDL_Unsupported(); + } + } else { + result = SDL_SetError("Rumble failed, device disconnected"); + } + + return result; } static int VIRTUAL_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble) { - return SDL_Unsupported(); + int result; + + if (joystick->hwdata) { + joystick_hwdata *hwdata = joystick->hwdata; + if (hwdata->desc.RumbleTriggers) { + result = hwdata->desc.RumbleTriggers(hwdata->desc.userdata, left_rumble, right_rumble); + } else { + result = SDL_Unsupported(); + } + } else { + result = SDL_SetError("Rumble failed, device disconnected"); + } + + return result; } static Uint32 VIRTUAL_JoystickGetCapabilities(SDL_Joystick *joystick) { - return 0; + joystick_hwdata *hwdata = joystick->hwdata; + Uint32 caps = 0; + + if (hwdata) { + if (hwdata->desc.Rumble) { + caps |= SDL_JOYCAP_RUMBLE; + } + if (hwdata->desc.RumbleTriggers) { + caps |= SDL_JOYCAP_RUMBLE_TRIGGERS; + } + if (hwdata->desc.SetLED) { + caps |= SDL_JOYCAP_LED; + } + } + return caps; } static int VIRTUAL_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue) { - return SDL_Unsupported(); + int result; + + if (joystick->hwdata) { + joystick_hwdata *hwdata = joystick->hwdata; + if (hwdata->desc.SetLED) { + result = hwdata->desc.SetLED(hwdata->desc.userdata, red, green, blue); + } else { + result = SDL_Unsupported(); + } + } else { + result = SDL_SetError("SetLED failed, device disconnected"); + } + + return result; } static int VIRTUAL_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int size) { - return SDL_Unsupported(); + int result; + + if (joystick->hwdata) { + joystick_hwdata *hwdata = joystick->hwdata; + if (hwdata->desc.SendEffect) { + result = hwdata->desc.SendEffect(hwdata->desc.userdata, data, size); + } else { + result = SDL_Unsupported(); + } + } else { + result = SDL_SetError("SendEffect failed, device disconnected"); + } + + return result; } static int @@ -386,13 +576,17 @@ hwdata = (joystick_hwdata *)joystick->hwdata; - for (i = 0; i < hwdata->naxes; ++i) { + if (hwdata->desc.Update) { + hwdata->desc.Update(hwdata->desc.userdata); + } + + for (i = 0; i < hwdata->desc.naxes; ++i) { SDL_PrivateJoystickAxis(joystick, i, hwdata->axes[i]); } - for (i = 0; i < hwdata->nbuttons; ++i) { + for (i = 0; i < hwdata->desc.nbuttons; ++i) { SDL_PrivateJoystickButton(joystick, i, hwdata->buttons[i]); } - for (i = 0; i < hwdata->nhats; ++i) { + for (i = 0; i < hwdata->desc.nhats; ++i) { SDL_PrivateJoystickHat(joystick, i, hwdata->hats[i]); } } @@ -401,17 +595,11 @@ static void VIRTUAL_JoystickClose(SDL_Joystick *joystick) { - joystick_hwdata *hwdata; - - if (!joystick) { - return; - } - if (!joystick->hwdata) { - return; + if (joystick->hwdata) { + joystick_hwdata *hwdata = joystick->hwdata; + hwdata->joystick = NULL; + joystick->hwdata = NULL; } - - hwdata = (joystick_hwdata *)joystick->hwdata; - hwdata->opened = SDL_FALSE; } @@ -426,7 +614,145 @@ static SDL_bool VIRTUAL_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out) { - return SDL_FALSE; + joystick_hwdata *hwdata = VIRTUAL_HWDataForIndex(device_index); + int current_button = 0; + int current_axis = 0; + + if (hwdata->desc.type != SDL_JOYSTICK_TYPE_GAMECONTROLLER) { + return SDL_FALSE; + } + + if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_A))) { + out->a.kind = EMappingKind_Button; + out->a.target = current_button++; + } + + if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_B))) { + out->b.kind = EMappingKind_Button; + out->b.target = current_button++; + } + + if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_X))) { + out->x.kind = EMappingKind_Button; + out->x.target = current_button++; + } + + if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_Y))) { + out->y.kind = EMappingKind_Button; + out->y.target = current_button++; + } + + if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_BACK))) { + out->back.kind = EMappingKind_Button; + out->back.target = current_button++; + } + + if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_GUIDE))) { + out->guide.kind = EMappingKind_Button; + out->guide.target = current_button++; + } + + if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_START))) { + out->start.kind = EMappingKind_Button; + out->start.target = current_button++; + } + + if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_LEFTSTICK))) { + out->leftstick.kind = EMappingKind_Button; + out->leftstick.target = current_button++; + } + + if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_RIGHTSTICK))) { + out->rightstick.kind = EMappingKind_Button; + out->rightstick.target = current_button++; + } + + if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_LEFTSHOULDER))) { + out->leftshoulder.kind = EMappingKind_Button; + out->leftshoulder.target = current_button++; + } + + if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_RIGHTSHOULDER))) { + out->rightshoulder.kind = EMappingKind_Button; + out->rightshoulder.target = current_button++; + } + + if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_DPAD_UP))) { + out->dpup.kind = EMappingKind_Button; + out->dpup.target = current_button++; + } + + if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_DPAD_DOWN))) { + out->dpdown.kind = EMappingKind_Button; + out->dpdown.target = current_button++; + } + + if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_DPAD_LEFT))) { + out->dpleft.kind = EMappingKind_Button; + out->dpleft.target = current_button++; + } + + if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_DPAD_RIGHT))) { + out->dpright.kind = EMappingKind_Button; + out->dpright.target = current_button++; + } + + if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_MISC1))) { + out->misc1.kind = EMappingKind_Button; + out->misc1.target = current_button++; + } + + if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_PADDLE1))) { + out->paddle1.kind = EMappingKind_Button; + out->paddle1.target = current_button++; + } + + if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_PADDLE2))) { + out->paddle2.kind = EMappingKind_Button; + out->paddle2.target = current_button++; + } + + if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_PADDLE3))) { + out->paddle3.kind = EMappingKind_Button; + out->paddle3.target = current_button++; + } + + if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_PADDLE4))) { + out->paddle4.kind = EMappingKind_Button; + out->paddle4.target = current_button++; + } + + if (current_axis < hwdata->desc.naxes && (hwdata->desc.axis_mask & (1 << SDL_CONTROLLER_AXIS_LEFTX))) { + out->leftx.kind = EMappingKind_Axis; + out->leftx.target = current_axis++; + } + + if (current_axis < hwdata->desc.naxes && (hwdata->desc.axis_mask & (1 << SDL_CONTROLLER_AXIS_LEFTY))) { + out->lefty.kind = EMappingKind_Axis; + out->lefty.target = current_axis++; + } + + if (current_axis < hwdata->desc.naxes && (hwdata->desc.axis_mask & (1 << SDL_CONTROLLER_AXIS_RIGHTX))) { + out->rightx.kind = EMappingKind_Axis; + out->rightx.target = current_axis++; + } + + if (current_axis < hwdata->desc.naxes && (hwdata->desc.axis_mask & (1 << SDL_CONTROLLER_AXIS_RIGHTY))) { + out->righty.kind = EMappingKind_Axis; + out->righty.target = current_axis++; + } + + if (current_axis < hwdata->desc.naxes && (hwdata->desc.axis_mask & (1 << SDL_CONTROLLER_AXIS_TRIGGERLEFT))) { + out->lefttrigger.kind = EMappingKind_Axis; + out->lefttrigger.target = current_axis++; + } + + if (current_axis < hwdata->desc.naxes && (hwdata->desc.axis_mask & (1 << SDL_CONTROLLER_AXIS_TRIGGERRIGHT))) { + out->righttrigger.kind = EMappingKind_Axis; + out->righttrigger.target = current_axis++; + } + + return SDL_TRUE; } SDL_JoystickDriver SDL_VIRTUAL_JoystickDriver = @@ -435,6 +761,7 @@ VIRTUAL_JoystickGetCount, VIRTUAL_JoystickDetect, VIRTUAL_JoystickGetDeviceName, + VIRTUAL_JoystickGetDevicePath, VIRTUAL_JoystickGetDevicePlayerIndex, VIRTUAL_JoystickSetDevicePlayerIndex, VIRTUAL_JoystickGetDeviceGUID, diff -Nru libsdl2-2.0.22+dfsg/src/joystick/virtual/SDL_virtualjoystick_c.h libsdl2-2.24.0+dfsg/src/joystick/virtual/SDL_virtualjoystick_c.h --- libsdl2-2.0.22+dfsg/src/joystick/virtual/SDL_virtualjoystick_c.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/virtual/SDL_virtualjoystick_c.h 2022-06-02 02:01:57.000000000 +0000 @@ -34,24 +34,19 @@ { SDL_JoystickType type; SDL_bool attached; - const char *name; + char *name; SDL_JoystickGUID guid; - int naxes; + SDL_VirtualJoystickDesc desc; Sint16 *axes; - int nbuttons; Uint8 *buttons; - int nhats; Uint8 *hats; SDL_JoystickID instance_id; - SDL_bool opened; + SDL_Joystick *joystick; + struct joystick_hwdata *next; } joystick_hwdata; -int SDL_JoystickAttachVirtualInner(SDL_JoystickType type, - int naxes, - int nbuttons, - int nhats); - +int SDL_JoystickAttachVirtualInner(const SDL_VirtualJoystickDesc *desc); int SDL_JoystickDetachVirtualInner(int device_index); int SDL_JoystickSetVirtualAxisInner(SDL_Joystick * joystick, int axis, Sint16 value); @@ -59,4 +54,7 @@ int SDL_JoystickSetVirtualHatInner(SDL_Joystick * joystick, int hat, Uint8 value); #endif /* SDL_JOYSTICK_VIRTUAL */ + #endif /* SDL_VIRTUALJOYSTICK_C_H */ + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/joystick/vita/SDL_sysjoystick.c libsdl2-2.24.0+dfsg/src/joystick/vita/SDL_sysjoystick.c --- libsdl2-2.0.22+dfsg/src/joystick/vita/SDL_sysjoystick.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/vita/SDL_sysjoystick.c 2022-08-13 03:48:10.000000000 +0000 @@ -179,7 +179,6 @@ return device_index; } -/* Function to get the device-dependent name of a joystick */ const char *VITA_JoystickGetDeviceName(int index) { if (index == 0) @@ -195,7 +194,12 @@ return "PSVita Controller"; SDL_SetError("No joystick available with that index"); - return(NULL); + return NULL; +} + +const char *VITA_JoystickGetDevicePath(int index) +{ + return NULL; } static int @@ -394,12 +398,19 @@ return SDL_Unsupported(); } +static SDL_bool +VITA_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out) +{ + return SDL_FALSE; +} + SDL_JoystickDriver SDL_VITA_JoystickDriver = { VITA_JoystickInit, VITA_JoystickGetCount, VITA_JoystickDetect, VITA_JoystickGetDeviceName, + VITA_JoystickGetDevicePath, VITA_JoystickGetDevicePlayerIndex, VITA_JoystickSetDevicePlayerIndex, VITA_JoystickGetDeviceGUID, @@ -418,6 +429,7 @@ VITA_JoystickUpdate, VITA_JoystickClose, VITA_JoystickQuit, + VITA_JoystickGetGamepadMapping, }; #endif /* SDL_JOYSTICK_VITA */ diff -Nru libsdl2-2.0.22+dfsg/src/joystick/windows/SDL_dinputjoystick.c libsdl2-2.24.0+dfsg/src/joystick/windows/SDL_dinputjoystick.c --- libsdl2-2.0.22+dfsg/src/joystick/windows/SDL_dinputjoystick.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/windows/SDL_dinputjoystick.c 2022-08-13 03:48:10.000000000 +0000 @@ -24,6 +24,8 @@ #if SDL_JOYSTICK_DINPUT +#include "SDL_hints.h" +#include "SDL_timer.h" #include "SDL_windowsjoystick_c.h" #include "SDL_dinputjoystick_c.h" #include "SDL_rawinputjoystick_c.h" @@ -253,7 +255,7 @@ return SDL_TRUE; } - type = SDL_GetJoystickGameControllerType("", vendor_id, product_id, -1, 0, 0, 0); + type = SDL_GetJoystickGameControllerTypeFromVIDPID(vendor_id, product_id, NULL, SDL_FALSE); if (type == SDL_CONTROLLER_TYPE_XBOX360 || type == SDL_CONTROLLER_TYPE_XBOXONE || (vendor_id == USB_VENDOR_VALVE && product_id == USB_PRODUCT_STEAM_VIRTUAL_GAMEPAD)) { @@ -397,6 +399,12 @@ HRESULT result; HINSTANCE instance; + if (!SDL_GetHintBoolean(SDL_HINT_DIRECTINPUT_ENABLED, SDL_TRUE)) { + /* In some environments, IDirectInput8_Initialize / _EnumDevices can take a minute even with no controllers. */ + dinput = NULL; + return 0; + } + result = WIN_CoInitialize(); if (FAILED(result)) { return SetDIerror("CoInitialize", result); @@ -456,7 +464,7 @@ pNewJoystick = *(JoyStick_DeviceData**)pContext; while (pNewJoystick) { /* update GUIDs of joysticks with matching paths, in case they're not open yet */ - if (SDL_strcmp(pNewJoystick->hidPath, hidPath) == 0) { + if (SDL_strcmp(pNewJoystick->path, hidPath) == 0) { /* if we are replacing the front of the list then update it */ if (pNewJoystick == *(JoyStick_DeviceData**)pContext) { *(JoyStick_DeviceData**)pContext = pNewJoystick->pNext; @@ -483,7 +491,7 @@ CHECK(pNewJoystick); SDL_zerop(pNewJoystick); - SDL_strlcpy(pNewJoystick->hidPath, hidPath, SDL_arraysize(pNewJoystick->hidPath)); + SDL_strlcpy(pNewJoystick->path, hidPath, SDL_arraysize(pNewJoystick->path)); SDL_memcpy(&pNewJoystick->dxdevice, pDeviceInstance, sizeof(DIDEVICEINSTANCE)); SDL_memset(pNewJoystick->guid.data, 0, sizeof(pNewJoystick->guid.data)); @@ -539,6 +547,10 @@ void SDL_DINPUT_JoystickDetect(JoyStick_DeviceData **pContext) { + if (dinput == NULL) { + return; + } + IDirectInput8_EnumDevices(dinput, DI8DEVCLASS_GAMECTRL, EnumJoystickDetectCallback, pContext, DIEDFL_ATTACHEDONLY); } @@ -683,7 +695,7 @@ /* Sort using the data offset into the DInput struct. * This gives a reasonable ordering for the inputs. */ -static int +static int SDLCALL SortDevFunc(const void *a, const void *b) { const input_t *inputA = (const input_t*)a; @@ -844,6 +856,15 @@ } else if (FAILED(result)) { return SetDIerror("IDirectInputDevice8::SetProperty", result); } + + /* Poll and wait for initial device state to be populated */ + result = IDirectInputDevice8_Poll(joystick->hwdata->InputDevice); + if (result == DIERR_INPUTLOST || result == DIERR_NOTACQUIRED) { + IDirectInputDevice8_Acquire(joystick->hwdata->InputDevice); + IDirectInputDevice8_Poll(joystick->hwdata->InputDevice); + } + SDL_Delay(50); + return 0; } diff -Nru libsdl2-2.0.22+dfsg/src/joystick/windows/SDL_dinputjoystick_c.h libsdl2-2.24.0+dfsg/src/joystick/windows/SDL_dinputjoystick_c.h --- libsdl2-2.0.22+dfsg/src/joystick/windows/SDL_dinputjoystick_c.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/windows/SDL_dinputjoystick_c.h 2022-08-13 03:48:10.000000000 +0000 @@ -20,6 +20,11 @@ */ #include "../../SDL_internal.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + extern int SDL_DINPUT_JoystickInit(void); extern void SDL_DINPUT_JoystickDetect(JoyStick_DeviceData **pContext); extern SDL_bool SDL_DINPUT_JoystickPresent(Uint16 vendor, Uint16 product, Uint16 version); @@ -30,4 +35,9 @@ extern void SDL_DINPUT_JoystickClose(SDL_Joystick * joystick); extern void SDL_DINPUT_JoystickQuit(void); +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif + /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/joystick/windows/SDL_rawinputjoystick.c libsdl2-2.24.0+dfsg/src/joystick/windows/SDL_rawinputjoystick.c --- libsdl2-2.0.22+dfsg/src/joystick/windows/SDL_rawinputjoystick.c 2022-04-23 17:37:35.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/windows/SDL_rawinputjoystick.c 2022-08-13 03:48:10.000000000 +0000 @@ -40,7 +40,6 @@ #include "SDL_timer.h" #include "../usb_ids.h" #include "../SDL_sysjoystick.h" -#include "../controller_type.h" #include "../../core/windows/SDL_windows.h" #include "../../core/windows/SDL_hid.h" #include "../hidapi/SDL_hidapijoystick_c.h" @@ -105,6 +104,7 @@ { SDL_atomic_t refcount; char *name; + char *path; Uint16 vendor_id; Uint16 product_id; Uint16 version; @@ -338,7 +338,9 @@ xinput_state[user_index].connected = SDL_FALSE; } xinput_state[user_index].battery.BatteryType = BATTERY_TYPE_UNKNOWN; - XINPUTGETBATTERYINFORMATION(user_index, BATTERY_DEVTYPE_GAMEPAD, &xinput_state[user_index].battery); + if (XINPUTGETBATTERYINFORMATION) { + XINPUTGETBATTERYINFORMATION(user_index, BATTERY_DEVTYPE_GAMEPAD, &xinput_state[user_index].battery); + } } } } @@ -689,10 +691,9 @@ #endif /* SDL_JOYSTICK_RAWINPUT_XINPUT */ if (SDL_AtomicDecRef(&device->refcount)) { - if (device->preparsed_data) { - SDL_HidD_FreePreparsedData(device->preparsed_data); - } + SDL_free(device->preparsed_data); SDL_free(device->name); + SDL_free(device->path); SDL_free(device); } } @@ -716,9 +717,8 @@ SDL_RAWINPUT_Device *device = NULL; SDL_RAWINPUT_Device *curr, *last; RID_DEVICE_INFO rdi; - UINT rdi_size = sizeof(rdi); + UINT size; char dev_name[MAX_PATH]; - UINT name_size = SDL_arraysize(dev_name); HANDLE hFile = INVALID_HANDLE_VALUE; /* Make sure we're not trying to add the same device twice */ @@ -727,11 +727,13 @@ } /* Figure out what kind of device it is */ - CHECK(GetRawInputDeviceInfoA(hDevice, RIDI_DEVICEINFO, &rdi, &rdi_size) != (UINT)-1); + size = sizeof(rdi); + CHECK(GetRawInputDeviceInfoA(hDevice, RIDI_DEVICEINFO, &rdi, &size) != (UINT)-1); CHECK(rdi.dwType == RIM_TYPEHID); /* Get the device "name" (HID Path) */ - CHECK(GetRawInputDeviceInfoA(hDevice, RIDI_DEVICENAME, dev_name, &name_size) != (UINT)-1); + size = SDL_arraysize(dev_name); + CHECK(GetRawInputDeviceInfoA(hDevice, RIDI_DEVICENAME, dev_name, &size) != (UINT)-1); /* Only take XInput-capable devices */ CHECK(SDL_strstr(dev_name, "IG_") != NULL); #ifdef SDL_JOYSTICK_HIDAPI @@ -745,7 +747,13 @@ device->product_id = (Uint16)rdi.hid.dwProductId; device->version = (Uint16)rdi.hid.dwVersionNumber; device->is_xinput = SDL_TRUE; - device->is_xboxone = GuessControllerType(device->vendor_id, device->product_id) == k_eControllerType_XBoxOneController; + device->is_xboxone = SDL_IsJoystickXboxOne(device->vendor_id, device->product_id); + + /* Get HID Top-Level Collection Preparsed Data */ + size = 0; + CHECK(GetRawInputDeviceInfoA(hDevice, RIDI_PREPARSEDDATA, NULL, &size) != (UINT)-1); + CHECK(device->preparsed_data = (PHIDP_PREPARSED_DATA)SDL_calloc(size, sizeof(BYTE))); + CHECK(GetRawInputDeviceInfoA(hDevice, RIDI_PREPARSEDDATA, device->preparsed_data, &size) != (UINT)-1); { const Uint16 vendor = device->vendor_id; @@ -791,8 +799,7 @@ SDL_free(product_string); } } - - CHECK(SDL_HidD_GetPreparsedData(hFile, &device->preparsed_data)); + device->path = SDL_strdup(dev_name); CloseHandle(hFile); hFile = INVALID_HANDLE_VALUE; @@ -825,8 +832,12 @@ CloseHandle(hFile); } if (device) { - if (device->name) + if (device->name) { SDL_free(device->name); + } + if (device->path) { + SDL_free(device->path); + } SDL_free(device); } #undef CHECK @@ -1029,6 +1040,12 @@ return RAWINPUT_GetDeviceByIndex(device_index)->name; } +static const char * +RAWINPUT_JoystickGetDevicePath(int device_index) +{ + return RAWINPUT_GetDeviceByIndex(device_index)->path; +} + static int RAWINPUT_JoystickGetDevicePlayerIndex(int device_index) { @@ -1053,7 +1070,7 @@ return RAWINPUT_GetDeviceByIndex(device_index)->joystick_id; } -static int +static int SDLCALL RAWINPUT_SortValueCaps(const void *A, const void *B) { HIDP_VALUE_CAPS *capsA = (HIDP_VALUE_CAPS *)A; @@ -1253,7 +1270,7 @@ } } - SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_UNKNOWN); + joystick->epowerlevel = SDL_JOYSTICK_POWER_UNKNOWN; return 0; } @@ -1263,8 +1280,8 @@ { #if defined(SDL_JOYSTICK_RAWINPUT_WGI) || defined(SDL_JOYSTICK_RAWINPUT_XINPUT) RAWINPUT_DeviceContext *ctx = joystick->hwdata; - SDL_bool rumbled = SDL_FALSE; #endif + SDL_bool rumbled = SDL_FALSE; #ifdef SDL_JOYSTICK_RAWINPUT_WGI if (!rumbled && ctx->wgi_correlated) { @@ -1312,7 +1329,7 @@ { #if defined(SDL_JOYSTICK_RAWINPUT_WGI) RAWINPUT_DeviceContext *ctx = joystick->hwdata; - + if (ctx->wgi_correlated) { WindowsGamingInputGamepadState *gamepad_state = ctx->wgi_slot; HRESULT hr; @@ -1334,15 +1351,15 @@ static Uint32 RAWINPUT_JoystickGetCapabilities(SDL_Joystick *joystick) { - RAWINPUT_DeviceContext *ctx = joystick->hwdata; Uint32 result = 0; +#if defined(SDL_JOYSTICK_RAWINPUT_XINPUT) || defined(SDL_JOYSTICK_RAWINPUT_WGI) + RAWINPUT_DeviceContext *ctx = joystick->hwdata; #ifdef SDL_JOYSTICK_RAWINPUT_XINPUT if (ctx->is_xinput) { result |= SDL_JOYCAP_RUMBLE; } #endif - #ifdef SDL_JOYSTICK_RAWINPUT_WGI if (ctx->is_xinput) { result |= SDL_JOYCAP_RUMBLE; @@ -1352,6 +1369,7 @@ } } #endif +#endif /**/ return result; } @@ -1570,17 +1588,25 @@ int guide_button = joystick->nbuttons - 1; int left_trigger = joystick->naxes - 2; int right_trigger = joystick->naxes - 1; +#ifdef SDL_JOYSTICK_RAWINPUT_WGI + SDL_bool xinput_correlated; +#endif RAWINPUT_FillMatchState(&match_state_xinput, ctx->match_state); #ifdef SDL_JOYSTICK_RAWINPUT_WGI + #ifdef SDL_JOYSTICK_RAWINPUT_XINPUT + xinput_correlated = ctx->xinput_correlated; + #else + xinput_correlated = SDL_FALSE; + #endif /* Parallel logic to WINDOWS_XINPUT below */ RAWINPUT_UpdateWindowsGamingInput(); if (ctx->wgi_correlated && !joystick->low_frequency_rumble && !joystick->high_frequency_rumble && !joystick->left_trigger_rumble && !joystick->right_trigger_rumble) { /* We have been previously correlated, ensure we are still matching, see comments in XINPUT section */ - if (RAWINPUT_WindowsGamingInputSlotMatches(&match_state_xinput, ctx->wgi_slot, ctx->xinput_correlated)) { + if (RAWINPUT_WindowsGamingInputSlotMatches(&match_state_xinput, ctx->wgi_slot, xinput_correlated)) { ctx->wgi_uncorrelate_count = 0; } else { ++ctx->wgi_uncorrelate_count; @@ -1609,7 +1635,7 @@ if (RAWINPUT_MissingWindowsGamingInputSlot()) { Uint8 correlation_id; WindowsGamingInputGamepadState *slot_idx = NULL; - if (RAWINPUT_GuessWindowsGamingInputSlot(&match_state_xinput, &correlation_id, &slot_idx, ctx->xinput_correlated)) { + if (RAWINPUT_GuessWindowsGamingInputSlot(&match_state_xinput, &correlation_id, &slot_idx, xinput_correlated)) { /* we match exactly one WindowsGamingInput device */ /* Probably can do without wgi_correlation_count, just check and clear wgi_slot to NULL, unless we need even more frames to be sure. */ @@ -1911,7 +1937,7 @@ return; } } - + LRESULT CALLBACK RAWINPUT_WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { @@ -2006,6 +2032,7 @@ RAWINPUT_JoystickGetCount, RAWINPUT_JoystickDetect, RAWINPUT_JoystickGetDeviceName, + RAWINPUT_JoystickGetDevicePath, RAWINPUT_JoystickGetDevicePlayerIndex, RAWINPUT_JoystickSetDevicePlayerIndex, RAWINPUT_JoystickGetDeviceGUID, diff -Nru libsdl2-2.0.22+dfsg/src/joystick/windows/SDL_windows_gaming_input.c libsdl2-2.24.0+dfsg/src/joystick/windows/SDL_windows_gaming_input.c --- libsdl2-2.0.22+dfsg/src/joystick/windows/SDL_windows_gaming_input.c 2022-04-21 17:37:37.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/windows/SDL_windows_gaming_input.c 2022-08-13 03:48:10.000000000 +0000 @@ -32,9 +32,17 @@ #define COBJMACROS #include "windows.gaming.input.h" #include +#include #include +#ifdef ____FIReference_1_INT32_INTERFACE_DEFINED__ +/* MinGW-64 uses __FIReference_1_INT32 instead of Microsoft's __FIReference_1_int */ +#define __FIReference_1_int __FIReference_1_INT32 +#define __FIReference_1_int_get_Value __FIReference_1_INT32_get_Value +#define __FIReference_1_int_Release __FIReference_1_INT32_Release +#endif + struct joystick_hwdata { __x_ABI_CWindows_CGaming_CInput_CIRawGameController *controller; @@ -206,11 +214,15 @@ } *ppvObject = NULL; - if (WIN_IsEqualIID(riid, &IID_IUnknown) || WIN_IsEqualIID(riid, &IID_IEventHandler_RawGameController)) { + if (WIN_IsEqualIID(riid, &IID_IUnknown) || WIN_IsEqualIID(riid, &IID_IAgileObject) || WIN_IsEqualIID(riid, &IID_IEventHandler_RawGameController)) { *ppvObject = This; return S_OK; + } else if (WIN_IsEqualIID(riid, &IID_IMarshal)) { + // This seems complicated. Let's hope it doesn't happen. + return E_OUTOFMEMORY; + } else { + return E_NOINTERFACE; } - return E_NOINTERFACE; } static ULONG STDMETHODCALLTYPE IEventHandler_CRawGameControllerVtbl_AddRef(__FIEventHandler_1_Windows__CGaming__CInput__CRawGameController * This) @@ -586,6 +598,12 @@ return wgi.controllers[device_index].name; } +static const char * +WGI_JoystickGetDevicePath(int device_index) +{ + return NULL; +} + static int WGI_JoystickGetDevicePlayerIndex(int device_index) { @@ -893,6 +911,7 @@ WGI_JoystickGetCount, WGI_JoystickDetect, WGI_JoystickGetDeviceName, + WGI_JoystickGetDevicePath, WGI_JoystickGetDevicePlayerIndex, WGI_JoystickSetDevicePlayerIndex, WGI_JoystickGetDeviceGUID, diff -Nru libsdl2-2.0.22+dfsg/src/joystick/windows/SDL_windowsjoystick.c libsdl2-2.24.0+dfsg/src/joystick/windows/SDL_windowsjoystick.c --- libsdl2-2.0.22+dfsg/src/joystick/windows/SDL_windowsjoystick.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/windows/SDL_windowsjoystick.c 2022-08-13 03:48:10.000000000 +0000 @@ -41,7 +41,7 @@ #include "../SDL_sysjoystick.h" #include "../../thread/SDL_systhread.h" #include "../../core/windows/SDL_windows.h" -#if !defined(__WINRT__) +#if !defined(__WINRT__) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #include #endif @@ -63,6 +63,11 @@ #define CR_SUCCESS (0x00000000) +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + DECLARE_HANDLE(HCMNOTIFICATION); typedef HCMNOTIFICATION* PHCMNOTIFICATION; @@ -141,7 +146,7 @@ JoyStick_DeviceData *SYS_Joystick; /* array to hold joystick ID values */ -#ifndef __WINRT__ +#if !defined(__WINRT__) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) static HMODULE cfgmgr32_lib_handle; static CM_Register_NotificationFunc CM_Register_Notification; static CM_Unregister_NotificationFunc CM_Unregister_Notification; @@ -327,10 +332,17 @@ return (lastret != -1) ? SDL_TRUE : SDL_FALSE; } +#endif /* !defined(__WINRT__) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) */ + + +#if !defined(__WINRT__) + +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) static SDL_DeviceNotificationData s_notification_data; +#endif /* Function/thread to scan the system for joysticks. */ -static int +static int SDLCALL SDL_JoystickThread(void *_data) { #if SDL_JOYSTICK_XINPUT @@ -338,13 +350,19 @@ SDL_zeroa(bOpenedXInputDevices); #endif +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) if (SDL_CreateDeviceNotification(&s_notification_data) < 0) { return -1; } +#endif SDL_LockMutex(s_mutexJoyStickEnum); while (s_bJoystickThreadQuit == SDL_FALSE) { +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) if (SDL_WaitForDeviceNotification(&s_notification_data, s_mutexJoyStickEnum) == SDL_FALSE) { +#else + { +#endif #if SDL_JOYSTICK_XINPUT /* WM_DEVICECHANGE not working, poll for new XINPUT controllers */ SDL_CondWaitTimeout(s_condJoystickThread, s_mutexJoyStickEnum, 1000); @@ -354,7 +372,7 @@ for (userId = 0; userId < XUSER_MAX_COUNT; userId++) { XINPUT_CAPABILITIES capabilities; const DWORD result = XINPUTGETCAPABILITIES(userId, XINPUT_FLAG_GAMEPAD, &capabilities); - const SDL_bool available = (result == ERROR_SUCCESS); + const SDL_bool available = (result == ERROR_SUCCESS) ? SDL_TRUE : SDL_FALSE; if (bOpenedXInputDevices[userId] != available) { s_bWindowsDeviceChanged = SDL_TRUE; bOpenedXInputDevices[userId] = available; @@ -367,9 +385,12 @@ #endif /* SDL_JOYSTICK_XINPUT */ } } + SDL_UnlockMutex(s_mutexJoyStickEnum); +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) SDL_CleanupDeviceNotification(&s_notification_data); +#endif return 1; } @@ -419,7 +440,7 @@ s_joystickThread = NULL; } -#endif /* !__WINRT__ */ +#endif /* !defined(__WINRT__) */ void WINDOWS_AddJoystickDevice(JoyStick_DeviceData *device) { @@ -453,7 +474,7 @@ WINDOWS_JoystickDetect(); -#ifndef __WINRT__ +#if !defined(__WINRT__) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) SDL_CreateDeviceNotificationFunc(); s_bJoystickThread = SDL_GetHintBoolean(SDL_HINT_JOYSTICK_THREAD, SDL_FALSE); @@ -467,6 +488,14 @@ } } #endif + +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) + /* On Xbox, force create the joystick thread for device detection (since other methods don't work */ + s_bJoystickThread = SDL_TRUE; + if (SDL_StartJoystickThread() < 0) { + return -1; + } +#endif return 0; } @@ -555,7 +584,6 @@ } } -/* Function to get the device-dependent name of a joystick */ static const char * WINDOWS_JoystickGetDeviceName(int device_index) { @@ -568,6 +596,18 @@ return device->joystickname; } +static const char * +WINDOWS_JoystickGetDevicePath(int device_index) +{ + JoyStick_DeviceData *device = SYS_Joystick; + int index; + + for (index = device_index; index > 0; index--) + device = device->pNext; + + return device->path; +} + static int WINDOWS_JoystickGetDevicePlayerIndex(int device_index) { @@ -727,7 +767,7 @@ } SYS_Joystick = NULL; -#ifndef __WINRT__ +#if !defined(__WINRT__) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) if (s_bJoystickThread) { SDL_StopJoystickThread(); } else { @@ -737,6 +777,12 @@ SDL_CleanupDeviceNotificationFunc(); #endif +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) + if (s_bJoystickThread) { + SDL_StopJoystickThread(); + } +#endif + SDL_DINPUT_JoystickQuit(); SDL_XINPUT_JoystickQuit(); @@ -755,6 +801,7 @@ WINDOWS_JoystickGetCount, WINDOWS_JoystickDetect, WINDOWS_JoystickGetDeviceName, + WINDOWS_JoystickGetDevicePath, WINDOWS_JoystickGetDevicePlayerIndex, WINDOWS_JoystickSetDevicePlayerIndex, WINDOWS_JoystickGetDeviceGUID, @@ -772,6 +819,11 @@ WINDOWS_JoystickGetGamepadMapping }; +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif + #else #if SDL_JOYSTICK_RAWINPUT diff -Nru libsdl2-2.0.22+dfsg/src/joystick/windows/SDL_windowsjoystick_c.h libsdl2-2.24.0+dfsg/src/joystick/windows/SDL_windowsjoystick_c.h --- libsdl2-2.0.22+dfsg/src/joystick/windows/SDL_windowsjoystick_c.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/windows/SDL_windowsjoystick_c.h 2022-08-13 03:48:10.000000000 +0000 @@ -27,6 +27,11 @@ #define MAX_INPUTS 256 /* each joystick can have up to 256 inputs */ +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + typedef struct JoyStick_DeviceData { SDL_JoystickGUID guid; @@ -37,7 +42,7 @@ BYTE SubType; Uint8 XInputUserId; DIDEVICEINSTANCE dxdevice; - char hidPath[MAX_PATH]; + char path[MAX_PATH]; struct JoyStick_DeviceData *pNext; } JoyStick_DeviceData; @@ -91,4 +96,9 @@ extern void WINDOWS_AddJoystickDevice(JoyStick_DeviceData *device); +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif + /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/joystick/windows/SDL_xinputjoystick.c libsdl2-2.24.0+dfsg/src/joystick/windows/SDL_xinputjoystick.c --- libsdl2-2.0.22+dfsg/src/joystick/windows/SDL_xinputjoystick.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/windows/SDL_xinputjoystick.c 2022-08-13 03:48:10.000000000 +0000 @@ -31,6 +31,11 @@ #include "SDL_rawinputjoystick_c.h" #include "../hidapi/SDL_hidapijoystick_c.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + /* * Internal stuff. */ @@ -45,6 +50,8 @@ /* TODO: remove this __WINRT__ block, but only after integrating with UWP/WinRT's HID API */ /* FIXME: Why are Win8/10 different here? -flibit */ return (NTDDI_VERSION < NTDDI_WIN10); +#elif defined(__XBOXONE__) || defined(__XBOXSERIES__) + return SDL_FALSE; #else static int s_XInputUseOldJoystickMapping = -1; if (s_XInputUseOldJoystickMapping < 0) { @@ -126,7 +133,7 @@ static void GuessXInputDevice(Uint8 userid, Uint16 *pVID, Uint16 *pPID, Uint16 *pVersion) { -#ifndef __WINRT__ /* TODO: remove this ifndef __WINRT__ block, but only after integrating with UWP/WinRT's HID API */ +#if !defined(__WINRT__) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) /* TODO: remove this ifndef __WINRT__ block, but only after integrating with UWP/WinRT's HID API */ PRAWINPUTDEVICELIST devices = NULL; UINT i, j, device_count = 0; @@ -297,6 +304,7 @@ SDL_free(pNewJoystick); return; /* better luck next time? */ } + SDL_snprintf(pNewJoystick->path, sizeof(pNewJoystick->path), "XInput#%d", userid); if (SDL_ShouldIgnoreJoystick(pNewJoystick->joystickname, pNewJoystick->guid)) { SDL_free(pNewJoystick); @@ -385,7 +393,7 @@ return SDL_SetError("Failed to obtain XInput device capabilities. Device disconnected?"); } SDL_zero(state); - joystick->hwdata->bXInputHaptic = (XINPUTSETSTATE(userId, &state) == ERROR_SUCCESS); + joystick->hwdata->bXInputHaptic = (XINPUTSETSTATE(userId, &state) == ERROR_SUCCESS) ? SDL_TRUE : SDL_FALSE; joystick->hwdata->userid = userId; /* The XInput API has a hard coded button/axis mapping, so we just match it */ @@ -540,6 +548,10 @@ result = XINPUTGETBATTERYINFORMATION(joystick->hwdata->userid, BATTERY_DEVTYPE_GAMEPAD, &XBatteryInformation); } +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) + /* XInputOnGameInput doesn't ever change dwPacketNumber, so have to just update every frame */ + UpdateXInputJoystickState(joystick, &XInputState, &XBatteryInformation); +#else /* only fire events if the data changed from last time */ if (XInputState.dwPacketNumber && XInputState.dwPacketNumber != joystick->hwdata->dwPacketNumber) { if (SDL_XInputUseOldJoystickMapping()) { @@ -549,6 +561,7 @@ } joystick->hwdata->dwPacketNumber = XInputState.dwPacketNumber; } +#endif } void @@ -564,6 +577,11 @@ } } +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif + #else /* !SDL_JOYSTICK_XINPUT */ typedef struct JoyStick_DeviceData JoyStick_DeviceData; diff -Nru libsdl2-2.0.22+dfsg/src/joystick/windows/SDL_xinputjoystick_c.h libsdl2-2.24.0+dfsg/src/joystick/windows/SDL_xinputjoystick_c.h --- libsdl2-2.0.22+dfsg/src/joystick/windows/SDL_xinputjoystick_c.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/joystick/windows/SDL_xinputjoystick_c.h 2022-08-13 03:48:10.000000000 +0000 @@ -22,6 +22,11 @@ #include "../../core/windows/SDL_xinput.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + extern SDL_bool SDL_XINPUT_Enabled(void); extern int SDL_XINPUT_JoystickInit(void); extern void SDL_XINPUT_JoystickDetect(JoyStick_DeviceData **pContext); @@ -32,4 +37,9 @@ extern void SDL_XINPUT_JoystickClose(SDL_Joystick * joystick); extern void SDL_XINPUT_JoystickQuit(void); +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif + /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/libm/math_private.h libsdl2-2.24.0+dfsg/src/libm/math_private.h --- libsdl2-2.0.22+dfsg/src/libm/math_private.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/libm/math_private.h 2022-06-16 20:16:31.000000000 +0000 @@ -27,7 +27,7 @@ #define libm_hidden_def(x) #define strong_alias(x, y) -#if !defined(__HAIKU__) && !defined(__PSP__) /* already defined in a system header. */ +#if !defined(__HAIKU__) && !defined(__PSP__) && !defined(__PS2__) /* already defined in a system header. */ typedef unsigned int u_int32_t; #endif @@ -66,9 +66,10 @@ * Math on arm is special: * For FPA, float words are always big-endian. * For VFP, floats words follow the memory system mode. + * For Maverick, float words are always little-endian. */ -#if (SDL_BYTEORDER == SDL_BIG_ENDIAN) +#if (SDL_FLOATWORDORDER == SDL_BIG_ENDIAN) typedef union { diff -Nru libsdl2-2.0.22+dfsg/src/main/gdk/SDL_gdk_main.c libsdl2-2.24.0+dfsg/src/main/gdk/SDL_gdk_main.c --- libsdl2-2.0.22+dfsg/src/main/gdk/SDL_gdk_main.c 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/main/gdk/SDL_gdk_main.c 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,41 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "SDL_config.h" + +/* Include this so we define UNICODE properly */ +#include "../../core/windows/SDL_windows.h" + +/* Include the SDL main definition header */ +#include "SDL.h" +#include "SDL_main.h" + +#ifdef main +# undef main +#endif /* main */ + +/* This is where execution begins */ +int WINAPI +WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw) +{ + return SDL_GDKRunApp(SDL_main, NULL); +} + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/main/ngage/SDL_ngage_main.cpp libsdl2-2.24.0+dfsg/src/main/ngage/SDL_ngage_main.cpp --- libsdl2-2.0.22+dfsg/src/main/ngage/SDL_ngage_main.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/main/ngage/SDL_ngage_main.cpp 2022-06-02 02:01:57.000000000 +0000 @@ -0,0 +1,82 @@ +/* + SDL_ngage_main.c, originally for SDL 1.2 by Hannu Viitala +*/ +#include "../../SDL_internal.h" + +/* Include the SDL main definition header */ +#include "SDL_main.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "SDL_error.h" + +extern "C" int main(int argc, char *argv[]); + +TInt E32Main() +{ + /* Get the clean-up stack */ + CTrapCleanup* cleanup = CTrapCleanup::New(); + + /* Arrange for multi-threaded operation */ + SpawnPosixServerThread(); + + /* Get args and environment */ + int argc = 0; + char** argv = 0; + char** envp = 0; + + __crt0(argc,argv,envp); + + /* Start the application! */ + + /* Create stdlib */ + _REENT; + + /* Set process and thread priority and name */ + + RThread currentThread; + RProcess thisProcess; + TParse exeName; + exeName.Set(thisProcess.FileName(), NULL, NULL); + currentThread.Rename(exeName.Name()); + currentThread.SetProcessPriority(EPriorityLow); + currentThread.SetPriority(EPriorityMuchLess); + + /* Increase heap size */ + RHeap* newHeap = NULL; + RHeap* oldHeap = NULL; + TInt heapSize = 7500000; + int ret; + + newHeap = User::ChunkHeap(NULL, heapSize, heapSize, KMinHeapGrowBy); + + if (NULL == newHeap) + { + ret = 3; + goto cleanup; + } + else + { + oldHeap = User::SwitchHeap(newHeap); + /* Call stdlib main */ + SDL_SetMainReady(); + ret = SDL_main(argc, argv); + } + +cleanup: + _cleanup(); + + CloseSTDLIB(); + delete cleanup; + return ret; +} + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/main/ps2/SDL_ps2_main.c libsdl2-2.24.0+dfsg/src/main/ps2/SDL_ps2_main.c --- libsdl2-2.0.22+dfsg/src/main/ps2/SDL_ps2_main.c 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/main/ps2/SDL_ps2_main.c 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,90 @@ +/* + SDL_ps2_main.c, fjtrujy@gmail.com +*/ + +#include "SDL_config.h" + +#ifdef __PS2__ + +#include "SDL_main.h" +#include "SDL_error.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#ifdef main + #undef main +#endif + +__attribute__((weak)) +void reset_IOP() { + SifInitRpc(0); + while(!SifIopReset(NULL, 0)){}; + while(!SifIopSync()){}; +} + +static void prepare_IOP() +{ + reset_IOP(); + SifInitRpc(0); + sbv_patch_enable_lmb(); + sbv_patch_disable_prefix_check(); +} + +static void init_drivers() { + init_fileXio_driver(); + init_memcard_driver(true); + init_usb_driver(true); +} + +static void deinit_drivers() { + deinit_usb_driver(true); + deinit_memcard_driver(true); + deinit_fileXio_driver(); +} + +static void waitUntilDeviceIsReady(char *path) +{ + struct stat buffer; + int ret = -1; + int retries = 50; + + while(ret != 0 && retries > 0) { + ret = stat(path, &buffer); + /* Wait untill the device is ready */ + nopdelay(); + + retries--; + } +} + +int main(int argc, char *argv[]) +{ + int res; + char cwd[FILENAME_MAX]; + + prepare_IOP(); + init_drivers(); + + getcwd(cwd, sizeof(cwd)); + waitUntilDeviceIsReady(cwd); + + res = SDL_main(argc, argv); + + deinit_drivers(); + + return res; +} + +#endif /* _PS2 */ + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/main/uikit/SDL_uikit_main.c libsdl2-2.24.0+dfsg/src/main/uikit/SDL_uikit_main.c --- libsdl2-2.0.22+dfsg/src/main/uikit/SDL_uikit_main.c 2021-07-31 23:05:30.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/main/uikit/SDL_uikit_main.c 2022-06-02 02:01:57.000000000 +0000 @@ -1,7 +1,6 @@ /* SDL_uikit_main.c, placed in the public domain by Sam Lantinga 3/18/2019 */ -#include "../../SDL_internal.h" /* Include the SDL main definition header */ #include "SDL_main.h" diff -Nru libsdl2-2.0.22+dfsg/src/main/windows/SDL_windows_main.c libsdl2-2.24.0+dfsg/src/main/windows/SDL_windows_main.c --- libsdl2-2.0.22+dfsg/src/main/windows/SDL_windows_main.c 2021-07-27 14:52:29.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/main/windows/SDL_windows_main.c 2022-06-16 20:16:31.000000000 +0000 @@ -70,7 +70,7 @@ if (!argv[i]) { return OutOfMemory(); } - CopyMemory(argv[i], arg, len); + SDL_memcpy(argv[i], arg, len); SDL_free(arg); } argv[i] = NULL; diff -Nru libsdl2-2.0.22+dfsg/src/main/windows/version.rc libsdl2-2.24.0+dfsg/src/main/windows/version.rc --- libsdl2-2.0.22+dfsg/src/main/windows/version.rc 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/main/windows/version.rc 2022-08-19 15:46:21.000000000 +0000 @@ -9,8 +9,8 @@ // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,0,22,0 - PRODUCTVERSION 2,0,22,0 + FILEVERSION 2,24,0,0 + PRODUCTVERSION 2,24,0,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0x0L FILEOS 0x40004L @@ -23,12 +23,12 @@ BEGIN VALUE "CompanyName", "\0" VALUE "FileDescription", "SDL\0" - VALUE "FileVersion", "2, 0, 22, 0\0" + VALUE "FileVersion", "2, 24, 0, 0\0" VALUE "InternalName", "SDL\0" VALUE "LegalCopyright", "Copyright (C) 2022 Sam Lantinga\0" VALUE "OriginalFilename", "SDL2.dll\0" VALUE "ProductName", "Simple DirectMedia Layer\0" - VALUE "ProductVersion", "2, 0, 22, 0\0" + VALUE "ProductVersion", "2, 24, 0, 0\0" END END BLOCK "VarFileInfo" diff -Nru libsdl2-2.0.22+dfsg/src/misc/windows/SDL_sysurl.c libsdl2-2.24.0+dfsg/src/misc/windows/SDL_sysurl.c --- libsdl2-2.0.22+dfsg/src/misc/windows/SDL_sysurl.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/misc/windows/SDL_sysurl.c 2022-08-13 03:48:10.000000000 +0000 @@ -24,6 +24,14 @@ #include +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) +int +SDL_SYS_OpenURL(const char *url) +{ + /* Not supported */ + return SDL_Unsupported(); +} +#else /* https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153%28v=vs.85%29.aspx */ int SDL_SYS_OpenURL(const char *url) @@ -49,6 +57,7 @@ WIN_CoUninitialize(); return (rc > ((HINSTANCE) 32)) ? 0 : WIN_SetError("Couldn't open given URL."); } +#endif /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/render/direct3d/SDL_render_d3d.c libsdl2-2.24.0+dfsg/src/render/direct3d/SDL_render_d3d.c --- libsdl2-2.0.22+dfsg/src/render/direct3d/SDL_render_d3d.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/render/direct3d/SDL_render_d3d.c 2022-08-13 03:48:10.000000000 +0000 @@ -41,6 +41,13 @@ #include "SDL_shaders_d3d.h" +#ifdef __WATCOMC__ +/* FIXME: Remove this once https://github.com/open-watcom/open-watcom-v2/pull/868 is merged */ +#define D3DBLENDOP_REVSUBTRACT 3 +/* FIXME: Remove this once https://github.com/open-watcom/open-watcom-v2/pull/869 is merged */ +#define D3DERR_UNSUPPORTEDCOLOROPERATION MAKE_D3DHRESULT( 2073 ) +#endif + typedef struct { SDL_Rect viewport; @@ -301,7 +308,7 @@ int w, h; Uint32 window_flags = SDL_GetWindowFlags(window); - SDL_GetWindowSize(window, &w, &h); + WIN_GetDrawableSize(window, &w, &h); data->pparams.BackBufferWidth = w; data->pparams.BackBufferHeight = h; if (window_flags & SDL_WINDOW_FULLSCREEN && (window_flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP) { @@ -347,6 +354,13 @@ } } +static int +D3D_GetOutputSize(SDL_Renderer * renderer, int *w, int *h) +{ + WIN_GetDrawableSize(renderer->window, w, h); + return 0; +} + static D3DBLEND GetBlendFunc(SDL_BlendFactor factor) { @@ -1079,7 +1093,13 @@ if (data->drawstate.viewport_dirty) { const SDL_Rect *viewport = &data->drawstate.viewport; - const D3DVIEWPORT9 d3dviewport = { viewport->x, viewport->y, viewport->w, viewport->h, 0.0f, 1.0f }; + D3DVIEWPORT9 d3dviewport; + d3dviewport.X = viewport->x; + d3dviewport.Y = viewport->y; + d3dviewport.Width = viewport->w; + d3dviewport.Height = viewport->h; + d3dviewport.MinZ = 0.0f; + d3dviewport.MaxZ = 1.0f; IDirect3DDevice9_SetViewport(data->device, &d3dviewport); /* Set an orthographic projection matrix */ @@ -1106,7 +1126,11 @@ if (data->drawstate.cliprect_dirty) { const SDL_Rect *viewport = &data->drawstate.viewport; const SDL_Rect *rect = &data->drawstate.cliprect; - const RECT d3drect = { viewport->x + rect->x, viewport->y + rect->y, viewport->x + rect->x + rect->w, viewport->y + rect->y + rect->h }; + RECT d3drect; + d3drect.left = viewport->x + rect->x; + d3drect.top = viewport->y + rect->y; + d3drect.right = viewport->x + rect->x + rect->w; + d3drect.bottom = viewport->y + rect->y + rect->h; IDirect3DDevice9_SetScissorRect(data->device, &d3drect); data->drawstate.cliprect_dirty = SDL_FALSE; } @@ -1183,8 +1207,8 @@ case SDL_RENDERCMD_SETVIEWPORT: { SDL_Rect *viewport = &data->drawstate.viewport; - if (SDL_memcmp(viewport, &cmd->data.viewport.rect, sizeof (SDL_Rect)) != 0) { - SDL_memcpy(viewport, &cmd->data.viewport.rect, sizeof (SDL_Rect)); + if (SDL_memcmp(viewport, &cmd->data.viewport.rect, sizeof(cmd->data.viewport.rect)) != 0) { + SDL_copyp(viewport, &cmd->data.viewport.rect); data->drawstate.viewport_dirty = SDL_TRUE; } break; @@ -1197,8 +1221,8 @@ data->drawstate.cliprect_enabled_dirty = SDL_TRUE; } - if (SDL_memcmp(&data->drawstate.cliprect, rect, sizeof (SDL_Rect)) != 0) { - SDL_memcpy(&data->drawstate.cliprect, rect, sizeof (SDL_Rect)); + if (SDL_memcmp(&data->drawstate.cliprect, rect, sizeof(*rect)) != 0) { + SDL_copyp(&data->drawstate.cliprect, rect); data->drawstate.cliprect_dirty = SDL_TRUE; } break; @@ -1221,7 +1245,9 @@ IDirect3DDevice9_Clear(data->device, 0, NULL, D3DCLEAR_TARGET, color, 0.0f, 0); } else { /* Clear is defined to clear the entire render target */ - const D3DVIEWPORT9 wholeviewport = { 0, 0, backw, backh, 0.0f, 1.0f }; + D3DVIEWPORT9 wholeviewport = { 0, 0, 0, 0, 0.0f, 1.0f }; + wholeviewport.Width = backw; + wholeviewport.Height = backh; IDirect3DDevice9_SetViewport(data->device, &wholeviewport); data->drawstate.viewport_dirty = SDL_TRUE; /* we still need to (re)set orthographic projection, so always mark it dirty. */ IDirect3DDevice9_Clear(data->device, 0, NULL, D3DCLEAR_TARGET, color, 0.0f, 0); @@ -1597,6 +1623,7 @@ } renderer->WindowEvent = D3D_WindowEvent; + renderer->GetOutputSize = D3D_GetOutputSize; renderer->SupportsBlendMode = D3D_SupportsBlendMode; renderer->CreateTexture = D3D_CreateTexture; renderer->UpdateTexture = D3D_UpdateTexture; @@ -1626,7 +1653,7 @@ SDL_GetWindowWMInfo(window, &windowinfo); window_flags = SDL_GetWindowFlags(window); - SDL_GetWindowSize(window, &w, &h); + WIN_GetDrawableSize(window, &w, &h); SDL_GetWindowDisplayMode(window, &fullscreen_mode); SDL_zero(pparams); @@ -1728,6 +1755,9 @@ } } #endif + data->drawstate.viewport_dirty = SDL_TRUE; + data->drawstate.cliprect_dirty = SDL_TRUE; + data->drawstate.cliprect_enabled_dirty = SDL_TRUE; data->drawstate.blend = SDL_BLENDMODE_INVALID; return renderer; @@ -1745,7 +1775,7 @@ }; #endif /* SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED */ -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__WINGDK__) /* This function needs to always exist on Windows, for the Dynamic API. */ IDirect3DDevice9 * SDL_RenderGetD3D9Device(SDL_Renderer * renderer) @@ -1769,6 +1799,6 @@ return device; } -#endif /* __WIN32__ */ +#endif /* defined(__WIN32__) || defined(__WINGDK__) */ /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/render/direct3d11/SDL_render_d3d11.c libsdl2-2.24.0+dfsg/src/render/direct3d11/SDL_render_d3d11.c --- libsdl2-2.0.22+dfsg/src/render/direct3d11/SDL_render_d3d11.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/render/direct3d11/SDL_render_d3d11.c 2022-08-13 03:48:10.000000000 +0000 @@ -27,6 +27,9 @@ #define COBJMACROS #include "../../core/windows/SDL_windows.h" +#if !defined(__WINRT__) +#include "../../video/windows/SDL_windowswindow.h" +#endif #include "SDL_hints.h" #include "SDL_loadso.h" #include "SDL_syswm.h" @@ -669,7 +672,7 @@ return result; } -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__WINGDK__) static DXGI_MODE_ROTATION D3D11_GetCurrentRotation() @@ -678,7 +681,7 @@ return DXGI_MODE_ROTATION_IDENTITY; } -#endif /* __WIN32__ */ +#endif /* defined(__WIN32__) || defined(__WINGDK__) */ static BOOL D3D11_IsDisplayRotated90Degrees(DXGI_MODE_ROTATION rotation) @@ -824,7 +827,7 @@ goto done; #endif } else { -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__WINGDK__) SDL_SysWMinfo windowinfo; SDL_VERSION(&windowinfo.version); SDL_GetWindowWMInfo(renderer->window, &windowinfo); @@ -846,7 +849,7 @@ #else SDL_SetError(__FUNCTION__", Unable to find something to attach a swap chain to"); goto done; -#endif /* ifdef __WIN32__ / else */ +#endif /* defined(__WIN32__) || defined(__WINGDK__) / else */ } data->swapEffect = swapChainDesc.SwapEffect; @@ -910,7 +913,11 @@ /* The width and height of the swap chain must be based on the display's * non-rotated size. */ +#if defined(__WINRT__) SDL_GetWindowSize(renderer->window, &w, &h); +#else + WIN_GetDrawableSize(renderer->window, &w, &h); +#endif data->rotation = D3D11_GetCurrentRotation(); /* SDL_Log("%s: windowSize={%d,%d}, orientation=%d\n", __FUNCTION__, w, h, (int)data->rotation); */ if (D3D11_IsDisplayRotated90Degrees(data->rotation)) { @@ -1051,6 +1058,15 @@ } } +#if !defined(__WINRT__) +static int +D3D11_GetOutputSize(SDL_Renderer * renderer, int *w, int *h) +{ + WIN_GetDrawableSize(renderer->window, w, h); + return 0; +} +#endif + static SDL_bool D3D11_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode) { @@ -1177,6 +1193,7 @@ } } #endif /* SDL_HAVE_YUV */ + SDL_zero(resourceViewDesc); resourceViewDesc.Format = textureDesc.Format; resourceViewDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; resourceViewDesc.Texture2D.MostDetailedMip = 0; @@ -1227,9 +1244,11 @@ return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result); } } +#endif /* SDL_HAVE_YUV */ if (texture->access & SDL_TEXTUREACCESS_TARGET) { D3D11_RENDER_TARGET_VIEW_DESC renderTargetViewDesc; + SDL_zero(renderTargetViewDesc); renderTargetViewDesc.Format = textureDesc.Format; renderTargetViewDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D; renderTargetViewDesc.Texture2D.MipSlice = 0; @@ -1243,7 +1262,7 @@ return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateRenderTargetView"), result); } } -#endif /* SDL_HAVE_YUV */ + return 0; } @@ -1963,7 +1982,7 @@ } if (updateSubresource == SDL_TRUE || SDL_memcmp(&rendererData->vertexShaderConstantsData.model, newmatrix, sizeof (*newmatrix)) != 0) { - SDL_memcpy(&rendererData->vertexShaderConstantsData.model, newmatrix, sizeof (*newmatrix)); + SDL_copyp(&rendererData->vertexShaderConstantsData.model, newmatrix); ID3D11DeviceContext_UpdateSubresource(rendererData->d3dContext, (ID3D11Resource *)rendererData->vertexShaderConstants, 0, @@ -2082,8 +2101,8 @@ case SDL_RENDERCMD_SETVIEWPORT: { SDL_Rect *viewport = &rendererData->currentViewport; - if (SDL_memcmp(viewport, &cmd->data.viewport.rect, sizeof (SDL_Rect)) != 0) { - SDL_memcpy(viewport, &cmd->data.viewport.rect, sizeof (SDL_Rect)); + if (SDL_memcmp(viewport, &cmd->data.viewport.rect, sizeof(cmd->data.viewport.rect)) != 0) { + SDL_copyp(viewport, &cmd->data.viewport.rect); rendererData->viewportDirty = SDL_TRUE; } break; @@ -2095,8 +2114,8 @@ rendererData->currentCliprectEnabled = cmd->data.cliprect.enabled; rendererData->cliprectDirty = SDL_TRUE; } - if (SDL_memcmp(&rendererData->currentCliprect, rect, sizeof (SDL_Rect)) != 0) { - SDL_memcpy(&rendererData->currentCliprect, rect, sizeof (SDL_Rect)); + if (SDL_memcmp(&rendererData->currentCliprect, rect, sizeof(*rect)) != 0) { + SDL_copyp(&rendererData->currentCliprect, rect); rendererData->cliprectDirty = SDL_TRUE; } break; @@ -2363,6 +2382,9 @@ data->identity = MatrixIdentity(); renderer->WindowEvent = D3D11_WindowEvent; +#if !defined(__WINRT__) + renderer->GetOutputSize = D3D11_GetOutputSize; +#endif renderer->SupportsBlendMode = D3D11_SupportsBlendMode; renderer->CreateTexture = D3D11_CreateTexture; renderer->UpdateTexture = D3D11_UpdateTexture; @@ -2451,7 +2473,7 @@ #endif /* SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED */ -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__WINGDK__) /* This function needs to always exist on Windows, for the Dynamic API. */ ID3D11Device * SDL_RenderGetD3D11Device(SDL_Renderer * renderer) @@ -2475,6 +2497,6 @@ return device; } -#endif /* __WIN32__ */ +#endif /* defined(__WIN32__) || defined(__WINGDK__) */ /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/render/direct3d12/SDL_render_d3d12.c libsdl2-2.24.0+dfsg/src/render/direct3d12/SDL_render_d3d12.c --- libsdl2-2.0.22+dfsg/src/render/direct3d12/SDL_render_d3d12.c 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/render/direct3d12/SDL_render_d3d12.c 2022-08-13 15:09:00.000000000 +0000 @@ -0,0 +1,3140 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#include "SDL_render.h" +#include "SDL_system.h" + +#if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED + +#define SDL_D3D12_NUM_BUFFERS 2 +#define SDL_D3D12_NUM_VERTEX_BUFFERS 256 +#define SDL_D3D12_MAX_NUM_TEXTURES 16384 +#define SDL_D3D12_NUM_UPLOAD_BUFFERS 32 + +#include "../../core/windows/SDL_windows.h" +#include "../../video/windows/SDL_windowswindow.h" +#include "SDL_hints.h" +#include "SDL_loadso.h" +#include "SDL_syswm.h" +#include "../SDL_sysrender.h" +#include "../SDL_d3dmath.h" + +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) +#include "SDL_render_d3d12_xbox.h" +#ifndef D3D12_TEXTURE_DATA_PITCH_ALIGNMENT +#define D3D12_TEXTURE_DATA_PITCH_ALIGNMENT 256 +#endif +#else +#include +#include +#include +#include +#endif + +#include "SDL_shaders_d3d12.h" + +#if defined(_MSC_VER) && !defined(__clang__) +#define SDL_COMPOSE_ERROR(str) __FUNCTION__ ", " str +#else +#define SDL_COMPOSE_ERROR(str) SDL_STRINGIFY_ARG(__FUNCTION__) ", " str +#endif + +#ifdef __cplusplus +#define SAFE_RELEASE(X) if (X) { (X)->Release(); X = NULL; } +#define D3D_CALL(THIS, FUNC, ...) (THIS)->FUNC(__VA_ARGS__) +#define D3D_CALL_RET(THIS, FUNC, RETVAL, ...) *(RETVAL) = (THIS)->FUNC(__VA_ARGS__) +#define D3D_GUID(X) (X) +#else +#define SAFE_RELEASE(X) if (X) { (X)->lpVtbl->Release(X); X = NULL; } +#define D3D_CALL(THIS, FUNC, ...) (THIS)->lpVtbl->FUNC((THIS), ##__VA_ARGS__) +#define D3D_CALL_RET(THIS, FUNC, ...) (THIS)->lpVtbl->FUNC((THIS), ##__VA_ARGS__) +#define D3D_GUID(X) &(X) +#endif + +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* !!! FIXME: vertex buffer bandwidth could be lower; only use UV coords when + !!! FIXME: textures are needed. */ + +/* Vertex shader, common values */ +typedef struct +{ + Float4X4 model; + Float4X4 projectionAndView; +} VertexShaderConstants; + +/* Per-vertex data */ +typedef struct +{ + Float2 pos; + Float2 tex; + SDL_Color color; +} VertexPositionColor; + +/* Per-texture data */ +typedef struct +{ + ID3D12Resource *mainTexture; + D3D12_CPU_DESCRIPTOR_HANDLE mainTextureResourceView; + D3D12_RESOURCE_STATES mainResourceState; + SIZE_T mainSRVIndex; + D3D12_CPU_DESCRIPTOR_HANDLE mainTextureRenderTargetView; + DXGI_FORMAT mainTextureFormat; + ID3D12Resource *stagingBuffer; + D3D12_RESOURCE_STATES stagingResourceState; + D3D12_FILTER scaleMode; +#if SDL_HAVE_YUV + /* YV12 texture support */ + SDL_bool yuv; + ID3D12Resource *mainTextureU; + D3D12_CPU_DESCRIPTOR_HANDLE mainTextureResourceViewU; + D3D12_RESOURCE_STATES mainResourceStateU; + SIZE_T mainSRVIndexU; + ID3D12Resource *mainTextureV; + D3D12_CPU_DESCRIPTOR_HANDLE mainTextureResourceViewV; + D3D12_RESOURCE_STATES mainResourceStateV; + SIZE_T mainSRVIndexV; + + /* NV12 texture support */ + SDL_bool nv12; + ID3D12Resource *mainTextureNV; + D3D12_CPU_DESCRIPTOR_HANDLE mainTextureResourceViewNV; + D3D12_RESOURCE_STATES mainResourceStateNV; + SIZE_T mainSRVIndexNV; + + Uint8 *pixels; + int pitch; +#endif + SDL_Rect lockedRect; +} D3D12_TextureData; + +/* Pipeline State Object data */ +typedef struct +{ + D3D12_Shader shader; + SDL_BlendMode blendMode; + D3D12_PRIMITIVE_TOPOLOGY_TYPE topology; + DXGI_FORMAT rtvFormat; + ID3D12PipelineState *pipelineState; +} D3D12_PipelineState; + +/* Vertex Buffer */ +typedef struct +{ + ID3D12Resource *resource; + D3D12_VERTEX_BUFFER_VIEW view; + size_t size; +} D3D12_VertexBuffer; + +/* For SRV pool allocator */ +typedef struct +{ + SIZE_T index; + void *next; +} D3D12_SRVPoolNode; + +/* Private renderer data */ +typedef struct +{ + void *hDXGIMod; + void *hD3D12Mod; +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) + UINT64 frameToken; +#else + IDXGIFactory6 *dxgiFactory; + IDXGIAdapter4 *dxgiAdapter; + IDXGIDebug *dxgiDebug; + IDXGISwapChain4 *swapChain; +#endif + ID3D12Device1 *d3dDevice; + ID3D12Debug *debugInterface; + ID3D12CommandQueue *commandQueue; + ID3D12GraphicsCommandList2 *commandList; + DXGI_SWAP_EFFECT swapEffect; + + /* Descriptor heaps */ + ID3D12DescriptorHeap* rtvDescriptorHeap; + UINT rtvDescriptorSize; + ID3D12DescriptorHeap* textureRTVDescriptorHeap; + ID3D12DescriptorHeap* srvDescriptorHeap; + UINT srvDescriptorSize; + ID3D12DescriptorHeap* samplerDescriptorHeap; + UINT samplerDescriptorSize; + + /* Data needed per backbuffer */ + ID3D12CommandAllocator *commandAllocators[SDL_D3D12_NUM_BUFFERS]; + ID3D12Resource *renderTargets[SDL_D3D12_NUM_BUFFERS]; + UINT64 fenceValue; + int currentBackBufferIndex; + + /* Fences */ + ID3D12Fence *fence; + HANDLE fenceEvent; + + /* Root signature and pipeline state data */ + ID3D12RootSignature *rootSignatures[NUM_ROOTSIGS]; + int pipelineStateCount; + D3D12_PipelineState *pipelineStates; + D3D12_PipelineState *currentPipelineState; + + D3D12_VertexBuffer vertexBuffers[SDL_D3D12_NUM_VERTEX_BUFFERS]; + D3D12_CPU_DESCRIPTOR_HANDLE nearestPixelSampler; + D3D12_CPU_DESCRIPTOR_HANDLE linearSampler; + + /* Data for staging/allocating textures */ + ID3D12Resource *uploadBuffers[SDL_D3D12_NUM_UPLOAD_BUFFERS]; + int currentUploadBuffer; + + /* Pool allocator to handle reusing SRV heap indices */ + D3D12_SRVPoolNode *srvPoolHead; + D3D12_SRVPoolNode srvPoolNodes[SDL_D3D12_MAX_NUM_TEXTURES]; + + /* Vertex buffer constants */ + VertexShaderConstants vertexShaderConstantsData; + + /* Cached renderer properties */ + DXGI_MODE_ROTATION rotation; + D3D12_TextureData* textureRenderTarget; + D3D12_CPU_DESCRIPTOR_HANDLE currentRenderTargetView; + D3D12_CPU_DESCRIPTOR_HANDLE currentShaderResource; + D3D12_CPU_DESCRIPTOR_HANDLE currentSampler; + SDL_bool cliprectDirty; + SDL_bool currentCliprectEnabled; + SDL_Rect currentCliprect; + SDL_Rect currentViewport; + int currentViewportRotation; + SDL_bool viewportDirty; + Float4X4 identity; + int currentVertexBuffer; + SDL_bool issueBatch; +} D3D12_RenderData; + + +/* Define D3D GUIDs here so we don't have to include uuid.lib. */ + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-const-variable" +#endif + +static const GUID SDL_IID_IDXGIFactory6 = { 0xc1b6694f, 0xff09, 0x44a9, { 0xb0, 0x3c, 0x77, 0x90, 0x0a, 0x0a, 0x1d, 0x17 } }; +static const GUID SDL_IID_IDXGIAdapter4 = { 0x3c8d99d1, 0x4fbf, 0x4181, { 0xa8, 0x2c, 0xaf, 0x66, 0xbf, 0x7b, 0xd2, 0x4e } }; +static const GUID SDL_IID_IDXGIDevice1 = { 0x77db970f, 0x6276, 0x48ba, { 0xba, 0x28, 0x07, 0x01, 0x43, 0xb4, 0x39, 0x2c } }; +static const GUID SDL_IID_ID3D12Device1 = { 0x77acce80, 0x638e, 0x4e65, { 0x88, 0x95, 0xc1, 0xf2, 0x33, 0x86, 0x86, 0x3e } }; +static const GUID SDL_IID_IDXGISwapChain4 = { 0x3D585D5A, 0xBD4A, 0x489E, { 0xB1, 0xF4, 0x3D, 0xBC, 0xB6, 0x45, 0x2F, 0xFB } }; +static const GUID SDL_IID_IDXGIDebug1 = { 0xc5a05f0c, 0x16f2, 0x4adf, { 0x9f, 0x4d, 0xa8, 0xc4, 0xd5, 0x8a, 0xc5, 0x50 } }; +static const GUID SDL_IID_IDXGIInfoQueue = { 0xD67441C7,0x672A,0x476f, { 0x9E,0x82,0xCD,0x55,0xB4,0x49,0x49,0xCE } }; +static const GUID SDL_IID_ID3D12Debug = { 0x344488b7, 0x6846, 0x474b, { 0xb9, 0x89, 0xf0, 0x27, 0x44, 0x82, 0x45, 0xe0 } }; +static const GUID SDL_DXGI_DEBUG_ALL = { 0xe48ae283, 0xda80, 0x490b, { 0x87, 0xe6, 0x43, 0xe9, 0xa9, 0xcf, 0xda, 0x8 } }; +static const GUID SDL_IID_ID3D12CommandQueue = { 0x0ec870a6, 0x5d7e, 0x4c22, { 0x8c, 0xfc, 0x5b, 0xaa, 0xe0, 0x76, 0x16, 0xed } }; +static const GUID SDL_IID_ID3D12DescriptorHeap = { 0x8efb471d, 0x616c, 0x4f49, { 0x90, 0xf7, 0x12, 0x7b, 0xb7, 0x63, 0xfa, 0x51 } }; +static const GUID SDL_IID_ID3D12CommandAllocator = { 0x6102dee4, 0xaf59, 0x4b09, { 0xb9, 0x99, 0xb4, 0x4d, 0x73, 0xf0, 0x9b, 0x24 } }; +static const GUID SDL_IID_ID3D12GraphicsCommandList2 = { 0x38C3E585, 0xFF17, 0x412C, { 0x91, 0x50, 0x4F, 0xC6, 0xF9, 0xD7, 0x2A, 0x28 } }; +static const GUID SDL_IID_ID3D12Fence = { 0x0a753dcf, 0xc4d8, 0x4b91, { 0xad, 0xf6, 0xbe, 0x5a, 0x60, 0xd9, 0x5a, 0x76 } }; +static const GUID SDL_IID_ID3D12Resource = { 0x696442be, 0xa72e, 0x4059, { 0xbc, 0x79, 0x5b, 0x5c, 0x98, 0x04, 0x0f, 0xad } }; +static const GUID SDL_IID_ID3D12RootSignature = { 0xc54a6b66, 0x72df, 0x4ee8, { 0x8b, 0xe5, 0xa9, 0x46, 0xa1, 0x42, 0x92, 0x14 } }; +static const GUID SDL_IID_ID3D12PipelineState = { 0x765a30f3, 0xf624, 0x4c6f, { 0xa8, 0x28, 0xac, 0xe9, 0x48, 0x62, 0x24, 0x45 } }; +static const GUID SDL_IID_ID3D12Heap = { 0x6b3b2502, 0x6e51, 0x45b3, { 0x90, 0xee, 0x98, 0x84, 0x26, 0x5e, 0x8d, 0xf3 } }; +static const GUID SDL_IID_ID3D12InfoQueue = { 0x0742a90b, 0xc387, 0x483f, { 0xb9, 0x46, 0x30, 0xa7, 0xe4, 0xe6, 0x14, 0x58 } }; + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif + + +UINT +D3D12_Align(UINT location, UINT alignment) +{ + return ((location + (alignment - 1)) & ~(alignment - 1)); +} + +Uint32 +D3D12_DXGIFormatToSDLPixelFormat(DXGI_FORMAT dxgiFormat) +{ + switch (dxgiFormat) { + case DXGI_FORMAT_B8G8R8A8_UNORM: + return SDL_PIXELFORMAT_ARGB8888; + case DXGI_FORMAT_B8G8R8X8_UNORM: + return SDL_PIXELFORMAT_RGB888; + default: + return SDL_PIXELFORMAT_UNKNOWN; + } +} + +static DXGI_FORMAT +SDLPixelFormatToDXGIFormat(Uint32 sdlFormat) +{ + switch (sdlFormat) { + case SDL_PIXELFORMAT_ARGB8888: + return DXGI_FORMAT_B8G8R8A8_UNORM; + case SDL_PIXELFORMAT_RGB888: + return DXGI_FORMAT_B8G8R8X8_UNORM; + case SDL_PIXELFORMAT_YV12: + case SDL_PIXELFORMAT_IYUV: + case SDL_PIXELFORMAT_NV12: /* For the Y texture */ + case SDL_PIXELFORMAT_NV21: /* For the Y texture */ + return DXGI_FORMAT_R8_UNORM; + default: + return DXGI_FORMAT_UNKNOWN; + } +} + +static void D3D12_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture); + +static void +D3D12_ReleaseAll(SDL_Renderer * renderer) +{ + D3D12_RenderData *data = (D3D12_RenderData *) renderer->driverdata; + SDL_Texture *texture = NULL; + + /* Release all textures */ + for (texture = renderer->textures; texture; texture = texture->next) { + D3D12_DestroyTexture(renderer, texture); + } + + /* Release/reset everything else */ + if (data) { + int i; + +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) + SAFE_RELEASE(data->dxgiFactory); + SAFE_RELEASE(data->dxgiAdapter); + SAFE_RELEASE(data->swapChain); +#endif + SAFE_RELEASE(data->d3dDevice); + SAFE_RELEASE(data->debugInterface); + SAFE_RELEASE(data->commandQueue); + SAFE_RELEASE(data->commandList); + SAFE_RELEASE(data->rtvDescriptorHeap); + SAFE_RELEASE(data->textureRTVDescriptorHeap); + SAFE_RELEASE(data->srvDescriptorHeap); + SAFE_RELEASE(data->samplerDescriptorHeap); + SAFE_RELEASE(data->fence); + + for (i = 0; i < SDL_D3D12_NUM_BUFFERS; ++i) { + SAFE_RELEASE(data->commandAllocators[i]); + SAFE_RELEASE(data->renderTargets[i]); + } + + if (data->pipelineStateCount > 0) { + for (i = 0; i < data->pipelineStateCount; ++i) { + SAFE_RELEASE(data->pipelineStates[i].pipelineState); + } + SDL_free(data->pipelineStates); + data->pipelineStateCount = 0; + } + + for (i = 0; i < NUM_ROOTSIGS; ++i) { + SAFE_RELEASE(data->rootSignatures[i]); + } + + for (i = 0; i < SDL_D3D12_NUM_VERTEX_BUFFERS; ++i) { + SAFE_RELEASE(data->vertexBuffers[i].resource); + } + + data->swapEffect = (DXGI_SWAP_EFFECT) 0; + data->currentRenderTargetView.ptr = 0; + data->currentSampler.ptr = 0; + +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) + /* Check for any leaks if in debug mode */ + if (data->dxgiDebug) { + DXGI_DEBUG_RLO_FLAGS rloFlags = (DXGI_DEBUG_RLO_FLAGS)(DXGI_DEBUG_RLO_SUMMARY | DXGI_DEBUG_RLO_IGNORE_INTERNAL); + D3D_CALL(data->dxgiDebug, ReportLiveObjects, SDL_DXGI_DEBUG_ALL, rloFlags); + SAFE_RELEASE(data->dxgiDebug); + } +#endif + + /* Unload the D3D libraries. This should be done last, in order + * to prevent IUnknown::Release() calls from crashing. + */ + if (data->hD3D12Mod) { + SDL_UnloadObject(data->hD3D12Mod); + data->hD3D12Mod = NULL; + } + if (data->hDXGIMod) { + SDL_UnloadObject(data->hDXGIMod); + data->hDXGIMod = NULL; + } + } +} + +static D3D12_GPU_DESCRIPTOR_HANDLE +D3D12_CPUtoGPUHandle(ID3D12DescriptorHeap * heap, D3D12_CPU_DESCRIPTOR_HANDLE CPUHandle) +{ + D3D12_CPU_DESCRIPTOR_HANDLE CPUHeapStart; + D3D12_GPU_DESCRIPTOR_HANDLE GPUHandle; + SIZE_T offset; + + /* Calculate the correct offset into the heap */ + D3D_CALL_RET(heap, GetCPUDescriptorHandleForHeapStart, &CPUHeapStart); + offset = CPUHandle.ptr - CPUHeapStart.ptr; + + D3D_CALL_RET(heap, GetGPUDescriptorHandleForHeapStart, &GPUHandle); + GPUHandle.ptr += offset; + + return GPUHandle; +} + +static void +D3D12_WaitForGPU(D3D12_RenderData * data) +{ + if (data->commandQueue && data->fence && data->fenceEvent) + { + D3D_CALL(data->commandQueue, Signal, data->fence, data->fenceValue); + if (D3D_CALL(data->fence, GetCompletedValue) < data->fenceValue) { + D3D_CALL(data->fence, SetEventOnCompletion, + data->fenceValue, + data->fenceEvent + ); + WaitForSingleObjectEx(data->fenceEvent, INFINITE, FALSE); + } + + data->fenceValue++; + } +} + +static D3D12_CPU_DESCRIPTOR_HANDLE +D3D12_GetCurrentRenderTargetView(SDL_Renderer * renderer) +{ + D3D12_RenderData* data = (D3D12_RenderData*)renderer->driverdata; + D3D12_CPU_DESCRIPTOR_HANDLE rtvDescriptor; + + if (data->textureRenderTarget) { + return data->textureRenderTarget->mainTextureRenderTargetView; + } + + SDL_zero(rtvDescriptor); + D3D_CALL_RET(data->rtvDescriptorHeap, GetCPUDescriptorHandleForHeapStart, &rtvDescriptor); + rtvDescriptor.ptr += data->currentBackBufferIndex * data->rtvDescriptorSize; + return rtvDescriptor; +} + +static void +D3D12_TransitionResource(D3D12_RenderData * data, + ID3D12Resource * resource, + D3D12_RESOURCE_STATES beforeState, + D3D12_RESOURCE_STATES afterState +) +{ + D3D12_RESOURCE_BARRIER barrier; + + if (beforeState != afterState) { + SDL_zero(barrier); + barrier.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION; + barrier.Transition.pResource = resource; + barrier.Transition.StateBefore = beforeState; + barrier.Transition.StateAfter = afterState; + barrier.Transition.Subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES; + + D3D_CALL(data->commandList, ResourceBarrier, 1, &barrier); + } +} + +static void +D3D12_ResetCommandList(D3D12_RenderData * data) +{ + int i; + ID3D12DescriptorHeap *rootDescriptorHeaps[] = { data->srvDescriptorHeap, data->samplerDescriptorHeap }; + ID3D12CommandAllocator *commandAllocator = data->commandAllocators[data->currentBackBufferIndex]; + + D3D_CALL(commandAllocator, Reset); + D3D_CALL(data->commandList, Reset, commandAllocator, NULL); + data->currentPipelineState = NULL; + data->currentVertexBuffer = 0; + data->issueBatch = SDL_FALSE; + data->cliprectDirty = SDL_TRUE; + data->viewportDirty = SDL_TRUE; + data->currentRenderTargetView.ptr = 0; + + /* Release any upload buffers that were inflight */ + for (i = 0; i < data->currentUploadBuffer; ++i) { + SAFE_RELEASE(data->uploadBuffers[i]); + } + data->currentUploadBuffer = 0; + + D3D_CALL(data->commandList, SetDescriptorHeaps, 2, rootDescriptorHeaps); +} + +static int +D3D12_IssueBatch(D3D12_RenderData * data) +{ + HRESULT result = S_OK; + + /* Issue the command list */ + result = D3D_CALL(data->commandList, Close); + if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("D3D12_IssueBatch"), result); + return result; + } + D3D_CALL(data->commandQueue, ExecuteCommandLists, 1, (ID3D12CommandList* const*)&data->commandList); + + D3D12_WaitForGPU(data); + + D3D12_ResetCommandList(data); + + return result; +} + +static void +D3D12_DestroyRenderer(SDL_Renderer * renderer) +{ + D3D12_RenderData *data = (D3D12_RenderData *) renderer->driverdata; + D3D12_WaitForGPU(data); + D3D12_ReleaseAll(renderer); + if (data) { + SDL_free(data); + } + SDL_free(renderer); +} + +static int +D3D12_GetOutputSize(SDL_Renderer *renderer, int *w, int *h) +{ + WIN_GetDrawableSize(renderer->window, w, h); + return 0; +} + +static D3D12_BLEND +GetBlendFunc(SDL_BlendFactor factor) +{ + switch (factor) { + case SDL_BLENDFACTOR_ZERO: + return D3D12_BLEND_ZERO; + case SDL_BLENDFACTOR_ONE: + return D3D12_BLEND_ONE; + case SDL_BLENDFACTOR_SRC_COLOR: + return D3D12_BLEND_SRC_COLOR; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR: + return D3D12_BLEND_INV_SRC_COLOR; + case SDL_BLENDFACTOR_SRC_ALPHA: + return D3D12_BLEND_SRC_ALPHA; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA: + return D3D12_BLEND_INV_SRC_ALPHA; + case SDL_BLENDFACTOR_DST_COLOR: + return D3D12_BLEND_DEST_COLOR; + case SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR: + return D3D12_BLEND_INV_DEST_COLOR; + case SDL_BLENDFACTOR_DST_ALPHA: + return D3D12_BLEND_DEST_ALPHA; + case SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA: + return D3D12_BLEND_INV_DEST_ALPHA; + default: + return (D3D12_BLEND)0; + } +} + +static D3D12_BLEND_OP +GetBlendEquation(SDL_BlendOperation operation) +{ + switch (operation) { + case SDL_BLENDOPERATION_ADD: + return D3D12_BLEND_OP_ADD; + case SDL_BLENDOPERATION_SUBTRACT: + return D3D12_BLEND_OP_SUBTRACT; + case SDL_BLENDOPERATION_REV_SUBTRACT: + return D3D12_BLEND_OP_REV_SUBTRACT; + case SDL_BLENDOPERATION_MINIMUM: + return D3D12_BLEND_OP_MIN; + case SDL_BLENDOPERATION_MAXIMUM: + return D3D12_BLEND_OP_MAX; + default: + return (D3D12_BLEND_OP)0; + } +} + +static void +D3D12_CreateBlendState(SDL_Renderer * renderer, SDL_BlendMode blendMode, D3D12_BLEND_DESC * outBlendDesc) +{ + SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode); + SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode); + SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode); + SDL_BlendFactor dstColorFactor = SDL_GetBlendModeDstColorFactor(blendMode); + SDL_BlendFactor dstAlphaFactor = SDL_GetBlendModeDstAlphaFactor(blendMode); + SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode); + + SDL_zerop(outBlendDesc); + outBlendDesc->AlphaToCoverageEnable = FALSE; + outBlendDesc->IndependentBlendEnable = FALSE; + outBlendDesc->RenderTarget[0].BlendEnable = TRUE; + outBlendDesc->RenderTarget[0].SrcBlend = GetBlendFunc(srcColorFactor); + outBlendDesc->RenderTarget[0].DestBlend = GetBlendFunc(dstColorFactor); + outBlendDesc->RenderTarget[0].BlendOp = GetBlendEquation(colorOperation); + outBlendDesc->RenderTarget[0].SrcBlendAlpha = GetBlendFunc(srcAlphaFactor); + outBlendDesc->RenderTarget[0].DestBlendAlpha = GetBlendFunc(dstAlphaFactor); + outBlendDesc->RenderTarget[0].BlendOpAlpha = GetBlendEquation(alphaOperation); + outBlendDesc->RenderTarget[0].RenderTargetWriteMask = D3D12_COLOR_WRITE_ENABLE_ALL; +} + +static D3D12_PipelineState * +D3D12_CreatePipelineState(SDL_Renderer * renderer, + D3D12_Shader shader, + SDL_BlendMode blendMode, + D3D12_PRIMITIVE_TOPOLOGY_TYPE topology, + DXGI_FORMAT rtvFormat + ) +{ + const D3D12_INPUT_ELEMENT_DESC vertexDesc[] = { + { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 8, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "COLOR", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, 16, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + }; + D3D12_RenderData* data = (D3D12_RenderData*)renderer->driverdata; + D3D12_GRAPHICS_PIPELINE_STATE_DESC pipelineDesc; + ID3D12PipelineState* pipelineState = NULL; + D3D12_PipelineState* pipelineStates; + HRESULT result = S_OK; + + SDL_zero(pipelineDesc); + pipelineDesc.pRootSignature = data->rootSignatures[D3D12_GetRootSignatureType(shader)]; + D3D12_GetVertexShader(shader, &pipelineDesc.VS); + D3D12_GetPixelShader(shader, &pipelineDesc.PS); + D3D12_CreateBlendState(renderer, blendMode, &pipelineDesc.BlendState); + pipelineDesc.SampleMask = 0xffffffff; + + pipelineDesc.RasterizerState.AntialiasedLineEnable = FALSE; + pipelineDesc.RasterizerState.CullMode = D3D12_CULL_MODE_NONE; + pipelineDesc.RasterizerState.DepthBias = 0; + pipelineDesc.RasterizerState.DepthBiasClamp = 0.0f; + pipelineDesc.RasterizerState.DepthClipEnable = TRUE; + pipelineDesc.RasterizerState.FillMode = D3D12_FILL_MODE_SOLID; + pipelineDesc.RasterizerState.FrontCounterClockwise = FALSE; + pipelineDesc.RasterizerState.MultisampleEnable = FALSE; + pipelineDesc.RasterizerState.SlopeScaledDepthBias = 0.0f; + + pipelineDesc.InputLayout.pInputElementDescs = vertexDesc; + pipelineDesc.InputLayout.NumElements = 3; + + pipelineDesc.PrimitiveTopologyType = topology; + + pipelineDesc.NumRenderTargets = 1; + pipelineDesc.RTVFormats[0] = rtvFormat; + pipelineDesc.SampleDesc.Count = 1; + pipelineDesc.SampleDesc.Quality = 0; + + result = D3D_CALL(data->d3dDevice, CreateGraphicsPipelineState, + &pipelineDesc, + D3D_GUID(SDL_IID_ID3D12PipelineState), + (void **)&pipelineState + ); + if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Device::CreateGraphicsPipelineState"), result); + return NULL; + } + + pipelineStates = (D3D12_PipelineState*)SDL_realloc(data->pipelineStates, (data->pipelineStateCount + 1) * sizeof(*pipelineStates)); + if (!pipelineStates) { + SAFE_RELEASE(pipelineState); + SDL_OutOfMemory(); + return NULL; + } + + pipelineStates[data->pipelineStateCount].shader = shader; + pipelineStates[data->pipelineStateCount].blendMode = blendMode; + pipelineStates[data->pipelineStateCount].topology = topology; + pipelineStates[data->pipelineStateCount].rtvFormat = rtvFormat; + pipelineStates[data->pipelineStateCount].pipelineState = pipelineState; + data->pipelineStates = pipelineStates; + ++data->pipelineStateCount; + + return &pipelineStates[data->pipelineStateCount - 1]; +} + +static HRESULT +D3D12_CreateVertexBuffer(D3D12_RenderData *data, size_t vbidx, size_t size) +{ + D3D12_HEAP_PROPERTIES vbufferHeapProps; + D3D12_RESOURCE_DESC vbufferDesc; + HRESULT result; + + SAFE_RELEASE(data->vertexBuffers[vbidx].resource); + + SDL_zero(vbufferHeapProps); + vbufferHeapProps.Type = D3D12_HEAP_TYPE_UPLOAD; + vbufferHeapProps.CreationNodeMask = 1; + vbufferHeapProps.VisibleNodeMask = 1; + + SDL_zero(vbufferDesc); + vbufferDesc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER; + vbufferDesc.Alignment = D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT; + vbufferDesc.Width = size; + vbufferDesc.Height = 1; + vbufferDesc.DepthOrArraySize = 1; + vbufferDesc.MipLevels = 1; + vbufferDesc.Format = DXGI_FORMAT_UNKNOWN; + vbufferDesc.SampleDesc.Count = 1; + vbufferDesc.SampleDesc.Quality = 0; + vbufferDesc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR; + vbufferDesc.Flags = D3D12_RESOURCE_FLAG_NONE; + + result = D3D_CALL(data->d3dDevice, CreateCommittedResource, + &vbufferHeapProps, + D3D12_HEAP_FLAG_NONE, + &vbufferDesc, + D3D12_RESOURCE_STATE_GENERIC_READ, + NULL, + D3D_GUID(SDL_IID_ID3D12Resource), + (void **) &data->vertexBuffers[vbidx].resource + ); + + if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Device::CreatePlacedResource [vertex buffer]"), result); + return result; + } + + data->vertexBuffers[vbidx].view.BufferLocation = D3D_CALL(data->vertexBuffers[vbidx].resource, GetGPUVirtualAddress); + data->vertexBuffers[vbidx].view.StrideInBytes = sizeof(VertexPositionColor); + data->vertexBuffers[vbidx].size = size; + + return result; +} + +/* Create resources that depend on the device. */ +static HRESULT +D3D12_CreateDeviceResources(SDL_Renderer* renderer) +{ +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) + typedef HRESULT(WINAPI* PFN_CREATE_DXGI_FACTORY)(UINT flags, REFIID riid, void** ppFactory); + PFN_CREATE_DXGI_FACTORY CreateDXGIFactoryFunc; + PFN_D3D12_CREATE_DEVICE D3D12CreateDeviceFunc; +#endif + D3D12_RenderData* data = (D3D12_RenderData*)renderer->driverdata; + ID3D12Device* d3dDevice = NULL; + HRESULT result = S_OK; + UINT creationFlags = 0; + int i, j, k, l; + SDL_bool createDebug = SDL_FALSE; + + D3D12_COMMAND_QUEUE_DESC queueDesc; + D3D12_DESCRIPTOR_HEAP_DESC descriptorHeapDesc; + D3D12_SAMPLER_DESC samplerDesc; + ID3D12DescriptorHeap *rootDescriptorHeaps[2]; + + const SDL_BlendMode defaultBlendModes[] = { + SDL_BLENDMODE_NONE, + SDL_BLENDMODE_BLEND, + SDL_BLENDMODE_ADD, + SDL_BLENDMODE_MOD, + SDL_BLENDMODE_MUL + }; + const DXGI_FORMAT defaultRTVFormats[] = { + DXGI_FORMAT_B8G8R8A8_UNORM, + DXGI_FORMAT_B8G8R8X8_UNORM, + DXGI_FORMAT_R8_UNORM + }; + + /* See if we need debug interfaces */ + createDebug = SDL_GetHintBoolean(SDL_HINT_RENDER_DIRECT3D11_DEBUG, SDL_FALSE); + +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) + data->hDXGIMod = SDL_LoadObject("dxgi.dll"); + if (!data->hDXGIMod) { + result = E_FAIL; + goto done; + } + + CreateDXGIFactoryFunc = (PFN_CREATE_DXGI_FACTORY)SDL_LoadFunction(data->hDXGIMod, "CreateDXGIFactory2"); + if (!CreateDXGIFactoryFunc) { + result = E_FAIL; + goto done; + } + + data->hD3D12Mod = SDL_LoadObject("D3D12.dll"); + if (!data->hD3D12Mod) { + result = E_FAIL; + goto done; + } + + D3D12CreateDeviceFunc = (PFN_D3D12_CREATE_DEVICE)SDL_LoadFunction(data->hD3D12Mod, "D3D12CreateDevice"); + if (!D3D12CreateDeviceFunc) { + result = E_FAIL; + goto done; + } + + if (createDebug) { + PFN_D3D12_GET_DEBUG_INTERFACE D3D12GetDebugInterfaceFunc; + + D3D12GetDebugInterfaceFunc = (PFN_D3D12_GET_DEBUG_INTERFACE)SDL_LoadFunction(data->hD3D12Mod, "D3D12GetDebugInterface"); + if (!D3D12GetDebugInterfaceFunc) { + result = E_FAIL; + goto done; + } + D3D12GetDebugInterfaceFunc(D3D_GUID(SDL_IID_ID3D12Debug), (void**)&data->debugInterface); + D3D_CALL(data->debugInterface, EnableDebugLayer); + } +#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ + +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) + result = D3D12_XBOX_CreateDevice(&d3dDevice, createDebug); + if (FAILED(result)) { + /* SDL Error is set by D3D12_XBOX_CreateDevice */ + goto done; + } +#else + if (createDebug) { +#ifdef __IDXGIInfoQueue_INTERFACE_DEFINED__ + IDXGIInfoQueue *dxgiInfoQueue = NULL; + PFN_CREATE_DXGI_FACTORY DXGIGetDebugInterfaceFunc; + + /* If the debug hint is set, also create the DXGI factory in debug mode */ + DXGIGetDebugInterfaceFunc = (PFN_CREATE_DXGI_FACTORY)SDL_LoadFunction(data->hDXGIMod, "DXGIGetDebugInterface1"); + if (!DXGIGetDebugInterfaceFunc) { + result = E_FAIL; + goto done; + } + + result = DXGIGetDebugInterfaceFunc(0, D3D_GUID(SDL_IID_IDXGIDebug1), (void **)&data->dxgiDebug); + if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("DXGIGetDebugInterface1"), result); + goto done; + } + + result = DXGIGetDebugInterfaceFunc(0, D3D_GUID(SDL_IID_IDXGIInfoQueue), (void **)&dxgiInfoQueue); + if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("DXGIGetDebugInterface1"), result); + goto done; + } + + D3D_CALL(dxgiInfoQueue, SetBreakOnSeverity, SDL_DXGI_DEBUG_ALL, DXGI_INFO_QUEUE_MESSAGE_SEVERITY_ERROR, TRUE); + D3D_CALL(dxgiInfoQueue, SetBreakOnSeverity, SDL_DXGI_DEBUG_ALL, DXGI_INFO_QUEUE_MESSAGE_SEVERITY_CORRUPTION, TRUE); + SAFE_RELEASE(dxgiInfoQueue); +#endif /* __IDXGIInfoQueue_INTERFACE_DEFINED__ */ + creationFlags = DXGI_CREATE_FACTORY_DEBUG; + } + + result = CreateDXGIFactoryFunc(creationFlags, D3D_GUID(SDL_IID_IDXGIFactory6), (void**)&data->dxgiFactory); + if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("CreateDXGIFactory"), result); + goto done; + } + + /* Prefer a high performance adapter if there are multiple choices */ + result = D3D_CALL(data->dxgiFactory, EnumAdapterByGpuPreference, + 0, + DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE, + D3D_GUID(SDL_IID_IDXGIAdapter4), + (void **)&data->dxgiAdapter + ); + if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("D3D12CreateDevice"), result); + goto done; + } + + result = D3D12CreateDeviceFunc((IUnknown *)data->dxgiAdapter, + D3D_FEATURE_LEVEL_11_0, /* Request minimum feature level 11.0 for maximum compatibility */ + D3D_GUID(SDL_IID_ID3D12Device1), + (void **)&d3dDevice + ); + if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("D3D12CreateDevice"), result); + goto done; + } + + /* Setup the info queue if in debug mode */ + if (createDebug) { + ID3D12InfoQueue *infoQueue = NULL; + D3D12_MESSAGE_SEVERITY severities[] = { D3D12_MESSAGE_SEVERITY_INFO }; + D3D12_INFO_QUEUE_FILTER filter; + + result = D3D_CALL(d3dDevice, QueryInterface, D3D_GUID(SDL_IID_ID3D12InfoQueue), (void **)&infoQueue); + if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Device to ID3D12InfoQueue"), result); + goto done; + } + + SDL_zero(filter); + filter.DenyList.NumSeverities = 1; + filter.DenyList.pSeverityList = severities; + D3D_CALL(infoQueue, PushStorageFilter, &filter); + + D3D_CALL(infoQueue, SetBreakOnSeverity, D3D12_MESSAGE_SEVERITY_ERROR, TRUE); + D3D_CALL(infoQueue, SetBreakOnSeverity, D3D12_MESSAGE_SEVERITY_CORRUPTION, TRUE); + + SAFE_RELEASE(infoQueue); + } +#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ + + result = D3D_CALL(d3dDevice, QueryInterface, D3D_GUID(SDL_IID_ID3D12Device1), (void **)&data->d3dDevice); + if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Device to ID3D12Device1"), result); + goto done; + } + + /* Create a command queue */ + SDL_zero(queueDesc); + queueDesc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE; + queueDesc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT; + + result = D3D_CALL(data->d3dDevice, CreateCommandQueue, + &queueDesc, + D3D_GUID(SDL_IID_ID3D12CommandQueue), + (void **)&data->commandQueue + ); + if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Device::CreateCommandQueue"), result); + goto done; + } + + /* Create the descriptor heaps for the render target view, texture SRVs, and samplers */ + SDL_zero(descriptorHeapDesc); + descriptorHeapDesc.NumDescriptors = SDL_D3D12_NUM_BUFFERS; + descriptorHeapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_RTV; + result = D3D_CALL(data->d3dDevice, CreateDescriptorHeap, + &descriptorHeapDesc, + D3D_GUID(SDL_IID_ID3D12DescriptorHeap), + (void **)&data->rtvDescriptorHeap + ); + if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Device::CreateDescriptorHeap [rtv]"), result); + goto done; + } + data->rtvDescriptorSize = D3D_CALL(d3dDevice, GetDescriptorHandleIncrementSize, D3D12_DESCRIPTOR_HEAP_TYPE_RTV); + + descriptorHeapDesc.NumDescriptors = SDL_D3D12_MAX_NUM_TEXTURES; + result = D3D_CALL(data->d3dDevice, CreateDescriptorHeap, + &descriptorHeapDesc, + D3D_GUID(SDL_IID_ID3D12DescriptorHeap), + (void **)&data->textureRTVDescriptorHeap + ); + if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Device::CreateDescriptorHeap [texture rtv]"), result); + goto done; + } + + SDL_zero(descriptorHeapDesc); + descriptorHeapDesc.NumDescriptors = SDL_D3D12_MAX_NUM_TEXTURES; + descriptorHeapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV; + descriptorHeapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE; + result = D3D_CALL(data->d3dDevice, CreateDescriptorHeap, + &descriptorHeapDesc, + D3D_GUID(SDL_IID_ID3D12DescriptorHeap), + (void **)&data->srvDescriptorHeap + ); + if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Device::CreateDescriptorHeap [srv]"), result); + goto done; + } + rootDescriptorHeaps[0] = data->srvDescriptorHeap; + data->srvDescriptorSize = D3D_CALL(d3dDevice, GetDescriptorHandleIncrementSize, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV); + + SDL_zero(descriptorHeapDesc); + descriptorHeapDesc.NumDescriptors = 2; + descriptorHeapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER; + descriptorHeapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE; + result = D3D_CALL(data->d3dDevice, CreateDescriptorHeap, + &descriptorHeapDesc, + D3D_GUID(SDL_IID_ID3D12DescriptorHeap), + (void **)&data->samplerDescriptorHeap + ); + if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Device::CreateDescriptorHeap [sampler]"), result); + goto done; + } + rootDescriptorHeaps[1] = data->samplerDescriptorHeap; + data->samplerDescriptorSize = D3D_CALL(d3dDevice, GetDescriptorHandleIncrementSize, D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER); + + /* Create a command allocator for each back buffer */ + for (i = 0; i < SDL_D3D12_NUM_BUFFERS; ++i) { + result = D3D_CALL(data->d3dDevice, CreateCommandAllocator, + D3D12_COMMAND_LIST_TYPE_DIRECT, + D3D_GUID(SDL_IID_ID3D12CommandAllocator), + (void **)&data->commandAllocators[i] + ); + if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Device::CreateCommandAllocator"), result); + goto done; + } + } + + /* Create the command list */ + result = D3D_CALL(data->d3dDevice, CreateCommandList, + 0, + D3D12_COMMAND_LIST_TYPE_DIRECT, + data->commandAllocators[0], + NULL, + D3D_GUID(SDL_IID_ID3D12GraphicsCommandList2), + (void **)&data->commandList + ); + if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Device::CreateCommandList"), result); + goto done; + } + + /* Set the descriptor heaps to the correct initial value */ + D3D_CALL(data->commandList, SetDescriptorHeaps, 2, rootDescriptorHeaps); + + /* Create the fence and fence event */ + result = D3D_CALL(data->d3dDevice, CreateFence, + data->fenceValue, + D3D12_FENCE_FLAG_NONE, + D3D_GUID(SDL_IID_ID3D12Fence), + (void **)&data->fence + ); + if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Device::CreateFence"), result); + goto done; + } + + data->fenceValue++; + + data->fenceEvent = CreateEventEx(NULL, NULL, 0, EVENT_MODIFY_STATE | SYNCHRONIZE); + if (!data->fenceEvent) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("CreateEventEx"), result); + goto done; + } + + /* Create all the root signatures */ + for (i = 0; i < NUM_ROOTSIGS; ++i) { + D3D12_SHADER_BYTECODE rootSigData; + D3D12_GetRootSignatureData((D3D12_RootSignature) i, &rootSigData); + result = D3D_CALL(data->d3dDevice, CreateRootSignature, + 0, + rootSigData.pShaderBytecode, + rootSigData.BytecodeLength, + D3D_GUID(SDL_IID_ID3D12RootSignature), + (void **)&data->rootSignatures[i] + ); + if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Device::CreateRootSignature"), result); + goto done; + } + } + + /* Create all the default pipeline state objects + (will add everything except custom blend states) */ + for (i = 0; i < NUM_SHADERS; ++i) { + for (j = 0; j < SDL_arraysize(defaultBlendModes); ++j) { + for (k = D3D12_PRIMITIVE_TOPOLOGY_TYPE_POINT; k < D3D12_PRIMITIVE_TOPOLOGY_TYPE_PATCH; ++k) { + for (l = 0; l < SDL_arraysize(defaultRTVFormats); ++l) { + if (!D3D12_CreatePipelineState(renderer, (D3D12_Shader) i, defaultBlendModes[j], (D3D12_PRIMITIVE_TOPOLOGY_TYPE) k, defaultRTVFormats[l])) { + /* D3D12_CreatePipelineState will set the SDL error, if it fails */ + goto done; + } + } + } + } + } + + /* Create default vertex buffers */ + for (i = 0; i < SDL_D3D12_NUM_VERTEX_BUFFERS; ++i) { + D3D12_CreateVertexBuffer(data, i, D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT); + } + + /* Create samplers to use when drawing textures: */ + SDL_zero(samplerDesc); + samplerDesc.Filter = D3D12_FILTER_MIN_MAG_MIP_POINT; + samplerDesc.AddressU = D3D12_TEXTURE_ADDRESS_MODE_CLAMP; + samplerDesc.AddressV = D3D12_TEXTURE_ADDRESS_MODE_CLAMP; + samplerDesc.AddressW = D3D12_TEXTURE_ADDRESS_MODE_CLAMP; + samplerDesc.MipLODBias = 0.0f; + samplerDesc.MaxAnisotropy = 1; + samplerDesc.ComparisonFunc = D3D12_COMPARISON_FUNC_ALWAYS; + samplerDesc.MinLOD = 0.0f; + samplerDesc.MaxLOD = D3D12_FLOAT32_MAX; + D3D_CALL_RET(data->samplerDescriptorHeap, GetCPUDescriptorHandleForHeapStart, &data->nearestPixelSampler); + D3D_CALL(data->d3dDevice, CreateSampler, &samplerDesc, data->nearestPixelSampler); + + samplerDesc.Filter = D3D12_FILTER_MIN_MAG_MIP_LINEAR; + data->linearSampler.ptr = data->nearestPixelSampler.ptr + data->samplerDescriptorSize; + D3D_CALL(data->d3dDevice, CreateSampler, &samplerDesc, data->linearSampler); + + /* Initialize the pool allocator for SRVs */ + for (i = 0; i < SDL_D3D12_MAX_NUM_TEXTURES; ++i) { + data->srvPoolNodes[i].index = (SIZE_T)i; + if (i != SDL_D3D12_MAX_NUM_TEXTURES - 1) { + data->srvPoolNodes[i].next = &data->srvPoolNodes[i + 1]; + } + } + data->srvPoolHead = &data->srvPoolNodes[0]; +done: + SAFE_RELEASE(d3dDevice); + return result; +} + +static DXGI_MODE_ROTATION +D3D12_GetCurrentRotation() +{ + /* FIXME */ + return DXGI_MODE_ROTATION_IDENTITY; +} + +static BOOL +D3D12_IsDisplayRotated90Degrees(DXGI_MODE_ROTATION rotation) +{ + switch (rotation) { + case DXGI_MODE_ROTATION_ROTATE90: + case DXGI_MODE_ROTATION_ROTATE270: + return TRUE; + default: + return FALSE; + } +} + +static int +D3D12_GetRotationForCurrentRenderTarget(SDL_Renderer * renderer) +{ + D3D12_RenderData *data = (D3D12_RenderData *)renderer->driverdata; + if (data->textureRenderTarget) { + return DXGI_MODE_ROTATION_IDENTITY; + } else { + return data->rotation; + } +} + +static int +D3D12_GetViewportAlignedD3DRect(SDL_Renderer * renderer, const SDL_Rect * sdlRect, D3D12_RECT * outRect, BOOL includeViewportOffset) +{ + D3D12_RenderData *data = (D3D12_RenderData *) renderer->driverdata; + const int rotation = D3D12_GetRotationForCurrentRenderTarget(renderer); + const SDL_Rect *viewport = &data->currentViewport; + + switch (rotation) { + case DXGI_MODE_ROTATION_IDENTITY: + outRect->left = sdlRect->x; + outRect->right = sdlRect->x + sdlRect->w; + outRect->top = sdlRect->y; + outRect->bottom = sdlRect->y + sdlRect->h; + if (includeViewportOffset) { + outRect->left += viewport->x; + outRect->right += viewport->x; + outRect->top += viewport->y; + outRect->bottom += viewport->y; + } + break; + case DXGI_MODE_ROTATION_ROTATE270: + outRect->left = sdlRect->y; + outRect->right = sdlRect->y + sdlRect->h; + outRect->top = viewport->w - sdlRect->x - sdlRect->w; + outRect->bottom = viewport->w - sdlRect->x; + break; + case DXGI_MODE_ROTATION_ROTATE180: + outRect->left = viewport->w - sdlRect->x - sdlRect->w; + outRect->right = viewport->w - sdlRect->x; + outRect->top = viewport->h - sdlRect->y - sdlRect->h; + outRect->bottom = viewport->h - sdlRect->y; + break; + case DXGI_MODE_ROTATION_ROTATE90: + outRect->left = viewport->h - sdlRect->y - sdlRect->h; + outRect->right = viewport->h - sdlRect->y; + outRect->top = sdlRect->x; + outRect->bottom = sdlRect->x + sdlRect->h; + break; + default: + return SDL_SetError("The physical display is in an unknown or unsupported rotation"); + } + return 0; +} + +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) +static HRESULT +D3D12_CreateSwapChain(SDL_Renderer * renderer, int w, int h) +{ + D3D12_RenderData *data = (D3D12_RenderData *)renderer->driverdata; + IDXGISwapChain1* swapChain; + HRESULT result = S_OK; + SDL_SysWMinfo windowinfo; + + /* Create a swap chain using the same adapter as the existing Direct3D device. */ + DXGI_SWAP_CHAIN_DESC1 swapChainDesc; + SDL_zero(swapChainDesc); + swapChainDesc.Width = w; + swapChainDesc.Height = h; + swapChainDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; /* This is the most common swap chain format. */ + swapChainDesc.Stereo = FALSE; + swapChainDesc.SampleDesc.Count = 1; /* Don't use multi-sampling. */ + swapChainDesc.SampleDesc.Quality = 0; + swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; + swapChainDesc.BufferCount = 2; /* Use double-buffering to minimize latency. */ + if (WIN_IsWindows8OrGreater()) { + swapChainDesc.Scaling = DXGI_SCALING_NONE; + } else { + swapChainDesc.Scaling = DXGI_SCALING_STRETCH; + } + swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; /* All Windows Store apps must use this SwapEffect. */ + swapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT | /* To support SetMaximumFrameLatency */ + DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING; /* To support presenting with allow tearing on */ + + SDL_VERSION(&windowinfo.version); + SDL_GetWindowWMInfo(renderer->window, &windowinfo); + + result = D3D_CALL(data->dxgiFactory, CreateSwapChainForHwnd, + (IUnknown *)data->commandQueue, + windowinfo.info.win.window, + &swapChainDesc, + NULL, + NULL, /* Allow on all displays. */ + &swapChain + ); + if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGIFactory2::CreateSwapChainForHwnd"), result); + goto done; + } + + D3D_CALL(data->dxgiFactory, MakeWindowAssociation, windowinfo.info.win.window, DXGI_MWA_NO_WINDOW_CHANGES); + + result = D3D_CALL(swapChain, QueryInterface, D3D_GUID(SDL_IID_IDXGISwapChain4), (void **)&data->swapChain); + if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGISwapChain1::QueryInterface"), result); + goto done; + } + + /* Ensure that the swapchain does not queue more than one frame at a time. This both reduces latency + * and ensures that the application will only render after each VSync, minimizing power consumption. + */ + result = D3D_CALL(data->swapChain, SetMaximumFrameLatency, 1); + if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGISwapChain4::SetMaximumFrameLatency"), result); + goto done; + } + + data->swapEffect = swapChainDesc.SwapEffect; + +done: + SAFE_RELEASE(swapChain); + return result; +} +#endif + +static HRESULT D3D12_UpdateForWindowSizeChange(SDL_Renderer * renderer); + + +HRESULT +D3D12_HandleDeviceLost(SDL_Renderer * renderer) +{ + HRESULT result = S_OK; + + D3D12_ReleaseAll(renderer); + + result = D3D12_CreateDeviceResources(renderer); + if (FAILED(result)) { + /* D3D12_CreateDeviceResources will set the SDL error */ + return result; + } + + result = D3D12_UpdateForWindowSizeChange(renderer); + if (FAILED(result)) { + /* D3D12_UpdateForWindowSizeChange will set the SDL error */ + return result; + } + + /* Let the application know that the device has been reset */ + { + SDL_Event event; + event.type = SDL_RENDER_DEVICE_RESET; + SDL_PushEvent(&event); + } + + return S_OK; +} + +/* Initialize all resources that change when the window's size changes. */ +static HRESULT +D3D12_CreateWindowSizeDependentResources(SDL_Renderer * renderer) +{ + D3D12_RenderData *data = (D3D12_RenderData *)renderer->driverdata; + HRESULT result = S_OK; + int i, w, h; + + D3D12_RENDER_TARGET_VIEW_DESC rtvDesc; + D3D12_CPU_DESCRIPTOR_HANDLE rtvDescriptor; + + /* Release render targets */ + for (i = 0; i < SDL_D3D12_NUM_BUFFERS; ++i) { + SAFE_RELEASE(data->renderTargets[i]); + } + /* The width and height of the swap chain must be based on the display's + * non-rotated size. + */ + WIN_GetDrawableSize(renderer->window, &w, &h); + data->rotation = D3D12_GetCurrentRotation(); + if (D3D12_IsDisplayRotated90Degrees(data->rotation)) { + int tmp = w; + w = h; + h = tmp; + } + +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) + if (data->swapChain) { + /* If the swap chain already exists, resize it. */ + result = D3D_CALL(data->swapChain, ResizeBuffers, + 0, + w, h, + DXGI_FORMAT_UNKNOWN, + 0 + ); + if (result == DXGI_ERROR_DEVICE_REMOVED) { + /* If the device was removed for any reason, a new device and swap chain will need to be created. */ + D3D12_HandleDeviceLost(renderer); + + /* Everything is set up now. Do not continue execution of this method. HandleDeviceLost will reenter this method + * and correctly set up the new device. + */ + goto done; + } else if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGISwapChain::ResizeBuffers"), result); + goto done; + } + } else { + result = D3D12_CreateSwapChain(renderer, w, h); + if (FAILED(result)) { + goto done; + } + } + + /* Set the proper rotation for the swap chain. */ + if (WIN_IsWindows8OrGreater()) { + if (data->swapEffect == DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL) { + result = D3D_CALL(data->swapChain, SetRotation, data->rotation); + if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGISwapChain4::SetRotation"), result); + goto done; + } + } + } +#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ + + /* Get each back buffer render target and create render target views */ + for (i = 0; i < SDL_D3D12_NUM_BUFFERS; ++i) { +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) + result = D3D12_XBOX_CreateBackBufferTarget(data->d3dDevice, renderer->window->w, renderer->window->h, (void **) &data->renderTargets[i]); + if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("D3D12_XBOX_CreateBackBufferTarget"), result); + goto done; + } +#else + result = D3D_CALL(data->swapChain, GetBuffer, + i, + D3D_GUID(SDL_IID_ID3D12Resource), + (void **) &data->renderTargets[i] + ); + if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGISwapChain4::GetBuffer"), result); + goto done; + } +#endif + + SDL_zero(rtvDesc); + rtvDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; + rtvDesc.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2D; + + SDL_zero(rtvDescriptor); + D3D_CALL_RET(data->rtvDescriptorHeap, GetCPUDescriptorHandleForHeapStart, &rtvDescriptor); + rtvDescriptor.ptr += i * data->rtvDescriptorSize; + D3D_CALL(data->d3dDevice, CreateRenderTargetView, data->renderTargets[i], &rtvDesc, rtvDescriptor); + } + + /* Set back buffer index to current buffer */ +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) + data->currentBackBufferIndex = 0; +#else + data->currentBackBufferIndex = D3D_CALL(data->swapChain, GetCurrentBackBufferIndex); +#endif + + /* Set the swap chain target immediately, so that a target is always set + * even before we get to SetDrawState. Without this it's possible to hit + * null references in places like ReadPixels! + */ + data->currentRenderTargetView = D3D12_GetCurrentRenderTargetView(renderer); + D3D_CALL(data->commandList, OMSetRenderTargets, 1, &data->currentRenderTargetView, FALSE, NULL); + D3D12_TransitionResource(data, + data->renderTargets[data->currentBackBufferIndex], + D3D12_RESOURCE_STATE_PRESENT, + D3D12_RESOURCE_STATE_RENDER_TARGET + ); + + data->viewportDirty = SDL_TRUE; + +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) + D3D12_XBOX_StartFrame(data->d3dDevice, &data->frameToken); +#endif + +done: + return result; +} + +/* This method is called when the window's size changes. */ +static HRESULT +D3D12_UpdateForWindowSizeChange(SDL_Renderer * renderer) +{ + D3D12_RenderData* data = (D3D12_RenderData*)renderer->driverdata; + /* If the GPU has previous work, wait for it to be done first */ + D3D12_WaitForGPU(data); + return D3D12_CreateWindowSizeDependentResources(renderer); +} + +static void +D3D12_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event) +{ + if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED) { + D3D12_UpdateForWindowSizeChange(renderer); + } +} + +static SDL_bool +D3D12_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode) +{ + SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode); + SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode); + SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode); + SDL_BlendFactor dstColorFactor = SDL_GetBlendModeDstColorFactor(blendMode); + SDL_BlendFactor dstAlphaFactor = SDL_GetBlendModeDstAlphaFactor(blendMode); + SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode); + + if (!GetBlendFunc(srcColorFactor) || !GetBlendFunc(srcAlphaFactor) || + !GetBlendEquation(colorOperation) || + !GetBlendFunc(dstColorFactor) || !GetBlendFunc(dstAlphaFactor) || + !GetBlendEquation(alphaOperation)) { + return SDL_FALSE; + } + return SDL_TRUE; +} + +static SIZE_T +D3D12_GetAvailableSRVIndex(SDL_Renderer * renderer) +{ + D3D12_RenderData* rendererData = (D3D12_RenderData*)renderer->driverdata; + if (rendererData->srvPoolHead) { + SIZE_T index = rendererData->srvPoolHead->index; + rendererData->srvPoolHead = (D3D12_SRVPoolNode*)(rendererData->srvPoolHead->next); + return index; + } else { + SDL_SetError("[d3d12] Cannot allocate more than %d textures!", SDL_D3D12_MAX_NUM_TEXTURES); + return SDL_D3D12_MAX_NUM_TEXTURES + 1; + } +} + +static void +D3D12_FreeSRVIndex(SDL_Renderer * renderer, SIZE_T index) +{ + D3D12_RenderData* rendererData = (D3D12_RenderData*)renderer->driverdata; + rendererData->srvPoolNodes[index].next = rendererData->srvPoolHead; + rendererData->srvPoolHead = &rendererData->srvPoolNodes[index]; +} + +static int +D3D12_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) +{ + D3D12_RenderData *rendererData = (D3D12_RenderData *) renderer->driverdata; + D3D12_TextureData *textureData; + HRESULT result; + DXGI_FORMAT textureFormat = SDLPixelFormatToDXGIFormat(texture->format); + D3D12_RESOURCE_DESC textureDesc; + D3D12_HEAP_PROPERTIES heapProps; + D3D12_SHADER_RESOURCE_VIEW_DESC resourceViewDesc; + + if (textureFormat == DXGI_FORMAT_UNKNOWN) { + return SDL_SetError("%s, An unsupported SDL pixel format (0x%x) was specified", + __FUNCTION__, texture->format); + } + + textureData = (D3D12_TextureData*) SDL_calloc(1, sizeof(*textureData)); + if (!textureData) { + SDL_OutOfMemory(); + return -1; + } + textureData->scaleMode = (texture->scaleMode == SDL_ScaleModeNearest) ? D3D12_FILTER_MIN_MAG_MIP_POINT : D3D12_FILTER_MIN_MAG_MIP_LINEAR; + + texture->driverdata = textureData; + textureData->mainTextureFormat = textureFormat; + + SDL_zero(textureDesc); + textureDesc.Width = texture->w; + textureDesc.Height = texture->h; + textureDesc.MipLevels = 1; + textureDesc.DepthOrArraySize = 1; + textureDesc.Format = textureFormat; + textureDesc.SampleDesc.Count = 1; + textureDesc.SampleDesc.Quality = 0; + textureDesc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D; + textureDesc.Flags = D3D12_RESOURCE_FLAG_NONE; + + if (texture->access == SDL_TEXTUREACCESS_TARGET) { + textureDesc.Flags = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET; + } + + SDL_zero(heapProps); + heapProps.Type = D3D12_HEAP_TYPE_DEFAULT; + heapProps.CreationNodeMask = 1; + heapProps.VisibleNodeMask = 1; + + result = D3D_CALL(rendererData->d3dDevice, CreateCommittedResource, + &heapProps, + D3D12_HEAP_FLAG_NONE, + &textureDesc, + D3D12_RESOURCE_STATE_COPY_DEST, + NULL, + D3D_GUID(SDL_IID_ID3D12Resource), + (void **)&textureData->mainTexture + ); + textureData->mainResourceState = D3D12_RESOURCE_STATE_COPY_DEST; + if (FAILED(result)) { + D3D12_DestroyTexture(renderer, texture); + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Device::CreateCommittedResource [texture]"), result); + } +#if SDL_HAVE_YUV + if (texture->format == SDL_PIXELFORMAT_YV12 || + texture->format == SDL_PIXELFORMAT_IYUV) { + textureData->yuv = SDL_TRUE; + + textureDesc.Width = (textureDesc.Width + 1) / 2; + textureDesc.Height = (textureDesc.Height + 1) / 2; + + result = D3D_CALL(rendererData->d3dDevice, CreateCommittedResource, + &heapProps, + D3D12_HEAP_FLAG_NONE, + &textureDesc, + D3D12_RESOURCE_STATE_COPY_DEST, + NULL, + D3D_GUID(SDL_IID_ID3D12Resource), + (void **)&textureData->mainTextureU + ); + textureData->mainResourceStateU = D3D12_RESOURCE_STATE_COPY_DEST; + if (FAILED(result)) { + D3D12_DestroyTexture(renderer, texture); + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Device::CreateCommittedResource [texture]"), result); + } + + result = D3D_CALL(rendererData->d3dDevice, CreateCommittedResource, + &heapProps, + D3D12_HEAP_FLAG_NONE, + &textureDesc, + D3D12_RESOURCE_STATE_COPY_DEST, + NULL, + D3D_GUID(SDL_IID_ID3D12Resource), + (void **)&textureData->mainTextureV + ); + textureData->mainResourceStateV = D3D12_RESOURCE_STATE_COPY_DEST; + if (FAILED(result)) { + D3D12_DestroyTexture(renderer, texture); + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Device::CreateCommittedResource [texture]"), result); + } + } + + if (texture->format == SDL_PIXELFORMAT_NV12 || + texture->format == SDL_PIXELFORMAT_NV21) { + D3D12_RESOURCE_DESC nvTextureDesc = textureDesc; + + textureData->nv12 = SDL_TRUE; + + nvTextureDesc.Format = DXGI_FORMAT_R8G8_UNORM; + nvTextureDesc.Width = (textureDesc.Width + 1) / 2; + nvTextureDesc.Height = (textureDesc.Height + 1) / 2; + + result = D3D_CALL(rendererData->d3dDevice, CreateCommittedResource, + &heapProps, + D3D12_HEAP_FLAG_NONE, + &nvTextureDesc, + D3D12_RESOURCE_STATE_COPY_DEST, + NULL, + D3D_GUID(SDL_IID_ID3D12Resource), + (void **)&textureData->mainTextureNV + ); + textureData->mainResourceStateNV = D3D12_RESOURCE_STATE_COPY_DEST; + if (FAILED(result)) { + D3D12_DestroyTexture(renderer, texture); + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Device::CreateTexture2D"), result); + } + } +#endif /* SDL_HAVE_YUV */ + SDL_zero(resourceViewDesc); + resourceViewDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING; + resourceViewDesc.Format = textureDesc.Format; + resourceViewDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D; + resourceViewDesc.Texture2D.MostDetailedMip = 0; + resourceViewDesc.Texture2D.MipLevels = textureDesc.MipLevels; + + textureData->mainSRVIndex = D3D12_GetAvailableSRVIndex(renderer); + D3D_CALL_RET(rendererData->srvDescriptorHeap, GetCPUDescriptorHandleForHeapStart, &textureData->mainTextureResourceView); + textureData->mainTextureResourceView.ptr += textureData->mainSRVIndex * rendererData->srvDescriptorSize; + + D3D_CALL(rendererData->d3dDevice, CreateShaderResourceView, + textureData->mainTexture, + &resourceViewDesc, + textureData->mainTextureResourceView + ); +#if SDL_HAVE_YUV + if (textureData->yuv) { + D3D_CALL_RET(rendererData->srvDescriptorHeap, GetCPUDescriptorHandleForHeapStart, &textureData->mainTextureResourceViewU); + textureData->mainSRVIndexU = D3D12_GetAvailableSRVIndex(renderer); + textureData->mainTextureResourceViewU.ptr += textureData->mainSRVIndexU * rendererData->srvDescriptorSize; + D3D_CALL(rendererData->d3dDevice, CreateShaderResourceView, + textureData->mainTextureU, + &resourceViewDesc, + textureData->mainTextureResourceViewU + ); + + D3D_CALL_RET(rendererData->srvDescriptorHeap, GetCPUDescriptorHandleForHeapStart, &textureData->mainTextureResourceViewV); + textureData->mainSRVIndexV = D3D12_GetAvailableSRVIndex(renderer); + textureData->mainTextureResourceViewV.ptr += textureData->mainSRVIndexV * rendererData->srvDescriptorSize; + D3D_CALL(rendererData->d3dDevice, CreateShaderResourceView, + textureData->mainTextureV, + &resourceViewDesc, + textureData->mainTextureResourceViewV + ); + } + + if (textureData->nv12) { + D3D12_SHADER_RESOURCE_VIEW_DESC nvResourceViewDesc = resourceViewDesc; + + nvResourceViewDesc.Format = DXGI_FORMAT_R8G8_UNORM; + + D3D_CALL_RET(rendererData->srvDescriptorHeap, GetCPUDescriptorHandleForHeapStart, &textureData->mainTextureResourceViewNV); + textureData->mainSRVIndexNV = D3D12_GetAvailableSRVIndex(renderer); + textureData->mainTextureResourceViewNV.ptr += textureData->mainSRVIndexNV * rendererData->srvDescriptorSize; + D3D_CALL(rendererData->d3dDevice, CreateShaderResourceView, + textureData->mainTextureNV, + &nvResourceViewDesc, + textureData->mainTextureResourceViewNV + ); + } +#endif /* SDL_HAVE_YUV */ + + if (texture->access & SDL_TEXTUREACCESS_TARGET) { + D3D12_RENDER_TARGET_VIEW_DESC renderTargetViewDesc; + SDL_zero(renderTargetViewDesc); + renderTargetViewDesc.Format = textureDesc.Format; + renderTargetViewDesc.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2D; + renderTargetViewDesc.Texture2D.MipSlice = 0; + + D3D_CALL_RET(rendererData->textureRTVDescriptorHeap, GetCPUDescriptorHandleForHeapStart, &textureData->mainTextureRenderTargetView); + textureData->mainTextureRenderTargetView.ptr += textureData->mainSRVIndex * rendererData->rtvDescriptorSize; + + D3D_CALL(rendererData->d3dDevice, CreateRenderTargetView, + (ID3D12Resource*)textureData->mainTexture, + &renderTargetViewDesc, + textureData->mainTextureRenderTargetView); + } + + return 0; +} + +static void +D3D12_DestroyTexture(SDL_Renderer * renderer, + SDL_Texture * texture) +{ + D3D12_RenderData *rendererData = (D3D12_RenderData*)renderer->driverdata; + D3D12_TextureData *textureData = (D3D12_TextureData *)texture->driverdata; + + if (!textureData) { + return; + } + + /* Because SDL_DestroyTexture might be called while the data is in-flight, we need to issue the batch first + Unfortunately, this means that deleting a lot of textures mid-frame will have poor performance. */ + D3D12_IssueBatch(rendererData); + + SAFE_RELEASE(textureData->mainTexture); + SAFE_RELEASE(textureData->stagingBuffer); + D3D12_FreeSRVIndex(renderer, textureData->mainSRVIndex); +#if SDL_HAVE_YUV + SAFE_RELEASE(textureData->mainTextureU); + SAFE_RELEASE(textureData->mainTextureV); + if (textureData->yuv) { + D3D12_FreeSRVIndex(renderer, textureData->mainSRVIndexU); + D3D12_FreeSRVIndex(renderer, textureData->mainSRVIndexV); + } + SAFE_RELEASE(textureData->mainTextureNV); + if (textureData->yuv) { + D3D12_FreeSRVIndex(renderer, textureData->mainSRVIndexNV); + } + SDL_free(textureData->pixels); +#endif + SDL_free(textureData); + texture->driverdata = NULL; +} + +static int +D3D12_UpdateTextureInternal(D3D12_RenderData * rendererData, ID3D12Resource * texture, int bpp, int x, int y, int w, int h, const void *pixels, int pitch, D3D12_RESOURCE_STATES *resourceState) +{ + const Uint8 *src; + Uint8 *dst; + int row; + UINT length; + HRESULT result; + D3D12_RESOURCE_DESC textureDesc; + D3D12_RESOURCE_DESC uploadDesc; + D3D12_HEAP_PROPERTIES heapProps; + D3D12_SUBRESOURCE_FOOTPRINT pitchedDesc; + D3D12_PLACED_SUBRESOURCE_FOOTPRINT placedTextureDesc; + D3D12_TEXTURE_COPY_LOCATION srcLocation; + D3D12_TEXTURE_COPY_LOCATION dstLocation; + BYTE *textureMemory; + ID3D12Resource *uploadBuffer; + + /* Create an upload buffer, which will be used to write to the main texture. */ + SDL_zero(textureDesc); + D3D_CALL_RET(texture, GetDesc, &textureDesc); + textureDesc.Width = w; + textureDesc.Height = h; + + SDL_zero(uploadDesc); + uploadDesc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER; + uploadDesc.Alignment = D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT; + uploadDesc.Height = 1; + uploadDesc.DepthOrArraySize = 1; + uploadDesc.MipLevels = 1; + uploadDesc.Format = DXGI_FORMAT_UNKNOWN; + uploadDesc.SampleDesc.Count = 1; + uploadDesc.SampleDesc.Quality = 0; + uploadDesc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR; + uploadDesc.Flags = D3D12_RESOURCE_FLAG_NONE; + + /* Figure out how much we need to allocate for the upload buffer */ + D3D_CALL(rendererData->d3dDevice, GetCopyableFootprints, + &textureDesc, + 0, + 1, + 0, + NULL, + NULL, + NULL, + &uploadDesc.Width + ); + + SDL_zero(heapProps); + heapProps.Type = D3D12_HEAP_TYPE_UPLOAD; + heapProps.CreationNodeMask = 1; + heapProps.VisibleNodeMask = 1; + + /* Create the upload buffer */ + result = D3D_CALL(rendererData->d3dDevice, CreateCommittedResource, + &heapProps, + D3D12_HEAP_FLAG_NONE, + &uploadDesc, + D3D12_RESOURCE_STATE_GENERIC_READ, + NULL, + D3D_GUID(SDL_IID_ID3D12Resource), + (void **)&rendererData->uploadBuffers[rendererData->currentUploadBuffer] + ); + if (FAILED(result)) { + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Device::CreateCommittedResource [create upload buffer]"), result); + } + + /* Get a write-only pointer to data in the upload buffer: */ + uploadBuffer = rendererData->uploadBuffers[rendererData->currentUploadBuffer]; + result = D3D_CALL(uploadBuffer, Map, + 0, + NULL, + (void **)&textureMemory + ); + if (FAILED(result)) { + SAFE_RELEASE(rendererData->uploadBuffers[rendererData->currentUploadBuffer]); + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Resource::Map [map staging texture]"), result); + } + + SDL_zero(pitchedDesc); + pitchedDesc.Format = textureDesc.Format; + pitchedDesc.Width = w; + pitchedDesc.Height = h; + pitchedDesc.Depth = 1; + pitchedDesc.RowPitch = D3D12_Align(w * bpp, D3D12_TEXTURE_DATA_PITCH_ALIGNMENT); + + SDL_zero(placedTextureDesc); + placedTextureDesc.Offset = 0; + placedTextureDesc.Footprint = pitchedDesc; + + src = (const Uint8 *)pixels; + dst = textureMemory; + length = w * bpp; + if (length == pitch && length == pitchedDesc.RowPitch) { + SDL_memcpy(dst, src, length*h); + } else { + if (length > (UINT)pitch) { + length = pitch; + } + if (length > pitchedDesc.RowPitch) { + length = pitchedDesc.RowPitch; + } + for (row = 0; row < h; ++row) { + SDL_memcpy(dst, src, length); + src += pitch; + dst += pitchedDesc.RowPitch; + } + } + + /* Commit the changes back to the upload buffer: */ + D3D_CALL(uploadBuffer, Unmap, 0, NULL); + + /* Make sure the destination is in the correct resource state */ + D3D12_TransitionResource(rendererData, texture, *resourceState, D3D12_RESOURCE_STATE_COPY_DEST); + *resourceState = D3D12_RESOURCE_STATE_COPY_DEST; + + SDL_zero(dstLocation); + dstLocation.pResource = texture; + dstLocation.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX; + dstLocation.SubresourceIndex = 0; + + SDL_zero(srcLocation); + srcLocation.pResource = rendererData->uploadBuffers[rendererData->currentUploadBuffer]; + srcLocation.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT; + srcLocation.PlacedFootprint = placedTextureDesc; + + D3D_CALL(rendererData->commandList, CopyTextureRegion, + &dstLocation, + x, + y, + 0, + &srcLocation, + NULL + ); + + /* Transition the texture to be shader accessible */ + D3D12_TransitionResource(rendererData, texture, *resourceState, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE); + *resourceState = D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE; + + rendererData->currentUploadBuffer++; + /* If we've used up all the upload buffers, we need to issue the batch */ + if (rendererData->currentUploadBuffer == SDL_D3D12_NUM_UPLOAD_BUFFERS) { + D3D12_IssueBatch(rendererData); + } + + return 0; +} + +static int +D3D12_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * rect, const void * srcPixels, + int srcPitch) +{ + D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata; + D3D12_TextureData *textureData = (D3D12_TextureData *)texture->driverdata; + + if (!textureData) { + return SDL_SetError("Texture is not currently available"); + } + + if (D3D12_UpdateTextureInternal(rendererData, textureData->mainTexture, SDL_BYTESPERPIXEL(texture->format), rect->x, rect->y, rect->w, rect->h, srcPixels, srcPitch, &textureData->mainResourceState) < 0) { + return -1; + } +#if SDL_HAVE_YUV + if (textureData->yuv) { + /* Skip to the correct offset into the next texture */ + srcPixels = (const void*)((const Uint8*)srcPixels + rect->h * srcPitch); + + if (D3D12_UpdateTextureInternal(rendererData, texture->format == SDL_PIXELFORMAT_YV12 ? textureData->mainTextureV : textureData->mainTextureU, SDL_BYTESPERPIXEL(texture->format), rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, srcPixels, (srcPitch + 1) / 2, texture->format == SDL_PIXELFORMAT_YV12 ? &textureData->mainResourceStateV : &textureData->mainResourceStateU) < 0) { + return -1; + } + + /* Skip to the correct offset into the next texture */ + srcPixels = (const void*)((const Uint8*)srcPixels + ((rect->h + 1) / 2) * ((srcPitch + 1) / 2)); + if (D3D12_UpdateTextureInternal(rendererData, texture->format == SDL_PIXELFORMAT_YV12 ? textureData->mainTextureU : textureData->mainTextureV, SDL_BYTESPERPIXEL(texture->format), rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, srcPixels, (srcPitch + 1) / 2, texture->format == SDL_PIXELFORMAT_YV12 ? &textureData->mainResourceStateU : &textureData->mainResourceStateV) < 0) { + return -1; + } + } + + if (textureData->nv12) { + /* Skip to the correct offset into the next texture */ + srcPixels = (const void*)((const Uint8*)srcPixels + rect->h * srcPitch); + + if (D3D12_UpdateTextureInternal(rendererData, textureData->mainTextureNV, 2, rect->x / 2, rect->y / 2, ((rect->w + 1) / 2), (rect->h + 1) / 2, srcPixels, 2*((srcPitch + 1) / 2), &textureData->mainResourceStateNV) < 0) { + return -1; + } + } +#endif /* SDL_HAVE_YUV */ + return 0; +} + +#if SDL_HAVE_YUV +static int +D3D12_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * rect, + const Uint8 *Yplane, int Ypitch, + const Uint8 *Uplane, int Upitch, + const Uint8 *Vplane, int Vpitch) +{ + D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata; + D3D12_TextureData *textureData = (D3D12_TextureData *)texture->driverdata; + + if (!textureData) { + return SDL_SetError("Texture is not currently available"); + } + + if (D3D12_UpdateTextureInternal(rendererData, textureData->mainTexture, SDL_BYTESPERPIXEL(texture->format), rect->x, rect->y, rect->w, rect->h, Yplane, Ypitch, &textureData->mainResourceState) < 0) { + return -1; + } + if (D3D12_UpdateTextureInternal(rendererData, textureData->mainTextureU, SDL_BYTESPERPIXEL(texture->format), rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, Uplane, Upitch, &textureData->mainResourceStateU) < 0) { + return -1; + } + if (D3D12_UpdateTextureInternal(rendererData, textureData->mainTextureV, SDL_BYTESPERPIXEL(texture->format), rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, Vplane, Vpitch, &textureData->mainResourceStateV) < 0) { + return -1; + } + return 0; +} + +static int +D3D12_UpdateTextureNV(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * rect, + const Uint8 *Yplane, int Ypitch, + const Uint8 *UVplane, int UVpitch) +{ + D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata; + D3D12_TextureData *textureData = (D3D12_TextureData *)texture->driverdata; + + if (!textureData) { + return SDL_SetError("Texture is not currently available"); + } + + if (D3D12_UpdateTextureInternal(rendererData, textureData->mainTexture, SDL_BYTESPERPIXEL(texture->format), rect->x, rect->y, rect->w, rect->h, Yplane, Ypitch, &textureData->mainResourceState) < 0) { + return -1; + } + + if (D3D12_UpdateTextureInternal(rendererData, textureData->mainTextureNV, 2, rect->x / 2, rect->y / 2, ((rect->w + 1) / 2), (rect->h + 1) / 2, UVplane, UVpitch, &textureData->mainResourceStateNV) < 0) { + return -1; + } + return 0; +} +#endif + +static int +D3D12_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * rect, void **pixels, int *pitch) +{ + D3D12_RenderData *rendererData = (D3D12_RenderData *) renderer->driverdata; + D3D12_TextureData *textureData = (D3D12_TextureData *) texture->driverdata; + HRESULT result = S_OK; + + D3D12_RESOURCE_DESC textureDesc; + D3D12_RESOURCE_DESC uploadDesc; + D3D12_HEAP_PROPERTIES heapProps; + D3D12_SUBRESOURCE_FOOTPRINT pitchedDesc; + BYTE *textureMemory; + int bpp; + + if (!textureData) { + return SDL_SetError("Texture is not currently available"); + } +#if SDL_HAVE_YUV + if (textureData->yuv || textureData->nv12) { + /* It's more efficient to upload directly... */ + if (!textureData->pixels) { + textureData->pitch = texture->w; + textureData->pixels = (Uint8 *)SDL_malloc((texture->h * textureData->pitch * 3) / 2); + if (!textureData->pixels) { + return SDL_OutOfMemory(); + } + } + textureData->lockedRect = *rect; + *pixels = + (void *)((Uint8 *)textureData->pixels + rect->y * textureData->pitch + + rect->x * SDL_BYTESPERPIXEL(texture->format)); + *pitch = textureData->pitch; + return 0; + } +#endif + if (textureData->stagingBuffer) { + return SDL_SetError("texture is already locked"); + } + + /* Create an upload buffer, which will be used to write to the main texture. */ + SDL_zero(textureDesc); + D3D_CALL_RET(textureData->mainTexture, GetDesc, &textureDesc); + textureDesc.Width = rect->w; + textureDesc.Height = rect->h; + + SDL_zero(uploadDesc); + uploadDesc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER; + uploadDesc.Alignment = D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT; + uploadDesc.Height = 1; + uploadDesc.DepthOrArraySize = 1; + uploadDesc.MipLevels = 1; + uploadDesc.Format = DXGI_FORMAT_UNKNOWN; + uploadDesc.SampleDesc.Count = 1; + uploadDesc.SampleDesc.Quality = 0; + uploadDesc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR; + uploadDesc.Flags = D3D12_RESOURCE_FLAG_NONE; + + /* Figure out how much we need to allocate for the upload buffer */ + D3D_CALL(rendererData->d3dDevice, GetCopyableFootprints, + &textureDesc, + 0, + 1, + 0, + NULL, + NULL, + NULL, + &uploadDesc.Width + ); + + SDL_zero(heapProps); + heapProps.Type = D3D12_HEAP_TYPE_UPLOAD; + heapProps.CreationNodeMask = 1; + heapProps.VisibleNodeMask = 1; + + /* Create the upload buffer */ + result = D3D_CALL(rendererData->d3dDevice, CreateCommittedResource, + &heapProps, + D3D12_HEAP_FLAG_NONE, + &uploadDesc, + D3D12_RESOURCE_STATE_GENERIC_READ, + NULL, + D3D_GUID(SDL_IID_ID3D12Resource), + (void **)&textureData->stagingBuffer + ); + if (FAILED(result)) { + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Device::CreateCommittedResource [create upload buffer]"), result); + } + + /* Get a write-only pointer to data in the upload buffer: */ + result = D3D_CALL(textureData->stagingBuffer, Map, + 0, + NULL, + (void **)&textureMemory + ); + if (FAILED(result)) { + SAFE_RELEASE(rendererData->uploadBuffers[rendererData->currentUploadBuffer]); + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Resource::Map [map staging texture]"), result); + } + + SDL_zero(pitchedDesc); + pitchedDesc.Format = textureDesc.Format; + pitchedDesc.Width = rect->w; + pitchedDesc.Height = rect->h; + pitchedDesc.Depth = 1; + if (pitchedDesc.Format == DXGI_FORMAT_R8_UNORM) { + bpp = 1; + } + else { + bpp = 4; + } + pitchedDesc.RowPitch = D3D12_Align(rect->w * bpp, D3D12_TEXTURE_DATA_PITCH_ALIGNMENT); + + /* Make note of where the staging texture will be written to + * (on a call to SDL_UnlockTexture): + */ + textureData->lockedRect = *rect; + + /* Make sure the caller has information on the texture's pixel buffer, + * then return: + */ + *pixels = textureMemory; + *pitch = pitchedDesc.RowPitch; + return 0; +} + +static void +D3D12_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) +{ + D3D12_RenderData *rendererData = (D3D12_RenderData *) renderer->driverdata; + D3D12_TextureData *textureData = (D3D12_TextureData *) texture->driverdata; + + D3D12_RESOURCE_DESC textureDesc; + D3D12_SUBRESOURCE_FOOTPRINT pitchedDesc; + D3D12_PLACED_SUBRESOURCE_FOOTPRINT placedTextureDesc; + D3D12_TEXTURE_COPY_LOCATION srcLocation; + D3D12_TEXTURE_COPY_LOCATION dstLocation; + int bpp; + + if (!textureData) { + return; + } +#if SDL_HAVE_YUV + if (textureData->yuv || textureData->nv12) { + const SDL_Rect *rect = &textureData->lockedRect; + void *pixels = + (void *) ((Uint8 *) textureData->pixels + rect->y * textureData->pitch + + rect->x * SDL_BYTESPERPIXEL(texture->format)); + D3D12_UpdateTexture(renderer, texture, rect, pixels, textureData->pitch); + return; + } +#endif + /* Commit the pixel buffer's changes back to the staging texture: */ + D3D_CALL(textureData->stagingBuffer, Unmap, 0, NULL); + + SDL_zero(textureDesc); + D3D_CALL_RET(textureData->mainTexture, GetDesc, &textureDesc); + textureDesc.Width = textureData->lockedRect.w; + textureDesc.Height = textureData->lockedRect.h; + + SDL_zero(pitchedDesc); + pitchedDesc.Format = textureDesc.Format; + pitchedDesc.Width = (UINT)textureDesc.Width; + pitchedDesc.Height = textureDesc.Height; + pitchedDesc.Depth = 1; + if (pitchedDesc.Format == DXGI_FORMAT_R8_UNORM) { + bpp = 1; + } + else { + bpp = 4; + } + pitchedDesc.RowPitch = D3D12_Align(textureData->lockedRect.w * bpp, D3D12_TEXTURE_DATA_PITCH_ALIGNMENT); + + SDL_zero(placedTextureDesc); + placedTextureDesc.Offset = 0; + placedTextureDesc.Footprint = pitchedDesc; + + D3D12_TransitionResource(rendererData, textureData->mainTexture, textureData->mainResourceState, D3D12_RESOURCE_STATE_COPY_DEST); + textureData->mainResourceState = D3D12_RESOURCE_STATE_COPY_DEST; + + SDL_zero(dstLocation); + dstLocation.pResource = textureData->mainTexture; + dstLocation.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX; + dstLocation.SubresourceIndex = 0; + + SDL_zero(srcLocation); + srcLocation.pResource = textureData->stagingBuffer; + srcLocation.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT; + srcLocation.PlacedFootprint = placedTextureDesc; + + D3D_CALL(rendererData->commandList, CopyTextureRegion, + &dstLocation, + textureData->lockedRect.x, + textureData->lockedRect.y, + 0, + &srcLocation, + NULL + ); + + /* Transition the texture to be shader accessible */ + D3D12_TransitionResource(rendererData, textureData->mainTexture, textureData->mainResourceState, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE); + textureData->mainResourceState = D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE; + + /* Execute the command list before releasing the staging buffer */ + D3D12_IssueBatch(rendererData); + SAFE_RELEASE(textureData->stagingBuffer); +} + +static void +D3D12_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture, SDL_ScaleMode scaleMode) +{ + D3D12_TextureData *textureData = (D3D12_TextureData *) texture->driverdata; + + if (!textureData) { + return; + } + + textureData->scaleMode = (scaleMode == SDL_ScaleModeNearest) ? D3D12_FILTER_MIN_MAG_MIP_POINT : D3D12_FILTER_MIN_MAG_MIP_LINEAR; +} + +static int +D3D12_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture) +{ + D3D12_RenderData *rendererData = (D3D12_RenderData *) renderer->driverdata; + D3D12_TextureData *textureData = NULL; + + if (texture == NULL) { + if (rendererData->textureRenderTarget) { + D3D12_TransitionResource(rendererData, + rendererData->textureRenderTarget->mainTexture, + rendererData->textureRenderTarget->mainResourceState, + D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE + ); + rendererData->textureRenderTarget->mainResourceState = D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE; + } + rendererData->textureRenderTarget = NULL; + return 0; + } + + textureData = (D3D12_TextureData *) texture->driverdata; + + if (!textureData->mainTextureRenderTargetView.ptr) { + return SDL_SetError("specified texture is not a render target"); + } + + rendererData->textureRenderTarget = textureData; + D3D12_TransitionResource(rendererData, + rendererData->textureRenderTarget->mainTexture, + rendererData->textureRenderTarget->mainResourceState, + D3D12_RESOURCE_STATE_RENDER_TARGET + ); + rendererData->textureRenderTarget->mainResourceState = D3D12_RESOURCE_STATE_RENDER_TARGET; + + + return 0; +} + +static int +D3D12_QueueSetViewport(SDL_Renderer * renderer, SDL_RenderCommand *cmd) +{ + return 0; /* nothing to do in this backend. */ +} + +static int +D3D12_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FPoint * points, int count) +{ + VertexPositionColor *verts = (VertexPositionColor *) SDL_AllocateRenderVertices(renderer, count * sizeof (VertexPositionColor), 0, &cmd->data.draw.first); + int i; + SDL_Color color; + color.r = cmd->data.draw.r; + color.g = cmd->data.draw.g; + color.b = cmd->data.draw.b; + color.a = cmd->data.draw.a; + + if (!verts) { + return -1; + } + + cmd->data.draw.count = count; + + for (i = 0; i < count; i++) { + verts->pos.x = points[i].x + 0.5f; + verts->pos.y = points[i].y + 0.5f; + verts->tex.x = 0.0f; + verts->tex.y = 0.0f; + verts->color = color; + verts++; + } + + return 0; +} + +static int +D3D12_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *texture, + const float *xy, int xy_stride, const SDL_Color *color, int color_stride, const float *uv, int uv_stride, + int num_vertices, const void *indices, int num_indices, int size_indices, + float scale_x, float scale_y) +{ + int i; + int count = indices ? num_indices : num_vertices; + VertexPositionColor *verts = (VertexPositionColor *) SDL_AllocateRenderVertices(renderer, count * sizeof (VertexPositionColor), 0, &cmd->data.draw.first); + + if (!verts) { + return -1; + } + + cmd->data.draw.count = count; + size_indices = indices ? size_indices : 0; + + for (i = 0; i < count; i++) { + int j; + float *xy_; + if (size_indices == 4) { + j = ((const Uint32 *)indices)[i]; + } else if (size_indices == 2) { + j = ((const Uint16 *)indices)[i]; + } else if (size_indices == 1) { + j = ((const Uint8 *)indices)[i]; + } else { + j = i; + } + + xy_ = (float *)((char*)xy + j * xy_stride); + + verts->pos.x = xy_[0] * scale_x; + verts->pos.y = xy_[1] * scale_y; + verts->color = *(SDL_Color*)((char*)color + j * color_stride); + + if (texture) { + float *uv_ = (float *)((char*)uv + j * uv_stride); + verts->tex.x = uv_[0]; + verts->tex.y = uv_[1]; + } else { + verts->tex.x = 0.0f; + verts->tex.y = 0.0f; + } + + verts += 1; + } + return 0; +} + +static int +D3D12_UpdateVertexBuffer(SDL_Renderer *renderer, + const void * vertexData, size_t dataSizeInBytes) +{ + D3D12_RenderData *rendererData = (D3D12_RenderData *) renderer->driverdata; + HRESULT result = S_OK; + const int vbidx = rendererData->currentVertexBuffer; + UINT8* vertexBufferData = NULL; + D3D12_RANGE range; + ID3D12Resource *vertexBuffer; + + range.Begin = 0; + range.End = 0; + + if (dataSizeInBytes == 0) { + return 0; /* nothing to do. */ + } + + if (rendererData->issueBatch) { + if (FAILED(D3D12_IssueBatch(rendererData))) { + SDL_SetError("Failed to issue intermediate batch"); + return E_FAIL; + } + } + + /* If the existing vertex buffer isn't big enough, we need to recreate a big enough one */ + if (dataSizeInBytes > rendererData->vertexBuffers[vbidx].size) { + D3D12_CreateVertexBuffer(rendererData, vbidx, dataSizeInBytes); + } + + vertexBuffer = rendererData->vertexBuffers[vbidx].resource; + result = D3D_CALL(vertexBuffer, Map, 0, &range, (void **)&vertexBufferData); + if (FAILED(result)) { + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Resource::Map [vertex buffer]"), result); + } + SDL_memcpy(vertexBufferData, vertexData, dataSizeInBytes); + D3D_CALL(vertexBuffer, Unmap, 0, NULL); + + rendererData->vertexBuffers[vbidx].view.SizeInBytes = (UINT)dataSizeInBytes; + + D3D_CALL(rendererData->commandList, IASetVertexBuffers, 0, 1, &rendererData->vertexBuffers[vbidx].view); + + rendererData->currentVertexBuffer++; + if (rendererData->currentVertexBuffer >= SDL_D3D12_NUM_VERTEX_BUFFERS) { + rendererData->currentVertexBuffer = 0; + rendererData->issueBatch = SDL_TRUE; + } + + return S_OK; +} + +static int +D3D12_UpdateViewport(SDL_Renderer * renderer) +{ + D3D12_RenderData *data = (D3D12_RenderData *) renderer->driverdata; + const SDL_Rect *viewport = &data->currentViewport; + Float4X4 projection; + Float4X4 view; + SDL_FRect orientationAlignedViewport; + BOOL swapDimensions; + D3D12_VIEWPORT d3dviewport; + const int rotation = D3D12_GetRotationForCurrentRenderTarget(renderer); + + if (viewport->w == 0 || viewport->h == 0) { + /* If the viewport is empty, assume that it is because + * SDL_CreateRenderer is calling it, and will call it again later + * with a non-empty viewport. + */ + /* SDL_Log("%s, no viewport was set!\n", __FUNCTION__); */ + return -1; + } + + /* Make sure the SDL viewport gets rotated to that of the physical display's rotation. + * Keep in mind here that the Y-axis will be been inverted (from Direct3D's + * default coordinate system) so rotations will be done in the opposite + * direction of the DXGI_MODE_ROTATION enumeration. + */ + switch (rotation) { + case DXGI_MODE_ROTATION_IDENTITY: + projection = MatrixIdentity(); + break; + case DXGI_MODE_ROTATION_ROTATE270: + projection = MatrixRotationZ(SDL_static_cast(float, M_PI * 0.5f)); + break; + case DXGI_MODE_ROTATION_ROTATE180: + projection = MatrixRotationZ(SDL_static_cast(float, M_PI)); + break; + case DXGI_MODE_ROTATION_ROTATE90: + projection = MatrixRotationZ(SDL_static_cast(float, -M_PI * 0.5f)); + break; + default: + return SDL_SetError("An unknown DisplayOrientation is being used"); + } + + /* Update the view matrix */ + SDL_zero(view); + view.m[0][0] = 2.0f / viewport->w; + view.m[1][1] = -2.0f / viewport->h; + view.m[2][2] = 1.0f; + view.m[3][0] = -1.0f; + view.m[3][1] = 1.0f; + view.m[3][3] = 1.0f; + + /* Combine the projection + view matrix together now, as both only get + * set here (as of this writing, on Dec 26, 2013). When done, store it + * for eventual transfer to the GPU. + */ + data->vertexShaderConstantsData.projectionAndView = MatrixMultiply( + view, + projection); + + /* Update the Direct3D viewport, which seems to be aligned to the + * swap buffer's coordinate space, which is always in either + * a landscape mode, for all Windows 8/RT devices, or a portrait mode, + * for Windows Phone devices. + */ + swapDimensions = D3D12_IsDisplayRotated90Degrees((DXGI_MODE_ROTATION) rotation); + if (swapDimensions) { + orientationAlignedViewport.x = (float) viewport->y; + orientationAlignedViewport.y = (float) viewport->x; + orientationAlignedViewport.w = (float) viewport->h; + orientationAlignedViewport.h = (float) viewport->w; + } else { + orientationAlignedViewport.x = (float) viewport->x; + orientationAlignedViewport.y = (float) viewport->y; + orientationAlignedViewport.w = (float) viewport->w; + orientationAlignedViewport.h = (float) viewport->h; + } + + d3dviewport.TopLeftX = orientationAlignedViewport.x; + d3dviewport.TopLeftY = orientationAlignedViewport.y; + d3dviewport.Width = orientationAlignedViewport.w; + d3dviewport.Height = orientationAlignedViewport.h; + d3dviewport.MinDepth = 0.0f; + d3dviewport.MaxDepth = 1.0f; + /* SDL_Log("%s: D3D viewport = {%f,%f,%f,%f}\n", __FUNCTION__, d3dviewport.TopLeftX, d3dviewport.TopLeftY, d3dviewport.Width, d3dviewport.Height); */ + D3D_CALL(data->commandList, RSSetViewports, 1, &d3dviewport); + + data->viewportDirty = SDL_FALSE; + + return 0; +} + +static int +D3D12_SetDrawState(SDL_Renderer * renderer, const SDL_RenderCommand *cmd, D3D12_Shader shader, + D3D12_PRIMITIVE_TOPOLOGY_TYPE topology, + const int numShaderResources, D3D12_CPU_DESCRIPTOR_HANDLE * shaderResources, + D3D12_CPU_DESCRIPTOR_HANDLE * sampler, const Float4X4 *matrix) + +{ + D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata; + const Float4X4 *newmatrix = matrix ? matrix : &rendererData->identity; + D3D12_CPU_DESCRIPTOR_HANDLE renderTargetView = D3D12_GetCurrentRenderTargetView(renderer); + const SDL_BlendMode blendMode = cmd->data.draw.blend; + SDL_bool updateSubresource = SDL_FALSE; + int i; + D3D12_CPU_DESCRIPTOR_HANDLE firstShaderResource; + DXGI_FORMAT rtvFormat = DXGI_FORMAT_B8G8R8A8_UNORM; + + if (rendererData->textureRenderTarget) { + rtvFormat = rendererData->textureRenderTarget->mainTextureFormat; + } + + /* See if we need to change the pipeline state */ + if (!rendererData->currentPipelineState || + rendererData->currentPipelineState->shader != shader || + rendererData->currentPipelineState->blendMode != blendMode || + rendererData->currentPipelineState->topology != topology || + rendererData->currentPipelineState->rtvFormat != rtvFormat) { + + /* Find the matching pipeline. + NOTE: Although it may seem inefficient to linearly search through ~450 pipelines + to find the correct one, in profiling this doesn't come up at all. + It's unlikely that using a hash table would affect performance a measurable amount unless + it's a degenerate case that's chaning the pipline state dozens of times per frame. + */ + rendererData->currentPipelineState = NULL; + for (i = 0; i < rendererData->pipelineStateCount; ++i) { + D3D12_PipelineState* candidatePiplineState = &rendererData->pipelineStates[i]; + if (candidatePiplineState->shader == shader && + candidatePiplineState->blendMode == blendMode && + candidatePiplineState->topology == topology && + candidatePiplineState->rtvFormat == rtvFormat) { + rendererData->currentPipelineState = candidatePiplineState; + break; + } + } + + /* If we didn't find a match, create a new one -- it must mean the blend mode is non-standard */ + if (!rendererData->currentPipelineState) { + rendererData->currentPipelineState = D3D12_CreatePipelineState(renderer, shader, blendMode, topology, rtvFormat); + } + + if (!rendererData->currentPipelineState) { + return SDL_SetError("[direct3d12] Unable to create required pipeline state"); + } + + D3D_CALL(rendererData->commandList, SetPipelineState, rendererData->currentPipelineState->pipelineState); + D3D_CALL(rendererData->commandList, SetGraphicsRootSignature, + rendererData->rootSignatures[D3D12_GetRootSignatureType(rendererData->currentPipelineState->shader)]); + /* When we change these we will need to re-upload the constant buffer and reset any descriptors */ + updateSubresource = SDL_TRUE; + rendererData->currentSampler.ptr = 0; + rendererData->currentShaderResource.ptr = 0; + } + + if (renderTargetView.ptr != rendererData->currentRenderTargetView.ptr) { + D3D_CALL(rendererData->commandList, OMSetRenderTargets, 1, &renderTargetView, FALSE, NULL); + rendererData->currentRenderTargetView = renderTargetView; + } + + if (rendererData->viewportDirty) { + if (D3D12_UpdateViewport(renderer) == 0) { + /* vertexShaderConstantsData.projectionAndView has changed */ + updateSubresource = SDL_TRUE; + } + } + + if (rendererData->cliprectDirty) { + D3D12_RECT scissorRect; + if (D3D12_GetViewportAlignedD3DRect(renderer, &rendererData->currentCliprect, &scissorRect, TRUE) != 0) { + /* D3D12_GetViewportAlignedD3DRect will have set the SDL error */ + return -1; + } + D3D_CALL(rendererData->commandList, RSSetScissorRects, 1, &scissorRect); + rendererData->cliprectDirty = SDL_FALSE; + } + + if (numShaderResources > 0) { + firstShaderResource = shaderResources[0]; + } else { + firstShaderResource.ptr = 0; + } + if (firstShaderResource.ptr != rendererData->currentShaderResource.ptr) { + for (i = 0; i < numShaderResources; ++i) { + D3D12_GPU_DESCRIPTOR_HANDLE GPUHandle = D3D12_CPUtoGPUHandle(rendererData->srvDescriptorHeap, shaderResources[i]); + D3D_CALL(rendererData->commandList, SetGraphicsRootDescriptorTable, i + 1, GPUHandle); + } + rendererData->currentShaderResource.ptr = firstShaderResource.ptr; + } + + if (sampler && sampler->ptr != rendererData->currentSampler.ptr) { + D3D12_GPU_DESCRIPTOR_HANDLE GPUHandle = D3D12_CPUtoGPUHandle(rendererData->samplerDescriptorHeap, *sampler); + UINT tableIndex = 0; + + /* Figure out the correct sampler descriptor table index based on the type of shader */ + switch (shader) { + case SHADER_RGB: + tableIndex = 2; + break; +#if SDL_HAVE_YUV + case SHADER_YUV_JPEG: + case SHADER_YUV_BT601: + case SHADER_YUV_BT709: + tableIndex = 4; + break; + case SHADER_NV12_JPEG: + case SHADER_NV12_BT601: + case SHADER_NV12_BT709: + case SHADER_NV21_JPEG: + case SHADER_NV21_BT601: + case SHADER_NV21_BT709: + tableIndex = 3; + break; +#endif + default: + return SDL_SetError("[direct3d12] Trying to set a sampler for a shader which doesn't have one"); + break; + } + + D3D_CALL(rendererData->commandList, SetGraphicsRootDescriptorTable, tableIndex, GPUHandle); + rendererData->currentSampler = *sampler; + } + + if (updateSubresource == SDL_TRUE || SDL_memcmp(&rendererData->vertexShaderConstantsData.model, newmatrix, sizeof (*newmatrix)) != 0) { + SDL_memcpy(&rendererData->vertexShaderConstantsData.model, newmatrix, sizeof (*newmatrix)); + D3D_CALL(rendererData->commandList, SetGraphicsRoot32BitConstants, + 0, + 32, + &rendererData->vertexShaderConstantsData, + 0 + ); + } + + return 0; +} + +static int +D3D12_SetCopyState(SDL_Renderer * renderer, const SDL_RenderCommand *cmd, const Float4X4 *matrix) +{ + SDL_Texture *texture = cmd->data.draw.texture; + D3D12_RenderData *rendererData = (D3D12_RenderData *) renderer->driverdata; + D3D12_TextureData *textureData = (D3D12_TextureData *) texture->driverdata; + D3D12_CPU_DESCRIPTOR_HANDLE *textureSampler; + + switch (textureData->scaleMode) { + case D3D12_FILTER_MIN_MAG_MIP_POINT: + textureSampler = &rendererData->nearestPixelSampler; + break; + case D3D12_FILTER_MIN_MAG_MIP_LINEAR: + textureSampler = &rendererData->linearSampler; + break; + default: + return SDL_SetError("Unknown scale mode: %d\n", textureData->scaleMode); + } +#if SDL_HAVE_YUV + if (textureData->yuv) { + D3D12_CPU_DESCRIPTOR_HANDLE shaderResources[] = { + textureData->mainTextureResourceView, + textureData->mainTextureResourceViewU, + textureData->mainTextureResourceViewV + }; + D3D12_Shader shader; + + switch (SDL_GetYUVConversionModeForResolution(texture->w, texture->h)) { + case SDL_YUV_CONVERSION_JPEG: + shader = SHADER_YUV_JPEG; + break; + case SDL_YUV_CONVERSION_BT601: + shader = SHADER_YUV_BT601; + break; + case SDL_YUV_CONVERSION_BT709: + shader = SHADER_YUV_BT709; + break; + default: + return SDL_SetError("Unsupported YUV conversion mode"); + } + + /* Make sure each texture is in the correct state to be accessed by the pixel shader. */ + D3D12_TransitionResource(rendererData, textureData->mainTexture, textureData->mainResourceState, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE); + textureData->mainResourceState = D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE; + D3D12_TransitionResource(rendererData, textureData->mainTextureU, textureData->mainResourceStateU, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE); + textureData->mainResourceStateU = D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE; + D3D12_TransitionResource(rendererData, textureData->mainTextureV, textureData->mainResourceStateV, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE); + textureData->mainResourceStateV = D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE; + + return D3D12_SetDrawState(renderer, cmd, shader, D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE, + SDL_arraysize(shaderResources), shaderResources, textureSampler, matrix); + } else if (textureData->nv12) { + D3D12_CPU_DESCRIPTOR_HANDLE shaderResources[] = { + textureData->mainTextureResourceView, + textureData->mainTextureResourceViewNV, + }; + D3D12_Shader shader; + + switch (SDL_GetYUVConversionModeForResolution(texture->w, texture->h)) { + case SDL_YUV_CONVERSION_JPEG: + shader = texture->format == SDL_PIXELFORMAT_NV12 ? SHADER_NV12_JPEG : SHADER_NV21_JPEG; + break; + case SDL_YUV_CONVERSION_BT601: + shader = texture->format == SDL_PIXELFORMAT_NV12 ? SHADER_NV12_BT601 : SHADER_NV21_BT601; + break; + case SDL_YUV_CONVERSION_BT709: + shader = texture->format == SDL_PIXELFORMAT_NV12 ? SHADER_NV12_BT709 : SHADER_NV21_BT709; + break; + default: + return SDL_SetError("Unsupported YUV conversion mode"); + } + + /* Make sure each texture is in the correct state to be accessed by the pixel shader. */ + D3D12_TransitionResource(rendererData, textureData->mainTexture, textureData->mainResourceState, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE); + textureData->mainResourceState = D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE; + D3D12_TransitionResource(rendererData, textureData->mainTextureNV, textureData->mainResourceStateNV, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE); + textureData->mainResourceStateNV = D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE; + + return D3D12_SetDrawState(renderer, cmd, shader, D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE, + SDL_arraysize(shaderResources), shaderResources, textureSampler, matrix); + } +#endif /* SDL_HAVE_YUV */ + D3D12_TransitionResource(rendererData, textureData->mainTexture, textureData->mainResourceState, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE); + textureData->mainResourceState = D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE; + return D3D12_SetDrawState(renderer, cmd, SHADER_RGB, D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE, + 1, &textureData->mainTextureResourceView, textureSampler, matrix); +} + +static void +D3D12_DrawPrimitives(SDL_Renderer * renderer, D3D12_PRIMITIVE_TOPOLOGY primitiveTopology, const size_t vertexStart, const size_t vertexCount) +{ + D3D12_RenderData *rendererData = (D3D12_RenderData *) renderer->driverdata; + D3D_CALL(rendererData->commandList, IASetPrimitiveTopology, primitiveTopology); + D3D_CALL(rendererData->commandList, DrawInstanced, (UINT)vertexCount, 1, (UINT)vertexStart, 0); +} + +static int +D3D12_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize) +{ + D3D12_RenderData *rendererData = (D3D12_RenderData *) renderer->driverdata; + const int viewportRotation = D3D12_GetRotationForCurrentRenderTarget(renderer); + + if (rendererData->currentViewportRotation != viewportRotation) { + rendererData->currentViewportRotation = viewportRotation; + rendererData->viewportDirty = SDL_TRUE; + } + + if (D3D12_UpdateVertexBuffer(renderer, vertices, vertsize) < 0) { + return -1; + } + + while (cmd) { + switch (cmd->command) { + case SDL_RENDERCMD_SETDRAWCOLOR: { + break; /* this isn't currently used in this render backend. */ + } + + case SDL_RENDERCMD_SETVIEWPORT: { + SDL_Rect *viewport = &rendererData->currentViewport; + if (SDL_memcmp(viewport, &cmd->data.viewport.rect, sizeof(cmd->data.viewport.rect)) != 0) { + SDL_copyp(viewport, &cmd->data.viewport.rect); + rendererData->viewportDirty = SDL_TRUE; + } + break; + } + + case SDL_RENDERCMD_SETCLIPRECT: { + const SDL_Rect *rect = &cmd->data.cliprect.rect; + if (rendererData->currentCliprectEnabled != cmd->data.cliprect.enabled) { + rendererData->currentCliprectEnabled = cmd->data.cliprect.enabled; + rendererData->cliprectDirty = SDL_TRUE; + } + if (!rendererData->currentCliprectEnabled) { + /* If the clip rect is disabled, then the scissor rect should be the whole viewport, + since direct3d12 doesn't allow disabling the scissor rectangle */ + rect = &rendererData->currentViewport; + } + if (SDL_memcmp(&rendererData->currentCliprect, rect, sizeof(*rect)) != 0) { + SDL_copyp(&rendererData->currentCliprect, rect); + rendererData->cliprectDirty = SDL_TRUE; + } + break; + } + + case SDL_RENDERCMD_CLEAR: { + const float colorRGBA[] = { + (cmd->data.color.r / 255.0f), + (cmd->data.color.g / 255.0f), + (cmd->data.color.b / 255.0f), + (cmd->data.color.a / 255.0f) + }; + + D3D12_CPU_DESCRIPTOR_HANDLE rtvDescriptor = D3D12_GetCurrentRenderTargetView(renderer); + D3D_CALL(rendererData->commandList, ClearRenderTargetView, rtvDescriptor, colorRGBA, 0, NULL); + break; + } + + case SDL_RENDERCMD_DRAW_POINTS: { + const size_t count = cmd->data.draw.count; + const size_t first = cmd->data.draw.first; + const size_t start = first / sizeof (VertexPositionColor); + D3D12_SetDrawState(renderer, cmd, SHADER_SOLID, D3D12_PRIMITIVE_TOPOLOGY_TYPE_POINT, 0, NULL, NULL, NULL); + D3D12_DrawPrimitives(renderer, D3D_PRIMITIVE_TOPOLOGY_POINTLIST, start, count); + break; + } + + case SDL_RENDERCMD_DRAW_LINES: { + const size_t count = cmd->data.draw.count; + const size_t first = cmd->data.draw.first; + const size_t start = first / sizeof (VertexPositionColor); + const VertexPositionColor *verts = (VertexPositionColor *) (((Uint8 *) vertices) + first); + D3D12_SetDrawState(renderer, cmd, SHADER_SOLID, D3D12_PRIMITIVE_TOPOLOGY_TYPE_LINE, 0, NULL, NULL, NULL); + D3D12_DrawPrimitives(renderer, D3D_PRIMITIVE_TOPOLOGY_LINESTRIP, start, count); + if (verts[0].pos.x != verts[count - 1].pos.x || verts[0].pos.y != verts[count - 1].pos.y) { + D3D12_DrawPrimitives(renderer, D3D_PRIMITIVE_TOPOLOGY_POINTLIST, start + (count-1), 1); + } + break; + } + + case SDL_RENDERCMD_FILL_RECTS: /* unused */ + break; + + case SDL_RENDERCMD_COPY: /* unused */ + break; + + case SDL_RENDERCMD_COPY_EX: /* unused */ + break; + + case SDL_RENDERCMD_GEOMETRY: { + SDL_Texture *texture = cmd->data.draw.texture; + const size_t count = cmd->data.draw.count; + const size_t first = cmd->data.draw.first; + const size_t start = first / sizeof (VertexPositionColor); + + if (texture) { + D3D12_SetCopyState(renderer, cmd, NULL); + } else { + D3D12_SetDrawState(renderer, cmd, SHADER_SOLID, D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE, 0, NULL, NULL, NULL); + } + + D3D12_DrawPrimitives(renderer, D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST, start, count); + break; + } + + case SDL_RENDERCMD_NO_OP: + break; + } + + cmd = cmd->next; + } + + return 0; +} + +static int +D3D12_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, + Uint32 format, void * pixels, int pitch) +{ + D3D12_RenderData * data = (D3D12_RenderData *) renderer->driverdata; + ID3D12Resource *backBuffer = NULL; + ID3D12Resource *readbackBuffer = NULL; + HRESULT result; + int status = -1; + D3D12_RESOURCE_DESC textureDesc; + D3D12_RESOURCE_DESC readbackDesc; + D3D12_HEAP_PROPERTIES heapProps; + D3D12_RECT srcRect = {0, 0, 0, 0}; + D3D12_BOX srcBox; + D3D12_TEXTURE_COPY_LOCATION dstLocation; + D3D12_TEXTURE_COPY_LOCATION srcLocation; + D3D12_PLACED_SUBRESOURCE_FOOTPRINT placedTextureDesc; + D3D12_SUBRESOURCE_FOOTPRINT pitchedDesc; + BYTE *textureMemory; + int bpp; + + if (data->textureRenderTarget) { + backBuffer = data->textureRenderTarget->mainTexture; + } else { + backBuffer = data->renderTargets[data->currentBackBufferIndex]; + } + + /* Create a staging texture to copy the screen's data to: */ + SDL_zero(textureDesc); + D3D_CALL_RET(backBuffer, GetDesc, &textureDesc); + textureDesc.Width = rect->w; + textureDesc.Height = rect->h; + + SDL_zero(readbackDesc); + readbackDesc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER; + readbackDesc.Alignment = D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT; + readbackDesc.Height = 1; + readbackDesc.DepthOrArraySize = 1; + readbackDesc.MipLevels = 1; + readbackDesc.Format = DXGI_FORMAT_UNKNOWN; + readbackDesc.SampleDesc.Count = 1; + readbackDesc.SampleDesc.Quality = 0; + readbackDesc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR; + readbackDesc.Flags = D3D12_RESOURCE_FLAG_NONE; + + /* Figure out how much we need to allocate for the upload buffer */ + D3D_CALL(data->d3dDevice, GetCopyableFootprints, + &textureDesc, + 0, + 1, + 0, + NULL, + NULL, + NULL, + &readbackDesc.Width + ); + + SDL_zero(heapProps); + heapProps.Type = D3D12_HEAP_TYPE_READBACK; + heapProps.CreationNodeMask = 1; + heapProps.VisibleNodeMask = 1; + + result = D3D_CALL(data->d3dDevice, CreateCommittedResource, + &heapProps, + D3D12_HEAP_FLAG_NONE, + &readbackDesc, + D3D12_RESOURCE_STATE_COPY_DEST, + NULL, + D3D_GUID(SDL_IID_ID3D12Resource), + (void **)&readbackBuffer + ); + if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Device::CreateTexture2D [create staging texture]"), result); + goto done; + } + + /* Transition the render target to be copyable from */ + D3D12_TransitionResource(data, backBuffer, D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE); + + /* Copy the desired portion of the back buffer to the staging texture: */ + if (D3D12_GetViewportAlignedD3DRect(renderer, rect, &srcRect, FALSE) != 0) { + /* D3D12_GetViewportAlignedD3DRect will have set the SDL error */ + goto done; + } + srcBox.left = srcRect.left; + srcBox.right = srcRect.right; + srcBox.top = srcRect.top; + srcBox.bottom = srcRect.bottom; + srcBox.front = 0; + srcBox.back = 1; + + /* Issue the copy texture region */ + SDL_zero(pitchedDesc); + pitchedDesc.Format = textureDesc.Format; + pitchedDesc.Width = (UINT)textureDesc.Width; + pitchedDesc.Height = textureDesc.Height; + pitchedDesc.Depth = 1; + if (pitchedDesc.Format == DXGI_FORMAT_R8_UNORM) { + bpp = 1; + } else { + bpp = 4; + } + pitchedDesc.RowPitch = D3D12_Align(pitchedDesc.Width * bpp, D3D12_TEXTURE_DATA_PITCH_ALIGNMENT); + + SDL_zero(placedTextureDesc); + placedTextureDesc.Offset = 0; + placedTextureDesc.Footprint = pitchedDesc; + + SDL_zero(dstLocation); + dstLocation.pResource = readbackBuffer; + dstLocation.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT; + dstLocation.PlacedFootprint = placedTextureDesc; + + SDL_zero(srcLocation); + srcLocation.pResource = backBuffer; + srcLocation.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX; + srcLocation.SubresourceIndex = 0; + + D3D_CALL(data->commandList, CopyTextureRegion, + &dstLocation, + 0, 0, 0, + &srcLocation, + &srcBox + ); + + /* We need to issue the command list for the copy to finish */ + D3D12_IssueBatch(data); + + /* Transition the render target back to a render target */ + D3D12_TransitionResource(data, backBuffer, D3D12_RESOURCE_STATE_COPY_SOURCE, D3D12_RESOURCE_STATE_RENDER_TARGET ); + + /* Map the staging texture's data to CPU-accessible memory: */ + result = D3D_CALL(readbackBuffer, Map, + 0, + NULL, + (void **)&textureMemory + ); + if (FAILED(result)) { + SAFE_RELEASE(readbackBuffer); + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Resource::Map [map staging texture]"), result); + } + + /* Copy the data into the desired buffer, converting pixels to the + * desired format at the same time: + */ + status = SDL_ConvertPixels( + rect->w, rect->h, + D3D12_DXGIFormatToSDLPixelFormat(textureDesc.Format), + textureMemory, + pitchedDesc.RowPitch, + format, + pixels, + pitch); + + /* Unmap the texture: */ + D3D_CALL(readbackBuffer, Unmap, 0, NULL); + +done: + SAFE_RELEASE(readbackBuffer); + return status; +} + +static void +D3D12_RenderPresent(SDL_Renderer * renderer) +{ + D3D12_RenderData *data = (D3D12_RenderData *) renderer->driverdata; +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) + UINT syncInterval; + UINT presentFlags; +#endif + HRESULT result; + + /* Transition the render target to present state */ + D3D12_TransitionResource(data, + data->renderTargets[data->currentBackBufferIndex], + D3D12_RESOURCE_STATE_RENDER_TARGET, + D3D12_RESOURCE_STATE_PRESENT + ); + + /* Issue the command list */ + result = D3D_CALL(data->commandList, Close); + D3D_CALL(data->commandQueue, ExecuteCommandLists, 1, (ID3D12CommandList * const *)&data->commandList); + +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) + result = D3D12_XBOX_PresentFrame(data->commandQueue, data->frameToken, data->renderTargets[data->currentBackBufferIndex]); +#else + if (renderer->info.flags & SDL_RENDERER_PRESENTVSYNC) { + syncInterval = 1; + presentFlags = 0; + } else { + syncInterval = 0; + presentFlags = DXGI_PRESENT_ALLOW_TEARING; + } + + /* The application may optionally specify "dirty" or "scroll" + * rects to improve efficiency in certain scenarios. + */ + result = D3D_CALL(data->swapChain, Present, syncInterval, presentFlags); +#endif + + if (FAILED(result) && result != DXGI_ERROR_WAS_STILL_DRAWING) { + /* If the device was removed either by a disconnect or a driver upgrade, we + * must recreate all device resources. + */ + if ( result == DXGI_ERROR_DEVICE_REMOVED ) { + D3D12_HandleDeviceLost(renderer); + } else if (result == DXGI_ERROR_INVALID_CALL) { + /* We probably went through a fullscreen <-> windowed transition */ + D3D12_CreateWindowSizeDependentResources(renderer); + } else { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGISwapChain::Present"), result); + } + } else { + /* Wait for the GPU and move to the next frame */ + result = D3D_CALL(data->commandQueue, Signal, data->fence, data->fenceValue); + + if (D3D_CALL(data->fence, GetCompletedValue) < data->fenceValue) { + result = D3D_CALL(data->fence, SetEventOnCompletion, + data->fenceValue, + data->fenceEvent + ); + WaitForSingleObjectEx(data->fenceEvent, INFINITE, FALSE); + } + + data->fenceValue++; +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) + data->currentBackBufferIndex++; + data->currentBackBufferIndex %= SDL_D3D12_NUM_BUFFERS; +#else + data->currentBackBufferIndex = D3D_CALL(data->swapChain, GetCurrentBackBufferIndex); +#endif + + /* Reset the command allocator and command list, and transition back to render target */ + D3D12_ResetCommandList(data); + D3D12_TransitionResource(data, + data->renderTargets[data->currentBackBufferIndex], + D3D12_RESOURCE_STATE_PRESENT, + D3D12_RESOURCE_STATE_RENDER_TARGET + ); + +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) + D3D12_XBOX_StartFrame(data->d3dDevice, &data->frameToken); +#endif + } +} + +static int +D3D12_SetVSync(SDL_Renderer * renderer, const int vsync) +{ + if (vsync) { + renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; + } else { + renderer->info.flags &= ~SDL_RENDERER_PRESENTVSYNC; + } + return 0; +} + +SDL_Renderer * +D3D12_CreateRenderer(SDL_Window * window, Uint32 flags) +{ + SDL_Renderer *renderer; + D3D12_RenderData *data; + + renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer)); + if (!renderer) { + SDL_OutOfMemory(); + return NULL; + } + + data = (D3D12_RenderData *) SDL_calloc(1, sizeof(*data)); + if (!data) { + SDL_free(renderer); + SDL_OutOfMemory(); + return NULL; + } + + data->identity = MatrixIdentity(); + + renderer->WindowEvent = D3D12_WindowEvent; + renderer->GetOutputSize = D3D12_GetOutputSize; + renderer->SupportsBlendMode = D3D12_SupportsBlendMode; + renderer->CreateTexture = D3D12_CreateTexture; + renderer->UpdateTexture = D3D12_UpdateTexture; +#if SDL_HAVE_YUV + renderer->UpdateTextureYUV = D3D12_UpdateTextureYUV; + renderer->UpdateTextureNV = D3D12_UpdateTextureNV; +#endif + renderer->LockTexture = D3D12_LockTexture; + renderer->UnlockTexture = D3D12_UnlockTexture; + renderer->SetTextureScaleMode = D3D12_SetTextureScaleMode; + renderer->SetRenderTarget = D3D12_SetRenderTarget; + renderer->QueueSetViewport = D3D12_QueueSetViewport; + renderer->QueueSetDrawColor = D3D12_QueueSetViewport; /* SetViewport and SetDrawColor are (currently) no-ops. */ + renderer->QueueDrawPoints = D3D12_QueueDrawPoints; + renderer->QueueDrawLines = D3D12_QueueDrawPoints; /* lines and points queue vertices the same way. */ + renderer->QueueGeometry = D3D12_QueueGeometry; + renderer->RunCommandQueue = D3D12_RunCommandQueue; + renderer->RenderReadPixels = D3D12_RenderReadPixels; + renderer->RenderPresent = D3D12_RenderPresent; + renderer->DestroyTexture = D3D12_DestroyTexture; + renderer->DestroyRenderer = D3D12_DestroyRenderer; + renderer->info = D3D12_RenderDriver.info; + renderer->info.flags = (SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE); + renderer->driverdata = data; + + if ((flags & SDL_RENDERER_PRESENTVSYNC)) { + renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; + } + renderer->SetVSync = D3D12_SetVSync; + + /* HACK: make sure the SDL_Renderer references the SDL_Window data now, in + * order to give init functions access to the underlying window handle: + */ + renderer->window = window; + + /* Initialize Direct3D resources */ + if (FAILED(D3D12_CreateDeviceResources(renderer))) { + D3D12_DestroyRenderer(renderer); + return NULL; + } + if (FAILED(D3D12_CreateWindowSizeDependentResources(renderer))) { + D3D12_DestroyRenderer(renderer); + return NULL; + } + + return renderer; +} + +SDL_RenderDriver D3D12_RenderDriver = { + D3D12_CreateRenderer, + { + "direct3d12", + ( + SDL_RENDERER_ACCELERATED | + SDL_RENDERER_PRESENTVSYNC | + SDL_RENDERER_TARGETTEXTURE + ), /* flags. see SDL_RendererFlags */ + 6, /* num_texture_formats */ + { /* texture_formats */ + SDL_PIXELFORMAT_ARGB8888, + SDL_PIXELFORMAT_RGB888, + SDL_PIXELFORMAT_YV12, + SDL_PIXELFORMAT_IYUV, + SDL_PIXELFORMAT_NV12, + SDL_PIXELFORMAT_NV21 + }, + 16384, /* max_texture_width */ + 16384 /* max_texture_height */ + } +}; + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif + +#endif /* SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED */ + +#if defined(__WIN32__) || defined(__GDK__) +#ifdef __cplusplus +extern "C" +#endif +/* This function needs to always exist on Windows, for the Dynamic API. */ +ID3D12Device * +SDL_RenderGetD3D12Device(SDL_Renderer * renderer) +{ + ID3D12Device *device = NULL; + +#if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED + D3D12_RenderData *data = (D3D12_RenderData *) renderer->driverdata; + + /* Make sure that this is a D3D renderer */ + if (renderer->DestroyRenderer != D3D12_DestroyRenderer) { + SDL_SetError("Renderer is not a D3D12 renderer"); + return NULL; + } + + device = (ID3D12Device *)data->d3dDevice; + if (device) { + D3D_CALL(device, AddRef); + } +#endif /* SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED */ + + return device; +} +#endif /* defined(__WIN32__) || defined(__GDK__) */ + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/render/direct3d12/SDL_render_d3d12_xbox.cpp libsdl2-2.24.0+dfsg/src/render/direct3d12/SDL_render_d3d12_xbox.cpp --- libsdl2-2.0.22+dfsg/src/render/direct3d12/SDL_render_d3d12_xbox.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/render/direct3d12/SDL_render_d3d12_xbox.cpp 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,27 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" +#if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && (defined(__XBOXONE__) || defined(__XBOXSERIES__)) +#include "SDL_render_d3d12_xbox.h" + +#error "This is a placeholder Xbox file, as the real one is under NDA. See README-gdk.md for more info." +#endif diff -Nru libsdl2-2.0.22+dfsg/src/render/direct3d12/SDL_render_d3d12_xbox.h libsdl2-2.24.0+dfsg/src/render/direct3d12/SDL_render_d3d12_xbox.h --- libsdl2-2.0.22+dfsg/src/render/direct3d12/SDL_render_d3d12_xbox.h 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/render/direct3d12/SDL_render_d3d12_xbox.h 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,22 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#error "This is a placeholder Xbox file, as the real one is under NDA. See README-gdk.md for more info." diff -Nru libsdl2-2.0.22+dfsg/src/render/direct3d12/SDL_shaders_d3d12.c libsdl2-2.24.0+dfsg/src/render/direct3d12/SDL_shaders_d3d12.c --- libsdl2-2.0.22+dfsg/src/render/direct3d12/SDL_shaders_d3d12.c 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/render/direct3d12/SDL_shaders_d3d12.c 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,6961 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) + +#include "SDL_stdinc.h" + +#include "../../core/windows/SDL_windows.h" +#include + +#include "SDL_shaders_d3d12.h" + +#define SDL_COMPOSE_ERROR(str) SDL_STRINGIFY_ARG(__FUNCTION__) ", " str + + +/* Direct3D 12 shaders + + SDL's shaders are compiled into SDL itself, to simplify distribution. + + All Direct3D 12 shaders were compiled with the following: + + dxc -E -T -Fo + + Variables: + - : the function. This is main for the pixel shader, and one of + four options for the vertex shader + - : the type of shader. A table of utilized shader types is + listed below. + - : where to store compiled output + - : where to read shader source code from + + Shader types: + - ps_6_0: Pixel shader + - vs_6_0: Vertex shader + + + Shader object code was converted to unsigned chars via the following + *nix style command (available separately from Windows + MSVC): + + xxd --include + */ + +/* The color-only-rendering pixel shader: + + --- D3D12_PixelShader_Colors.hlsl --- + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + #define ColorRS \ + "RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \ + "DENY_DOMAIN_SHADER_ROOT_ACCESS |" \ + "DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \ + "DENY_HULL_SHADER_ROOT_ACCESS )," \ + "RootConstants(num32BitConstants=32, b0)" + + [RootSignature(ColorRS)] + float4 main(PixelShaderInput input) : SV_TARGET0 + { + return input.color; + } +*/ + +static unsigned char D3D12_PixelShader_Colors[] = { + 0x44, 0x58, 0x42, 0x43, 0x38, 0xfe, 0xa0, 0xc7, 0x8e, 0xb3, 0x78, 0x02, + 0x7e, 0x71, 0xa9, 0x1c, 0x23, 0x3e, 0x23, 0xa2, 0x01, 0x00, 0x00, 0x00, + 0xe5, 0x0c, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, + 0x50, 0x00, 0x00, 0x00, 0xdb, 0x00, 0x00, 0x00, 0x15, 0x01, 0x00, 0x00, + 0xd9, 0x01, 0x00, 0x00, 0x11, 0x02, 0x00, 0x00, 0xa9, 0x07, 0x00, 0x00, + 0xc5, 0x07, 0x00, 0x00, 0x53, 0x46, 0x49, 0x30, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x31, + 0x83, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x53, 0x56, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, + 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x43, 0x4f, 0x4c, + 0x4f, 0x52, 0x00, 0x4f, 0x53, 0x47, 0x31, 0x32, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x00, 0x50, 0x53, 0x56, 0x30, 0xbc, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, + 0xff, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01, 0x00, 0x03, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x54, 0x45, + 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x44, + 0x03, 0x03, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x01, 0x42, 0x00, 0x03, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x44, 0x00, 0x03, 0x02, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x44, + 0x10, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, + 0x00, 0x08, 0x00, 0x00, 0x00, 0x52, 0x54, 0x53, 0x30, 0x30, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, + 0x00, 0x53, 0x54, 0x41, 0x54, 0x90, 0x05, 0x00, 0x00, 0x60, 0x00, 0x00, + 0x00, 0x64, 0x01, 0x00, 0x00, 0x44, 0x58, 0x49, 0x4c, 0x00, 0x01, 0x00, + 0x00, 0x10, 0x00, 0x00, 0x00, 0x78, 0x05, 0x00, 0x00, 0x42, 0x43, 0xc0, + 0xde, 0x21, 0x0c, 0x00, 0x00, 0x5b, 0x01, 0x00, 0x00, 0x0b, 0x82, 0x20, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, + 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, + 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x10, 0x45, + 0x02, 0x42, 0x92, 0x0b, 0x42, 0x84, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, + 0x4b, 0x0a, 0x32, 0x42, 0x88, 0x48, 0x90, 0x14, 0x20, 0x43, 0x46, 0x88, + 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, 0x90, 0x11, 0x22, 0xc4, + 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, 0x8a, 0x04, 0x21, 0x46, + 0x06, 0x51, 0x18, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0xe0, + 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, 0x02, 0xa8, 0x0d, 0x84, 0xf0, 0xff, + 0xff, 0xff, 0xff, 0x03, 0x20, 0x01, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, 0x00, 0x00, + 0x00, 0x89, 0x20, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x32, 0x22, 0x08, + 0x09, 0x20, 0x64, 0x85, 0x04, 0x13, 0x22, 0xa4, 0x84, 0x04, 0x13, 0x22, + 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x88, 0x8c, 0x0b, 0x84, 0x84, + 0x4c, 0x10, 0x3c, 0x23, 0x00, 0x25, 0x00, 0x8a, 0x19, 0x80, 0x39, 0x02, + 0x30, 0x98, 0x23, 0x40, 0x8a, 0x31, 0x44, 0x54, 0x44, 0x56, 0x0c, 0x20, + 0xa2, 0x1a, 0xc2, 0x81, 0x80, 0x61, 0x04, 0x62, 0x18, 0x46, 0x10, 0x86, + 0xbb, 0xa4, 0x29, 0xa2, 0x84, 0xc9, 0x4f, 0x91, 0x8b, 0x58, 0xd8, 0x03, + 0x18, 0x88, 0x48, 0x6c, 0x1e, 0x6a, 0x42, 0xc3, 0xf2, 0xa6, 0x03, 0x01, + 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, + 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, + 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, + 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x43, 0x9e, 0x00, 0x08, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x3c, 0x06, 0x10, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x79, 0x10, + 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x02, + 0x01, 0x10, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, + 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0xa2, 0x12, 0x18, 0x01, + 0x28, 0x86, 0x02, 0x2b, 0x83, 0x42, 0x28, 0x87, 0x92, 0x28, 0x90, 0x02, + 0x2a, 0x82, 0xf2, 0xa0, 0x2a, 0x89, 0x32, 0x28, 0x84, 0x11, 0x80, 0x22, + 0x28, 0x10, 0xea, 0x19, 0x00, 0xf2, 0xb1, 0x1c, 0x86, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x08, 0x04, 0x02, 0x01, 0x00, 0x00, 0x79, 0x18, 0x00, + 0x00, 0x85, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, + 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b, 0x93, 0x9b, + 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1, 0x0b, 0x3b, + 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, 0x0a, 0x9a, 0x2a, 0xfa, 0x9a, 0xb9, + 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, 0x63, 0x4b, 0xd9, 0x10, 0x04, 0x13, + 0x04, 0x62, 0x98, 0x20, 0x10, 0xc4, 0x06, 0x61, 0x20, 0x36, 0x08, 0x04, + 0x41, 0x01, 0x6e, 0x6e, 0x82, 0x40, 0x14, 0x1b, 0x86, 0x03, 0x21, 0x26, + 0x08, 0x4d, 0x35, 0x41, 0x20, 0x0c, 0x0e, 0x70, 0x6f, 0x73, 0x13, 0x04, + 0xe2, 0x98, 0x20, 0x10, 0x08, 0x97, 0x29, 0xab, 0x2f, 0xa8, 0xa7, 0xa9, + 0x24, 0xaa, 0xa4, 0x27, 0xa7, 0x09, 0x02, 0x91, 0x4c, 0x10, 0x08, 0x65, + 0x03, 0x82, 0x30, 0x0d, 0xe1, 0x3c, 0x50, 0xc4, 0x81, 0xae, 0x0c, 0x6f, + 0x82, 0x40, 0x2c, 0x4c, 0xa8, 0x8a, 0xb0, 0x86, 0x9e, 0x9e, 0xa4, 0x88, + 0x60, 0x36, 0x20, 0xc8, 0xd4, 0x50, 0x4e, 0x05, 0x45, 0x2c, 0xc6, 0xde, + 0xd8, 0xde, 0xe4, 0x26, 0x08, 0x04, 0x43, 0x63, 0xe8, 0x89, 0xe9, 0x49, + 0x0a, 0x66, 0x03, 0x82, 0x5c, 0x0d, 0xe6, 0x64, 0x50, 0xb4, 0x81, 0x58, + 0x24, 0x4b, 0xdb, 0x30, 0x10, 0xca, 0x36, 0x41, 0x10, 0x80, 0x0d, 0xc0, + 0x86, 0x81, 0xf0, 0xbc, 0x0d, 0xc1, 0xb7, 0x61, 0x18, 0x3a, 0x30, 0x98, + 0x20, 0x38, 0xd6, 0x86, 0x40, 0x0c, 0x48, 0xb4, 0x85, 0xa5, 0xb9, 0x71, + 0x99, 0xb2, 0xfa, 0x82, 0x7a, 0x9b, 0x4b, 0xa3, 0x4b, 0x7b, 0x73, 0x9b, + 0x20, 0x14, 0xcf, 0x04, 0xa1, 0x80, 0x36, 0x04, 0xc4, 0x04, 0xa1, 0x88, + 0x26, 0x08, 0x85, 0xb4, 0x61, 0x21, 0xca, 0xc0, 0x0c, 0xce, 0x00, 0x0d, + 0xd2, 0x60, 0x48, 0x03, 0x42, 0x0d, 0x00, 0x22, 0x54, 0x45, 0x58, 0x43, + 0x4f, 0x4f, 0x52, 0x44, 0x13, 0x84, 0x62, 0xda, 0xb0, 0x0c, 0x6c, 0x60, + 0x06, 0x6a, 0x80, 0x06, 0x6d, 0x30, 0xb4, 0xc1, 0xa0, 0x06, 0xc0, 0x04, + 0x81, 0x68, 0x58, 0x0c, 0x3d, 0x31, 0x3d, 0x49, 0x4d, 0x10, 0x08, 0x67, + 0x83, 0xd0, 0xc4, 0xc1, 0x86, 0xe5, 0x0d, 0xe0, 0xc0, 0x0c, 0xd4, 0x00, + 0x0d, 0xda, 0x60, 0x48, 0x83, 0x37, 0x50, 0x03, 0x39, 0xd8, 0x30, 0xac, + 0x81, 0x1b, 0xcc, 0x01, 0x93, 0x29, 0xab, 0x2f, 0xaa, 0x30, 0xb9, 0xb3, + 0x32, 0xba, 0x09, 0x42, 0x41, 0x6d, 0x58, 0x88, 0x3a, 0x30, 0x03, 0x3b, + 0x40, 0x03, 0x35, 0x18, 0xd2, 0x80, 0x50, 0x03, 0x39, 0xd8, 0x10, 0xdc, + 0xc1, 0x86, 0x81, 0x0e, 0xf0, 0x00, 0xd8, 0x50, 0x74, 0x64, 0x90, 0x07, + 0x00, 0xc0, 0x22, 0xcd, 0x6d, 0x8e, 0x6e, 0x8e, 0xc6, 0x5c, 0xda, 0xd9, + 0x17, 0x1b, 0x19, 0x8d, 0xb9, 0xb4, 0xb3, 0xaf, 0x39, 0xba, 0x0d, 0xc6, + 0x1e, 0x44, 0x7c, 0xe0, 0xf4, 0x81, 0x53, 0x85, 0x8d, 0xcd, 0xae, 0xcd, + 0x25, 0x8d, 0xac, 0xcc, 0x8d, 0x6e, 0x4a, 0x10, 0x54, 0x21, 0xc3, 0x73, + 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x9b, 0x12, 0x10, 0x4d, 0xc8, + 0xf0, 0x5c, 0xec, 0xc2, 0xd8, 0xec, 0xca, 0xe4, 0xa6, 0x04, 0x45, 0x1d, + 0x32, 0x3c, 0x97, 0x39, 0xb4, 0x30, 0xb2, 0x32, 0xb9, 0xa6, 0x37, 0xb2, + 0x32, 0xb6, 0x29, 0x01, 0x52, 0x89, 0x0c, 0xcf, 0x85, 0x2e, 0x0f, 0xae, + 0x2c, 0xc8, 0xcd, 0xed, 0x8d, 0x2e, 0x8c, 0x2e, 0xed, 0xcd, 0x6d, 0x6e, + 0x8a, 0xb0, 0x81, 0x41, 0x1d, 0x32, 0x3c, 0x17, 0xbb, 0xb4, 0xb2, 0xbb, + 0x24, 0xb2, 0x29, 0xba, 0x30, 0xba, 0xb2, 0x29, 0x81, 0x18, 0xd4, 0x21, + 0xc3, 0x73, 0x29, 0x73, 0xa3, 0x93, 0xcb, 0x83, 0x7a, 0x4b, 0x73, 0xa3, + 0x9b, 0x9b, 0x12, 0xe4, 0x41, 0x17, 0x32, 0x3c, 0x97, 0xb1, 0xb7, 0x3a, + 0x37, 0xba, 0x32, 0xb9, 0xb9, 0x29, 0x41, 0x1f, 0x00, 0x79, 0x18, 0x00, + 0x00, 0x4c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, + 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, + 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, + 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, + 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, + 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, + 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, + 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, + 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, + 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, + 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, + 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, + 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, + 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, + 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, + 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, + 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, + 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, + 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, + 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, + 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, + 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, + 0x3b, 0xb0, 0xc3, 0x0c, 0xc4, 0x21, 0x07, 0x7c, 0x70, 0x03, 0x7a, 0x28, + 0x87, 0x76, 0x80, 0x87, 0x19, 0xd1, 0x43, 0x0e, 0xf8, 0xe0, 0x06, 0xe4, + 0x20, 0x0e, 0xe7, 0xe0, 0x06, 0xf6, 0x10, 0x0e, 0xf2, 0xc0, 0x0e, 0xe1, + 0x90, 0x0f, 0xef, 0x50, 0x0f, 0xf4, 0x00, 0x00, 0x00, 0x71, 0x20, 0x00, + 0x00, 0x0b, 0x00, 0x00, 0x00, 0x16, 0x30, 0x0d, 0x97, 0xef, 0x3c, 0xfe, + 0xe2, 0x00, 0x83, 0xd8, 0x3c, 0xd4, 0xe4, 0x17, 0xb7, 0x6d, 0x02, 0xd5, + 0x70, 0xf9, 0xce, 0xe3, 0x4b, 0x93, 0x13, 0x11, 0x28, 0x35, 0x3d, 0xd4, + 0xe4, 0x17, 0xb7, 0x6d, 0x00, 0x04, 0x03, 0x20, 0x0d, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x41, 0x53, 0x48, 0x14, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xe1, 0x4a, 0xd5, 0x78, 0xe4, 0x4f, 0xd6, + 0x12, 0x0d, 0x86, 0x23, 0xf7, 0x0e, 0x82, 0x21, 0x40, 0x44, 0x58, 0x49, + 0x4c, 0x18, 0x05, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x46, 0x01, 0x00, + 0x00, 0x44, 0x58, 0x49, 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x05, 0x00, 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, + 0x00, 0x3d, 0x01, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, + 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, + 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x10, 0x45, 0x02, 0x42, 0x92, 0x0b, + 0x42, 0x84, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x42, + 0x88, 0x48, 0x90, 0x14, 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, + 0x42, 0xe4, 0x48, 0x0e, 0x90, 0x11, 0x22, 0xc4, 0x50, 0x41, 0x51, 0x81, + 0x8c, 0xe1, 0x83, 0xe5, 0x8a, 0x04, 0x21, 0x46, 0x06, 0x51, 0x18, 0x00, + 0x00, 0x06, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, + 0x07, 0x40, 0x02, 0xa8, 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, + 0x20, 0x01, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, + 0x00, 0x0f, 0x00, 0x00, 0x00, 0x32, 0x22, 0x08, 0x09, 0x20, 0x64, 0x85, + 0x04, 0x13, 0x22, 0xa4, 0x84, 0x04, 0x13, 0x22, 0xe3, 0x84, 0xa1, 0x90, + 0x14, 0x12, 0x4c, 0x88, 0x8c, 0x0b, 0x84, 0x84, 0x4c, 0x10, 0x30, 0x23, + 0x00, 0x25, 0x00, 0x8a, 0x19, 0x80, 0x39, 0x02, 0x30, 0x98, 0x23, 0x40, + 0x8a, 0x31, 0x44, 0x54, 0x44, 0x56, 0x0c, 0x20, 0xa2, 0x1a, 0xc2, 0x81, + 0x80, 0x74, 0x20, 0x00, 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, + 0x87, 0x36, 0x68, 0x87, 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, 0x0d, 0xaf, + 0x50, 0x0e, 0x6d, 0xd0, 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, + 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, + 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, + 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, + 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, + 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, + 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, + 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x43, + 0x9e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x86, 0x3c, 0x06, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x0c, 0x79, 0x10, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xc8, 0x02, 0x01, 0x0d, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, + 0x14, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, + 0xa2, 0x12, 0x18, 0x01, 0x28, 0x86, 0x22, 0x28, 0x83, 0xf2, 0xa0, 0x2a, + 0x89, 0x32, 0x28, 0x84, 0x11, 0x80, 0x22, 0x28, 0x10, 0xda, 0xb1, 0x1c, + 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x02, 0x01, 0x00, + 0x00, 0x79, 0x18, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, + 0x90, 0x46, 0x02, 0x13, 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, 0x3b, 0x03, + 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, 0xb9, 0x01, + 0x41, 0xa1, 0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, 0x0a, 0x9a, + 0x2a, 0xfa, 0x9a, 0xb9, 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, 0x63, 0x4b, + 0xd9, 0x10, 0x04, 0x13, 0x04, 0x62, 0x98, 0x20, 0x10, 0xc4, 0x06, 0x61, + 0x20, 0x26, 0x08, 0x44, 0xb1, 0x41, 0x18, 0x0c, 0x0a, 0x70, 0x73, 0x1b, + 0x06, 0xc4, 0x20, 0x26, 0x08, 0xcb, 0xb3, 0x21, 0x50, 0x26, 0x08, 0x02, + 0x40, 0xa2, 0x2d, 0x2c, 0xcd, 0x8d, 0xcb, 0x94, 0xd5, 0x17, 0xd4, 0xdb, + 0x5c, 0x1a, 0x5d, 0xda, 0x9b, 0xdb, 0x04, 0xa1, 0x48, 0x26, 0x08, 0x85, + 0xb2, 0x21, 0x20, 0x26, 0x08, 0xc5, 0x32, 0x41, 0x28, 0x98, 0x0d, 0x0b, + 0xe1, 0x3c, 0x50, 0x24, 0x0d, 0x12, 0x31, 0x01, 0x44, 0xa8, 0x8a, 0xb0, + 0x86, 0x9e, 0x9e, 0xa4, 0x88, 0x26, 0x08, 0x45, 0xb3, 0x61, 0x19, 0xaa, + 0x67, 0x8a, 0xac, 0xc1, 0x1a, 0x26, 0x60, 0x82, 0x40, 0x18, 0x2c, 0x86, + 0x9e, 0x98, 0x9e, 0xa4, 0x26, 0x08, 0xc4, 0x31, 0x41, 0x20, 0x90, 0x0d, + 0x82, 0xb6, 0x6d, 0x58, 0xb0, 0xec, 0x99, 0x22, 0x6b, 0x90, 0xb0, 0x89, + 0xdb, 0x30, 0x50, 0x57, 0xc7, 0x64, 0xca, 0xea, 0x8b, 0x2a, 0x4c, 0xee, + 0xac, 0x8c, 0x6e, 0x82, 0x50, 0x38, 0x1b, 0x16, 0xe2, 0x7b, 0xc0, 0x20, + 0x9a, 0x06, 0x89, 0x98, 0xb8, 0x0d, 0x41, 0x18, 0x6c, 0x18, 0x3c, 0x31, + 0x00, 0x36, 0x14, 0x4c, 0x33, 0x06, 0x00, 0x50, 0x85, 0x8d, 0xcd, 0xae, + 0xcd, 0x25, 0x8d, 0xac, 0xcc, 0x8d, 0x6e, 0x4a, 0x10, 0x54, 0x21, 0xc3, + 0x73, 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x9b, 0x12, 0x10, 0x4d, + 0xc8, 0xf0, 0x5c, 0xec, 0xc2, 0xd8, 0xec, 0xca, 0xe4, 0xa6, 0x04, 0x46, + 0x1d, 0x32, 0x3c, 0x97, 0x39, 0xb4, 0x30, 0xb2, 0x32, 0xb9, 0xa6, 0x37, + 0xb2, 0x32, 0xb6, 0x29, 0x01, 0x52, 0x87, 0x0c, 0xcf, 0xc5, 0x2e, 0xad, + 0xec, 0x2e, 0x89, 0x6c, 0x8a, 0x2e, 0x8c, 0xae, 0x6c, 0x4a, 0xa0, 0xd4, + 0x21, 0xc3, 0x73, 0x29, 0x73, 0xa3, 0x93, 0xcb, 0x83, 0x7a, 0x4b, 0x73, + 0xa3, 0x9b, 0x9b, 0x12, 0x8c, 0x01, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, + 0x00, 0x4c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, + 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, + 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, + 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, + 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, + 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, + 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, + 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, + 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, + 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, + 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, + 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, + 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, + 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, + 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, + 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, + 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, + 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, + 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, + 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, + 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, + 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, + 0x3b, 0xb0, 0xc3, 0x0c, 0xc4, 0x21, 0x07, 0x7c, 0x70, 0x03, 0x7a, 0x28, + 0x87, 0x76, 0x80, 0x87, 0x19, 0xd1, 0x43, 0x0e, 0xf8, 0xe0, 0x06, 0xe4, + 0x20, 0x0e, 0xe7, 0xe0, 0x06, 0xf6, 0x10, 0x0e, 0xf2, 0xc0, 0x0e, 0xe1, + 0x90, 0x0f, 0xef, 0x50, 0x0f, 0xf4, 0x00, 0x00, 0x00, 0x71, 0x20, 0x00, + 0x00, 0x0b, 0x00, 0x00, 0x00, 0x16, 0x30, 0x0d, 0x97, 0xef, 0x3c, 0xfe, + 0xe2, 0x00, 0x83, 0xd8, 0x3c, 0xd4, 0xe4, 0x17, 0xb7, 0x6d, 0x02, 0xd5, + 0x70, 0xf9, 0xce, 0xe3, 0x4b, 0x93, 0x13, 0x11, 0x28, 0x35, 0x3d, 0xd4, + 0xe4, 0x17, 0xb7, 0x6d, 0x00, 0x04, 0x03, 0x20, 0x0d, 0x00, 0x00, 0x00, + 0x00, 0x61, 0x20, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, + 0x2c, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x44, 0x85, 0x30, + 0x03, 0x50, 0x0a, 0x54, 0x25, 0x00, 0x00, 0x00, 0x00, 0x23, 0x06, 0x09, + 0x00, 0x82, 0x60, 0x60, 0x4c, 0x84, 0x03, 0x21, 0xc3, 0x88, 0x41, 0x02, + 0x80, 0x20, 0x18, 0x18, 0x54, 0xf1, 0x44, 0x02, 0x31, 0x62, 0x90, 0x00, + 0x20, 0x08, 0x06, 0x46, 0x65, 0x40, 0x52, 0x52, 0x8c, 0x18, 0x24, 0x00, + 0x08, 0x82, 0x81, 0x61, 0x1d, 0xd1, 0xd4, 0x18, 0x23, 0x06, 0x09, 0x00, + 0x82, 0x60, 0x80, 0x58, 0x06, 0x45, 0x31, 0xc4, 0x88, 0x41, 0x02, 0x80, + 0x20, 0x18, 0x20, 0x96, 0x41, 0x51, 0xc5, 0x30, 0x62, 0x90, 0x00, 0x20, + 0x08, 0x06, 0x88, 0x65, 0x50, 0xd4, 0x22, 0x8c, 0x18, 0x24, 0x00, 0x08, + 0x82, 0x01, 0x62, 0x19, 0x14, 0xe5, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, + 0x00 +}; + +/* The texture-rendering pixel shader: + + --- D3D12_PixelShader_Textures.hlsl --- + Texture2D theTexture : register(t0); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + #define TextureRS \ + "RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \ + " DENY_DOMAIN_SHADER_ROOT_ACCESS |" \ + " DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \ + " DENY_HULL_SHADER_ROOT_ACCESS )," \ + "RootConstants(num32BitConstants=32, b0),"\ + "DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )" + + [RootSignature(TextureRS)] + float4 main(PixelShaderInput input) : SV_TARGET + { + return theTexture.Sample(theSampler, input.tex) * input.color; + } +*/ + +static unsigned char D3D12_PixelShader_Textures[] = { + 0x44, 0x58, 0x42, 0x43, 0x7e, 0x22, 0x8c, 0xc3, 0x6b, 0xf9, 0xa8, 0x10, + 0xf1, 0x5f, 0x55, 0xde, 0x62, 0x56, 0x81, 0x2d, 0x01, 0x00, 0x00, 0x00, + 0x7d, 0x11, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, + 0x50, 0x00, 0x00, 0x00, 0xdb, 0x00, 0x00, 0x00, 0x15, 0x01, 0x00, 0x00, + 0xfd, 0x01, 0x00, 0x00, 0x8d, 0x02, 0x00, 0x00, 0x6d, 0x0a, 0x00, 0x00, + 0x89, 0x0a, 0x00, 0x00, 0x53, 0x46, 0x49, 0x30, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x31, + 0x83, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x53, 0x56, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, + 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x43, 0x4f, 0x4c, + 0x4f, 0x52, 0x00, 0x4f, 0x53, 0x47, 0x31, 0x32, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x00, 0x50, 0x53, 0x56, 0x30, 0xe0, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, + 0xff, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01, 0x00, 0x03, 0x01, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x54, 0x45, + 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x44, + 0x03, 0x03, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x01, 0x42, 0x00, 0x03, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x44, 0x00, 0x03, 0x02, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x44, + 0x10, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, + 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, + 0x00, 0x08, 0x00, 0x00, 0x00, 0x52, 0x54, 0x53, 0x30, 0x88, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, + 0x00, 0x70, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xff, 0xff, 0x53, 0x54, 0x41, 0x54, 0xd8, 0x07, 0x00, + 0x00, 0x60, 0x00, 0x00, 0x00, 0xf6, 0x01, 0x00, 0x00, 0x44, 0x58, 0x49, + 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xc0, 0x07, 0x00, + 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0xed, 0x01, 0x00, + 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, + 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, + 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, + 0x62, 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, + 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x52, 0x88, 0x48, 0x90, 0x14, + 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, + 0x90, 0x91, 0x22, 0xc4, 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, + 0x8a, 0x04, 0x29, 0x46, 0x06, 0x51, 0x18, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, 0x02, 0xa8, + 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x20, 0x6d, 0x30, 0x86, + 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x09, 0xa8, 0x00, 0x49, 0x18, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, 0x4c, 0x08, + 0x06, 0x00, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x4a, 0x00, 0x00, + 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, + 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, + 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x70, 0x33, 0x00, 0xc3, 0x08, 0x04, + 0x30, 0x47, 0x00, 0x06, 0x33, 0xb5, 0xc1, 0x38, 0xb0, 0x43, 0x38, 0xcc, + 0xc3, 0x3c, 0xb8, 0x01, 0x2d, 0x94, 0x03, 0x3e, 0xd0, 0x43, 0x3d, 0xc8, + 0x43, 0x39, 0xc8, 0x01, 0x29, 0xf0, 0x81, 0x3d, 0x94, 0xc3, 0x38, 0xd0, + 0xc3, 0x3b, 0xc8, 0x03, 0x1f, 0x98, 0x03, 0x3b, 0xbc, 0x43, 0x38, 0xd0, + 0x03, 0x1b, 0x80, 0x01, 0x1d, 0xf8, 0x01, 0x18, 0xf8, 0x81, 0x1e, 0xe8, + 0x41, 0x3b, 0xa4, 0x03, 0x3c, 0xcc, 0xc3, 0x2f, 0xd0, 0x43, 0x3e, 0xc0, + 0x43, 0x39, 0xa0, 0x40, 0xcc, 0x24, 0x06, 0xe3, 0xc0, 0x0e, 0xe1, 0x30, + 0x0f, 0xf3, 0xe0, 0x06, 0xb4, 0x50, 0x0e, 0xf8, 0x40, 0x0f, 0xf5, 0x20, + 0x0f, 0xe5, 0x20, 0x07, 0xa4, 0xc0, 0x07, 0xf6, 0x50, 0x0e, 0xe3, 0x40, + 0x0f, 0xef, 0x20, 0x0f, 0x7c, 0x60, 0x0e, 0xec, 0xf0, 0x0e, 0xe1, 0x40, + 0x0f, 0x6c, 0x00, 0x06, 0x74, 0xe0, 0x07, 0x60, 0xe0, 0x07, 0x48, 0x08, + 0x83, 0xc8, 0x4d, 0xd2, 0x14, 0x51, 0xc2, 0xe4, 0xb3, 0x00, 0xf3, 0x2c, + 0x44, 0xc4, 0x4e, 0xc0, 0x44, 0xa0, 0x40, 0x90, 0x19, 0x01, 0x28, 0x01, + 0xa2, 0x34, 0x47, 0x80, 0x14, 0x03, 0x08, 0x21, 0x96, 0x20, 0x56, 0x0c, + 0x24, 0x84, 0x58, 0x80, 0xdc, 0x4d, 0xc3, 0xe5, 0x4f, 0xd8, 0x43, 0x48, + 0xfe, 0x4a, 0x48, 0x2b, 0x31, 0xf9, 0xc5, 0x6d, 0xa3, 0x02, 0x00, 0x00, + 0x04, 0xad, 0x7b, 0x86, 0xcb, 0x9f, 0xb0, 0x87, 0x90, 0xfc, 0x10, 0x68, + 0x86, 0x85, 0x40, 0x41, 0x2c, 0x0c, 0x14, 0x52, 0x02, 0x00, 0x80, 0x10, + 0x02, 0xd0, 0x9c, 0x23, 0x08, 0x8a, 0x21, 0xc5, 0x12, 0xa2, 0x92, 0x1d, + 0x08, 0x18, 0x46, 0x10, 0x80, 0xbb, 0xa4, 0x29, 0xa2, 0x84, 0xc9, 0x4f, + 0x91, 0x8b, 0x58, 0xd8, 0x03, 0x18, 0x88, 0x48, 0x6c, 0x1e, 0x6a, 0x42, + 0x43, 0xc8, 0x21, 0x1d, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x14, 0x72, + 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, 0x79, 0x68, 0x03, 0x72, + 0xc0, 0x87, 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, 0x0e, 0x7a, 0x50, 0x0e, + 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, + 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, + 0x78, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, + 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, + 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, + 0x74, 0xd0, 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, 0x07, + 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, + 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0xe0, 0x0e, + 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, + 0x76, 0x40, 0x07, 0x3a, 0x0f, 0x64, 0x90, 0x21, 0x23, 0x45, 0x44, 0x00, + 0x72, 0x00, 0xc0, 0xf4, 0x00, 0x80, 0x87, 0x3c, 0x09, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x79, 0x18, 0x20, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xf2, 0x38, 0x40, + 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xe4, 0x99, + 0x80, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xc8, + 0x63, 0x01, 0x01, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, + 0x16, 0x08, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, + 0x18, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, + 0x5a, 0x05, 0x42, 0xa2, 0x04, 0x46, 0x00, 0x8a, 0xa1, 0x08, 0x4a, 0xa2, + 0x50, 0xca, 0xa0, 0x1c, 0x0a, 0xa4, 0x10, 0x4a, 0xa1, 0xc0, 0x0a, 0xa8, + 0x3c, 0x8a, 0x85, 0x56, 0x11, 0x8c, 0x00, 0x14, 0x42, 0x19, 0x94, 0x04, + 0x9d, 0x19, 0x00, 0x2a, 0x33, 0x00, 0x44, 0x66, 0x00, 0x68, 0xcc, 0x00, + 0x50, 0x98, 0x01, 0x20, 0x3d, 0x03, 0x40, 0x7b, 0x2c, 0x87, 0x21, 0x00, + 0x00, 0x00, 0x9e, 0x07, 0x00, 0x02, 0x81, 0x40, 0x00, 0x79, 0x18, 0x00, + 0x00, 0xb7, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, + 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b, 0x93, 0x9b, + 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1, 0x0b, 0x3b, + 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, 0x0a, 0x9a, 0x2a, 0xfa, 0x9a, 0xb9, + 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, 0x63, 0x4b, 0xd9, 0x10, 0x04, 0x13, + 0x04, 0x01, 0x99, 0x20, 0x08, 0xc9, 0x06, 0x61, 0x20, 0x36, 0x08, 0x04, + 0x41, 0x01, 0x6e, 0x6e, 0x82, 0x20, 0x28, 0x1b, 0x86, 0x03, 0x21, 0x26, + 0x08, 0x45, 0x47, 0x85, 0x0e, 0xad, 0x8c, 0xaa, 0x0c, 0x8f, 0xae, 0x4e, + 0xae, 0x6c, 0x82, 0x20, 0x2c, 0x13, 0x04, 0x81, 0xd9, 0x20, 0x10, 0xcd, + 0x86, 0x84, 0x50, 0x16, 0x82, 0x18, 0x18, 0xc2, 0xd9, 0x10, 0x3c, 0x13, + 0x84, 0x83, 0xa3, 0x42, 0x87, 0x56, 0x36, 0x15, 0xd6, 0x06, 0xc7, 0x56, + 0x26, 0xb7, 0x01, 0x21, 0x22, 0x89, 0x20, 0x06, 0x02, 0xd8, 0x10, 0x4c, + 0x1b, 0x08, 0x08, 0x00, 0xa8, 0x09, 0x02, 0xe1, 0x4d, 0x10, 0x84, 0x86, + 0x01, 0xda, 0x04, 0x41, 0x70, 0x26, 0x08, 0xc2, 0xb3, 0xc1, 0x40, 0xb0, + 0x8c, 0xd0, 0x1a, 0x12, 0x6d, 0x69, 0x70, 0x73, 0x13, 0x04, 0x01, 0xda, + 0x40, 0x20, 0x5c, 0xd6, 0x4d, 0x10, 0x02, 0x30, 0xd8, 0x20, 0x10, 0xdf, + 0x86, 0x00, 0x0c, 0x36, 0x08, 0x44, 0x18, 0x6c, 0x20, 0xae, 0xcd, 0x13, + 0x83, 0x09, 0xc2, 0xf0, 0x4d, 0x10, 0x84, 0x88, 0x06, 0x5a, 0x98, 0x1b, + 0x19, 0x5b, 0xd9, 0x04, 0x41, 0x90, 0x36, 0x18, 0x88, 0x19, 0x64, 0x84, + 0x76, 0x06, 0x1b, 0x84, 0x32, 0x40, 0x83, 0x09, 0x82, 0x16, 0x06, 0x13, + 0x04, 0x61, 0xe2, 0x00, 0xf7, 0x36, 0xc7, 0x65, 0xca, 0xea, 0x0b, 0xea, + 0x69, 0x2a, 0x89, 0x2a, 0xe9, 0xc9, 0x69, 0x03, 0x82, 0xb0, 0x41, 0x46, + 0x94, 0x41, 0x1b, 0x68, 0x0d, 0x07, 0xba, 0x32, 0x3c, 0x26, 0x54, 0x45, + 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x30, 0x1b, 0x10, 0xe4, 0x0d, 0xb2, + 0xae, 0x0c, 0xe0, 0x40, 0x6b, 0x58, 0x8c, 0xbd, 0xb1, 0xbd, 0xc9, 0x4d, + 0x10, 0x04, 0x8a, 0xc6, 0xd0, 0x13, 0xd3, 0x93, 0x14, 0xcc, 0x06, 0x04, + 0x91, 0x83, 0x6c, 0x0e, 0xca, 0x80, 0x0e, 0xb4, 0x66, 0x03, 0xb1, 0x06, + 0x6e, 0x10, 0x07, 0x75, 0xb0, 0xe1, 0x20, 0xac, 0x31, 0x20, 0x83, 0x34, + 0x50, 0x03, 0x3b, 0x98, 0x20, 0x28, 0xc2, 0x06, 0x60, 0xc3, 0x40, 0xe4, + 0x41, 0x1e, 0x6c, 0x08, 0xf4, 0x60, 0xc3, 0x30, 0xe0, 0xc1, 0x1e, 0x4c, + 0x10, 0x36, 0x31, 0xd8, 0x10, 0xf4, 0x01, 0x89, 0xb6, 0xb0, 0x34, 0x37, + 0x2e, 0x53, 0x56, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x13, 0x84, 0x65, 0x9b, 0x20, 0x2c, 0xda, 0x86, 0x80, 0x98, 0x20, 0x2c, + 0xd9, 0x04, 0x61, 0xc1, 0x36, 0x2c, 0x04, 0x28, 0x84, 0x82, 0x28, 0x8c, + 0x02, 0x29, 0x0c, 0xa4, 0x40, 0x94, 0x02, 0x40, 0x84, 0xaa, 0x08, 0x6b, + 0xe8, 0xe9, 0x49, 0x8a, 0x68, 0x82, 0xb0, 0x5c, 0x1b, 0x84, 0x2c, 0xdb, + 0xb0, 0x0c, 0xa7, 0x10, 0x0a, 0xa5, 0x30, 0x0a, 0xa8, 0x30, 0xa0, 0xc2, + 0x50, 0x0a, 0xa9, 0xc0, 0x62, 0xe8, 0x89, 0xe9, 0x49, 0x6a, 0x82, 0x20, + 0x54, 0x1b, 0x84, 0x8c, 0x15, 0x36, 0x2c, 0xcc, 0x2a, 0x84, 0x42, 0x29, + 0x8c, 0x02, 0x2a, 0x0c, 0xa4, 0xc0, 0x94, 0x42, 0x2b, 0x6c, 0x18, 0x4c, + 0x41, 0x15, 0x5c, 0x81, 0xc9, 0x94, 0xd5, 0x17, 0x55, 0x98, 0xdc, 0x59, + 0x19, 0xdd, 0x04, 0x61, 0x39, 0x36, 0x2c, 0x04, 0x2c, 0x84, 0x42, 0x2c, + 0x8c, 0x42, 0x29, 0x0c, 0xa4, 0x40, 0x94, 0x42, 0x2b, 0x6c, 0x08, 0x64, + 0x61, 0xc3, 0xf0, 0x0a, 0xb3, 0x00, 0x6c, 0x28, 0xf0, 0xe0, 0x0f, 0x68, + 0xa1, 0x02, 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xcd, 0xb1, 0x48, 0x73, + 0x9b, 0xa3, 0x9b, 0x9b, 0x20, 0x08, 0x16, 0x8d, 0xb9, 0xb4, 0xb3, 0x2f, + 0x36, 0x32, 0x1a, 0x73, 0x69, 0x67, 0x5f, 0x73, 0x74, 0x44, 0xe8, 0xca, + 0xf0, 0xbe, 0xdc, 0xde, 0xe4, 0xda, 0x36, 0x28, 0xb6, 0x50, 0x06, 0xb7, + 0x80, 0x0b, 0xb9, 0x80, 0xe8, 0x42, 0x19, 0xec, 0xc2, 0x50, 0x85, 0x8d, + 0xcd, 0xae, 0xcd, 0x25, 0x8d, 0xac, 0xcc, 0x8d, 0x6e, 0x4a, 0x10, 0x54, + 0x21, 0xc3, 0x73, 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x9b, 0x12, + 0x10, 0x4d, 0xc8, 0xf0, 0x5c, 0xec, 0xc2, 0xd8, 0xec, 0xca, 0xe4, 0xa6, + 0x04, 0x45, 0x1d, 0x32, 0x3c, 0x97, 0x39, 0xb4, 0x30, 0xb2, 0x32, 0xb9, + 0xa6, 0x37, 0xb2, 0x32, 0xb6, 0x29, 0x01, 0x52, 0x86, 0x0c, 0xcf, 0x45, + 0xae, 0x6c, 0xee, 0xad, 0x4e, 0x6e, 0xac, 0x6c, 0x6e, 0x4a, 0x40, 0x55, + 0x22, 0xc3, 0x73, 0xa1, 0xcb, 0x83, 0x2b, 0x0b, 0x72, 0x73, 0x7b, 0xa3, + 0x0b, 0xa3, 0x4b, 0x7b, 0x73, 0x9b, 0x9b, 0x22, 0xd8, 0xc1, 0x1e, 0xd4, + 0x21, 0xc3, 0x73, 0xb1, 0x4b, 0x2b, 0xbb, 0x4b, 0x22, 0x9b, 0xa2, 0x0b, + 0xa3, 0x2b, 0x9b, 0x12, 0xf4, 0x41, 0x1d, 0x32, 0x3c, 0x97, 0x32, 0x37, + 0x3a, 0xb9, 0x3c, 0xa8, 0xb7, 0x34, 0x37, 0xba, 0xb9, 0x29, 0x01, 0x2d, + 0x74, 0x21, 0xc3, 0x73, 0x19, 0x7b, 0xab, 0x73, 0xa3, 0x2b, 0x93, 0x9b, + 0x9b, 0x12, 0xec, 0x02, 0x00, 0x79, 0x18, 0x00, 0x00, 0x4c, 0x00, 0x00, + 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, + 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, + 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, + 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, + 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, + 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, + 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, + 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, + 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, + 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, + 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, + 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, + 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, + 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, + 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, + 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, + 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, + 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, + 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, + 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, + 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, + 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, + 0xc4, 0x21, 0x07, 0x7c, 0x70, 0x03, 0x7a, 0x28, 0x87, 0x76, 0x80, 0x87, + 0x19, 0xd1, 0x43, 0x0e, 0xf8, 0xe0, 0x06, 0xe4, 0x20, 0x0e, 0xe7, 0xe0, + 0x06, 0xf6, 0x10, 0x0e, 0xf2, 0xc0, 0x0e, 0xe1, 0x90, 0x0f, 0xef, 0x50, + 0x0f, 0xf4, 0x00, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x24, 0x00, 0x00, + 0x00, 0x15, 0xf0, 0x05, 0x7e, 0x74, 0x74, 0x79, 0x1a, 0x6e, 0xc3, 0xd9, + 0x65, 0x39, 0x10, 0x38, 0xab, 0x4e, 0xc3, 0x6d, 0x38, 0xbb, 0x2c, 0x9f, + 0xd2, 0xc3, 0xf4, 0x32, 0x10, 0x18, 0x2c, 0x80, 0x37, 0x08, 0xfc, 0xe8, + 0xe8, 0x32, 0xb5, 0x8c, 0xa7, 0xd7, 0xe5, 0x65, 0x20, 0x70, 0x66, 0xfd, + 0x91, 0xa8, 0x65, 0x3c, 0xbd, 0x2e, 0x2f, 0xcb, 0x88, 0x40, 0xeb, 0x8f, + 0x64, 0x2f, 0x8f, 0xe9, 0x6f, 0x39, 0xb0, 0x49, 0x82, 0xcd, 0x80, 0x40, + 0x20, 0x30, 0x68, 0x06, 0xd2, 0x70, 0xf9, 0xce, 0xe3, 0x0b, 0x11, 0x01, + 0x4c, 0x44, 0x08, 0x34, 0xc3, 0x42, 0xd8, 0xc0, 0x34, 0x5c, 0xbe, 0xf3, + 0xf8, 0x8b, 0x03, 0x0c, 0x62, 0xf3, 0x50, 0x93, 0x5f, 0xdc, 0xb6, 0x15, + 0x40, 0xc3, 0xe5, 0x3b, 0x8f, 0x2f, 0x01, 0xcc, 0xb3, 0x10, 0x7e, 0x71, + 0xdb, 0x46, 0x50, 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x34, 0x39, 0x11, 0x81, + 0x52, 0xd3, 0x43, 0x4d, 0x7e, 0x71, 0xdb, 0x26, 0x40, 0x30, 0x00, 0xd2, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x41, 0x53, 0x48, 0x14, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0xa4, 0x51, 0x7f, 0xb4, 0x3e, 0x6a, + 0xe5, 0x04, 0x66, 0x2e, 0x73, 0x80, 0x43, 0xf2, 0xb2, 0x44, 0x58, 0x49, + 0x4c, 0xec, 0x06, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xbb, 0x01, 0x00, + 0x00, 0x44, 0x58, 0x49, 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0xd4, 0x06, 0x00, 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, + 0x00, 0xb2, 0x01, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, + 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, + 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, + 0x42, 0xa4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x52, + 0x88, 0x48, 0x90, 0x14, 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, + 0x42, 0xe4, 0x48, 0x0e, 0x90, 0x91, 0x22, 0xc4, 0x50, 0x41, 0x51, 0x81, + 0x8c, 0xe1, 0x83, 0xe5, 0x8a, 0x04, 0x29, 0x46, 0x06, 0x51, 0x18, 0x00, + 0x00, 0x08, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, + 0x07, 0x40, 0x02, 0xa8, 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, + 0x20, 0x6d, 0x30, 0x86, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x09, 0xa8, + 0x00, 0x49, 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, + 0x42, 0x20, 0x4c, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, + 0x00, 0x43, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, + 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, + 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x68, 0x23, + 0x00, 0x25, 0x00, 0x14, 0x66, 0x00, 0xe6, 0x08, 0xc0, 0x60, 0x8e, 0x00, + 0x29, 0xc6, 0x20, 0x84, 0x14, 0x42, 0xa6, 0x18, 0x80, 0x10, 0x52, 0x06, + 0xa1, 0x9b, 0x86, 0xcb, 0x9f, 0xb0, 0x87, 0x90, 0xfc, 0x95, 0x90, 0x56, + 0x62, 0xf2, 0x8b, 0xdb, 0x46, 0xc5, 0x18, 0x63, 0x10, 0x2a, 0xf7, 0x0c, + 0x97, 0x3f, 0x61, 0x0f, 0x21, 0xf9, 0x21, 0xd0, 0x0c, 0x0b, 0x81, 0x82, + 0x55, 0x18, 0x45, 0x18, 0x1b, 0x63, 0x0c, 0x42, 0xc8, 0xa0, 0x36, 0x47, + 0x10, 0x14, 0x83, 0x91, 0x42, 0xc8, 0x23, 0x38, 0x10, 0x30, 0x8c, 0x40, + 0x0c, 0x33, 0xb5, 0xc1, 0x38, 0xb0, 0x43, 0x38, 0xcc, 0xc3, 0x3c, 0xb8, + 0x01, 0x2d, 0x94, 0x03, 0x3e, 0xd0, 0x43, 0x3d, 0xc8, 0x43, 0x39, 0xc8, + 0x01, 0x29, 0xf0, 0x81, 0x3d, 0x94, 0xc3, 0x38, 0xd0, 0xc3, 0x3b, 0xc8, + 0x03, 0x1f, 0x98, 0x03, 0x3b, 0xbc, 0x43, 0x38, 0xd0, 0x03, 0x1b, 0x80, + 0x01, 0x1d, 0xf8, 0x01, 0x18, 0xf8, 0x81, 0x1e, 0xe8, 0x41, 0x3b, 0xa4, + 0x03, 0x3c, 0xcc, 0xc3, 0x2f, 0xd0, 0x43, 0x3e, 0xc0, 0x43, 0x39, 0xa0, + 0x80, 0xcc, 0x24, 0x06, 0xe3, 0xc0, 0x0e, 0xe1, 0x30, 0x0f, 0xf3, 0xe0, + 0x06, 0xb4, 0x50, 0x0e, 0xf8, 0x40, 0x0f, 0xf5, 0x20, 0x0f, 0xe5, 0x20, + 0x07, 0xa4, 0xc0, 0x07, 0xf6, 0x50, 0x0e, 0xe3, 0x40, 0x0f, 0xef, 0x20, + 0x0f, 0x7c, 0x60, 0x0e, 0xec, 0xf0, 0x0e, 0xe1, 0x40, 0x0f, 0x6c, 0x00, + 0x06, 0x74, 0xe0, 0x07, 0x60, 0xe0, 0x07, 0x48, 0x98, 0x94, 0xea, 0x4d, + 0xd2, 0x14, 0x51, 0xc2, 0xe4, 0xb3, 0x00, 0xf3, 0x2c, 0x44, 0xc4, 0x4e, + 0xc0, 0x44, 0xa0, 0x80, 0xd0, 0x4d, 0x07, 0x02, 0x00, 0x13, 0x14, 0x72, + 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, 0x79, 0x68, 0x03, 0x72, + 0xc0, 0x87, 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, 0x0e, 0x7a, 0x50, 0x0e, + 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, + 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, + 0x78, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, + 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, + 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, + 0x74, 0xd0, 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, 0x07, + 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, + 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0xe0, 0x0e, + 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, + 0x76, 0x40, 0x07, 0x43, 0x9e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x86, 0x3c, 0x06, 0x10, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x79, 0x10, 0x20, 0x00, 0x04, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xf2, 0x34, 0x40, 0x00, 0x0c, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xe4, 0x81, 0x80, 0x00, + 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x0b, 0x04, 0x00, + 0x00, 0x0f, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, + 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x22, 0x25, 0x30, 0x02, + 0x50, 0x0c, 0x45, 0x50, 0x12, 0x65, 0x50, 0x1e, 0x54, 0x4a, 0xa2, 0x0c, + 0x0a, 0x61, 0x04, 0xa0, 0x08, 0x0a, 0x84, 0xec, 0x0c, 0x00, 0xe1, 0x19, + 0x00, 0xca, 0x63, 0x39, 0x0c, 0x01, 0x00, 0x00, 0xf0, 0x3c, 0x00, 0x10, + 0x08, 0x04, 0x02, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x63, 0x00, 0x00, + 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, 0x44, 0x35, 0x18, 0x63, + 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x03, + 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1, 0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, + 0x62, 0x2a, 0x0a, 0x9a, 0x2a, 0xfa, 0x9a, 0xb9, 0x81, 0x79, 0x31, 0x4b, + 0x73, 0x0b, 0x63, 0x4b, 0xd9, 0x10, 0x04, 0x13, 0x04, 0xa2, 0x98, 0x20, + 0x10, 0xc6, 0x06, 0x61, 0x20, 0x26, 0x08, 0xc4, 0xb1, 0x41, 0x18, 0x0c, + 0x0a, 0x70, 0x73, 0x1b, 0x06, 0xc4, 0x20, 0x26, 0x08, 0x96, 0x44, 0x60, + 0x82, 0x40, 0x20, 0x13, 0x04, 0x22, 0xd9, 0x20, 0x10, 0xcd, 0x86, 0x84, + 0x50, 0x16, 0x82, 0x18, 0x18, 0xc2, 0xd9, 0x10, 0x3c, 0x13, 0x04, 0x6c, + 0xda, 0x80, 0x10, 0xd1, 0x42, 0x10, 0x03, 0x01, 0x6c, 0x08, 0xa4, 0x0d, + 0x04, 0x04, 0x00, 0xd3, 0x04, 0x21, 0xa3, 0x36, 0x04, 0xd5, 0x04, 0x41, + 0x00, 0x48, 0xb4, 0x85, 0xa5, 0xb9, 0x71, 0x99, 0xb2, 0xfa, 0x82, 0x7a, + 0x9b, 0x4b, 0xa3, 0x4b, 0x7b, 0x73, 0x9b, 0x20, 0x14, 0xcc, 0x04, 0xa1, + 0x68, 0x36, 0x04, 0xc4, 0x04, 0xa1, 0x70, 0x26, 0x08, 0xc5, 0xb3, 0x61, + 0x21, 0x32, 0x6d, 0xe3, 0xba, 0xa1, 0x23, 0x3c, 0x80, 0x08, 0x55, 0x11, + 0xd6, 0xd0, 0xd3, 0x93, 0x14, 0xd1, 0x04, 0xa1, 0x80, 0x26, 0x08, 0x84, + 0xb2, 0x41, 0x10, 0x03, 0x31, 0xd8, 0xb0, 0x0c, 0x60, 0xa0, 0x79, 0x5c, + 0x18, 0x0c, 0x61, 0x30, 0x78, 0x63, 0xc0, 0x62, 0xe8, 0x89, 0xe9, 0x49, + 0x6a, 0x82, 0x40, 0x2c, 0x1b, 0x04, 0x31, 0x30, 0x83, 0x0d, 0x0b, 0x53, + 0x06, 0x9a, 0xc7, 0x85, 0xc1, 0xd0, 0x31, 0xde, 0x19, 0x6c, 0x18, 0x3e, + 0x32, 0x40, 0x03, 0x26, 0x53, 0x56, 0x5f, 0x54, 0x61, 0x72, 0x67, 0x65, + 0x74, 0x13, 0x84, 0x22, 0xda, 0xb0, 0x10, 0x6a, 0xa0, 0xad, 0x01, 0xe7, + 0x0d, 0x1d, 0xe1, 0x9d, 0xc1, 0x86, 0x80, 0x0d, 0x36, 0x0c, 0x69, 0xd0, + 0x06, 0xc0, 0x86, 0xe2, 0xc2, 0xdc, 0x80, 0x02, 0xaa, 0xb0, 0xb1, 0xd9, + 0xb5, 0xb9, 0xa4, 0x91, 0x95, 0xb9, 0xd1, 0x4d, 0x09, 0x82, 0x2a, 0x64, + 0x78, 0x2e, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x02, 0xa2, + 0x09, 0x19, 0x9e, 0x8b, 0x5d, 0x18, 0x9b, 0x5d, 0x99, 0xdc, 0x94, 0xc0, + 0xa8, 0x43, 0x86, 0xe7, 0x32, 0x87, 0x16, 0x46, 0x56, 0x26, 0xd7, 0xf4, + 0x46, 0x56, 0xc6, 0x36, 0x25, 0x40, 0xca, 0x90, 0xe1, 0xb9, 0xc8, 0x95, + 0xcd, 0xbd, 0xd5, 0xc9, 0x8d, 0x95, 0xcd, 0x4d, 0x09, 0xa6, 0x3a, 0x64, + 0x78, 0x2e, 0x76, 0x69, 0x65, 0x77, 0x49, 0x64, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x53, 0x82, 0xaa, 0x0e, 0x19, 0x9e, 0x4b, 0x99, 0x1b, 0x9d, 0x5c, + 0x1e, 0xd4, 0x5b, 0x9a, 0x1b, 0xdd, 0xdc, 0x94, 0xc0, 0x0d, 0x00, 0x00, + 0x00, 0x79, 0x18, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, + 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, + 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, + 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, + 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, + 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, + 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, + 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, + 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, + 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, + 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, + 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, + 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, + 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, + 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, + 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, + 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, + 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, + 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, + 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, + 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, + 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, + 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc4, 0x21, 0x07, 0x7c, + 0x70, 0x03, 0x7a, 0x28, 0x87, 0x76, 0x80, 0x87, 0x19, 0xd1, 0x43, 0x0e, + 0xf8, 0xe0, 0x06, 0xe4, 0x20, 0x0e, 0xe7, 0xe0, 0x06, 0xf6, 0x10, 0x0e, + 0xf2, 0xc0, 0x0e, 0xe1, 0x90, 0x0f, 0xef, 0x50, 0x0f, 0xf4, 0x00, 0x00, + 0x00, 0x71, 0x20, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x46, 0x20, 0x0d, + 0x97, 0xef, 0x3c, 0xbe, 0x10, 0x11, 0xc0, 0x44, 0x84, 0x40, 0x33, 0x2c, + 0x84, 0x05, 0x4c, 0xc3, 0xe5, 0x3b, 0x8f, 0xbf, 0x38, 0xc0, 0x20, 0x36, + 0x0f, 0x35, 0xf9, 0xc5, 0x6d, 0xdb, 0x00, 0x34, 0x5c, 0xbe, 0xf3, 0xf8, + 0x12, 0xc0, 0x3c, 0x0b, 0xe1, 0x17, 0xb7, 0x6d, 0x02, 0xd5, 0x70, 0xf9, + 0xce, 0xe3, 0x4b, 0x93, 0x13, 0x11, 0x28, 0x35, 0x3d, 0xd4, 0xe4, 0x17, + 0xb7, 0x6d, 0x00, 0x04, 0x03, 0x20, 0x0d, 0x00, 0x00, 0x61, 0x20, 0x00, + 0x00, 0x3a, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, 0x10, 0x00, 0x00, + 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x46, 0x00, 0x88, 0xcc, 0x00, 0x14, + 0x42, 0x29, 0x94, 0x5c, 0xe1, 0x51, 0x29, 0x01, 0x1a, 0x33, 0x00, 0x00, + 0x00, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x00, 0x65, 0x84, 0x73, 0x5d, + 0xc8, 0x88, 0x41, 0x02, 0x80, 0x20, 0x18, 0x40, 0x5a, 0x11, 0x61, 0x58, + 0x32, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x86, 0x87, 0x5c, 0x19, 0x94, + 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, 0x81, 0xf1, 0x25, 0x98, 0x56, 0x28, + 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0x80, 0x81, 0x92, 0x6d, 0xd1, + 0x32, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x46, 0x18, 0x2c, 0x1a, 0x57, + 0x31, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0x88, 0x01, 0xe3, 0x75, + 0x54, 0x33, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0xc6, 0x18, 0x34, 0x9f, + 0x97, 0x38, 0x23, 0x06, 0x0f, 0x00, 0x82, 0x60, 0xd0, 0x88, 0xc1, 0x82, + 0x1c, 0x42, 0x90, 0x24, 0xdf, 0xf7, 0x24, 0xa3, 0x09, 0x01, 0x30, 0x9a, + 0x20, 0x04, 0xa3, 0x09, 0x83, 0x30, 0x9a, 0x40, 0x0c, 0x46, 0x2c, 0xf2, + 0x31, 0x62, 0x91, 0x8f, 0x11, 0x8b, 0x7c, 0x8c, 0x58, 0xe4, 0x33, 0x62, + 0x90, 0x00, 0x20, 0x08, 0x06, 0x08, 0x1b, 0x58, 0x68, 0x80, 0x06, 0x1f, + 0x31, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x08, 0x1b, 0x58, 0x68, 0x80, + 0x06, 0xd3, 0x30, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x08, 0x1b, 0x58, + 0x68, 0x80, 0x06, 0x9e, 0x30, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x08, + 0x1b, 0x58, 0x68, 0x80, 0x06, 0x61, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, + 0x00 +}; + +/* The yuv-rendering pixel shader: + + --- D3D12_PixelShader_YUV_JPEG.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureU : register(t1); + Texture2D theTextureV : register(t2); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + #define YUVRS \ + "RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \ + " DENY_DOMAIN_SHADER_ROOT_ACCESS |" \ + " DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \ + " DENY_HULL_SHADER_ROOT_ACCESS )," \ + "RootConstants(num32BitConstants=32, b0),"\ + "DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( SRV(t2), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )" + + [RootSignature(YUVRS)] + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {0.0, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.0000, 0.0000, 1.4020}; + const float3 Gcoeff = {1.0000, -0.3441, -0.7141}; + const float3 Bcoeff = {1.0000, 1.7720, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.y = theTextureU.Sample(theSampler, input.tex).r; + yuv.z = theTextureV.Sample(theSampler, input.tex).r; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ + +static unsigned char D3D12_PixelShader_YUV_JPEG[] = { + 0x44, 0x58, 0x42, 0x43, 0xb1, 0xef, 0x39, 0xc1, 0xc8, 0x72, 0xbb, 0xb0, + 0x20, 0x73, 0xd6, 0x2a, 0xc9, 0xba, 0xcb, 0x70, 0x01, 0x00, 0x00, 0x00, + 0x95, 0x13, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, + 0x50, 0x00, 0x00, 0x00, 0xdb, 0x00, 0x00, 0x00, 0x15, 0x01, 0x00, 0x00, + 0x1d, 0x02, 0x00, 0x00, 0x05, 0x03, 0x00, 0x00, 0x9d, 0x0b, 0x00, 0x00, + 0xb9, 0x0b, 0x00, 0x00, 0x53, 0x46, 0x49, 0x30, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x31, + 0x83, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x53, 0x56, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, + 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x43, 0x4f, 0x4c, + 0x4f, 0x52, 0x00, 0x4f, 0x53, 0x47, 0x31, 0x32, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x00, 0x50, 0x53, 0x56, 0x30, 0x00, 0x01, 0x00, 0x00, 0x24, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, + 0xff, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01, 0x00, 0x03, 0x01, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, + 0x52, 0x44, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x44, 0x03, 0x03, 0x04, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x42, + 0x00, 0x03, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x02, 0x44, 0x00, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x44, 0x10, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x52, 0x54, 0x53, 0x30, 0xe0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x05, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xe0, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x05, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x05, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x05, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x05, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, + 0xff, 0x01, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, + 0x00, 0xc8, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xff, 0xff, 0x53, 0x54, 0x41, 0x54, 0x90, 0x08, 0x00, + 0x00, 0x60, 0x00, 0x00, 0x00, 0x24, 0x02, 0x00, 0x00, 0x44, 0x58, 0x49, + 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x78, 0x08, 0x00, + 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0x1b, 0x02, 0x00, + 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, + 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, + 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, + 0x62, 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, + 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x52, 0x88, 0x48, 0x90, 0x14, + 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, + 0x90, 0x91, 0x22, 0xc4, 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, + 0x8a, 0x04, 0x29, 0x46, 0x06, 0x51, 0x18, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, 0x02, 0xa8, + 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x20, 0x6d, 0x30, 0x86, + 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x09, 0xa8, 0x00, 0x49, 0x18, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, 0x4c, 0x08, + 0x06, 0x00, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x4b, 0x00, 0x00, + 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, + 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, + 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x78, 0x33, 0x00, 0xc3, 0x08, 0x04, + 0x30, 0x47, 0x00, 0x06, 0x33, 0xb5, 0xc1, 0x38, 0xb0, 0x43, 0x38, 0xcc, + 0xc3, 0x3c, 0xb8, 0x01, 0x2d, 0x94, 0x03, 0x3e, 0xd0, 0x43, 0x3d, 0xc8, + 0x43, 0x39, 0xc8, 0x01, 0x29, 0xf0, 0x81, 0x3d, 0x94, 0xc3, 0x38, 0xd0, + 0xc3, 0x3b, 0xc8, 0x03, 0x1f, 0x98, 0x03, 0x3b, 0xbc, 0x43, 0x38, 0xd0, + 0x03, 0x1b, 0x80, 0x01, 0x1d, 0xf8, 0x01, 0x18, 0xf8, 0x81, 0x1e, 0xe8, + 0x41, 0x3b, 0xa4, 0x03, 0x3c, 0xcc, 0xc3, 0x2f, 0xd0, 0x43, 0x3e, 0xc0, + 0x43, 0x39, 0xa0, 0x40, 0xcc, 0x24, 0x06, 0xe3, 0xc0, 0x0e, 0xe1, 0x30, + 0x0f, 0xf3, 0xe0, 0x06, 0xb4, 0x50, 0x0e, 0xf8, 0x40, 0x0f, 0xf5, 0x20, + 0x0f, 0xe5, 0x20, 0x07, 0xa4, 0xc0, 0x07, 0xf6, 0x50, 0x0e, 0xe3, 0x40, + 0x0f, 0xef, 0x20, 0x0f, 0x7c, 0x60, 0x0e, 0xec, 0xf0, 0x0e, 0xe1, 0x40, + 0x0f, 0x6c, 0x00, 0x06, 0x74, 0xe0, 0x07, 0x60, 0xe0, 0x07, 0x48, 0x08, + 0x83, 0xc8, 0x4d, 0xd2, 0x14, 0x51, 0xc2, 0xe4, 0xb3, 0x00, 0xf3, 0x2c, + 0x44, 0xc4, 0x4e, 0xc0, 0x44, 0xa0, 0x40, 0x90, 0x19, 0x01, 0x28, 0x01, + 0xa2, 0x34, 0x47, 0x80, 0x14, 0x03, 0x08, 0x21, 0x96, 0x20, 0x56, 0x0c, + 0x24, 0x84, 0x58, 0x80, 0xdc, 0x4d, 0xc3, 0xe5, 0x4f, 0xd8, 0x43, 0x48, + 0xfe, 0x4a, 0x48, 0x2b, 0x31, 0xf9, 0xc5, 0x6d, 0xa3, 0x02, 0x00, 0x00, + 0x04, 0xad, 0x7b, 0x86, 0xcb, 0x9f, 0xb0, 0x87, 0x90, 0xfc, 0x10, 0x68, + 0x86, 0x85, 0x40, 0x41, 0x2c, 0x0c, 0x14, 0x52, 0x02, 0x00, 0x80, 0x10, + 0x02, 0xd0, 0x2c, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0xd5, 0x39, 0x82, + 0xa0, 0x18, 0x52, 0x2c, 0x21, 0x2e, 0xe1, 0x81, 0x80, 0x61, 0x04, 0x01, + 0xb8, 0x4b, 0x9a, 0x22, 0x4a, 0x98, 0xfc, 0x14, 0xb9, 0x88, 0x85, 0x3d, + 0x80, 0x81, 0x88, 0xc4, 0xe6, 0xa1, 0x26, 0x34, 0x84, 0x1d, 0xd2, 0x41, + 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, + 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, + 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, + 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x3a, 0x0f, 0x64, 0x90, 0x21, + 0x23, 0x45, 0x44, 0x00, 0x72, 0x00, 0xc0, 0xe4, 0x00, 0x80, 0xc9, 0x01, + 0x00, 0xd3, 0x03, 0x00, 0x1e, 0xf2, 0x24, 0x40, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xe4, 0x61, 0x80, 0x00, 0x08, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xc8, 0xe3, 0x00, 0x01, 0x20, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x90, 0x67, 0x02, 0x02, + 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x21, 0x4f, 0x05, + 0x04, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x1e, + 0x0c, 0x08, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb2, + 0x40, 0x16, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x18, 0x19, 0x11, 0x4c, + 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x5a, 0x05, 0x42, 0xa2, + 0x04, 0x46, 0x00, 0x8a, 0xa1, 0x08, 0x4a, 0xa2, 0x50, 0xca, 0xa0, 0x1c, + 0x0a, 0xa4, 0x10, 0x4a, 0xa1, 0xc0, 0x0a, 0xa8, 0x3c, 0x0a, 0xa2, 0x74, + 0x68, 0x15, 0xc1, 0x08, 0x40, 0x21, 0x94, 0x41, 0x49, 0xd0, 0x99, 0x01, + 0xa0, 0x32, 0x03, 0x40, 0x64, 0x06, 0x80, 0xc6, 0x0c, 0x00, 0x85, 0x19, + 0x00, 0xe2, 0x33, 0x00, 0xd4, 0xc7, 0x72, 0x18, 0x02, 0x00, 0x00, 0xe0, + 0x38, 0x00, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, + 0x00, 0xc5, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, + 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b, 0x93, 0x9b, + 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1, 0x0b, 0x3b, + 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, 0x0a, 0x9a, 0x2a, 0xfa, 0x9a, 0xb9, + 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, 0x63, 0x4b, 0xd9, 0x10, 0x04, 0x13, + 0x04, 0x61, 0x99, 0x20, 0x08, 0xcc, 0x06, 0x61, 0x20, 0x36, 0x08, 0x04, + 0x41, 0x01, 0x6e, 0x6e, 0x82, 0x20, 0x34, 0x1b, 0x86, 0x03, 0x21, 0x26, + 0x08, 0x45, 0x18, 0x70, 0xa1, 0x43, 0x2b, 0xa3, 0x2a, 0xc3, 0xa3, 0xab, + 0x93, 0x2b, 0xcb, 0x9a, 0x20, 0x08, 0xce, 0x04, 0x41, 0x78, 0x36, 0x08, + 0x44, 0xb3, 0x21, 0x21, 0x94, 0x85, 0x20, 0x06, 0x86, 0x70, 0xb8, 0xd0, + 0xa1, 0x95, 0x51, 0x95, 0xe1, 0xd1, 0xd5, 0xc9, 0x95, 0x55, 0x6d, 0x48, + 0x06, 0x05, 0x22, 0x86, 0x81, 0x21, 0x1c, 0x2e, 0x74, 0x68, 0x65, 0x54, + 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x56, 0x1b, 0x12, 0x46, 0x91, 0x08, + 0x66, 0x60, 0x08, 0x67, 0xc3, 0xf0, 0x44, 0xd3, 0x04, 0xe1, 0x00, 0x03, + 0x2a, 0x74, 0x68, 0x65, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x1b, + 0x10, 0xa2, 0xb2, 0x08, 0x62, 0x20, 0x80, 0x0d, 0xc1, 0xb5, 0x81, 0xa0, + 0x00, 0x00, 0x9b, 0x20, 0x10, 0x62, 0x30, 0x41, 0x10, 0x20, 0x06, 0x68, + 0x13, 0x04, 0x21, 0x9a, 0x20, 0x08, 0xd2, 0x06, 0x03, 0xe1, 0x3a, 0xc2, + 0x6b, 0x48, 0xb4, 0xa5, 0xc1, 0xcd, 0x4d, 0x10, 0x84, 0x69, 0x03, 0x81, + 0x80, 0x41, 0x17, 0x06, 0x13, 0x84, 0x80, 0x0c, 0x36, 0x08, 0xc4, 0x18, + 0x6c, 0x08, 0xc8, 0x60, 0x83, 0x40, 0x94, 0xc1, 0x06, 0x62, 0xfb, 0xc4, + 0xc0, 0x0c, 0x26, 0x08, 0xc3, 0x18, 0x4c, 0x10, 0x04, 0x8a, 0x06, 0x5a, + 0x98, 0x1b, 0x19, 0x5b, 0xd9, 0x04, 0x41, 0xa8, 0x36, 0x18, 0x88, 0x1a, + 0x74, 0x84, 0xb7, 0x06, 0x1b, 0x84, 0x34, 0x60, 0x83, 0x09, 0x02, 0x57, + 0x06, 0x13, 0x04, 0xc1, 0xe2, 0x00, 0xf7, 0x36, 0xc7, 0x65, 0xca, 0xea, + 0x0b, 0xea, 0x69, 0x2a, 0x89, 0x2a, 0xe9, 0xc9, 0x69, 0x03, 0x82, 0xc0, + 0x41, 0x47, 0xa4, 0x41, 0x1c, 0x78, 0x0d, 0x07, 0xba, 0x32, 0x3c, 0x26, + 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x30, 0x1b, 0x10, 0x64, + 0x0e, 0xba, 0x30, 0x48, 0x03, 0x3a, 0xf0, 0x1a, 0x16, 0x63, 0x6f, 0x6c, + 0x6f, 0x72, 0x13, 0x04, 0xe1, 0xa2, 0x31, 0xf4, 0xc4, 0xf4, 0x24, 0x05, + 0xb3, 0x01, 0x41, 0xec, 0xa0, 0xbb, 0x83, 0x34, 0xc0, 0x03, 0xaf, 0xd9, + 0x40, 0xbc, 0x81, 0x1c, 0xd4, 0x41, 0x1e, 0x6c, 0x38, 0x08, 0xed, 0x0c, + 0xd0, 0xa0, 0x0d, 0xdc, 0x40, 0x0f, 0x26, 0x08, 0x0a, 0xb1, 0x01, 0xd8, + 0x30, 0x10, 0x7d, 0xd0, 0x07, 0x1b, 0x02, 0x3f, 0xd8, 0x30, 0x0c, 0x7c, + 0xf0, 0x07, 0x13, 0x84, 0xce, 0x0c, 0x36, 0x04, 0xa1, 0x40, 0xa2, 0x2d, + 0x2c, 0xcd, 0x8d, 0xcb, 0x94, 0xd5, 0x17, 0xd4, 0xdb, 0x5c, 0x1a, 0x5d, + 0xda, 0x9b, 0xdb, 0x04, 0x61, 0xf9, 0x26, 0x08, 0x8b, 0xb7, 0x21, 0x20, + 0x26, 0x08, 0x4b, 0x37, 0x41, 0x58, 0xb8, 0x0d, 0x0b, 0x41, 0x0a, 0xa5, + 0x60, 0x0a, 0xa7, 0x80, 0x0a, 0x03, 0x2a, 0x10, 0xa9, 0x00, 0x10, 0xa1, + 0x2a, 0xc2, 0x1a, 0x7a, 0x7a, 0x92, 0x22, 0x9a, 0x20, 0x2c, 0xdb, 0x06, + 0xa1, 0xeb, 0x36, 0x2c, 0xc3, 0x2a, 0x94, 0x42, 0x2a, 0x9c, 0x02, 0x2b, + 0x0c, 0xac, 0x30, 0xa4, 0x42, 0x2b, 0xb0, 0x18, 0x7a, 0x62, 0x7a, 0x92, + 0x9a, 0x20, 0x08, 0xd8, 0x06, 0xa1, 0x83, 0x85, 0x0d, 0x0b, 0xf3, 0x0a, + 0xa5, 0x90, 0x0a, 0xa7, 0xc0, 0x0a, 0x03, 0x2a, 0x30, 0xa9, 0x10, 0x0b, + 0x1b, 0x06, 0x55, 0x70, 0x05, 0x59, 0x60, 0x32, 0x65, 0xf5, 0x45, 0x15, + 0x26, 0x77, 0x56, 0x46, 0x37, 0x41, 0x58, 0x94, 0x0d, 0x0b, 0x41, 0x0b, + 0xa5, 0x50, 0x0b, 0xa7, 0x90, 0x0a, 0x03, 0x2a, 0x10, 0xa9, 0x10, 0x0b, + 0x1b, 0x02, 0x5b, 0xd8, 0x30, 0xcc, 0xc2, 0x2d, 0x00, 0x1b, 0x0a, 0x3e, + 0x18, 0x05, 0x5c, 0xc8, 0x00, 0x1a, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x73, + 0x13, 0x04, 0x21, 0x63, 0x91, 0xe6, 0x36, 0x47, 0x37, 0x37, 0x41, 0x10, + 0x34, 0x1a, 0x73, 0x69, 0x67, 0x5f, 0x6c, 0x64, 0x34, 0xe6, 0xd2, 0xce, + 0xbe, 0xe6, 0xe8, 0x88, 0xd0, 0x95, 0xe1, 0x7d, 0xb9, 0xbd, 0xc9, 0xb5, + 0x6d, 0x50, 0x74, 0x61, 0x17, 0x78, 0xa1, 0x17, 0x7c, 0x01, 0xf9, 0x85, + 0x34, 0x00, 0x87, 0xae, 0x0a, 0x1b, 0x9b, 0x5d, 0x9b, 0x4b, 0x1a, 0x59, + 0x99, 0x1b, 0xdd, 0x94, 0x20, 0xa8, 0x42, 0x86, 0xe7, 0x62, 0x57, 0x26, + 0x37, 0x97, 0xf6, 0xe6, 0x36, 0x25, 0x20, 0x9a, 0x90, 0xe1, 0xb9, 0xd8, + 0x85, 0xb1, 0xd9, 0x95, 0xc9, 0x4d, 0x09, 0x8a, 0x3a, 0x64, 0x78, 0x2e, + 0x73, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x53, + 0x02, 0xa4, 0x0c, 0x19, 0x9e, 0x8b, 0x5c, 0xd9, 0xdc, 0x5b, 0x9d, 0xdc, + 0x58, 0xd9, 0xdc, 0x94, 0x00, 0xab, 0x44, 0x86, 0xe7, 0x42, 0x97, 0x07, + 0x57, 0x16, 0xe4, 0xe6, 0xf6, 0x46, 0x17, 0x46, 0x97, 0xf6, 0xe6, 0x36, + 0x37, 0x45, 0xd0, 0x83, 0x3f, 0xa8, 0x43, 0x86, 0xe7, 0x62, 0x97, 0x56, + 0x76, 0x97, 0x44, 0x36, 0x45, 0x17, 0x46, 0x57, 0x36, 0x25, 0x08, 0x85, + 0x3a, 0x64, 0x78, 0x2e, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, + 0x6e, 0x74, 0x73, 0x53, 0x02, 0x5c, 0xe8, 0x42, 0x86, 0xe7, 0x32, 0xf6, + 0x56, 0xe7, 0x46, 0x57, 0x26, 0x37, 0x37, 0x25, 0x00, 0x07, 0x00, 0x00, + 0x00, 0x79, 0x18, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, + 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, + 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, + 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, + 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, + 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, + 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, + 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, + 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, + 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, + 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, + 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, + 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, + 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, + 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, + 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, + 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, + 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, + 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, + 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, + 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, + 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, + 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc4, 0x21, 0x07, 0x7c, + 0x70, 0x03, 0x7a, 0x28, 0x87, 0x76, 0x80, 0x87, 0x19, 0xd1, 0x43, 0x0e, + 0xf8, 0xe0, 0x06, 0xe4, 0x20, 0x0e, 0xe7, 0xe0, 0x06, 0xf6, 0x10, 0x0e, + 0xf2, 0xc0, 0x0e, 0xe1, 0x90, 0x0f, 0xef, 0x50, 0x0f, 0xf4, 0x00, 0x00, + 0x00, 0x71, 0x20, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x35, 0xf0, 0x05, + 0x7e, 0x74, 0x74, 0x79, 0x1a, 0x6e, 0xc3, 0xd9, 0x65, 0x39, 0x10, 0x38, + 0xab, 0x4e, 0xc3, 0x6d, 0x38, 0xbb, 0x2c, 0x9f, 0xd2, 0xc3, 0xf4, 0x32, + 0x10, 0x18, 0xac, 0x00, 0x38, 0x08, 0xfc, 0xe8, 0xe8, 0x32, 0xb5, 0x8c, + 0xa7, 0xd7, 0xe5, 0xe5, 0x2a, 0x10, 0x38, 0xb3, 0xfe, 0x48, 0xd4, 0x32, + 0x9e, 0x5e, 0x97, 0x97, 0x65, 0x44, 0xa0, 0xf5, 0x47, 0xb2, 0x97, 0xc7, + 0xf4, 0xb7, 0x1c, 0xd8, 0x24, 0xc1, 0x66, 0x40, 0x20, 0x10, 0x18, 0x2c, + 0x01, 0x38, 0x08, 0xfc, 0xe8, 0xe8, 0x32, 0xb5, 0x8c, 0xa7, 0xd7, 0xe5, + 0x65, 0x2b, 0x10, 0x38, 0xb3, 0xfe, 0x48, 0xd4, 0x32, 0x9e, 0x5e, 0x97, + 0x97, 0x65, 0x44, 0xa0, 0xf5, 0x47, 0xb2, 0x97, 0xc7, 0xf4, 0xb7, 0x1c, + 0xd8, 0x24, 0xc1, 0x66, 0x40, 0x20, 0x10, 0x18, 0x2c, 0x00, 0x38, 0x08, + 0xfc, 0xe8, 0xe8, 0x32, 0xb5, 0x8c, 0xa7, 0xd7, 0xe5, 0xe5, 0x2c, 0x10, + 0x38, 0xb3, 0xfe, 0x48, 0xd4, 0x32, 0x9e, 0x5e, 0x97, 0x97, 0x65, 0x44, + 0xa0, 0xf5, 0x47, 0xb2, 0x97, 0xc7, 0xf4, 0xb7, 0x1c, 0xd8, 0x24, 0xc1, + 0x66, 0x40, 0x20, 0x10, 0x18, 0xb4, 0x04, 0x69, 0xb8, 0x7c, 0xe7, 0xf1, + 0x85, 0x88, 0x00, 0x26, 0x22, 0x04, 0x9a, 0x61, 0x21, 0x0c, 0xc1, 0x19, + 0x2e, 0xdf, 0x79, 0xfc, 0xc1, 0x99, 0x6e, 0xbf, 0xb8, 0x6d, 0x2b, 0x98, + 0x86, 0xcb, 0x77, 0x1e, 0x7f, 0x71, 0x80, 0x41, 0x6c, 0x1e, 0x6a, 0xf2, + 0x8b, 0xdb, 0xb6, 0x03, 0x68, 0xb8, 0x7c, 0xe7, 0xf1, 0x25, 0x80, 0x79, + 0x16, 0xc2, 0x2f, 0x6e, 0xdb, 0x0c, 0xaa, 0xe1, 0xf2, 0x9d, 0xc7, 0x97, + 0x26, 0x27, 0x22, 0x50, 0x6a, 0x7a, 0xa8, 0xc9, 0x2f, 0x6e, 0xdb, 0x08, + 0x08, 0x06, 0x40, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x41, 0x53, + 0x48, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd2, 0x76, 0x77, + 0xba, 0xe6, 0x06, 0xb3, 0xd2, 0x85, 0x4b, 0xcf, 0xc4, 0x54, 0x26, 0x79, + 0xad, 0x44, 0x58, 0x49, 0x4c, 0xd4, 0x07, 0x00, 0x00, 0x60, 0x00, 0x00, + 0x00, 0xf5, 0x01, 0x00, 0x00, 0x44, 0x58, 0x49, 0x4c, 0x00, 0x01, 0x00, + 0x00, 0x10, 0x00, 0x00, 0x00, 0xbc, 0x07, 0x00, 0x00, 0x42, 0x43, 0xc0, + 0xde, 0x21, 0x0c, 0x00, 0x00, 0xec, 0x01, 0x00, 0x00, 0x0b, 0x82, 0x20, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, + 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, + 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, + 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, + 0x4b, 0x0a, 0x32, 0x52, 0x88, 0x48, 0x90, 0x14, 0x20, 0x43, 0x46, 0x88, + 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, 0x90, 0x91, 0x22, 0xc4, + 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, 0x8a, 0x04, 0x29, 0x46, + 0x06, 0x51, 0x18, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0xe0, + 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, 0x02, 0xa8, 0x0d, 0x84, 0xf0, 0xff, + 0xff, 0xff, 0xff, 0x03, 0x20, 0x6d, 0x30, 0x86, 0xff, 0xff, 0xff, 0xff, + 0x1f, 0x00, 0x09, 0xa8, 0x00, 0x49, 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, + 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, 0x4c, 0x08, 0x06, 0x00, 0x00, 0x00, + 0x00, 0x89, 0x20, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, + 0x09, 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, + 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, + 0x4c, 0x10, 0x70, 0x23, 0x00, 0x25, 0x00, 0x14, 0x66, 0x00, 0xe6, 0x08, + 0xc0, 0x60, 0x8e, 0x00, 0x29, 0xc6, 0x20, 0x84, 0x14, 0x42, 0xa6, 0x18, + 0x80, 0x10, 0x52, 0x06, 0xa1, 0x9b, 0x86, 0xcb, 0x9f, 0xb0, 0x87, 0x90, + 0xfc, 0x95, 0x90, 0x56, 0x62, 0xf2, 0x8b, 0xdb, 0x46, 0xc5, 0x18, 0x63, + 0x10, 0x2a, 0xf7, 0x0c, 0x97, 0x3f, 0x61, 0x0f, 0x21, 0xf9, 0x21, 0xd0, + 0x0c, 0x0b, 0x81, 0x82, 0x55, 0x18, 0x45, 0x18, 0x1b, 0x63, 0x0c, 0x42, + 0xc8, 0xa0, 0x56, 0x90, 0x41, 0xc6, 0x18, 0x63, 0x0c, 0x7a, 0x73, 0x04, + 0x41, 0x31, 0x18, 0x29, 0x84, 0x44, 0x92, 0x03, 0x01, 0xc3, 0x08, 0xc4, + 0x30, 0x53, 0x1b, 0x8c, 0x03, 0x3b, 0x84, 0xc3, 0x3c, 0xcc, 0x83, 0x1b, + 0xd0, 0x42, 0x39, 0xe0, 0x03, 0x3d, 0xd4, 0x83, 0x3c, 0x94, 0x83, 0x1c, + 0x90, 0x02, 0x1f, 0xd8, 0x43, 0x39, 0x8c, 0x03, 0x3d, 0xbc, 0x83, 0x3c, + 0xf0, 0x81, 0x39, 0xb0, 0xc3, 0x3b, 0x84, 0x03, 0x3d, 0xb0, 0x01, 0x18, + 0xd0, 0x81, 0x1f, 0x80, 0x81, 0x1f, 0xe8, 0x81, 0x1e, 0xb4, 0x43, 0x3a, + 0xc0, 0xc3, 0x3c, 0xfc, 0x02, 0x3d, 0xe4, 0x03, 0x3c, 0x94, 0x03, 0x0a, + 0xc8, 0x4c, 0x62, 0x30, 0x0e, 0xec, 0x10, 0x0e, 0xf3, 0x30, 0x0f, 0x6e, + 0x40, 0x0b, 0xe5, 0x80, 0x0f, 0xf4, 0x50, 0x0f, 0xf2, 0x50, 0x0e, 0x72, + 0x40, 0x0a, 0x7c, 0x60, 0x0f, 0xe5, 0x30, 0x0e, 0xf4, 0xf0, 0x0e, 0xf2, + 0xc0, 0x07, 0xe6, 0xc0, 0x0e, 0xef, 0x10, 0x0e, 0xf4, 0xc0, 0x06, 0x60, + 0x40, 0x07, 0x7e, 0x00, 0x06, 0x7e, 0x80, 0x84, 0x6a, 0xe9, 0xde, 0x24, + 0x4d, 0x11, 0x25, 0x4c, 0x3e, 0x0b, 0x30, 0xcf, 0x42, 0x44, 0xec, 0x04, + 0x4c, 0x04, 0x0a, 0x08, 0xe5, 0x74, 0x20, 0x00, 0x00, 0x13, 0x14, 0x72, + 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, 0x79, 0x68, 0x03, 0x72, + 0xc0, 0x87, 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, 0x0e, 0x7a, 0x50, 0x0e, + 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, + 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, + 0x78, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, + 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, + 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, + 0x74, 0xd0, 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, 0x07, + 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, + 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0xe0, 0x0e, + 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, + 0x76, 0x40, 0x07, 0x43, 0x9e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x86, 0x3c, 0x06, 0x10, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x79, 0x10, 0x20, 0x00, 0x04, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xf2, 0x34, 0x40, 0x00, 0x0c, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xe4, 0x79, 0x80, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xc8, 0x23, 0x01, + 0x01, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x16, 0x08, + 0x00, 0x0f, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, + 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x22, 0x25, 0x30, 0x02, + 0x50, 0x0c, 0x45, 0x50, 0x12, 0x65, 0x50, 0x1e, 0x54, 0x4a, 0xa2, 0x0c, + 0x0a, 0x61, 0x04, 0xa0, 0x08, 0x0a, 0x84, 0xf0, 0x0c, 0x00, 0xe9, 0x19, + 0x00, 0xda, 0x63, 0x39, 0x0c, 0x01, 0x00, 0x00, 0x70, 0x1c, 0x00, 0x10, + 0x08, 0x04, 0x02, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x69, 0x00, 0x00, + 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, 0x44, 0x35, 0x18, 0x63, + 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x03, + 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1, 0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, + 0x62, 0x2a, 0x0a, 0x9a, 0x2a, 0xfa, 0x9a, 0xb9, 0x81, 0x79, 0x31, 0x4b, + 0x73, 0x0b, 0x63, 0x4b, 0xd9, 0x10, 0x04, 0x13, 0x04, 0xc2, 0x98, 0x20, + 0x10, 0xc7, 0x06, 0x61, 0x20, 0x26, 0x08, 0x04, 0xb2, 0x41, 0x18, 0x0c, + 0x0a, 0x70, 0x73, 0x1b, 0x06, 0xc4, 0x20, 0x26, 0x08, 0xd8, 0x44, 0x60, + 0x82, 0x40, 0x24, 0x13, 0x04, 0x42, 0xd9, 0x20, 0x10, 0xcd, 0x86, 0x84, + 0x50, 0x16, 0x82, 0x18, 0x18, 0xc2, 0xd9, 0x90, 0x0c, 0xca, 0x42, 0x0c, + 0x03, 0x43, 0x38, 0x1b, 0x12, 0x46, 0x59, 0x08, 0x66, 0x60, 0x08, 0x67, + 0xc3, 0xf0, 0x40, 0xd1, 0x04, 0x41, 0xa3, 0x36, 0x20, 0xc4, 0xb4, 0x10, + 0xc4, 0x40, 0x00, 0x1b, 0x02, 0x6a, 0x03, 0x21, 0x01, 0x40, 0x35, 0x41, + 0xd8, 0xaa, 0x0d, 0xc1, 0x35, 0x41, 0x10, 0x00, 0x12, 0x6d, 0x61, 0x69, + 0x6e, 0x5c, 0xa6, 0xac, 0xbe, 0xa0, 0xde, 0xe6, 0xd2, 0xe8, 0xd2, 0xde, + 0xdc, 0x26, 0x08, 0x45, 0x33, 0x41, 0x28, 0x9c, 0x0d, 0x01, 0x31, 0x41, + 0x28, 0x9e, 0x09, 0x42, 0x01, 0x6d, 0x58, 0x88, 0x8d, 0xeb, 0xbc, 0x6f, + 0xf8, 0x08, 0x30, 0x00, 0x88, 0x50, 0x15, 0x61, 0x0d, 0x3d, 0x3d, 0x49, + 0x11, 0x4d, 0x10, 0x8a, 0x68, 0x82, 0x40, 0x2c, 0x1b, 0x04, 0x32, 0x20, + 0x83, 0x0d, 0xcb, 0x20, 0x06, 0x1c, 0x18, 0x78, 0x63, 0x30, 0x8c, 0xc1, + 0x00, 0x06, 0x65, 0xc0, 0x62, 0xe8, 0x89, 0xe9, 0x49, 0x6a, 0x82, 0x40, + 0x30, 0x1b, 0x04, 0x32, 0x40, 0x83, 0x0d, 0x0b, 0x73, 0x06, 0x1c, 0x18, + 0x78, 0x63, 0x30, 0x7c, 0x0c, 0x18, 0xa4, 0xc1, 0x86, 0x21, 0x0c, 0xcc, + 0x40, 0x0d, 0x98, 0x4c, 0x59, 0x7d, 0x51, 0x85, 0xc9, 0x9d, 0x95, 0xd1, + 0x4d, 0x10, 0x0a, 0x69, 0xc3, 0x42, 0xb0, 0x01, 0xd7, 0x06, 0x1e, 0x18, + 0x0c, 0x1f, 0x01, 0x06, 0x69, 0xb0, 0x21, 0x70, 0x83, 0x0d, 0xc3, 0x1a, + 0xbc, 0x01, 0xb0, 0xa1, 0xc8, 0x34, 0x38, 0xb0, 0x80, 0x2a, 0x6c, 0x6c, + 0x76, 0x6d, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x53, 0x82, 0xa0, 0x0a, + 0x19, 0x9e, 0x8b, 0x5d, 0x99, 0xdc, 0x5c, 0xda, 0x9b, 0xdb, 0x94, 0x80, + 0x68, 0x42, 0x86, 0xe7, 0x62, 0x17, 0xc6, 0x66, 0x57, 0x26, 0x37, 0x25, + 0x30, 0xea, 0x90, 0xe1, 0xb9, 0xcc, 0xa1, 0x85, 0x91, 0x95, 0xc9, 0x35, + 0xbd, 0x91, 0x95, 0xb1, 0x4d, 0x09, 0x90, 0x32, 0x64, 0x78, 0x2e, 0x72, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x53, 0x82, 0xaa, 0x0e, + 0x19, 0x9e, 0x8b, 0x5d, 0x5a, 0xd9, 0x5d, 0x12, 0xd9, 0x14, 0x5d, 0x18, + 0x5d, 0xd9, 0x94, 0xe0, 0xaa, 0x43, 0x86, 0xe7, 0x52, 0xe6, 0x46, 0x27, + 0x97, 0x07, 0xf5, 0x96, 0xe6, 0x46, 0x37, 0x37, 0x25, 0x80, 0x03, 0x00, + 0x00, 0x79, 0x18, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, + 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, + 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, + 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, + 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, + 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, + 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, + 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, + 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, + 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, + 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, + 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, + 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, + 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, + 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, + 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, + 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, + 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, + 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, + 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, + 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, + 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, + 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc4, 0x21, 0x07, 0x7c, + 0x70, 0x03, 0x7a, 0x28, 0x87, 0x76, 0x80, 0x87, 0x19, 0xd1, 0x43, 0x0e, + 0xf8, 0xe0, 0x06, 0xe4, 0x20, 0x0e, 0xe7, 0xe0, 0x06, 0xf6, 0x10, 0x0e, + 0xf2, 0xc0, 0x0e, 0xe1, 0x90, 0x0f, 0xef, 0x50, 0x0f, 0xf4, 0x00, 0x00, + 0x00, 0x71, 0x20, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x56, 0x20, 0x0d, + 0x97, 0xef, 0x3c, 0xbe, 0x10, 0x11, 0xc0, 0x44, 0x84, 0x40, 0x33, 0x2c, + 0x84, 0x11, 0x38, 0xc3, 0xe5, 0x3b, 0x8f, 0x3f, 0x38, 0xd3, 0xed, 0x17, + 0xb7, 0x6d, 0x01, 0xd3, 0x70, 0xf9, 0xce, 0xe3, 0x2f, 0x0e, 0x30, 0x88, + 0xcd, 0x43, 0x4d, 0x7e, 0x71, 0xdb, 0x36, 0x00, 0x0d, 0x97, 0xef, 0x3c, + 0xbe, 0x04, 0x30, 0xcf, 0x42, 0xf8, 0xc5, 0x6d, 0x9b, 0x40, 0x35, 0x5c, + 0xbe, 0xf3, 0xf8, 0xd2, 0xe4, 0x44, 0x04, 0x4a, 0x4d, 0x0f, 0x35, 0xf9, + 0xc5, 0x6d, 0x1b, 0x00, 0xc1, 0x00, 0x48, 0x03, 0x00, 0x61, 0x20, 0x00, + 0x00, 0x66, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, 0x10, 0x00, 0x00, + 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x47, 0x00, 0xa8, 0x94, 0x00, 0x91, + 0x72, 0x2b, 0xbc, 0x52, 0x28, 0xb9, 0x42, 0x98, 0x01, 0xa0, 0x31, 0x46, + 0x50, 0x9e, 0x74, 0xe9, 0x7f, 0x63, 0x04, 0xa2, 0x3e, 0xb7, 0xf3, 0x2f, + 0x8c, 0x11, 0x80, 0xef, 0x0a, 0xae, 0xbf, 0x30, 0x46, 0xc0, 0x97, 0xbd, + 0xb9, 0x7f, 0x23, 0x00, 0x63, 0x04, 0x21, 0x09, 0x86, 0xf0, 0x2f, 0x8c, + 0x11, 0x80, 0x20, 0x08, 0xe2, 0xdf, 0x0c, 0x00, 0x00, 0x23, 0x06, 0x09, + 0x00, 0x82, 0x60, 0x20, 0x85, 0xc1, 0x62, 0x75, 0x1d, 0x34, 0x62, 0x90, + 0x00, 0x20, 0x08, 0x06, 0x92, 0x18, 0x30, 0x57, 0x18, 0x84, 0x41, 0x34, + 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0xd2, 0x18, 0x34, 0x58, 0x18, 0x84, + 0x81, 0x34, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x12, 0x19, 0x38, 0x9b, + 0x18, 0x88, 0xc1, 0x34, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x46, 0x1a, + 0x38, 0x61, 0x30, 0x06, 0x5a, 0x33, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, + 0x86, 0x1a, 0x3c, 0x62, 0x40, 0x06, 0x94, 0x33, 0x62, 0x90, 0x00, 0x20, + 0x08, 0x06, 0xc6, 0x1a, 0x40, 0x63, 0x50, 0x06, 0xdb, 0x33, 0x62, 0x90, + 0x00, 0x20, 0x08, 0x06, 0x06, 0x1b, 0x44, 0x64, 0x60, 0x06, 0x1f, 0x34, + 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x46, 0x1b, 0x48, 0x68, 0x70, 0x06, + 0x5e, 0x34, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x86, 0x1b, 0x4c, 0x69, + 0x80, 0x06, 0x98, 0x34, 0x62, 0xf0, 0x00, 0x20, 0x08, 0x06, 0x4d, 0x1b, + 0x5c, 0xc8, 0x21, 0x04, 0xcb, 0x92, 0x06, 0x69, 0x30, 0x2d, 0xa3, 0x09, + 0x01, 0x30, 0x62, 0xf0, 0x00, 0x20, 0x08, 0x06, 0xcd, 0x1b, 0x64, 0x4b, + 0x42, 0x0c, 0x4d, 0xb3, 0x06, 0x6b, 0x50, 0x35, 0xa3, 0x09, 0x01, 0x30, + 0x62, 0xf0, 0x00, 0x20, 0x08, 0x06, 0x4d, 0x1c, 0x6c, 0xce, 0x62, 0x14, + 0xcf, 0xd3, 0x06, 0x6d, 0x70, 0x3d, 0xa3, 0x09, 0x01, 0x60, 0xc3, 0x04, + 0x1f, 0x13, 0x28, 0xf8, 0x8c, 0x18, 0x2c, 0x00, 0x08, 0x82, 0xc1, 0x43, + 0x07, 0x60, 0x70, 0x08, 0x01, 0x65, 0x5d, 0x23, 0x06, 0x0b, 0x00, 0x82, + 0x60, 0xf0, 0xd4, 0x41, 0x18, 0x20, 0x83, 0x50, 0x65, 0xda, 0x88, 0xc1, + 0x02, 0x80, 0x20, 0x18, 0x3c, 0x76, 0x20, 0x06, 0x09, 0x31, 0x58, 0x1c, + 0x66, 0x43, 0x24, 0x1f, 0x1b, 0x22, 0xf9, 0xd8, 0x10, 0xc9, 0x67, 0xc4, + 0x20, 0x01, 0x40, 0x10, 0x0c, 0x10, 0x3e, 0x20, 0x83, 0x3b, 0xb8, 0x03, + 0x37, 0x18, 0x46, 0x0c, 0x12, 0x00, 0x04, 0xc1, 0x00, 0xe1, 0x03, 0x32, + 0xb8, 0x83, 0x3b, 0x38, 0x03, 0x61, 0xc4, 0x20, 0x01, 0x40, 0x10, 0x0c, + 0x10, 0x3e, 0x20, 0x83, 0x3b, 0xb8, 0x83, 0x36, 0x08, 0x46, 0x0c, 0x12, + 0x00, 0x04, 0xc1, 0x00, 0xe1, 0x03, 0x32, 0xb8, 0x83, 0x3b, 0x80, 0x83, + 0x08, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +/* The yuv-rendering pixel shader: + + --- D3D12_PixelShader_YUV_BT601.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureU : register(t1); + Texture2D theTextureV : register(t2); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + #define YUVRS \ + "RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \ + " DENY_DOMAIN_SHADER_ROOT_ACCESS |" \ + " DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \ + " DENY_HULL_SHADER_ROOT_ACCESS )," \ + "RootConstants(num32BitConstants=32, b0),"\ + "DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( SRV(t2), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )" + + [RootSignature(YUVRS)] + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.5960}; + const float3 Gcoeff = {1.1644, -0.3918, -0.8130}; + const float3 Bcoeff = {1.1644, 2.0172, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.y = theTextureU.Sample(theSampler, input.tex).r; + yuv.z = theTextureV.Sample(theSampler, input.tex).r; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ + +static unsigned char D3D12_PixelShader_YUV_BT601[] = { + 0x44, 0x58, 0x42, 0x43, 0x15, 0xda, 0x8f, 0x26, 0x88, 0x1f, 0xc5, 0x79, + 0x25, 0xc3, 0x83, 0x74, 0xb6, 0xe8, 0x4f, 0x43, 0x01, 0x00, 0x00, 0x00, + 0x99, 0x13, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, + 0x50, 0x00, 0x00, 0x00, 0xdb, 0x00, 0x00, 0x00, 0x15, 0x01, 0x00, 0x00, + 0x1d, 0x02, 0x00, 0x00, 0x05, 0x03, 0x00, 0x00, 0x95, 0x0b, 0x00, 0x00, + 0xb1, 0x0b, 0x00, 0x00, 0x53, 0x46, 0x49, 0x30, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x31, + 0x83, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x53, 0x56, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, + 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x43, 0x4f, 0x4c, + 0x4f, 0x52, 0x00, 0x4f, 0x53, 0x47, 0x31, 0x32, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x00, 0x50, 0x53, 0x56, 0x30, 0x00, 0x01, 0x00, 0x00, 0x24, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, + 0xff, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01, 0x00, 0x03, 0x01, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, + 0x52, 0x44, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x44, 0x03, 0x03, 0x04, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x42, + 0x00, 0x03, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x02, 0x44, 0x00, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x44, 0x10, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x52, 0x54, 0x53, 0x30, 0xe0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x05, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xe0, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x05, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x05, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x05, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x05, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, + 0xff, 0x01, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, + 0x00, 0xc8, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xff, 0xff, 0x53, 0x54, 0x41, 0x54, 0x88, 0x08, 0x00, + 0x00, 0x60, 0x00, 0x00, 0x00, 0x22, 0x02, 0x00, 0x00, 0x44, 0x58, 0x49, + 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x08, 0x00, + 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0x19, 0x02, 0x00, + 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, + 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, + 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, + 0x62, 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, + 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x52, 0x88, 0x48, 0x90, 0x14, + 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, + 0x90, 0x91, 0x22, 0xc4, 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, + 0x8a, 0x04, 0x29, 0x46, 0x06, 0x51, 0x18, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, 0x02, 0xa8, + 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x20, 0x6d, 0x30, 0x86, + 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x09, 0xa8, 0x00, 0x49, 0x18, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, 0x4c, 0x08, + 0x06, 0x00, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x4b, 0x00, 0x00, + 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, + 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, + 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x78, 0x33, 0x00, 0xc3, 0x08, 0x04, + 0x30, 0x47, 0x00, 0x06, 0x33, 0xb5, 0xc1, 0x38, 0xb0, 0x43, 0x38, 0xcc, + 0xc3, 0x3c, 0xb8, 0x01, 0x2d, 0x94, 0x03, 0x3e, 0xd0, 0x43, 0x3d, 0xc8, + 0x43, 0x39, 0xc8, 0x01, 0x29, 0xf0, 0x81, 0x3d, 0x94, 0xc3, 0x38, 0xd0, + 0xc3, 0x3b, 0xc8, 0x03, 0x1f, 0x98, 0x03, 0x3b, 0xbc, 0x43, 0x38, 0xd0, + 0x03, 0x1b, 0x80, 0x01, 0x1d, 0xf8, 0x01, 0x18, 0xf8, 0x81, 0x1e, 0xe8, + 0x41, 0x3b, 0xa4, 0x03, 0x3c, 0xcc, 0xc3, 0x2f, 0xd0, 0x43, 0x3e, 0xc0, + 0x43, 0x39, 0xa0, 0x40, 0xcc, 0x24, 0x06, 0xe3, 0xc0, 0x0e, 0xe1, 0x30, + 0x0f, 0xf3, 0xe0, 0x06, 0xb4, 0x50, 0x0e, 0xf8, 0x40, 0x0f, 0xf5, 0x20, + 0x0f, 0xe5, 0x20, 0x07, 0xa4, 0xc0, 0x07, 0xf6, 0x50, 0x0e, 0xe3, 0x40, + 0x0f, 0xef, 0x20, 0x0f, 0x7c, 0x60, 0x0e, 0xec, 0xf0, 0x0e, 0xe1, 0x40, + 0x0f, 0x6c, 0x00, 0x06, 0x74, 0xe0, 0x07, 0x60, 0xe0, 0x07, 0x48, 0x08, + 0x83, 0xc8, 0x4d, 0xd2, 0x14, 0x51, 0xc2, 0xe4, 0xb3, 0x00, 0xf3, 0x2c, + 0x44, 0xc4, 0x4e, 0xc0, 0x44, 0xa0, 0x40, 0x90, 0x19, 0x01, 0x28, 0x01, + 0xa2, 0x34, 0x47, 0x80, 0x14, 0x03, 0x08, 0x21, 0x96, 0x20, 0x56, 0x0c, + 0x24, 0x84, 0x58, 0x80, 0xdc, 0x4d, 0xc3, 0xe5, 0x4f, 0xd8, 0x43, 0x48, + 0xfe, 0x4a, 0x48, 0x2b, 0x31, 0xf9, 0xc5, 0x6d, 0xa3, 0x02, 0x00, 0x00, + 0x04, 0xad, 0x7b, 0x86, 0xcb, 0x9f, 0xb0, 0x87, 0x90, 0xfc, 0x10, 0x68, + 0x86, 0x85, 0x40, 0x41, 0x2c, 0x0c, 0x14, 0x52, 0x02, 0x00, 0x80, 0x10, + 0x02, 0xd0, 0x2c, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0xd5, 0x39, 0x82, + 0xa0, 0x18, 0x52, 0x2c, 0x21, 0x2e, 0xe1, 0x81, 0x80, 0x61, 0x04, 0x01, + 0xb8, 0x4b, 0x9a, 0x22, 0x4a, 0x98, 0xfc, 0x14, 0xb9, 0x88, 0x85, 0x3d, + 0x80, 0x81, 0x88, 0xc4, 0xe6, 0xa1, 0x26, 0x34, 0x84, 0x1d, 0xd2, 0x41, + 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, + 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, + 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, + 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x3a, 0x0f, 0x64, 0x90, 0x21, + 0x23, 0x45, 0x44, 0x00, 0x72, 0x00, 0xc0, 0xe4, 0x00, 0x80, 0xc9, 0x01, + 0x00, 0xd3, 0x03, 0x00, 0x1e, 0xf2, 0x24, 0x40, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xe4, 0x61, 0x80, 0x00, 0x08, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xc8, 0xe3, 0x00, 0x01, 0x20, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x90, 0x67, 0x02, 0x02, + 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x21, 0x4f, 0x05, + 0x04, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x1e, + 0x0c, 0x08, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb2, + 0x40, 0x15, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x18, 0x19, 0x11, 0x4c, + 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x5a, 0x05, 0x42, 0xa2, + 0x04, 0x46, 0x00, 0x8a, 0xa1, 0x08, 0x4a, 0xa2, 0x50, 0xca, 0xa0, 0x1c, + 0x0a, 0xa4, 0x10, 0x4a, 0xa1, 0xc0, 0x0a, 0xa8, 0x3c, 0x8a, 0x87, 0x56, + 0x11, 0x8c, 0x00, 0x14, 0x42, 0x19, 0x94, 0x04, 0x9d, 0x19, 0x00, 0x2a, + 0x33, 0x00, 0x44, 0x66, 0x00, 0x68, 0xcc, 0x00, 0x50, 0x98, 0x01, 0x20, + 0x3e, 0x03, 0x40, 0x7d, 0x2c, 0x87, 0x21, 0x00, 0x00, 0x00, 0x8e, 0x03, + 0x00, 0x02, 0x81, 0x40, 0x00, 0x79, 0x18, 0x00, 0x00, 0xc4, 0x00, 0x00, + 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, 0x44, 0x35, 0x18, 0x63, + 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x03, + 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1, 0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, + 0x62, 0x2a, 0x0a, 0x9a, 0x2a, 0xfa, 0x9a, 0xb9, 0x81, 0x79, 0x31, 0x4b, + 0x73, 0x0b, 0x63, 0x4b, 0xd9, 0x10, 0x04, 0x13, 0x04, 0x61, 0x99, 0x20, + 0x08, 0xcc, 0x06, 0x61, 0x20, 0x36, 0x08, 0x04, 0x41, 0x01, 0x6e, 0x6e, + 0x82, 0x20, 0x34, 0x1b, 0x86, 0x03, 0x21, 0x26, 0x08, 0x05, 0x18, 0x70, + 0xa1, 0x43, 0x2b, 0xa3, 0x2a, 0xc3, 0xa3, 0xab, 0x93, 0x2b, 0xcb, 0x9a, + 0x20, 0x08, 0xce, 0x04, 0x41, 0x78, 0x36, 0x08, 0x44, 0xb3, 0x21, 0x21, + 0x94, 0x85, 0x20, 0x06, 0x86, 0x70, 0xb8, 0xd0, 0xa1, 0x95, 0x51, 0x95, + 0xe1, 0xd1, 0xd5, 0xc9, 0x95, 0x55, 0x6d, 0x48, 0x06, 0x05, 0x22, 0x86, + 0x81, 0x21, 0x1c, 0x2e, 0x74, 0x68, 0x65, 0x54, 0x65, 0x78, 0x74, 0x75, + 0x72, 0x65, 0x56, 0x1b, 0x12, 0x46, 0x91, 0x08, 0x66, 0x60, 0x08, 0x67, + 0xc3, 0xf0, 0x44, 0xd3, 0x04, 0xe1, 0xf8, 0xa8, 0xd0, 0xa1, 0x95, 0x4d, + 0x85, 0xb5, 0xc1, 0xb1, 0x95, 0xc9, 0x6d, 0x40, 0x88, 0xca, 0x22, 0x88, + 0x81, 0x00, 0x36, 0x04, 0xd7, 0x06, 0x82, 0x02, 0x00, 0x6c, 0x82, 0x40, + 0x84, 0xc1, 0x04, 0x41, 0x80, 0x18, 0xa0, 0x4d, 0x10, 0x84, 0x68, 0x82, + 0x20, 0x48, 0x1b, 0x0c, 0x84, 0xeb, 0x08, 0xaf, 0x21, 0xd1, 0x96, 0x06, + 0x37, 0x37, 0x41, 0x10, 0xa6, 0x0d, 0x04, 0x02, 0x06, 0x5d, 0x18, 0x4c, + 0x10, 0x82, 0x31, 0xd8, 0x20, 0x10, 0x63, 0xb0, 0x21, 0x20, 0x83, 0x0d, + 0x02, 0x51, 0x06, 0x1b, 0x88, 0xed, 0x13, 0x03, 0x33, 0x98, 0x20, 0x0c, + 0x62, 0x30, 0x41, 0x10, 0x28, 0x1a, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, + 0x13, 0x04, 0xa1, 0xda, 0x60, 0x20, 0x6a, 0xd0, 0x11, 0xde, 0x1a, 0x6c, + 0x10, 0xd2, 0x80, 0x0d, 0x26, 0x08, 0x1c, 0x19, 0x4c, 0x10, 0x04, 0x8b, + 0x03, 0xdc, 0xdb, 0x1c, 0x97, 0x29, 0xab, 0x2f, 0xa8, 0xa7, 0xa9, 0x24, + 0xaa, 0xa4, 0x27, 0xa7, 0x0d, 0x08, 0x02, 0x07, 0x1d, 0x91, 0x06, 0x71, + 0xe0, 0x35, 0x1c, 0xe8, 0xca, 0xf0, 0x98, 0x50, 0x15, 0x61, 0x0d, 0x3d, + 0x3d, 0x49, 0x11, 0xc1, 0x6c, 0x40, 0x90, 0x39, 0xe8, 0xc2, 0x20, 0x0d, + 0xe8, 0xc0, 0x6b, 0x58, 0x8c, 0xbd, 0xb1, 0xbd, 0xc9, 0x4d, 0x10, 0x84, + 0x8b, 0xc6, 0xd0, 0x13, 0xd3, 0x93, 0x14, 0xcc, 0x06, 0x04, 0xb1, 0x83, + 0xee, 0x0e, 0xd2, 0x00, 0x0f, 0xbc, 0x66, 0x03, 0xf1, 0x06, 0x72, 0x50, + 0x07, 0x79, 0xb0, 0xe1, 0x20, 0xb4, 0x33, 0x40, 0x83, 0x36, 0x70, 0x03, + 0x3d, 0x98, 0x20, 0x28, 0xc4, 0x06, 0x60, 0xc3, 0x40, 0xf4, 0x41, 0x1f, + 0x6c, 0x08, 0xfc, 0x60, 0xc3, 0x30, 0xf0, 0xc1, 0x1f, 0x4c, 0x10, 0xba, + 0x32, 0xd8, 0x10, 0x84, 0x02, 0x89, 0xb6, 0xb0, 0x34, 0x37, 0x2e, 0x53, + 0x56, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x13, 0x84, + 0xc5, 0x9b, 0x20, 0x2c, 0xdd, 0x86, 0x80, 0x98, 0x20, 0x2c, 0xdc, 0x04, + 0x61, 0xd9, 0x36, 0x2c, 0x04, 0x29, 0x94, 0x82, 0x29, 0x9c, 0x02, 0x2a, + 0x0c, 0xa8, 0x40, 0xa4, 0x02, 0x40, 0x84, 0xaa, 0x08, 0x6b, 0xe8, 0xe9, + 0x49, 0x8a, 0x68, 0x82, 0xb0, 0x68, 0x1b, 0x84, 0xae, 0xdb, 0xb0, 0x0c, + 0xab, 0x50, 0x0a, 0xa9, 0x70, 0x0a, 0xac, 0x30, 0xb0, 0xc2, 0x90, 0x0a, + 0xad, 0xc0, 0x62, 0xe8, 0x89, 0xe9, 0x49, 0x6a, 0x82, 0x20, 0x60, 0x1b, + 0x84, 0x0e, 0x16, 0x36, 0x2c, 0xcc, 0x2b, 0x94, 0x42, 0x2a, 0x9c, 0x02, + 0x2b, 0x0c, 0xa8, 0xc0, 0xa4, 0x42, 0x2c, 0x6c, 0x18, 0x54, 0xc1, 0x15, + 0x64, 0x81, 0xc9, 0x94, 0xd5, 0x17, 0x55, 0x98, 0xdc, 0x59, 0x19, 0xdd, + 0x04, 0x61, 0x51, 0x36, 0x2c, 0x04, 0x2d, 0x94, 0x42, 0x2d, 0x9c, 0x42, + 0x2a, 0x0c, 0xa8, 0x40, 0xa4, 0x42, 0x2c, 0x6c, 0x08, 0x6c, 0x61, 0xc3, + 0x30, 0x0b, 0xb7, 0x00, 0x6c, 0x28, 0xf8, 0x60, 0x14, 0x70, 0x21, 0x03, + 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xcd, 0xb1, 0x48, 0x73, 0x9b, 0xa3, + 0x9b, 0x9b, 0x20, 0x08, 0x19, 0x8d, 0xb9, 0xb4, 0xb3, 0x2f, 0x36, 0x32, + 0x1a, 0x73, 0x69, 0x67, 0x5f, 0x73, 0x74, 0x44, 0xe8, 0xca, 0xf0, 0xbe, + 0xdc, 0xde, 0xe4, 0xda, 0x36, 0x28, 0xba, 0xd0, 0xec, 0x02, 0x2f, 0xf4, + 0x02, 0xe2, 0x0b, 0x69, 0xf0, 0x0b, 0x5d, 0x15, 0x36, 0x36, 0xbb, 0x36, + 0x97, 0x34, 0xb2, 0x32, 0x37, 0xba, 0x29, 0x41, 0x50, 0x85, 0x0c, 0xcf, + 0xc5, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x6d, 0x4a, 0x40, 0x34, 0x21, + 0xc3, 0x73, 0xb1, 0x0b, 0x63, 0xb3, 0x2b, 0x93, 0x9b, 0x12, 0x14, 0x75, + 0xc8, 0xf0, 0x5c, 0xe6, 0xd0, 0xc2, 0xc8, 0xca, 0xe4, 0x9a, 0xde, 0xc8, + 0xca, 0xd8, 0xa6, 0x04, 0x48, 0x19, 0x32, 0x3c, 0x17, 0xb9, 0xb2, 0xb9, + 0xb7, 0x3a, 0xb9, 0xb1, 0xb2, 0xb9, 0x29, 0x01, 0x56, 0x89, 0x0c, 0xcf, + 0x85, 0x2e, 0x0f, 0xae, 0x2c, 0xc8, 0xcd, 0xed, 0x8d, 0x2e, 0x8c, 0x2e, + 0xed, 0xcd, 0x6d, 0x6e, 0x8a, 0xa0, 0x07, 0x7f, 0x50, 0x87, 0x0c, 0xcf, + 0xc5, 0x2e, 0xad, 0xec, 0x2e, 0x89, 0x6c, 0x8a, 0x2e, 0x8c, 0xae, 0x6c, + 0x4a, 0x10, 0x0a, 0x75, 0xc8, 0xf0, 0x5c, 0xca, 0xdc, 0xe8, 0xe4, 0xf2, + 0xa0, 0xde, 0xd2, 0xdc, 0xe8, 0xe6, 0xa6, 0x04, 0xb8, 0xd0, 0x85, 0x0c, + 0xcf, 0x65, 0xec, 0xad, 0xce, 0x8d, 0xae, 0x4c, 0x6e, 0x6e, 0x4a, 0xf0, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x4c, 0x00, 0x00, + 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, + 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, + 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, + 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, + 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, + 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, + 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, + 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, + 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, + 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, + 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, + 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, + 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, + 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, + 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, + 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, + 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, + 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, + 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, + 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, + 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, + 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, + 0xc4, 0x21, 0x07, 0x7c, 0x70, 0x03, 0x7a, 0x28, 0x87, 0x76, 0x80, 0x87, + 0x19, 0xd1, 0x43, 0x0e, 0xf8, 0xe0, 0x06, 0xe4, 0x20, 0x0e, 0xe7, 0xe0, + 0x06, 0xf6, 0x10, 0x0e, 0xf2, 0xc0, 0x0e, 0xe1, 0x90, 0x0f, 0xef, 0x50, + 0x0f, 0xf4, 0x00, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x3e, 0x00, 0x00, + 0x00, 0x35, 0xf0, 0x05, 0x7e, 0x74, 0x74, 0x79, 0x1a, 0x6e, 0xc3, 0xd9, + 0x65, 0x39, 0x10, 0x38, 0xab, 0x4e, 0xc3, 0x6d, 0x38, 0xbb, 0x2c, 0x9f, + 0xd2, 0xc3, 0xf4, 0x32, 0x10, 0x18, 0xac, 0x00, 0x38, 0x08, 0xfc, 0xe8, + 0xe8, 0x32, 0xb5, 0x8c, 0xa7, 0xd7, 0xe5, 0xe5, 0x2a, 0x10, 0x38, 0xb3, + 0xfe, 0x48, 0xd4, 0x32, 0x9e, 0x5e, 0x97, 0x97, 0x65, 0x44, 0xa0, 0xf5, + 0x47, 0xb2, 0x97, 0xc7, 0xf4, 0xb7, 0x1c, 0xd8, 0x24, 0xc1, 0x66, 0x40, + 0x20, 0x10, 0x18, 0x2c, 0x01, 0x38, 0x08, 0xfc, 0xe8, 0xe8, 0x32, 0xb5, + 0x8c, 0xa7, 0xd7, 0xe5, 0x65, 0x2b, 0x10, 0x38, 0xb3, 0xfe, 0x48, 0xd4, + 0x32, 0x9e, 0x5e, 0x97, 0x97, 0x65, 0x44, 0xa0, 0xf5, 0x47, 0xb2, 0x97, + 0xc7, 0xf4, 0xb7, 0x1c, 0xd8, 0x24, 0xc1, 0x66, 0x40, 0x20, 0x10, 0x18, + 0x2c, 0x00, 0x38, 0x08, 0xfc, 0xe8, 0xe8, 0x32, 0xb5, 0x8c, 0xa7, 0xd7, + 0xe5, 0xe5, 0x2c, 0x10, 0x38, 0xb3, 0xfe, 0x48, 0xd4, 0x32, 0x9e, 0x5e, + 0x97, 0x97, 0x65, 0x44, 0xa0, 0xf5, 0x47, 0xb2, 0x97, 0xc7, 0xf4, 0xb7, + 0x1c, 0xd8, 0x24, 0xc1, 0x66, 0x40, 0x20, 0x10, 0x18, 0xb4, 0x04, 0x69, + 0xb8, 0x7c, 0xe7, 0xf1, 0x85, 0x88, 0x00, 0x26, 0x22, 0x04, 0x9a, 0x61, + 0x21, 0x0c, 0xc1, 0x19, 0x2e, 0xdf, 0x79, 0xfc, 0xc1, 0x99, 0x6e, 0xbf, + 0xb8, 0x6d, 0x2b, 0x98, 0x86, 0xcb, 0x77, 0x1e, 0x7f, 0x71, 0x80, 0x41, + 0x6c, 0x1e, 0x6a, 0xf2, 0x8b, 0xdb, 0xb6, 0x03, 0x68, 0xb8, 0x7c, 0xe7, + 0xf1, 0x25, 0x80, 0x79, 0x16, 0xc2, 0x2f, 0x6e, 0xdb, 0x0c, 0xaa, 0xe1, + 0xf2, 0x9d, 0xc7, 0x97, 0x26, 0x27, 0x22, 0x50, 0x6a, 0x7a, 0xa8, 0xc9, + 0x2f, 0x6e, 0xdb, 0x08, 0x08, 0x06, 0x40, 0x1a, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x48, 0x41, 0x53, 0x48, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x57, 0xe4, 0xe0, 0xfd, 0x5b, 0x8a, 0xbf, 0x47, 0x55, 0x60, 0xe1, + 0xa5, 0xe1, 0x4c, 0x5a, 0xa7, 0x44, 0x58, 0x49, 0x4c, 0xe0, 0x07, 0x00, + 0x00, 0x60, 0x00, 0x00, 0x00, 0xf8, 0x01, 0x00, 0x00, 0x44, 0x58, 0x49, + 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xc8, 0x07, 0x00, + 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0xef, 0x01, 0x00, + 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, + 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, + 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, + 0x62, 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, + 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x52, 0x88, 0x48, 0x90, 0x14, + 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, + 0x90, 0x91, 0x22, 0xc4, 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, + 0x8a, 0x04, 0x29, 0x46, 0x06, 0x51, 0x18, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, 0x02, 0xa8, + 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x20, 0x6d, 0x30, 0x86, + 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x09, 0xa8, 0x00, 0x49, 0x18, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, 0x4c, 0x08, + 0x06, 0x00, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x45, 0x00, 0x00, + 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, + 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, + 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x70, 0x23, 0x00, 0x25, 0x00, 0x14, + 0x66, 0x00, 0xe6, 0x08, 0xc0, 0x60, 0x8e, 0x00, 0x29, 0xc6, 0x20, 0x84, + 0x14, 0x42, 0xa6, 0x18, 0x80, 0x10, 0x52, 0x06, 0xa1, 0x9b, 0x86, 0xcb, + 0x9f, 0xb0, 0x87, 0x90, 0xfc, 0x95, 0x90, 0x56, 0x62, 0xf2, 0x8b, 0xdb, + 0x46, 0xc5, 0x18, 0x63, 0x10, 0x2a, 0xf7, 0x0c, 0x97, 0x3f, 0x61, 0x0f, + 0x21, 0xf9, 0x21, 0xd0, 0x0c, 0x0b, 0x81, 0x82, 0x55, 0x18, 0x45, 0x18, + 0x1b, 0x63, 0x0c, 0x42, 0xc8, 0xa0, 0x56, 0x90, 0x41, 0xc6, 0x18, 0x63, + 0x0c, 0x7a, 0x73, 0x04, 0x41, 0x31, 0x18, 0x29, 0x84, 0x44, 0x92, 0x03, + 0x01, 0xc3, 0x08, 0xc4, 0x30, 0x53, 0x1b, 0x8c, 0x03, 0x3b, 0x84, 0xc3, + 0x3c, 0xcc, 0x83, 0x1b, 0xd0, 0x42, 0x39, 0xe0, 0x03, 0x3d, 0xd4, 0x83, + 0x3c, 0x94, 0x83, 0x1c, 0x90, 0x02, 0x1f, 0xd8, 0x43, 0x39, 0x8c, 0x03, + 0x3d, 0xbc, 0x83, 0x3c, 0xf0, 0x81, 0x39, 0xb0, 0xc3, 0x3b, 0x84, 0x03, + 0x3d, 0xb0, 0x01, 0x18, 0xd0, 0x81, 0x1f, 0x80, 0x81, 0x1f, 0xe8, 0x81, + 0x1e, 0xb4, 0x43, 0x3a, 0xc0, 0xc3, 0x3c, 0xfc, 0x02, 0x3d, 0xe4, 0x03, + 0x3c, 0x94, 0x03, 0x0a, 0xc8, 0x4c, 0x62, 0x30, 0x0e, 0xec, 0x10, 0x0e, + 0xf3, 0x30, 0x0f, 0x6e, 0x40, 0x0b, 0xe5, 0x80, 0x0f, 0xf4, 0x50, 0x0f, + 0xf2, 0x50, 0x0e, 0x72, 0x40, 0x0a, 0x7c, 0x60, 0x0f, 0xe5, 0x30, 0x0e, + 0xf4, 0xf0, 0x0e, 0xf2, 0xc0, 0x07, 0xe6, 0xc0, 0x0e, 0xef, 0x10, 0x0e, + 0xf4, 0xc0, 0x06, 0x60, 0x40, 0x07, 0x7e, 0x00, 0x06, 0x7e, 0x80, 0x84, + 0x6a, 0xe9, 0xde, 0x24, 0x4d, 0x11, 0x25, 0x4c, 0x3e, 0x0b, 0x30, 0xcf, + 0x42, 0x44, 0xec, 0x04, 0x4c, 0x04, 0x0a, 0x08, 0xe5, 0x74, 0x20, 0x00, + 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, + 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, + 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, + 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x43, 0x9e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x3c, 0x06, 0x10, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x79, 0x10, + 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xf2, + 0x34, 0x40, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, + 0xe4, 0x79, 0x80, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x60, 0xc8, 0x23, 0x01, 0x01, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x40, 0x16, 0x08, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, + 0x14, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, + 0x22, 0x25, 0x30, 0x02, 0x50, 0x0c, 0x45, 0x50, 0x12, 0x65, 0x50, 0x1e, + 0x54, 0x4a, 0xa2, 0x0c, 0x0a, 0x61, 0x04, 0xa0, 0x08, 0x0a, 0x84, 0xf0, + 0x0c, 0x00, 0xe9, 0x19, 0x00, 0xda, 0x63, 0x39, 0x0c, 0x01, 0x00, 0x00, + 0x70, 0x1c, 0x00, 0x10, 0x08, 0x04, 0x02, 0x00, 0x00, 0x79, 0x18, 0x00, + 0x00, 0x69, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, + 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b, 0x93, 0x9b, + 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1, 0x0b, 0x3b, + 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, 0x0a, 0x9a, 0x2a, 0xfa, 0x9a, 0xb9, + 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, 0x63, 0x4b, 0xd9, 0x10, 0x04, 0x13, + 0x04, 0xc2, 0x98, 0x20, 0x10, 0xc7, 0x06, 0x61, 0x20, 0x26, 0x08, 0x04, + 0xb2, 0x41, 0x18, 0x0c, 0x0a, 0x70, 0x73, 0x1b, 0x06, 0xc4, 0x20, 0x26, + 0x08, 0xd8, 0x44, 0x60, 0x82, 0x40, 0x24, 0x13, 0x04, 0x42, 0xd9, 0x20, + 0x10, 0xcd, 0x86, 0x84, 0x50, 0x16, 0x82, 0x18, 0x18, 0xc2, 0xd9, 0x90, + 0x0c, 0xca, 0x42, 0x0c, 0x03, 0x43, 0x38, 0x1b, 0x12, 0x46, 0x59, 0x08, + 0x66, 0x60, 0x08, 0x67, 0xc3, 0xf0, 0x40, 0xd1, 0x04, 0x41, 0xa3, 0x36, + 0x20, 0xc4, 0xb4, 0x10, 0xc4, 0x40, 0x00, 0x1b, 0x02, 0x6a, 0x03, 0x21, + 0x01, 0x40, 0x35, 0x41, 0xd8, 0xaa, 0x0d, 0xc1, 0x35, 0x41, 0x10, 0x00, + 0x12, 0x6d, 0x61, 0x69, 0x6e, 0x5c, 0xa6, 0xac, 0xbe, 0xa0, 0xde, 0xe6, + 0xd2, 0xe8, 0xd2, 0xde, 0xdc, 0x26, 0x08, 0x45, 0x33, 0x41, 0x28, 0x9c, + 0x0d, 0x01, 0x31, 0x41, 0x28, 0x9e, 0x09, 0x42, 0x01, 0x6d, 0x58, 0x88, + 0x8d, 0xeb, 0xbc, 0x6f, 0xf8, 0x08, 0x30, 0x00, 0x88, 0x50, 0x15, 0x61, + 0x0d, 0x3d, 0x3d, 0x49, 0x11, 0x4d, 0x10, 0x8a, 0x68, 0x82, 0x40, 0x2c, + 0x1b, 0x04, 0x32, 0x20, 0x83, 0x0d, 0xcb, 0x20, 0x06, 0x1c, 0x18, 0x78, + 0x63, 0x30, 0x8c, 0xc1, 0x00, 0x06, 0x65, 0xc0, 0x62, 0xe8, 0x89, 0xe9, + 0x49, 0x6a, 0x82, 0x40, 0x30, 0x1b, 0x04, 0x32, 0x40, 0x83, 0x0d, 0x0b, + 0x73, 0x06, 0x1c, 0x18, 0x78, 0x63, 0x30, 0x7c, 0x0c, 0x18, 0xa4, 0xc1, + 0x86, 0x21, 0x0c, 0xcc, 0x40, 0x0d, 0x98, 0x4c, 0x59, 0x7d, 0x51, 0x85, + 0xc9, 0x9d, 0x95, 0xd1, 0x4d, 0x10, 0x0a, 0x69, 0xc3, 0x42, 0xb0, 0x01, + 0xd7, 0x06, 0x1e, 0x18, 0x0c, 0x1f, 0x01, 0x06, 0x69, 0xb0, 0x21, 0x70, + 0x83, 0x0d, 0xc3, 0x1a, 0xbc, 0x01, 0xb0, 0xa1, 0xc8, 0x34, 0x38, 0xb0, + 0x80, 0x2a, 0x6c, 0x6c, 0x76, 0x6d, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, + 0x53, 0x82, 0xa0, 0x0a, 0x19, 0x9e, 0x8b, 0x5d, 0x99, 0xdc, 0x5c, 0xda, + 0x9b, 0xdb, 0x94, 0x80, 0x68, 0x42, 0x86, 0xe7, 0x62, 0x17, 0xc6, 0x66, + 0x57, 0x26, 0x37, 0x25, 0x30, 0xea, 0x90, 0xe1, 0xb9, 0xcc, 0xa1, 0x85, + 0x91, 0x95, 0xc9, 0x35, 0xbd, 0x91, 0x95, 0xb1, 0x4d, 0x09, 0x90, 0x32, + 0x64, 0x78, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, + 0x53, 0x82, 0xaa, 0x0e, 0x19, 0x9e, 0x8b, 0x5d, 0x5a, 0xd9, 0x5d, 0x12, + 0xd9, 0x14, 0x5d, 0x18, 0x5d, 0xd9, 0x94, 0xe0, 0xaa, 0x43, 0x86, 0xe7, + 0x52, 0xe6, 0x46, 0x27, 0x97, 0x07, 0xf5, 0x96, 0xe6, 0x46, 0x37, 0x37, + 0x25, 0x80, 0x03, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x4c, 0x00, 0x00, + 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, + 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, + 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, + 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, + 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, + 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, + 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, + 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, + 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, + 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, + 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, + 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, + 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, + 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, + 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, + 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, + 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, + 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, + 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, + 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, + 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, + 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, + 0xc4, 0x21, 0x07, 0x7c, 0x70, 0x03, 0x7a, 0x28, 0x87, 0x76, 0x80, 0x87, + 0x19, 0xd1, 0x43, 0x0e, 0xf8, 0xe0, 0x06, 0xe4, 0x20, 0x0e, 0xe7, 0xe0, + 0x06, 0xf6, 0x10, 0x0e, 0xf2, 0xc0, 0x0e, 0xe1, 0x90, 0x0f, 0xef, 0x50, + 0x0f, 0xf4, 0x00, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x15, 0x00, 0x00, + 0x00, 0x56, 0x20, 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x10, 0x11, 0xc0, 0x44, + 0x84, 0x40, 0x33, 0x2c, 0x84, 0x11, 0x38, 0xc3, 0xe5, 0x3b, 0x8f, 0x3f, + 0x38, 0xd3, 0xed, 0x17, 0xb7, 0x6d, 0x01, 0xd3, 0x70, 0xf9, 0xce, 0xe3, + 0x2f, 0x0e, 0x30, 0x88, 0xcd, 0x43, 0x4d, 0x7e, 0x71, 0xdb, 0x36, 0x00, + 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x04, 0x30, 0xcf, 0x42, 0xf8, 0xc5, 0x6d, + 0x9b, 0x40, 0x35, 0x5c, 0xbe, 0xf3, 0xf8, 0xd2, 0xe4, 0x44, 0x04, 0x4a, + 0x4d, 0x0f, 0x35, 0xf9, 0xc5, 0x6d, 0x1b, 0x00, 0xc1, 0x00, 0x48, 0x03, + 0x00, 0x61, 0x20, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, + 0x2c, 0x10, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x14, 0x47, 0x00, + 0xa8, 0x94, 0x00, 0x91, 0x72, 0x2b, 0xbc, 0x52, 0x28, 0xb9, 0x42, 0x98, + 0x01, 0xa0, 0x31, 0x46, 0xe0, 0xba, 0xa6, 0x08, 0x82, 0xc1, 0x18, 0x41, + 0x69, 0xa2, 0x60, 0xfd, 0x0b, 0x63, 0x04, 0x22, 0x6c, 0xc6, 0xec, 0x2f, + 0x8c, 0x11, 0xe8, 0xad, 0x8c, 0xf3, 0xdf, 0x18, 0x41, 0x48, 0x82, 0x21, + 0xee, 0x0b, 0x23, 0x00, 0x63, 0x04, 0x21, 0x09, 0x86, 0xf0, 0x2f, 0x8c, + 0x11, 0xbc, 0xb8, 0xa8, 0xe6, 0xdf, 0x0c, 0x00, 0x00, 0x23, 0x06, 0x09, + 0x00, 0x82, 0x60, 0x20, 0x89, 0x01, 0x73, 0x79, 0x5e, 0x34, 0x62, 0x90, + 0x00, 0x20, 0x08, 0x06, 0xd2, 0x18, 0x34, 0x98, 0x18, 0x88, 0x81, 0x34, + 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x12, 0x19, 0x38, 0x99, 0x18, 0x88, + 0xc1, 0x34, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x52, 0x19, 0x3c, 0xdc, + 0x18, 0x8c, 0x01, 0x35, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x86, 0x1a, + 0x3c, 0x62, 0x40, 0x06, 0x9b, 0x33, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, + 0xc6, 0x1a, 0x40, 0x63, 0x50, 0x06, 0xd5, 0x33, 0x62, 0x90, 0x00, 0x20, + 0x08, 0x06, 0x06, 0x1b, 0x44, 0x64, 0x60, 0x06, 0x1c, 0x34, 0x62, 0x90, + 0x00, 0x20, 0x08, 0x06, 0x46, 0x1b, 0x48, 0x65, 0x70, 0x06, 0x60, 0x10, + 0x8d, 0x18, 0x24, 0x00, 0x08, 0x82, 0x81, 0xe1, 0x06, 0x53, 0x1a, 0xa0, + 0xc1, 0x27, 0x8d, 0x18, 0x24, 0x00, 0x08, 0x82, 0x81, 0xf1, 0x06, 0x94, + 0x1a, 0xa4, 0x41, 0x36, 0x8d, 0x18, 0x3c, 0x00, 0x08, 0x82, 0x41, 0xe3, + 0x06, 0x18, 0x72, 0x08, 0xc1, 0xb2, 0xa8, 0x81, 0x1a, 0x50, 0xcb, 0x68, + 0x42, 0x00, 0x8c, 0x18, 0x3c, 0x00, 0x08, 0x82, 0x41, 0x03, 0x07, 0xda, + 0x92, 0x10, 0x43, 0xd3, 0xb0, 0x01, 0x1b, 0x58, 0xcd, 0x68, 0x42, 0x00, + 0x8c, 0x18, 0x3c, 0x00, 0x08, 0x82, 0x41, 0x23, 0x07, 0x9c, 0xb3, 0x18, + 0xc5, 0xf3, 0xb8, 0x81, 0x1b, 0x60, 0xcf, 0x68, 0x42, 0x00, 0x58, 0x51, + 0xc1, 0xc7, 0x08, 0x0a, 0x3e, 0x36, 0x54, 0xf0, 0x19, 0x31, 0x58, 0x00, + 0x10, 0x04, 0x83, 0xc7, 0x0e, 0xc4, 0x60, 0x10, 0x82, 0xea, 0xca, 0x46, + 0x0c, 0x16, 0x00, 0x04, 0xc1, 0xe0, 0xb9, 0x83, 0x31, 0x20, 0x06, 0xc1, + 0xda, 0xb8, 0x11, 0x83, 0x05, 0x00, 0x41, 0x30, 0x78, 0xf0, 0x80, 0x0c, + 0x0a, 0x62, 0xb8, 0xbc, 0xcc, 0x06, 0x49, 0x3e, 0x36, 0x48, 0xf2, 0xb1, + 0x41, 0x92, 0xcf, 0x88, 0x41, 0x02, 0x80, 0x20, 0x18, 0x20, 0x7e, 0x60, + 0x06, 0x79, 0x90, 0x07, 0x70, 0x30, 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, + 0x01, 0xe2, 0x07, 0x66, 0x90, 0x07, 0x79, 0x90, 0x06, 0xc2, 0x88, 0x41, + 0x02, 0x80, 0x20, 0x18, 0x20, 0x7e, 0x60, 0x06, 0x79, 0x90, 0x07, 0x6f, + 0x10, 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, 0x01, 0xe2, 0x07, 0x66, 0x90, + 0x07, 0x79, 0x20, 0x07, 0x12, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00 +}; + +/* The yuv-rendering pixel shader: + + --- D3D12_PixelShader_YUV_BT709.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureU : register(t1); + Texture2D theTextureV : register(t2); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + #define YUVRS \ + "RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \ + " DENY_DOMAIN_SHADER_ROOT_ACCESS |" \ + " DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \ + " DENY_HULL_SHADER_ROOT_ACCESS )," \ + "RootConstants(num32BitConstants=32, b0),"\ + "DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( SRV(t2), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )" + + [RootSignature(YUVRS)] + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.7927}; + const float3 Gcoeff = {1.1644, -0.2132, -0.5329}; + const float3 Bcoeff = {1.1644, 2.1124, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.y = theTextureU.Sample(theSampler, input.tex).r; + yuv.z = theTextureV.Sample(theSampler, input.tex).r; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ + +static unsigned char D3D12_PixelShader_YUV_BT709[] = { + 0x44, 0x58, 0x42, 0x43, 0xe6, 0x97, 0xfb, 0x70, 0x81, 0x58, 0x82, 0x84, + 0xfd, 0xe7, 0xb6, 0x4d, 0x56, 0x90, 0xf8, 0x87, 0x01, 0x00, 0x00, 0x00, + 0x99, 0x13, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, + 0x50, 0x00, 0x00, 0x00, 0xdb, 0x00, 0x00, 0x00, 0x15, 0x01, 0x00, 0x00, + 0x1d, 0x02, 0x00, 0x00, 0x05, 0x03, 0x00, 0x00, 0x95, 0x0b, 0x00, 0x00, + 0xb1, 0x0b, 0x00, 0x00, 0x53, 0x46, 0x49, 0x30, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x31, + 0x83, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x53, 0x56, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, + 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x43, 0x4f, 0x4c, + 0x4f, 0x52, 0x00, 0x4f, 0x53, 0x47, 0x31, 0x32, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x00, 0x50, 0x53, 0x56, 0x30, 0x00, 0x01, 0x00, 0x00, 0x24, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, + 0xff, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01, 0x00, 0x03, 0x01, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, + 0x52, 0x44, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x44, 0x03, 0x03, 0x04, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x42, + 0x00, 0x03, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x02, 0x44, 0x00, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x44, 0x10, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x52, 0x54, 0x53, 0x30, 0xe0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x05, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xe0, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x05, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x05, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x05, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x05, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, + 0xff, 0x01, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, + 0x00, 0xc8, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xff, 0xff, 0x53, 0x54, 0x41, 0x54, 0x88, 0x08, 0x00, + 0x00, 0x60, 0x00, 0x00, 0x00, 0x22, 0x02, 0x00, 0x00, 0x44, 0x58, 0x49, + 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x08, 0x00, + 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0x19, 0x02, 0x00, + 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, + 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, + 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, + 0x62, 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, + 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x52, 0x88, 0x48, 0x90, 0x14, + 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, + 0x90, 0x91, 0x22, 0xc4, 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, + 0x8a, 0x04, 0x29, 0x46, 0x06, 0x51, 0x18, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, 0x02, 0xa8, + 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x20, 0x6d, 0x30, 0x86, + 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x09, 0xa8, 0x00, 0x49, 0x18, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, 0x4c, 0x08, + 0x06, 0x00, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x4b, 0x00, 0x00, + 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, + 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, + 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x78, 0x33, 0x00, 0xc3, 0x08, 0x04, + 0x30, 0x47, 0x00, 0x06, 0x33, 0xb5, 0xc1, 0x38, 0xb0, 0x43, 0x38, 0xcc, + 0xc3, 0x3c, 0xb8, 0x01, 0x2d, 0x94, 0x03, 0x3e, 0xd0, 0x43, 0x3d, 0xc8, + 0x43, 0x39, 0xc8, 0x01, 0x29, 0xf0, 0x81, 0x3d, 0x94, 0xc3, 0x38, 0xd0, + 0xc3, 0x3b, 0xc8, 0x03, 0x1f, 0x98, 0x03, 0x3b, 0xbc, 0x43, 0x38, 0xd0, + 0x03, 0x1b, 0x80, 0x01, 0x1d, 0xf8, 0x01, 0x18, 0xf8, 0x81, 0x1e, 0xe8, + 0x41, 0x3b, 0xa4, 0x03, 0x3c, 0xcc, 0xc3, 0x2f, 0xd0, 0x43, 0x3e, 0xc0, + 0x43, 0x39, 0xa0, 0x40, 0xcc, 0x24, 0x06, 0xe3, 0xc0, 0x0e, 0xe1, 0x30, + 0x0f, 0xf3, 0xe0, 0x06, 0xb4, 0x50, 0x0e, 0xf8, 0x40, 0x0f, 0xf5, 0x20, + 0x0f, 0xe5, 0x20, 0x07, 0xa4, 0xc0, 0x07, 0xf6, 0x50, 0x0e, 0xe3, 0x40, + 0x0f, 0xef, 0x20, 0x0f, 0x7c, 0x60, 0x0e, 0xec, 0xf0, 0x0e, 0xe1, 0x40, + 0x0f, 0x6c, 0x00, 0x06, 0x74, 0xe0, 0x07, 0x60, 0xe0, 0x07, 0x48, 0x08, + 0x83, 0xc8, 0x4d, 0xd2, 0x14, 0x51, 0xc2, 0xe4, 0xb3, 0x00, 0xf3, 0x2c, + 0x44, 0xc4, 0x4e, 0xc0, 0x44, 0xa0, 0x40, 0x90, 0x19, 0x01, 0x28, 0x01, + 0xa2, 0x34, 0x47, 0x80, 0x14, 0x03, 0x08, 0x21, 0x96, 0x20, 0x56, 0x0c, + 0x24, 0x84, 0x58, 0x80, 0xdc, 0x4d, 0xc3, 0xe5, 0x4f, 0xd8, 0x43, 0x48, + 0xfe, 0x4a, 0x48, 0x2b, 0x31, 0xf9, 0xc5, 0x6d, 0xa3, 0x02, 0x00, 0x00, + 0x04, 0xad, 0x7b, 0x86, 0xcb, 0x9f, 0xb0, 0x87, 0x90, 0xfc, 0x10, 0x68, + 0x86, 0x85, 0x40, 0x41, 0x2c, 0x0c, 0x14, 0x52, 0x02, 0x00, 0x80, 0x10, + 0x02, 0xd0, 0x2c, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0xd5, 0x39, 0x82, + 0xa0, 0x18, 0x52, 0x2c, 0x21, 0x2e, 0xe1, 0x81, 0x80, 0x61, 0x04, 0x01, + 0xb8, 0x4b, 0x9a, 0x22, 0x4a, 0x98, 0xfc, 0x14, 0xb9, 0x88, 0x85, 0x3d, + 0x80, 0x81, 0x88, 0xc4, 0xe6, 0xa1, 0x26, 0x34, 0x84, 0x1d, 0xd2, 0x41, + 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, + 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, + 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, + 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x3a, 0x0f, 0x64, 0x90, 0x21, + 0x23, 0x45, 0x44, 0x00, 0x72, 0x00, 0xc0, 0xe4, 0x00, 0x80, 0xc9, 0x01, + 0x00, 0xd3, 0x03, 0x00, 0x1e, 0xf2, 0x24, 0x40, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xe4, 0x61, 0x80, 0x00, 0x08, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xc8, 0xe3, 0x00, 0x01, 0x20, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x90, 0x67, 0x02, 0x02, + 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x21, 0x4f, 0x05, + 0x04, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x1e, + 0x0c, 0x08, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb2, + 0x40, 0x15, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x18, 0x19, 0x11, 0x4c, + 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x5a, 0x05, 0x42, 0xa2, + 0x04, 0x46, 0x00, 0x8a, 0xa1, 0x08, 0x4a, 0xa2, 0x50, 0xca, 0xa0, 0x1c, + 0x0a, 0xa4, 0x10, 0x4a, 0xa1, 0xc0, 0x0a, 0xa8, 0x3c, 0x8a, 0x87, 0x56, + 0x11, 0x8c, 0x00, 0x14, 0x42, 0x19, 0x94, 0x04, 0x9d, 0x19, 0x00, 0x2a, + 0x33, 0x00, 0x44, 0x66, 0x00, 0x68, 0xcc, 0x00, 0x50, 0x98, 0x01, 0x20, + 0x3e, 0x03, 0x40, 0x7d, 0x2c, 0x87, 0x21, 0x00, 0x00, 0x00, 0x8e, 0x03, + 0x00, 0x02, 0x81, 0x40, 0x00, 0x79, 0x18, 0x00, 0x00, 0xc4, 0x00, 0x00, + 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, 0x44, 0x35, 0x18, 0x63, + 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x03, + 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1, 0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, + 0x62, 0x2a, 0x0a, 0x9a, 0x2a, 0xfa, 0x9a, 0xb9, 0x81, 0x79, 0x31, 0x4b, + 0x73, 0x0b, 0x63, 0x4b, 0xd9, 0x10, 0x04, 0x13, 0x04, 0x61, 0x99, 0x20, + 0x08, 0xcc, 0x06, 0x61, 0x20, 0x36, 0x08, 0x04, 0x41, 0x01, 0x6e, 0x6e, + 0x82, 0x20, 0x34, 0x1b, 0x86, 0x03, 0x21, 0x26, 0x08, 0x05, 0x18, 0x70, + 0xa1, 0x43, 0x2b, 0xa3, 0x2a, 0xc3, 0xa3, 0xab, 0x93, 0x2b, 0xcb, 0x9a, + 0x20, 0x08, 0xce, 0x04, 0x41, 0x78, 0x36, 0x08, 0x44, 0xb3, 0x21, 0x21, + 0x94, 0x85, 0x20, 0x06, 0x86, 0x70, 0xb8, 0xd0, 0xa1, 0x95, 0x51, 0x95, + 0xe1, 0xd1, 0xd5, 0xc9, 0x95, 0x55, 0x6d, 0x48, 0x06, 0x05, 0x22, 0x86, + 0x81, 0x21, 0x1c, 0x2e, 0x74, 0x68, 0x65, 0x54, 0x65, 0x78, 0x74, 0x75, + 0x72, 0x65, 0x56, 0x1b, 0x12, 0x46, 0x91, 0x08, 0x66, 0x60, 0x08, 0x67, + 0xc3, 0xf0, 0x44, 0xd3, 0x04, 0xe1, 0xf8, 0xa8, 0xd0, 0xa1, 0x95, 0x4d, + 0x85, 0xb5, 0xc1, 0xb1, 0x95, 0xc9, 0x6d, 0x40, 0x88, 0xca, 0x22, 0x88, + 0x81, 0x00, 0x36, 0x04, 0xd7, 0x06, 0x82, 0x02, 0x00, 0x6c, 0x82, 0x40, + 0x84, 0xc1, 0x04, 0x41, 0x80, 0x18, 0xa0, 0x4d, 0x10, 0x84, 0x68, 0x82, + 0x20, 0x48, 0x1b, 0x0c, 0x84, 0xeb, 0x08, 0xaf, 0x21, 0xd1, 0x96, 0x06, + 0x37, 0x37, 0x41, 0x10, 0xa6, 0x0d, 0x04, 0x02, 0x06, 0x5d, 0x18, 0x4c, + 0x10, 0x82, 0x31, 0xd8, 0x20, 0x10, 0x63, 0xb0, 0x21, 0x20, 0x83, 0x0d, + 0x02, 0x51, 0x06, 0x1b, 0x88, 0xed, 0x13, 0x03, 0x33, 0x98, 0x20, 0x0c, + 0x62, 0x30, 0x41, 0x10, 0x28, 0x1a, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, + 0x13, 0x04, 0xa1, 0xda, 0x60, 0x20, 0x6a, 0xd0, 0x11, 0xde, 0x1a, 0x6c, + 0x10, 0xd2, 0x80, 0x0d, 0x26, 0x08, 0x1c, 0x19, 0x4c, 0x10, 0x04, 0x8b, + 0x03, 0xdc, 0xdb, 0x1c, 0x97, 0x29, 0xab, 0x2f, 0xa8, 0xa7, 0xa9, 0x24, + 0xaa, 0xa4, 0x27, 0xa7, 0x0d, 0x08, 0x02, 0x07, 0x1d, 0x91, 0x06, 0x71, + 0xe0, 0x35, 0x1c, 0xe8, 0xca, 0xf0, 0x98, 0x50, 0x15, 0x61, 0x0d, 0x3d, + 0x3d, 0x49, 0x11, 0xc1, 0x6c, 0x40, 0x90, 0x39, 0xe8, 0xc2, 0x20, 0x0d, + 0xe8, 0xc0, 0x6b, 0x58, 0x8c, 0xbd, 0xb1, 0xbd, 0xc9, 0x4d, 0x10, 0x84, + 0x8b, 0xc6, 0xd0, 0x13, 0xd3, 0x93, 0x14, 0xcc, 0x06, 0x04, 0xb1, 0x83, + 0xee, 0x0e, 0xd2, 0x00, 0x0f, 0xbc, 0x66, 0x03, 0xf1, 0x06, 0x72, 0x50, + 0x07, 0x79, 0xb0, 0xe1, 0x20, 0xb4, 0x33, 0x40, 0x83, 0x36, 0x70, 0x03, + 0x3d, 0x98, 0x20, 0x28, 0xc4, 0x06, 0x60, 0xc3, 0x40, 0xf4, 0x41, 0x1f, + 0x6c, 0x08, 0xfc, 0x60, 0xc3, 0x30, 0xf0, 0xc1, 0x1f, 0x4c, 0x10, 0xba, + 0x32, 0xd8, 0x10, 0x84, 0x02, 0x89, 0xb6, 0xb0, 0x34, 0x37, 0x2e, 0x53, + 0x56, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x13, 0x84, + 0xc5, 0x9b, 0x20, 0x2c, 0xdd, 0x86, 0x80, 0x98, 0x20, 0x2c, 0xdc, 0x04, + 0x61, 0xd9, 0x36, 0x2c, 0x04, 0x29, 0x94, 0x82, 0x29, 0x9c, 0x02, 0x2a, + 0x0c, 0xa8, 0x40, 0xa4, 0x02, 0x40, 0x84, 0xaa, 0x08, 0x6b, 0xe8, 0xe9, + 0x49, 0x8a, 0x68, 0x82, 0xb0, 0x68, 0x1b, 0x84, 0xae, 0xdb, 0xb0, 0x0c, + 0xab, 0x50, 0x0a, 0xa9, 0x70, 0x0a, 0xac, 0x30, 0xb0, 0xc2, 0x90, 0x0a, + 0xad, 0xc0, 0x62, 0xe8, 0x89, 0xe9, 0x49, 0x6a, 0x82, 0x20, 0x60, 0x1b, + 0x84, 0x0e, 0x16, 0x36, 0x2c, 0xcc, 0x2b, 0x94, 0x42, 0x2a, 0x9c, 0x02, + 0x2b, 0x0c, 0xa8, 0xc0, 0xa4, 0x42, 0x2c, 0x6c, 0x18, 0x54, 0xc1, 0x15, + 0x64, 0x81, 0xc9, 0x94, 0xd5, 0x17, 0x55, 0x98, 0xdc, 0x59, 0x19, 0xdd, + 0x04, 0x61, 0x51, 0x36, 0x2c, 0x04, 0x2d, 0x94, 0x42, 0x2d, 0x9c, 0x42, + 0x2a, 0x0c, 0xa8, 0x40, 0xa4, 0x42, 0x2c, 0x6c, 0x08, 0x6c, 0x61, 0xc3, + 0x30, 0x0b, 0xb7, 0x00, 0x6c, 0x28, 0xf8, 0x60, 0x14, 0x70, 0x21, 0x03, + 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xcd, 0xb1, 0x48, 0x73, 0x9b, 0xa3, + 0x9b, 0x9b, 0x20, 0x08, 0x19, 0x8d, 0xb9, 0xb4, 0xb3, 0x2f, 0x36, 0x32, + 0x1a, 0x73, 0x69, 0x67, 0x5f, 0x73, 0x74, 0x44, 0xe8, 0xca, 0xf0, 0xbe, + 0xdc, 0xde, 0xe4, 0xda, 0x36, 0x28, 0xba, 0xd0, 0xec, 0x02, 0x2f, 0xf4, + 0x02, 0xe2, 0x0b, 0x69, 0xf0, 0x0b, 0x5d, 0x15, 0x36, 0x36, 0xbb, 0x36, + 0x97, 0x34, 0xb2, 0x32, 0x37, 0xba, 0x29, 0x41, 0x50, 0x85, 0x0c, 0xcf, + 0xc5, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x6d, 0x4a, 0x40, 0x34, 0x21, + 0xc3, 0x73, 0xb1, 0x0b, 0x63, 0xb3, 0x2b, 0x93, 0x9b, 0x12, 0x14, 0x75, + 0xc8, 0xf0, 0x5c, 0xe6, 0xd0, 0xc2, 0xc8, 0xca, 0xe4, 0x9a, 0xde, 0xc8, + 0xca, 0xd8, 0xa6, 0x04, 0x48, 0x19, 0x32, 0x3c, 0x17, 0xb9, 0xb2, 0xb9, + 0xb7, 0x3a, 0xb9, 0xb1, 0xb2, 0xb9, 0x29, 0x01, 0x56, 0x89, 0x0c, 0xcf, + 0x85, 0x2e, 0x0f, 0xae, 0x2c, 0xc8, 0xcd, 0xed, 0x8d, 0x2e, 0x8c, 0x2e, + 0xed, 0xcd, 0x6d, 0x6e, 0x8a, 0xa0, 0x07, 0x7f, 0x50, 0x87, 0x0c, 0xcf, + 0xc5, 0x2e, 0xad, 0xec, 0x2e, 0x89, 0x6c, 0x8a, 0x2e, 0x8c, 0xae, 0x6c, + 0x4a, 0x10, 0x0a, 0x75, 0xc8, 0xf0, 0x5c, 0xca, 0xdc, 0xe8, 0xe4, 0xf2, + 0xa0, 0xde, 0xd2, 0xdc, 0xe8, 0xe6, 0xa6, 0x04, 0xb8, 0xd0, 0x85, 0x0c, + 0xcf, 0x65, 0xec, 0xad, 0xce, 0x8d, 0xae, 0x4c, 0x6e, 0x6e, 0x4a, 0xf0, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x4c, 0x00, 0x00, + 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, + 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, + 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, + 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, + 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, + 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, + 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, + 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, + 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, + 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, + 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, + 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, + 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, + 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, + 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, + 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, + 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, + 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, + 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, + 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, + 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, + 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, + 0xc4, 0x21, 0x07, 0x7c, 0x70, 0x03, 0x7a, 0x28, 0x87, 0x76, 0x80, 0x87, + 0x19, 0xd1, 0x43, 0x0e, 0xf8, 0xe0, 0x06, 0xe4, 0x20, 0x0e, 0xe7, 0xe0, + 0x06, 0xf6, 0x10, 0x0e, 0xf2, 0xc0, 0x0e, 0xe1, 0x90, 0x0f, 0xef, 0x50, + 0x0f, 0xf4, 0x00, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x3e, 0x00, 0x00, + 0x00, 0x35, 0xf0, 0x05, 0x7e, 0x74, 0x74, 0x79, 0x1a, 0x6e, 0xc3, 0xd9, + 0x65, 0x39, 0x10, 0x38, 0xab, 0x4e, 0xc3, 0x6d, 0x38, 0xbb, 0x2c, 0x9f, + 0xd2, 0xc3, 0xf4, 0x32, 0x10, 0x18, 0xac, 0x00, 0x38, 0x08, 0xfc, 0xe8, + 0xe8, 0x32, 0xb5, 0x8c, 0xa7, 0xd7, 0xe5, 0xe5, 0x2a, 0x10, 0x38, 0xb3, + 0xfe, 0x48, 0xd4, 0x32, 0x9e, 0x5e, 0x97, 0x97, 0x65, 0x44, 0xa0, 0xf5, + 0x47, 0xb2, 0x97, 0xc7, 0xf4, 0xb7, 0x1c, 0xd8, 0x24, 0xc1, 0x66, 0x40, + 0x20, 0x10, 0x18, 0x2c, 0x01, 0x38, 0x08, 0xfc, 0xe8, 0xe8, 0x32, 0xb5, + 0x8c, 0xa7, 0xd7, 0xe5, 0x65, 0x2b, 0x10, 0x38, 0xb3, 0xfe, 0x48, 0xd4, + 0x32, 0x9e, 0x5e, 0x97, 0x97, 0x65, 0x44, 0xa0, 0xf5, 0x47, 0xb2, 0x97, + 0xc7, 0xf4, 0xb7, 0x1c, 0xd8, 0x24, 0xc1, 0x66, 0x40, 0x20, 0x10, 0x18, + 0x2c, 0x00, 0x38, 0x08, 0xfc, 0xe8, 0xe8, 0x32, 0xb5, 0x8c, 0xa7, 0xd7, + 0xe5, 0xe5, 0x2c, 0x10, 0x38, 0xb3, 0xfe, 0x48, 0xd4, 0x32, 0x9e, 0x5e, + 0x97, 0x97, 0x65, 0x44, 0xa0, 0xf5, 0x47, 0xb2, 0x97, 0xc7, 0xf4, 0xb7, + 0x1c, 0xd8, 0x24, 0xc1, 0x66, 0x40, 0x20, 0x10, 0x18, 0xb4, 0x04, 0x69, + 0xb8, 0x7c, 0xe7, 0xf1, 0x85, 0x88, 0x00, 0x26, 0x22, 0x04, 0x9a, 0x61, + 0x21, 0x0c, 0xc1, 0x19, 0x2e, 0xdf, 0x79, 0xfc, 0xc1, 0x99, 0x6e, 0xbf, + 0xb8, 0x6d, 0x2b, 0x98, 0x86, 0xcb, 0x77, 0x1e, 0x7f, 0x71, 0x80, 0x41, + 0x6c, 0x1e, 0x6a, 0xf2, 0x8b, 0xdb, 0xb6, 0x03, 0x68, 0xb8, 0x7c, 0xe7, + 0xf1, 0x25, 0x80, 0x79, 0x16, 0xc2, 0x2f, 0x6e, 0xdb, 0x0c, 0xaa, 0xe1, + 0xf2, 0x9d, 0xc7, 0x97, 0x26, 0x27, 0x22, 0x50, 0x6a, 0x7a, 0xa8, 0xc9, + 0x2f, 0x6e, 0xdb, 0x08, 0x08, 0x06, 0x40, 0x1a, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x48, 0x41, 0x53, 0x48, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x28, 0xea, 0x91, 0x74, 0x07, 0xef, 0x37, 0x34, 0xc5, 0x63, 0xc4, + 0x30, 0x49, 0xbf, 0x93, 0x8b, 0x44, 0x58, 0x49, 0x4c, 0xe0, 0x07, 0x00, + 0x00, 0x60, 0x00, 0x00, 0x00, 0xf8, 0x01, 0x00, 0x00, 0x44, 0x58, 0x49, + 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xc8, 0x07, 0x00, + 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0xef, 0x01, 0x00, + 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, + 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, + 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, + 0x62, 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, + 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x52, 0x88, 0x48, 0x90, 0x14, + 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, + 0x90, 0x91, 0x22, 0xc4, 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, + 0x8a, 0x04, 0x29, 0x46, 0x06, 0x51, 0x18, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, 0x02, 0xa8, + 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x20, 0x6d, 0x30, 0x86, + 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x09, 0xa8, 0x00, 0x49, 0x18, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, 0x4c, 0x08, + 0x06, 0x00, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x45, 0x00, 0x00, + 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, + 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, + 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x70, 0x23, 0x00, 0x25, 0x00, 0x14, + 0x66, 0x00, 0xe6, 0x08, 0xc0, 0x60, 0x8e, 0x00, 0x29, 0xc6, 0x20, 0x84, + 0x14, 0x42, 0xa6, 0x18, 0x80, 0x10, 0x52, 0x06, 0xa1, 0x9b, 0x86, 0xcb, + 0x9f, 0xb0, 0x87, 0x90, 0xfc, 0x95, 0x90, 0x56, 0x62, 0xf2, 0x8b, 0xdb, + 0x46, 0xc5, 0x18, 0x63, 0x10, 0x2a, 0xf7, 0x0c, 0x97, 0x3f, 0x61, 0x0f, + 0x21, 0xf9, 0x21, 0xd0, 0x0c, 0x0b, 0x81, 0x82, 0x55, 0x18, 0x45, 0x18, + 0x1b, 0x63, 0x0c, 0x42, 0xc8, 0xa0, 0x56, 0x90, 0x41, 0xc6, 0x18, 0x63, + 0x0c, 0x7a, 0x73, 0x04, 0x41, 0x31, 0x18, 0x29, 0x84, 0x44, 0x92, 0x03, + 0x01, 0xc3, 0x08, 0xc4, 0x30, 0x53, 0x1b, 0x8c, 0x03, 0x3b, 0x84, 0xc3, + 0x3c, 0xcc, 0x83, 0x1b, 0xd0, 0x42, 0x39, 0xe0, 0x03, 0x3d, 0xd4, 0x83, + 0x3c, 0x94, 0x83, 0x1c, 0x90, 0x02, 0x1f, 0xd8, 0x43, 0x39, 0x8c, 0x03, + 0x3d, 0xbc, 0x83, 0x3c, 0xf0, 0x81, 0x39, 0xb0, 0xc3, 0x3b, 0x84, 0x03, + 0x3d, 0xb0, 0x01, 0x18, 0xd0, 0x81, 0x1f, 0x80, 0x81, 0x1f, 0xe8, 0x81, + 0x1e, 0xb4, 0x43, 0x3a, 0xc0, 0xc3, 0x3c, 0xfc, 0x02, 0x3d, 0xe4, 0x03, + 0x3c, 0x94, 0x03, 0x0a, 0xc8, 0x4c, 0x62, 0x30, 0x0e, 0xec, 0x10, 0x0e, + 0xf3, 0x30, 0x0f, 0x6e, 0x40, 0x0b, 0xe5, 0x80, 0x0f, 0xf4, 0x50, 0x0f, + 0xf2, 0x50, 0x0e, 0x72, 0x40, 0x0a, 0x7c, 0x60, 0x0f, 0xe5, 0x30, 0x0e, + 0xf4, 0xf0, 0x0e, 0xf2, 0xc0, 0x07, 0xe6, 0xc0, 0x0e, 0xef, 0x10, 0x0e, + 0xf4, 0xc0, 0x06, 0x60, 0x40, 0x07, 0x7e, 0x00, 0x06, 0x7e, 0x80, 0x84, + 0x6a, 0xe9, 0xde, 0x24, 0x4d, 0x11, 0x25, 0x4c, 0x3e, 0x0b, 0x30, 0xcf, + 0x42, 0x44, 0xec, 0x04, 0x4c, 0x04, 0x0a, 0x08, 0xe5, 0x74, 0x20, 0x00, + 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, + 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, + 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, + 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x43, 0x9e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x3c, 0x06, 0x10, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x79, 0x10, + 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xf2, + 0x34, 0x40, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, + 0xe4, 0x79, 0x80, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x60, 0xc8, 0x23, 0x01, 0x01, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x40, 0x16, 0x08, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, + 0x14, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, + 0x22, 0x25, 0x30, 0x02, 0x50, 0x0c, 0x45, 0x50, 0x12, 0x65, 0x50, 0x1e, + 0x54, 0x4a, 0xa2, 0x0c, 0x0a, 0x61, 0x04, 0xa0, 0x08, 0x0a, 0x84, 0xf0, + 0x0c, 0x00, 0xe9, 0x19, 0x00, 0xda, 0x63, 0x39, 0x0c, 0x01, 0x00, 0x00, + 0x70, 0x1c, 0x00, 0x10, 0x08, 0x04, 0x02, 0x00, 0x00, 0x79, 0x18, 0x00, + 0x00, 0x69, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, + 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b, 0x93, 0x9b, + 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1, 0x0b, 0x3b, + 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, 0x0a, 0x9a, 0x2a, 0xfa, 0x9a, 0xb9, + 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, 0x63, 0x4b, 0xd9, 0x10, 0x04, 0x13, + 0x04, 0xc2, 0x98, 0x20, 0x10, 0xc7, 0x06, 0x61, 0x20, 0x26, 0x08, 0x04, + 0xb2, 0x41, 0x18, 0x0c, 0x0a, 0x70, 0x73, 0x1b, 0x06, 0xc4, 0x20, 0x26, + 0x08, 0xd8, 0x44, 0x60, 0x82, 0x40, 0x24, 0x13, 0x04, 0x42, 0xd9, 0x20, + 0x10, 0xcd, 0x86, 0x84, 0x50, 0x16, 0x82, 0x18, 0x18, 0xc2, 0xd9, 0x90, + 0x0c, 0xca, 0x42, 0x0c, 0x03, 0x43, 0x38, 0x1b, 0x12, 0x46, 0x59, 0x08, + 0x66, 0x60, 0x08, 0x67, 0xc3, 0xf0, 0x40, 0xd1, 0x04, 0x41, 0xa3, 0x36, + 0x20, 0xc4, 0xb4, 0x10, 0xc4, 0x40, 0x00, 0x1b, 0x02, 0x6a, 0x03, 0x21, + 0x01, 0x40, 0x35, 0x41, 0xd8, 0xaa, 0x0d, 0xc1, 0x35, 0x41, 0x10, 0x00, + 0x12, 0x6d, 0x61, 0x69, 0x6e, 0x5c, 0xa6, 0xac, 0xbe, 0xa0, 0xde, 0xe6, + 0xd2, 0xe8, 0xd2, 0xde, 0xdc, 0x26, 0x08, 0x45, 0x33, 0x41, 0x28, 0x9c, + 0x0d, 0x01, 0x31, 0x41, 0x28, 0x9e, 0x09, 0x42, 0x01, 0x6d, 0x58, 0x88, + 0x8d, 0xeb, 0xbc, 0x6f, 0xf8, 0x08, 0x30, 0x00, 0x88, 0x50, 0x15, 0x61, + 0x0d, 0x3d, 0x3d, 0x49, 0x11, 0x4d, 0x10, 0x8a, 0x68, 0x82, 0x40, 0x2c, + 0x1b, 0x04, 0x32, 0x20, 0x83, 0x0d, 0xcb, 0x20, 0x06, 0x1c, 0x18, 0x78, + 0x63, 0x30, 0x8c, 0xc1, 0x00, 0x06, 0x65, 0xc0, 0x62, 0xe8, 0x89, 0xe9, + 0x49, 0x6a, 0x82, 0x40, 0x30, 0x1b, 0x04, 0x32, 0x40, 0x83, 0x0d, 0x0b, + 0x73, 0x06, 0x1c, 0x18, 0x78, 0x63, 0x30, 0x7c, 0x0c, 0x18, 0xa4, 0xc1, + 0x86, 0x21, 0x0c, 0xcc, 0x40, 0x0d, 0x98, 0x4c, 0x59, 0x7d, 0x51, 0x85, + 0xc9, 0x9d, 0x95, 0xd1, 0x4d, 0x10, 0x0a, 0x69, 0xc3, 0x42, 0xb0, 0x01, + 0xd7, 0x06, 0x1e, 0x18, 0x0c, 0x1f, 0x01, 0x06, 0x69, 0xb0, 0x21, 0x70, + 0x83, 0x0d, 0xc3, 0x1a, 0xbc, 0x01, 0xb0, 0xa1, 0xc8, 0x34, 0x38, 0xb0, + 0x80, 0x2a, 0x6c, 0x6c, 0x76, 0x6d, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, + 0x53, 0x82, 0xa0, 0x0a, 0x19, 0x9e, 0x8b, 0x5d, 0x99, 0xdc, 0x5c, 0xda, + 0x9b, 0xdb, 0x94, 0x80, 0x68, 0x42, 0x86, 0xe7, 0x62, 0x17, 0xc6, 0x66, + 0x57, 0x26, 0x37, 0x25, 0x30, 0xea, 0x90, 0xe1, 0xb9, 0xcc, 0xa1, 0x85, + 0x91, 0x95, 0xc9, 0x35, 0xbd, 0x91, 0x95, 0xb1, 0x4d, 0x09, 0x90, 0x32, + 0x64, 0x78, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, + 0x53, 0x82, 0xaa, 0x0e, 0x19, 0x9e, 0x8b, 0x5d, 0x5a, 0xd9, 0x5d, 0x12, + 0xd9, 0x14, 0x5d, 0x18, 0x5d, 0xd9, 0x94, 0xe0, 0xaa, 0x43, 0x86, 0xe7, + 0x52, 0xe6, 0x46, 0x27, 0x97, 0x07, 0xf5, 0x96, 0xe6, 0x46, 0x37, 0x37, + 0x25, 0x80, 0x03, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x4c, 0x00, 0x00, + 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, + 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, + 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, + 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, + 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, + 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, + 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, + 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, + 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, + 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, + 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, + 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, + 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, + 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, + 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, + 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, + 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, + 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, + 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, + 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, + 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, + 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, + 0xc4, 0x21, 0x07, 0x7c, 0x70, 0x03, 0x7a, 0x28, 0x87, 0x76, 0x80, 0x87, + 0x19, 0xd1, 0x43, 0x0e, 0xf8, 0xe0, 0x06, 0xe4, 0x20, 0x0e, 0xe7, 0xe0, + 0x06, 0xf6, 0x10, 0x0e, 0xf2, 0xc0, 0x0e, 0xe1, 0x90, 0x0f, 0xef, 0x50, + 0x0f, 0xf4, 0x00, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x15, 0x00, 0x00, + 0x00, 0x56, 0x20, 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x10, 0x11, 0xc0, 0x44, + 0x84, 0x40, 0x33, 0x2c, 0x84, 0x11, 0x38, 0xc3, 0xe5, 0x3b, 0x8f, 0x3f, + 0x38, 0xd3, 0xed, 0x17, 0xb7, 0x6d, 0x01, 0xd3, 0x70, 0xf9, 0xce, 0xe3, + 0x2f, 0x0e, 0x30, 0x88, 0xcd, 0x43, 0x4d, 0x7e, 0x71, 0xdb, 0x36, 0x00, + 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x04, 0x30, 0xcf, 0x42, 0xf8, 0xc5, 0x6d, + 0x9b, 0x40, 0x35, 0x5c, 0xbe, 0xf3, 0xf8, 0xd2, 0xe4, 0x44, 0x04, 0x4a, + 0x4d, 0x0f, 0x35, 0xf9, 0xc5, 0x6d, 0x1b, 0x00, 0xc1, 0x00, 0x48, 0x03, + 0x00, 0x61, 0x20, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, + 0x2c, 0x10, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x14, 0x47, 0x00, + 0xa8, 0x94, 0x00, 0x91, 0x72, 0x2b, 0xbc, 0x52, 0x28, 0xb9, 0x42, 0x98, + 0x01, 0xa0, 0x31, 0x46, 0x00, 0xb3, 0xac, 0x0b, 0x82, 0xc1, 0x18, 0x81, + 0x18, 0xee, 0x30, 0xfc, 0x0b, 0x63, 0x04, 0x3a, 0x4a, 0xd3, 0xe5, 0x2f, + 0x8c, 0x11, 0xc8, 0x79, 0xaf, 0xfa, 0xdf, 0x18, 0x41, 0x48, 0x82, 0x21, + 0xee, 0x0b, 0x23, 0x00, 0x63, 0x04, 0x21, 0x09, 0x86, 0xf0, 0x2f, 0x8c, + 0x11, 0xbc, 0xb8, 0xa8, 0xe6, 0xdf, 0x0c, 0x00, 0x00, 0x23, 0x06, 0x09, + 0x00, 0x82, 0x60, 0x20, 0x89, 0x01, 0x73, 0x79, 0x5e, 0x34, 0x62, 0x90, + 0x00, 0x20, 0x08, 0x06, 0xd2, 0x18, 0x34, 0x98, 0x18, 0x88, 0x81, 0x34, + 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x12, 0x19, 0x38, 0x99, 0x18, 0x88, + 0xc1, 0x34, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x52, 0x19, 0x3c, 0xdc, + 0x18, 0x8c, 0x01, 0x35, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x86, 0x1a, + 0x3c, 0x62, 0x40, 0x06, 0x9b, 0x33, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, + 0xc6, 0x1a, 0x40, 0x63, 0x50, 0x06, 0xd5, 0x33, 0x62, 0x90, 0x00, 0x20, + 0x08, 0x06, 0x06, 0x1b, 0x44, 0x64, 0x60, 0x06, 0x1c, 0x34, 0x62, 0x90, + 0x00, 0x20, 0x08, 0x06, 0x46, 0x1b, 0x48, 0x65, 0x70, 0x06, 0x60, 0x10, + 0x8d, 0x18, 0x24, 0x00, 0x08, 0x82, 0x81, 0xe1, 0x06, 0x53, 0x1a, 0xa0, + 0xc1, 0x27, 0x8d, 0x18, 0x24, 0x00, 0x08, 0x82, 0x81, 0xf1, 0x06, 0x94, + 0x1a, 0xa4, 0x41, 0x36, 0x8d, 0x18, 0x3c, 0x00, 0x08, 0x82, 0x41, 0xe3, + 0x06, 0x18, 0x72, 0x08, 0xc1, 0xb2, 0xa8, 0x81, 0x1a, 0x50, 0xcb, 0x68, + 0x42, 0x00, 0x8c, 0x18, 0x3c, 0x00, 0x08, 0x82, 0x41, 0x03, 0x07, 0xda, + 0x92, 0x10, 0x43, 0xd3, 0xb0, 0x01, 0x1b, 0x58, 0xcd, 0x68, 0x42, 0x00, + 0x8c, 0x18, 0x3c, 0x00, 0x08, 0x82, 0x41, 0x23, 0x07, 0x9c, 0xb3, 0x18, + 0xc5, 0xf3, 0xb8, 0x81, 0x1b, 0x60, 0xcf, 0x68, 0x42, 0x00, 0x58, 0x51, + 0xc1, 0xc7, 0x08, 0x0a, 0x3e, 0x36, 0x54, 0xf0, 0x19, 0x31, 0x58, 0x00, + 0x10, 0x04, 0x83, 0xc7, 0x0e, 0xc4, 0x60, 0x10, 0x82, 0xea, 0xca, 0x46, + 0x0c, 0x16, 0x00, 0x04, 0xc1, 0xe0, 0xb9, 0x83, 0x31, 0x20, 0x06, 0xc1, + 0xda, 0xb8, 0x11, 0x83, 0x05, 0x00, 0x41, 0x30, 0x78, 0xf0, 0x80, 0x0c, + 0x0a, 0x62, 0xb8, 0xbc, 0xcc, 0x06, 0x49, 0x3e, 0x36, 0x48, 0xf2, 0xb1, + 0x41, 0x92, 0xcf, 0x88, 0x41, 0x02, 0x80, 0x20, 0x18, 0x20, 0x7e, 0x60, + 0x06, 0x79, 0x90, 0x07, 0x70, 0x30, 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, + 0x01, 0xe2, 0x07, 0x66, 0x90, 0x07, 0x79, 0x90, 0x06, 0xc2, 0x88, 0x41, + 0x02, 0x80, 0x20, 0x18, 0x20, 0x7e, 0x60, 0x06, 0x79, 0x90, 0x07, 0x6f, + 0x10, 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, 0x01, 0xe2, 0x07, 0x66, 0x90, + 0x07, 0x79, 0x20, 0x07, 0x12, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00 +}; + +/* The yuv-rendering pixel shader: + + --- D3D12_PixelShader_NV12_JPEG.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureUV : register(t1); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + #define NVRS \ + "RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \ + " DENY_DOMAIN_SHADER_ROOT_ACCESS |" \ + " DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \ + " DENY_HULL_SHADER_ROOT_ACCESS )," \ + "RootConstants(num32BitConstants=32, b0),"\ + "DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )" + + [RootSignature(NVRS)] + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {0.0, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.0000, 0.0000, 1.4020}; + const float3 Gcoeff = {1.0000, -0.3441, -0.7141}; + const float3 Bcoeff = {1.0000, 1.7720, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ + +static unsigned char D3D12_PixelShader_NV12_JPEG[] = { + 0x44, 0x58, 0x42, 0x43, 0x4d, 0x84, 0xab, 0xd3, 0xf9, 0x2a, 0x29, 0x46, + 0xc8, 0x39, 0x22, 0xd6, 0x7a, 0xdf, 0x22, 0x16, 0x01, 0x00, 0x00, 0x00, + 0xe1, 0x12, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, + 0x50, 0x00, 0x00, 0x00, 0xdb, 0x00, 0x00, 0x00, 0x15, 0x01, 0x00, 0x00, + 0x0d, 0x02, 0x00, 0x00, 0xc9, 0x02, 0x00, 0x00, 0x1d, 0x0b, 0x00, 0x00, + 0x39, 0x0b, 0x00, 0x00, 0x53, 0x46, 0x49, 0x30, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x31, + 0x83, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x53, 0x56, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, + 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x43, 0x4f, 0x4c, + 0x4f, 0x52, 0x00, 0x4f, 0x53, 0x47, 0x31, 0x32, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x00, 0x50, 0x53, 0x56, 0x30, 0xf0, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, + 0xff, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01, 0x00, 0x03, 0x01, 0x00, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x43, + 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x44, 0x03, 0x03, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x42, 0x00, 0x03, 0x02, 0x00, + 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x44, + 0x00, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x44, 0x10, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x52, 0x54, 0x53, + 0x30, 0xb4, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, + 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, + 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, + 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, + 0x00, 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, + 0xff, 0x01, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, + 0x00, 0x9c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xff, 0xff, 0x53, 0x54, 0x41, 0x54, 0x4c, 0x08, 0x00, + 0x00, 0x60, 0x00, 0x00, 0x00, 0x13, 0x02, 0x00, 0x00, 0x44, 0x58, 0x49, + 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x34, 0x08, 0x00, + 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0x0a, 0x02, 0x00, + 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, + 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, + 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, + 0x62, 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, + 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x52, 0x88, 0x48, 0x90, 0x14, + 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, + 0x90, 0x91, 0x22, 0xc4, 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, + 0x8a, 0x04, 0x29, 0x46, 0x06, 0x51, 0x18, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, 0x02, 0xa8, + 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x20, 0x6d, 0x30, 0x86, + 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x09, 0xa8, 0x00, 0x49, 0x18, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, 0x4c, 0x08, + 0x06, 0x00, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x4b, 0x00, 0x00, + 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, + 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, + 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x78, 0x33, 0x00, 0xc3, 0x08, 0x04, + 0x30, 0x47, 0x00, 0x06, 0x33, 0xb5, 0xc1, 0x38, 0xb0, 0x43, 0x38, 0xcc, + 0xc3, 0x3c, 0xb8, 0x01, 0x2d, 0x94, 0x03, 0x3e, 0xd0, 0x43, 0x3d, 0xc8, + 0x43, 0x39, 0xc8, 0x01, 0x29, 0xf0, 0x81, 0x3d, 0x94, 0xc3, 0x38, 0xd0, + 0xc3, 0x3b, 0xc8, 0x03, 0x1f, 0x98, 0x03, 0x3b, 0xbc, 0x43, 0x38, 0xd0, + 0x03, 0x1b, 0x80, 0x01, 0x1d, 0xf8, 0x01, 0x18, 0xf8, 0x81, 0x1e, 0xe8, + 0x41, 0x3b, 0xa4, 0x03, 0x3c, 0xcc, 0xc3, 0x2f, 0xd0, 0x43, 0x3e, 0xc0, + 0x43, 0x39, 0xa0, 0x40, 0xcc, 0x24, 0x06, 0xe3, 0xc0, 0x0e, 0xe1, 0x30, + 0x0f, 0xf3, 0xe0, 0x06, 0xb4, 0x50, 0x0e, 0xf8, 0x40, 0x0f, 0xf5, 0x20, + 0x0f, 0xe5, 0x20, 0x07, 0xa4, 0xc0, 0x07, 0xf6, 0x50, 0x0e, 0xe3, 0x40, + 0x0f, 0xef, 0x20, 0x0f, 0x7c, 0x60, 0x0e, 0xec, 0xf0, 0x0e, 0xe1, 0x40, + 0x0f, 0x6c, 0x00, 0x06, 0x74, 0xe0, 0x07, 0x60, 0xe0, 0x07, 0x48, 0x08, + 0x83, 0xc8, 0x4d, 0xd2, 0x14, 0x51, 0xc2, 0xe4, 0xb3, 0x00, 0xf3, 0x2c, + 0x44, 0xc4, 0x4e, 0xc0, 0x44, 0xa0, 0x40, 0x90, 0x19, 0x01, 0x28, 0x01, + 0xa2, 0x34, 0x47, 0x80, 0x14, 0x03, 0x08, 0x21, 0x96, 0x20, 0x56, 0x0c, + 0x24, 0x84, 0x58, 0x80, 0xdc, 0x4d, 0xc3, 0xe5, 0x4f, 0xd8, 0x43, 0x48, + 0xfe, 0x4a, 0x48, 0x2b, 0x31, 0xf9, 0xc5, 0x6d, 0xa3, 0x02, 0x00, 0x00, + 0x04, 0xad, 0x7b, 0x86, 0xcb, 0x9f, 0xb0, 0x87, 0x90, 0xfc, 0x10, 0x68, + 0x86, 0x85, 0x40, 0x41, 0x2c, 0x0c, 0x14, 0x52, 0x02, 0x00, 0x80, 0x10, + 0x02, 0xd0, 0x2c, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0xd5, 0x39, 0x82, + 0xa0, 0x18, 0x52, 0x2c, 0x21, 0x2e, 0xe1, 0x81, 0x80, 0x61, 0x04, 0x01, + 0xb8, 0x4b, 0x9a, 0x22, 0x4a, 0x98, 0xfc, 0x14, 0xb9, 0x88, 0x85, 0x3d, + 0x80, 0x81, 0x88, 0xc4, 0xe6, 0xa1, 0x26, 0x34, 0x84, 0x1d, 0xd2, 0x41, + 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, + 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, + 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, + 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x3a, 0x0f, 0x64, 0x90, 0x21, + 0x23, 0x45, 0x44, 0x00, 0x72, 0x00, 0xc0, 0xe4, 0x00, 0x80, 0xe9, 0x01, + 0x00, 0x0f, 0x79, 0x12, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x18, 0xf2, 0x30, 0x40, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x30, 0xe4, 0x71, 0x80, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x60, 0xc8, 0x33, 0x01, 0x01, 0x30, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x90, 0xa7, 0x02, 0x02, 0x20, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x21, 0x0f, 0x06, 0x04, 0xc0, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x59, 0x20, 0x00, 0x00, + 0x00, 0x16, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x18, 0x19, 0x11, 0x4c, + 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x5a, 0x05, 0x42, 0xa2, + 0x04, 0x46, 0x00, 0x8a, 0xa1, 0x08, 0x4a, 0xa2, 0x50, 0xca, 0xa0, 0x1c, + 0x0a, 0xa4, 0x10, 0x4a, 0xa1, 0xc0, 0x0a, 0xa8, 0x3c, 0x0a, 0xa2, 0x6c, + 0x68, 0x15, 0xc1, 0x08, 0x40, 0x21, 0x94, 0x41, 0x49, 0xd0, 0x99, 0x01, + 0xa0, 0x32, 0x03, 0x40, 0x64, 0x06, 0x80, 0xc6, 0x0c, 0x00, 0x85, 0x19, + 0x00, 0xe2, 0x33, 0x00, 0xd4, 0xc7, 0x72, 0x18, 0x02, 0x00, 0x00, 0xe0, + 0x38, 0x00, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, + 0x00, 0xbf, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, + 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b, 0x93, 0x9b, + 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1, 0x0b, 0x3b, + 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, 0x0a, 0x9a, 0x2a, 0xfa, 0x9a, 0xb9, + 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, 0x63, 0x4b, 0xd9, 0x10, 0x04, 0x13, + 0x04, 0x41, 0x99, 0x20, 0x08, 0xcb, 0x06, 0x61, 0x20, 0x36, 0x08, 0x04, + 0x41, 0x01, 0x6e, 0x6e, 0x82, 0x20, 0x30, 0x1b, 0x86, 0x03, 0x21, 0x26, + 0x08, 0x05, 0x18, 0x70, 0xa1, 0x43, 0x2b, 0xa3, 0x2a, 0xc3, 0xa3, 0xab, + 0x93, 0x2b, 0xcb, 0x9a, 0x20, 0x08, 0xcd, 0x04, 0x41, 0x70, 0x36, 0x08, + 0x44, 0xb3, 0x21, 0x21, 0x94, 0x85, 0x20, 0x06, 0x86, 0x70, 0xc8, 0xd0, + 0xa1, 0x95, 0x51, 0x95, 0xe1, 0xd1, 0xd5, 0xc9, 0x95, 0x55, 0x59, 0x6d, + 0x48, 0x06, 0x05, 0x22, 0x86, 0x81, 0x21, 0x9c, 0x0d, 0xc2, 0x13, 0x4d, + 0x10, 0x8e, 0x8f, 0x0a, 0x1d, 0x5a, 0xd9, 0x54, 0x58, 0x1b, 0x1c, 0x5b, + 0x99, 0xdc, 0x06, 0x84, 0x98, 0x28, 0x82, 0x18, 0x08, 0x60, 0x43, 0x50, + 0x6d, 0x20, 0x24, 0x00, 0xb0, 0x26, 0x08, 0x44, 0x18, 0x4c, 0x10, 0x84, + 0x87, 0x01, 0xda, 0x04, 0x41, 0x80, 0x26, 0x08, 0x42, 0xb4, 0xc1, 0x40, + 0xb4, 0x8d, 0xe0, 0x1a, 0x12, 0x6d, 0x69, 0x70, 0x73, 0x13, 0x04, 0x41, + 0xda, 0x40, 0x20, 0xde, 0xf6, 0x4d, 0x10, 0x82, 0x31, 0xd8, 0x20, 0x10, + 0x61, 0xb0, 0x21, 0x10, 0x83, 0x0d, 0x02, 0x31, 0x06, 0x1b, 0x88, 0xac, + 0x03, 0x03, 0x32, 0x98, 0x20, 0x0c, 0x62, 0x30, 0x41, 0x10, 0x26, 0x1a, + 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x13, 0x04, 0x81, 0xda, 0x60, 0x20, + 0x68, 0xb0, 0x11, 0x5c, 0x1a, 0x6c, 0x10, 0xce, 0x40, 0x0d, 0x26, 0x08, + 0x1c, 0x19, 0x4c, 0x10, 0x84, 0x8a, 0x03, 0xdc, 0xdb, 0x1c, 0x97, 0x29, + 0xab, 0x2f, 0xa8, 0xa7, 0xa9, 0x24, 0xaa, 0xa4, 0x27, 0xa7, 0x0d, 0x08, + 0xe2, 0x06, 0x1b, 0x71, 0x06, 0x6f, 0xc0, 0x35, 0x1c, 0xe8, 0xca, 0xf0, + 0x98, 0x50, 0x15, 0x61, 0x0d, 0x3d, 0x3d, 0x49, 0x11, 0xc1, 0x6c, 0x40, + 0x90, 0x38, 0xd8, 0xbe, 0x33, 0x90, 0x03, 0xae, 0x61, 0x31, 0xf6, 0xc6, + 0xf6, 0x26, 0x37, 0x41, 0x10, 0x2c, 0x1a, 0x43, 0x4f, 0x4c, 0x4f, 0x52, + 0x30, 0x1b, 0x10, 0x84, 0x0e, 0xb6, 0x3a, 0x38, 0x03, 0x3b, 0xe0, 0x9a, + 0x0d, 0x44, 0x1b, 0xc0, 0xc1, 0x1c, 0xdc, 0xc1, 0x86, 0x83, 0xc0, 0xca, + 0xc0, 0x0c, 0xd6, 0x80, 0x0d, 0xf0, 0x60, 0x82, 0xa0, 0x0c, 0x1b, 0x80, + 0x0d, 0x03, 0xb1, 0x07, 0x7b, 0xb0, 0x21, 0xe0, 0x83, 0x0d, 0xc3, 0xa0, + 0x07, 0x7d, 0x30, 0x41, 0xe8, 0xca, 0x60, 0x43, 0xf0, 0x07, 0x24, 0xda, + 0xc2, 0xd2, 0xdc, 0xb8, 0x4c, 0x59, 0x7d, 0x41, 0xbd, 0xcd, 0xa5, 0xd1, + 0xa5, 0xbd, 0xb9, 0x4d, 0x10, 0x16, 0x6f, 0x82, 0xb0, 0x74, 0x1b, 0x02, + 0x62, 0x82, 0xb0, 0x70, 0x13, 0x84, 0x65, 0xdb, 0xb0, 0x10, 0xa2, 0x30, + 0x0a, 0xa4, 0x50, 0x0a, 0xa6, 0x30, 0x98, 0x02, 0x71, 0x0a, 0x00, 0x11, + 0xaa, 0x22, 0xac, 0xa1, 0xa7, 0x27, 0x29, 0xa2, 0x09, 0xc2, 0xa2, 0x6d, + 0x10, 0xb6, 0x6d, 0xc3, 0x32, 0xa4, 0xc2, 0x28, 0x9c, 0x42, 0x29, 0xa8, + 0xc2, 0xa0, 0x0a, 0xc3, 0x29, 0xac, 0x02, 0x8b, 0xa1, 0x27, 0xa6, 0x27, + 0xa9, 0x09, 0x82, 0x70, 0x6d, 0x10, 0x36, 0x57, 0xd8, 0xb0, 0x30, 0xad, + 0x30, 0x0a, 0xa7, 0x50, 0x0a, 0xaa, 0x30, 0x98, 0x02, 0x73, 0x0a, 0xaf, + 0xb0, 0x61, 0x40, 0x05, 0x56, 0x80, 0x05, 0x26, 0x53, 0x56, 0x5f, 0x54, + 0x61, 0x72, 0x67, 0x65, 0x74, 0x13, 0x84, 0x25, 0xd9, 0xb0, 0x10, 0xb2, + 0x30, 0x0a, 0xb3, 0x50, 0x0a, 0xa7, 0x30, 0x98, 0x02, 0x71, 0x0a, 0xaf, + 0xb0, 0x21, 0xa0, 0x85, 0x0d, 0x43, 0x2c, 0xd4, 0x02, 0xb0, 0xa1, 0xd0, + 0x83, 0x50, 0xb0, 0x85, 0x0b, 0xa0, 0x61, 0xc6, 0xf6, 0x16, 0x46, 0x37, + 0x37, 0x41, 0x10, 0x30, 0x16, 0x69, 0x6e, 0x73, 0x74, 0x73, 0x13, 0x04, + 0x21, 0xa3, 0x31, 0x97, 0x76, 0xf6, 0xc5, 0x46, 0x46, 0x63, 0x2e, 0xed, + 0xec, 0x6b, 0x8e, 0x8e, 0x08, 0x5d, 0x19, 0xde, 0x97, 0xdb, 0x9b, 0x5c, + 0xdb, 0x06, 0x05, 0x17, 0x72, 0x41, 0x17, 0x76, 0x81, 0x17, 0x90, 0x5e, + 0x38, 0x03, 0x5f, 0x60, 0xaa, 0xb0, 0xb1, 0xd9, 0xb5, 0xb9, 0xa4, 0x91, + 0x95, 0xb9, 0xd1, 0x4d, 0x09, 0x82, 0x2a, 0x64, 0x78, 0x2e, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x02, 0xa2, 0x09, 0x19, 0x9e, 0x8b, + 0x5d, 0x18, 0x9b, 0x5d, 0x99, 0xdc, 0x94, 0xa0, 0xa8, 0x43, 0x86, 0xe7, + 0x32, 0x87, 0x16, 0x46, 0x56, 0x26, 0xd7, 0xf4, 0x46, 0x56, 0xc6, 0x36, + 0x25, 0x40, 0xca, 0x90, 0xe1, 0xb9, 0xc8, 0x95, 0xcd, 0xbd, 0xd5, 0xc9, + 0x8d, 0x95, 0xcd, 0x4d, 0x09, 0xac, 0x4a, 0x64, 0x78, 0x2e, 0x74, 0x79, + 0x70, 0x65, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x53, 0x04, 0x3c, 0xe8, 0x83, 0x3a, 0x64, 0x78, 0x2e, 0x76, 0x69, + 0x65, 0x77, 0x49, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x82, 0x3f, + 0xa8, 0x43, 0x86, 0xe7, 0x52, 0xe6, 0x46, 0x27, 0x97, 0x07, 0xf5, 0x96, + 0xe6, 0x46, 0x37, 0x37, 0x25, 0xb0, 0x85, 0x2e, 0x64, 0x78, 0x2e, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x53, 0x02, 0x5f, 0x00, 0x00, + 0x00, 0x79, 0x18, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, + 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, + 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, + 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, + 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, + 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, + 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, + 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, + 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, + 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, + 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, + 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, + 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, + 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, + 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, + 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, + 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, + 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, + 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, + 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, + 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, + 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, + 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc4, 0x21, 0x07, 0x7c, + 0x70, 0x03, 0x7a, 0x28, 0x87, 0x76, 0x80, 0x87, 0x19, 0xd1, 0x43, 0x0e, + 0xf8, 0xe0, 0x06, 0xe4, 0x20, 0x0e, 0xe7, 0xe0, 0x06, 0xf6, 0x10, 0x0e, + 0xf2, 0xc0, 0x0e, 0xe1, 0x90, 0x0f, 0xef, 0x50, 0x0f, 0xf4, 0x00, 0x00, + 0x00, 0x71, 0x20, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x25, 0xf0, 0x05, + 0x7e, 0x74, 0x74, 0x79, 0x1a, 0x6e, 0xc3, 0xd9, 0x65, 0x39, 0x10, 0x38, + 0xab, 0x4e, 0xc3, 0x6d, 0x38, 0xbb, 0x2c, 0x9f, 0xd2, 0xc3, 0xf4, 0x32, + 0x10, 0x18, 0xac, 0x80, 0x38, 0x08, 0xfc, 0xe8, 0xe8, 0x32, 0xb5, 0x8c, + 0xa7, 0xd7, 0xe5, 0xe5, 0xaa, 0x15, 0x08, 0x9c, 0x59, 0x7f, 0x24, 0x6a, + 0x19, 0x4f, 0xaf, 0xcb, 0xcb, 0x32, 0x22, 0xd0, 0xfa, 0x23, 0xd9, 0xcb, + 0x63, 0xfa, 0x5b, 0x0e, 0x6c, 0x92, 0x60, 0x33, 0x20, 0x10, 0x08, 0x0c, + 0x16, 0x00, 0x1c, 0x04, 0x7e, 0x74, 0x74, 0x99, 0x5a, 0xc6, 0xd3, 0xeb, + 0xf2, 0x72, 0x16, 0x08, 0x9c, 0x59, 0x7f, 0x24, 0x6a, 0x19, 0x4f, 0xaf, + 0xcb, 0xcb, 0x32, 0x22, 0xd0, 0xfa, 0x23, 0xd9, 0xcb, 0x63, 0xfa, 0x5b, + 0x0e, 0x6c, 0x92, 0x60, 0x33, 0x20, 0x10, 0x08, 0x0c, 0x1a, 0x82, 0x34, + 0x5c, 0xbe, 0xf3, 0xf8, 0x42, 0x44, 0x00, 0x13, 0x11, 0x02, 0xcd, 0xb0, + 0x10, 0x76, 0xe0, 0x0c, 0x97, 0xef, 0x3c, 0xfe, 0xe0, 0x4c, 0xb7, 0x5f, + 0xdc, 0xb6, 0x11, 0x4c, 0xc3, 0xe5, 0x3b, 0x8f, 0xbf, 0x38, 0xc0, 0x20, + 0x36, 0x0f, 0x35, 0xf9, 0xc5, 0x6d, 0x9b, 0x01, 0x34, 0x5c, 0xbe, 0xf3, + 0xf8, 0x12, 0xc0, 0x3c, 0x0b, 0xe1, 0x17, 0xb7, 0x6d, 0x05, 0xd5, 0x70, + 0xf9, 0xce, 0xe3, 0x4b, 0x93, 0x13, 0x11, 0x28, 0x35, 0x3d, 0xd4, 0xe4, + 0x17, 0xb7, 0x6d, 0x03, 0x04, 0x03, 0x20, 0x0d, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x48, 0x41, 0x53, 0x48, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xa0, 0x59, 0x53, 0xa0, 0x6c, 0x9f, 0xab, 0x00, 0x3c, 0x49, 0x69, + 0x91, 0x4f, 0x9f, 0xaf, 0x32, 0x44, 0x58, 0x49, 0x4c, 0xa0, 0x07, 0x00, + 0x00, 0x60, 0x00, 0x00, 0x00, 0xe8, 0x01, 0x00, 0x00, 0x44, 0x58, 0x49, + 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x88, 0x07, 0x00, + 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0xdf, 0x01, 0x00, + 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, + 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, + 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, + 0x62, 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, + 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x52, 0x88, 0x48, 0x90, 0x14, + 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, + 0x90, 0x91, 0x22, 0xc4, 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, + 0x8a, 0x04, 0x29, 0x46, 0x06, 0x51, 0x18, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, 0x02, 0xa8, + 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x20, 0x6d, 0x30, 0x86, + 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x09, 0xa8, 0x00, 0x49, 0x18, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, 0x4c, 0x08, + 0x06, 0x00, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x45, 0x00, 0x00, + 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, + 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, + 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x70, 0x23, 0x00, 0x25, 0x00, 0x14, + 0x66, 0x00, 0xe6, 0x08, 0xc0, 0x60, 0x8e, 0x00, 0x29, 0xc6, 0x20, 0x84, + 0x14, 0x42, 0xa6, 0x18, 0x80, 0x10, 0x52, 0x06, 0xa1, 0x9b, 0x86, 0xcb, + 0x9f, 0xb0, 0x87, 0x90, 0xfc, 0x95, 0x90, 0x56, 0x62, 0xf2, 0x8b, 0xdb, + 0x46, 0xc5, 0x18, 0x63, 0x10, 0x2a, 0xf7, 0x0c, 0x97, 0x3f, 0x61, 0x0f, + 0x21, 0xf9, 0x21, 0xd0, 0x0c, 0x0b, 0x81, 0x82, 0x55, 0x18, 0x45, 0x18, + 0x1b, 0x63, 0x0c, 0x42, 0xc8, 0xa0, 0x56, 0x90, 0x41, 0xc6, 0x18, 0x63, + 0x0c, 0x7a, 0x73, 0x04, 0x41, 0x31, 0x18, 0x29, 0x84, 0x44, 0x92, 0x03, + 0x01, 0xc3, 0x08, 0xc4, 0x30, 0x53, 0x1b, 0x8c, 0x03, 0x3b, 0x84, 0xc3, + 0x3c, 0xcc, 0x83, 0x1b, 0xd0, 0x42, 0x39, 0xe0, 0x03, 0x3d, 0xd4, 0x83, + 0x3c, 0x94, 0x83, 0x1c, 0x90, 0x02, 0x1f, 0xd8, 0x43, 0x39, 0x8c, 0x03, + 0x3d, 0xbc, 0x83, 0x3c, 0xf0, 0x81, 0x39, 0xb0, 0xc3, 0x3b, 0x84, 0x03, + 0x3d, 0xb0, 0x01, 0x18, 0xd0, 0x81, 0x1f, 0x80, 0x81, 0x1f, 0xe8, 0x81, + 0x1e, 0xb4, 0x43, 0x3a, 0xc0, 0xc3, 0x3c, 0xfc, 0x02, 0x3d, 0xe4, 0x03, + 0x3c, 0x94, 0x03, 0x0a, 0xc8, 0x4c, 0x62, 0x30, 0x0e, 0xec, 0x10, 0x0e, + 0xf3, 0x30, 0x0f, 0x6e, 0x40, 0x0b, 0xe5, 0x80, 0x0f, 0xf4, 0x50, 0x0f, + 0xf2, 0x50, 0x0e, 0x72, 0x40, 0x0a, 0x7c, 0x60, 0x0f, 0xe5, 0x30, 0x0e, + 0xf4, 0xf0, 0x0e, 0xf2, 0xc0, 0x07, 0xe6, 0xc0, 0x0e, 0xef, 0x10, 0x0e, + 0xf4, 0xc0, 0x06, 0x60, 0x40, 0x07, 0x7e, 0x00, 0x06, 0x7e, 0x80, 0x84, + 0x6a, 0xe9, 0xde, 0x24, 0x4d, 0x11, 0x25, 0x4c, 0x3e, 0x0b, 0x30, 0xcf, + 0x42, 0x44, 0xec, 0x04, 0x4c, 0x04, 0x0a, 0x08, 0xe5, 0x74, 0x20, 0x00, + 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, + 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, + 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, + 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x43, 0x9e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x3c, 0x06, 0x10, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x79, 0x10, + 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xf2, + 0x34, 0x40, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, + 0xe4, 0x79, 0x80, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x60, 0xc8, 0x23, 0x01, 0x01, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x40, 0x16, 0x08, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, + 0x14, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, + 0x22, 0x25, 0x30, 0x02, 0x50, 0x0c, 0x45, 0x50, 0x12, 0x65, 0x50, 0x1e, + 0x54, 0x4a, 0xa2, 0x0c, 0x0a, 0x61, 0x04, 0xa0, 0x08, 0x0a, 0x84, 0xf0, + 0x0c, 0x00, 0xe9, 0x19, 0x00, 0xda, 0x63, 0x39, 0x0c, 0x01, 0x00, 0x00, + 0x70, 0x1c, 0x00, 0x10, 0x08, 0x04, 0x02, 0x00, 0x00, 0x79, 0x18, 0x00, + 0x00, 0x65, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, + 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b, 0x93, 0x9b, + 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1, 0x0b, 0x3b, + 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, 0x0a, 0x9a, 0x2a, 0xfa, 0x9a, 0xb9, + 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, 0x63, 0x4b, 0xd9, 0x10, 0x04, 0x13, + 0x04, 0xc2, 0x98, 0x20, 0x10, 0xc7, 0x06, 0x61, 0x20, 0x26, 0x08, 0x04, + 0xb2, 0x41, 0x18, 0x0c, 0x0a, 0x70, 0x73, 0x1b, 0x06, 0xc4, 0x20, 0x26, + 0x08, 0xd8, 0x44, 0x60, 0x82, 0x40, 0x24, 0x13, 0x04, 0x42, 0xd9, 0x20, + 0x10, 0xcd, 0x86, 0x84, 0x50, 0x16, 0x82, 0x18, 0x18, 0xc2, 0xd9, 0x90, + 0x0c, 0xca, 0x42, 0x0c, 0x03, 0x43, 0x38, 0x1b, 0x84, 0x07, 0x9a, 0x20, + 0x68, 0xd4, 0x06, 0x84, 0x90, 0x16, 0x82, 0x18, 0x08, 0x60, 0x43, 0x30, + 0x6d, 0x20, 0x22, 0x00, 0xa0, 0x26, 0x08, 0x5b, 0xb5, 0x21, 0xb0, 0x26, + 0x08, 0x02, 0x40, 0xa2, 0x2d, 0x2c, 0xcd, 0x8d, 0xcb, 0x94, 0xd5, 0x17, + 0xd4, 0xdb, 0x5c, 0x1a, 0x5d, 0xda, 0x9b, 0xdb, 0x04, 0xa1, 0x68, 0x26, + 0x08, 0x85, 0xb3, 0x21, 0x20, 0x26, 0x08, 0xc5, 0x33, 0x41, 0x28, 0xa0, + 0x0d, 0x0b, 0xa1, 0x6d, 0x5c, 0xe7, 0x0d, 0x1e, 0xf1, 0x01, 0x44, 0xa8, + 0x8a, 0xb0, 0x86, 0x9e, 0x9e, 0xa4, 0x88, 0x26, 0x08, 0x45, 0x34, 0x41, + 0x20, 0x96, 0x0d, 0xc2, 0x18, 0x8c, 0xc1, 0x86, 0x65, 0x08, 0x83, 0xed, + 0xeb, 0xc4, 0x60, 0x10, 0x83, 0xe1, 0x23, 0x03, 0x16, 0x43, 0x4f, 0x4c, + 0x4f, 0x52, 0x13, 0x04, 0x82, 0xd9, 0x20, 0x8c, 0xc1, 0x19, 0x6c, 0x58, + 0x18, 0x33, 0xd8, 0xbe, 0x4e, 0x0c, 0x06, 0x8f, 0xf9, 0xd0, 0x60, 0xc3, + 0x00, 0x06, 0x65, 0x90, 0x06, 0x4c, 0xa6, 0xac, 0xbe, 0xa8, 0xc2, 0xe4, + 0xce, 0xca, 0xe8, 0x26, 0x08, 0x85, 0xb4, 0x61, 0x21, 0xd6, 0x60, 0x63, + 0x83, 0xee, 0x1b, 0x3c, 0xe2, 0x43, 0x83, 0x0d, 0x41, 0x1b, 0x6c, 0x18, + 0xd4, 0xc0, 0x0d, 0x80, 0x0d, 0x05, 0x96, 0xbd, 0x41, 0x05, 0x54, 0x61, + 0x63, 0xb3, 0x6b, 0x73, 0x49, 0x23, 0x2b, 0x73, 0xa3, 0x9b, 0x12, 0x04, + 0x55, 0xc8, 0xf0, 0x5c, 0xec, 0xca, 0xe4, 0xe6, 0xd2, 0xde, 0xdc, 0xa6, + 0x04, 0x44, 0x13, 0x32, 0x3c, 0x17, 0xbb, 0x30, 0x36, 0xbb, 0x32, 0xb9, + 0x29, 0x81, 0x51, 0x87, 0x0c, 0xcf, 0x65, 0x0e, 0x2d, 0x8c, 0xac, 0x4c, + 0xae, 0xe9, 0x8d, 0xac, 0x8c, 0x6d, 0x4a, 0x80, 0x94, 0x21, 0xc3, 0x73, + 0x91, 0x2b, 0x9b, 0x7b, 0xab, 0x93, 0x1b, 0x2b, 0x9b, 0x9b, 0x12, 0x50, + 0x75, 0xc8, 0xf0, 0x5c, 0xec, 0xd2, 0xca, 0xee, 0x92, 0xc8, 0xa6, 0xe8, + 0xc2, 0xe8, 0xca, 0xa6, 0x04, 0x56, 0x1d, 0x32, 0x3c, 0x97, 0x32, 0x37, + 0x3a, 0xb9, 0x3c, 0xa8, 0xb7, 0x34, 0x37, 0xba, 0xb9, 0x29, 0xc1, 0x1b, + 0x00, 0x79, 0x18, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, + 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, + 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, + 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, + 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, + 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, + 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, + 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, + 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, + 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, + 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, + 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, + 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, + 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, + 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, + 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, + 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, + 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, + 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, + 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, + 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, + 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, + 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc4, 0x21, 0x07, 0x7c, + 0x70, 0x03, 0x7a, 0x28, 0x87, 0x76, 0x80, 0x87, 0x19, 0xd1, 0x43, 0x0e, + 0xf8, 0xe0, 0x06, 0xe4, 0x20, 0x0e, 0xe7, 0xe0, 0x06, 0xf6, 0x10, 0x0e, + 0xf2, 0xc0, 0x0e, 0xe1, 0x90, 0x0f, 0xef, 0x50, 0x0f, 0xf4, 0x00, 0x00, + 0x00, 0x71, 0x20, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x56, 0x20, 0x0d, + 0x97, 0xef, 0x3c, 0xbe, 0x10, 0x11, 0xc0, 0x44, 0x84, 0x40, 0x33, 0x2c, + 0x84, 0x11, 0x38, 0xc3, 0xe5, 0x3b, 0x8f, 0x3f, 0x38, 0xd3, 0xed, 0x17, + 0xb7, 0x6d, 0x01, 0xd3, 0x70, 0xf9, 0xce, 0xe3, 0x2f, 0x0e, 0x30, 0x88, + 0xcd, 0x43, 0x4d, 0x7e, 0x71, 0xdb, 0x36, 0x00, 0x0d, 0x97, 0xef, 0x3c, + 0xbe, 0x04, 0x30, 0xcf, 0x42, 0xf8, 0xc5, 0x6d, 0x9b, 0x40, 0x35, 0x5c, + 0xbe, 0xf3, 0xf8, 0xd2, 0xe4, 0x44, 0x04, 0x4a, 0x4d, 0x0f, 0x35, 0xf9, + 0xc5, 0x6d, 0x1b, 0x00, 0xc1, 0x00, 0x48, 0x03, 0x00, 0x61, 0x20, 0x00, + 0x00, 0x5d, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, 0x10, 0x00, 0x00, + 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x47, 0x00, 0xa8, 0x94, 0x00, 0x91, + 0xc2, 0x2b, 0xb7, 0x92, 0x2b, 0x85, 0x42, 0x98, 0x01, 0xa0, 0x31, 0x46, + 0x50, 0x9e, 0x74, 0xe9, 0x7f, 0x63, 0x04, 0xa2, 0x3e, 0xb7, 0xf3, 0x2f, + 0x8c, 0x11, 0x80, 0xef, 0x0a, 0xae, 0xbf, 0x30, 0x46, 0xc0, 0x97, 0xbd, + 0xb9, 0x7f, 0x23, 0x00, 0x63, 0x04, 0x21, 0x09, 0x86, 0xf0, 0x2f, 0x8c, + 0x11, 0x80, 0x20, 0x08, 0xe2, 0xdf, 0x0c, 0x00, 0x00, 0x23, 0x06, 0x09, + 0x00, 0x82, 0x60, 0x20, 0x85, 0x01, 0x63, 0x81, 0x01, 0x18, 0x40, 0x23, + 0x06, 0x09, 0x00, 0x82, 0x60, 0x20, 0x89, 0x41, 0x73, 0x81, 0x01, 0x18, + 0x44, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x20, 0x8d, 0x81, 0xa3, 0x85, + 0x41, 0x18, 0x48, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0xa0, 0x41, + 0x03, 0x06, 0x62, 0x90, 0x31, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, + 0xa4, 0x81, 0x13, 0x06, 0x63, 0x30, 0x35, 0x23, 0x06, 0x09, 0x00, 0x82, + 0x60, 0x60, 0xa8, 0xc1, 0x23, 0x06, 0x64, 0xa0, 0x39, 0x23, 0x06, 0x09, + 0x00, 0x82, 0x60, 0x60, 0xac, 0x01, 0x34, 0x06, 0x65, 0xe0, 0x3d, 0x23, + 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0xb0, 0x41, 0x74, 0x06, 0x66, 0xd0, + 0x41, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0xb4, 0x81, 0x84, 0x06, + 0x67, 0x70, 0x45, 0x23, 0x06, 0x0f, 0x00, 0x82, 0x60, 0xd0, 0xb0, 0xc1, + 0x85, 0x1c, 0x42, 0xa0, 0x28, 0x68, 0x80, 0x06, 0x92, 0x32, 0x9a, 0x10, + 0x00, 0x23, 0x06, 0x0f, 0x00, 0x82, 0x60, 0xd0, 0xb8, 0x41, 0xb6, 0x24, + 0xc4, 0xc0, 0x30, 0x6a, 0xa0, 0x06, 0x14, 0x33, 0x9a, 0x10, 0x00, 0xa3, + 0x09, 0x42, 0x60, 0x42, 0x04, 0x1f, 0x13, 0x24, 0xf8, 0x8c, 0x18, 0x2c, + 0x00, 0x08, 0x82, 0xc1, 0x23, 0x07, 0x9d, 0x21, 0x04, 0x12, 0x55, 0x8d, + 0x18, 0x2c, 0x00, 0x08, 0x82, 0xc1, 0x33, 0x07, 0xde, 0x31, 0x08, 0xd3, + 0x85, 0x8d, 0x18, 0x2c, 0x00, 0x08, 0x82, 0xc1, 0x43, 0x07, 0x1f, 0x42, + 0x0c, 0x94, 0x66, 0xd9, 0x00, 0xc9, 0xc7, 0x06, 0x48, 0x3e, 0x36, 0x40, + 0xf2, 0x19, 0x31, 0x48, 0x00, 0x10, 0x04, 0x03, 0x44, 0x0f, 0xc2, 0xa0, + 0x0e, 0xea, 0x80, 0x0d, 0x86, 0x11, 0x83, 0x04, 0x00, 0x41, 0x30, 0x40, + 0xf4, 0x20, 0x0c, 0xea, 0xa0, 0x0e, 0xca, 0x40, 0x18, 0x31, 0x48, 0x00, + 0x10, 0x04, 0x03, 0x44, 0x0f, 0xc2, 0xa0, 0x0e, 0xea, 0x60, 0x0d, 0x82, + 0x11, 0x83, 0x04, 0x00, 0x41, 0x30, 0x40, 0xf4, 0x20, 0x0c, 0xea, 0xa0, + 0x0e, 0xdc, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +/* The yuv-rendering pixel shader: + + --- D3D12_PixelShader_NV12_BT601.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureUV : register(t1); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + #define NVRS \ + "RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \ + " DENY_DOMAIN_SHADER_ROOT_ACCESS |" \ + " DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \ + " DENY_HULL_SHADER_ROOT_ACCESS )," \ + "RootConstants(num32BitConstants=32, b0),"\ + "DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )" + + [RootSignature(NVRS)] + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.5960}; + const float3 Gcoeff = {1.1644, -0.3918, -0.8130}; + const float3 Bcoeff = {1.1644, 2.0172, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ + +static unsigned char D3D12_PixelShader_NV12_BT601[] = { + 0x44, 0x58, 0x42, 0x43, 0xd0, 0xda, 0x37, 0x96, 0x52, 0x6b, 0x77, 0x3b, + 0x82, 0x71, 0x03, 0xf9, 0x0a, 0x76, 0x4b, 0xd7, 0x01, 0x00, 0x00, 0x00, + 0xe9, 0x12, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, + 0x50, 0x00, 0x00, 0x00, 0xdb, 0x00, 0x00, 0x00, 0x15, 0x01, 0x00, 0x00, + 0x0d, 0x02, 0x00, 0x00, 0xc9, 0x02, 0x00, 0x00, 0x15, 0x0b, 0x00, 0x00, + 0x31, 0x0b, 0x00, 0x00, 0x53, 0x46, 0x49, 0x30, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x31, + 0x83, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x53, 0x56, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, + 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x43, 0x4f, 0x4c, + 0x4f, 0x52, 0x00, 0x4f, 0x53, 0x47, 0x31, 0x32, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x00, 0x50, 0x53, 0x56, 0x30, 0xf0, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, + 0xff, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01, 0x00, 0x03, 0x01, 0x00, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x43, + 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x44, 0x03, 0x03, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x42, 0x00, 0x03, 0x02, 0x00, + 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x44, + 0x00, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x44, 0x10, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x52, 0x54, 0x53, + 0x30, 0xb4, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, + 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, + 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, + 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, + 0x00, 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, + 0xff, 0x01, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, + 0x00, 0x9c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xff, 0xff, 0x53, 0x54, 0x41, 0x54, 0x44, 0x08, 0x00, + 0x00, 0x60, 0x00, 0x00, 0x00, 0x11, 0x02, 0x00, 0x00, 0x44, 0x58, 0x49, + 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x2c, 0x08, 0x00, + 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0x08, 0x02, 0x00, + 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, + 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, + 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, + 0x62, 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, + 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x52, 0x88, 0x48, 0x90, 0x14, + 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, + 0x90, 0x91, 0x22, 0xc4, 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, + 0x8a, 0x04, 0x29, 0x46, 0x06, 0x51, 0x18, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, 0x02, 0xa8, + 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x20, 0x6d, 0x30, 0x86, + 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x09, 0xa8, 0x00, 0x49, 0x18, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, 0x4c, 0x08, + 0x06, 0x00, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x4b, 0x00, 0x00, + 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, + 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, + 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x78, 0x33, 0x00, 0xc3, 0x08, 0x04, + 0x30, 0x47, 0x00, 0x06, 0x33, 0xb5, 0xc1, 0x38, 0xb0, 0x43, 0x38, 0xcc, + 0xc3, 0x3c, 0xb8, 0x01, 0x2d, 0x94, 0x03, 0x3e, 0xd0, 0x43, 0x3d, 0xc8, + 0x43, 0x39, 0xc8, 0x01, 0x29, 0xf0, 0x81, 0x3d, 0x94, 0xc3, 0x38, 0xd0, + 0xc3, 0x3b, 0xc8, 0x03, 0x1f, 0x98, 0x03, 0x3b, 0xbc, 0x43, 0x38, 0xd0, + 0x03, 0x1b, 0x80, 0x01, 0x1d, 0xf8, 0x01, 0x18, 0xf8, 0x81, 0x1e, 0xe8, + 0x41, 0x3b, 0xa4, 0x03, 0x3c, 0xcc, 0xc3, 0x2f, 0xd0, 0x43, 0x3e, 0xc0, + 0x43, 0x39, 0xa0, 0x40, 0xcc, 0x24, 0x06, 0xe3, 0xc0, 0x0e, 0xe1, 0x30, + 0x0f, 0xf3, 0xe0, 0x06, 0xb4, 0x50, 0x0e, 0xf8, 0x40, 0x0f, 0xf5, 0x20, + 0x0f, 0xe5, 0x20, 0x07, 0xa4, 0xc0, 0x07, 0xf6, 0x50, 0x0e, 0xe3, 0x40, + 0x0f, 0xef, 0x20, 0x0f, 0x7c, 0x60, 0x0e, 0xec, 0xf0, 0x0e, 0xe1, 0x40, + 0x0f, 0x6c, 0x00, 0x06, 0x74, 0xe0, 0x07, 0x60, 0xe0, 0x07, 0x48, 0x08, + 0x83, 0xc8, 0x4d, 0xd2, 0x14, 0x51, 0xc2, 0xe4, 0xb3, 0x00, 0xf3, 0x2c, + 0x44, 0xc4, 0x4e, 0xc0, 0x44, 0xa0, 0x40, 0x90, 0x19, 0x01, 0x28, 0x01, + 0xa2, 0x34, 0x47, 0x80, 0x14, 0x03, 0x08, 0x21, 0x96, 0x20, 0x56, 0x0c, + 0x24, 0x84, 0x58, 0x80, 0xdc, 0x4d, 0xc3, 0xe5, 0x4f, 0xd8, 0x43, 0x48, + 0xfe, 0x4a, 0x48, 0x2b, 0x31, 0xf9, 0xc5, 0x6d, 0xa3, 0x02, 0x00, 0x00, + 0x04, 0xad, 0x7b, 0x86, 0xcb, 0x9f, 0xb0, 0x87, 0x90, 0xfc, 0x10, 0x68, + 0x86, 0x85, 0x40, 0x41, 0x2c, 0x0c, 0x14, 0x52, 0x02, 0x00, 0x80, 0x10, + 0x02, 0xd0, 0x2c, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0xd5, 0x39, 0x82, + 0xa0, 0x18, 0x52, 0x2c, 0x21, 0x2e, 0xe1, 0x81, 0x80, 0x61, 0x04, 0x01, + 0xb8, 0x4b, 0x9a, 0x22, 0x4a, 0x98, 0xfc, 0x14, 0xb9, 0x88, 0x85, 0x3d, + 0x80, 0x81, 0x88, 0xc4, 0xe6, 0xa1, 0x26, 0x34, 0x84, 0x1d, 0xd2, 0x41, + 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, + 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, + 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, + 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x3a, 0x0f, 0x64, 0x90, 0x21, + 0x23, 0x45, 0x44, 0x00, 0x72, 0x00, 0xc0, 0xe4, 0x00, 0x80, 0xe9, 0x01, + 0x00, 0x0f, 0x79, 0x12, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x18, 0xf2, 0x30, 0x40, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x30, 0xe4, 0x71, 0x80, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x60, 0xc8, 0x33, 0x01, 0x01, 0x30, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x90, 0xa7, 0x02, 0x02, 0x20, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x21, 0x0f, 0x06, 0x04, 0xc0, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x59, 0x20, 0x00, 0x00, + 0x00, 0x15, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x18, 0x19, 0x11, 0x4c, + 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x5a, 0x05, 0x42, 0xa2, + 0x04, 0x46, 0x00, 0x8a, 0xa1, 0x08, 0x4a, 0xa2, 0x50, 0xca, 0xa0, 0x1c, + 0x0a, 0xa4, 0x10, 0x4a, 0xa1, 0xc0, 0x0a, 0xa8, 0x3c, 0x0a, 0x87, 0x56, + 0x11, 0x8c, 0x00, 0x14, 0x42, 0x19, 0x94, 0x04, 0x9d, 0x19, 0x00, 0x2a, + 0x33, 0x00, 0x44, 0x66, 0x00, 0x68, 0xcc, 0x00, 0x50, 0x98, 0x01, 0x20, + 0x3e, 0x03, 0x40, 0x7d, 0x2c, 0x87, 0x21, 0x00, 0x00, 0x00, 0x8e, 0x03, + 0x00, 0x02, 0x81, 0x40, 0x00, 0x79, 0x18, 0x00, 0x00, 0xbe, 0x00, 0x00, + 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, 0x44, 0x35, 0x18, 0x63, + 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x03, + 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1, 0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, + 0x62, 0x2a, 0x0a, 0x9a, 0x2a, 0xfa, 0x9a, 0xb9, 0x81, 0x79, 0x31, 0x4b, + 0x73, 0x0b, 0x63, 0x4b, 0xd9, 0x10, 0x04, 0x13, 0x04, 0x41, 0x99, 0x20, + 0x08, 0xcb, 0x06, 0x61, 0x20, 0x36, 0x08, 0x04, 0x41, 0x01, 0x6e, 0x6e, + 0x82, 0x20, 0x30, 0x1b, 0x86, 0x03, 0x21, 0x26, 0x08, 0xc5, 0xc7, 0x85, + 0x0e, 0xad, 0x8c, 0xaa, 0x0c, 0x8f, 0xae, 0x4e, 0xae, 0x2c, 0x6b, 0x82, + 0x20, 0x34, 0x13, 0x04, 0xc1, 0xd9, 0x20, 0x10, 0xcd, 0x86, 0x84, 0x50, + 0x16, 0x82, 0x18, 0x18, 0xc2, 0x21, 0x43, 0x87, 0x56, 0x46, 0x55, 0x86, + 0x47, 0x57, 0x27, 0x57, 0x56, 0x65, 0xb5, 0x21, 0x19, 0x14, 0x88, 0x18, + 0x06, 0x86, 0x70, 0x36, 0x08, 0x4f, 0x34, 0x41, 0x38, 0x3c, 0x2a, 0x74, + 0x68, 0x65, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x1b, 0x10, 0x62, + 0xa2, 0x08, 0x62, 0x20, 0x80, 0x0d, 0x41, 0xb5, 0x81, 0x90, 0x00, 0xc0, + 0x9a, 0x20, 0x10, 0x60, 0x30, 0x41, 0x10, 0x1e, 0x06, 0x68, 0x13, 0x04, + 0x01, 0x9a, 0x20, 0x08, 0xd1, 0x06, 0x03, 0xd1, 0x36, 0x82, 0x6b, 0x48, + 0xb4, 0xa5, 0xc1, 0xcd, 0x4d, 0x10, 0x04, 0x69, 0x03, 0x81, 0x78, 0xdb, + 0x37, 0x41, 0x08, 0xc4, 0x60, 0x83, 0x40, 0x84, 0xc1, 0x86, 0x40, 0x0c, + 0x36, 0x08, 0xc4, 0x18, 0x6c, 0x20, 0xb2, 0x0e, 0x0c, 0xc8, 0x60, 0x82, + 0x30, 0x84, 0xc1, 0x04, 0x41, 0x98, 0x68, 0xa0, 0x85, 0xb9, 0x91, 0xb1, + 0x95, 0x4d, 0x10, 0x04, 0x6a, 0x83, 0x81, 0xa0, 0xc1, 0x46, 0x70, 0x69, + 0xb0, 0x41, 0x38, 0x03, 0x35, 0x98, 0x20, 0x70, 0x63, 0x30, 0x41, 0x10, + 0x2a, 0x0e, 0x70, 0x6f, 0x73, 0x5c, 0xa6, 0xac, 0xbe, 0xa0, 0x9e, 0xa6, + 0x92, 0xa8, 0x92, 0x9e, 0x9c, 0x36, 0x20, 0x88, 0x1b, 0x6c, 0xc4, 0x19, + 0xbc, 0x01, 0xd7, 0x70, 0xa0, 0x2b, 0xc3, 0x63, 0x42, 0x55, 0x84, 0x35, + 0xf4, 0xf4, 0x24, 0x45, 0x04, 0xb3, 0x01, 0x41, 0xe2, 0x60, 0xfb, 0xce, + 0x40, 0x0e, 0xb8, 0x86, 0xc5, 0xd8, 0x1b, 0xdb, 0x9b, 0xdc, 0x04, 0x41, + 0xb0, 0x68, 0x0c, 0x3d, 0x31, 0x3d, 0x49, 0xc1, 0x6c, 0x40, 0x10, 0x3a, + 0xd8, 0xea, 0xe0, 0x0c, 0xec, 0x80, 0x6b, 0x36, 0x10, 0x6d, 0x00, 0x07, + 0x73, 0x70, 0x07, 0x1b, 0x0e, 0x02, 0x2b, 0x03, 0x33, 0x58, 0x03, 0x36, + 0xc0, 0x83, 0x09, 0x82, 0x32, 0x6c, 0x00, 0x36, 0x0c, 0xc4, 0x1e, 0xec, + 0xc1, 0x86, 0x80, 0x0f, 0x36, 0x0c, 0x83, 0x1e, 0xf4, 0xc1, 0x04, 0xa1, + 0x23, 0x83, 0x0d, 0xc1, 0x1f, 0x90, 0x68, 0x0b, 0x4b, 0x73, 0xe3, 0x32, + 0x65, 0xf5, 0x05, 0xf5, 0x36, 0x97, 0x46, 0x97, 0xf6, 0xe6, 0x36, 0x41, + 0x58, 0xba, 0x09, 0xc2, 0xc2, 0x6d, 0x08, 0x88, 0x09, 0xc2, 0xb2, 0x4d, + 0x10, 0x16, 0x6d, 0xc3, 0x42, 0x88, 0xc2, 0x28, 0x90, 0x42, 0x29, 0x98, + 0xc2, 0x60, 0x0a, 0xc4, 0x29, 0x00, 0x44, 0xa8, 0x8a, 0xb0, 0x86, 0x9e, + 0x9e, 0xa4, 0x88, 0x26, 0x08, 0x4b, 0xb6, 0x41, 0xd8, 0xb6, 0x0d, 0xcb, + 0x90, 0x0a, 0xa3, 0x70, 0x0a, 0xa5, 0xa0, 0x0a, 0x83, 0x2a, 0x0c, 0xa7, + 0xb0, 0x0a, 0x2c, 0x86, 0x9e, 0x98, 0x9e, 0xa4, 0x26, 0x08, 0xc2, 0xb5, + 0x41, 0xd8, 0x5c, 0x61, 0xc3, 0xc2, 0xb4, 0xc2, 0x28, 0x9c, 0x42, 0x29, + 0xa8, 0xc2, 0x60, 0x0a, 0xcc, 0x29, 0xbc, 0xc2, 0x86, 0x01, 0x15, 0x58, + 0x01, 0x16, 0x98, 0x4c, 0x59, 0x7d, 0x51, 0x85, 0xc9, 0x9d, 0x95, 0xd1, + 0x4d, 0x10, 0x96, 0x64, 0xc3, 0x42, 0xc8, 0xc2, 0x28, 0xcc, 0x42, 0x29, + 0x9c, 0xc2, 0x60, 0x0a, 0xc4, 0x29, 0xbc, 0xc2, 0x86, 0x80, 0x16, 0x36, + 0x0c, 0xb1, 0x50, 0x0b, 0xc0, 0x86, 0x42, 0x0f, 0x42, 0xc1, 0x16, 0x2e, + 0x80, 0x86, 0x19, 0xdb, 0x5b, 0x18, 0xdd, 0x1c, 0x8b, 0x34, 0xb7, 0x39, + 0xba, 0xb9, 0x09, 0x82, 0x80, 0xd1, 0x98, 0x4b, 0x3b, 0xfb, 0x62, 0x23, + 0xa3, 0x31, 0x97, 0x76, 0xf6, 0x35, 0x47, 0x47, 0x84, 0xae, 0x0c, 0xef, + 0xcb, 0xed, 0x4d, 0xae, 0x6d, 0x83, 0x82, 0x0b, 0x4d, 0x2e, 0xe8, 0xc2, + 0x2e, 0x20, 0xbc, 0x70, 0x06, 0xbd, 0xc0, 0x54, 0x61, 0x63, 0xb3, 0x6b, + 0x73, 0x49, 0x23, 0x2b, 0x73, 0xa3, 0x9b, 0x12, 0x04, 0x55, 0xc8, 0xf0, + 0x5c, 0xec, 0xca, 0xe4, 0xe6, 0xd2, 0xde, 0xdc, 0xa6, 0x04, 0x44, 0x13, + 0x32, 0x3c, 0x17, 0xbb, 0x30, 0x36, 0xbb, 0x32, 0xb9, 0x29, 0x41, 0x51, + 0x87, 0x0c, 0xcf, 0x65, 0x0e, 0x2d, 0x8c, 0xac, 0x4c, 0xae, 0xe9, 0x8d, + 0xac, 0x8c, 0x6d, 0x4a, 0x80, 0x94, 0x21, 0xc3, 0x73, 0x91, 0x2b, 0x9b, + 0x7b, 0xab, 0x93, 0x1b, 0x2b, 0x9b, 0x9b, 0x12, 0x58, 0x95, 0xc8, 0xf0, + 0x5c, 0xe8, 0xf2, 0xe0, 0xca, 0x82, 0xdc, 0xdc, 0xde, 0xe8, 0xc2, 0xe8, + 0xd2, 0xde, 0xdc, 0xe6, 0xa6, 0x08, 0x78, 0xd0, 0x07, 0x75, 0xc8, 0xf0, + 0x5c, 0xec, 0xd2, 0xca, 0xee, 0x92, 0xc8, 0xa6, 0xe8, 0xc2, 0xe8, 0xca, + 0xa6, 0x04, 0x7f, 0x50, 0x87, 0x0c, 0xcf, 0xa5, 0xcc, 0x8d, 0x4e, 0x2e, + 0x0f, 0xea, 0x2d, 0xcd, 0x8d, 0x6e, 0x6e, 0x4a, 0x60, 0x0b, 0x5d, 0xc8, + 0xf0, 0x5c, 0xc6, 0xde, 0xea, 0xdc, 0xe8, 0xca, 0xe4, 0xe6, 0xa6, 0x04, + 0xbd, 0x00, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x4c, 0x00, 0x00, + 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, + 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, + 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, + 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, + 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, + 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, + 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, + 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, + 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, + 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, + 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, + 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, + 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, + 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, + 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, + 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, + 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, + 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, + 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, + 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, + 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, + 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, + 0xc4, 0x21, 0x07, 0x7c, 0x70, 0x03, 0x7a, 0x28, 0x87, 0x76, 0x80, 0x87, + 0x19, 0xd1, 0x43, 0x0e, 0xf8, 0xe0, 0x06, 0xe4, 0x20, 0x0e, 0xe7, 0xe0, + 0x06, 0xf6, 0x10, 0x0e, 0xf2, 0xc0, 0x0e, 0xe1, 0x90, 0x0f, 0xef, 0x50, + 0x0f, 0xf4, 0x00, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x33, 0x00, 0x00, + 0x00, 0x25, 0xf0, 0x05, 0x7e, 0x74, 0x74, 0x79, 0x1a, 0x6e, 0xc3, 0xd9, + 0x65, 0x39, 0x10, 0x38, 0xab, 0x4e, 0xc3, 0x6d, 0x38, 0xbb, 0x2c, 0x9f, + 0xd2, 0xc3, 0xf4, 0x32, 0x10, 0x18, 0xac, 0x80, 0x38, 0x08, 0xfc, 0xe8, + 0xe8, 0x32, 0xb5, 0x8c, 0xa7, 0xd7, 0xe5, 0xe5, 0xaa, 0x15, 0x08, 0x9c, + 0x59, 0x7f, 0x24, 0x6a, 0x19, 0x4f, 0xaf, 0xcb, 0xcb, 0x32, 0x22, 0xd0, + 0xfa, 0x23, 0xd9, 0xcb, 0x63, 0xfa, 0x5b, 0x0e, 0x6c, 0x92, 0x60, 0x33, + 0x20, 0x10, 0x08, 0x0c, 0x16, 0x00, 0x1c, 0x04, 0x7e, 0x74, 0x74, 0x99, + 0x5a, 0xc6, 0xd3, 0xeb, 0xf2, 0x72, 0x16, 0x08, 0x9c, 0x59, 0x7f, 0x24, + 0x6a, 0x19, 0x4f, 0xaf, 0xcb, 0xcb, 0x32, 0x22, 0xd0, 0xfa, 0x23, 0xd9, + 0xcb, 0x63, 0xfa, 0x5b, 0x0e, 0x6c, 0x92, 0x60, 0x33, 0x20, 0x10, 0x08, + 0x0c, 0x1a, 0x82, 0x34, 0x5c, 0xbe, 0xf3, 0xf8, 0x42, 0x44, 0x00, 0x13, + 0x11, 0x02, 0xcd, 0xb0, 0x10, 0x76, 0xe0, 0x0c, 0x97, 0xef, 0x3c, 0xfe, + 0xe0, 0x4c, 0xb7, 0x5f, 0xdc, 0xb6, 0x11, 0x4c, 0xc3, 0xe5, 0x3b, 0x8f, + 0xbf, 0x38, 0xc0, 0x20, 0x36, 0x0f, 0x35, 0xf9, 0xc5, 0x6d, 0x9b, 0x01, + 0x34, 0x5c, 0xbe, 0xf3, 0xf8, 0x12, 0xc0, 0x3c, 0x0b, 0xe1, 0x17, 0xb7, + 0x6d, 0x05, 0xd5, 0x70, 0xf9, 0xce, 0xe3, 0x4b, 0x93, 0x13, 0x11, 0x28, + 0x35, 0x3d, 0xd4, 0xe4, 0x17, 0xb7, 0x6d, 0x03, 0x04, 0x03, 0x20, 0x0d, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x41, 0x53, 0x48, 0x14, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xd6, 0x59, 0x5f, 0x75, 0xd6, 0x73, 0xad, + 0xd4, 0x07, 0x66, 0xfb, 0xaa, 0x3b, 0xb4, 0x38, 0x99, 0x44, 0x58, 0x49, + 0x4c, 0xb0, 0x07, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xec, 0x01, 0x00, + 0x00, 0x44, 0x58, 0x49, 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x98, 0x07, 0x00, 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, + 0x00, 0xe3, 0x01, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, + 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, + 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, + 0x42, 0xa4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x52, + 0x88, 0x48, 0x90, 0x14, 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, + 0x42, 0xe4, 0x48, 0x0e, 0x90, 0x91, 0x22, 0xc4, 0x50, 0x41, 0x51, 0x81, + 0x8c, 0xe1, 0x83, 0xe5, 0x8a, 0x04, 0x29, 0x46, 0x06, 0x51, 0x18, 0x00, + 0x00, 0x08, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, + 0x07, 0x40, 0x02, 0xa8, 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, + 0x20, 0x6d, 0x30, 0x86, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x09, 0xa8, + 0x00, 0x49, 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, + 0x42, 0x20, 0x4c, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, + 0x00, 0x45, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, + 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, + 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x70, 0x23, + 0x00, 0x25, 0x00, 0x14, 0x66, 0x00, 0xe6, 0x08, 0xc0, 0x60, 0x8e, 0x00, + 0x29, 0xc6, 0x20, 0x84, 0x14, 0x42, 0xa6, 0x18, 0x80, 0x10, 0x52, 0x06, + 0xa1, 0x9b, 0x86, 0xcb, 0x9f, 0xb0, 0x87, 0x90, 0xfc, 0x95, 0x90, 0x56, + 0x62, 0xf2, 0x8b, 0xdb, 0x46, 0xc5, 0x18, 0x63, 0x10, 0x2a, 0xf7, 0x0c, + 0x97, 0x3f, 0x61, 0x0f, 0x21, 0xf9, 0x21, 0xd0, 0x0c, 0x0b, 0x81, 0x82, + 0x55, 0x18, 0x45, 0x18, 0x1b, 0x63, 0x0c, 0x42, 0xc8, 0xa0, 0x56, 0x90, + 0x41, 0xc6, 0x18, 0x63, 0x0c, 0x7a, 0x73, 0x04, 0x41, 0x31, 0x18, 0x29, + 0x84, 0x44, 0x92, 0x03, 0x01, 0xc3, 0x08, 0xc4, 0x30, 0x53, 0x1b, 0x8c, + 0x03, 0x3b, 0x84, 0xc3, 0x3c, 0xcc, 0x83, 0x1b, 0xd0, 0x42, 0x39, 0xe0, + 0x03, 0x3d, 0xd4, 0x83, 0x3c, 0x94, 0x83, 0x1c, 0x90, 0x02, 0x1f, 0xd8, + 0x43, 0x39, 0x8c, 0x03, 0x3d, 0xbc, 0x83, 0x3c, 0xf0, 0x81, 0x39, 0xb0, + 0xc3, 0x3b, 0x84, 0x03, 0x3d, 0xb0, 0x01, 0x18, 0xd0, 0x81, 0x1f, 0x80, + 0x81, 0x1f, 0xe8, 0x81, 0x1e, 0xb4, 0x43, 0x3a, 0xc0, 0xc3, 0x3c, 0xfc, + 0x02, 0x3d, 0xe4, 0x03, 0x3c, 0x94, 0x03, 0x0a, 0xc8, 0x4c, 0x62, 0x30, + 0x0e, 0xec, 0x10, 0x0e, 0xf3, 0x30, 0x0f, 0x6e, 0x40, 0x0b, 0xe5, 0x80, + 0x0f, 0xf4, 0x50, 0x0f, 0xf2, 0x50, 0x0e, 0x72, 0x40, 0x0a, 0x7c, 0x60, + 0x0f, 0xe5, 0x30, 0x0e, 0xf4, 0xf0, 0x0e, 0xf2, 0xc0, 0x07, 0xe6, 0xc0, + 0x0e, 0xef, 0x10, 0x0e, 0xf4, 0xc0, 0x06, 0x60, 0x40, 0x07, 0x7e, 0x00, + 0x06, 0x7e, 0x80, 0x84, 0x6a, 0xe9, 0xde, 0x24, 0x4d, 0x11, 0x25, 0x4c, + 0x3e, 0x0b, 0x30, 0xcf, 0x42, 0x44, 0xec, 0x04, 0x4c, 0x04, 0x0a, 0x08, + 0xe5, 0x74, 0x20, 0x00, 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, + 0x87, 0x36, 0x68, 0x87, 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, 0x0d, 0xaf, + 0x50, 0x0e, 0x6d, 0xd0, 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, + 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, + 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, + 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, + 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, + 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, + 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, + 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x43, + 0x9e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x86, 0x3c, 0x06, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x0c, 0x79, 0x10, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x18, 0xf2, 0x34, 0x40, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x30, 0xe4, 0x79, 0x80, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x60, 0xc8, 0x23, 0x01, 0x01, 0x30, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x16, 0x08, 0x00, 0x0f, 0x00, 0x00, + 0x00, 0x32, 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, + 0x47, 0xc6, 0x04, 0x43, 0x22, 0x25, 0x30, 0x02, 0x50, 0x0c, 0x45, 0x50, + 0x12, 0x65, 0x50, 0x1e, 0x54, 0x4a, 0xa2, 0x0c, 0x0a, 0x61, 0x04, 0xa0, + 0x08, 0x0a, 0x84, 0xf0, 0x0c, 0x00, 0xe9, 0x19, 0x00, 0xda, 0x63, 0x39, + 0x0c, 0x01, 0x00, 0x00, 0x70, 0x1c, 0x00, 0x10, 0x08, 0x04, 0x02, 0x00, + 0x00, 0x79, 0x18, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, + 0x90, 0x46, 0x02, 0x13, 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, 0x3b, 0x03, + 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, 0xb9, 0x01, + 0x41, 0xa1, 0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, 0x0a, 0x9a, + 0x2a, 0xfa, 0x9a, 0xb9, 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, 0x63, 0x4b, + 0xd9, 0x10, 0x04, 0x13, 0x04, 0xc2, 0x98, 0x20, 0x10, 0xc7, 0x06, 0x61, + 0x20, 0x26, 0x08, 0x04, 0xb2, 0x41, 0x18, 0x0c, 0x0a, 0x70, 0x73, 0x1b, + 0x06, 0xc4, 0x20, 0x26, 0x08, 0xd8, 0x44, 0x60, 0x82, 0x40, 0x24, 0x13, + 0x04, 0x42, 0xd9, 0x20, 0x10, 0xcd, 0x86, 0x84, 0x50, 0x16, 0x82, 0x18, + 0x18, 0xc2, 0xd9, 0x90, 0x0c, 0xca, 0x42, 0x0c, 0x03, 0x43, 0x38, 0x1b, + 0x84, 0x07, 0x9a, 0x20, 0x68, 0xd4, 0x06, 0x84, 0x90, 0x16, 0x82, 0x18, + 0x08, 0x60, 0x43, 0x30, 0x6d, 0x20, 0x22, 0x00, 0xa0, 0x26, 0x08, 0x5b, + 0xb5, 0x21, 0xb0, 0x26, 0x08, 0x02, 0x40, 0xa2, 0x2d, 0x2c, 0xcd, 0x8d, + 0xcb, 0x94, 0xd5, 0x17, 0xd4, 0xdb, 0x5c, 0x1a, 0x5d, 0xda, 0x9b, 0xdb, + 0x04, 0xa1, 0x68, 0x26, 0x08, 0x85, 0xb3, 0x21, 0x20, 0x26, 0x08, 0xc5, + 0x33, 0x41, 0x28, 0xa0, 0x0d, 0x0b, 0xa1, 0x6d, 0x5c, 0xe7, 0x0d, 0x1e, + 0xf1, 0x01, 0x44, 0xa8, 0x8a, 0xb0, 0x86, 0x9e, 0x9e, 0xa4, 0x88, 0x26, + 0x08, 0x45, 0x34, 0x41, 0x20, 0x96, 0x0d, 0xc2, 0x18, 0x8c, 0xc1, 0x86, + 0x65, 0x08, 0x83, 0xed, 0xeb, 0xc4, 0x60, 0x10, 0x83, 0xe1, 0x23, 0x03, + 0x16, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x13, 0x04, 0x82, 0xd9, 0x20, 0x8c, + 0xc1, 0x19, 0x6c, 0x58, 0x18, 0x33, 0xd8, 0xbe, 0x4e, 0x0c, 0x06, 0x8f, + 0xf9, 0xd0, 0x60, 0xc3, 0x00, 0x06, 0x65, 0x90, 0x06, 0x4c, 0xa6, 0xac, + 0xbe, 0xa8, 0xc2, 0xe4, 0xce, 0xca, 0xe8, 0x26, 0x08, 0x85, 0xb4, 0x61, + 0x21, 0xd6, 0x60, 0x63, 0x83, 0xee, 0x1b, 0x3c, 0xe2, 0x43, 0x83, 0x0d, + 0x41, 0x1b, 0x6c, 0x18, 0xd4, 0xc0, 0x0d, 0x80, 0x0d, 0x05, 0x96, 0xbd, + 0x41, 0x05, 0x54, 0x61, 0x63, 0xb3, 0x6b, 0x73, 0x49, 0x23, 0x2b, 0x73, + 0xa3, 0x9b, 0x12, 0x04, 0x55, 0xc8, 0xf0, 0x5c, 0xec, 0xca, 0xe4, 0xe6, + 0xd2, 0xde, 0xdc, 0xa6, 0x04, 0x44, 0x13, 0x32, 0x3c, 0x17, 0xbb, 0x30, + 0x36, 0xbb, 0x32, 0xb9, 0x29, 0x81, 0x51, 0x87, 0x0c, 0xcf, 0x65, 0x0e, + 0x2d, 0x8c, 0xac, 0x4c, 0xae, 0xe9, 0x8d, 0xac, 0x8c, 0x6d, 0x4a, 0x80, + 0x94, 0x21, 0xc3, 0x73, 0x91, 0x2b, 0x9b, 0x7b, 0xab, 0x93, 0x1b, 0x2b, + 0x9b, 0x9b, 0x12, 0x50, 0x75, 0xc8, 0xf0, 0x5c, 0xec, 0xd2, 0xca, 0xee, + 0x92, 0xc8, 0xa6, 0xe8, 0xc2, 0xe8, 0xca, 0xa6, 0x04, 0x56, 0x1d, 0x32, + 0x3c, 0x97, 0x32, 0x37, 0x3a, 0xb9, 0x3c, 0xa8, 0xb7, 0x34, 0x37, 0xba, + 0xb9, 0x29, 0xc1, 0x1b, 0x00, 0x79, 0x18, 0x00, 0x00, 0x4c, 0x00, 0x00, + 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, + 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, + 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, + 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, + 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, + 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, + 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, + 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, + 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, + 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, + 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, + 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, + 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, + 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, + 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, + 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, + 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, + 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, + 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, + 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, + 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, + 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, + 0xc4, 0x21, 0x07, 0x7c, 0x70, 0x03, 0x7a, 0x28, 0x87, 0x76, 0x80, 0x87, + 0x19, 0xd1, 0x43, 0x0e, 0xf8, 0xe0, 0x06, 0xe4, 0x20, 0x0e, 0xe7, 0xe0, + 0x06, 0xf6, 0x10, 0x0e, 0xf2, 0xc0, 0x0e, 0xe1, 0x90, 0x0f, 0xef, 0x50, + 0x0f, 0xf4, 0x00, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x15, 0x00, 0x00, + 0x00, 0x56, 0x20, 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x10, 0x11, 0xc0, 0x44, + 0x84, 0x40, 0x33, 0x2c, 0x84, 0x11, 0x38, 0xc3, 0xe5, 0x3b, 0x8f, 0x3f, + 0x38, 0xd3, 0xed, 0x17, 0xb7, 0x6d, 0x01, 0xd3, 0x70, 0xf9, 0xce, 0xe3, + 0x2f, 0x0e, 0x30, 0x88, 0xcd, 0x43, 0x4d, 0x7e, 0x71, 0xdb, 0x36, 0x00, + 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x04, 0x30, 0xcf, 0x42, 0xf8, 0xc5, 0x6d, + 0x9b, 0x40, 0x35, 0x5c, 0xbe, 0xf3, 0xf8, 0xd2, 0xe4, 0x44, 0x04, 0x4a, + 0x4d, 0x0f, 0x35, 0xf9, 0xc5, 0x6d, 0x1b, 0x00, 0xc1, 0x00, 0x48, 0x03, + 0x00, 0x61, 0x20, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, + 0x2c, 0x10, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x14, 0x47, 0x00, + 0xa8, 0x94, 0x00, 0x91, 0xc2, 0x2b, 0xb7, 0x92, 0x2b, 0x85, 0x42, 0x98, + 0x01, 0xa0, 0x31, 0x46, 0xe0, 0xba, 0xa6, 0x08, 0x82, 0xc1, 0x18, 0x41, + 0x69, 0xa2, 0x60, 0xfd, 0x0b, 0x63, 0x04, 0x22, 0x6c, 0xc6, 0xec, 0x2f, + 0x8c, 0x11, 0xe8, 0xad, 0x8c, 0xf3, 0xdf, 0x18, 0x41, 0x48, 0x82, 0x21, + 0xee, 0x0b, 0x23, 0x00, 0x63, 0x04, 0x21, 0x09, 0x86, 0xf0, 0x2f, 0x8c, + 0x11, 0xbc, 0xb8, 0xa8, 0xe6, 0xdf, 0x0c, 0x00, 0x00, 0x23, 0x06, 0x09, + 0x00, 0x82, 0x60, 0x20, 0x89, 0x41, 0x73, 0x85, 0x41, 0x18, 0x44, 0x23, + 0x06, 0x09, 0x00, 0x82, 0x60, 0x20, 0x8d, 0x81, 0x83, 0x85, 0x41, 0x18, + 0x48, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x20, 0x91, 0xc1, 0xb3, 0x89, + 0x81, 0x18, 0x4c, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0xa4, 0x81, + 0x13, 0x06, 0x63, 0xa0, 0x35, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, + 0xa8, 0xc1, 0x23, 0x06, 0x64, 0x40, 0x39, 0x23, 0x06, 0x09, 0x00, 0x82, + 0x60, 0x60, 0xac, 0x01, 0x34, 0x06, 0x65, 0xb0, 0x3d, 0x23, 0x06, 0x09, + 0x00, 0x82, 0x60, 0x60, 0xb0, 0x41, 0x44, 0x06, 0x66, 0xf0, 0x41, 0x23, + 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0xb4, 0x81, 0x84, 0x06, 0x67, 0xe0, + 0x45, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0xb8, 0xc1, 0x94, 0x06, + 0x68, 0x80, 0x49, 0x23, 0x06, 0x0f, 0x00, 0x82, 0x60, 0xd0, 0xb4, 0x01, + 0x86, 0x1c, 0x42, 0xa0, 0x28, 0x69, 0x90, 0x06, 0x93, 0x32, 0x9a, 0x10, + 0x00, 0x23, 0x06, 0x0f, 0x00, 0x82, 0x60, 0xd0, 0xbc, 0x81, 0xb6, 0x24, + 0xc4, 0xc0, 0x30, 0x6b, 0xb0, 0x06, 0x15, 0x33, 0x9a, 0x10, 0x00, 0xa3, + 0x09, 0x42, 0x60, 0xc4, 0x04, 0x1f, 0x1b, 0x24, 0xf8, 0xd8, 0x30, 0xc1, + 0x67, 0xc4, 0x60, 0x01, 0x40, 0x10, 0x0c, 0x1e, 0x3a, 0xf8, 0x06, 0x21, + 0x98, 0xaa, 0x6b, 0xc4, 0x60, 0x01, 0x40, 0x10, 0x0c, 0x9e, 0x3a, 0x00, + 0x03, 0x62, 0x10, 0xa8, 0x4c, 0x1b, 0x31, 0x58, 0x00, 0x10, 0x04, 0x83, + 0xc7, 0x0e, 0xc2, 0xa0, 0x20, 0x86, 0x8a, 0xbb, 0x6c, 0x88, 0xe4, 0x63, + 0x43, 0x24, 0x1f, 0x1b, 0x22, 0xf9, 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, + 0x01, 0xc2, 0x07, 0x63, 0x70, 0x07, 0x77, 0xe0, 0x06, 0xc3, 0x88, 0x41, + 0x02, 0x80, 0x20, 0x18, 0x20, 0x7c, 0x30, 0x06, 0x77, 0x70, 0x07, 0x67, + 0x20, 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, 0x01, 0xc2, 0x07, 0x63, 0x70, + 0x07, 0x77, 0xd0, 0x06, 0xc1, 0x88, 0x41, 0x02, 0x80, 0x20, 0x18, 0x20, + 0x7c, 0x30, 0x06, 0x77, 0x70, 0x07, 0x70, 0x10, 0x21, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +/* The yuv-rendering pixel shader: + + --- D3D12_PixelShader_NV12_BT709.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureUV : register(t1); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + #define NVRS \ + "RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \ + " DENY_DOMAIN_SHADER_ROOT_ACCESS |" \ + " DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \ + " DENY_HULL_SHADER_ROOT_ACCESS )," \ + "RootConstants(num32BitConstants=32, b0),"\ + "DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )" + + [RootSignature(NVRS)] + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.7927}; + const float3 Gcoeff = {1.1644, -0.2132, -0.5329}; + const float3 Bcoeff = {1.1644, 2.1124, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ + +static unsigned char D3D12_PixelShader_NV12_BT709[] = { + 0x44, 0x58, 0x42, 0x43, 0x45, 0xb4, 0xa5, 0xa8, 0x01, 0xc5, 0xab, 0xf5, + 0xc0, 0x51, 0x32, 0xc2, 0xc3, 0x60, 0x64, 0xf1, 0x01, 0x00, 0x00, 0x00, + 0xe9, 0x12, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, + 0x50, 0x00, 0x00, 0x00, 0xdb, 0x00, 0x00, 0x00, 0x15, 0x01, 0x00, 0x00, + 0x0d, 0x02, 0x00, 0x00, 0xc9, 0x02, 0x00, 0x00, 0x15, 0x0b, 0x00, 0x00, + 0x31, 0x0b, 0x00, 0x00, 0x53, 0x46, 0x49, 0x30, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x31, + 0x83, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x53, 0x56, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, + 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x43, 0x4f, 0x4c, + 0x4f, 0x52, 0x00, 0x4f, 0x53, 0x47, 0x31, 0x32, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x00, 0x50, 0x53, 0x56, 0x30, 0xf0, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, + 0xff, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01, 0x00, 0x03, 0x01, 0x00, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x43, + 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x44, 0x03, 0x03, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x42, 0x00, 0x03, 0x02, 0x00, + 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x44, + 0x00, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x44, 0x10, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x52, 0x54, 0x53, + 0x30, 0xb4, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, + 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, + 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, + 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, + 0x00, 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, + 0xff, 0x01, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, + 0x00, 0x9c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xff, 0xff, 0x53, 0x54, 0x41, 0x54, 0x44, 0x08, 0x00, + 0x00, 0x60, 0x00, 0x00, 0x00, 0x11, 0x02, 0x00, 0x00, 0x44, 0x58, 0x49, + 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x2c, 0x08, 0x00, + 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0x08, 0x02, 0x00, + 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, + 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, + 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, + 0x62, 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, + 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x52, 0x88, 0x48, 0x90, 0x14, + 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, + 0x90, 0x91, 0x22, 0xc4, 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, + 0x8a, 0x04, 0x29, 0x46, 0x06, 0x51, 0x18, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, 0x02, 0xa8, + 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x20, 0x6d, 0x30, 0x86, + 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x09, 0xa8, 0x00, 0x49, 0x18, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, 0x4c, 0x08, + 0x06, 0x00, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x4b, 0x00, 0x00, + 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, + 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, + 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x78, 0x33, 0x00, 0xc3, 0x08, 0x04, + 0x30, 0x47, 0x00, 0x06, 0x33, 0xb5, 0xc1, 0x38, 0xb0, 0x43, 0x38, 0xcc, + 0xc3, 0x3c, 0xb8, 0x01, 0x2d, 0x94, 0x03, 0x3e, 0xd0, 0x43, 0x3d, 0xc8, + 0x43, 0x39, 0xc8, 0x01, 0x29, 0xf0, 0x81, 0x3d, 0x94, 0xc3, 0x38, 0xd0, + 0xc3, 0x3b, 0xc8, 0x03, 0x1f, 0x98, 0x03, 0x3b, 0xbc, 0x43, 0x38, 0xd0, + 0x03, 0x1b, 0x80, 0x01, 0x1d, 0xf8, 0x01, 0x18, 0xf8, 0x81, 0x1e, 0xe8, + 0x41, 0x3b, 0xa4, 0x03, 0x3c, 0xcc, 0xc3, 0x2f, 0xd0, 0x43, 0x3e, 0xc0, + 0x43, 0x39, 0xa0, 0x40, 0xcc, 0x24, 0x06, 0xe3, 0xc0, 0x0e, 0xe1, 0x30, + 0x0f, 0xf3, 0xe0, 0x06, 0xb4, 0x50, 0x0e, 0xf8, 0x40, 0x0f, 0xf5, 0x20, + 0x0f, 0xe5, 0x20, 0x07, 0xa4, 0xc0, 0x07, 0xf6, 0x50, 0x0e, 0xe3, 0x40, + 0x0f, 0xef, 0x20, 0x0f, 0x7c, 0x60, 0x0e, 0xec, 0xf0, 0x0e, 0xe1, 0x40, + 0x0f, 0x6c, 0x00, 0x06, 0x74, 0xe0, 0x07, 0x60, 0xe0, 0x07, 0x48, 0x08, + 0x83, 0xc8, 0x4d, 0xd2, 0x14, 0x51, 0xc2, 0xe4, 0xb3, 0x00, 0xf3, 0x2c, + 0x44, 0xc4, 0x4e, 0xc0, 0x44, 0xa0, 0x40, 0x90, 0x19, 0x01, 0x28, 0x01, + 0xa2, 0x34, 0x47, 0x80, 0x14, 0x03, 0x08, 0x21, 0x96, 0x20, 0x56, 0x0c, + 0x24, 0x84, 0x58, 0x80, 0xdc, 0x4d, 0xc3, 0xe5, 0x4f, 0xd8, 0x43, 0x48, + 0xfe, 0x4a, 0x48, 0x2b, 0x31, 0xf9, 0xc5, 0x6d, 0xa3, 0x02, 0x00, 0x00, + 0x04, 0xad, 0x7b, 0x86, 0xcb, 0x9f, 0xb0, 0x87, 0x90, 0xfc, 0x10, 0x68, + 0x86, 0x85, 0x40, 0x41, 0x2c, 0x0c, 0x14, 0x52, 0x02, 0x00, 0x80, 0x10, + 0x02, 0xd0, 0x2c, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0xd5, 0x39, 0x82, + 0xa0, 0x18, 0x52, 0x2c, 0x21, 0x2e, 0xe1, 0x81, 0x80, 0x61, 0x04, 0x01, + 0xb8, 0x4b, 0x9a, 0x22, 0x4a, 0x98, 0xfc, 0x14, 0xb9, 0x88, 0x85, 0x3d, + 0x80, 0x81, 0x88, 0xc4, 0xe6, 0xa1, 0x26, 0x34, 0x84, 0x1d, 0xd2, 0x41, + 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, + 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, + 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, + 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x3a, 0x0f, 0x64, 0x90, 0x21, + 0x23, 0x45, 0x44, 0x00, 0x72, 0x00, 0xc0, 0xe4, 0x00, 0x80, 0xe9, 0x01, + 0x00, 0x0f, 0x79, 0x12, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x18, 0xf2, 0x30, 0x40, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x30, 0xe4, 0x71, 0x80, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x60, 0xc8, 0x33, 0x01, 0x01, 0x30, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x90, 0xa7, 0x02, 0x02, 0x20, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x21, 0x0f, 0x06, 0x04, 0xc0, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x59, 0x20, 0x00, 0x00, + 0x00, 0x15, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x18, 0x19, 0x11, 0x4c, + 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x5a, 0x05, 0x42, 0xa2, + 0x04, 0x46, 0x00, 0x8a, 0xa1, 0x08, 0x4a, 0xa2, 0x50, 0xca, 0xa0, 0x1c, + 0x0a, 0xa4, 0x10, 0x4a, 0xa1, 0xc0, 0x0a, 0xa8, 0x3c, 0x0a, 0x87, 0x56, + 0x11, 0x8c, 0x00, 0x14, 0x42, 0x19, 0x94, 0x04, 0x9d, 0x19, 0x00, 0x2a, + 0x33, 0x00, 0x44, 0x66, 0x00, 0x68, 0xcc, 0x00, 0x50, 0x98, 0x01, 0x20, + 0x3e, 0x03, 0x40, 0x7d, 0x2c, 0x87, 0x21, 0x00, 0x00, 0x00, 0x8e, 0x03, + 0x00, 0x02, 0x81, 0x40, 0x00, 0x79, 0x18, 0x00, 0x00, 0xbe, 0x00, 0x00, + 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, 0x44, 0x35, 0x18, 0x63, + 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x03, + 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1, 0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, + 0x62, 0x2a, 0x0a, 0x9a, 0x2a, 0xfa, 0x9a, 0xb9, 0x81, 0x79, 0x31, 0x4b, + 0x73, 0x0b, 0x63, 0x4b, 0xd9, 0x10, 0x04, 0x13, 0x04, 0x41, 0x99, 0x20, + 0x08, 0xcb, 0x06, 0x61, 0x20, 0x36, 0x08, 0x04, 0x41, 0x01, 0x6e, 0x6e, + 0x82, 0x20, 0x30, 0x1b, 0x86, 0x03, 0x21, 0x26, 0x08, 0xc5, 0xc7, 0x85, + 0x0e, 0xad, 0x8c, 0xaa, 0x0c, 0x8f, 0xae, 0x4e, 0xae, 0x2c, 0x6b, 0x82, + 0x20, 0x34, 0x13, 0x04, 0xc1, 0xd9, 0x20, 0x10, 0xcd, 0x86, 0x84, 0x50, + 0x16, 0x82, 0x18, 0x18, 0xc2, 0x21, 0x43, 0x87, 0x56, 0x46, 0x55, 0x86, + 0x47, 0x57, 0x27, 0x57, 0x56, 0x65, 0xb5, 0x21, 0x19, 0x14, 0x88, 0x18, + 0x06, 0x86, 0x70, 0x36, 0x08, 0x4f, 0x34, 0x41, 0x38, 0x3c, 0x2a, 0x74, + 0x68, 0x65, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x1b, 0x10, 0x62, + 0xa2, 0x08, 0x62, 0x20, 0x80, 0x0d, 0x41, 0xb5, 0x81, 0x90, 0x00, 0xc0, + 0x9a, 0x20, 0x10, 0x60, 0x30, 0x41, 0x10, 0x1e, 0x06, 0x68, 0x13, 0x04, + 0x01, 0x9a, 0x20, 0x08, 0xd1, 0x06, 0x03, 0xd1, 0x36, 0x82, 0x6b, 0x48, + 0xb4, 0xa5, 0xc1, 0xcd, 0x4d, 0x10, 0x04, 0x69, 0x03, 0x81, 0x78, 0xdb, + 0x37, 0x41, 0x08, 0xc4, 0x60, 0x83, 0x40, 0x84, 0xc1, 0x86, 0x40, 0x0c, + 0x36, 0x08, 0xc4, 0x18, 0x6c, 0x20, 0xb2, 0x0e, 0x0c, 0xc8, 0x60, 0x82, + 0x30, 0x84, 0xc1, 0x04, 0x41, 0x98, 0x68, 0xa0, 0x85, 0xb9, 0x91, 0xb1, + 0x95, 0x4d, 0x10, 0x04, 0x6a, 0x83, 0x81, 0xa0, 0xc1, 0x46, 0x70, 0x69, + 0xb0, 0x41, 0x38, 0x03, 0x35, 0x98, 0x20, 0x70, 0x63, 0x30, 0x41, 0x10, + 0x2a, 0x0e, 0x70, 0x6f, 0x73, 0x5c, 0xa6, 0xac, 0xbe, 0xa0, 0x9e, 0xa6, + 0x92, 0xa8, 0x92, 0x9e, 0x9c, 0x36, 0x20, 0x88, 0x1b, 0x6c, 0xc4, 0x19, + 0xbc, 0x01, 0xd7, 0x70, 0xa0, 0x2b, 0xc3, 0x63, 0x42, 0x55, 0x84, 0x35, + 0xf4, 0xf4, 0x24, 0x45, 0x04, 0xb3, 0x01, 0x41, 0xe2, 0x60, 0xfb, 0xce, + 0x40, 0x0e, 0xb8, 0x86, 0xc5, 0xd8, 0x1b, 0xdb, 0x9b, 0xdc, 0x04, 0x41, + 0xb0, 0x68, 0x0c, 0x3d, 0x31, 0x3d, 0x49, 0xc1, 0x6c, 0x40, 0x10, 0x3a, + 0xd8, 0xea, 0xe0, 0x0c, 0xec, 0x80, 0x6b, 0x36, 0x10, 0x6d, 0x00, 0x07, + 0x73, 0x70, 0x07, 0x1b, 0x0e, 0x02, 0x2b, 0x03, 0x33, 0x58, 0x03, 0x36, + 0xc0, 0x83, 0x09, 0x82, 0x32, 0x6c, 0x00, 0x36, 0x0c, 0xc4, 0x1e, 0xec, + 0xc1, 0x86, 0x80, 0x0f, 0x36, 0x0c, 0x83, 0x1e, 0xf4, 0xc1, 0x04, 0xa1, + 0x23, 0x83, 0x0d, 0xc1, 0x1f, 0x90, 0x68, 0x0b, 0x4b, 0x73, 0xe3, 0x32, + 0x65, 0xf5, 0x05, 0xf5, 0x36, 0x97, 0x46, 0x97, 0xf6, 0xe6, 0x36, 0x41, + 0x58, 0xba, 0x09, 0xc2, 0xc2, 0x6d, 0x08, 0x88, 0x09, 0xc2, 0xb2, 0x4d, + 0x10, 0x16, 0x6d, 0xc3, 0x42, 0x88, 0xc2, 0x28, 0x90, 0x42, 0x29, 0x98, + 0xc2, 0x60, 0x0a, 0xc4, 0x29, 0x00, 0x44, 0xa8, 0x8a, 0xb0, 0x86, 0x9e, + 0x9e, 0xa4, 0x88, 0x26, 0x08, 0x4b, 0xb6, 0x41, 0xd8, 0xb6, 0x0d, 0xcb, + 0x90, 0x0a, 0xa3, 0x70, 0x0a, 0xa5, 0xa0, 0x0a, 0x83, 0x2a, 0x0c, 0xa7, + 0xb0, 0x0a, 0x2c, 0x86, 0x9e, 0x98, 0x9e, 0xa4, 0x26, 0x08, 0xc2, 0xb5, + 0x41, 0xd8, 0x5c, 0x61, 0xc3, 0xc2, 0xb4, 0xc2, 0x28, 0x9c, 0x42, 0x29, + 0xa8, 0xc2, 0x60, 0x0a, 0xcc, 0x29, 0xbc, 0xc2, 0x86, 0x01, 0x15, 0x58, + 0x01, 0x16, 0x98, 0x4c, 0x59, 0x7d, 0x51, 0x85, 0xc9, 0x9d, 0x95, 0xd1, + 0x4d, 0x10, 0x96, 0x64, 0xc3, 0x42, 0xc8, 0xc2, 0x28, 0xcc, 0x42, 0x29, + 0x9c, 0xc2, 0x60, 0x0a, 0xc4, 0x29, 0xbc, 0xc2, 0x86, 0x80, 0x16, 0x36, + 0x0c, 0xb1, 0x50, 0x0b, 0xc0, 0x86, 0x42, 0x0f, 0x42, 0xc1, 0x16, 0x2e, + 0x80, 0x86, 0x19, 0xdb, 0x5b, 0x18, 0xdd, 0x1c, 0x8b, 0x34, 0xb7, 0x39, + 0xba, 0xb9, 0x09, 0x82, 0x80, 0xd1, 0x98, 0x4b, 0x3b, 0xfb, 0x62, 0x23, + 0xa3, 0x31, 0x97, 0x76, 0xf6, 0x35, 0x47, 0x47, 0x84, 0xae, 0x0c, 0xef, + 0xcb, 0xed, 0x4d, 0xae, 0x6d, 0x83, 0x82, 0x0b, 0x4d, 0x2e, 0xe8, 0xc2, + 0x2e, 0x20, 0xbc, 0x70, 0x06, 0xbd, 0xc0, 0x54, 0x61, 0x63, 0xb3, 0x6b, + 0x73, 0x49, 0x23, 0x2b, 0x73, 0xa3, 0x9b, 0x12, 0x04, 0x55, 0xc8, 0xf0, + 0x5c, 0xec, 0xca, 0xe4, 0xe6, 0xd2, 0xde, 0xdc, 0xa6, 0x04, 0x44, 0x13, + 0x32, 0x3c, 0x17, 0xbb, 0x30, 0x36, 0xbb, 0x32, 0xb9, 0x29, 0x41, 0x51, + 0x87, 0x0c, 0xcf, 0x65, 0x0e, 0x2d, 0x8c, 0xac, 0x4c, 0xae, 0xe9, 0x8d, + 0xac, 0x8c, 0x6d, 0x4a, 0x80, 0x94, 0x21, 0xc3, 0x73, 0x91, 0x2b, 0x9b, + 0x7b, 0xab, 0x93, 0x1b, 0x2b, 0x9b, 0x9b, 0x12, 0x58, 0x95, 0xc8, 0xf0, + 0x5c, 0xe8, 0xf2, 0xe0, 0xca, 0x82, 0xdc, 0xdc, 0xde, 0xe8, 0xc2, 0xe8, + 0xd2, 0xde, 0xdc, 0xe6, 0xa6, 0x08, 0x78, 0xd0, 0x07, 0x75, 0xc8, 0xf0, + 0x5c, 0xec, 0xd2, 0xca, 0xee, 0x92, 0xc8, 0xa6, 0xe8, 0xc2, 0xe8, 0xca, + 0xa6, 0x04, 0x7f, 0x50, 0x87, 0x0c, 0xcf, 0xa5, 0xcc, 0x8d, 0x4e, 0x2e, + 0x0f, 0xea, 0x2d, 0xcd, 0x8d, 0x6e, 0x6e, 0x4a, 0x60, 0x0b, 0x5d, 0xc8, + 0xf0, 0x5c, 0xc6, 0xde, 0xea, 0xdc, 0xe8, 0xca, 0xe4, 0xe6, 0xa6, 0x04, + 0xbd, 0x00, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x4c, 0x00, 0x00, + 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, + 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, + 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, + 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, + 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, + 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, + 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, + 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, + 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, + 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, + 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, + 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, + 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, + 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, + 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, + 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, + 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, + 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, + 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, + 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, + 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, + 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, + 0xc4, 0x21, 0x07, 0x7c, 0x70, 0x03, 0x7a, 0x28, 0x87, 0x76, 0x80, 0x87, + 0x19, 0xd1, 0x43, 0x0e, 0xf8, 0xe0, 0x06, 0xe4, 0x20, 0x0e, 0xe7, 0xe0, + 0x06, 0xf6, 0x10, 0x0e, 0xf2, 0xc0, 0x0e, 0xe1, 0x90, 0x0f, 0xef, 0x50, + 0x0f, 0xf4, 0x00, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x33, 0x00, 0x00, + 0x00, 0x25, 0xf0, 0x05, 0x7e, 0x74, 0x74, 0x79, 0x1a, 0x6e, 0xc3, 0xd9, + 0x65, 0x39, 0x10, 0x38, 0xab, 0x4e, 0xc3, 0x6d, 0x38, 0xbb, 0x2c, 0x9f, + 0xd2, 0xc3, 0xf4, 0x32, 0x10, 0x18, 0xac, 0x80, 0x38, 0x08, 0xfc, 0xe8, + 0xe8, 0x32, 0xb5, 0x8c, 0xa7, 0xd7, 0xe5, 0xe5, 0xaa, 0x15, 0x08, 0x9c, + 0x59, 0x7f, 0x24, 0x6a, 0x19, 0x4f, 0xaf, 0xcb, 0xcb, 0x32, 0x22, 0xd0, + 0xfa, 0x23, 0xd9, 0xcb, 0x63, 0xfa, 0x5b, 0x0e, 0x6c, 0x92, 0x60, 0x33, + 0x20, 0x10, 0x08, 0x0c, 0x16, 0x00, 0x1c, 0x04, 0x7e, 0x74, 0x74, 0x99, + 0x5a, 0xc6, 0xd3, 0xeb, 0xf2, 0x72, 0x16, 0x08, 0x9c, 0x59, 0x7f, 0x24, + 0x6a, 0x19, 0x4f, 0xaf, 0xcb, 0xcb, 0x32, 0x22, 0xd0, 0xfa, 0x23, 0xd9, + 0xcb, 0x63, 0xfa, 0x5b, 0x0e, 0x6c, 0x92, 0x60, 0x33, 0x20, 0x10, 0x08, + 0x0c, 0x1a, 0x82, 0x34, 0x5c, 0xbe, 0xf3, 0xf8, 0x42, 0x44, 0x00, 0x13, + 0x11, 0x02, 0xcd, 0xb0, 0x10, 0x76, 0xe0, 0x0c, 0x97, 0xef, 0x3c, 0xfe, + 0xe0, 0x4c, 0xb7, 0x5f, 0xdc, 0xb6, 0x11, 0x4c, 0xc3, 0xe5, 0x3b, 0x8f, + 0xbf, 0x38, 0xc0, 0x20, 0x36, 0x0f, 0x35, 0xf9, 0xc5, 0x6d, 0x9b, 0x01, + 0x34, 0x5c, 0xbe, 0xf3, 0xf8, 0x12, 0xc0, 0x3c, 0x0b, 0xe1, 0x17, 0xb7, + 0x6d, 0x05, 0xd5, 0x70, 0xf9, 0xce, 0xe3, 0x4b, 0x93, 0x13, 0x11, 0x28, + 0x35, 0x3d, 0xd4, 0xe4, 0x17, 0xb7, 0x6d, 0x03, 0x04, 0x03, 0x20, 0x0d, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x41, 0x53, 0x48, 0x14, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xd1, 0x3f, 0x63, 0xb2, 0x44, 0xb0, 0x28, + 0x54, 0xc4, 0x46, 0x87, 0x44, 0x49, 0x1b, 0x1b, 0xb5, 0x44, 0x58, 0x49, + 0x4c, 0xb0, 0x07, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xec, 0x01, 0x00, + 0x00, 0x44, 0x58, 0x49, 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x98, 0x07, 0x00, 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, + 0x00, 0xe3, 0x01, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, + 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, + 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, + 0x42, 0xa4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x52, + 0x88, 0x48, 0x90, 0x14, 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, + 0x42, 0xe4, 0x48, 0x0e, 0x90, 0x91, 0x22, 0xc4, 0x50, 0x41, 0x51, 0x81, + 0x8c, 0xe1, 0x83, 0xe5, 0x8a, 0x04, 0x29, 0x46, 0x06, 0x51, 0x18, 0x00, + 0x00, 0x08, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, + 0x07, 0x40, 0x02, 0xa8, 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, + 0x20, 0x6d, 0x30, 0x86, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x09, 0xa8, + 0x00, 0x49, 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, + 0x42, 0x20, 0x4c, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, + 0x00, 0x45, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, + 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, + 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x70, 0x23, + 0x00, 0x25, 0x00, 0x14, 0x66, 0x00, 0xe6, 0x08, 0xc0, 0x60, 0x8e, 0x00, + 0x29, 0xc6, 0x20, 0x84, 0x14, 0x42, 0xa6, 0x18, 0x80, 0x10, 0x52, 0x06, + 0xa1, 0x9b, 0x86, 0xcb, 0x9f, 0xb0, 0x87, 0x90, 0xfc, 0x95, 0x90, 0x56, + 0x62, 0xf2, 0x8b, 0xdb, 0x46, 0xc5, 0x18, 0x63, 0x10, 0x2a, 0xf7, 0x0c, + 0x97, 0x3f, 0x61, 0x0f, 0x21, 0xf9, 0x21, 0xd0, 0x0c, 0x0b, 0x81, 0x82, + 0x55, 0x18, 0x45, 0x18, 0x1b, 0x63, 0x0c, 0x42, 0xc8, 0xa0, 0x56, 0x90, + 0x41, 0xc6, 0x18, 0x63, 0x0c, 0x7a, 0x73, 0x04, 0x41, 0x31, 0x18, 0x29, + 0x84, 0x44, 0x92, 0x03, 0x01, 0xc3, 0x08, 0xc4, 0x30, 0x53, 0x1b, 0x8c, + 0x03, 0x3b, 0x84, 0xc3, 0x3c, 0xcc, 0x83, 0x1b, 0xd0, 0x42, 0x39, 0xe0, + 0x03, 0x3d, 0xd4, 0x83, 0x3c, 0x94, 0x83, 0x1c, 0x90, 0x02, 0x1f, 0xd8, + 0x43, 0x39, 0x8c, 0x03, 0x3d, 0xbc, 0x83, 0x3c, 0xf0, 0x81, 0x39, 0xb0, + 0xc3, 0x3b, 0x84, 0x03, 0x3d, 0xb0, 0x01, 0x18, 0xd0, 0x81, 0x1f, 0x80, + 0x81, 0x1f, 0xe8, 0x81, 0x1e, 0xb4, 0x43, 0x3a, 0xc0, 0xc3, 0x3c, 0xfc, + 0x02, 0x3d, 0xe4, 0x03, 0x3c, 0x94, 0x03, 0x0a, 0xc8, 0x4c, 0x62, 0x30, + 0x0e, 0xec, 0x10, 0x0e, 0xf3, 0x30, 0x0f, 0x6e, 0x40, 0x0b, 0xe5, 0x80, + 0x0f, 0xf4, 0x50, 0x0f, 0xf2, 0x50, 0x0e, 0x72, 0x40, 0x0a, 0x7c, 0x60, + 0x0f, 0xe5, 0x30, 0x0e, 0xf4, 0xf0, 0x0e, 0xf2, 0xc0, 0x07, 0xe6, 0xc0, + 0x0e, 0xef, 0x10, 0x0e, 0xf4, 0xc0, 0x06, 0x60, 0x40, 0x07, 0x7e, 0x00, + 0x06, 0x7e, 0x80, 0x84, 0x6a, 0xe9, 0xde, 0x24, 0x4d, 0x11, 0x25, 0x4c, + 0x3e, 0x0b, 0x30, 0xcf, 0x42, 0x44, 0xec, 0x04, 0x4c, 0x04, 0x0a, 0x08, + 0xe5, 0x74, 0x20, 0x00, 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, + 0x87, 0x36, 0x68, 0x87, 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, 0x0d, 0xaf, + 0x50, 0x0e, 0x6d, 0xd0, 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, + 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, + 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, + 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, + 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, + 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, + 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, + 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x43, + 0x9e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x86, 0x3c, 0x06, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x0c, 0x79, 0x10, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x18, 0xf2, 0x34, 0x40, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x30, 0xe4, 0x79, 0x80, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x60, 0xc8, 0x23, 0x01, 0x01, 0x30, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x16, 0x08, 0x00, 0x0f, 0x00, 0x00, + 0x00, 0x32, 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, + 0x47, 0xc6, 0x04, 0x43, 0x22, 0x25, 0x30, 0x02, 0x50, 0x0c, 0x45, 0x50, + 0x12, 0x65, 0x50, 0x1e, 0x54, 0x4a, 0xa2, 0x0c, 0x0a, 0x61, 0x04, 0xa0, + 0x08, 0x0a, 0x84, 0xf0, 0x0c, 0x00, 0xe9, 0x19, 0x00, 0xda, 0x63, 0x39, + 0x0c, 0x01, 0x00, 0x00, 0x70, 0x1c, 0x00, 0x10, 0x08, 0x04, 0x02, 0x00, + 0x00, 0x79, 0x18, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, + 0x90, 0x46, 0x02, 0x13, 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, 0x3b, 0x03, + 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, 0xb9, 0x01, + 0x41, 0xa1, 0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, 0x0a, 0x9a, + 0x2a, 0xfa, 0x9a, 0xb9, 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, 0x63, 0x4b, + 0xd9, 0x10, 0x04, 0x13, 0x04, 0xc2, 0x98, 0x20, 0x10, 0xc7, 0x06, 0x61, + 0x20, 0x26, 0x08, 0x04, 0xb2, 0x41, 0x18, 0x0c, 0x0a, 0x70, 0x73, 0x1b, + 0x06, 0xc4, 0x20, 0x26, 0x08, 0xd8, 0x44, 0x60, 0x82, 0x40, 0x24, 0x13, + 0x04, 0x42, 0xd9, 0x20, 0x10, 0xcd, 0x86, 0x84, 0x50, 0x16, 0x82, 0x18, + 0x18, 0xc2, 0xd9, 0x90, 0x0c, 0xca, 0x42, 0x0c, 0x03, 0x43, 0x38, 0x1b, + 0x84, 0x07, 0x9a, 0x20, 0x68, 0xd4, 0x06, 0x84, 0x90, 0x16, 0x82, 0x18, + 0x08, 0x60, 0x43, 0x30, 0x6d, 0x20, 0x22, 0x00, 0xa0, 0x26, 0x08, 0x5b, + 0xb5, 0x21, 0xb0, 0x26, 0x08, 0x02, 0x40, 0xa2, 0x2d, 0x2c, 0xcd, 0x8d, + 0xcb, 0x94, 0xd5, 0x17, 0xd4, 0xdb, 0x5c, 0x1a, 0x5d, 0xda, 0x9b, 0xdb, + 0x04, 0xa1, 0x68, 0x26, 0x08, 0x85, 0xb3, 0x21, 0x20, 0x26, 0x08, 0xc5, + 0x33, 0x41, 0x28, 0xa0, 0x0d, 0x0b, 0xa1, 0x6d, 0x5c, 0xe7, 0x0d, 0x1e, + 0xf1, 0x01, 0x44, 0xa8, 0x8a, 0xb0, 0x86, 0x9e, 0x9e, 0xa4, 0x88, 0x26, + 0x08, 0x45, 0x34, 0x41, 0x20, 0x96, 0x0d, 0xc2, 0x18, 0x8c, 0xc1, 0x86, + 0x65, 0x08, 0x83, 0xed, 0xeb, 0xc4, 0x60, 0x10, 0x83, 0xe1, 0x23, 0x03, + 0x16, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x13, 0x04, 0x82, 0xd9, 0x20, 0x8c, + 0xc1, 0x19, 0x6c, 0x58, 0x18, 0x33, 0xd8, 0xbe, 0x4e, 0x0c, 0x06, 0x8f, + 0xf9, 0xd0, 0x60, 0xc3, 0x00, 0x06, 0x65, 0x90, 0x06, 0x4c, 0xa6, 0xac, + 0xbe, 0xa8, 0xc2, 0xe4, 0xce, 0xca, 0xe8, 0x26, 0x08, 0x85, 0xb4, 0x61, + 0x21, 0xd6, 0x60, 0x63, 0x83, 0xee, 0x1b, 0x3c, 0xe2, 0x43, 0x83, 0x0d, + 0x41, 0x1b, 0x6c, 0x18, 0xd4, 0xc0, 0x0d, 0x80, 0x0d, 0x05, 0x96, 0xbd, + 0x41, 0x05, 0x54, 0x61, 0x63, 0xb3, 0x6b, 0x73, 0x49, 0x23, 0x2b, 0x73, + 0xa3, 0x9b, 0x12, 0x04, 0x55, 0xc8, 0xf0, 0x5c, 0xec, 0xca, 0xe4, 0xe6, + 0xd2, 0xde, 0xdc, 0xa6, 0x04, 0x44, 0x13, 0x32, 0x3c, 0x17, 0xbb, 0x30, + 0x36, 0xbb, 0x32, 0xb9, 0x29, 0x81, 0x51, 0x87, 0x0c, 0xcf, 0x65, 0x0e, + 0x2d, 0x8c, 0xac, 0x4c, 0xae, 0xe9, 0x8d, 0xac, 0x8c, 0x6d, 0x4a, 0x80, + 0x94, 0x21, 0xc3, 0x73, 0x91, 0x2b, 0x9b, 0x7b, 0xab, 0x93, 0x1b, 0x2b, + 0x9b, 0x9b, 0x12, 0x50, 0x75, 0xc8, 0xf0, 0x5c, 0xec, 0xd2, 0xca, 0xee, + 0x92, 0xc8, 0xa6, 0xe8, 0xc2, 0xe8, 0xca, 0xa6, 0x04, 0x56, 0x1d, 0x32, + 0x3c, 0x97, 0x32, 0x37, 0x3a, 0xb9, 0x3c, 0xa8, 0xb7, 0x34, 0x37, 0xba, + 0xb9, 0x29, 0xc1, 0x1b, 0x00, 0x79, 0x18, 0x00, 0x00, 0x4c, 0x00, 0x00, + 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, + 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, + 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, + 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, + 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, + 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, + 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, + 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, + 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, + 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, + 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, + 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, + 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, + 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, + 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, + 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, + 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, + 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, + 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, + 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, + 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, + 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, + 0xc4, 0x21, 0x07, 0x7c, 0x70, 0x03, 0x7a, 0x28, 0x87, 0x76, 0x80, 0x87, + 0x19, 0xd1, 0x43, 0x0e, 0xf8, 0xe0, 0x06, 0xe4, 0x20, 0x0e, 0xe7, 0xe0, + 0x06, 0xf6, 0x10, 0x0e, 0xf2, 0xc0, 0x0e, 0xe1, 0x90, 0x0f, 0xef, 0x50, + 0x0f, 0xf4, 0x00, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x15, 0x00, 0x00, + 0x00, 0x56, 0x20, 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x10, 0x11, 0xc0, 0x44, + 0x84, 0x40, 0x33, 0x2c, 0x84, 0x11, 0x38, 0xc3, 0xe5, 0x3b, 0x8f, 0x3f, + 0x38, 0xd3, 0xed, 0x17, 0xb7, 0x6d, 0x01, 0xd3, 0x70, 0xf9, 0xce, 0xe3, + 0x2f, 0x0e, 0x30, 0x88, 0xcd, 0x43, 0x4d, 0x7e, 0x71, 0xdb, 0x36, 0x00, + 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x04, 0x30, 0xcf, 0x42, 0xf8, 0xc5, 0x6d, + 0x9b, 0x40, 0x35, 0x5c, 0xbe, 0xf3, 0xf8, 0xd2, 0xe4, 0x44, 0x04, 0x4a, + 0x4d, 0x0f, 0x35, 0xf9, 0xc5, 0x6d, 0x1b, 0x00, 0xc1, 0x00, 0x48, 0x03, + 0x00, 0x61, 0x20, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, + 0x2c, 0x10, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x14, 0x47, 0x00, + 0xa8, 0x94, 0x00, 0x91, 0xc2, 0x2b, 0xb7, 0x92, 0x2b, 0x85, 0x42, 0x98, + 0x01, 0xa0, 0x31, 0x46, 0x00, 0xb3, 0xac, 0x0b, 0x82, 0xc1, 0x18, 0x81, + 0x18, 0xee, 0x30, 0xfc, 0x0b, 0x63, 0x04, 0x3a, 0x4a, 0xd3, 0xe5, 0x2f, + 0x8c, 0x11, 0xc8, 0x79, 0xaf, 0xfa, 0xdf, 0x18, 0x41, 0x48, 0x82, 0x21, + 0xee, 0x0b, 0x23, 0x00, 0x63, 0x04, 0x21, 0x09, 0x86, 0xf0, 0x2f, 0x8c, + 0x11, 0xbc, 0xb8, 0xa8, 0xe6, 0xdf, 0x0c, 0x00, 0x00, 0x23, 0x06, 0x09, + 0x00, 0x82, 0x60, 0x20, 0x89, 0x41, 0x73, 0x85, 0x41, 0x18, 0x44, 0x23, + 0x06, 0x09, 0x00, 0x82, 0x60, 0x20, 0x8d, 0x81, 0x83, 0x85, 0x41, 0x18, + 0x48, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x20, 0x91, 0xc1, 0xb3, 0x89, + 0x81, 0x18, 0x4c, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0xa4, 0x81, + 0x13, 0x06, 0x63, 0xa0, 0x35, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, + 0xa8, 0xc1, 0x23, 0x06, 0x64, 0x40, 0x39, 0x23, 0x06, 0x09, 0x00, 0x82, + 0x60, 0x60, 0xac, 0x01, 0x34, 0x06, 0x65, 0xb0, 0x3d, 0x23, 0x06, 0x09, + 0x00, 0x82, 0x60, 0x60, 0xb0, 0x41, 0x44, 0x06, 0x66, 0xf0, 0x41, 0x23, + 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0xb4, 0x81, 0x84, 0x06, 0x67, 0xe0, + 0x45, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0xb8, 0xc1, 0x94, 0x06, + 0x68, 0x80, 0x49, 0x23, 0x06, 0x0f, 0x00, 0x82, 0x60, 0xd0, 0xb4, 0x01, + 0x86, 0x1c, 0x42, 0xa0, 0x28, 0x69, 0x90, 0x06, 0x93, 0x32, 0x9a, 0x10, + 0x00, 0x23, 0x06, 0x0f, 0x00, 0x82, 0x60, 0xd0, 0xbc, 0x81, 0xb6, 0x24, + 0xc4, 0xc0, 0x30, 0x6b, 0xb0, 0x06, 0x15, 0x33, 0x9a, 0x10, 0x00, 0xa3, + 0x09, 0x42, 0x60, 0xc4, 0x04, 0x1f, 0x1b, 0x24, 0xf8, 0xd8, 0x30, 0xc1, + 0x67, 0xc4, 0x60, 0x01, 0x40, 0x10, 0x0c, 0x1e, 0x3a, 0xf8, 0x06, 0x21, + 0x98, 0xaa, 0x6b, 0xc4, 0x60, 0x01, 0x40, 0x10, 0x0c, 0x9e, 0x3a, 0x00, + 0x03, 0x62, 0x10, 0xa8, 0x4c, 0x1b, 0x31, 0x58, 0x00, 0x10, 0x04, 0x83, + 0xc7, 0x0e, 0xc2, 0xa0, 0x20, 0x86, 0x8a, 0xbb, 0x6c, 0x88, 0xe4, 0x63, + 0x43, 0x24, 0x1f, 0x1b, 0x22, 0xf9, 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, + 0x01, 0xc2, 0x07, 0x63, 0x70, 0x07, 0x77, 0xe0, 0x06, 0xc3, 0x88, 0x41, + 0x02, 0x80, 0x20, 0x18, 0x20, 0x7c, 0x30, 0x06, 0x77, 0x70, 0x07, 0x67, + 0x20, 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, 0x01, 0xc2, 0x07, 0x63, 0x70, + 0x07, 0x77, 0xd0, 0x06, 0xc1, 0x88, 0x41, 0x02, 0x80, 0x20, 0x18, 0x20, + 0x7c, 0x30, 0x06, 0x77, 0x70, 0x07, 0x70, 0x10, 0x21, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +/* The yuv-rendering pixel shader: + + --- D3D12_PixelShader_NV21_JPEG.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureUV : register(t1); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + #define NVRS \ + "RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \ + " DENY_DOMAIN_SHADER_ROOT_ACCESS |" \ + " DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \ + " DENY_HULL_SHADER_ROOT_ACCESS )," \ + "RootConstants(num32BitConstants=32, b0),"\ + "DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )" + + [RootSignature(NVRS)] + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {0.0, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.0000, 0.0000, 1.4020}; + const float3 Gcoeff = {1.0000, -0.3441, -0.7141}; + const float3 Bcoeff = {1.0000, 1.7720, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ + +static unsigned char D3D12_PixelShader_NV21_JPEG[] = { + 0x44, 0x58, 0x42, 0x43, 0xcf, 0xc7, 0x5e, 0x20, 0x3e, 0x0d, 0xdf, 0x60, + 0x41, 0xdf, 0xe0, 0xb4, 0x61, 0xb5, 0x7b, 0x53, 0x01, 0x00, 0x00, 0x00, + 0xe1, 0x12, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, + 0x50, 0x00, 0x00, 0x00, 0xdb, 0x00, 0x00, 0x00, 0x15, 0x01, 0x00, 0x00, + 0x0d, 0x02, 0x00, 0x00, 0xc9, 0x02, 0x00, 0x00, 0x1d, 0x0b, 0x00, 0x00, + 0x39, 0x0b, 0x00, 0x00, 0x53, 0x46, 0x49, 0x30, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x31, + 0x83, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x53, 0x56, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, + 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x43, 0x4f, 0x4c, + 0x4f, 0x52, 0x00, 0x4f, 0x53, 0x47, 0x31, 0x32, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x00, 0x50, 0x53, 0x56, 0x30, 0xf0, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, + 0xff, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01, 0x00, 0x03, 0x01, 0x00, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x43, + 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x44, 0x03, 0x03, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x42, 0x00, 0x03, 0x02, 0x00, + 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x44, + 0x00, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x44, 0x10, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x52, 0x54, 0x53, + 0x30, 0xb4, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, + 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, + 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, + 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, + 0x00, 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, + 0xff, 0x01, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, + 0x00, 0x9c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xff, 0xff, 0x53, 0x54, 0x41, 0x54, 0x4c, 0x08, 0x00, + 0x00, 0x60, 0x00, 0x00, 0x00, 0x13, 0x02, 0x00, 0x00, 0x44, 0x58, 0x49, + 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x34, 0x08, 0x00, + 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0x0a, 0x02, 0x00, + 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, + 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, + 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, + 0x62, 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, + 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x52, 0x88, 0x48, 0x90, 0x14, + 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, + 0x90, 0x91, 0x22, 0xc4, 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, + 0x8a, 0x04, 0x29, 0x46, 0x06, 0x51, 0x18, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, 0x02, 0xa8, + 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x20, 0x6d, 0x30, 0x86, + 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x09, 0xa8, 0x00, 0x49, 0x18, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, 0x4c, 0x08, + 0x06, 0x00, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x4b, 0x00, 0x00, + 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, + 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, + 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x78, 0x33, 0x00, 0xc3, 0x08, 0x04, + 0x30, 0x47, 0x00, 0x06, 0x33, 0xb5, 0xc1, 0x38, 0xb0, 0x43, 0x38, 0xcc, + 0xc3, 0x3c, 0xb8, 0x01, 0x2d, 0x94, 0x03, 0x3e, 0xd0, 0x43, 0x3d, 0xc8, + 0x43, 0x39, 0xc8, 0x01, 0x29, 0xf0, 0x81, 0x3d, 0x94, 0xc3, 0x38, 0xd0, + 0xc3, 0x3b, 0xc8, 0x03, 0x1f, 0x98, 0x03, 0x3b, 0xbc, 0x43, 0x38, 0xd0, + 0x03, 0x1b, 0x80, 0x01, 0x1d, 0xf8, 0x01, 0x18, 0xf8, 0x81, 0x1e, 0xe8, + 0x41, 0x3b, 0xa4, 0x03, 0x3c, 0xcc, 0xc3, 0x2f, 0xd0, 0x43, 0x3e, 0xc0, + 0x43, 0x39, 0xa0, 0x40, 0xcc, 0x24, 0x06, 0xe3, 0xc0, 0x0e, 0xe1, 0x30, + 0x0f, 0xf3, 0xe0, 0x06, 0xb4, 0x50, 0x0e, 0xf8, 0x40, 0x0f, 0xf5, 0x20, + 0x0f, 0xe5, 0x20, 0x07, 0xa4, 0xc0, 0x07, 0xf6, 0x50, 0x0e, 0xe3, 0x40, + 0x0f, 0xef, 0x20, 0x0f, 0x7c, 0x60, 0x0e, 0xec, 0xf0, 0x0e, 0xe1, 0x40, + 0x0f, 0x6c, 0x00, 0x06, 0x74, 0xe0, 0x07, 0x60, 0xe0, 0x07, 0x48, 0x08, + 0x83, 0xc8, 0x4d, 0xd2, 0x14, 0x51, 0xc2, 0xe4, 0xb3, 0x00, 0xf3, 0x2c, + 0x44, 0xc4, 0x4e, 0xc0, 0x44, 0xa0, 0x40, 0x90, 0x19, 0x01, 0x28, 0x01, + 0xa2, 0x34, 0x47, 0x80, 0x14, 0x03, 0x08, 0x21, 0x96, 0x20, 0x56, 0x0c, + 0x24, 0x84, 0x58, 0x80, 0xdc, 0x4d, 0xc3, 0xe5, 0x4f, 0xd8, 0x43, 0x48, + 0xfe, 0x4a, 0x48, 0x2b, 0x31, 0xf9, 0xc5, 0x6d, 0xa3, 0x02, 0x00, 0x00, + 0x04, 0xad, 0x7b, 0x86, 0xcb, 0x9f, 0xb0, 0x87, 0x90, 0xfc, 0x10, 0x68, + 0x86, 0x85, 0x40, 0x41, 0x2c, 0x0c, 0x14, 0x52, 0x02, 0x00, 0x80, 0x10, + 0x02, 0xd0, 0x2c, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0xd5, 0x39, 0x82, + 0xa0, 0x18, 0x52, 0x2c, 0x21, 0x2e, 0xe1, 0x81, 0x80, 0x61, 0x04, 0x01, + 0xb8, 0x4b, 0x9a, 0x22, 0x4a, 0x98, 0xfc, 0x14, 0xb9, 0x88, 0x85, 0x3d, + 0x80, 0x81, 0x88, 0xc4, 0xe6, 0xa1, 0x26, 0x34, 0x84, 0x1d, 0xd2, 0x41, + 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, + 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, + 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, + 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x3a, 0x0f, 0x64, 0x90, 0x21, + 0x23, 0x45, 0x44, 0x00, 0x72, 0x00, 0xc0, 0xe4, 0x00, 0x80, 0xe9, 0x01, + 0x00, 0x0f, 0x79, 0x12, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x18, 0xf2, 0x30, 0x40, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x30, 0xe4, 0x71, 0x80, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x60, 0xc8, 0x33, 0x01, 0x01, 0x30, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x90, 0xa7, 0x02, 0x02, 0x20, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x21, 0x0f, 0x06, 0x04, 0xc0, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x59, 0x20, 0x00, 0x00, + 0x00, 0x16, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x18, 0x19, 0x11, 0x4c, + 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x5a, 0x05, 0x42, 0xa2, + 0x04, 0x46, 0x00, 0x8a, 0xa1, 0x08, 0x4a, 0xa2, 0x50, 0xca, 0xa0, 0x1c, + 0x0a, 0xa4, 0x10, 0x4a, 0xa1, 0xc0, 0x0a, 0xa8, 0x3c, 0x0a, 0xa2, 0x6c, + 0x68, 0x15, 0xc1, 0x08, 0x40, 0x21, 0x94, 0x41, 0x49, 0xd0, 0x99, 0x01, + 0xa0, 0x32, 0x03, 0x40, 0x64, 0x06, 0x80, 0xc6, 0x0c, 0x00, 0x85, 0x19, + 0x00, 0xe2, 0x33, 0x00, 0xd4, 0xc7, 0x72, 0x18, 0x02, 0x00, 0x00, 0xe0, + 0x38, 0x00, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, + 0x00, 0xbf, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, + 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b, 0x93, 0x9b, + 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1, 0x0b, 0x3b, + 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, 0x0a, 0x9a, 0x2a, 0xfa, 0x9a, 0xb9, + 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, 0x63, 0x4b, 0xd9, 0x10, 0x04, 0x13, + 0x04, 0x41, 0x99, 0x20, 0x08, 0xcb, 0x06, 0x61, 0x20, 0x36, 0x08, 0x04, + 0x41, 0x01, 0x6e, 0x6e, 0x82, 0x20, 0x30, 0x1b, 0x86, 0x03, 0x21, 0x26, + 0x08, 0x05, 0x18, 0x70, 0xa1, 0x43, 0x2b, 0xa3, 0x2a, 0xc3, 0xa3, 0xab, + 0x93, 0x2b, 0xcb, 0x9a, 0x20, 0x08, 0xcd, 0x04, 0x41, 0x70, 0x36, 0x08, + 0x44, 0xb3, 0x21, 0x21, 0x94, 0x85, 0x20, 0x06, 0x86, 0x70, 0xc8, 0xd0, + 0xa1, 0x95, 0x51, 0x95, 0xe1, 0xd1, 0xd5, 0xc9, 0x95, 0x55, 0x59, 0x6d, + 0x48, 0x06, 0x05, 0x22, 0x86, 0x81, 0x21, 0x9c, 0x0d, 0xc2, 0x13, 0x4d, + 0x10, 0x8e, 0x8f, 0x0a, 0x1d, 0x5a, 0xd9, 0x54, 0x58, 0x1b, 0x1c, 0x5b, + 0x99, 0xdc, 0x06, 0x84, 0x98, 0x28, 0x82, 0x18, 0x08, 0x60, 0x43, 0x50, + 0x6d, 0x20, 0x24, 0x00, 0xb0, 0x26, 0x08, 0x44, 0x18, 0x4c, 0x10, 0x84, + 0x87, 0x01, 0xda, 0x04, 0x41, 0x80, 0x26, 0x08, 0x42, 0xb4, 0xc1, 0x40, + 0xb4, 0x8d, 0xe0, 0x1a, 0x12, 0x6d, 0x69, 0x70, 0x73, 0x13, 0x04, 0x41, + 0xda, 0x40, 0x20, 0xde, 0xf6, 0x4d, 0x10, 0x82, 0x31, 0xd8, 0x20, 0x10, + 0x61, 0xb0, 0x21, 0x10, 0x83, 0x0d, 0x02, 0x31, 0x06, 0x1b, 0x88, 0xac, + 0x03, 0x03, 0x32, 0x98, 0x20, 0x0c, 0x62, 0x30, 0x41, 0x10, 0x26, 0x1a, + 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x13, 0x04, 0x81, 0xda, 0x60, 0x20, + 0x68, 0xb0, 0x11, 0x5c, 0x1a, 0x6c, 0x10, 0xce, 0x40, 0x0d, 0x26, 0x08, + 0x1c, 0x19, 0x4c, 0x10, 0x84, 0x8a, 0x03, 0xdc, 0xdb, 0x1c, 0x97, 0x29, + 0xab, 0x2f, 0xa8, 0xa7, 0xa9, 0x24, 0xaa, 0xa4, 0x27, 0xa7, 0x0d, 0x08, + 0xe2, 0x06, 0x1b, 0x71, 0x06, 0x6f, 0xc0, 0x35, 0x1c, 0xe8, 0xca, 0xf0, + 0x98, 0x50, 0x15, 0x61, 0x0d, 0x3d, 0x3d, 0x49, 0x11, 0xc1, 0x6c, 0x40, + 0x90, 0x38, 0xd8, 0xbe, 0x33, 0x90, 0x03, 0xae, 0x61, 0x31, 0xf6, 0xc6, + 0xf6, 0x26, 0x37, 0x41, 0x10, 0x2c, 0x1a, 0x43, 0x4f, 0x4c, 0x4f, 0x52, + 0x30, 0x1b, 0x10, 0x84, 0x0e, 0xb6, 0x3a, 0x38, 0x03, 0x3b, 0xe0, 0x9a, + 0x0d, 0x44, 0x1b, 0xc0, 0xc1, 0x1c, 0xdc, 0xc1, 0x86, 0x83, 0xc0, 0xca, + 0xc0, 0x0c, 0xd6, 0x80, 0x0d, 0xf0, 0x60, 0x82, 0xa0, 0x0c, 0x1b, 0x80, + 0x0d, 0x03, 0xb1, 0x07, 0x7b, 0xb0, 0x21, 0xe0, 0x83, 0x0d, 0xc3, 0xa0, + 0x07, 0x7d, 0x30, 0x41, 0xe8, 0xca, 0x60, 0x43, 0xf0, 0x07, 0x24, 0xda, + 0xc2, 0xd2, 0xdc, 0xb8, 0x4c, 0x59, 0x7d, 0x41, 0xbd, 0xcd, 0xa5, 0xd1, + 0xa5, 0xbd, 0xb9, 0x4d, 0x10, 0x16, 0x6f, 0x82, 0xb0, 0x74, 0x1b, 0x02, + 0x62, 0x82, 0xb0, 0x70, 0x13, 0x84, 0x65, 0xdb, 0xb0, 0x10, 0xa2, 0x30, + 0x0a, 0xa4, 0x50, 0x0a, 0xa6, 0x30, 0x98, 0x02, 0x71, 0x0a, 0x00, 0x11, + 0xaa, 0x22, 0xac, 0xa1, 0xa7, 0x27, 0x29, 0xa2, 0x09, 0xc2, 0xa2, 0x6d, + 0x10, 0xb6, 0x6d, 0xc3, 0x32, 0xa4, 0xc2, 0x28, 0x9c, 0x42, 0x29, 0xa8, + 0xc2, 0xa0, 0x0a, 0xc3, 0x29, 0xac, 0x02, 0x8b, 0xa1, 0x27, 0xa6, 0x27, + 0xa9, 0x09, 0x82, 0x70, 0x6d, 0x10, 0x36, 0x57, 0xd8, 0xb0, 0x30, 0xad, + 0x30, 0x0a, 0xa7, 0x50, 0x0a, 0xaa, 0x30, 0x98, 0x02, 0x73, 0x0a, 0xaf, + 0xb0, 0x61, 0x40, 0x05, 0x56, 0x80, 0x05, 0x26, 0x53, 0x56, 0x5f, 0x54, + 0x61, 0x72, 0x67, 0x65, 0x74, 0x13, 0x84, 0x25, 0xd9, 0xb0, 0x10, 0xb2, + 0x30, 0x0a, 0xb3, 0x50, 0x0a, 0xa7, 0x30, 0x98, 0x02, 0x71, 0x0a, 0xaf, + 0xb0, 0x21, 0xa0, 0x85, 0x0d, 0x43, 0x2c, 0xd4, 0x02, 0xb0, 0xa1, 0xd0, + 0x83, 0x50, 0xb0, 0x85, 0x0b, 0xa0, 0x61, 0xc6, 0xf6, 0x16, 0x46, 0x37, + 0x37, 0x41, 0x10, 0x30, 0x16, 0x69, 0x6e, 0x73, 0x74, 0x73, 0x13, 0x04, + 0x21, 0xa3, 0x31, 0x97, 0x76, 0xf6, 0xc5, 0x46, 0x46, 0x63, 0x2e, 0xed, + 0xec, 0x6b, 0x8e, 0x8e, 0x08, 0x5d, 0x19, 0xde, 0x97, 0xdb, 0x9b, 0x5c, + 0xdb, 0x06, 0x05, 0x17, 0x72, 0x41, 0x17, 0x76, 0x81, 0x17, 0x90, 0x5e, + 0x38, 0x03, 0x5f, 0x60, 0xaa, 0xb0, 0xb1, 0xd9, 0xb5, 0xb9, 0xa4, 0x91, + 0x95, 0xb9, 0xd1, 0x4d, 0x09, 0x82, 0x2a, 0x64, 0x78, 0x2e, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x02, 0xa2, 0x09, 0x19, 0x9e, 0x8b, + 0x5d, 0x18, 0x9b, 0x5d, 0x99, 0xdc, 0x94, 0xa0, 0xa8, 0x43, 0x86, 0xe7, + 0x32, 0x87, 0x16, 0x46, 0x56, 0x26, 0xd7, 0xf4, 0x46, 0x56, 0xc6, 0x36, + 0x25, 0x40, 0xca, 0x90, 0xe1, 0xb9, 0xc8, 0x95, 0xcd, 0xbd, 0xd5, 0xc9, + 0x8d, 0x95, 0xcd, 0x4d, 0x09, 0xac, 0x4a, 0x64, 0x78, 0x2e, 0x74, 0x79, + 0x70, 0x65, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x53, 0x04, 0x3c, 0xe8, 0x83, 0x3a, 0x64, 0x78, 0x2e, 0x76, 0x69, + 0x65, 0x77, 0x49, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x82, 0x3f, + 0xa8, 0x43, 0x86, 0xe7, 0x52, 0xe6, 0x46, 0x27, 0x97, 0x07, 0xf5, 0x96, + 0xe6, 0x46, 0x37, 0x37, 0x25, 0xb0, 0x85, 0x2e, 0x64, 0x78, 0x2e, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x53, 0x02, 0x5f, 0x00, 0x00, + 0x00, 0x79, 0x18, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, + 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, + 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, + 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, + 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, + 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, + 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, + 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, + 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, + 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, + 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, + 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, + 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, + 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, + 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, + 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, + 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, + 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, + 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, + 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, + 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, + 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, + 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc4, 0x21, 0x07, 0x7c, + 0x70, 0x03, 0x7a, 0x28, 0x87, 0x76, 0x80, 0x87, 0x19, 0xd1, 0x43, 0x0e, + 0xf8, 0xe0, 0x06, 0xe4, 0x20, 0x0e, 0xe7, 0xe0, 0x06, 0xf6, 0x10, 0x0e, + 0xf2, 0xc0, 0x0e, 0xe1, 0x90, 0x0f, 0xef, 0x50, 0x0f, 0xf4, 0x00, 0x00, + 0x00, 0x71, 0x20, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x25, 0xf0, 0x05, + 0x7e, 0x74, 0x74, 0x79, 0x1a, 0x6e, 0xc3, 0xd9, 0x65, 0x39, 0x10, 0x38, + 0xab, 0x4e, 0xc3, 0x6d, 0x38, 0xbb, 0x2c, 0x9f, 0xd2, 0xc3, 0xf4, 0x32, + 0x10, 0x18, 0xac, 0x80, 0x38, 0x08, 0xfc, 0xe8, 0xe8, 0x32, 0xb5, 0x8c, + 0xa7, 0xd7, 0xe5, 0xe5, 0xaa, 0x15, 0x08, 0x9c, 0x59, 0x7f, 0x24, 0x6a, + 0x19, 0x4f, 0xaf, 0xcb, 0xcb, 0x32, 0x22, 0xd0, 0xfa, 0x23, 0xd9, 0xcb, + 0x63, 0xfa, 0x5b, 0x0e, 0x6c, 0x92, 0x60, 0x33, 0x20, 0x10, 0x08, 0x0c, + 0x16, 0x00, 0x1c, 0x04, 0x7e, 0x74, 0x74, 0x99, 0x5a, 0xc6, 0xd3, 0xeb, + 0xf2, 0x72, 0x16, 0x08, 0x9c, 0x59, 0x7f, 0x24, 0x6a, 0x19, 0x4f, 0xaf, + 0xcb, 0xcb, 0x32, 0x22, 0xd0, 0xfa, 0x23, 0xd9, 0xcb, 0x63, 0xfa, 0x5b, + 0x0e, 0x6c, 0x92, 0x60, 0x33, 0x20, 0x10, 0x08, 0x0c, 0x1a, 0x82, 0x34, + 0x5c, 0xbe, 0xf3, 0xf8, 0x42, 0x44, 0x00, 0x13, 0x11, 0x02, 0xcd, 0xb0, + 0x10, 0x76, 0xe0, 0x0c, 0x97, 0xef, 0x3c, 0xfe, 0xe0, 0x4c, 0xb7, 0x5f, + 0xdc, 0xb6, 0x11, 0x4c, 0xc3, 0xe5, 0x3b, 0x8f, 0xbf, 0x38, 0xc0, 0x20, + 0x36, 0x0f, 0x35, 0xf9, 0xc5, 0x6d, 0x9b, 0x01, 0x34, 0x5c, 0xbe, 0xf3, + 0xf8, 0x12, 0xc0, 0x3c, 0x0b, 0xe1, 0x17, 0xb7, 0x6d, 0x05, 0xd5, 0x70, + 0xf9, 0xce, 0xe3, 0x4b, 0x93, 0x13, 0x11, 0x28, 0x35, 0x3d, 0xd4, 0xe4, + 0x17, 0xb7, 0x6d, 0x03, 0x04, 0x03, 0x20, 0x0d, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x48, 0x41, 0x53, 0x48, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x3d, 0xf1, 0x38, 0x49, 0x7f, 0x91, 0x6b, 0xbb, 0x2e, 0x0c, 0x31, + 0x06, 0xa9, 0xa3, 0xcd, 0x81, 0x44, 0x58, 0x49, 0x4c, 0xa0, 0x07, 0x00, + 0x00, 0x60, 0x00, 0x00, 0x00, 0xe8, 0x01, 0x00, 0x00, 0x44, 0x58, 0x49, + 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x88, 0x07, 0x00, + 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0xdf, 0x01, 0x00, + 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, + 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, + 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, + 0x62, 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, + 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x52, 0x88, 0x48, 0x90, 0x14, + 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, + 0x90, 0x91, 0x22, 0xc4, 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, + 0x8a, 0x04, 0x29, 0x46, 0x06, 0x51, 0x18, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, 0x02, 0xa8, + 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x20, 0x6d, 0x30, 0x86, + 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x09, 0xa8, 0x00, 0x49, 0x18, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, 0x4c, 0x08, + 0x06, 0x00, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x45, 0x00, 0x00, + 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, + 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, + 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x70, 0x23, 0x00, 0x25, 0x00, 0x14, + 0x66, 0x00, 0xe6, 0x08, 0xc0, 0x60, 0x8e, 0x00, 0x29, 0xc6, 0x20, 0x84, + 0x14, 0x42, 0xa6, 0x18, 0x80, 0x10, 0x52, 0x06, 0xa1, 0x9b, 0x86, 0xcb, + 0x9f, 0xb0, 0x87, 0x90, 0xfc, 0x95, 0x90, 0x56, 0x62, 0xf2, 0x8b, 0xdb, + 0x46, 0xc5, 0x18, 0x63, 0x10, 0x2a, 0xf7, 0x0c, 0x97, 0x3f, 0x61, 0x0f, + 0x21, 0xf9, 0x21, 0xd0, 0x0c, 0x0b, 0x81, 0x82, 0x55, 0x18, 0x45, 0x18, + 0x1b, 0x63, 0x0c, 0x42, 0xc8, 0xa0, 0x56, 0x90, 0x41, 0xc6, 0x18, 0x63, + 0x0c, 0x7a, 0x73, 0x04, 0x41, 0x31, 0x18, 0x29, 0x84, 0x44, 0x92, 0x03, + 0x01, 0xc3, 0x08, 0xc4, 0x30, 0x53, 0x1b, 0x8c, 0x03, 0x3b, 0x84, 0xc3, + 0x3c, 0xcc, 0x83, 0x1b, 0xd0, 0x42, 0x39, 0xe0, 0x03, 0x3d, 0xd4, 0x83, + 0x3c, 0x94, 0x83, 0x1c, 0x90, 0x02, 0x1f, 0xd8, 0x43, 0x39, 0x8c, 0x03, + 0x3d, 0xbc, 0x83, 0x3c, 0xf0, 0x81, 0x39, 0xb0, 0xc3, 0x3b, 0x84, 0x03, + 0x3d, 0xb0, 0x01, 0x18, 0xd0, 0x81, 0x1f, 0x80, 0x81, 0x1f, 0xe8, 0x81, + 0x1e, 0xb4, 0x43, 0x3a, 0xc0, 0xc3, 0x3c, 0xfc, 0x02, 0x3d, 0xe4, 0x03, + 0x3c, 0x94, 0x03, 0x0a, 0xc8, 0x4c, 0x62, 0x30, 0x0e, 0xec, 0x10, 0x0e, + 0xf3, 0x30, 0x0f, 0x6e, 0x40, 0x0b, 0xe5, 0x80, 0x0f, 0xf4, 0x50, 0x0f, + 0xf2, 0x50, 0x0e, 0x72, 0x40, 0x0a, 0x7c, 0x60, 0x0f, 0xe5, 0x30, 0x0e, + 0xf4, 0xf0, 0x0e, 0xf2, 0xc0, 0x07, 0xe6, 0xc0, 0x0e, 0xef, 0x10, 0x0e, + 0xf4, 0xc0, 0x06, 0x60, 0x40, 0x07, 0x7e, 0x00, 0x06, 0x7e, 0x80, 0x84, + 0x6a, 0xe9, 0xde, 0x24, 0x4d, 0x11, 0x25, 0x4c, 0x3e, 0x0b, 0x30, 0xcf, + 0x42, 0x44, 0xec, 0x04, 0x4c, 0x04, 0x0a, 0x08, 0xe5, 0x74, 0x20, 0x00, + 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, + 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, + 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, + 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x43, 0x9e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x3c, 0x06, 0x10, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x79, 0x10, + 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xf2, + 0x34, 0x40, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, + 0xe4, 0x79, 0x80, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x60, 0xc8, 0x23, 0x01, 0x01, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x40, 0x16, 0x08, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, + 0x14, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, + 0x22, 0x25, 0x30, 0x02, 0x50, 0x0c, 0x45, 0x50, 0x12, 0x65, 0x50, 0x1e, + 0x54, 0x4a, 0xa2, 0x0c, 0x0a, 0x61, 0x04, 0xa0, 0x08, 0x0a, 0x84, 0xf0, + 0x0c, 0x00, 0xe9, 0x19, 0x00, 0xda, 0x63, 0x39, 0x0c, 0x01, 0x00, 0x00, + 0x70, 0x1c, 0x00, 0x10, 0x08, 0x04, 0x02, 0x00, 0x00, 0x79, 0x18, 0x00, + 0x00, 0x65, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, + 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b, 0x93, 0x9b, + 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1, 0x0b, 0x3b, + 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, 0x0a, 0x9a, 0x2a, 0xfa, 0x9a, 0xb9, + 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, 0x63, 0x4b, 0xd9, 0x10, 0x04, 0x13, + 0x04, 0xc2, 0x98, 0x20, 0x10, 0xc7, 0x06, 0x61, 0x20, 0x26, 0x08, 0x04, + 0xb2, 0x41, 0x18, 0x0c, 0x0a, 0x70, 0x73, 0x1b, 0x06, 0xc4, 0x20, 0x26, + 0x08, 0xd8, 0x44, 0x60, 0x82, 0x40, 0x24, 0x13, 0x04, 0x42, 0xd9, 0x20, + 0x10, 0xcd, 0x86, 0x84, 0x50, 0x16, 0x82, 0x18, 0x18, 0xc2, 0xd9, 0x90, + 0x0c, 0xca, 0x42, 0x0c, 0x03, 0x43, 0x38, 0x1b, 0x84, 0x07, 0x9a, 0x20, + 0x68, 0xd4, 0x06, 0x84, 0x90, 0x16, 0x82, 0x18, 0x08, 0x60, 0x43, 0x30, + 0x6d, 0x20, 0x22, 0x00, 0xa0, 0x26, 0x08, 0x5b, 0xb5, 0x21, 0xb0, 0x26, + 0x08, 0x02, 0x40, 0xa2, 0x2d, 0x2c, 0xcd, 0x8d, 0xcb, 0x94, 0xd5, 0x17, + 0xd4, 0xdb, 0x5c, 0x1a, 0x5d, 0xda, 0x9b, 0xdb, 0x04, 0xa1, 0x68, 0x26, + 0x08, 0x85, 0xb3, 0x21, 0x20, 0x26, 0x08, 0xc5, 0x33, 0x41, 0x28, 0xa0, + 0x0d, 0x0b, 0xa1, 0x6d, 0x5c, 0xe7, 0x0d, 0x1e, 0xf1, 0x01, 0x44, 0xa8, + 0x8a, 0xb0, 0x86, 0x9e, 0x9e, 0xa4, 0x88, 0x26, 0x08, 0x45, 0x34, 0x41, + 0x20, 0x96, 0x0d, 0xc2, 0x18, 0x8c, 0xc1, 0x86, 0x65, 0x08, 0x83, 0xed, + 0xeb, 0xc4, 0x60, 0x10, 0x83, 0xe1, 0x23, 0x03, 0x16, 0x43, 0x4f, 0x4c, + 0x4f, 0x52, 0x13, 0x04, 0x82, 0xd9, 0x20, 0x8c, 0xc1, 0x19, 0x6c, 0x58, + 0x18, 0x33, 0xd8, 0xbe, 0x4e, 0x0c, 0x06, 0x8f, 0xf9, 0xd0, 0x60, 0xc3, + 0x00, 0x06, 0x65, 0x90, 0x06, 0x4c, 0xa6, 0xac, 0xbe, 0xa8, 0xc2, 0xe4, + 0xce, 0xca, 0xe8, 0x26, 0x08, 0x85, 0xb4, 0x61, 0x21, 0xd6, 0x60, 0x63, + 0x83, 0xee, 0x1b, 0x3c, 0xe2, 0x43, 0x83, 0x0d, 0x41, 0x1b, 0x6c, 0x18, + 0xd4, 0xc0, 0x0d, 0x80, 0x0d, 0x05, 0x96, 0xbd, 0x41, 0x05, 0x54, 0x61, + 0x63, 0xb3, 0x6b, 0x73, 0x49, 0x23, 0x2b, 0x73, 0xa3, 0x9b, 0x12, 0x04, + 0x55, 0xc8, 0xf0, 0x5c, 0xec, 0xca, 0xe4, 0xe6, 0xd2, 0xde, 0xdc, 0xa6, + 0x04, 0x44, 0x13, 0x32, 0x3c, 0x17, 0xbb, 0x30, 0x36, 0xbb, 0x32, 0xb9, + 0x29, 0x81, 0x51, 0x87, 0x0c, 0xcf, 0x65, 0x0e, 0x2d, 0x8c, 0xac, 0x4c, + 0xae, 0xe9, 0x8d, 0xac, 0x8c, 0x6d, 0x4a, 0x80, 0x94, 0x21, 0xc3, 0x73, + 0x91, 0x2b, 0x9b, 0x7b, 0xab, 0x93, 0x1b, 0x2b, 0x9b, 0x9b, 0x12, 0x50, + 0x75, 0xc8, 0xf0, 0x5c, 0xec, 0xd2, 0xca, 0xee, 0x92, 0xc8, 0xa6, 0xe8, + 0xc2, 0xe8, 0xca, 0xa6, 0x04, 0x56, 0x1d, 0x32, 0x3c, 0x97, 0x32, 0x37, + 0x3a, 0xb9, 0x3c, 0xa8, 0xb7, 0x34, 0x37, 0xba, 0xb9, 0x29, 0xc1, 0x1b, + 0x00, 0x79, 0x18, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, + 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, + 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, + 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, + 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, + 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, + 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, + 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, + 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, + 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, + 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, + 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, + 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, + 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, + 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, + 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, + 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, + 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, + 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, + 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, + 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, + 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, + 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc4, 0x21, 0x07, 0x7c, + 0x70, 0x03, 0x7a, 0x28, 0x87, 0x76, 0x80, 0x87, 0x19, 0xd1, 0x43, 0x0e, + 0xf8, 0xe0, 0x06, 0xe4, 0x20, 0x0e, 0xe7, 0xe0, 0x06, 0xf6, 0x10, 0x0e, + 0xf2, 0xc0, 0x0e, 0xe1, 0x90, 0x0f, 0xef, 0x50, 0x0f, 0xf4, 0x00, 0x00, + 0x00, 0x71, 0x20, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x56, 0x20, 0x0d, + 0x97, 0xef, 0x3c, 0xbe, 0x10, 0x11, 0xc0, 0x44, 0x84, 0x40, 0x33, 0x2c, + 0x84, 0x11, 0x38, 0xc3, 0xe5, 0x3b, 0x8f, 0x3f, 0x38, 0xd3, 0xed, 0x17, + 0xb7, 0x6d, 0x01, 0xd3, 0x70, 0xf9, 0xce, 0xe3, 0x2f, 0x0e, 0x30, 0x88, + 0xcd, 0x43, 0x4d, 0x7e, 0x71, 0xdb, 0x36, 0x00, 0x0d, 0x97, 0xef, 0x3c, + 0xbe, 0x04, 0x30, 0xcf, 0x42, 0xf8, 0xc5, 0x6d, 0x9b, 0x40, 0x35, 0x5c, + 0xbe, 0xf3, 0xf8, 0xd2, 0xe4, 0x44, 0x04, 0x4a, 0x4d, 0x0f, 0x35, 0xf9, + 0xc5, 0x6d, 0x1b, 0x00, 0xc1, 0x00, 0x48, 0x03, 0x00, 0x61, 0x20, 0x00, + 0x00, 0x5d, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, 0x10, 0x00, 0x00, + 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x47, 0x00, 0xa8, 0x94, 0x00, 0x91, + 0xc2, 0x2b, 0xb7, 0x92, 0x2b, 0x85, 0x42, 0x98, 0x01, 0xa0, 0x31, 0x46, + 0x50, 0x9e, 0x74, 0xe9, 0x7f, 0x63, 0x04, 0xa2, 0x3e, 0xb7, 0xf3, 0x2f, + 0x8c, 0x11, 0x80, 0xef, 0x0a, 0xae, 0xbf, 0x30, 0x46, 0xc0, 0x97, 0xbd, + 0xb9, 0x7f, 0x23, 0x00, 0x63, 0x04, 0x21, 0x09, 0x86, 0xf0, 0x2f, 0x8c, + 0x11, 0x80, 0x20, 0x08, 0xe2, 0xdf, 0x0c, 0x00, 0x00, 0x23, 0x06, 0x09, + 0x00, 0x82, 0x60, 0x20, 0x85, 0x01, 0x63, 0x81, 0x01, 0x18, 0x40, 0x23, + 0x06, 0x09, 0x00, 0x82, 0x60, 0x20, 0x89, 0x41, 0x73, 0x81, 0x01, 0x18, + 0x44, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x20, 0x8d, 0x81, 0xa3, 0x85, + 0x41, 0x18, 0x48, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0xa0, 0x41, + 0x03, 0x06, 0x62, 0x90, 0x31, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, + 0xa4, 0x81, 0x13, 0x06, 0x63, 0x30, 0x35, 0x23, 0x06, 0x09, 0x00, 0x82, + 0x60, 0x60, 0xa8, 0xc1, 0x23, 0x06, 0x64, 0xa0, 0x39, 0x23, 0x06, 0x09, + 0x00, 0x82, 0x60, 0x60, 0xac, 0x01, 0x34, 0x06, 0x65, 0xe0, 0x3d, 0x23, + 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0xb0, 0x41, 0x74, 0x06, 0x66, 0xd0, + 0x41, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0xb4, 0x81, 0x84, 0x06, + 0x67, 0x70, 0x45, 0x23, 0x06, 0x0f, 0x00, 0x82, 0x60, 0xd0, 0xb0, 0xc1, + 0x85, 0x1c, 0x42, 0xa0, 0x28, 0x68, 0x80, 0x06, 0x92, 0x32, 0x9a, 0x10, + 0x00, 0x23, 0x06, 0x0f, 0x00, 0x82, 0x60, 0xd0, 0xb8, 0x41, 0xb6, 0x24, + 0xc4, 0xc0, 0x30, 0x6a, 0xa0, 0x06, 0x14, 0x33, 0x9a, 0x10, 0x00, 0xa3, + 0x09, 0x42, 0x60, 0x41, 0x04, 0x1f, 0x1b, 0x24, 0xf8, 0x8c, 0x18, 0x2c, + 0x00, 0x08, 0x82, 0xc1, 0x23, 0x07, 0x9d, 0x21, 0x04, 0x12, 0x55, 0x8d, + 0x18, 0x2c, 0x00, 0x08, 0x82, 0xc1, 0x33, 0x07, 0xde, 0x31, 0x08, 0xd3, + 0x85, 0x8d, 0x18, 0x2c, 0x00, 0x08, 0x82, 0xc1, 0x43, 0x07, 0x1f, 0x42, + 0x0c, 0x94, 0x66, 0xd9, 0x00, 0xc9, 0xc7, 0x06, 0x48, 0x3e, 0x36, 0x40, + 0xf2, 0x19, 0x31, 0x48, 0x00, 0x10, 0x04, 0x03, 0x44, 0x0f, 0xc2, 0xa0, + 0x0e, 0xea, 0x80, 0x0d, 0x86, 0x11, 0x83, 0x04, 0x00, 0x41, 0x30, 0x40, + 0xf4, 0x20, 0x0c, 0xea, 0xa0, 0x0e, 0xca, 0x40, 0x18, 0x31, 0x48, 0x00, + 0x10, 0x04, 0x03, 0x44, 0x0f, 0xc2, 0xa0, 0x0e, 0xea, 0x60, 0x0d, 0x82, + 0x11, 0x83, 0x04, 0x00, 0x41, 0x30, 0x40, 0xf4, 0x20, 0x0c, 0xea, 0xa0, + 0x0e, 0xdc, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +/* The yuv-rendering pixel shader: + + --- D3D12_PixelShader_NV21_BT601.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureUV : register(t1); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + #define NVRS \ + "RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \ + " DENY_DOMAIN_SHADER_ROOT_ACCESS |" \ + " DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \ + " DENY_HULL_SHADER_ROOT_ACCESS )," \ + "RootConstants(num32BitConstants=32, b0),"\ + "DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )" + + [RootSignature(NVRS)] + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.5960}; + const float3 Gcoeff = {1.1644, -0.3918, -0.8130}; + const float3 Bcoeff = {1.1644, 2.0172, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ + +static unsigned char D3D12_PixelShader_NV21_BT601[] = { + 0x44, 0x58, 0x42, 0x43, 0x06, 0x29, 0xca, 0x47, 0x9e, 0x47, 0xed, 0x99, + 0xcf, 0xa5, 0xa6, 0xdb, 0x0b, 0x0d, 0xa5, 0x31, 0x01, 0x00, 0x00, 0x00, + 0xe9, 0x12, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, + 0x50, 0x00, 0x00, 0x00, 0xdb, 0x00, 0x00, 0x00, 0x15, 0x01, 0x00, 0x00, + 0x0d, 0x02, 0x00, 0x00, 0xc9, 0x02, 0x00, 0x00, 0x15, 0x0b, 0x00, 0x00, + 0x31, 0x0b, 0x00, 0x00, 0x53, 0x46, 0x49, 0x30, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x31, + 0x83, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x53, 0x56, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, + 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x43, 0x4f, 0x4c, + 0x4f, 0x52, 0x00, 0x4f, 0x53, 0x47, 0x31, 0x32, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x00, 0x50, 0x53, 0x56, 0x30, 0xf0, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, + 0xff, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01, 0x00, 0x03, 0x01, 0x00, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x43, + 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x44, 0x03, 0x03, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x42, 0x00, 0x03, 0x02, 0x00, + 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x44, + 0x00, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x44, 0x10, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x52, 0x54, 0x53, + 0x30, 0xb4, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, + 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, + 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, + 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, + 0x00, 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, + 0xff, 0x01, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, + 0x00, 0x9c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xff, 0xff, 0x53, 0x54, 0x41, 0x54, 0x44, 0x08, 0x00, + 0x00, 0x60, 0x00, 0x00, 0x00, 0x11, 0x02, 0x00, 0x00, 0x44, 0x58, 0x49, + 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x2c, 0x08, 0x00, + 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0x08, 0x02, 0x00, + 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, + 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, + 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, + 0x62, 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, + 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x52, 0x88, 0x48, 0x90, 0x14, + 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, + 0x90, 0x91, 0x22, 0xc4, 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, + 0x8a, 0x04, 0x29, 0x46, 0x06, 0x51, 0x18, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, 0x02, 0xa8, + 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x20, 0x6d, 0x30, 0x86, + 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x09, 0xa8, 0x00, 0x49, 0x18, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, 0x4c, 0x08, + 0x06, 0x00, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x4b, 0x00, 0x00, + 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, + 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, + 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x78, 0x33, 0x00, 0xc3, 0x08, 0x04, + 0x30, 0x47, 0x00, 0x06, 0x33, 0xb5, 0xc1, 0x38, 0xb0, 0x43, 0x38, 0xcc, + 0xc3, 0x3c, 0xb8, 0x01, 0x2d, 0x94, 0x03, 0x3e, 0xd0, 0x43, 0x3d, 0xc8, + 0x43, 0x39, 0xc8, 0x01, 0x29, 0xf0, 0x81, 0x3d, 0x94, 0xc3, 0x38, 0xd0, + 0xc3, 0x3b, 0xc8, 0x03, 0x1f, 0x98, 0x03, 0x3b, 0xbc, 0x43, 0x38, 0xd0, + 0x03, 0x1b, 0x80, 0x01, 0x1d, 0xf8, 0x01, 0x18, 0xf8, 0x81, 0x1e, 0xe8, + 0x41, 0x3b, 0xa4, 0x03, 0x3c, 0xcc, 0xc3, 0x2f, 0xd0, 0x43, 0x3e, 0xc0, + 0x43, 0x39, 0xa0, 0x40, 0xcc, 0x24, 0x06, 0xe3, 0xc0, 0x0e, 0xe1, 0x30, + 0x0f, 0xf3, 0xe0, 0x06, 0xb4, 0x50, 0x0e, 0xf8, 0x40, 0x0f, 0xf5, 0x20, + 0x0f, 0xe5, 0x20, 0x07, 0xa4, 0xc0, 0x07, 0xf6, 0x50, 0x0e, 0xe3, 0x40, + 0x0f, 0xef, 0x20, 0x0f, 0x7c, 0x60, 0x0e, 0xec, 0xf0, 0x0e, 0xe1, 0x40, + 0x0f, 0x6c, 0x00, 0x06, 0x74, 0xe0, 0x07, 0x60, 0xe0, 0x07, 0x48, 0x08, + 0x83, 0xc8, 0x4d, 0xd2, 0x14, 0x51, 0xc2, 0xe4, 0xb3, 0x00, 0xf3, 0x2c, + 0x44, 0xc4, 0x4e, 0xc0, 0x44, 0xa0, 0x40, 0x90, 0x19, 0x01, 0x28, 0x01, + 0xa2, 0x34, 0x47, 0x80, 0x14, 0x03, 0x08, 0x21, 0x96, 0x20, 0x56, 0x0c, + 0x24, 0x84, 0x58, 0x80, 0xdc, 0x4d, 0xc3, 0xe5, 0x4f, 0xd8, 0x43, 0x48, + 0xfe, 0x4a, 0x48, 0x2b, 0x31, 0xf9, 0xc5, 0x6d, 0xa3, 0x02, 0x00, 0x00, + 0x04, 0xad, 0x7b, 0x86, 0xcb, 0x9f, 0xb0, 0x87, 0x90, 0xfc, 0x10, 0x68, + 0x86, 0x85, 0x40, 0x41, 0x2c, 0x0c, 0x14, 0x52, 0x02, 0x00, 0x80, 0x10, + 0x02, 0xd0, 0x2c, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0xd5, 0x39, 0x82, + 0xa0, 0x18, 0x52, 0x2c, 0x21, 0x2e, 0xe1, 0x81, 0x80, 0x61, 0x04, 0x01, + 0xb8, 0x4b, 0x9a, 0x22, 0x4a, 0x98, 0xfc, 0x14, 0xb9, 0x88, 0x85, 0x3d, + 0x80, 0x81, 0x88, 0xc4, 0xe6, 0xa1, 0x26, 0x34, 0x84, 0x1d, 0xd2, 0x41, + 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, + 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, + 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, + 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x3a, 0x0f, 0x64, 0x90, 0x21, + 0x23, 0x45, 0x44, 0x00, 0x72, 0x00, 0xc0, 0xe4, 0x00, 0x80, 0xe9, 0x01, + 0x00, 0x0f, 0x79, 0x12, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x18, 0xf2, 0x30, 0x40, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x30, 0xe4, 0x71, 0x80, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x60, 0xc8, 0x33, 0x01, 0x01, 0x30, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x90, 0xa7, 0x02, 0x02, 0x20, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x21, 0x0f, 0x06, 0x04, 0xc0, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x59, 0x20, 0x00, 0x00, + 0x00, 0x15, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x18, 0x19, 0x11, 0x4c, + 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x5a, 0x05, 0x42, 0xa2, + 0x04, 0x46, 0x00, 0x8a, 0xa1, 0x08, 0x4a, 0xa2, 0x50, 0xca, 0xa0, 0x1c, + 0x0a, 0xa4, 0x10, 0x4a, 0xa1, 0xc0, 0x0a, 0xa8, 0x3c, 0x0a, 0x87, 0x56, + 0x11, 0x8c, 0x00, 0x14, 0x42, 0x19, 0x94, 0x04, 0x9d, 0x19, 0x00, 0x2a, + 0x33, 0x00, 0x44, 0x66, 0x00, 0x68, 0xcc, 0x00, 0x50, 0x98, 0x01, 0x20, + 0x3e, 0x03, 0x40, 0x7d, 0x2c, 0x87, 0x21, 0x00, 0x00, 0x00, 0x8e, 0x03, + 0x00, 0x02, 0x81, 0x40, 0x00, 0x79, 0x18, 0x00, 0x00, 0xbe, 0x00, 0x00, + 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, 0x44, 0x35, 0x18, 0x63, + 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x03, + 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1, 0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, + 0x62, 0x2a, 0x0a, 0x9a, 0x2a, 0xfa, 0x9a, 0xb9, 0x81, 0x79, 0x31, 0x4b, + 0x73, 0x0b, 0x63, 0x4b, 0xd9, 0x10, 0x04, 0x13, 0x04, 0x41, 0x99, 0x20, + 0x08, 0xcb, 0x06, 0x61, 0x20, 0x36, 0x08, 0x04, 0x41, 0x01, 0x6e, 0x6e, + 0x82, 0x20, 0x30, 0x1b, 0x86, 0x03, 0x21, 0x26, 0x08, 0xc5, 0xc7, 0x85, + 0x0e, 0xad, 0x8c, 0xaa, 0x0c, 0x8f, 0xae, 0x4e, 0xae, 0x2c, 0x6b, 0x82, + 0x20, 0x34, 0x13, 0x04, 0xc1, 0xd9, 0x20, 0x10, 0xcd, 0x86, 0x84, 0x50, + 0x16, 0x82, 0x18, 0x18, 0xc2, 0x21, 0x43, 0x87, 0x56, 0x46, 0x55, 0x86, + 0x47, 0x57, 0x27, 0x57, 0x56, 0x65, 0xb5, 0x21, 0x19, 0x14, 0x88, 0x18, + 0x06, 0x86, 0x70, 0x36, 0x08, 0x4f, 0x34, 0x41, 0x38, 0x3c, 0x2a, 0x74, + 0x68, 0x65, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x1b, 0x10, 0x62, + 0xa2, 0x08, 0x62, 0x20, 0x80, 0x0d, 0x41, 0xb5, 0x81, 0x90, 0x00, 0xc0, + 0x9a, 0x20, 0x10, 0x60, 0x30, 0x41, 0x10, 0x1e, 0x06, 0x68, 0x13, 0x04, + 0x01, 0x9a, 0x20, 0x08, 0xd1, 0x06, 0x03, 0xd1, 0x36, 0x82, 0x6b, 0x48, + 0xb4, 0xa5, 0xc1, 0xcd, 0x4d, 0x10, 0x04, 0x69, 0x03, 0x81, 0x78, 0xdb, + 0x37, 0x41, 0x08, 0xc4, 0x60, 0x83, 0x40, 0x84, 0xc1, 0x86, 0x40, 0x0c, + 0x36, 0x08, 0xc4, 0x18, 0x6c, 0x20, 0xb2, 0x0e, 0x0c, 0xc8, 0x60, 0x82, + 0x30, 0x84, 0xc1, 0x04, 0x41, 0x98, 0x68, 0xa0, 0x85, 0xb9, 0x91, 0xb1, + 0x95, 0x4d, 0x10, 0x04, 0x6a, 0x83, 0x81, 0xa0, 0xc1, 0x46, 0x70, 0x69, + 0xb0, 0x41, 0x38, 0x03, 0x35, 0x98, 0x20, 0x70, 0x63, 0x30, 0x41, 0x10, + 0x2a, 0x0e, 0x70, 0x6f, 0x73, 0x5c, 0xa6, 0xac, 0xbe, 0xa0, 0x9e, 0xa6, + 0x92, 0xa8, 0x92, 0x9e, 0x9c, 0x36, 0x20, 0x88, 0x1b, 0x6c, 0xc4, 0x19, + 0xbc, 0x01, 0xd7, 0x70, 0xa0, 0x2b, 0xc3, 0x63, 0x42, 0x55, 0x84, 0x35, + 0xf4, 0xf4, 0x24, 0x45, 0x04, 0xb3, 0x01, 0x41, 0xe2, 0x60, 0xfb, 0xce, + 0x40, 0x0e, 0xb8, 0x86, 0xc5, 0xd8, 0x1b, 0xdb, 0x9b, 0xdc, 0x04, 0x41, + 0xb0, 0x68, 0x0c, 0x3d, 0x31, 0x3d, 0x49, 0xc1, 0x6c, 0x40, 0x10, 0x3a, + 0xd8, 0xea, 0xe0, 0x0c, 0xec, 0x80, 0x6b, 0x36, 0x10, 0x6d, 0x00, 0x07, + 0x73, 0x70, 0x07, 0x1b, 0x0e, 0x02, 0x2b, 0x03, 0x33, 0x58, 0x03, 0x36, + 0xc0, 0x83, 0x09, 0x82, 0x32, 0x6c, 0x00, 0x36, 0x0c, 0xc4, 0x1e, 0xec, + 0xc1, 0x86, 0x80, 0x0f, 0x36, 0x0c, 0x83, 0x1e, 0xf4, 0xc1, 0x04, 0xa1, + 0x23, 0x83, 0x0d, 0xc1, 0x1f, 0x90, 0x68, 0x0b, 0x4b, 0x73, 0xe3, 0x32, + 0x65, 0xf5, 0x05, 0xf5, 0x36, 0x97, 0x46, 0x97, 0xf6, 0xe6, 0x36, 0x41, + 0x58, 0xba, 0x09, 0xc2, 0xc2, 0x6d, 0x08, 0x88, 0x09, 0xc2, 0xb2, 0x4d, + 0x10, 0x16, 0x6d, 0xc3, 0x42, 0x88, 0xc2, 0x28, 0x90, 0x42, 0x29, 0x98, + 0xc2, 0x60, 0x0a, 0xc4, 0x29, 0x00, 0x44, 0xa8, 0x8a, 0xb0, 0x86, 0x9e, + 0x9e, 0xa4, 0x88, 0x26, 0x08, 0x4b, 0xb6, 0x41, 0xd8, 0xb6, 0x0d, 0xcb, + 0x90, 0x0a, 0xa3, 0x70, 0x0a, 0xa5, 0xa0, 0x0a, 0x83, 0x2a, 0x0c, 0xa7, + 0xb0, 0x0a, 0x2c, 0x86, 0x9e, 0x98, 0x9e, 0xa4, 0x26, 0x08, 0xc2, 0xb5, + 0x41, 0xd8, 0x5c, 0x61, 0xc3, 0xc2, 0xb4, 0xc2, 0x28, 0x9c, 0x42, 0x29, + 0xa8, 0xc2, 0x60, 0x0a, 0xcc, 0x29, 0xbc, 0xc2, 0x86, 0x01, 0x15, 0x58, + 0x01, 0x16, 0x98, 0x4c, 0x59, 0x7d, 0x51, 0x85, 0xc9, 0x9d, 0x95, 0xd1, + 0x4d, 0x10, 0x96, 0x64, 0xc3, 0x42, 0xc8, 0xc2, 0x28, 0xcc, 0x42, 0x29, + 0x9c, 0xc2, 0x60, 0x0a, 0xc4, 0x29, 0xbc, 0xc2, 0x86, 0x80, 0x16, 0x36, + 0x0c, 0xb1, 0x50, 0x0b, 0xc0, 0x86, 0x42, 0x0f, 0x42, 0xc1, 0x16, 0x2e, + 0x80, 0x86, 0x19, 0xdb, 0x5b, 0x18, 0xdd, 0x1c, 0x8b, 0x34, 0xb7, 0x39, + 0xba, 0xb9, 0x09, 0x82, 0x80, 0xd1, 0x98, 0x4b, 0x3b, 0xfb, 0x62, 0x23, + 0xa3, 0x31, 0x97, 0x76, 0xf6, 0x35, 0x47, 0x47, 0x84, 0xae, 0x0c, 0xef, + 0xcb, 0xed, 0x4d, 0xae, 0x6d, 0x83, 0x82, 0x0b, 0x4d, 0x2e, 0xe8, 0xc2, + 0x2e, 0x20, 0xbc, 0x70, 0x06, 0xbd, 0xc0, 0x54, 0x61, 0x63, 0xb3, 0x6b, + 0x73, 0x49, 0x23, 0x2b, 0x73, 0xa3, 0x9b, 0x12, 0x04, 0x55, 0xc8, 0xf0, + 0x5c, 0xec, 0xca, 0xe4, 0xe6, 0xd2, 0xde, 0xdc, 0xa6, 0x04, 0x44, 0x13, + 0x32, 0x3c, 0x17, 0xbb, 0x30, 0x36, 0xbb, 0x32, 0xb9, 0x29, 0x41, 0x51, + 0x87, 0x0c, 0xcf, 0x65, 0x0e, 0x2d, 0x8c, 0xac, 0x4c, 0xae, 0xe9, 0x8d, + 0xac, 0x8c, 0x6d, 0x4a, 0x80, 0x94, 0x21, 0xc3, 0x73, 0x91, 0x2b, 0x9b, + 0x7b, 0xab, 0x93, 0x1b, 0x2b, 0x9b, 0x9b, 0x12, 0x58, 0x95, 0xc8, 0xf0, + 0x5c, 0xe8, 0xf2, 0xe0, 0xca, 0x82, 0xdc, 0xdc, 0xde, 0xe8, 0xc2, 0xe8, + 0xd2, 0xde, 0xdc, 0xe6, 0xa6, 0x08, 0x78, 0xd0, 0x07, 0x75, 0xc8, 0xf0, + 0x5c, 0xec, 0xd2, 0xca, 0xee, 0x92, 0xc8, 0xa6, 0xe8, 0xc2, 0xe8, 0xca, + 0xa6, 0x04, 0x7f, 0x50, 0x87, 0x0c, 0xcf, 0xa5, 0xcc, 0x8d, 0x4e, 0x2e, + 0x0f, 0xea, 0x2d, 0xcd, 0x8d, 0x6e, 0x6e, 0x4a, 0x60, 0x0b, 0x5d, 0xc8, + 0xf0, 0x5c, 0xc6, 0xde, 0xea, 0xdc, 0xe8, 0xca, 0xe4, 0xe6, 0xa6, 0x04, + 0xbd, 0x00, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x4c, 0x00, 0x00, + 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, + 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, + 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, + 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, + 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, + 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, + 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, + 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, + 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, + 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, + 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, + 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, + 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, + 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, + 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, + 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, + 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, + 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, + 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, + 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, + 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, + 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, + 0xc4, 0x21, 0x07, 0x7c, 0x70, 0x03, 0x7a, 0x28, 0x87, 0x76, 0x80, 0x87, + 0x19, 0xd1, 0x43, 0x0e, 0xf8, 0xe0, 0x06, 0xe4, 0x20, 0x0e, 0xe7, 0xe0, + 0x06, 0xf6, 0x10, 0x0e, 0xf2, 0xc0, 0x0e, 0xe1, 0x90, 0x0f, 0xef, 0x50, + 0x0f, 0xf4, 0x00, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x33, 0x00, 0x00, + 0x00, 0x25, 0xf0, 0x05, 0x7e, 0x74, 0x74, 0x79, 0x1a, 0x6e, 0xc3, 0xd9, + 0x65, 0x39, 0x10, 0x38, 0xab, 0x4e, 0xc3, 0x6d, 0x38, 0xbb, 0x2c, 0x9f, + 0xd2, 0xc3, 0xf4, 0x32, 0x10, 0x18, 0xac, 0x80, 0x38, 0x08, 0xfc, 0xe8, + 0xe8, 0x32, 0xb5, 0x8c, 0xa7, 0xd7, 0xe5, 0xe5, 0xaa, 0x15, 0x08, 0x9c, + 0x59, 0x7f, 0x24, 0x6a, 0x19, 0x4f, 0xaf, 0xcb, 0xcb, 0x32, 0x22, 0xd0, + 0xfa, 0x23, 0xd9, 0xcb, 0x63, 0xfa, 0x5b, 0x0e, 0x6c, 0x92, 0x60, 0x33, + 0x20, 0x10, 0x08, 0x0c, 0x16, 0x00, 0x1c, 0x04, 0x7e, 0x74, 0x74, 0x99, + 0x5a, 0xc6, 0xd3, 0xeb, 0xf2, 0x72, 0x16, 0x08, 0x9c, 0x59, 0x7f, 0x24, + 0x6a, 0x19, 0x4f, 0xaf, 0xcb, 0xcb, 0x32, 0x22, 0xd0, 0xfa, 0x23, 0xd9, + 0xcb, 0x63, 0xfa, 0x5b, 0x0e, 0x6c, 0x92, 0x60, 0x33, 0x20, 0x10, 0x08, + 0x0c, 0x1a, 0x82, 0x34, 0x5c, 0xbe, 0xf3, 0xf8, 0x42, 0x44, 0x00, 0x13, + 0x11, 0x02, 0xcd, 0xb0, 0x10, 0x76, 0xe0, 0x0c, 0x97, 0xef, 0x3c, 0xfe, + 0xe0, 0x4c, 0xb7, 0x5f, 0xdc, 0xb6, 0x11, 0x4c, 0xc3, 0xe5, 0x3b, 0x8f, + 0xbf, 0x38, 0xc0, 0x20, 0x36, 0x0f, 0x35, 0xf9, 0xc5, 0x6d, 0x9b, 0x01, + 0x34, 0x5c, 0xbe, 0xf3, 0xf8, 0x12, 0xc0, 0x3c, 0x0b, 0xe1, 0x17, 0xb7, + 0x6d, 0x05, 0xd5, 0x70, 0xf9, 0xce, 0xe3, 0x4b, 0x93, 0x13, 0x11, 0x28, + 0x35, 0x3d, 0xd4, 0xe4, 0x17, 0xb7, 0x6d, 0x03, 0x04, 0x03, 0x20, 0x0d, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x41, 0x53, 0x48, 0x14, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x6a, 0x46, 0xfe, 0xd5, 0x21, 0x7d, + 0xa1, 0xb7, 0x81, 0xb9, 0x35, 0xf9, 0x0f, 0x28, 0x1d, 0x44, 0x58, 0x49, + 0x4c, 0xb0, 0x07, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xec, 0x01, 0x00, + 0x00, 0x44, 0x58, 0x49, 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x98, 0x07, 0x00, 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, + 0x00, 0xe3, 0x01, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, + 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, + 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, + 0x42, 0xa4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x52, + 0x88, 0x48, 0x90, 0x14, 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, + 0x42, 0xe4, 0x48, 0x0e, 0x90, 0x91, 0x22, 0xc4, 0x50, 0x41, 0x51, 0x81, + 0x8c, 0xe1, 0x83, 0xe5, 0x8a, 0x04, 0x29, 0x46, 0x06, 0x51, 0x18, 0x00, + 0x00, 0x08, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, + 0x07, 0x40, 0x02, 0xa8, 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, + 0x20, 0x6d, 0x30, 0x86, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x09, 0xa8, + 0x00, 0x49, 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, + 0x42, 0x20, 0x4c, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, + 0x00, 0x45, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, + 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, + 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x70, 0x23, + 0x00, 0x25, 0x00, 0x14, 0x66, 0x00, 0xe6, 0x08, 0xc0, 0x60, 0x8e, 0x00, + 0x29, 0xc6, 0x20, 0x84, 0x14, 0x42, 0xa6, 0x18, 0x80, 0x10, 0x52, 0x06, + 0xa1, 0x9b, 0x86, 0xcb, 0x9f, 0xb0, 0x87, 0x90, 0xfc, 0x95, 0x90, 0x56, + 0x62, 0xf2, 0x8b, 0xdb, 0x46, 0xc5, 0x18, 0x63, 0x10, 0x2a, 0xf7, 0x0c, + 0x97, 0x3f, 0x61, 0x0f, 0x21, 0xf9, 0x21, 0xd0, 0x0c, 0x0b, 0x81, 0x82, + 0x55, 0x18, 0x45, 0x18, 0x1b, 0x63, 0x0c, 0x42, 0xc8, 0xa0, 0x56, 0x90, + 0x41, 0xc6, 0x18, 0x63, 0x0c, 0x7a, 0x73, 0x04, 0x41, 0x31, 0x18, 0x29, + 0x84, 0x44, 0x92, 0x03, 0x01, 0xc3, 0x08, 0xc4, 0x30, 0x53, 0x1b, 0x8c, + 0x03, 0x3b, 0x84, 0xc3, 0x3c, 0xcc, 0x83, 0x1b, 0xd0, 0x42, 0x39, 0xe0, + 0x03, 0x3d, 0xd4, 0x83, 0x3c, 0x94, 0x83, 0x1c, 0x90, 0x02, 0x1f, 0xd8, + 0x43, 0x39, 0x8c, 0x03, 0x3d, 0xbc, 0x83, 0x3c, 0xf0, 0x81, 0x39, 0xb0, + 0xc3, 0x3b, 0x84, 0x03, 0x3d, 0xb0, 0x01, 0x18, 0xd0, 0x81, 0x1f, 0x80, + 0x81, 0x1f, 0xe8, 0x81, 0x1e, 0xb4, 0x43, 0x3a, 0xc0, 0xc3, 0x3c, 0xfc, + 0x02, 0x3d, 0xe4, 0x03, 0x3c, 0x94, 0x03, 0x0a, 0xc8, 0x4c, 0x62, 0x30, + 0x0e, 0xec, 0x10, 0x0e, 0xf3, 0x30, 0x0f, 0x6e, 0x40, 0x0b, 0xe5, 0x80, + 0x0f, 0xf4, 0x50, 0x0f, 0xf2, 0x50, 0x0e, 0x72, 0x40, 0x0a, 0x7c, 0x60, + 0x0f, 0xe5, 0x30, 0x0e, 0xf4, 0xf0, 0x0e, 0xf2, 0xc0, 0x07, 0xe6, 0xc0, + 0x0e, 0xef, 0x10, 0x0e, 0xf4, 0xc0, 0x06, 0x60, 0x40, 0x07, 0x7e, 0x00, + 0x06, 0x7e, 0x80, 0x84, 0x6a, 0xe9, 0xde, 0x24, 0x4d, 0x11, 0x25, 0x4c, + 0x3e, 0x0b, 0x30, 0xcf, 0x42, 0x44, 0xec, 0x04, 0x4c, 0x04, 0x0a, 0x08, + 0xe5, 0x74, 0x20, 0x00, 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, + 0x87, 0x36, 0x68, 0x87, 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, 0x0d, 0xaf, + 0x50, 0x0e, 0x6d, 0xd0, 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, + 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, + 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, + 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, + 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, + 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, + 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, + 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x43, + 0x9e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x86, 0x3c, 0x06, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x0c, 0x79, 0x10, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x18, 0xf2, 0x34, 0x40, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x30, 0xe4, 0x79, 0x80, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x60, 0xc8, 0x23, 0x01, 0x01, 0x30, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x16, 0x08, 0x00, 0x0f, 0x00, 0x00, + 0x00, 0x32, 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, + 0x47, 0xc6, 0x04, 0x43, 0x22, 0x25, 0x30, 0x02, 0x50, 0x0c, 0x45, 0x50, + 0x12, 0x65, 0x50, 0x1e, 0x54, 0x4a, 0xa2, 0x0c, 0x0a, 0x61, 0x04, 0xa0, + 0x08, 0x0a, 0x84, 0xf0, 0x0c, 0x00, 0xe9, 0x19, 0x00, 0xda, 0x63, 0x39, + 0x0c, 0x01, 0x00, 0x00, 0x70, 0x1c, 0x00, 0x10, 0x08, 0x04, 0x02, 0x00, + 0x00, 0x79, 0x18, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, + 0x90, 0x46, 0x02, 0x13, 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, 0x3b, 0x03, + 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, 0xb9, 0x01, + 0x41, 0xa1, 0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, 0x0a, 0x9a, + 0x2a, 0xfa, 0x9a, 0xb9, 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, 0x63, 0x4b, + 0xd9, 0x10, 0x04, 0x13, 0x04, 0xc2, 0x98, 0x20, 0x10, 0xc7, 0x06, 0x61, + 0x20, 0x26, 0x08, 0x04, 0xb2, 0x41, 0x18, 0x0c, 0x0a, 0x70, 0x73, 0x1b, + 0x06, 0xc4, 0x20, 0x26, 0x08, 0xd8, 0x44, 0x60, 0x82, 0x40, 0x24, 0x13, + 0x04, 0x42, 0xd9, 0x20, 0x10, 0xcd, 0x86, 0x84, 0x50, 0x16, 0x82, 0x18, + 0x18, 0xc2, 0xd9, 0x90, 0x0c, 0xca, 0x42, 0x0c, 0x03, 0x43, 0x38, 0x1b, + 0x84, 0x07, 0x9a, 0x20, 0x68, 0xd4, 0x06, 0x84, 0x90, 0x16, 0x82, 0x18, + 0x08, 0x60, 0x43, 0x30, 0x6d, 0x20, 0x22, 0x00, 0xa0, 0x26, 0x08, 0x5b, + 0xb5, 0x21, 0xb0, 0x26, 0x08, 0x02, 0x40, 0xa2, 0x2d, 0x2c, 0xcd, 0x8d, + 0xcb, 0x94, 0xd5, 0x17, 0xd4, 0xdb, 0x5c, 0x1a, 0x5d, 0xda, 0x9b, 0xdb, + 0x04, 0xa1, 0x68, 0x26, 0x08, 0x85, 0xb3, 0x21, 0x20, 0x26, 0x08, 0xc5, + 0x33, 0x41, 0x28, 0xa0, 0x0d, 0x0b, 0xa1, 0x6d, 0x5c, 0xe7, 0x0d, 0x1e, + 0xf1, 0x01, 0x44, 0xa8, 0x8a, 0xb0, 0x86, 0x9e, 0x9e, 0xa4, 0x88, 0x26, + 0x08, 0x45, 0x34, 0x41, 0x20, 0x96, 0x0d, 0xc2, 0x18, 0x8c, 0xc1, 0x86, + 0x65, 0x08, 0x83, 0xed, 0xeb, 0xc4, 0x60, 0x10, 0x83, 0xe1, 0x23, 0x03, + 0x16, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x13, 0x04, 0x82, 0xd9, 0x20, 0x8c, + 0xc1, 0x19, 0x6c, 0x58, 0x18, 0x33, 0xd8, 0xbe, 0x4e, 0x0c, 0x06, 0x8f, + 0xf9, 0xd0, 0x60, 0xc3, 0x00, 0x06, 0x65, 0x90, 0x06, 0x4c, 0xa6, 0xac, + 0xbe, 0xa8, 0xc2, 0xe4, 0xce, 0xca, 0xe8, 0x26, 0x08, 0x85, 0xb4, 0x61, + 0x21, 0xd6, 0x60, 0x63, 0x83, 0xee, 0x1b, 0x3c, 0xe2, 0x43, 0x83, 0x0d, + 0x41, 0x1b, 0x6c, 0x18, 0xd4, 0xc0, 0x0d, 0x80, 0x0d, 0x05, 0x96, 0xbd, + 0x41, 0x05, 0x54, 0x61, 0x63, 0xb3, 0x6b, 0x73, 0x49, 0x23, 0x2b, 0x73, + 0xa3, 0x9b, 0x12, 0x04, 0x55, 0xc8, 0xf0, 0x5c, 0xec, 0xca, 0xe4, 0xe6, + 0xd2, 0xde, 0xdc, 0xa6, 0x04, 0x44, 0x13, 0x32, 0x3c, 0x17, 0xbb, 0x30, + 0x36, 0xbb, 0x32, 0xb9, 0x29, 0x81, 0x51, 0x87, 0x0c, 0xcf, 0x65, 0x0e, + 0x2d, 0x8c, 0xac, 0x4c, 0xae, 0xe9, 0x8d, 0xac, 0x8c, 0x6d, 0x4a, 0x80, + 0x94, 0x21, 0xc3, 0x73, 0x91, 0x2b, 0x9b, 0x7b, 0xab, 0x93, 0x1b, 0x2b, + 0x9b, 0x9b, 0x12, 0x50, 0x75, 0xc8, 0xf0, 0x5c, 0xec, 0xd2, 0xca, 0xee, + 0x92, 0xc8, 0xa6, 0xe8, 0xc2, 0xe8, 0xca, 0xa6, 0x04, 0x56, 0x1d, 0x32, + 0x3c, 0x97, 0x32, 0x37, 0x3a, 0xb9, 0x3c, 0xa8, 0xb7, 0x34, 0x37, 0xba, + 0xb9, 0x29, 0xc1, 0x1b, 0x00, 0x79, 0x18, 0x00, 0x00, 0x4c, 0x00, 0x00, + 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, + 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, + 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, + 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, + 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, + 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, + 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, + 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, + 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, + 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, + 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, + 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, + 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, + 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, + 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, + 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, + 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, + 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, + 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, + 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, + 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, + 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, + 0xc4, 0x21, 0x07, 0x7c, 0x70, 0x03, 0x7a, 0x28, 0x87, 0x76, 0x80, 0x87, + 0x19, 0xd1, 0x43, 0x0e, 0xf8, 0xe0, 0x06, 0xe4, 0x20, 0x0e, 0xe7, 0xe0, + 0x06, 0xf6, 0x10, 0x0e, 0xf2, 0xc0, 0x0e, 0xe1, 0x90, 0x0f, 0xef, 0x50, + 0x0f, 0xf4, 0x00, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x15, 0x00, 0x00, + 0x00, 0x56, 0x20, 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x10, 0x11, 0xc0, 0x44, + 0x84, 0x40, 0x33, 0x2c, 0x84, 0x11, 0x38, 0xc3, 0xe5, 0x3b, 0x8f, 0x3f, + 0x38, 0xd3, 0xed, 0x17, 0xb7, 0x6d, 0x01, 0xd3, 0x70, 0xf9, 0xce, 0xe3, + 0x2f, 0x0e, 0x30, 0x88, 0xcd, 0x43, 0x4d, 0x7e, 0x71, 0xdb, 0x36, 0x00, + 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x04, 0x30, 0xcf, 0x42, 0xf8, 0xc5, 0x6d, + 0x9b, 0x40, 0x35, 0x5c, 0xbe, 0xf3, 0xf8, 0xd2, 0xe4, 0x44, 0x04, 0x4a, + 0x4d, 0x0f, 0x35, 0xf9, 0xc5, 0x6d, 0x1b, 0x00, 0xc1, 0x00, 0x48, 0x03, + 0x00, 0x61, 0x20, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, + 0x2c, 0x10, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x14, 0x47, 0x00, + 0xa8, 0x94, 0x00, 0x91, 0xc2, 0x2b, 0xb7, 0x92, 0x2b, 0x85, 0x42, 0x98, + 0x01, 0xa0, 0x31, 0x46, 0xe0, 0xba, 0xa6, 0x08, 0x82, 0xc1, 0x18, 0x41, + 0x69, 0xa2, 0x60, 0xfd, 0x0b, 0x63, 0x04, 0x22, 0x6c, 0xc6, 0xec, 0x2f, + 0x8c, 0x11, 0xe8, 0xad, 0x8c, 0xf3, 0xdf, 0x18, 0x41, 0x48, 0x82, 0x21, + 0xee, 0x0b, 0x23, 0x00, 0x63, 0x04, 0x21, 0x09, 0x86, 0xf0, 0x2f, 0x8c, + 0x11, 0xbc, 0xb8, 0xa8, 0xe6, 0xdf, 0x0c, 0x00, 0x00, 0x23, 0x06, 0x09, + 0x00, 0x82, 0x60, 0x20, 0x89, 0x41, 0x73, 0x85, 0x41, 0x18, 0x44, 0x23, + 0x06, 0x09, 0x00, 0x82, 0x60, 0x20, 0x8d, 0x81, 0x83, 0x85, 0x41, 0x18, + 0x48, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x20, 0x91, 0xc1, 0xb3, 0x89, + 0x81, 0x18, 0x4c, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0xa4, 0x81, + 0x13, 0x06, 0x63, 0xa0, 0x35, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, + 0xa8, 0xc1, 0x23, 0x06, 0x64, 0x40, 0x39, 0x23, 0x06, 0x09, 0x00, 0x82, + 0x60, 0x60, 0xac, 0x01, 0x34, 0x06, 0x65, 0xb0, 0x3d, 0x23, 0x06, 0x09, + 0x00, 0x82, 0x60, 0x60, 0xb0, 0x41, 0x44, 0x06, 0x66, 0xf0, 0x41, 0x23, + 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0xb4, 0x81, 0x84, 0x06, 0x67, 0xe0, + 0x45, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0xb8, 0xc1, 0x94, 0x06, + 0x68, 0x80, 0x49, 0x23, 0x06, 0x0f, 0x00, 0x82, 0x60, 0xd0, 0xb4, 0x01, + 0x86, 0x1c, 0x42, 0xa0, 0x28, 0x69, 0x90, 0x06, 0x93, 0x32, 0x9a, 0x10, + 0x00, 0x23, 0x06, 0x0f, 0x00, 0x82, 0x60, 0xd0, 0xbc, 0x81, 0xb6, 0x24, + 0xc4, 0xc0, 0x30, 0x6b, 0xb0, 0x06, 0x15, 0x33, 0x9a, 0x10, 0x00, 0xa3, + 0x09, 0x42, 0x60, 0xc4, 0x04, 0x1f, 0x13, 0x24, 0xf8, 0x18, 0x31, 0xc1, + 0x67, 0xc4, 0x60, 0x01, 0x40, 0x10, 0x0c, 0x1e, 0x3a, 0xf8, 0x06, 0x21, + 0x98, 0xaa, 0x6b, 0xc4, 0x60, 0x01, 0x40, 0x10, 0x0c, 0x9e, 0x3a, 0x00, + 0x03, 0x62, 0x10, 0xa8, 0x4c, 0x1b, 0x31, 0x58, 0x00, 0x10, 0x04, 0x83, + 0xc7, 0x0e, 0xc2, 0xa0, 0x20, 0x86, 0x8a, 0xbb, 0x6c, 0x88, 0xe4, 0x63, + 0x43, 0x24, 0x1f, 0x1b, 0x22, 0xf9, 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, + 0x01, 0xc2, 0x07, 0x63, 0x70, 0x07, 0x77, 0xe0, 0x06, 0xc3, 0x88, 0x41, + 0x02, 0x80, 0x20, 0x18, 0x20, 0x7c, 0x30, 0x06, 0x77, 0x70, 0x07, 0x67, + 0x20, 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, 0x01, 0xc2, 0x07, 0x63, 0x70, + 0x07, 0x77, 0xd0, 0x06, 0xc1, 0x88, 0x41, 0x02, 0x80, 0x20, 0x18, 0x20, + 0x7c, 0x30, 0x06, 0x77, 0x70, 0x07, 0x70, 0x10, 0x21, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +/* The yuv-rendering pixel shader: + + --- D3D12_PixelShader_NV21_BT709.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureUV : register(t1); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + #define NVRS \ + "RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \ + " DENY_DOMAIN_SHADER_ROOT_ACCESS |" \ + " DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \ + " DENY_HULL_SHADER_ROOT_ACCESS )," \ + "RootConstants(num32BitConstants=32, b0),"\ + "DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )" + + [RootSignature(NVRS)] + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.7927}; + const float3 Gcoeff = {1.1644, -0.2132, -0.5329}; + const float3 Bcoeff = {1.1644, 2.1124, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ + +static unsigned char D3D12_PixelShader_NV21_BT709[] = { + 0x44, 0x58, 0x42, 0x43, 0x5c, 0x52, 0x50, 0xb3, 0x0c, 0x9c, 0x81, 0x8a, + 0x2d, 0x9e, 0x1b, 0x5d, 0x0b, 0xcb, 0x2a, 0xa0, 0x01, 0x00, 0x00, 0x00, + 0xe9, 0x12, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, + 0x50, 0x00, 0x00, 0x00, 0xdb, 0x00, 0x00, 0x00, 0x15, 0x01, 0x00, 0x00, + 0x0d, 0x02, 0x00, 0x00, 0xc9, 0x02, 0x00, 0x00, 0x15, 0x0b, 0x00, 0x00, + 0x31, 0x0b, 0x00, 0x00, 0x53, 0x46, 0x49, 0x30, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x31, + 0x83, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x53, 0x56, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, + 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x43, 0x4f, 0x4c, + 0x4f, 0x52, 0x00, 0x4f, 0x53, 0x47, 0x31, 0x32, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x00, 0x50, 0x53, 0x56, 0x30, 0xf0, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, + 0xff, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01, 0x00, 0x03, 0x01, 0x00, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x43, + 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x44, 0x03, 0x03, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x42, 0x00, 0x03, 0x02, 0x00, + 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x44, + 0x00, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x44, 0x10, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x52, 0x54, 0x53, + 0x30, 0xb4, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, + 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, + 0x00, 0x1d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, + 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, + 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, + 0x00, 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, + 0xff, 0x01, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, + 0x00, 0x9c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xff, 0xff, 0x53, 0x54, 0x41, 0x54, 0x44, 0x08, 0x00, + 0x00, 0x60, 0x00, 0x00, 0x00, 0x11, 0x02, 0x00, 0x00, 0x44, 0x58, 0x49, + 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x2c, 0x08, 0x00, + 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0x08, 0x02, 0x00, + 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, + 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, + 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, + 0x62, 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, + 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x52, 0x88, 0x48, 0x90, 0x14, + 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, + 0x90, 0x91, 0x22, 0xc4, 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, + 0x8a, 0x04, 0x29, 0x46, 0x06, 0x51, 0x18, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, 0x02, 0xa8, + 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x20, 0x6d, 0x30, 0x86, + 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x09, 0xa8, 0x00, 0x49, 0x18, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, 0x4c, 0x08, + 0x06, 0x00, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x4b, 0x00, 0x00, + 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, + 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, + 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x78, 0x33, 0x00, 0xc3, 0x08, 0x04, + 0x30, 0x47, 0x00, 0x06, 0x33, 0xb5, 0xc1, 0x38, 0xb0, 0x43, 0x38, 0xcc, + 0xc3, 0x3c, 0xb8, 0x01, 0x2d, 0x94, 0x03, 0x3e, 0xd0, 0x43, 0x3d, 0xc8, + 0x43, 0x39, 0xc8, 0x01, 0x29, 0xf0, 0x81, 0x3d, 0x94, 0xc3, 0x38, 0xd0, + 0xc3, 0x3b, 0xc8, 0x03, 0x1f, 0x98, 0x03, 0x3b, 0xbc, 0x43, 0x38, 0xd0, + 0x03, 0x1b, 0x80, 0x01, 0x1d, 0xf8, 0x01, 0x18, 0xf8, 0x81, 0x1e, 0xe8, + 0x41, 0x3b, 0xa4, 0x03, 0x3c, 0xcc, 0xc3, 0x2f, 0xd0, 0x43, 0x3e, 0xc0, + 0x43, 0x39, 0xa0, 0x40, 0xcc, 0x24, 0x06, 0xe3, 0xc0, 0x0e, 0xe1, 0x30, + 0x0f, 0xf3, 0xe0, 0x06, 0xb4, 0x50, 0x0e, 0xf8, 0x40, 0x0f, 0xf5, 0x20, + 0x0f, 0xe5, 0x20, 0x07, 0xa4, 0xc0, 0x07, 0xf6, 0x50, 0x0e, 0xe3, 0x40, + 0x0f, 0xef, 0x20, 0x0f, 0x7c, 0x60, 0x0e, 0xec, 0xf0, 0x0e, 0xe1, 0x40, + 0x0f, 0x6c, 0x00, 0x06, 0x74, 0xe0, 0x07, 0x60, 0xe0, 0x07, 0x48, 0x08, + 0x83, 0xc8, 0x4d, 0xd2, 0x14, 0x51, 0xc2, 0xe4, 0xb3, 0x00, 0xf3, 0x2c, + 0x44, 0xc4, 0x4e, 0xc0, 0x44, 0xa0, 0x40, 0x90, 0x19, 0x01, 0x28, 0x01, + 0xa2, 0x34, 0x47, 0x80, 0x14, 0x03, 0x08, 0x21, 0x96, 0x20, 0x56, 0x0c, + 0x24, 0x84, 0x58, 0x80, 0xdc, 0x4d, 0xc3, 0xe5, 0x4f, 0xd8, 0x43, 0x48, + 0xfe, 0x4a, 0x48, 0x2b, 0x31, 0xf9, 0xc5, 0x6d, 0xa3, 0x02, 0x00, 0x00, + 0x04, 0xad, 0x7b, 0x86, 0xcb, 0x9f, 0xb0, 0x87, 0x90, 0xfc, 0x10, 0x68, + 0x86, 0x85, 0x40, 0x41, 0x2c, 0x0c, 0x14, 0x52, 0x02, 0x00, 0x80, 0x10, + 0x02, 0xd0, 0x2c, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0xd5, 0x39, 0x82, + 0xa0, 0x18, 0x52, 0x2c, 0x21, 0x2e, 0xe1, 0x81, 0x80, 0x61, 0x04, 0x01, + 0xb8, 0x4b, 0x9a, 0x22, 0x4a, 0x98, 0xfc, 0x14, 0xb9, 0x88, 0x85, 0x3d, + 0x80, 0x81, 0x88, 0xc4, 0xe6, 0xa1, 0x26, 0x34, 0x84, 0x1d, 0xd2, 0x41, + 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, + 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, + 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, + 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x3a, 0x0f, 0x64, 0x90, 0x21, + 0x23, 0x45, 0x44, 0x00, 0x72, 0x00, 0xc0, 0xe4, 0x00, 0x80, 0xe9, 0x01, + 0x00, 0x0f, 0x79, 0x12, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x18, 0xf2, 0x30, 0x40, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x30, 0xe4, 0x71, 0x80, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x60, 0xc8, 0x33, 0x01, 0x01, 0x30, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x90, 0xa7, 0x02, 0x02, 0x20, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x21, 0x0f, 0x06, 0x04, 0xc0, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x59, 0x20, 0x00, 0x00, + 0x00, 0x15, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x18, 0x19, 0x11, 0x4c, + 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x5a, 0x05, 0x42, 0xa2, + 0x04, 0x46, 0x00, 0x8a, 0xa1, 0x08, 0x4a, 0xa2, 0x50, 0xca, 0xa0, 0x1c, + 0x0a, 0xa4, 0x10, 0x4a, 0xa1, 0xc0, 0x0a, 0xa8, 0x3c, 0x0a, 0x87, 0x56, + 0x11, 0x8c, 0x00, 0x14, 0x42, 0x19, 0x94, 0x04, 0x9d, 0x19, 0x00, 0x2a, + 0x33, 0x00, 0x44, 0x66, 0x00, 0x68, 0xcc, 0x00, 0x50, 0x98, 0x01, 0x20, + 0x3e, 0x03, 0x40, 0x7d, 0x2c, 0x87, 0x21, 0x00, 0x00, 0x00, 0x8e, 0x03, + 0x00, 0x02, 0x81, 0x40, 0x00, 0x79, 0x18, 0x00, 0x00, 0xbe, 0x00, 0x00, + 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, 0x44, 0x35, 0x18, 0x63, + 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x03, + 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1, 0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, + 0x62, 0x2a, 0x0a, 0x9a, 0x2a, 0xfa, 0x9a, 0xb9, 0x81, 0x79, 0x31, 0x4b, + 0x73, 0x0b, 0x63, 0x4b, 0xd9, 0x10, 0x04, 0x13, 0x04, 0x41, 0x99, 0x20, + 0x08, 0xcb, 0x06, 0x61, 0x20, 0x36, 0x08, 0x04, 0x41, 0x01, 0x6e, 0x6e, + 0x82, 0x20, 0x30, 0x1b, 0x86, 0x03, 0x21, 0x26, 0x08, 0xc5, 0xc7, 0x85, + 0x0e, 0xad, 0x8c, 0xaa, 0x0c, 0x8f, 0xae, 0x4e, 0xae, 0x2c, 0x6b, 0x82, + 0x20, 0x34, 0x13, 0x04, 0xc1, 0xd9, 0x20, 0x10, 0xcd, 0x86, 0x84, 0x50, + 0x16, 0x82, 0x18, 0x18, 0xc2, 0x21, 0x43, 0x87, 0x56, 0x46, 0x55, 0x86, + 0x47, 0x57, 0x27, 0x57, 0x56, 0x65, 0xb5, 0x21, 0x19, 0x14, 0x88, 0x18, + 0x06, 0x86, 0x70, 0x36, 0x08, 0x4f, 0x34, 0x41, 0x38, 0x3c, 0x2a, 0x74, + 0x68, 0x65, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x1b, 0x10, 0x62, + 0xa2, 0x08, 0x62, 0x20, 0x80, 0x0d, 0x41, 0xb5, 0x81, 0x90, 0x00, 0xc0, + 0x9a, 0x20, 0x10, 0x60, 0x30, 0x41, 0x10, 0x1e, 0x06, 0x68, 0x13, 0x04, + 0x01, 0x9a, 0x20, 0x08, 0xd1, 0x06, 0x03, 0xd1, 0x36, 0x82, 0x6b, 0x48, + 0xb4, 0xa5, 0xc1, 0xcd, 0x4d, 0x10, 0x04, 0x69, 0x03, 0x81, 0x78, 0xdb, + 0x37, 0x41, 0x08, 0xc4, 0x60, 0x83, 0x40, 0x84, 0xc1, 0x86, 0x40, 0x0c, + 0x36, 0x08, 0xc4, 0x18, 0x6c, 0x20, 0xb2, 0x0e, 0x0c, 0xc8, 0x60, 0x82, + 0x30, 0x84, 0xc1, 0x04, 0x41, 0x98, 0x68, 0xa0, 0x85, 0xb9, 0x91, 0xb1, + 0x95, 0x4d, 0x10, 0x04, 0x6a, 0x83, 0x81, 0xa0, 0xc1, 0x46, 0x70, 0x69, + 0xb0, 0x41, 0x38, 0x03, 0x35, 0x98, 0x20, 0x70, 0x63, 0x30, 0x41, 0x10, + 0x2a, 0x0e, 0x70, 0x6f, 0x73, 0x5c, 0xa6, 0xac, 0xbe, 0xa0, 0x9e, 0xa6, + 0x92, 0xa8, 0x92, 0x9e, 0x9c, 0x36, 0x20, 0x88, 0x1b, 0x6c, 0xc4, 0x19, + 0xbc, 0x01, 0xd7, 0x70, 0xa0, 0x2b, 0xc3, 0x63, 0x42, 0x55, 0x84, 0x35, + 0xf4, 0xf4, 0x24, 0x45, 0x04, 0xb3, 0x01, 0x41, 0xe2, 0x60, 0xfb, 0xce, + 0x40, 0x0e, 0xb8, 0x86, 0xc5, 0xd8, 0x1b, 0xdb, 0x9b, 0xdc, 0x04, 0x41, + 0xb0, 0x68, 0x0c, 0x3d, 0x31, 0x3d, 0x49, 0xc1, 0x6c, 0x40, 0x10, 0x3a, + 0xd8, 0xea, 0xe0, 0x0c, 0xec, 0x80, 0x6b, 0x36, 0x10, 0x6d, 0x00, 0x07, + 0x73, 0x70, 0x07, 0x1b, 0x0e, 0x02, 0x2b, 0x03, 0x33, 0x58, 0x03, 0x36, + 0xc0, 0x83, 0x09, 0x82, 0x32, 0x6c, 0x00, 0x36, 0x0c, 0xc4, 0x1e, 0xec, + 0xc1, 0x86, 0x80, 0x0f, 0x36, 0x0c, 0x83, 0x1e, 0xf4, 0xc1, 0x04, 0xa1, + 0x23, 0x83, 0x0d, 0xc1, 0x1f, 0x90, 0x68, 0x0b, 0x4b, 0x73, 0xe3, 0x32, + 0x65, 0xf5, 0x05, 0xf5, 0x36, 0x97, 0x46, 0x97, 0xf6, 0xe6, 0x36, 0x41, + 0x58, 0xba, 0x09, 0xc2, 0xc2, 0x6d, 0x08, 0x88, 0x09, 0xc2, 0xb2, 0x4d, + 0x10, 0x16, 0x6d, 0xc3, 0x42, 0x88, 0xc2, 0x28, 0x90, 0x42, 0x29, 0x98, + 0xc2, 0x60, 0x0a, 0xc4, 0x29, 0x00, 0x44, 0xa8, 0x8a, 0xb0, 0x86, 0x9e, + 0x9e, 0xa4, 0x88, 0x26, 0x08, 0x4b, 0xb6, 0x41, 0xd8, 0xb6, 0x0d, 0xcb, + 0x90, 0x0a, 0xa3, 0x70, 0x0a, 0xa5, 0xa0, 0x0a, 0x83, 0x2a, 0x0c, 0xa7, + 0xb0, 0x0a, 0x2c, 0x86, 0x9e, 0x98, 0x9e, 0xa4, 0x26, 0x08, 0xc2, 0xb5, + 0x41, 0xd8, 0x5c, 0x61, 0xc3, 0xc2, 0xb4, 0xc2, 0x28, 0x9c, 0x42, 0x29, + 0xa8, 0xc2, 0x60, 0x0a, 0xcc, 0x29, 0xbc, 0xc2, 0x86, 0x01, 0x15, 0x58, + 0x01, 0x16, 0x98, 0x4c, 0x59, 0x7d, 0x51, 0x85, 0xc9, 0x9d, 0x95, 0xd1, + 0x4d, 0x10, 0x96, 0x64, 0xc3, 0x42, 0xc8, 0xc2, 0x28, 0xcc, 0x42, 0x29, + 0x9c, 0xc2, 0x60, 0x0a, 0xc4, 0x29, 0xbc, 0xc2, 0x86, 0x80, 0x16, 0x36, + 0x0c, 0xb1, 0x50, 0x0b, 0xc0, 0x86, 0x42, 0x0f, 0x42, 0xc1, 0x16, 0x2e, + 0x80, 0x86, 0x19, 0xdb, 0x5b, 0x18, 0xdd, 0x1c, 0x8b, 0x34, 0xb7, 0x39, + 0xba, 0xb9, 0x09, 0x82, 0x80, 0xd1, 0x98, 0x4b, 0x3b, 0xfb, 0x62, 0x23, + 0xa3, 0x31, 0x97, 0x76, 0xf6, 0x35, 0x47, 0x47, 0x84, 0xae, 0x0c, 0xef, + 0xcb, 0xed, 0x4d, 0xae, 0x6d, 0x83, 0x82, 0x0b, 0x4d, 0x2e, 0xe8, 0xc2, + 0x2e, 0x20, 0xbc, 0x70, 0x06, 0xbd, 0xc0, 0x54, 0x61, 0x63, 0xb3, 0x6b, + 0x73, 0x49, 0x23, 0x2b, 0x73, 0xa3, 0x9b, 0x12, 0x04, 0x55, 0xc8, 0xf0, + 0x5c, 0xec, 0xca, 0xe4, 0xe6, 0xd2, 0xde, 0xdc, 0xa6, 0x04, 0x44, 0x13, + 0x32, 0x3c, 0x17, 0xbb, 0x30, 0x36, 0xbb, 0x32, 0xb9, 0x29, 0x41, 0x51, + 0x87, 0x0c, 0xcf, 0x65, 0x0e, 0x2d, 0x8c, 0xac, 0x4c, 0xae, 0xe9, 0x8d, + 0xac, 0x8c, 0x6d, 0x4a, 0x80, 0x94, 0x21, 0xc3, 0x73, 0x91, 0x2b, 0x9b, + 0x7b, 0xab, 0x93, 0x1b, 0x2b, 0x9b, 0x9b, 0x12, 0x58, 0x95, 0xc8, 0xf0, + 0x5c, 0xe8, 0xf2, 0xe0, 0xca, 0x82, 0xdc, 0xdc, 0xde, 0xe8, 0xc2, 0xe8, + 0xd2, 0xde, 0xdc, 0xe6, 0xa6, 0x08, 0x78, 0xd0, 0x07, 0x75, 0xc8, 0xf0, + 0x5c, 0xec, 0xd2, 0xca, 0xee, 0x92, 0xc8, 0xa6, 0xe8, 0xc2, 0xe8, 0xca, + 0xa6, 0x04, 0x7f, 0x50, 0x87, 0x0c, 0xcf, 0xa5, 0xcc, 0x8d, 0x4e, 0x2e, + 0x0f, 0xea, 0x2d, 0xcd, 0x8d, 0x6e, 0x6e, 0x4a, 0x60, 0x0b, 0x5d, 0xc8, + 0xf0, 0x5c, 0xc6, 0xde, 0xea, 0xdc, 0xe8, 0xca, 0xe4, 0xe6, 0xa6, 0x04, + 0xbd, 0x00, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x4c, 0x00, 0x00, + 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, + 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, + 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, + 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, + 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, + 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, + 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, + 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, + 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, + 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, + 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, + 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, + 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, + 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, + 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, + 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, + 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, + 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, + 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, + 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, + 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, + 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, + 0xc4, 0x21, 0x07, 0x7c, 0x70, 0x03, 0x7a, 0x28, 0x87, 0x76, 0x80, 0x87, + 0x19, 0xd1, 0x43, 0x0e, 0xf8, 0xe0, 0x06, 0xe4, 0x20, 0x0e, 0xe7, 0xe0, + 0x06, 0xf6, 0x10, 0x0e, 0xf2, 0xc0, 0x0e, 0xe1, 0x90, 0x0f, 0xef, 0x50, + 0x0f, 0xf4, 0x00, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x33, 0x00, 0x00, + 0x00, 0x25, 0xf0, 0x05, 0x7e, 0x74, 0x74, 0x79, 0x1a, 0x6e, 0xc3, 0xd9, + 0x65, 0x39, 0x10, 0x38, 0xab, 0x4e, 0xc3, 0x6d, 0x38, 0xbb, 0x2c, 0x9f, + 0xd2, 0xc3, 0xf4, 0x32, 0x10, 0x18, 0xac, 0x80, 0x38, 0x08, 0xfc, 0xe8, + 0xe8, 0x32, 0xb5, 0x8c, 0xa7, 0xd7, 0xe5, 0xe5, 0xaa, 0x15, 0x08, 0x9c, + 0x59, 0x7f, 0x24, 0x6a, 0x19, 0x4f, 0xaf, 0xcb, 0xcb, 0x32, 0x22, 0xd0, + 0xfa, 0x23, 0xd9, 0xcb, 0x63, 0xfa, 0x5b, 0x0e, 0x6c, 0x92, 0x60, 0x33, + 0x20, 0x10, 0x08, 0x0c, 0x16, 0x00, 0x1c, 0x04, 0x7e, 0x74, 0x74, 0x99, + 0x5a, 0xc6, 0xd3, 0xeb, 0xf2, 0x72, 0x16, 0x08, 0x9c, 0x59, 0x7f, 0x24, + 0x6a, 0x19, 0x4f, 0xaf, 0xcb, 0xcb, 0x32, 0x22, 0xd0, 0xfa, 0x23, 0xd9, + 0xcb, 0x63, 0xfa, 0x5b, 0x0e, 0x6c, 0x92, 0x60, 0x33, 0x20, 0x10, 0x08, + 0x0c, 0x1a, 0x82, 0x34, 0x5c, 0xbe, 0xf3, 0xf8, 0x42, 0x44, 0x00, 0x13, + 0x11, 0x02, 0xcd, 0xb0, 0x10, 0x76, 0xe0, 0x0c, 0x97, 0xef, 0x3c, 0xfe, + 0xe0, 0x4c, 0xb7, 0x5f, 0xdc, 0xb6, 0x11, 0x4c, 0xc3, 0xe5, 0x3b, 0x8f, + 0xbf, 0x38, 0xc0, 0x20, 0x36, 0x0f, 0x35, 0xf9, 0xc5, 0x6d, 0x9b, 0x01, + 0x34, 0x5c, 0xbe, 0xf3, 0xf8, 0x12, 0xc0, 0x3c, 0x0b, 0xe1, 0x17, 0xb7, + 0x6d, 0x05, 0xd5, 0x70, 0xf9, 0xce, 0xe3, 0x4b, 0x93, 0x13, 0x11, 0x28, + 0x35, 0x3d, 0xd4, 0xe4, 0x17, 0xb7, 0x6d, 0x03, 0x04, 0x03, 0x20, 0x0d, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x41, 0x53, 0x48, 0x14, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xf3, 0x33, 0x44, 0x4f, 0x49, 0x10, 0x21, + 0xcb, 0x08, 0xc8, 0x3e, 0x2d, 0x19, 0x9c, 0x34, 0xa7, 0x44, 0x58, 0x49, + 0x4c, 0xb0, 0x07, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xec, 0x01, 0x00, + 0x00, 0x44, 0x58, 0x49, 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x98, 0x07, 0x00, 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, + 0x00, 0xe3, 0x01, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, + 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, + 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, + 0x42, 0xa4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x52, + 0x88, 0x48, 0x90, 0x14, 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, + 0x42, 0xe4, 0x48, 0x0e, 0x90, 0x91, 0x22, 0xc4, 0x50, 0x41, 0x51, 0x81, + 0x8c, 0xe1, 0x83, 0xe5, 0x8a, 0x04, 0x29, 0x46, 0x06, 0x51, 0x18, 0x00, + 0x00, 0x08, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, + 0x07, 0x40, 0x02, 0xa8, 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, + 0x20, 0x6d, 0x30, 0x86, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x09, 0xa8, + 0x00, 0x49, 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, + 0x42, 0x20, 0x4c, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, + 0x00, 0x45, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, + 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, + 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x70, 0x23, + 0x00, 0x25, 0x00, 0x14, 0x66, 0x00, 0xe6, 0x08, 0xc0, 0x60, 0x8e, 0x00, + 0x29, 0xc6, 0x20, 0x84, 0x14, 0x42, 0xa6, 0x18, 0x80, 0x10, 0x52, 0x06, + 0xa1, 0x9b, 0x86, 0xcb, 0x9f, 0xb0, 0x87, 0x90, 0xfc, 0x95, 0x90, 0x56, + 0x62, 0xf2, 0x8b, 0xdb, 0x46, 0xc5, 0x18, 0x63, 0x10, 0x2a, 0xf7, 0x0c, + 0x97, 0x3f, 0x61, 0x0f, 0x21, 0xf9, 0x21, 0xd0, 0x0c, 0x0b, 0x81, 0x82, + 0x55, 0x18, 0x45, 0x18, 0x1b, 0x63, 0x0c, 0x42, 0xc8, 0xa0, 0x56, 0x90, + 0x41, 0xc6, 0x18, 0x63, 0x0c, 0x7a, 0x73, 0x04, 0x41, 0x31, 0x18, 0x29, + 0x84, 0x44, 0x92, 0x03, 0x01, 0xc3, 0x08, 0xc4, 0x30, 0x53, 0x1b, 0x8c, + 0x03, 0x3b, 0x84, 0xc3, 0x3c, 0xcc, 0x83, 0x1b, 0xd0, 0x42, 0x39, 0xe0, + 0x03, 0x3d, 0xd4, 0x83, 0x3c, 0x94, 0x83, 0x1c, 0x90, 0x02, 0x1f, 0xd8, + 0x43, 0x39, 0x8c, 0x03, 0x3d, 0xbc, 0x83, 0x3c, 0xf0, 0x81, 0x39, 0xb0, + 0xc3, 0x3b, 0x84, 0x03, 0x3d, 0xb0, 0x01, 0x18, 0xd0, 0x81, 0x1f, 0x80, + 0x81, 0x1f, 0xe8, 0x81, 0x1e, 0xb4, 0x43, 0x3a, 0xc0, 0xc3, 0x3c, 0xfc, + 0x02, 0x3d, 0xe4, 0x03, 0x3c, 0x94, 0x03, 0x0a, 0xc8, 0x4c, 0x62, 0x30, + 0x0e, 0xec, 0x10, 0x0e, 0xf3, 0x30, 0x0f, 0x6e, 0x40, 0x0b, 0xe5, 0x80, + 0x0f, 0xf4, 0x50, 0x0f, 0xf2, 0x50, 0x0e, 0x72, 0x40, 0x0a, 0x7c, 0x60, + 0x0f, 0xe5, 0x30, 0x0e, 0xf4, 0xf0, 0x0e, 0xf2, 0xc0, 0x07, 0xe6, 0xc0, + 0x0e, 0xef, 0x10, 0x0e, 0xf4, 0xc0, 0x06, 0x60, 0x40, 0x07, 0x7e, 0x00, + 0x06, 0x7e, 0x80, 0x84, 0x6a, 0xe9, 0xde, 0x24, 0x4d, 0x11, 0x25, 0x4c, + 0x3e, 0x0b, 0x30, 0xcf, 0x42, 0x44, 0xec, 0x04, 0x4c, 0x04, 0x0a, 0x08, + 0xe5, 0x74, 0x20, 0x00, 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, + 0x87, 0x36, 0x68, 0x87, 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, 0x0d, 0xaf, + 0x50, 0x0e, 0x6d, 0xd0, 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, + 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, + 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, + 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, + 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, + 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, + 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, + 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x43, + 0x9e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x86, 0x3c, 0x06, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x0c, 0x79, 0x10, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x18, 0xf2, 0x34, 0x40, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x30, 0xe4, 0x79, 0x80, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x60, 0xc8, 0x23, 0x01, 0x01, 0x30, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x16, 0x08, 0x00, 0x0f, 0x00, 0x00, + 0x00, 0x32, 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, + 0x47, 0xc6, 0x04, 0x43, 0x22, 0x25, 0x30, 0x02, 0x50, 0x0c, 0x45, 0x50, + 0x12, 0x65, 0x50, 0x1e, 0x54, 0x4a, 0xa2, 0x0c, 0x0a, 0x61, 0x04, 0xa0, + 0x08, 0x0a, 0x84, 0xf0, 0x0c, 0x00, 0xe9, 0x19, 0x00, 0xda, 0x63, 0x39, + 0x0c, 0x01, 0x00, 0x00, 0x70, 0x1c, 0x00, 0x10, 0x08, 0x04, 0x02, 0x00, + 0x00, 0x79, 0x18, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, + 0x90, 0x46, 0x02, 0x13, 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, 0x3b, 0x03, + 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, 0xb9, 0x01, + 0x41, 0xa1, 0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, 0x0a, 0x9a, + 0x2a, 0xfa, 0x9a, 0xb9, 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, 0x63, 0x4b, + 0xd9, 0x10, 0x04, 0x13, 0x04, 0xc2, 0x98, 0x20, 0x10, 0xc7, 0x06, 0x61, + 0x20, 0x26, 0x08, 0x04, 0xb2, 0x41, 0x18, 0x0c, 0x0a, 0x70, 0x73, 0x1b, + 0x06, 0xc4, 0x20, 0x26, 0x08, 0xd8, 0x44, 0x60, 0x82, 0x40, 0x24, 0x13, + 0x04, 0x42, 0xd9, 0x20, 0x10, 0xcd, 0x86, 0x84, 0x50, 0x16, 0x82, 0x18, + 0x18, 0xc2, 0xd9, 0x90, 0x0c, 0xca, 0x42, 0x0c, 0x03, 0x43, 0x38, 0x1b, + 0x84, 0x07, 0x9a, 0x20, 0x68, 0xd4, 0x06, 0x84, 0x90, 0x16, 0x82, 0x18, + 0x08, 0x60, 0x43, 0x30, 0x6d, 0x20, 0x22, 0x00, 0xa0, 0x26, 0x08, 0x5b, + 0xb5, 0x21, 0xb0, 0x26, 0x08, 0x02, 0x40, 0xa2, 0x2d, 0x2c, 0xcd, 0x8d, + 0xcb, 0x94, 0xd5, 0x17, 0xd4, 0xdb, 0x5c, 0x1a, 0x5d, 0xda, 0x9b, 0xdb, + 0x04, 0xa1, 0x68, 0x26, 0x08, 0x85, 0xb3, 0x21, 0x20, 0x26, 0x08, 0xc5, + 0x33, 0x41, 0x28, 0xa0, 0x0d, 0x0b, 0xa1, 0x6d, 0x5c, 0xe7, 0x0d, 0x1e, + 0xf1, 0x01, 0x44, 0xa8, 0x8a, 0xb0, 0x86, 0x9e, 0x9e, 0xa4, 0x88, 0x26, + 0x08, 0x45, 0x34, 0x41, 0x20, 0x96, 0x0d, 0xc2, 0x18, 0x8c, 0xc1, 0x86, + 0x65, 0x08, 0x83, 0xed, 0xeb, 0xc4, 0x60, 0x10, 0x83, 0xe1, 0x23, 0x03, + 0x16, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x13, 0x04, 0x82, 0xd9, 0x20, 0x8c, + 0xc1, 0x19, 0x6c, 0x58, 0x18, 0x33, 0xd8, 0xbe, 0x4e, 0x0c, 0x06, 0x8f, + 0xf9, 0xd0, 0x60, 0xc3, 0x00, 0x06, 0x65, 0x90, 0x06, 0x4c, 0xa6, 0xac, + 0xbe, 0xa8, 0xc2, 0xe4, 0xce, 0xca, 0xe8, 0x26, 0x08, 0x85, 0xb4, 0x61, + 0x21, 0xd6, 0x60, 0x63, 0x83, 0xee, 0x1b, 0x3c, 0xe2, 0x43, 0x83, 0x0d, + 0x41, 0x1b, 0x6c, 0x18, 0xd4, 0xc0, 0x0d, 0x80, 0x0d, 0x05, 0x96, 0xbd, + 0x41, 0x05, 0x54, 0x61, 0x63, 0xb3, 0x6b, 0x73, 0x49, 0x23, 0x2b, 0x73, + 0xa3, 0x9b, 0x12, 0x04, 0x55, 0xc8, 0xf0, 0x5c, 0xec, 0xca, 0xe4, 0xe6, + 0xd2, 0xde, 0xdc, 0xa6, 0x04, 0x44, 0x13, 0x32, 0x3c, 0x17, 0xbb, 0x30, + 0x36, 0xbb, 0x32, 0xb9, 0x29, 0x81, 0x51, 0x87, 0x0c, 0xcf, 0x65, 0x0e, + 0x2d, 0x8c, 0xac, 0x4c, 0xae, 0xe9, 0x8d, 0xac, 0x8c, 0x6d, 0x4a, 0x80, + 0x94, 0x21, 0xc3, 0x73, 0x91, 0x2b, 0x9b, 0x7b, 0xab, 0x93, 0x1b, 0x2b, + 0x9b, 0x9b, 0x12, 0x50, 0x75, 0xc8, 0xf0, 0x5c, 0xec, 0xd2, 0xca, 0xee, + 0x92, 0xc8, 0xa6, 0xe8, 0xc2, 0xe8, 0xca, 0xa6, 0x04, 0x56, 0x1d, 0x32, + 0x3c, 0x97, 0x32, 0x37, 0x3a, 0xb9, 0x3c, 0xa8, 0xb7, 0x34, 0x37, 0xba, + 0xb9, 0x29, 0xc1, 0x1b, 0x00, 0x79, 0x18, 0x00, 0x00, 0x4c, 0x00, 0x00, + 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, + 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, + 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, + 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, + 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, + 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, + 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, + 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, + 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, + 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, + 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, + 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, + 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, + 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, + 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, + 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, + 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, + 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, + 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, + 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, + 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, + 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, + 0xc4, 0x21, 0x07, 0x7c, 0x70, 0x03, 0x7a, 0x28, 0x87, 0x76, 0x80, 0x87, + 0x19, 0xd1, 0x43, 0x0e, 0xf8, 0xe0, 0x06, 0xe4, 0x20, 0x0e, 0xe7, 0xe0, + 0x06, 0xf6, 0x10, 0x0e, 0xf2, 0xc0, 0x0e, 0xe1, 0x90, 0x0f, 0xef, 0x50, + 0x0f, 0xf4, 0x00, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x15, 0x00, 0x00, + 0x00, 0x56, 0x20, 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x10, 0x11, 0xc0, 0x44, + 0x84, 0x40, 0x33, 0x2c, 0x84, 0x11, 0x38, 0xc3, 0xe5, 0x3b, 0x8f, 0x3f, + 0x38, 0xd3, 0xed, 0x17, 0xb7, 0x6d, 0x01, 0xd3, 0x70, 0xf9, 0xce, 0xe3, + 0x2f, 0x0e, 0x30, 0x88, 0xcd, 0x43, 0x4d, 0x7e, 0x71, 0xdb, 0x36, 0x00, + 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x04, 0x30, 0xcf, 0x42, 0xf8, 0xc5, 0x6d, + 0x9b, 0x40, 0x35, 0x5c, 0xbe, 0xf3, 0xf8, 0xd2, 0xe4, 0x44, 0x04, 0x4a, + 0x4d, 0x0f, 0x35, 0xf9, 0xc5, 0x6d, 0x1b, 0x00, 0xc1, 0x00, 0x48, 0x03, + 0x00, 0x61, 0x20, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, + 0x2c, 0x10, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x14, 0x47, 0x00, + 0xa8, 0x94, 0x00, 0x91, 0xc2, 0x2b, 0xb7, 0x92, 0x2b, 0x85, 0x42, 0x98, + 0x01, 0xa0, 0x31, 0x46, 0x00, 0xb3, 0xac, 0x0b, 0x82, 0xc1, 0x18, 0x81, + 0x18, 0xee, 0x30, 0xfc, 0x0b, 0x63, 0x04, 0x3a, 0x4a, 0xd3, 0xe5, 0x2f, + 0x8c, 0x11, 0xc8, 0x79, 0xaf, 0xfa, 0xdf, 0x18, 0x41, 0x48, 0x82, 0x21, + 0xee, 0x0b, 0x23, 0x00, 0x63, 0x04, 0x21, 0x09, 0x86, 0xf0, 0x2f, 0x8c, + 0x11, 0xbc, 0xb8, 0xa8, 0xe6, 0xdf, 0x0c, 0x00, 0x00, 0x23, 0x06, 0x09, + 0x00, 0x82, 0x60, 0x20, 0x89, 0x41, 0x73, 0x85, 0x41, 0x18, 0x44, 0x23, + 0x06, 0x09, 0x00, 0x82, 0x60, 0x20, 0x8d, 0x81, 0x83, 0x85, 0x41, 0x18, + 0x48, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x20, 0x91, 0xc1, 0xb3, 0x89, + 0x81, 0x18, 0x4c, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0xa4, 0x81, + 0x13, 0x06, 0x63, 0xa0, 0x35, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, + 0xa8, 0xc1, 0x23, 0x06, 0x64, 0x40, 0x39, 0x23, 0x06, 0x09, 0x00, 0x82, + 0x60, 0x60, 0xac, 0x01, 0x34, 0x06, 0x65, 0xb0, 0x3d, 0x23, 0x06, 0x09, + 0x00, 0x82, 0x60, 0x60, 0xb0, 0x41, 0x44, 0x06, 0x66, 0xf0, 0x41, 0x23, + 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0xb4, 0x81, 0x84, 0x06, 0x67, 0xe0, + 0x45, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0xb8, 0xc1, 0x94, 0x06, + 0x68, 0x80, 0x49, 0x23, 0x06, 0x0f, 0x00, 0x82, 0x60, 0xd0, 0xb4, 0x01, + 0x86, 0x1c, 0x42, 0xa0, 0x28, 0x69, 0x90, 0x06, 0x93, 0x32, 0x9a, 0x10, + 0x00, 0x23, 0x06, 0x0f, 0x00, 0x82, 0x60, 0xd0, 0xbc, 0x81, 0xb6, 0x24, + 0xc4, 0xc0, 0x30, 0x6b, 0xb0, 0x06, 0x15, 0x33, 0x9a, 0x10, 0x00, 0xa3, + 0x09, 0x42, 0x60, 0xc4, 0x04, 0x1f, 0x13, 0x24, 0xf8, 0x18, 0x31, 0xc1, + 0x67, 0xc4, 0x60, 0x01, 0x40, 0x10, 0x0c, 0x1e, 0x3a, 0xf8, 0x06, 0x21, + 0x98, 0xaa, 0x6b, 0xc4, 0x60, 0x01, 0x40, 0x10, 0x0c, 0x9e, 0x3a, 0x00, + 0x03, 0x62, 0x10, 0xa8, 0x4c, 0x1b, 0x31, 0x58, 0x00, 0x10, 0x04, 0x83, + 0xc7, 0x0e, 0xc2, 0xa0, 0x20, 0x86, 0x8a, 0xbb, 0x6c, 0x88, 0xe4, 0x63, + 0x43, 0x24, 0x1f, 0x1b, 0x22, 0xf9, 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, + 0x01, 0xc2, 0x07, 0x63, 0x70, 0x07, 0x77, 0xe0, 0x06, 0xc3, 0x88, 0x41, + 0x02, 0x80, 0x20, 0x18, 0x20, 0x7c, 0x30, 0x06, 0x77, 0x70, 0x07, 0x67, + 0x20, 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, 0x01, 0xc2, 0x07, 0x63, 0x70, + 0x07, 0x77, 0xd0, 0x06, 0xc1, 0x88, 0x41, 0x02, 0x80, 0x20, 0x18, 0x20, + 0x7c, 0x30, 0x06, 0x77, 0x70, 0x07, 0x70, 0x10, 0x21, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +/* The sole vertex shader (have to build 4x for different root signatures): + + --- D3D12_VertexShader.hlsl --- + #pragma pack_matrix( row_major ) + + cbuffer VertexShaderConstants : register(b0) + { + matrix model; + matrix projectionAndView; + }; + + struct VertexShaderInput + { + float3 pos : POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + struct VertexShaderOutput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + #define ColorRS \ + "RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \ + "DENY_DOMAIN_SHADER_ROOT_ACCESS |" \ + "DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \ + "DENY_HULL_SHADER_ROOT_ACCESS )," \ + "RootConstants(num32BitConstants=32, b0)" + + #define TextureRS \ + "RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \ + " DENY_DOMAIN_SHADER_ROOT_ACCESS |" \ + " DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \ + " DENY_HULL_SHADER_ROOT_ACCESS )," \ + "RootConstants(num32BitConstants=32, b0),"\ + "DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )" + + #define YUVRS \ + "RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \ + " DENY_DOMAIN_SHADER_ROOT_ACCESS |" \ + " DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \ + " DENY_HULL_SHADER_ROOT_ACCESS )," \ + "RootConstants(num32BitConstants=32, b0),"\ + "DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( SRV(t2), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )" + + #define NVRS \ + "RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \ + " DENY_DOMAIN_SHADER_ROOT_ACCESS |" \ + " DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \ + " DENY_HULL_SHADER_ROOT_ACCESS )," \ + "RootConstants(num32BitConstants=32, b0),"\ + "DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )" + + [RootSignature(ColorRS)] + VertexShaderOutput mainColor(VertexShaderInput input) + { + VertexShaderOutput output; + float4 pos = float4(input.pos, 1.0f); + + // Transform the vertex position into projected space. + pos = mul(pos, model); + pos = mul(pos, projectionAndView); + output.pos = pos; + + // Pass through texture coordinates and color values without transformation + output.tex = input.tex; + output.color = input.color; + + return output; + } + + [RootSignature(TextureRS)] + VertexShaderOutput mainTexture(VertexShaderInput input) + { + return mainColor(input); + } + + [RootSignature(YUVRS)] + VertexShaderOutput mainYUV(VertexShaderInput input) + { + return mainColor(input); + } + + [RootSignature(NVRS)] + VertexShaderOutput mainNV(VertexShaderInput input) + { + return mainColor(input); + } +*/ + +static unsigned char D3D12_VertexShader_Colors[] = { + 0x44, 0x58, 0x42, 0x43, 0xbd, 0x28, 0xdc, 0xb4, 0x40, 0x82, 0x5f, 0xf6, + 0x92, 0x33, 0x60, 0xe7, 0x83, 0x5b, 0x8f, 0x2d, 0x01, 0x00, 0x00, 0x00, + 0xeb, 0x13, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, + 0x50, 0x00, 0x00, 0x00, 0xd8, 0x00, 0x00, 0x00, 0x63, 0x01, 0x00, 0x00, + 0x73, 0x02, 0x00, 0x00, 0xab, 0x02, 0x00, 0x00, 0xa7, 0x0a, 0x00, 0x00, + 0xc3, 0x0a, 0x00, 0x00, 0x53, 0x46, 0x49, 0x30, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x31, + 0x80, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x54, 0x45, 0x58, + 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, + 0x4f, 0x53, 0x47, 0x31, 0x83, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x03, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, + 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x50, 0x53, 0x56, 0x30, 0x08, + 0x01, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x03, + 0x03, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, + 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, + 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x54, 0x45, 0x58, + 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, + 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x43, 0x4f, 0x4c, + 0x4f, 0x52, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x43, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x01, 0x42, 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x44, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x44, 0x03, 0x03, 0x04, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x01, 0x42, 0x00, 0x03, 0x02, 0x00, 0x00, 0x22, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x44, 0x00, 0x03, + 0x02, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x52, 0x54, 0x53, 0x30, 0x30, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x53, + 0x54, 0x41, 0x54, 0xf4, 0x07, 0x00, 0x00, 0x60, 0x00, 0x01, 0x00, 0xfd, + 0x01, 0x00, 0x00, 0x44, 0x58, 0x49, 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, + 0x00, 0x00, 0x00, 0xdc, 0x07, 0x00, 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, + 0x0c, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, + 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, + 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x18, 0x45, 0x02, 0x42, + 0x92, 0x0b, 0x42, 0xc4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, + 0x32, 0x62, 0x88, 0x48, 0x90, 0x14, 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, + 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, 0x90, 0x11, 0x23, 0xc4, 0x50, 0x41, + 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, 0x8a, 0x04, 0x31, 0x46, 0x06, 0x51, + 0x18, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, + 0xff, 0xff, 0x07, 0x40, 0x02, 0xa8, 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, + 0xff, 0x03, 0x20, 0x6d, 0x30, 0x86, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, + 0x09, 0xa8, 0x00, 0x49, 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, + 0x82, 0x60, 0x42, 0x20, 0x4c, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00, 0x89, + 0x20, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x32, 0x22, 0x88, 0x09, 0x20, + 0x64, 0x85, 0x04, 0x13, 0x23, 0xa4, 0x84, 0x04, 0x13, 0x23, 0xe3, 0x84, + 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8c, 0x8c, 0x0b, 0x84, 0xc4, 0x4c, 0x10, + 0x88, 0xc1, 0x0c, 0xc0, 0x30, 0x02, 0x01, 0x24, 0x41, 0x70, 0x70, 0x30, + 0x5c, 0x3e, 0xb0, 0x20, 0x46, 0xc3, 0x10, 0xcd, 0xe4, 0x2f, 0x84, 0x01, + 0x08, 0x98, 0x2f, 0x4d, 0x11, 0x25, 0x4c, 0xfe, 0x4b, 0x44, 0x13, 0x71, + 0xb1, 0x07, 0x30, 0x10, 0x11, 0xe7, 0x34, 0xd2, 0x04, 0x34, 0x93, 0x84, + 0x04, 0x41, 0xb8, 0x6e, 0xb8, 0x7c, 0x60, 0x41, 0x8c, 0x86, 0x21, 0x9a, + 0xc9, 0x5f, 0x08, 0x03, 0x10, 0x30, 0x9f, 0x73, 0x1a, 0x69, 0x02, 0x9a, + 0x49, 0x42, 0xc1, 0x40, 0xc4, 0x08, 0x40, 0x09, 0x0c, 0x3a, 0xe6, 0x08, + 0xc0, 0x60, 0x8e, 0x00, 0x29, 0x06, 0x90, 0x24, 0x89, 0x92, 0xd0, 0x52, + 0x0c, 0x23, 0x49, 0x12, 0x05, 0xa0, 0xe6, 0xa8, 0xe1, 0xf2, 0x27, 0xec, + 0x21, 0x24, 0x9f, 0xdb, 0xa8, 0x62, 0x25, 0x26, 0xbf, 0xb8, 0x6d, 0x44, + 0x00, 0x00, 0x00, 0x90, 0x72, 0xcf, 0x70, 0xf9, 0x13, 0xf6, 0x10, 0x92, + 0x1f, 0x02, 0xcd, 0xb0, 0x10, 0x28, 0x80, 0x0a, 0xf1, 0x24, 0x51, 0x42, + 0x52, 0x29, 0x80, 0x04, 0x00, 0x00, 0xa2, 0xe6, 0x08, 0x82, 0x62, 0x44, + 0x89, 0x92, 0x24, 0x16, 0x5d, 0x03, 0x01, 0x67, 0x09, 0x0b, 0x20, 0x49, + 0x3e, 0x03, 0x4c, 0x11, 0x72, 0xf9, 0xc5, 0xe2, 0x00, 0x93, 0x8f, 0xfb, + 0x38, 0x0a, 0x84, 0xe3, 0xa4, 0x29, 0xa2, 0x84, 0xc9, 0x7f, 0x89, 0x68, + 0x22, 0x2e, 0xf6, 0x00, 0x06, 0x22, 0xe2, 0x9c, 0x46, 0x9a, 0x80, 0x66, + 0x92, 0x90, 0xa0, 0x69, 0xc3, 0x08, 0x02, 0x70, 0x99, 0x34, 0x45, 0x94, + 0x30, 0xf9, 0x2f, 0x11, 0x4d, 0xc4, 0xc5, 0x1e, 0xc0, 0x40, 0x44, 0x28, + 0x35, 0x3d, 0xd4, 0x84, 0x86, 0x80, 0x0b, 0x86, 0x11, 0x06, 0xe0, 0x30, + 0x69, 0x8a, 0x28, 0x61, 0xf2, 0x5f, 0x22, 0x9a, 0x88, 0x8b, 0x3d, 0x80, + 0x81, 0x88, 0xc4, 0xe6, 0xa1, 0x26, 0x34, 0x78, 0x5c, 0x70, 0x09, 0xe7, + 0x34, 0xd2, 0x04, 0x34, 0x93, 0x84, 0x82, 0x2d, 0x1d, 0x12, 0x00, 0x13, + 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, 0x79, 0x68, + 0x03, 0x72, 0xc0, 0x87, 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, 0x0e, 0x7a, + 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, + 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, + 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, + 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, + 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, + 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, + 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0xa0, 0x07, 0x76, 0x40, 0x07, 0x3a, 0x0f, 0x64, 0x90, 0x21, 0x23, 0x25, + 0x40, 0x00, 0x52, 0x00, 0xc0, 0x90, 0xe7, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x21, 0xcf, 0x02, 0x04, 0x40, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x9e, 0x06, 0x08, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x3c, 0x12, 0x10, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x79, 0x28, + 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xf2, + 0x5c, 0x40, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, + 0x05, 0x02, 0x00, 0x19, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x18, 0x19, + 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x52, 0x0a, + 0xa1, 0x08, 0xca, 0x80, 0x92, 0x12, 0x18, 0x01, 0x28, 0x86, 0x02, 0x14, + 0x28, 0x82, 0x42, 0x28, 0x83, 0x72, 0x28, 0x89, 0x02, 0x0c, 0x28, 0xb0, + 0x02, 0x29, 0xa0, 0xf2, 0x28, 0x8c, 0xd2, 0x0d, 0x28, 0x0a, 0x52, 0x4a, + 0x62, 0x04, 0x80, 0x8a, 0x19, 0x00, 0x22, 0x66, 0x00, 0x68, 0x98, 0x01, + 0xa0, 0x6d, 0x06, 0x80, 0xba, 0x19, 0x00, 0xfa, 0x66, 0x00, 0x08, 0x9c, + 0x01, 0xa0, 0x70, 0x2c, 0x87, 0x61, 0x9e, 0xe7, 0x01, 0x20, 0x30, 0x00, + 0x00, 0x10, 0x01, 0x21, 0x10, 0x0c, 0x40, 0x50, 0x00, 0x00, 0x00, 0x79, + 0x18, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, + 0x02, 0x13, 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b, + 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1, + 0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, 0x0a, 0x9a, 0x2a, 0xfa, + 0x9a, 0xb9, 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, 0x63, 0x4b, 0xd9, 0x10, + 0x04, 0x13, 0x84, 0x44, 0x99, 0x20, 0x24, 0xcb, 0x06, 0x61, 0x20, 0x36, + 0x08, 0x04, 0x41, 0xc1, 0x6e, 0x6e, 0x82, 0x90, 0x30, 0x1b, 0x86, 0x03, + 0x21, 0x26, 0x08, 0x45, 0xc7, 0x64, 0xe8, 0xcd, 0x6d, 0x8e, 0x2e, 0xcc, + 0x8d, 0x6e, 0x6e, 0x82, 0x90, 0x34, 0x1b, 0x10, 0x42, 0x59, 0x08, 0x62, + 0x60, 0x80, 0x0d, 0x41, 0xb3, 0x81, 0x00, 0x00, 0x07, 0x98, 0x20, 0x6c, + 0x60, 0xc0, 0xa2, 0xed, 0x8d, 0xac, 0x8c, 0x6d, 0x82, 0x90, 0x38, 0x13, + 0x84, 0xe4, 0xd9, 0x30, 0x4c, 0xd3, 0x30, 0x41, 0x48, 0xa0, 0x09, 0x42, + 0x12, 0x4d, 0x10, 0x12, 0x69, 0x03, 0x82, 0x44, 0x12, 0x55, 0x11, 0xd6, + 0xc5, 0x08, 0x4e, 0xee, 0x4d, 0xad, 0x6c, 0x8c, 0x2e, 0xed, 0xcd, 0x2d, + 0xc8, 0x8d, 0xcc, 0x2a, 0xad, 0xec, 0x6e, 0x82, 0x90, 0x4c, 0x1b, 0x10, + 0x24, 0x93, 0xa8, 0x4a, 0xb3, 0xae, 0x0d, 0x03, 0x83, 0x6d, 0x13, 0x84, + 0x2e, 0x0c, 0x26, 0x08, 0x09, 0xc5, 0x01, 0xee, 0x6d, 0x8e, 0xcb, 0x94, + 0xd5, 0x17, 0xd4, 0xd3, 0x54, 0x12, 0x55, 0xd2, 0x93, 0xd3, 0x06, 0x04, + 0xf9, 0x2a, 0x62, 0x02, 0x03, 0xeb, 0xe2, 0x40, 0x57, 0x86, 0x37, 0x41, + 0x48, 0x2a, 0x26, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x30, + 0x1b, 0x10, 0x44, 0x0c, 0xaa, 0x31, 0x98, 0xc8, 0xc0, 0xba, 0x58, 0x8c, + 0xbd, 0xb1, 0xbd, 0xc9, 0x4d, 0x10, 0x12, 0x8b, 0xc6, 0xd0, 0x13, 0xd3, + 0x93, 0x14, 0xcc, 0x06, 0x04, 0x31, 0x83, 0xea, 0x0c, 0x26, 0x34, 0xb0, + 0xae, 0x0d, 0x84, 0x17, 0x06, 0x65, 0x90, 0x06, 0x13, 0x84, 0x4f, 0x0c, + 0x88, 0x40, 0x3d, 0x4d, 0x25, 0x51, 0x25, 0x3d, 0x39, 0x6d, 0x40, 0x90, + 0xaf, 0x22, 0x26, 0x36, 0xb0, 0xae, 0x0d, 0x84, 0xd7, 0x06, 0x65, 0x90, + 0x06, 0x13, 0x04, 0x30, 0x18, 0x83, 0x0d, 0x04, 0xb2, 0x54, 0xc4, 0x06, + 0x81, 0x81, 0x83, 0x09, 0xc2, 0xf0, 0x4d, 0x10, 0x08, 0x6f, 0x43, 0x43, + 0x40, 0x5c, 0xa7, 0x06, 0x6b, 0xe0, 0x06, 0x6f, 0x10, 0x07, 0x72, 0xc0, + 0xcd, 0x41, 0x1c, 0x4c, 0x10, 0x90, 0x60, 0x03, 0xb0, 0x61, 0x20, 0xec, + 0xc0, 0x0e, 0x36, 0x04, 0x77, 0xb0, 0x61, 0x18, 0xea, 0x00, 0x0f, 0x26, + 0x08, 0x61, 0x40, 0x06, 0x1b, 0x02, 0x3d, 0x60, 0xd2, 0x16, 0x96, 0xe6, + 0x36, 0xf4, 0xc6, 0xf6, 0x26, 0x37, 0x41, 0x50, 0xb6, 0x09, 0x82, 0xc2, + 0x6d, 0x08, 0x88, 0x09, 0x82, 0x92, 0x6c, 0x10, 0x2a, 0x6b, 0xc3, 0x42, + 0xb0, 0x41, 0x1f, 0xf8, 0xc1, 0x1f, 0xf8, 0xc1, 0x00, 0x0a, 0x84, 0x1f, + 0x84, 0x02, 0x11, 0xaa, 0x22, 0xac, 0xa1, 0xa7, 0x27, 0x29, 0xa2, 0x09, + 0x82, 0x82, 0x6c, 0x10, 0xaa, 0x6a, 0xc3, 0x32, 0x8c, 0x42, 0x1f, 0xf8, + 0xc1, 0x1f, 0xf8, 0xc1, 0x40, 0x0a, 0x83, 0x1f, 0x94, 0x02, 0x8b, 0xa1, + 0x27, 0xa6, 0x27, 0xa9, 0x09, 0x82, 0x72, 0x4c, 0x10, 0x92, 0x6b, 0x83, + 0x50, 0xa5, 0xc2, 0x86, 0x45, 0x3a, 0x85, 0x3e, 0xf0, 0x83, 0x3f, 0xf0, + 0x83, 0x01, 0x15, 0x24, 0x3f, 0x50, 0x85, 0x0d, 0x83, 0x28, 0x98, 0xc2, + 0x2a, 0x70, 0x99, 0xb2, 0xfa, 0x82, 0x7a, 0x9b, 0x4b, 0xa3, 0x4b, 0x7b, + 0x73, 0xdb, 0xb0, 0x10, 0xad, 0xd0, 0x07, 0xa0, 0xf0, 0x07, 0xa8, 0x30, + 0xa0, 0x02, 0xe1, 0x07, 0xaa, 0xb0, 0x61, 0x19, 0x46, 0xa1, 0x0f, 0xfc, + 0xe0, 0x0f, 0x48, 0x61, 0x20, 0x85, 0xc1, 0x0f, 0x4a, 0x61, 0xc3, 0x22, + 0x9d, 0x42, 0x1f, 0xf8, 0xc1, 0x1f, 0x90, 0xc2, 0x80, 0x0a, 0x92, 0x1f, + 0xa8, 0xc2, 0x86, 0xc1, 0x15, 0x5e, 0x01, 0x16, 0x36, 0x0c, 0xac, 0x10, + 0x0b, 0xc0, 0x86, 0xa2, 0x0e, 0xf8, 0x40, 0x16, 0x1e, 0x80, 0x86, 0x19, + 0xdb, 0x5b, 0x18, 0xdd, 0xdc, 0x04, 0x21, 0xc1, 0x58, 0xa4, 0xb9, 0xcd, + 0xd1, 0xcd, 0x4d, 0x10, 0x92, 0x8c, 0xc6, 0x5c, 0xda, 0xd9, 0x17, 0x1b, + 0x19, 0x8d, 0xb9, 0xb4, 0xb3, 0xaf, 0x39, 0xba, 0x09, 0x42, 0xa2, 0x6d, + 0x40, 0x68, 0xa1, 0x16, 0x6c, 0xe1, 0x16, 0x70, 0xe1, 0xca, 0x05, 0x5d, + 0xa8, 0xc2, 0xc6, 0x66, 0xd7, 0xe6, 0x92, 0x46, 0x56, 0xe6, 0x46, 0x37, + 0x25, 0x08, 0xaa, 0x90, 0xe1, 0xb9, 0xd8, 0x95, 0xc9, 0xcd, 0xa5, 0xbd, + 0xb9, 0x4d, 0x09, 0x88, 0x26, 0x64, 0x78, 0x2e, 0x76, 0x61, 0x6c, 0x76, + 0x65, 0x72, 0x53, 0x82, 0xa2, 0x0e, 0x19, 0x9e, 0xcb, 0x1c, 0x5a, 0x18, + 0x59, 0x99, 0x5c, 0xd3, 0x1b, 0x59, 0x19, 0xdb, 0x94, 0x00, 0x29, 0x43, + 0x86, 0xe7, 0x22, 0x57, 0x36, 0xf7, 0x56, 0x27, 0x37, 0x56, 0x36, 0x37, + 0x25, 0x70, 0x2a, 0x91, 0xe1, 0xb9, 0xd0, 0xe5, 0xc1, 0x95, 0x05, 0xb9, + 0xb9, 0xbd, 0xd1, 0x85, 0xd1, 0xa5, 0xbd, 0xb9, 0xcd, 0x4d, 0x11, 0xe6, + 0x00, 0x0f, 0xea, 0x90, 0xe1, 0xb9, 0xd8, 0xa5, 0x95, 0xdd, 0x25, 0x91, + 0x4d, 0xd1, 0x85, 0xd1, 0x95, 0x4d, 0x09, 0xf4, 0xa0, 0x0e, 0x19, 0x9e, + 0x4b, 0x99, 0x1b, 0x9d, 0x5c, 0x1e, 0xd4, 0x5b, 0x9a, 0x1b, 0xdd, 0xdc, + 0x94, 0x40, 0x16, 0xba, 0x90, 0xe1, 0xb9, 0x8c, 0xbd, 0xd5, 0xb9, 0xd1, + 0x95, 0xc9, 0xcd, 0x4d, 0x09, 0x74, 0x01, 0x79, 0x18, 0x00, 0x00, 0x49, + 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, + 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, + 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, + 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, + 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, + 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, + 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, + 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, + 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, + 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, + 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, + 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, + 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, + 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, + 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, + 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, + 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, + 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, + 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, + 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, + 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, + 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, + 0xc3, 0x8c, 0xc8, 0x21, 0x07, 0x7c, 0x70, 0x03, 0x72, 0x10, 0x87, 0x73, + 0x70, 0x03, 0x7b, 0x08, 0x07, 0x79, 0x60, 0x87, 0x70, 0xc8, 0x87, 0x77, + 0xa8, 0x07, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x1d, + 0x00, 0x00, 0x00, 0x06, 0x00, 0x71, 0x4e, 0x23, 0x4d, 0x40, 0x33, 0x49, + 0xff, 0x42, 0x18, 0x80, 0x80, 0x19, 0xc1, 0x36, 0x5c, 0xbe, 0xf3, 0xf8, + 0x42, 0x40, 0x15, 0x05, 0x11, 0x95, 0x0e, 0x30, 0x94, 0x84, 0x01, 0x08, + 0x98, 0x5f, 0xdc, 0xb6, 0x19, 0x48, 0xc3, 0xe5, 0x3b, 0x8f, 0x2f, 0x44, + 0x04, 0x30, 0x11, 0x21, 0xd0, 0x0c, 0x0b, 0x61, 0x02, 0xd3, 0x70, 0xf9, + 0xce, 0xe3, 0x2f, 0x0e, 0x30, 0x88, 0xcd, 0x43, 0x4d, 0x7e, 0x71, 0xdb, + 0x36, 0x50, 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x34, 0x39, 0x11, 0x81, 0x52, + 0xd3, 0x43, 0x4d, 0x7e, 0x71, 0xdb, 0x56, 0x20, 0x0d, 0x97, 0xef, 0x3c, + 0xfe, 0x44, 0x44, 0x13, 0x02, 0x44, 0x98, 0x5f, 0xdc, 0xb6, 0x05, 0x24, + 0x0c, 0x80, 0x34, 0x9c, 0xb3, 0x38, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x48, 0x41, 0x53, 0x48, 0x14, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x46, 0x05, 0xa8, 0xdb, 0xf4, 0x51, 0x8f, 0x4d, 0x34, + 0xfb, 0x4e, 0x9d, 0x82, 0x8b, 0x6e, 0x9e, 0x44, 0x58, 0x49, 0x4c, 0x20, + 0x09, 0x00, 0x00, 0x60, 0x00, 0x01, 0x00, 0x48, 0x02, 0x00, 0x00, 0x44, + 0x58, 0x49, 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x08, + 0x09, 0x00, 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0x3f, + 0x02, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, + 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, + 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, + 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, + 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x52, 0x88, 0x48, + 0x90, 0x14, 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, + 0x48, 0x0e, 0x90, 0x91, 0x22, 0xc4, 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, + 0x83, 0xe5, 0x8a, 0x04, 0x29, 0x46, 0x06, 0x51, 0x18, 0x00, 0x00, 0x08, + 0x00, 0x00, 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, + 0x02, 0xa8, 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x20, 0x6d, + 0x30, 0x86, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x09, 0xa8, 0x00, 0x49, + 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, + 0x4c, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x30, + 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04, 0x93, + 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, + 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x6c, 0x23, 0x00, 0x25, + 0x00, 0x14, 0x66, 0x00, 0xe6, 0x08, 0xc0, 0x60, 0x8e, 0x00, 0x29, 0xc6, + 0x20, 0x84, 0x14, 0x42, 0xa6, 0x18, 0x80, 0x10, 0x52, 0x06, 0xa1, 0xa3, + 0x86, 0xcb, 0x9f, 0xb0, 0x87, 0x90, 0x7c, 0x6e, 0xa3, 0x8a, 0x95, 0x98, + 0xfc, 0xe2, 0xb6, 0x11, 0x31, 0xc6, 0x18, 0x54, 0xee, 0x19, 0x2e, 0x7f, + 0xc2, 0x1e, 0x42, 0xf2, 0x43, 0xa0, 0x19, 0x16, 0x02, 0x05, 0xab, 0x10, + 0x8a, 0x30, 0x42, 0xad, 0x14, 0x83, 0x8c, 0x31, 0xe8, 0xcd, 0x11, 0x04, + 0xc5, 0x60, 0xa4, 0x10, 0x12, 0x49, 0x0e, 0x04, 0x0c, 0x23, 0x10, 0x43, + 0x12, 0xd4, 0x83, 0x83, 0xe1, 0xf2, 0x81, 0x05, 0x31, 0x1a, 0x86, 0x68, + 0x26, 0x7f, 0x21, 0x0c, 0x40, 0xc0, 0x7c, 0x69, 0x8a, 0x28, 0x61, 0xf2, + 0x5f, 0x22, 0x9a, 0x88, 0x8b, 0x3d, 0x80, 0x81, 0x88, 0x38, 0xa7, 0x91, + 0x26, 0xa0, 0x99, 0x24, 0x24, 0x58, 0x7b, 0xdd, 0x70, 0xf9, 0xc0, 0x82, + 0x18, 0x0d, 0x43, 0x34, 0x93, 0xbf, 0x10, 0x06, 0x20, 0x60, 0x3e, 0xe7, + 0x34, 0xd2, 0x04, 0x34, 0x93, 0x84, 0x82, 0x4b, 0x38, 0x1d, 0x08, 0x00, + 0x00, 0x00, 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, + 0x68, 0x87, 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, 0x0d, 0xaf, 0x50, 0x0e, + 0x6d, 0xd0, 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, + 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, + 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, 0x20, 0x07, + 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, + 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, + 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x10, 0x07, + 0x76, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, + 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, + 0x76, 0x40, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, + 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x43, 0x9e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x3c, + 0x06, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, + 0x79, 0x10, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0xf2, 0x34, 0x40, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x30, 0xe4, 0x79, 0x80, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x60, 0xc8, 0x23, 0x01, 0x01, 0x30, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x40, 0x16, 0x08, 0x00, 0x10, 0x00, 0x00, 0x00, 0x32, + 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, + 0x04, 0x43, 0x22, 0x25, 0x30, 0x02, 0x50, 0x0c, 0x05, 0x28, 0x50, 0x06, + 0xe5, 0x50, 0x04, 0xe5, 0x41, 0xa5, 0x24, 0x46, 0x00, 0xca, 0xa0, 0x08, + 0x0a, 0x81, 0xf2, 0x0c, 0x00, 0xe9, 0xb1, 0x1c, 0x86, 0x79, 0x9e, 0x07, + 0x80, 0xc0, 0x00, 0x00, 0x40, 0x04, 0x84, 0x40, 0x30, 0x00, 0x41, 0x01, + 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, 0x1a, + 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, + 0x3b, 0x03, 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, + 0xb9, 0x01, 0x41, 0xa1, 0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, + 0x0a, 0x9a, 0x2a, 0xfa, 0x9a, 0xb9, 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, + 0x63, 0x4b, 0xd9, 0x10, 0x04, 0x13, 0x04, 0xc2, 0x98, 0x20, 0x10, 0xc7, + 0x06, 0x61, 0x20, 0x26, 0x08, 0x04, 0xb2, 0x41, 0x18, 0x0c, 0x0a, 0x76, + 0x73, 0x1b, 0x06, 0xc4, 0x20, 0x26, 0x08, 0xd9, 0x44, 0x60, 0x82, 0x40, + 0x24, 0x1b, 0x10, 0x42, 0x59, 0x08, 0x62, 0x60, 0x80, 0x0d, 0x41, 0xb3, + 0x81, 0x00, 0x00, 0x07, 0x98, 0x20, 0x68, 0xd4, 0x86, 0x00, 0x9a, 0x20, + 0x08, 0x00, 0x93, 0xb6, 0xb0, 0x34, 0xb7, 0xa1, 0x37, 0xb6, 0x37, 0x39, + 0x22, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x13, 0x84, 0xc2, + 0x99, 0x20, 0x14, 0xcf, 0x86, 0x80, 0x98, 0x20, 0x14, 0xd0, 0x04, 0x81, + 0x50, 0x26, 0x08, 0xc4, 0xb2, 0x41, 0xc8, 0xb4, 0x0d, 0x0b, 0x41, 0x55, + 0xd6, 0x65, 0x0d, 0x18, 0x61, 0x6d, 0x44, 0xa8, 0x8a, 0xb0, 0x86, 0x9e, + 0x9e, 0xa4, 0x88, 0x26, 0x08, 0x45, 0xb4, 0x41, 0xc8, 0xb2, 0x0d, 0xcb, + 0xd0, 0x55, 0xd6, 0x65, 0x0d, 0xde, 0x60, 0x7d, 0x13, 0x04, 0x82, 0x61, + 0x31, 0xf4, 0xc4, 0xf4, 0x24, 0x35, 0x41, 0x28, 0xa4, 0x09, 0x02, 0xd1, + 0x6c, 0x10, 0x32, 0x32, 0xd8, 0xb0, 0x84, 0x81, 0x18, 0x54, 0xd6, 0x65, + 0x0d, 0x63, 0x10, 0x06, 0x56, 0x19, 0x6c, 0x18, 0x38, 0x30, 0x30, 0x03, + 0x2e, 0x53, 0x56, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x1b, 0x16, 0x02, 0x0d, 0x2a, 0xec, 0x1a, 0x83, 0x61, 0x0c, 0x08, 0xab, + 0x0c, 0x36, 0x2c, 0x43, 0x57, 0x59, 0x97, 0x37, 0x78, 0x83, 0xf5, 0x6d, + 0x58, 0xc2, 0x40, 0x0c, 0x2a, 0xeb, 0xf2, 0x86, 0x31, 0x08, 0x03, 0xab, + 0x0c, 0x36, 0x0c, 0x69, 0xa0, 0x06, 0x6b, 0xb0, 0x61, 0x38, 0x03, 0x36, + 0x00, 0x36, 0x14, 0xd2, 0xd4, 0x06, 0x0f, 0x50, 0x85, 0x8d, 0xcd, 0xae, + 0xcd, 0x25, 0x8d, 0xac, 0xcc, 0x8d, 0x6e, 0x4a, 0x10, 0x54, 0x21, 0xc3, + 0x73, 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x9b, 0x12, 0x10, 0x4d, + 0xc8, 0xf0, 0x5c, 0xec, 0xc2, 0xd8, 0xec, 0xca, 0xe4, 0xa6, 0x04, 0x46, + 0x1d, 0x32, 0x3c, 0x97, 0x39, 0xb4, 0x30, 0xb2, 0x32, 0xb9, 0xa6, 0x37, + 0xb2, 0x32, 0xb6, 0x29, 0x01, 0x52, 0x86, 0x0c, 0xcf, 0x45, 0xae, 0x6c, + 0xee, 0xad, 0x4e, 0x6e, 0xac, 0x6c, 0x6e, 0x4a, 0xe0, 0xd4, 0x21, 0xc3, + 0x73, 0xb1, 0x4b, 0x2b, 0xbb, 0x4b, 0x22, 0x9b, 0xa2, 0x0b, 0xa3, 0x2b, + 0x9b, 0x12, 0x40, 0x75, 0xc8, 0xf0, 0x5c, 0xca, 0xdc, 0xe8, 0xe4, 0xf2, + 0xa0, 0xde, 0xd2, 0xdc, 0xe8, 0xe6, 0xa6, 0x04, 0x6d, 0x00, 0x00, 0x79, + 0x18, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, + 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, + 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, + 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, + 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, + 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, + 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, + 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, + 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, + 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, + 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, + 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, + 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, + 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, + 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, + 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, + 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, + 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, + 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, + 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, + 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, + 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, + 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x8c, 0xc8, 0x21, 0x07, 0x7c, 0x70, 0x03, + 0x72, 0x10, 0x87, 0x73, 0x70, 0x03, 0x7b, 0x08, 0x07, 0x79, 0x60, 0x87, + 0x70, 0xc8, 0x87, 0x77, 0xa8, 0x07, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x71, + 0x20, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x36, 0xb0, 0x0d, 0x97, 0xef, + 0x3c, 0xbe, 0x10, 0x50, 0x45, 0x41, 0x44, 0xa5, 0x03, 0x0c, 0x25, 0x61, + 0x00, 0x02, 0xe6, 0x17, 0xb7, 0x6d, 0x05, 0xd2, 0x70, 0xf9, 0xce, 0xe3, + 0x0b, 0x11, 0x01, 0x4c, 0x44, 0x08, 0x34, 0xc3, 0x42, 0x58, 0xc0, 0x34, + 0x5c, 0xbe, 0xf3, 0xf8, 0x8b, 0x03, 0x0c, 0x62, 0xf3, 0x50, 0x93, 0x5f, + 0xdc, 0xb6, 0x09, 0x54, 0xc3, 0xe5, 0x3b, 0x8f, 0x2f, 0x4d, 0x4e, 0x44, + 0xa0, 0xd4, 0xf4, 0x50, 0x93, 0x5f, 0xdc, 0xb6, 0x11, 0x48, 0xc3, 0xe5, + 0x3b, 0x8f, 0x3f, 0x11, 0xd1, 0x84, 0x00, 0x11, 0xe6, 0x17, 0xb7, 0x6d, + 0x00, 0x09, 0x03, 0x20, 0x0d, 0xe7, 0x2c, 0x4e, 0x04, 0x00, 0x00, 0x61, + 0x20, 0x00, 0x00, 0xcf, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, 0x10, + 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x44, 0x8a, 0xab, 0x14, 0x0a, + 0x61, 0x06, 0xa0, 0xec, 0x4a, 0x8e, 0x4a, 0x09, 0x50, 0x1c, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x20, 0x61, 0x03, + 0x63, 0x59, 0xc1, 0x88, 0x41, 0x02, 0x80, 0x20, 0x18, 0x18, 0xdd, 0x21, + 0x5d, 0x8f, 0x31, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x86, 0x87, 0x4c, + 0x18, 0x71, 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, 0x81, 0xf1, 0x25, 0x54, + 0xf6, 0x20, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0x80, 0x81, 0x52, + 0x69, 0x51, 0x32, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x46, 0x18, 0x2c, + 0xdc, 0x36, 0x29, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0x88, 0x01, + 0xd3, 0x71, 0xc8, 0x32, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0xc6, 0x18, + 0x34, 0x5d, 0x57, 0x31, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0x90, + 0x81, 0xe3, 0x79, 0x4a, 0x33, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x46, + 0x19, 0x3c, 0xdf, 0x57, 0x39, 0x23, 0x06, 0x07, 0x00, 0x82, 0x60, 0xd0, + 0x90, 0x81, 0xa3, 0x80, 0xc1, 0x68, 0x42, 0x00, 0x8c, 0x26, 0x08, 0xc1, + 0x68, 0xc2, 0x20, 0x8c, 0x26, 0x10, 0xc3, 0x88, 0xc1, 0x01, 0x80, 0x20, + 0x18, 0x34, 0x69, 0x30, 0x3d, 0x66, 0x30, 0x9a, 0x10, 0x00, 0xa3, 0x09, + 0x42, 0x30, 0x9a, 0x30, 0x08, 0xa3, 0x09, 0xc4, 0x30, 0x62, 0x70, 0x00, + 0x20, 0x08, 0x06, 0x8d, 0x1b, 0x60, 0x54, 0x19, 0x8c, 0x26, 0x04, 0xc0, + 0x68, 0x82, 0x10, 0x8c, 0x26, 0x0c, 0xc2, 0x68, 0x02, 0x31, 0x8c, 0x18, + 0x1c, 0x00, 0x08, 0x82, 0x41, 0x33, 0x07, 0x5d, 0xc6, 0x06, 0xa3, 0x09, + 0x01, 0x30, 0x9a, 0x20, 0x04, 0xa3, 0x09, 0x83, 0x30, 0x9a, 0x40, 0x0c, + 0x36, 0x5d, 0xf2, 0x19, 0x31, 0x40, 0x00, 0x10, 0x04, 0x83, 0x07, 0x0f, + 0xce, 0xe0, 0x7a, 0x82, 0x11, 0x03, 0x04, 0x00, 0x41, 0x30, 0x78, 0xf2, + 0x00, 0x0d, 0xae, 0x25, 0xb0, 0xe0, 0x80, 0x8e, 0x59, 0x9b, 0x7c, 0x46, + 0x0c, 0x10, 0x00, 0x04, 0xc1, 0xe0, 0xe1, 0x83, 0x35, 0xd8, 0xa4, 0x60, + 0xc4, 0x00, 0x01, 0x40, 0x10, 0x0c, 0x9e, 0x3e, 0x60, 0x83, 0xcd, 0x09, + 0x2c, 0x50, 0xa0, 0x63, 0xd9, 0x27, 0x9f, 0x11, 0x03, 0x04, 0x00, 0x41, + 0x30, 0x78, 0x40, 0xe1, 0x0d, 0xbe, 0x2a, 0x18, 0x31, 0x40, 0x00, 0x10, + 0x04, 0x83, 0x27, 0x14, 0xe0, 0xe0, 0x8b, 0x02, 0x0b, 0x1a, 0xe8, 0x18, + 0x37, 0x06, 0xf2, 0x19, 0x31, 0x40, 0x00, 0x10, 0x04, 0x83, 0x87, 0x14, + 0xe6, 0x60, 0x0c, 0xb0, 0x60, 0xc4, 0x00, 0x01, 0x40, 0x10, 0x0c, 0x9e, + 0x52, 0xa0, 0x83, 0x31, 0xa0, 0x02, 0x0b, 0x20, 0xe8, 0x8c, 0x18, 0x1c, + 0x00, 0x08, 0x82, 0x41, 0x83, 0x0a, 0x72, 0xe0, 0x06, 0x74, 0x30, 0x9a, + 0x10, 0x00, 0xa3, 0x09, 0x42, 0x30, 0x9a, 0x30, 0x08, 0xa3, 0x09, 0xc4, + 0x30, 0x62, 0x70, 0x00, 0x20, 0x08, 0x06, 0x4d, 0x2b, 0xdc, 0xc1, 0x1c, + 0xe8, 0xc1, 0x68, 0x42, 0x00, 0x8c, 0x26, 0x08, 0xc1, 0x68, 0xc2, 0x20, + 0x8c, 0x26, 0x10, 0xc3, 0x88, 0xc1, 0x01, 0x80, 0x20, 0x18, 0x34, 0xb2, + 0xc0, 0x07, 0x78, 0xd0, 0x0a, 0xa3, 0x09, 0x01, 0x30, 0x9a, 0x20, 0x04, + 0xa3, 0x09, 0x83, 0x30, 0x9a, 0x40, 0x0c, 0x23, 0x06, 0x07, 0x00, 0x82, + 0x60, 0xd0, 0xdc, 0x42, 0x28, 0xf4, 0xc1, 0x2b, 0x8c, 0x26, 0x04, 0xc0, + 0x68, 0x82, 0x10, 0x8c, 0x26, 0x0c, 0xc2, 0x68, 0x02, 0x31, 0xd8, 0x14, + 0x06, 0xf2, 0x19, 0x31, 0x40, 0x00, 0x10, 0x04, 0x83, 0x87, 0x17, 0x56, + 0xc1, 0x7b, 0x82, 0x11, 0x03, 0x04, 0x00, 0x41, 0x30, 0x78, 0x7a, 0x81, + 0x15, 0xb6, 0x25, 0x18, 0x31, 0x40, 0x00, 0x10, 0x04, 0x83, 0xc7, 0x17, + 0x5a, 0x01, 0x3b, 0x02, 0xb3, 0xca, 0x40, 0x3e, 0x23, 0x06, 0x08, 0x00, + 0x82, 0x60, 0xf0, 0x80, 0xc3, 0x2b, 0x88, 0x81, 0x14, 0x8c, 0x18, 0x20, + 0x00, 0x08, 0x82, 0xc1, 0x13, 0x0e, 0xb0, 0xf0, 0x39, 0xc1, 0x88, 0x01, + 0x02, 0x80, 0x20, 0x18, 0x3c, 0xe2, 0x10, 0x0b, 0x9c, 0x12, 0x58, 0x96, + 0x06, 0xf2, 0x19, 0x31, 0x40, 0x00, 0x10, 0x04, 0x83, 0x87, 0x1c, 0x66, + 0xc1, 0x0c, 0xaa, 0x60, 0xc4, 0x00, 0x01, 0x40, 0x10, 0x0c, 0x9e, 0x72, + 0xa0, 0x85, 0x31, 0x88, 0x82, 0x11, 0x03, 0x04, 0x00, 0x41, 0x30, 0x78, + 0xcc, 0xa1, 0x16, 0xc0, 0xa0, 0x09, 0x8c, 0x6b, 0x03, 0xf9, 0x8c, 0x18, + 0x20, 0x00, 0x08, 0x82, 0xc1, 0x83, 0x0e, 0xb7, 0xa0, 0x06, 0x58, 0x30, + 0x62, 0x80, 0x00, 0x20, 0x08, 0x06, 0x4f, 0x3a, 0xe0, 0xc2, 0x19, 0x50, + 0xc1, 0x88, 0x01, 0x02, 0x80, 0x20, 0x18, 0x3c, 0xea, 0x90, 0x0b, 0x64, + 0x00, 0x05, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x80, 0xb4, 0x43, 0x2e, + 0xa0, 0x03, 0x3a, 0x80, 0x43, 0x33, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, + 0x48, 0x3b, 0xe4, 0x02, 0x3a, 0xa0, 0x03, 0x2d, 0x24, 0x23, 0x06, 0x09, + 0x00, 0x82, 0x60, 0x80, 0xb4, 0x43, 0x2e, 0xa0, 0x03, 0x3a, 0xf8, 0x42, + 0x31, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x48, 0x3b, 0xe4, 0x02, 0x3a, + 0xa0, 0xc3, 0x2f, 0x04, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x80, 0xb4, + 0x43, 0x2e, 0xa4, 0x03, 0x3a, 0x80, 0x43, 0x2b, 0x8c, 0x18, 0x24, 0x00, + 0x08, 0x82, 0x01, 0xd2, 0x0e, 0xb9, 0x90, 0x0e, 0xe8, 0x40, 0x0b, 0xac, + 0x30, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x48, 0x3b, 0xe4, 0xc2, 0x38, + 0xa0, 0x03, 0x38, 0xc4, 0xc2, 0x88, 0x41, 0x02, 0x80, 0x20, 0x18, 0x20, + 0xed, 0x90, 0x0b, 0xe3, 0x80, 0x0e, 0xb4, 0x00, 0x0b, 0x23, 0x06, 0x09, + 0x00, 0x82, 0x60, 0x80, 0xb4, 0x43, 0x2e, 0x8c, 0x03, 0x3a, 0xf8, 0xc2, + 0x2b, 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, 0x01, 0xd2, 0x0e, 0xb9, 0x30, + 0x0e, 0xe8, 0xf0, 0x0b, 0xae, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static unsigned char D3D12_VertexShader_Textures[] = { + 0x44, 0x58, 0x42, 0x43, 0x64, 0x78, 0x9b, 0xaf, 0x0d, 0x1f, 0x5b, 0x33, + 0xd2, 0x5e, 0x6d, 0x7f, 0x5d, 0x5c, 0xd1, 0x9d, 0x01, 0x00, 0x00, 0x00, + 0x4b, 0x14, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, + 0x50, 0x00, 0x00, 0x00, 0xd8, 0x00, 0x00, 0x00, 0x63, 0x01, 0x00, 0x00, + 0x73, 0x02, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x03, 0x0b, 0x00, 0x00, + 0x1f, 0x0b, 0x00, 0x00, 0x53, 0x46, 0x49, 0x30, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x31, + 0x80, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x54, 0x45, 0x58, + 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, + 0x4f, 0x53, 0x47, 0x31, 0x83, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x03, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, + 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x50, 0x53, 0x56, 0x30, 0x08, + 0x01, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x03, + 0x03, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, + 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, + 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x54, 0x45, 0x58, + 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, + 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x43, 0x4f, 0x4c, + 0x4f, 0x52, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x43, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x01, 0x42, 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x44, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x44, 0x03, 0x03, 0x04, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x01, 0x42, 0x00, 0x03, 0x02, 0x00, 0x00, 0x22, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x44, 0x00, 0x03, + 0x02, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x52, 0x54, 0x53, 0x30, 0x88, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x70, + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, + 0xff, 0xff, 0xff, 0x53, 0x54, 0x41, 0x54, 0xf8, 0x07, 0x00, 0x00, 0x60, + 0x00, 0x01, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x44, 0x58, 0x49, 0x4c, 0x00, + 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x42, + 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0xf5, 0x01, 0x00, 0x00, 0x0b, + 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, + 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, + 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, + 0x18, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xc4, 0x10, 0x32, 0x14, 0x38, + 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x62, 0x88, 0x48, 0x90, 0x14, 0x20, 0x43, + 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, 0x90, 0x11, + 0x23, 0xc4, 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, 0x8a, 0x04, + 0x31, 0x46, 0x06, 0x51, 0x18, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1b, + 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, 0x02, 0xa8, 0x0d, 0x84, + 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x20, 0x6d, 0x30, 0x86, 0xff, 0xff, + 0xff, 0xff, 0x1f, 0x00, 0x09, 0xa8, 0x00, 0x49, 0x18, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, 0x4c, 0x08, 0x06, 0x00, + 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x32, + 0x22, 0x88, 0x09, 0x20, 0x64, 0x85, 0x04, 0x13, 0x23, 0xa4, 0x84, 0x04, + 0x13, 0x23, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8c, 0x8c, 0x0b, + 0x84, 0xc4, 0x4c, 0x10, 0x88, 0xc1, 0x0c, 0xc0, 0x30, 0x02, 0x01, 0x24, + 0x41, 0x70, 0x70, 0x30, 0x5c, 0x3e, 0xb0, 0x20, 0x46, 0xc3, 0x10, 0xcd, + 0xe4, 0x2f, 0x84, 0x01, 0x08, 0x98, 0x2f, 0x4d, 0x11, 0x25, 0x4c, 0xfe, + 0x4b, 0x44, 0x13, 0x71, 0xb1, 0x07, 0x30, 0x10, 0x11, 0xe7, 0x34, 0xd2, + 0x04, 0x34, 0x93, 0x84, 0x04, 0x41, 0xb8, 0x6e, 0xb8, 0x7c, 0x60, 0x41, + 0x8c, 0x86, 0x21, 0x9a, 0xc9, 0x5f, 0x08, 0x03, 0x10, 0x30, 0x9f, 0x73, + 0x1a, 0x69, 0x02, 0x9a, 0x49, 0x42, 0xc1, 0x40, 0xc4, 0x08, 0x40, 0x09, + 0x0c, 0x3a, 0xe6, 0x08, 0xc0, 0x60, 0x8e, 0x00, 0x29, 0x06, 0x90, 0x24, + 0x89, 0x92, 0xd0, 0x52, 0x0c, 0x23, 0x49, 0x12, 0x05, 0xa0, 0xe6, 0xa8, + 0xe1, 0xf2, 0x27, 0xec, 0x21, 0x24, 0x9f, 0xdb, 0xa8, 0x62, 0x25, 0x26, + 0xbf, 0xb8, 0x6d, 0x44, 0x00, 0x00, 0x00, 0x90, 0x72, 0xcf, 0x70, 0xf9, + 0x13, 0xf6, 0x10, 0x92, 0x1f, 0x02, 0xcd, 0xb0, 0x10, 0x28, 0x80, 0x0a, + 0xf1, 0x24, 0x51, 0x42, 0x52, 0x29, 0x80, 0x04, 0x00, 0x00, 0xa2, 0xe6, + 0x08, 0x82, 0x62, 0x44, 0x89, 0x92, 0x24, 0x16, 0x5d, 0x03, 0x01, 0x67, + 0x09, 0x0b, 0x20, 0x49, 0x3e, 0x03, 0x4c, 0x11, 0x72, 0xf9, 0xc5, 0xe2, + 0x00, 0x93, 0x8f, 0xfb, 0x38, 0x0a, 0x84, 0xe3, 0xa4, 0x29, 0xa2, 0x84, + 0xc9, 0x7f, 0x89, 0x68, 0x22, 0x2e, 0xf6, 0x00, 0x06, 0x22, 0xe2, 0x9c, + 0x46, 0x9a, 0x80, 0x66, 0x92, 0x90, 0xa0, 0x69, 0xc3, 0x08, 0x02, 0x70, + 0x99, 0x34, 0x45, 0x94, 0x30, 0xf9, 0x2f, 0x11, 0x4d, 0xc4, 0xc5, 0x1e, + 0xc0, 0x40, 0x44, 0x28, 0x35, 0x3d, 0xd4, 0x84, 0x86, 0x80, 0x0b, 0x86, + 0x11, 0x06, 0xe0, 0x30, 0x69, 0x8a, 0x28, 0x61, 0xf2, 0x5f, 0x22, 0x9a, + 0x88, 0x8b, 0x3d, 0x80, 0x81, 0x88, 0xc4, 0xe6, 0xa1, 0x26, 0x34, 0x78, + 0x5c, 0x70, 0x09, 0xe7, 0x34, 0xd2, 0x04, 0x34, 0x93, 0x84, 0x82, 0x2d, + 0x1d, 0x12, 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, + 0x68, 0x87, 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, 0x0d, 0xaf, 0x50, 0x0e, + 0x6d, 0xd0, 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, + 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, + 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, 0x20, 0x07, + 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, + 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, + 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x10, 0x07, + 0x76, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, + 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, + 0x76, 0x40, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, + 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x3a, 0x0f, 0x64, + 0x90, 0x21, 0x23, 0x25, 0x40, 0x00, 0x52, 0x00, 0xc0, 0x90, 0xe7, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x21, 0xcf, + 0x02, 0x04, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, + 0x9e, 0x06, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x86, 0x3c, 0x12, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x0c, 0x79, 0x28, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x18, 0xf2, 0x5c, 0x40, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x90, 0x05, 0x02, 0x00, 0x19, 0x00, 0x00, 0x00, 0x32, + 0x1e, 0x98, 0x18, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, + 0x04, 0x43, 0x52, 0x0a, 0xa1, 0x08, 0xca, 0x80, 0x92, 0x12, 0x18, 0x01, + 0x28, 0x86, 0x02, 0x14, 0x28, 0x82, 0x42, 0x28, 0x83, 0x72, 0x28, 0x89, + 0x02, 0x0c, 0x28, 0xb0, 0x02, 0x29, 0xa0, 0xf2, 0x28, 0x8c, 0xd2, 0x0d, + 0x28, 0x0a, 0x52, 0x4a, 0x62, 0x04, 0x80, 0x8a, 0x19, 0x00, 0x22, 0x66, + 0x00, 0x68, 0x98, 0x01, 0xa0, 0x6d, 0x06, 0x80, 0xba, 0x19, 0x00, 0xfa, + 0x66, 0x00, 0x08, 0x9c, 0x01, 0xa0, 0x70, 0x2c, 0x87, 0x61, 0x9e, 0xe7, + 0x01, 0x20, 0x30, 0x00, 0x00, 0x10, 0x01, 0x21, 0x10, 0x0c, 0x40, 0x50, + 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0xc1, 0x00, 0x00, 0x00, 0x1a, + 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, + 0x3b, 0x03, 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, + 0xb9, 0x01, 0x41, 0xa1, 0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, + 0x0a, 0x9a, 0x2a, 0xfa, 0x9a, 0xb9, 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, + 0x63, 0x4b, 0xd9, 0x10, 0x04, 0x13, 0x84, 0x44, 0x99, 0x20, 0x24, 0xcb, + 0x06, 0x61, 0x20, 0x36, 0x08, 0x04, 0x41, 0xc1, 0x6e, 0x6e, 0x82, 0x90, + 0x30, 0x1b, 0x86, 0x03, 0x21, 0x26, 0x08, 0x45, 0xc7, 0x64, 0xe8, 0xcd, + 0x6d, 0x8e, 0x2e, 0xcc, 0x8d, 0x6e, 0x6e, 0x82, 0x90, 0x34, 0x1b, 0x10, + 0x42, 0x59, 0x08, 0x62, 0x60, 0x80, 0x0d, 0x41, 0xb3, 0x81, 0x00, 0x00, + 0x07, 0x98, 0x20, 0x6c, 0x60, 0xc0, 0xa2, 0xed, 0x8d, 0xac, 0x8c, 0x6d, + 0x82, 0x90, 0x38, 0x13, 0x84, 0xe4, 0xd9, 0x30, 0x4c, 0xd3, 0x30, 0x41, + 0x48, 0xa0, 0x09, 0x42, 0x12, 0x4d, 0x10, 0x12, 0x69, 0x03, 0x82, 0x44, + 0x12, 0x55, 0x11, 0xd6, 0xc5, 0x08, 0x4e, 0xee, 0x4d, 0xad, 0x6c, 0x8c, + 0x2e, 0xed, 0xcd, 0x2d, 0xc8, 0x8d, 0xcc, 0x2a, 0xad, 0xec, 0x6e, 0x82, + 0x90, 0x4c, 0x1b, 0x10, 0x24, 0x93, 0xa8, 0x4a, 0xb3, 0xae, 0x0d, 0x03, + 0x83, 0x6d, 0x13, 0x84, 0x2e, 0x0c, 0x26, 0x08, 0x09, 0xc5, 0x01, 0xee, + 0x6d, 0x8e, 0xcb, 0x94, 0xd5, 0x17, 0xd4, 0xd3, 0x54, 0x12, 0x55, 0xd2, + 0x93, 0xd3, 0x06, 0x04, 0xf9, 0x2a, 0x62, 0x02, 0x03, 0xeb, 0xe2, 0x40, + 0x57, 0x86, 0x37, 0x41, 0x48, 0x2a, 0x26, 0x54, 0x45, 0x58, 0x43, 0x4f, + 0x4f, 0x52, 0x44, 0x30, 0x1b, 0x10, 0x44, 0x0c, 0xaa, 0x31, 0x98, 0xc8, + 0xc0, 0xba, 0x58, 0x8c, 0xbd, 0xb1, 0xbd, 0xc9, 0x4d, 0x10, 0x12, 0x8b, + 0xc6, 0xd0, 0x13, 0xd3, 0x93, 0x14, 0xcc, 0x06, 0x04, 0x31, 0x83, 0xea, + 0x0c, 0x26, 0x34, 0xb0, 0xae, 0x0d, 0x84, 0x17, 0x06, 0x65, 0x90, 0x06, + 0x13, 0x84, 0x4f, 0x0c, 0x88, 0x40, 0x3d, 0x4d, 0x25, 0x51, 0x25, 0x3d, + 0x39, 0x6d, 0x40, 0x90, 0xaf, 0x22, 0x26, 0x36, 0xb0, 0xae, 0x0d, 0x84, + 0xd7, 0x06, 0x65, 0x90, 0x06, 0x13, 0x04, 0x30, 0x18, 0x83, 0x0d, 0x04, + 0xb2, 0x54, 0xc4, 0x06, 0x81, 0x81, 0x83, 0x09, 0xc2, 0xf0, 0x4d, 0x10, + 0x08, 0x6f, 0x43, 0x43, 0x40, 0x5c, 0xa7, 0x06, 0x6b, 0xe0, 0x06, 0x6f, + 0x10, 0x07, 0x72, 0xc0, 0xcd, 0x41, 0x1c, 0x4c, 0x10, 0x90, 0x60, 0x03, + 0xb0, 0x61, 0x20, 0xec, 0xc0, 0x0e, 0x36, 0x04, 0x77, 0xb0, 0x61, 0x18, + 0xea, 0x00, 0x0f, 0x26, 0x08, 0x61, 0x40, 0x06, 0x1b, 0x02, 0x3d, 0xe0, + 0xd2, 0x16, 0x96, 0xe6, 0x46, 0x55, 0x86, 0x47, 0x57, 0x27, 0x57, 0x36, + 0x41, 0x50, 0xb6, 0x09, 0x82, 0xc2, 0x6d, 0x08, 0x88, 0x09, 0x82, 0x92, + 0x6c, 0x10, 0x2a, 0x6b, 0xc3, 0x42, 0xb0, 0x41, 0x1f, 0xf8, 0xc1, 0x1f, + 0xf8, 0xc1, 0x00, 0x0a, 0x84, 0x1f, 0x84, 0x02, 0x11, 0xaa, 0x22, 0xac, + 0xa1, 0xa7, 0x27, 0x29, 0xa2, 0x09, 0x82, 0x82, 0x6c, 0x10, 0xaa, 0x6a, + 0xc3, 0x32, 0x8c, 0x42, 0x1f, 0xf8, 0xc1, 0x1f, 0xf8, 0xc1, 0x40, 0x0a, + 0x83, 0x1f, 0x94, 0x02, 0x8b, 0xa1, 0x27, 0xa6, 0x27, 0xa9, 0x09, 0x82, + 0x72, 0x4c, 0x10, 0x92, 0x6b, 0x83, 0x50, 0xa5, 0xc2, 0x86, 0x45, 0x3a, + 0x85, 0x3e, 0xf0, 0x83, 0x3f, 0xf0, 0x83, 0x01, 0x15, 0x24, 0x3f, 0x50, + 0x85, 0x0d, 0x83, 0x28, 0x98, 0xc2, 0x2a, 0x70, 0x99, 0xb2, 0xfa, 0x82, + 0x7a, 0x9b, 0x4b, 0xa3, 0x4b, 0x7b, 0x73, 0xdb, 0xb0, 0x10, 0xad, 0xd0, + 0x07, 0xa0, 0xf0, 0x07, 0xa8, 0x30, 0xa0, 0x02, 0xe1, 0x07, 0xaa, 0xb0, + 0x61, 0x19, 0x46, 0xa1, 0x0f, 0xfc, 0xe0, 0x0f, 0x48, 0x61, 0x20, 0x85, + 0xc1, 0x0f, 0x4a, 0x61, 0xc3, 0x22, 0x9d, 0x42, 0x1f, 0xf8, 0xc1, 0x1f, + 0x90, 0xc2, 0x80, 0x0a, 0x92, 0x1f, 0xa8, 0xc2, 0x86, 0xc1, 0x15, 0x5e, + 0x01, 0x16, 0x36, 0x0c, 0xac, 0x10, 0x0b, 0xc0, 0x86, 0xa2, 0x0e, 0xf8, + 0x40, 0x16, 0x1e, 0x80, 0x86, 0x19, 0xdb, 0x5b, 0x18, 0xdd, 0xdc, 0x04, + 0x21, 0xc1, 0x58, 0xa4, 0xb9, 0xcd, 0xd1, 0xcd, 0x4d, 0x10, 0x92, 0x8c, + 0xc6, 0x5c, 0xda, 0xd9, 0x17, 0x1b, 0x19, 0x8d, 0xb9, 0xb4, 0xb3, 0xaf, + 0x39, 0xba, 0x09, 0x42, 0xa2, 0x6d, 0x40, 0x68, 0xa1, 0x16, 0x6c, 0xe1, + 0x16, 0x70, 0xe1, 0xca, 0x05, 0x5d, 0xa8, 0xc2, 0xc6, 0x66, 0xd7, 0xe6, + 0x92, 0x46, 0x56, 0xe6, 0x46, 0x37, 0x25, 0x08, 0xaa, 0x90, 0xe1, 0xb9, + 0xd8, 0x95, 0xc9, 0xcd, 0xa5, 0xbd, 0xb9, 0x4d, 0x09, 0x88, 0x26, 0x64, + 0x78, 0x2e, 0x76, 0x61, 0x6c, 0x76, 0x65, 0x72, 0x53, 0x82, 0xa2, 0x0e, + 0x19, 0x9e, 0xcb, 0x1c, 0x5a, 0x18, 0x59, 0x99, 0x5c, 0xd3, 0x1b, 0x59, + 0x19, 0xdb, 0x94, 0x00, 0x29, 0x43, 0x86, 0xe7, 0x22, 0x57, 0x36, 0xf7, + 0x56, 0x27, 0x37, 0x56, 0x36, 0x37, 0x25, 0x70, 0x2a, 0x91, 0xe1, 0xb9, + 0xd0, 0xe5, 0xc1, 0x95, 0x05, 0xb9, 0xb9, 0xbd, 0xd1, 0x85, 0xd1, 0xa5, + 0xbd, 0xb9, 0xcd, 0x4d, 0x11, 0xe6, 0x00, 0x0f, 0xea, 0x90, 0xe1, 0xb9, + 0xd8, 0xa5, 0x95, 0xdd, 0x25, 0x91, 0x4d, 0xd1, 0x85, 0xd1, 0x95, 0x4d, + 0x09, 0xf4, 0xa0, 0x0e, 0x19, 0x9e, 0x4b, 0x99, 0x1b, 0x9d, 0x5c, 0x1e, + 0xd4, 0x5b, 0x9a, 0x1b, 0xdd, 0xdc, 0x94, 0x40, 0x16, 0xba, 0x90, 0xe1, + 0xb9, 0x8c, 0xbd, 0xd5, 0xb9, 0xd1, 0x95, 0xc9, 0xcd, 0x4d, 0x09, 0x74, + 0x01, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00, 0x33, + 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, + 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, + 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, + 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, + 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, + 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, + 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, + 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, + 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, + 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, + 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, + 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, + 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, + 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, + 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, + 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, + 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, + 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, + 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, + 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, + 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, + 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x8c, 0xc8, 0x21, + 0x07, 0x7c, 0x70, 0x03, 0x72, 0x10, 0x87, 0x73, 0x70, 0x03, 0x7b, 0x08, + 0x07, 0x79, 0x60, 0x87, 0x70, 0xc8, 0x87, 0x77, 0xa8, 0x07, 0x7a, 0x00, + 0x00, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x06, + 0x00, 0x71, 0x4e, 0x23, 0x4d, 0x40, 0x33, 0x49, 0xff, 0x42, 0x18, 0x80, + 0x80, 0x19, 0xc1, 0x36, 0x5c, 0xbe, 0xf3, 0xf8, 0x42, 0x40, 0x15, 0x05, + 0x11, 0x95, 0x0e, 0x30, 0x94, 0x84, 0x01, 0x08, 0x98, 0x5f, 0xdc, 0xb6, + 0x19, 0x48, 0xc3, 0xe5, 0x3b, 0x8f, 0x2f, 0x44, 0x04, 0x30, 0x11, 0x21, + 0xd0, 0x0c, 0x0b, 0x61, 0x02, 0xd3, 0x70, 0xf9, 0xce, 0xe3, 0x2f, 0x0e, + 0x30, 0x88, 0xcd, 0x43, 0x4d, 0x7e, 0x71, 0xdb, 0x36, 0x50, 0x0d, 0x97, + 0xef, 0x3c, 0xbe, 0x34, 0x39, 0x11, 0x81, 0x52, 0xd3, 0x43, 0x4d, 0x7e, + 0x71, 0xdb, 0x56, 0x20, 0x0d, 0x97, 0xef, 0x3c, 0xfe, 0x44, 0x44, 0x13, + 0x02, 0x44, 0x98, 0x5f, 0xdc, 0xb6, 0x05, 0x2c, 0x0c, 0x80, 0x34, 0x2d, + 0x71, 0x4d, 0x54, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, + 0x41, 0x53, 0x48, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, + 0xa0, 0xdd, 0xa0, 0xcf, 0x1a, 0x5f, 0x65, 0x5e, 0xda, 0x32, 0xf3, 0x80, + 0x17, 0x51, 0x70, 0x44, 0x58, 0x49, 0x4c, 0x24, 0x09, 0x00, 0x00, 0x60, + 0x00, 0x01, 0x00, 0x49, 0x02, 0x00, 0x00, 0x44, 0x58, 0x49, 0x4c, 0x00, + 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x0c, 0x09, 0x00, 0x00, 0x42, + 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x0b, + 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, + 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, + 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, + 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, 0x38, + 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x52, 0x88, 0x48, 0x90, 0x14, 0x20, 0x43, + 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, 0x90, 0x91, + 0x22, 0xc4, 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, 0x8a, 0x04, + 0x29, 0x46, 0x06, 0x51, 0x18, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1b, + 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, 0x02, 0xa8, 0x0d, 0x84, + 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x20, 0x6d, 0x30, 0x86, 0xff, 0xff, + 0xff, 0xff, 0x1f, 0x00, 0x09, 0xa8, 0x00, 0x49, 0x18, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, 0x4c, 0x08, 0x06, 0x00, + 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x32, + 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, + 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, + 0x84, 0xa4, 0x4c, 0x10, 0x6c, 0x23, 0x00, 0x25, 0x00, 0x14, 0x66, 0x00, + 0xe6, 0x08, 0xc0, 0x60, 0x8e, 0x00, 0x29, 0xc6, 0x20, 0x84, 0x14, 0x42, + 0xa6, 0x18, 0x80, 0x10, 0x52, 0x06, 0xa1, 0xa3, 0x86, 0xcb, 0x9f, 0xb0, + 0x87, 0x90, 0x7c, 0x6e, 0xa3, 0x8a, 0x95, 0x98, 0xfc, 0xe2, 0xb6, 0x11, + 0x31, 0xc6, 0x18, 0x54, 0xee, 0x19, 0x2e, 0x7f, 0xc2, 0x1e, 0x42, 0xf2, + 0x43, 0xa0, 0x19, 0x16, 0x02, 0x05, 0xab, 0x10, 0x8a, 0x30, 0x42, 0xad, + 0x14, 0x83, 0x8c, 0x31, 0xe8, 0xcd, 0x11, 0x04, 0xc5, 0x60, 0xa4, 0x10, + 0x12, 0x49, 0x0e, 0x04, 0x0c, 0x23, 0x10, 0x43, 0x12, 0xd4, 0x83, 0x83, + 0xe1, 0xf2, 0x81, 0x05, 0x31, 0x1a, 0x86, 0x68, 0x26, 0x7f, 0x21, 0x0c, + 0x40, 0xc0, 0x7c, 0x69, 0x8a, 0x28, 0x61, 0xf2, 0x5f, 0x22, 0x9a, 0x88, + 0x8b, 0x3d, 0x80, 0x81, 0x88, 0x38, 0xa7, 0x91, 0x26, 0xa0, 0x99, 0x24, + 0x24, 0x58, 0x7b, 0xdd, 0x70, 0xf9, 0xc0, 0x82, 0x18, 0x0d, 0x43, 0x34, + 0x93, 0xbf, 0x10, 0x06, 0x20, 0x60, 0x3e, 0xe7, 0x34, 0xd2, 0x04, 0x34, + 0x93, 0x84, 0x82, 0x4b, 0x38, 0x1d, 0x08, 0x00, 0x00, 0x00, 0x00, 0x13, + 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, 0x79, 0x68, + 0x03, 0x72, 0xc0, 0x87, 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, 0x0e, 0x7a, + 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, + 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, + 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, + 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, + 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, + 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, + 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0xa0, 0x07, 0x76, 0x40, 0x07, 0x43, 0x9e, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x3c, 0x06, 0x10, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x79, 0x10, 0x20, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xf2, 0x34, 0x40, + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xe4, 0x79, + 0x80, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xc8, + 0x23, 0x01, 0x01, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, + 0x16, 0x08, 0x00, 0x10, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x14, 0x19, + 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x22, 0x25, + 0x30, 0x02, 0x50, 0x0c, 0x05, 0x28, 0x50, 0x06, 0xe5, 0x50, 0x04, 0xe5, + 0x41, 0xa5, 0x24, 0x46, 0x00, 0xca, 0xa0, 0x08, 0x0a, 0x81, 0xf2, 0x0c, + 0x00, 0xe9, 0xb1, 0x1c, 0x86, 0x79, 0x9e, 0x07, 0x80, 0xc0, 0x00, 0x00, + 0x40, 0x04, 0x84, 0x40, 0x30, 0x00, 0x41, 0x01, 0x00, 0x00, 0x00, 0x79, + 0x18, 0x00, 0x00, 0x67, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, + 0x02, 0x13, 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b, + 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1, + 0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, 0x0a, 0x9a, 0x2a, 0xfa, + 0x9a, 0xb9, 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, 0x63, 0x4b, 0xd9, 0x10, + 0x04, 0x13, 0x04, 0xc2, 0x98, 0x20, 0x10, 0xc7, 0x06, 0x61, 0x20, 0x26, + 0x08, 0x04, 0xb2, 0x41, 0x18, 0x0c, 0x0a, 0x76, 0x73, 0x1b, 0x06, 0xc4, + 0x20, 0x26, 0x08, 0xd9, 0x44, 0x60, 0x82, 0x40, 0x24, 0x1b, 0x10, 0x42, + 0x59, 0x08, 0x62, 0x60, 0x80, 0x0d, 0x41, 0xb3, 0x81, 0x00, 0x00, 0x07, + 0x98, 0x20, 0x68, 0xd4, 0x86, 0x00, 0x9a, 0x20, 0x08, 0x00, 0x97, 0xb6, + 0xb0, 0x34, 0x37, 0xaa, 0x32, 0x3c, 0xba, 0x3a, 0xb9, 0x32, 0x22, 0x50, + 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x13, 0x84, 0xc2, 0x99, 0x20, + 0x14, 0xcf, 0x86, 0x80, 0x98, 0x20, 0x14, 0xd0, 0x04, 0x81, 0x50, 0x26, + 0x08, 0xc4, 0xb2, 0x41, 0xc8, 0xb4, 0x0d, 0x0b, 0x41, 0x55, 0xd6, 0x65, + 0x0d, 0x18, 0x61, 0x6d, 0x44, 0xa8, 0x8a, 0xb0, 0x86, 0x9e, 0x9e, 0xa4, + 0x88, 0x26, 0x08, 0x45, 0xb4, 0x41, 0xc8, 0xb2, 0x0d, 0xcb, 0xd0, 0x55, + 0xd6, 0x65, 0x0d, 0xde, 0x60, 0x7d, 0x13, 0x04, 0x82, 0x61, 0x31, 0xf4, + 0xc4, 0xf4, 0x24, 0x35, 0x41, 0x28, 0xa4, 0x09, 0x02, 0xd1, 0x6c, 0x10, + 0x32, 0x32, 0xd8, 0xb0, 0x84, 0x81, 0x18, 0x54, 0xd6, 0x65, 0x0d, 0x63, + 0x10, 0x06, 0x56, 0x19, 0x6c, 0x18, 0x38, 0x30, 0x30, 0x03, 0x2e, 0x53, + 0x56, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x1b, 0x16, + 0x02, 0x0d, 0x2a, 0xec, 0x1a, 0x83, 0x61, 0x0c, 0x08, 0xab, 0x0c, 0x36, + 0x2c, 0x43, 0x57, 0x59, 0x97, 0x37, 0x78, 0x83, 0xf5, 0x6d, 0x58, 0xc2, + 0x40, 0x0c, 0x2a, 0xeb, 0xf2, 0x86, 0x31, 0x08, 0x03, 0xab, 0x0c, 0x36, + 0x0c, 0x69, 0xa0, 0x06, 0x6b, 0xb0, 0x61, 0x38, 0x03, 0x36, 0x00, 0x36, + 0x14, 0xd2, 0xd4, 0x06, 0x0f, 0x50, 0x85, 0x8d, 0xcd, 0xae, 0xcd, 0x25, + 0x8d, 0xac, 0xcc, 0x8d, 0x6e, 0x4a, 0x10, 0x54, 0x21, 0xc3, 0x73, 0xb1, + 0x2b, 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x9b, 0x12, 0x10, 0x4d, 0xc8, 0xf0, + 0x5c, 0xec, 0xc2, 0xd8, 0xec, 0xca, 0xe4, 0xa6, 0x04, 0x46, 0x1d, 0x32, + 0x3c, 0x97, 0x39, 0xb4, 0x30, 0xb2, 0x32, 0xb9, 0xa6, 0x37, 0xb2, 0x32, + 0xb6, 0x29, 0x01, 0x52, 0x86, 0x0c, 0xcf, 0x45, 0xae, 0x6c, 0xee, 0xad, + 0x4e, 0x6e, 0xac, 0x6c, 0x6e, 0x4a, 0xe0, 0xd4, 0x21, 0xc3, 0x73, 0xb1, + 0x4b, 0x2b, 0xbb, 0x4b, 0x22, 0x9b, 0xa2, 0x0b, 0xa3, 0x2b, 0x9b, 0x12, + 0x40, 0x75, 0xc8, 0xf0, 0x5c, 0xca, 0xdc, 0xe8, 0xe4, 0xf2, 0xa0, 0xde, + 0xd2, 0xdc, 0xe8, 0xe6, 0xa6, 0x04, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x79, + 0x18, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, + 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, + 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, + 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, + 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, + 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, + 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, + 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, + 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, + 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, + 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, + 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, + 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, + 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, + 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, + 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, + 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, + 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, + 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, + 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, + 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, + 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, + 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x8c, 0xc8, 0x21, 0x07, 0x7c, 0x70, 0x03, + 0x72, 0x10, 0x87, 0x73, 0x70, 0x03, 0x7b, 0x08, 0x07, 0x79, 0x60, 0x87, + 0x70, 0xc8, 0x87, 0x77, 0xa8, 0x07, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x71, + 0x20, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x36, 0xb0, 0x0d, 0x97, 0xef, + 0x3c, 0xbe, 0x10, 0x50, 0x45, 0x41, 0x44, 0xa5, 0x03, 0x0c, 0x25, 0x61, + 0x00, 0x02, 0xe6, 0x17, 0xb7, 0x6d, 0x05, 0xd2, 0x70, 0xf9, 0xce, 0xe3, + 0x0b, 0x11, 0x01, 0x4c, 0x44, 0x08, 0x34, 0xc3, 0x42, 0x58, 0xc0, 0x34, + 0x5c, 0xbe, 0xf3, 0xf8, 0x8b, 0x03, 0x0c, 0x62, 0xf3, 0x50, 0x93, 0x5f, + 0xdc, 0xb6, 0x09, 0x54, 0xc3, 0xe5, 0x3b, 0x8f, 0x2f, 0x4d, 0x4e, 0x44, + 0xa0, 0xd4, 0xf4, 0x50, 0x93, 0x5f, 0xdc, 0xb6, 0x11, 0x48, 0xc3, 0xe5, + 0x3b, 0x8f, 0x3f, 0x11, 0xd1, 0x84, 0x00, 0x11, 0xe6, 0x17, 0xb7, 0x6d, + 0x00, 0x0b, 0x03, 0x20, 0x4d, 0x4b, 0x5c, 0x13, 0x15, 0x11, 0x00, 0x61, + 0x20, 0x00, 0x00, 0xcf, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, 0x10, + 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x44, 0x8a, 0xab, 0x14, 0x0a, + 0x61, 0x06, 0xa0, 0xec, 0x4a, 0x8e, 0x4a, 0x09, 0x50, 0x1c, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x20, 0x61, 0x03, + 0x63, 0x59, 0xc1, 0x88, 0x41, 0x02, 0x80, 0x20, 0x18, 0x18, 0xdd, 0x21, + 0x5d, 0x8f, 0x31, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x86, 0x87, 0x4c, + 0x18, 0x71, 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, 0x81, 0xf1, 0x25, 0x54, + 0xf6, 0x20, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0x80, 0x81, 0x52, + 0x69, 0x51, 0x32, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x46, 0x18, 0x2c, + 0xdc, 0x36, 0x29, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0x88, 0x01, + 0xd3, 0x71, 0xc8, 0x32, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0xc6, 0x18, + 0x34, 0x5d, 0x57, 0x31, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0x90, + 0x81, 0xe3, 0x79, 0x4a, 0x33, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x46, + 0x19, 0x3c, 0xdf, 0x57, 0x39, 0x23, 0x06, 0x07, 0x00, 0x82, 0x60, 0xd0, + 0x90, 0x81, 0xa3, 0x80, 0xc1, 0x68, 0x42, 0x00, 0x8c, 0x26, 0x08, 0xc1, + 0x68, 0xc2, 0x20, 0x8c, 0x26, 0x10, 0xc3, 0x88, 0xc1, 0x01, 0x80, 0x20, + 0x18, 0x34, 0x69, 0x30, 0x3d, 0x66, 0x30, 0x9a, 0x10, 0x00, 0xa3, 0x09, + 0x42, 0x30, 0x9a, 0x30, 0x08, 0xa3, 0x09, 0xc4, 0x30, 0x62, 0x70, 0x00, + 0x20, 0x08, 0x06, 0x8d, 0x1b, 0x60, 0x54, 0x19, 0x8c, 0x26, 0x04, 0xc0, + 0x68, 0x82, 0x10, 0x8c, 0x26, 0x0c, 0xc2, 0x68, 0x02, 0x31, 0x8c, 0x18, + 0x1c, 0x00, 0x08, 0x82, 0x41, 0x33, 0x07, 0x5d, 0xc6, 0x06, 0xa3, 0x09, + 0x01, 0x30, 0x9a, 0x20, 0x04, 0xa3, 0x09, 0x83, 0x30, 0x9a, 0x40, 0x0c, + 0x36, 0x5d, 0xf2, 0x19, 0x31, 0x40, 0x00, 0x10, 0x04, 0x83, 0x07, 0x0f, + 0xce, 0xe0, 0x7a, 0x82, 0x11, 0x03, 0x04, 0x00, 0x41, 0x30, 0x78, 0xf2, + 0x00, 0x0d, 0xae, 0x25, 0xb0, 0xe0, 0x80, 0x8e, 0x59, 0x9b, 0x7c, 0x46, + 0x0c, 0x10, 0x00, 0x04, 0xc1, 0xe0, 0xe1, 0x83, 0x35, 0xd8, 0xa4, 0x60, + 0xc4, 0x00, 0x01, 0x40, 0x10, 0x0c, 0x9e, 0x3e, 0x60, 0x83, 0xcd, 0x09, + 0x2c, 0x50, 0xa0, 0x63, 0xd9, 0x27, 0x9f, 0x11, 0x03, 0x04, 0x00, 0x41, + 0x30, 0x78, 0x40, 0xe1, 0x0d, 0xbe, 0x2a, 0x18, 0x31, 0x40, 0x00, 0x10, + 0x04, 0x83, 0x27, 0x14, 0xe0, 0xe0, 0x8b, 0x02, 0x0b, 0x1a, 0xe8, 0x18, + 0x37, 0x06, 0xf2, 0x19, 0x31, 0x40, 0x00, 0x10, 0x04, 0x83, 0x87, 0x14, + 0xe6, 0x60, 0x0c, 0xb0, 0x60, 0xc4, 0x00, 0x01, 0x40, 0x10, 0x0c, 0x9e, + 0x52, 0xa0, 0x83, 0x31, 0xa0, 0x02, 0x0b, 0x20, 0xe8, 0x8c, 0x18, 0x1c, + 0x00, 0x08, 0x82, 0x41, 0x83, 0x0a, 0x72, 0xe0, 0x06, 0x74, 0x30, 0x9a, + 0x10, 0x00, 0xa3, 0x09, 0x42, 0x30, 0x9a, 0x30, 0x08, 0xa3, 0x09, 0xc4, + 0x30, 0x62, 0x70, 0x00, 0x20, 0x08, 0x06, 0x4d, 0x2b, 0xdc, 0xc1, 0x1c, + 0xe8, 0xc1, 0x68, 0x42, 0x00, 0x8c, 0x26, 0x08, 0xc1, 0x68, 0xc2, 0x20, + 0x8c, 0x26, 0x10, 0xc3, 0x88, 0xc1, 0x01, 0x80, 0x20, 0x18, 0x34, 0xb2, + 0xc0, 0x07, 0x78, 0xd0, 0x0a, 0xa3, 0x09, 0x01, 0x30, 0x9a, 0x20, 0x04, + 0xa3, 0x09, 0x83, 0x30, 0x9a, 0x40, 0x0c, 0x23, 0x06, 0x07, 0x00, 0x82, + 0x60, 0xd0, 0xdc, 0x42, 0x28, 0xf4, 0xc1, 0x2b, 0x8c, 0x26, 0x04, 0xc0, + 0x68, 0x82, 0x10, 0x8c, 0x26, 0x0c, 0xc2, 0x68, 0x02, 0x31, 0xd8, 0x14, + 0x06, 0xf2, 0x19, 0x31, 0x40, 0x00, 0x10, 0x04, 0x83, 0x87, 0x17, 0x56, + 0xc1, 0x7b, 0x82, 0x11, 0x03, 0x04, 0x00, 0x41, 0x30, 0x78, 0x7a, 0x81, + 0x15, 0xb6, 0x25, 0x18, 0x31, 0x40, 0x00, 0x10, 0x04, 0x83, 0xc7, 0x17, + 0x5a, 0x01, 0x3b, 0x02, 0xb3, 0xca, 0x40, 0x3e, 0x23, 0x06, 0x08, 0x00, + 0x82, 0x60, 0xf0, 0x80, 0xc3, 0x2b, 0x88, 0x81, 0x14, 0x8c, 0x18, 0x20, + 0x00, 0x08, 0x82, 0xc1, 0x13, 0x0e, 0xb0, 0xf0, 0x39, 0xc1, 0x88, 0x01, + 0x02, 0x80, 0x20, 0x18, 0x3c, 0xe2, 0x10, 0x0b, 0x9c, 0x12, 0x58, 0x96, + 0x06, 0xf2, 0x19, 0x31, 0x40, 0x00, 0x10, 0x04, 0x83, 0x87, 0x1c, 0x66, + 0xc1, 0x0c, 0xaa, 0x60, 0xc4, 0x00, 0x01, 0x40, 0x10, 0x0c, 0x9e, 0x72, + 0xa0, 0x85, 0x31, 0x88, 0x82, 0x11, 0x03, 0x04, 0x00, 0x41, 0x30, 0x78, + 0xcc, 0xa1, 0x16, 0xc0, 0xa0, 0x09, 0x8c, 0x6b, 0x03, 0xf9, 0x8c, 0x18, + 0x20, 0x00, 0x08, 0x82, 0xc1, 0x83, 0x0e, 0xb7, 0xa0, 0x06, 0x58, 0x30, + 0x62, 0x80, 0x00, 0x20, 0x08, 0x06, 0x4f, 0x3a, 0xe0, 0xc2, 0x19, 0x50, + 0xc1, 0x88, 0x01, 0x02, 0x80, 0x20, 0x18, 0x3c, 0xea, 0x90, 0x0b, 0x64, + 0x00, 0x05, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x80, 0xb4, 0x43, 0x2e, + 0xa0, 0x03, 0x3a, 0x80, 0x43, 0x33, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, + 0x48, 0x3b, 0xe4, 0x02, 0x3a, 0xa0, 0x03, 0x2d, 0x24, 0x23, 0x06, 0x09, + 0x00, 0x82, 0x60, 0x80, 0xb4, 0x43, 0x2e, 0xa0, 0x03, 0x3a, 0xf8, 0x42, + 0x31, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x48, 0x3b, 0xe4, 0x02, 0x3a, + 0xa0, 0xc3, 0x2f, 0x04, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x80, 0xb4, + 0x43, 0x2e, 0xa4, 0x03, 0x3a, 0x80, 0x43, 0x2b, 0x8c, 0x18, 0x24, 0x00, + 0x08, 0x82, 0x01, 0xd2, 0x0e, 0xb9, 0x90, 0x0e, 0xe8, 0x40, 0x0b, 0xac, + 0x30, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x48, 0x3b, 0xe4, 0xc2, 0x38, + 0xa0, 0x03, 0x38, 0xc4, 0xc2, 0x88, 0x41, 0x02, 0x80, 0x20, 0x18, 0x20, + 0xed, 0x90, 0x0b, 0xe3, 0x80, 0x0e, 0xb4, 0x00, 0x0b, 0x23, 0x06, 0x09, + 0x00, 0x82, 0x60, 0x80, 0xb4, 0x43, 0x2e, 0x8c, 0x03, 0x3a, 0xf8, 0xc2, + 0x2b, 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, 0x01, 0xd2, 0x0e, 0xb9, 0x30, + 0x0e, 0xe8, 0xf0, 0x0b, 0xae, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static unsigned char D3D12_VertexShader_YUV[] = { + 0x44, 0x58, 0x42, 0x43, 0xec, 0x10, 0x35, 0x4f, 0x25, 0x8f, 0xde, 0xa0, + 0xad, 0x2c, 0x2c, 0xb7, 0x5e, 0xd4, 0x57, 0xdd, 0x01, 0x00, 0x00, 0x00, + 0x97, 0x14, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, + 0x50, 0x00, 0x00, 0x00, 0xd8, 0x00, 0x00, 0x00, 0x63, 0x01, 0x00, 0x00, + 0x73, 0x02, 0x00, 0x00, 0x5b, 0x03, 0x00, 0x00, 0x53, 0x0b, 0x00, 0x00, + 0x6f, 0x0b, 0x00, 0x00, 0x53, 0x46, 0x49, 0x30, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x31, + 0x80, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x54, 0x45, 0x58, + 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, + 0x4f, 0x53, 0x47, 0x31, 0x83, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x03, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, + 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x50, 0x53, 0x56, 0x30, 0x08, + 0x01, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x03, + 0x03, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, + 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, + 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x54, 0x45, 0x58, + 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, + 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x43, 0x4f, 0x4c, + 0x4f, 0x52, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x43, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x01, 0x42, 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x44, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x44, 0x03, 0x03, 0x04, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x01, 0x42, 0x00, 0x03, 0x02, 0x00, 0x00, 0x22, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x44, 0x00, 0x03, + 0x02, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x52, 0x54, 0x53, 0x30, 0xe0, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x88, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, + 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, + 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x53, 0x54, 0x41, 0x54, 0xf0, + 0x07, 0x00, 0x00, 0x60, 0x00, 0x01, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x44, + 0x58, 0x49, 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xd8, + 0x07, 0x00, 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0xf3, + 0x01, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, + 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, + 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, + 0x04, 0x8b, 0x62, 0x80, 0x18, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xc4, + 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x62, 0x88, 0x48, + 0x90, 0x14, 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, + 0x48, 0x0e, 0x90, 0x11, 0x23, 0xc4, 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, + 0x83, 0xe5, 0x8a, 0x04, 0x31, 0x46, 0x06, 0x51, 0x18, 0x00, 0x00, 0x08, + 0x00, 0x00, 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, + 0x02, 0xa8, 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x20, 0x6d, + 0x30, 0x86, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x09, 0xa8, 0x00, 0x49, + 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, + 0x4c, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x4c, + 0x00, 0x00, 0x00, 0x32, 0x22, 0x88, 0x09, 0x20, 0x64, 0x85, 0x04, 0x13, + 0x23, 0xa4, 0x84, 0x04, 0x13, 0x23, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, + 0x4c, 0x8c, 0x8c, 0x0b, 0x84, 0xc4, 0x4c, 0x10, 0x88, 0xc1, 0x0c, 0xc0, + 0x30, 0x02, 0x01, 0x24, 0x41, 0x70, 0x70, 0x30, 0x5c, 0x3e, 0xb0, 0x20, + 0x46, 0xc3, 0x10, 0xcd, 0xe4, 0x2f, 0x84, 0x01, 0x08, 0x98, 0x2f, 0x4d, + 0x11, 0x25, 0x4c, 0xfe, 0x4b, 0x44, 0x13, 0x71, 0xb1, 0x07, 0x30, 0x10, + 0x11, 0xe7, 0x34, 0xd2, 0x04, 0x34, 0x93, 0x84, 0x04, 0x41, 0xb8, 0x6e, + 0xb8, 0x7c, 0x60, 0x41, 0x8c, 0x86, 0x21, 0x9a, 0xc9, 0x5f, 0x08, 0x03, + 0x10, 0x30, 0x9f, 0x73, 0x1a, 0x69, 0x02, 0x9a, 0x49, 0x42, 0xc1, 0x40, + 0xc4, 0x08, 0x40, 0x09, 0x0c, 0x3a, 0xe6, 0x08, 0xc0, 0x60, 0x8e, 0x00, + 0x29, 0x06, 0x90, 0x24, 0x89, 0x92, 0xd0, 0x52, 0x0c, 0x23, 0x49, 0x12, + 0x05, 0xa0, 0xe6, 0xa8, 0xe1, 0xf2, 0x27, 0xec, 0x21, 0x24, 0x9f, 0xdb, + 0xa8, 0x62, 0x25, 0x26, 0xbf, 0xb8, 0x6d, 0x44, 0x00, 0x00, 0x00, 0x90, + 0x72, 0xcf, 0x70, 0xf9, 0x13, 0xf6, 0x10, 0x92, 0x1f, 0x02, 0xcd, 0xb0, + 0x10, 0x28, 0x80, 0x0a, 0xf1, 0x24, 0x51, 0x42, 0x52, 0x29, 0x80, 0x04, + 0x00, 0x00, 0xa2, 0xe6, 0x08, 0x82, 0x62, 0x44, 0x89, 0x92, 0x24, 0x16, + 0x5d, 0x03, 0x01, 0x67, 0x09, 0x0b, 0x20, 0x49, 0x3e, 0x03, 0x4c, 0x11, + 0x72, 0xf9, 0xc5, 0xe2, 0x00, 0x93, 0x8f, 0xfb, 0x38, 0x0a, 0x84, 0xe3, + 0xa4, 0x29, 0xa2, 0x84, 0xc9, 0x7f, 0x89, 0x68, 0x22, 0x2e, 0xf6, 0x00, + 0x06, 0x22, 0xe2, 0x9c, 0x46, 0x9a, 0x80, 0x66, 0x92, 0x90, 0xa0, 0x69, + 0xc3, 0x08, 0x02, 0x70, 0x99, 0x34, 0x45, 0x94, 0x30, 0xf9, 0x2f, 0x11, + 0x4d, 0xc4, 0xc5, 0x1e, 0xc0, 0x40, 0x44, 0x28, 0x35, 0x3d, 0xd4, 0x84, + 0x86, 0x80, 0x0b, 0x86, 0x11, 0x06, 0xe0, 0x30, 0x69, 0x8a, 0x28, 0x61, + 0xf2, 0x5f, 0x22, 0x9a, 0x88, 0x8b, 0x3d, 0x80, 0x81, 0x88, 0xc4, 0xe6, + 0xa1, 0x26, 0x34, 0x78, 0x5c, 0x70, 0x09, 0xe7, 0x34, 0xd2, 0x04, 0x34, + 0x93, 0x84, 0x82, 0x2d, 0x1d, 0x12, 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, + 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, + 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, + 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, + 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, + 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, + 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, + 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, + 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x3a, 0x0f, 0x64, 0x90, 0x21, 0x23, 0x25, 0x40, 0x00, 0x52, 0x00, + 0xc0, 0x90, 0xe7, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x80, 0x21, 0xcf, 0x02, 0x04, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x43, 0x9e, 0x06, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x86, 0x3c, 0x12, 0x10, 0x00, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x79, 0x28, 0x20, 0x00, 0x02, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xf2, 0x5c, 0x40, 0x00, 0x0c, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x05, 0x02, 0x00, 0x19, + 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x18, 0x19, 0x11, 0x4c, 0x90, 0x8c, + 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x52, 0x0a, 0xa1, 0x08, 0xca, 0x80, + 0x92, 0x12, 0x18, 0x01, 0x28, 0x86, 0x02, 0x14, 0x28, 0x82, 0x42, 0x28, + 0x83, 0x72, 0x28, 0x89, 0x02, 0x0c, 0x28, 0xb0, 0x02, 0x29, 0xa0, 0xf2, + 0x28, 0x8c, 0xd2, 0x0d, 0x28, 0x0a, 0x52, 0x4a, 0x62, 0x04, 0x80, 0x8a, + 0x19, 0x00, 0x22, 0x66, 0x00, 0x68, 0x98, 0x01, 0xa0, 0x6d, 0x06, 0x80, + 0xba, 0x19, 0x00, 0xfa, 0x66, 0x00, 0x08, 0x9c, 0x01, 0xa0, 0x70, 0x2c, + 0x87, 0x61, 0x9e, 0xe7, 0x01, 0x20, 0x30, 0x00, 0x00, 0x10, 0x01, 0x21, + 0x10, 0x0c, 0x40, 0x50, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0xc0, + 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, 0x44, 0x35, + 0x18, 0x63, 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, + 0x73, 0x03, 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1, 0x0b, 0x3b, 0x9b, 0x7b, + 0x91, 0x2a, 0x62, 0x2a, 0x0a, 0x9a, 0x2a, 0xfa, 0x9a, 0xb9, 0x81, 0x79, + 0x31, 0x4b, 0x73, 0x0b, 0x63, 0x4b, 0xd9, 0x10, 0x04, 0x13, 0x84, 0x44, + 0x99, 0x20, 0x24, 0xcb, 0x06, 0x61, 0x20, 0x36, 0x08, 0x04, 0x41, 0xc1, + 0x6e, 0x6e, 0x82, 0x90, 0x30, 0x1b, 0x86, 0x03, 0x21, 0x26, 0x08, 0x45, + 0xc7, 0x64, 0xe8, 0xcd, 0x6d, 0x8e, 0x2e, 0xcc, 0x8d, 0x6e, 0x6e, 0x82, + 0x90, 0x34, 0x1b, 0x10, 0x42, 0x59, 0x08, 0x62, 0x60, 0x80, 0x0d, 0x41, + 0xb3, 0x81, 0x00, 0x00, 0x07, 0x98, 0x20, 0x6c, 0x60, 0xc0, 0xa2, 0xed, + 0x8d, 0xac, 0x8c, 0x6d, 0x82, 0x90, 0x38, 0x13, 0x84, 0xe4, 0xd9, 0x30, + 0x4c, 0xd3, 0x30, 0x41, 0x48, 0xa0, 0x09, 0x42, 0x12, 0x4d, 0x10, 0x12, + 0x69, 0x03, 0x82, 0x44, 0x12, 0x55, 0x11, 0xd6, 0xc5, 0x08, 0x4e, 0xee, + 0x4d, 0xad, 0x6c, 0x8c, 0x2e, 0xed, 0xcd, 0x2d, 0xc8, 0x8d, 0xcc, 0x2a, + 0xad, 0xec, 0x6e, 0x82, 0x90, 0x4c, 0x1b, 0x10, 0x24, 0x93, 0xa8, 0x4a, + 0xb3, 0xae, 0x0d, 0x03, 0x83, 0x6d, 0x13, 0x84, 0x2e, 0x0c, 0x26, 0x08, + 0x09, 0xc5, 0x01, 0xee, 0x6d, 0x8e, 0xcb, 0x94, 0xd5, 0x17, 0xd4, 0xd3, + 0x54, 0x12, 0x55, 0xd2, 0x93, 0xd3, 0x06, 0x04, 0xf9, 0x2a, 0x62, 0x02, + 0x03, 0xeb, 0xe2, 0x40, 0x57, 0x86, 0x37, 0x41, 0x48, 0x2a, 0x26, 0x54, + 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x30, 0x1b, 0x10, 0x44, 0x0c, + 0xaa, 0x31, 0x98, 0xc8, 0xc0, 0xba, 0x58, 0x8c, 0xbd, 0xb1, 0xbd, 0xc9, + 0x4d, 0x10, 0x12, 0x8b, 0xc6, 0xd0, 0x13, 0xd3, 0x93, 0x14, 0xcc, 0x06, + 0x04, 0x31, 0x83, 0xea, 0x0c, 0x26, 0x34, 0xb0, 0xae, 0x0d, 0x84, 0x17, + 0x06, 0x65, 0x90, 0x06, 0x13, 0x84, 0x4f, 0x0c, 0x88, 0x40, 0x3d, 0x4d, + 0x25, 0x51, 0x25, 0x3d, 0x39, 0x6d, 0x40, 0x90, 0xaf, 0x22, 0x26, 0x36, + 0xb0, 0xae, 0x0d, 0x84, 0xd7, 0x06, 0x65, 0x90, 0x06, 0x13, 0x04, 0x30, + 0x18, 0x83, 0x0d, 0x04, 0xb2, 0x54, 0xc4, 0x06, 0x81, 0x81, 0x83, 0x09, + 0xc2, 0xf0, 0x4d, 0x10, 0x08, 0x6f, 0x43, 0x43, 0x40, 0x5c, 0xa7, 0x06, + 0x6b, 0xe0, 0x06, 0x6f, 0x10, 0x07, 0x72, 0xc0, 0xcd, 0x41, 0x1c, 0x4c, + 0x10, 0x90, 0x60, 0x03, 0xb0, 0x61, 0x20, 0xec, 0xc0, 0x0e, 0x36, 0x04, + 0x77, 0xb0, 0x61, 0x18, 0xea, 0x00, 0x0f, 0x26, 0x08, 0x61, 0x40, 0x06, + 0x1b, 0x02, 0x3d, 0xe0, 0xd1, 0x16, 0x96, 0xe6, 0x96, 0x55, 0x65, 0x35, + 0x41, 0x50, 0xb6, 0x09, 0x82, 0xc2, 0x6d, 0x08, 0x88, 0x09, 0x82, 0x92, + 0x6c, 0x10, 0x2a, 0x6b, 0xc3, 0x42, 0xb0, 0x41, 0x1f, 0xf8, 0xc1, 0x1f, + 0xf8, 0xc1, 0x00, 0x0a, 0x84, 0x1f, 0x84, 0x02, 0x11, 0xaa, 0x22, 0xac, + 0xa1, 0xa7, 0x27, 0x29, 0xa2, 0x09, 0x82, 0x82, 0x6c, 0x10, 0xaa, 0x6a, + 0xc3, 0x32, 0x8c, 0x42, 0x1f, 0xf8, 0xc1, 0x1f, 0xf8, 0xc1, 0x40, 0x0a, + 0x83, 0x1f, 0x94, 0x02, 0x8b, 0xa1, 0x27, 0xa6, 0x27, 0xa9, 0x09, 0x82, + 0x72, 0x4c, 0x10, 0x92, 0x6b, 0x83, 0x50, 0xa5, 0xc2, 0x86, 0x45, 0x3a, + 0x85, 0x3e, 0xf0, 0x83, 0x3f, 0xf0, 0x83, 0x01, 0x15, 0x24, 0x3f, 0x50, + 0x85, 0x0d, 0x83, 0x28, 0x98, 0xc2, 0x2a, 0x70, 0x99, 0xb2, 0xfa, 0x82, + 0x7a, 0x9b, 0x4b, 0xa3, 0x4b, 0x7b, 0x73, 0xdb, 0xb0, 0x10, 0xad, 0xd0, + 0x07, 0xa0, 0xf0, 0x07, 0xa8, 0x30, 0xa0, 0x02, 0xe1, 0x07, 0xaa, 0xb0, + 0x61, 0x19, 0x46, 0xa1, 0x0f, 0xfc, 0xe0, 0x0f, 0x48, 0x61, 0x20, 0x85, + 0xc1, 0x0f, 0x4a, 0x61, 0xc3, 0x22, 0x9d, 0x42, 0x1f, 0xf8, 0xc1, 0x1f, + 0x90, 0xc2, 0x80, 0x0a, 0x92, 0x1f, 0xa8, 0xc2, 0x86, 0xc1, 0x15, 0x5e, + 0x01, 0x16, 0x36, 0x0c, 0xac, 0x10, 0x0b, 0xc0, 0x86, 0xa2, 0x0e, 0xf8, + 0x40, 0x16, 0x1e, 0x80, 0x86, 0x19, 0xdb, 0x5b, 0x18, 0xdd, 0xdc, 0x04, + 0x21, 0xc1, 0x58, 0xa4, 0xb9, 0xcd, 0xd1, 0xcd, 0x4d, 0x10, 0x92, 0x8c, + 0xc6, 0x5c, 0xda, 0xd9, 0x17, 0x1b, 0x19, 0x8d, 0xb9, 0xb4, 0xb3, 0xaf, + 0x39, 0xba, 0x09, 0x42, 0xa2, 0x6d, 0x40, 0x68, 0xa1, 0x16, 0x6c, 0xe1, + 0x16, 0x70, 0xe1, 0xca, 0x05, 0x5d, 0xa8, 0xc2, 0xc6, 0x66, 0xd7, 0xe6, + 0x92, 0x46, 0x56, 0xe6, 0x46, 0x37, 0x25, 0x08, 0xaa, 0x90, 0xe1, 0xb9, + 0xd8, 0x95, 0xc9, 0xcd, 0xa5, 0xbd, 0xb9, 0x4d, 0x09, 0x88, 0x26, 0x64, + 0x78, 0x2e, 0x76, 0x61, 0x6c, 0x76, 0x65, 0x72, 0x53, 0x82, 0xa2, 0x0e, + 0x19, 0x9e, 0xcb, 0x1c, 0x5a, 0x18, 0x59, 0x99, 0x5c, 0xd3, 0x1b, 0x59, + 0x19, 0xdb, 0x94, 0x00, 0x29, 0x43, 0x86, 0xe7, 0x22, 0x57, 0x36, 0xf7, + 0x56, 0x27, 0x37, 0x56, 0x36, 0x37, 0x25, 0x70, 0x2a, 0x91, 0xe1, 0xb9, + 0xd0, 0xe5, 0xc1, 0x95, 0x05, 0xb9, 0xb9, 0xbd, 0xd1, 0x85, 0xd1, 0xa5, + 0xbd, 0xb9, 0xcd, 0x4d, 0x11, 0xe6, 0x00, 0x0f, 0xea, 0x90, 0xe1, 0xb9, + 0xd8, 0xa5, 0x95, 0xdd, 0x25, 0x91, 0x4d, 0xd1, 0x85, 0xd1, 0x95, 0x4d, + 0x09, 0xf4, 0xa0, 0x0e, 0x19, 0x9e, 0x4b, 0x99, 0x1b, 0x9d, 0x5c, 0x1e, + 0xd4, 0x5b, 0x9a, 0x1b, 0xdd, 0xdc, 0x94, 0x40, 0x16, 0xba, 0x90, 0xe1, + 0xb9, 0x8c, 0xbd, 0xd5, 0xb9, 0xd1, 0x95, 0xc9, 0xcd, 0x4d, 0x09, 0x74, + 0x01, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00, 0x33, + 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, + 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, + 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, + 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, + 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, + 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, + 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, + 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, + 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, + 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, + 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, + 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, + 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, + 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, + 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, + 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, + 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, + 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, + 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, + 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, + 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, + 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x8c, 0xc8, 0x21, + 0x07, 0x7c, 0x70, 0x03, 0x72, 0x10, 0x87, 0x73, 0x70, 0x03, 0x7b, 0x08, + 0x07, 0x79, 0x60, 0x87, 0x70, 0xc8, 0x87, 0x77, 0xa8, 0x07, 0x7a, 0x00, + 0x00, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x06, + 0x00, 0x71, 0x4e, 0x23, 0x4d, 0x40, 0x33, 0x49, 0xff, 0x42, 0x18, 0x80, + 0x80, 0x19, 0xc1, 0x36, 0x5c, 0xbe, 0xf3, 0xf8, 0x42, 0x40, 0x15, 0x05, + 0x11, 0x95, 0x0e, 0x30, 0x94, 0x84, 0x01, 0x08, 0x98, 0x5f, 0xdc, 0xb6, + 0x19, 0x48, 0xc3, 0xe5, 0x3b, 0x8f, 0x2f, 0x44, 0x04, 0x30, 0x11, 0x21, + 0xd0, 0x0c, 0x0b, 0x61, 0x02, 0xd3, 0x70, 0xf9, 0xce, 0xe3, 0x2f, 0x0e, + 0x30, 0x88, 0xcd, 0x43, 0x4d, 0x7e, 0x71, 0xdb, 0x36, 0x50, 0x0d, 0x97, + 0xef, 0x3c, 0xbe, 0x34, 0x39, 0x11, 0x81, 0x52, 0xd3, 0x43, 0x4d, 0x7e, + 0x71, 0xdb, 0x56, 0x20, 0x0d, 0x97, 0xef, 0x3c, 0xfe, 0x44, 0x44, 0x13, + 0x02, 0x44, 0x98, 0x5f, 0xdc, 0xb6, 0x05, 0x1c, 0x0c, 0x80, 0x34, 0xb2, + 0xfb, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x41, 0x53, 0x48, 0x14, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7b, 0x37, 0x12, 0xc2, 0x76, + 0x04, 0xc6, 0xc0, 0xad, 0xe5, 0xc2, 0x1e, 0x4d, 0x70, 0xa6, 0x71, 0x44, + 0x58, 0x49, 0x4c, 0x20, 0x09, 0x00, 0x00, 0x60, 0x00, 0x01, 0x00, 0x48, + 0x02, 0x00, 0x00, 0x44, 0x58, 0x49, 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, + 0x00, 0x00, 0x00, 0x08, 0x09, 0x00, 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, + 0x0c, 0x00, 0x00, 0x3f, 0x02, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, + 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, + 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02, 0x42, + 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, + 0x32, 0x52, 0x88, 0x48, 0x90, 0x14, 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, + 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, 0x90, 0x91, 0x22, 0xc4, 0x50, 0x41, + 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, 0x8a, 0x04, 0x29, 0x46, 0x06, 0x51, + 0x18, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, + 0xff, 0xff, 0x07, 0x40, 0x02, 0xa8, 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, + 0xff, 0x03, 0x20, 0x6d, 0x30, 0x86, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, + 0x09, 0xa8, 0x00, 0x49, 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, + 0x82, 0x60, 0x42, 0x20, 0x4c, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00, 0x89, + 0x20, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, + 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, + 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, + 0x6c, 0x23, 0x00, 0x25, 0x00, 0x14, 0x66, 0x00, 0xe6, 0x08, 0xc0, 0x60, + 0x8e, 0x00, 0x29, 0xc6, 0x20, 0x84, 0x14, 0x42, 0xa6, 0x18, 0x80, 0x10, + 0x52, 0x06, 0xa1, 0xa3, 0x86, 0xcb, 0x9f, 0xb0, 0x87, 0x90, 0x7c, 0x6e, + 0xa3, 0x8a, 0x95, 0x98, 0xfc, 0xe2, 0xb6, 0x11, 0x31, 0xc6, 0x18, 0x54, + 0xee, 0x19, 0x2e, 0x7f, 0xc2, 0x1e, 0x42, 0xf2, 0x43, 0xa0, 0x19, 0x16, + 0x02, 0x05, 0xab, 0x10, 0x8a, 0x30, 0x42, 0xad, 0x14, 0x83, 0x8c, 0x31, + 0xe8, 0xcd, 0x11, 0x04, 0xc5, 0x60, 0xa4, 0x10, 0x12, 0x49, 0x0e, 0x04, + 0x0c, 0x23, 0x10, 0x43, 0x12, 0xd4, 0x83, 0x83, 0xe1, 0xf2, 0x81, 0x05, + 0x31, 0x1a, 0x86, 0x68, 0x26, 0x7f, 0x21, 0x0c, 0x40, 0xc0, 0x7c, 0x69, + 0x8a, 0x28, 0x61, 0xf2, 0x5f, 0x22, 0x9a, 0x88, 0x8b, 0x3d, 0x80, 0x81, + 0x88, 0x38, 0xa7, 0x91, 0x26, 0xa0, 0x99, 0x24, 0x24, 0x58, 0x7b, 0xdd, + 0x70, 0xf9, 0xc0, 0x82, 0x18, 0x0d, 0x43, 0x34, 0x93, 0xbf, 0x10, 0x06, + 0x20, 0x60, 0x3e, 0xe7, 0x34, 0xd2, 0x04, 0x34, 0x93, 0x84, 0x82, 0x4b, + 0x38, 0x1d, 0x08, 0x00, 0x00, 0x00, 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, + 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, + 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, + 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, + 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, + 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, + 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, + 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, + 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x43, 0x9e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x86, 0x3c, 0x06, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x0c, 0x79, 0x10, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x18, 0xf2, 0x34, 0x40, 0x00, 0x0c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xe4, 0x79, 0x80, 0x00, 0x08, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xc8, 0x23, 0x01, 0x01, 0x30, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x16, 0x08, 0x00, 0x10, + 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, 0x90, 0x8c, + 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x22, 0x25, 0x30, 0x02, 0x50, 0x0c, + 0x05, 0x28, 0x50, 0x06, 0xe5, 0x50, 0x04, 0xe5, 0x41, 0xa5, 0x24, 0x46, + 0x00, 0xca, 0xa0, 0x08, 0x0a, 0x81, 0xf2, 0x0c, 0x00, 0xe9, 0xb1, 0x1c, + 0x86, 0x79, 0x9e, 0x07, 0x80, 0xc0, 0x00, 0x00, 0x40, 0x04, 0x84, 0x40, + 0x30, 0x00, 0x41, 0x01, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x66, + 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, 0x44, 0x35, + 0x18, 0x63, 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, + 0x73, 0x03, 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1, 0x0b, 0x3b, 0x9b, 0x7b, + 0x91, 0x2a, 0x62, 0x2a, 0x0a, 0x9a, 0x2a, 0xfa, 0x9a, 0xb9, 0x81, 0x79, + 0x31, 0x4b, 0x73, 0x0b, 0x63, 0x4b, 0xd9, 0x10, 0x04, 0x13, 0x04, 0xc2, + 0x98, 0x20, 0x10, 0xc7, 0x06, 0x61, 0x20, 0x26, 0x08, 0x04, 0xb2, 0x41, + 0x18, 0x0c, 0x0a, 0x76, 0x73, 0x1b, 0x06, 0xc4, 0x20, 0x26, 0x08, 0xd9, + 0x44, 0x60, 0x82, 0x40, 0x24, 0x1b, 0x10, 0x42, 0x59, 0x08, 0x62, 0x60, + 0x80, 0x0d, 0x41, 0xb3, 0x81, 0x00, 0x00, 0x07, 0x98, 0x20, 0x68, 0xd4, + 0x86, 0x00, 0x9a, 0x20, 0x08, 0x00, 0x8f, 0xb6, 0xb0, 0x34, 0xb7, 0xac, + 0x2a, 0x2b, 0x22, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x13, + 0x84, 0xc2, 0x99, 0x20, 0x14, 0xcf, 0x86, 0x80, 0x98, 0x20, 0x14, 0xd0, + 0x04, 0x81, 0x50, 0x26, 0x08, 0xc4, 0xb2, 0x41, 0xc8, 0xb4, 0x0d, 0x0b, + 0x41, 0x55, 0xd6, 0x65, 0x0d, 0x18, 0x61, 0x6d, 0x44, 0xa8, 0x8a, 0xb0, + 0x86, 0x9e, 0x9e, 0xa4, 0x88, 0x26, 0x08, 0x45, 0xb4, 0x41, 0xc8, 0xb2, + 0x0d, 0xcb, 0xd0, 0x55, 0xd6, 0x65, 0x0d, 0xde, 0x60, 0x7d, 0x13, 0x04, + 0x82, 0x61, 0x31, 0xf4, 0xc4, 0xf4, 0x24, 0x35, 0x41, 0x28, 0xa4, 0x09, + 0x02, 0xd1, 0x6c, 0x10, 0x32, 0x32, 0xd8, 0xb0, 0x84, 0x81, 0x18, 0x54, + 0xd6, 0x65, 0x0d, 0x63, 0x10, 0x06, 0x56, 0x19, 0x6c, 0x18, 0x38, 0x30, + 0x30, 0x03, 0x2e, 0x53, 0x56, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x1b, 0x16, 0x02, 0x0d, 0x2a, 0xec, 0x1a, 0x83, 0x61, 0x0c, + 0x08, 0xab, 0x0c, 0x36, 0x2c, 0x43, 0x57, 0x59, 0x97, 0x37, 0x78, 0x83, + 0xf5, 0x6d, 0x58, 0xc2, 0x40, 0x0c, 0x2a, 0xeb, 0xf2, 0x86, 0x31, 0x08, + 0x03, 0xab, 0x0c, 0x36, 0x0c, 0x69, 0xa0, 0x06, 0x6b, 0xb0, 0x61, 0x38, + 0x03, 0x36, 0x00, 0x36, 0x14, 0xd2, 0xd4, 0x06, 0x0f, 0x50, 0x85, 0x8d, + 0xcd, 0xae, 0xcd, 0x25, 0x8d, 0xac, 0xcc, 0x8d, 0x6e, 0x4a, 0x10, 0x54, + 0x21, 0xc3, 0x73, 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x9b, 0x12, + 0x10, 0x4d, 0xc8, 0xf0, 0x5c, 0xec, 0xc2, 0xd8, 0xec, 0xca, 0xe4, 0xa6, + 0x04, 0x46, 0x1d, 0x32, 0x3c, 0x97, 0x39, 0xb4, 0x30, 0xb2, 0x32, 0xb9, + 0xa6, 0x37, 0xb2, 0x32, 0xb6, 0x29, 0x01, 0x52, 0x86, 0x0c, 0xcf, 0x45, + 0xae, 0x6c, 0xee, 0xad, 0x4e, 0x6e, 0xac, 0x6c, 0x6e, 0x4a, 0xe0, 0xd4, + 0x21, 0xc3, 0x73, 0xb1, 0x4b, 0x2b, 0xbb, 0x4b, 0x22, 0x9b, 0xa2, 0x0b, + 0xa3, 0x2b, 0x9b, 0x12, 0x40, 0x75, 0xc8, 0xf0, 0x5c, 0xca, 0xdc, 0xe8, + 0xe4, 0xf2, 0xa0, 0xde, 0xd2, 0xdc, 0xe8, 0xe6, 0xa6, 0x04, 0x6d, 0x00, + 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00, 0x33, + 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, + 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, + 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, + 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, + 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, + 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, + 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, + 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, + 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, + 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, + 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, + 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, + 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, + 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, + 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, + 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, + 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, + 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, + 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, + 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, + 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, + 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x8c, 0xc8, 0x21, + 0x07, 0x7c, 0x70, 0x03, 0x72, 0x10, 0x87, 0x73, 0x70, 0x03, 0x7b, 0x08, + 0x07, 0x79, 0x60, 0x87, 0x70, 0xc8, 0x87, 0x77, 0xa8, 0x07, 0x7a, 0x00, + 0x00, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x36, + 0xb0, 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x10, 0x50, 0x45, 0x41, 0x44, 0xa5, + 0x03, 0x0c, 0x25, 0x61, 0x00, 0x02, 0xe6, 0x17, 0xb7, 0x6d, 0x05, 0xd2, + 0x70, 0xf9, 0xce, 0xe3, 0x0b, 0x11, 0x01, 0x4c, 0x44, 0x08, 0x34, 0xc3, + 0x42, 0x58, 0xc0, 0x34, 0x5c, 0xbe, 0xf3, 0xf8, 0x8b, 0x03, 0x0c, 0x62, + 0xf3, 0x50, 0x93, 0x5f, 0xdc, 0xb6, 0x09, 0x54, 0xc3, 0xe5, 0x3b, 0x8f, + 0x2f, 0x4d, 0x4e, 0x44, 0xa0, 0xd4, 0xf4, 0x50, 0x93, 0x5f, 0xdc, 0xb6, + 0x11, 0x48, 0xc3, 0xe5, 0x3b, 0x8f, 0x3f, 0x11, 0xd1, 0x84, 0x00, 0x11, + 0xe6, 0x17, 0xb7, 0x6d, 0x00, 0x07, 0x03, 0x20, 0x8d, 0xec, 0xbe, 0x00, + 0x00, 0x00, 0x00, 0x61, 0x20, 0x00, 0x00, 0xcf, 0x00, 0x00, 0x00, 0x13, + 0x04, 0x41, 0x2c, 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x44, + 0x8a, 0xab, 0x14, 0x0a, 0x61, 0x06, 0xa0, 0xec, 0x4a, 0x8e, 0x4a, 0x09, + 0x50, 0x1c, 0x01, 0x00, 0x00, 0x00, 0x00, 0x23, 0x06, 0x09, 0x00, 0x82, + 0x60, 0x20, 0x61, 0x03, 0x63, 0x59, 0xc1, 0x88, 0x41, 0x02, 0x80, 0x20, + 0x18, 0x18, 0xdd, 0x21, 0x5d, 0x8f, 0x31, 0x62, 0x90, 0x00, 0x20, 0x08, + 0x06, 0x86, 0x87, 0x4c, 0x18, 0x71, 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, + 0x81, 0xf1, 0x25, 0x54, 0xf6, 0x20, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, + 0x60, 0x80, 0x81, 0x52, 0x69, 0x51, 0x32, 0x62, 0x90, 0x00, 0x20, 0x08, + 0x06, 0x46, 0x18, 0x2c, 0xdc, 0x36, 0x29, 0x23, 0x06, 0x09, 0x00, 0x82, + 0x60, 0x60, 0x88, 0x01, 0xd3, 0x71, 0xc8, 0x32, 0x62, 0x90, 0x00, 0x20, + 0x08, 0x06, 0xc6, 0x18, 0x34, 0x5d, 0x57, 0x31, 0x23, 0x06, 0x09, 0x00, + 0x82, 0x60, 0x60, 0x90, 0x81, 0xe3, 0x79, 0x4a, 0x33, 0x62, 0x90, 0x00, + 0x20, 0x08, 0x06, 0x46, 0x19, 0x3c, 0xdf, 0x57, 0x39, 0x23, 0x06, 0x07, + 0x00, 0x82, 0x60, 0xd0, 0x90, 0x81, 0xa3, 0x80, 0xc1, 0x68, 0x42, 0x00, + 0x8c, 0x26, 0x08, 0xc1, 0x68, 0xc2, 0x20, 0x8c, 0x26, 0x10, 0xc3, 0x88, + 0xc1, 0x01, 0x80, 0x20, 0x18, 0x34, 0x69, 0x30, 0x3d, 0x66, 0x30, 0x9a, + 0x10, 0x00, 0xa3, 0x09, 0x42, 0x30, 0x9a, 0x30, 0x08, 0xa3, 0x09, 0xc4, + 0x30, 0x62, 0x70, 0x00, 0x20, 0x08, 0x06, 0x8d, 0x1b, 0x60, 0x54, 0x19, + 0x8c, 0x26, 0x04, 0xc0, 0x68, 0x82, 0x10, 0x8c, 0x26, 0x0c, 0xc2, 0x68, + 0x02, 0x31, 0x8c, 0x18, 0x1c, 0x00, 0x08, 0x82, 0x41, 0x33, 0x07, 0x5d, + 0xc6, 0x06, 0xa3, 0x09, 0x01, 0x30, 0x9a, 0x20, 0x04, 0xa3, 0x09, 0x83, + 0x30, 0x9a, 0x40, 0x0c, 0x36, 0x5d, 0xf2, 0x19, 0x31, 0x40, 0x00, 0x10, + 0x04, 0x83, 0x07, 0x0f, 0xce, 0xe0, 0x7a, 0x82, 0x11, 0x03, 0x04, 0x00, + 0x41, 0x30, 0x78, 0xf2, 0x00, 0x0d, 0xae, 0x25, 0xb0, 0xe0, 0x80, 0x8e, + 0x59, 0x9b, 0x7c, 0x46, 0x0c, 0x10, 0x00, 0x04, 0xc1, 0xe0, 0xe1, 0x83, + 0x35, 0xd8, 0xa4, 0x60, 0xc4, 0x00, 0x01, 0x40, 0x10, 0x0c, 0x9e, 0x3e, + 0x60, 0x83, 0xcd, 0x09, 0x2c, 0x50, 0xa0, 0x63, 0xd9, 0x27, 0x9f, 0x11, + 0x03, 0x04, 0x00, 0x41, 0x30, 0x78, 0x40, 0xe1, 0x0d, 0xbe, 0x2a, 0x18, + 0x31, 0x40, 0x00, 0x10, 0x04, 0x83, 0x27, 0x14, 0xe0, 0xe0, 0x8b, 0x02, + 0x0b, 0x1a, 0xe8, 0x18, 0x37, 0x06, 0xf2, 0x19, 0x31, 0x40, 0x00, 0x10, + 0x04, 0x83, 0x87, 0x14, 0xe6, 0x60, 0x0c, 0xb0, 0x60, 0xc4, 0x00, 0x01, + 0x40, 0x10, 0x0c, 0x9e, 0x52, 0xa0, 0x83, 0x31, 0xa0, 0x02, 0x0b, 0x20, + 0xe8, 0x8c, 0x18, 0x1c, 0x00, 0x08, 0x82, 0x41, 0x83, 0x0a, 0x72, 0xe0, + 0x06, 0x74, 0x30, 0x9a, 0x10, 0x00, 0xa3, 0x09, 0x42, 0x30, 0x9a, 0x30, + 0x08, 0xa3, 0x09, 0xc4, 0x30, 0x62, 0x70, 0x00, 0x20, 0x08, 0x06, 0x4d, + 0x2b, 0xdc, 0xc1, 0x1c, 0xe8, 0xc1, 0x68, 0x42, 0x00, 0x8c, 0x26, 0x08, + 0xc1, 0x68, 0xc2, 0x20, 0x8c, 0x26, 0x10, 0xc3, 0x88, 0xc1, 0x01, 0x80, + 0x20, 0x18, 0x34, 0xb2, 0xc0, 0x07, 0x78, 0xd0, 0x0a, 0xa3, 0x09, 0x01, + 0x30, 0x9a, 0x20, 0x04, 0xa3, 0x09, 0x83, 0x30, 0x9a, 0x40, 0x0c, 0x23, + 0x06, 0x07, 0x00, 0x82, 0x60, 0xd0, 0xdc, 0x42, 0x28, 0xf4, 0xc1, 0x2b, + 0x8c, 0x26, 0x04, 0xc0, 0x68, 0x82, 0x10, 0x8c, 0x26, 0x0c, 0xc2, 0x68, + 0x02, 0x31, 0xd8, 0x14, 0x06, 0xf2, 0x19, 0x31, 0x40, 0x00, 0x10, 0x04, + 0x83, 0x87, 0x17, 0x56, 0xc1, 0x7b, 0x82, 0x11, 0x03, 0x04, 0x00, 0x41, + 0x30, 0x78, 0x7a, 0x81, 0x15, 0xb6, 0x25, 0x18, 0x31, 0x40, 0x00, 0x10, + 0x04, 0x83, 0xc7, 0x17, 0x5a, 0x01, 0x3b, 0x02, 0xb3, 0xca, 0x40, 0x3e, + 0x23, 0x06, 0x08, 0x00, 0x82, 0x60, 0xf0, 0x80, 0xc3, 0x2b, 0x88, 0x81, + 0x14, 0x8c, 0x18, 0x20, 0x00, 0x08, 0x82, 0xc1, 0x13, 0x0e, 0xb0, 0xf0, + 0x39, 0xc1, 0x88, 0x01, 0x02, 0x80, 0x20, 0x18, 0x3c, 0xe2, 0x10, 0x0b, + 0x9c, 0x12, 0x58, 0x96, 0x06, 0xf2, 0x19, 0x31, 0x40, 0x00, 0x10, 0x04, + 0x83, 0x87, 0x1c, 0x66, 0xc1, 0x0c, 0xaa, 0x60, 0xc4, 0x00, 0x01, 0x40, + 0x10, 0x0c, 0x9e, 0x72, 0xa0, 0x85, 0x31, 0x88, 0x82, 0x11, 0x03, 0x04, + 0x00, 0x41, 0x30, 0x78, 0xcc, 0xa1, 0x16, 0xc0, 0xa0, 0x09, 0x8c, 0x6b, + 0x03, 0xf9, 0x8c, 0x18, 0x20, 0x00, 0x08, 0x82, 0xc1, 0x83, 0x0e, 0xb7, + 0xa0, 0x06, 0x58, 0x30, 0x62, 0x80, 0x00, 0x20, 0x08, 0x06, 0x4f, 0x3a, + 0xe0, 0xc2, 0x19, 0x50, 0xc1, 0x88, 0x01, 0x02, 0x80, 0x20, 0x18, 0x3c, + 0xea, 0x90, 0x0b, 0x64, 0x00, 0x05, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, + 0x80, 0xb4, 0x43, 0x2e, 0xa0, 0x03, 0x3a, 0x80, 0x43, 0x33, 0x62, 0x90, + 0x00, 0x20, 0x08, 0x06, 0x48, 0x3b, 0xe4, 0x02, 0x3a, 0xa0, 0x03, 0x2d, + 0x24, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x80, 0xb4, 0x43, 0x2e, 0xa0, + 0x03, 0x3a, 0xf8, 0x42, 0x31, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x48, + 0x3b, 0xe4, 0x02, 0x3a, 0xa0, 0xc3, 0x2f, 0x04, 0x23, 0x06, 0x09, 0x00, + 0x82, 0x60, 0x80, 0xb4, 0x43, 0x2e, 0xa4, 0x03, 0x3a, 0x80, 0x43, 0x2b, + 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, 0x01, 0xd2, 0x0e, 0xb9, 0x90, 0x0e, + 0xe8, 0x40, 0x0b, 0xac, 0x30, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x48, + 0x3b, 0xe4, 0xc2, 0x38, 0xa0, 0x03, 0x38, 0xc4, 0xc2, 0x88, 0x41, 0x02, + 0x80, 0x20, 0x18, 0x20, 0xed, 0x90, 0x0b, 0xe3, 0x80, 0x0e, 0xb4, 0x00, + 0x0b, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x80, 0xb4, 0x43, 0x2e, 0x8c, + 0x03, 0x3a, 0xf8, 0xc2, 0x2b, 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, 0x01, + 0xd2, 0x0e, 0xb9, 0x30, 0x0e, 0xe8, 0xf0, 0x0b, 0xae, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00 +}; + +static unsigned char D3D12_VertexShader_NV[] = { + 0x44, 0x58, 0x42, 0x43, 0x52, 0x51, 0xf4, 0x61, 0xe0, 0x16, 0x3e, 0xc4, + 0xd9, 0x83, 0xc5, 0x7a, 0x0a, 0xa7, 0x7f, 0x7c, 0x01, 0x00, 0x00, 0x00, + 0x63, 0x14, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, + 0x50, 0x00, 0x00, 0x00, 0xd8, 0x00, 0x00, 0x00, 0x63, 0x01, 0x00, 0x00, + 0x73, 0x02, 0x00, 0x00, 0x2f, 0x03, 0x00, 0x00, 0x27, 0x0b, 0x00, 0x00, + 0x43, 0x0b, 0x00, 0x00, 0x53, 0x46, 0x49, 0x30, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x31, + 0x80, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x54, 0x45, 0x58, + 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, + 0x4f, 0x53, 0x47, 0x31, 0x83, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x03, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, + 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x50, 0x53, 0x56, 0x30, 0x08, + 0x01, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x03, + 0x03, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, + 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, + 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x54, 0x45, 0x58, + 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, + 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x43, 0x4f, 0x4c, + 0x4f, 0x52, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x43, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x01, 0x42, 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x44, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x44, 0x03, 0x03, 0x04, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x01, 0x42, 0x00, 0x03, 0x02, 0x00, 0x00, 0x22, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x44, 0x00, 0x03, + 0x02, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x52, 0x54, 0x53, 0x30, 0xb4, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x7c, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, + 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x53, + 0x54, 0x41, 0x54, 0xf0, 0x07, 0x00, 0x00, 0x60, 0x00, 0x01, 0x00, 0xfc, + 0x01, 0x00, 0x00, 0x44, 0x58, 0x49, 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, + 0x00, 0x00, 0x00, 0xd8, 0x07, 0x00, 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, + 0x0c, 0x00, 0x00, 0xf3, 0x01, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, + 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, + 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x18, 0x45, 0x02, 0x42, + 0x92, 0x0b, 0x42, 0xc4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, + 0x32, 0x62, 0x88, 0x48, 0x90, 0x14, 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, + 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, 0x90, 0x11, 0x23, 0xc4, 0x50, 0x41, + 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, 0x8a, 0x04, 0x31, 0x46, 0x06, 0x51, + 0x18, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, + 0xff, 0xff, 0x07, 0x40, 0x02, 0xa8, 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, + 0xff, 0x03, 0x20, 0x6d, 0x30, 0x86, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, + 0x09, 0xa8, 0x00, 0x49, 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, + 0x82, 0x60, 0x42, 0x20, 0x4c, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00, 0x89, + 0x20, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x32, 0x22, 0x88, 0x09, 0x20, + 0x64, 0x85, 0x04, 0x13, 0x23, 0xa4, 0x84, 0x04, 0x13, 0x23, 0xe3, 0x84, + 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8c, 0x8c, 0x0b, 0x84, 0xc4, 0x4c, 0x10, + 0x88, 0xc1, 0x0c, 0xc0, 0x30, 0x02, 0x01, 0x24, 0x41, 0x70, 0x70, 0x30, + 0x5c, 0x3e, 0xb0, 0x20, 0x46, 0xc3, 0x10, 0xcd, 0xe4, 0x2f, 0x84, 0x01, + 0x08, 0x98, 0x2f, 0x4d, 0x11, 0x25, 0x4c, 0xfe, 0x4b, 0x44, 0x13, 0x71, + 0xb1, 0x07, 0x30, 0x10, 0x11, 0xe7, 0x34, 0xd2, 0x04, 0x34, 0x93, 0x84, + 0x04, 0x41, 0xb8, 0x6e, 0xb8, 0x7c, 0x60, 0x41, 0x8c, 0x86, 0x21, 0x9a, + 0xc9, 0x5f, 0x08, 0x03, 0x10, 0x30, 0x9f, 0x73, 0x1a, 0x69, 0x02, 0x9a, + 0x49, 0x42, 0xc1, 0x40, 0xc4, 0x08, 0x40, 0x09, 0x0c, 0x3a, 0xe6, 0x08, + 0xc0, 0x60, 0x8e, 0x00, 0x29, 0x06, 0x90, 0x24, 0x89, 0x92, 0xd0, 0x52, + 0x0c, 0x23, 0x49, 0x12, 0x05, 0xa0, 0xe6, 0xa8, 0xe1, 0xf2, 0x27, 0xec, + 0x21, 0x24, 0x9f, 0xdb, 0xa8, 0x62, 0x25, 0x26, 0xbf, 0xb8, 0x6d, 0x44, + 0x00, 0x00, 0x00, 0x90, 0x72, 0xcf, 0x70, 0xf9, 0x13, 0xf6, 0x10, 0x92, + 0x1f, 0x02, 0xcd, 0xb0, 0x10, 0x28, 0x80, 0x0a, 0xf1, 0x24, 0x51, 0x42, + 0x52, 0x29, 0x80, 0x04, 0x00, 0x00, 0xa2, 0xe6, 0x08, 0x82, 0x62, 0x44, + 0x89, 0x92, 0x24, 0x16, 0x5d, 0x03, 0x01, 0x67, 0x09, 0x0b, 0x20, 0x49, + 0x3e, 0x03, 0x4c, 0x11, 0x72, 0xf9, 0xc5, 0xe2, 0x00, 0x93, 0x8f, 0xfb, + 0x38, 0x0a, 0x84, 0xe3, 0xa4, 0x29, 0xa2, 0x84, 0xc9, 0x7f, 0x89, 0x68, + 0x22, 0x2e, 0xf6, 0x00, 0x06, 0x22, 0xe2, 0x9c, 0x46, 0x9a, 0x80, 0x66, + 0x92, 0x90, 0xa0, 0x69, 0xc3, 0x08, 0x02, 0x70, 0x99, 0x34, 0x45, 0x94, + 0x30, 0xf9, 0x2f, 0x11, 0x4d, 0xc4, 0xc5, 0x1e, 0xc0, 0x40, 0x44, 0x28, + 0x35, 0x3d, 0xd4, 0x84, 0x86, 0x80, 0x0b, 0x86, 0x11, 0x06, 0xe0, 0x30, + 0x69, 0x8a, 0x28, 0x61, 0xf2, 0x5f, 0x22, 0x9a, 0x88, 0x8b, 0x3d, 0x80, + 0x81, 0x88, 0xc4, 0xe6, 0xa1, 0x26, 0x34, 0x78, 0x5c, 0x70, 0x09, 0xe7, + 0x34, 0xd2, 0x04, 0x34, 0x93, 0x84, 0x82, 0x2d, 0x1d, 0x12, 0x00, 0x13, + 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, 0x79, 0x68, + 0x03, 0x72, 0xc0, 0x87, 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, 0x0e, 0x7a, + 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, + 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, + 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, + 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, + 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, + 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, + 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0xa0, 0x07, 0x76, 0x40, 0x07, 0x3a, 0x0f, 0x64, 0x90, 0x21, 0x23, 0x25, + 0x40, 0x00, 0x52, 0x00, 0xc0, 0x90, 0xe7, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x21, 0xcf, 0x02, 0x04, 0x40, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x9e, 0x06, 0x08, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x3c, 0x12, 0x10, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x79, 0x28, + 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xf2, + 0x5c, 0x40, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, + 0x05, 0x02, 0x00, 0x19, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x18, 0x19, + 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x52, 0x0a, + 0xa1, 0x08, 0xca, 0x80, 0x92, 0x12, 0x18, 0x01, 0x28, 0x86, 0x02, 0x14, + 0x28, 0x82, 0x42, 0x28, 0x83, 0x72, 0x28, 0x89, 0x02, 0x0c, 0x28, 0xb0, + 0x02, 0x29, 0xa0, 0xf2, 0x28, 0x8c, 0xd2, 0x0d, 0x28, 0x0a, 0x52, 0x4a, + 0x62, 0x04, 0x80, 0x8a, 0x19, 0x00, 0x22, 0x66, 0x00, 0x68, 0x98, 0x01, + 0xa0, 0x6d, 0x06, 0x80, 0xba, 0x19, 0x00, 0xfa, 0x66, 0x00, 0x08, 0x9c, + 0x01, 0xa0, 0x70, 0x2c, 0x87, 0x61, 0x9e, 0xe7, 0x01, 0x20, 0x30, 0x00, + 0x00, 0x10, 0x01, 0x21, 0x10, 0x0c, 0x40, 0x50, 0x00, 0x00, 0x00, 0x79, + 0x18, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, + 0x02, 0x13, 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b, + 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1, + 0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, 0x0a, 0x9a, 0x2a, 0xfa, + 0x9a, 0xb9, 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, 0x63, 0x4b, 0xd9, 0x10, + 0x04, 0x13, 0x84, 0x44, 0x99, 0x20, 0x24, 0xcb, 0x06, 0x61, 0x20, 0x36, + 0x08, 0x04, 0x41, 0xc1, 0x6e, 0x6e, 0x82, 0x90, 0x30, 0x1b, 0x86, 0x03, + 0x21, 0x26, 0x08, 0x45, 0xc7, 0x64, 0xe8, 0xcd, 0x6d, 0x8e, 0x2e, 0xcc, + 0x8d, 0x6e, 0x6e, 0x82, 0x90, 0x34, 0x1b, 0x10, 0x42, 0x59, 0x08, 0x62, + 0x60, 0x80, 0x0d, 0x41, 0xb3, 0x81, 0x00, 0x00, 0x07, 0x98, 0x20, 0x6c, + 0x60, 0xc0, 0xa2, 0xed, 0x8d, 0xac, 0x8c, 0x6d, 0x82, 0x90, 0x38, 0x13, + 0x84, 0xe4, 0xd9, 0x30, 0x4c, 0xd3, 0x30, 0x41, 0x48, 0xa0, 0x09, 0x42, + 0x12, 0x4d, 0x10, 0x12, 0x69, 0x03, 0x82, 0x44, 0x12, 0x55, 0x11, 0xd6, + 0xc5, 0x08, 0x4e, 0xee, 0x4d, 0xad, 0x6c, 0x8c, 0x2e, 0xed, 0xcd, 0x2d, + 0xc8, 0x8d, 0xcc, 0x2a, 0xad, 0xec, 0x6e, 0x82, 0x90, 0x4c, 0x1b, 0x10, + 0x24, 0x93, 0xa8, 0x4a, 0xb3, 0xae, 0x0d, 0x03, 0x83, 0x6d, 0x13, 0x84, + 0x2e, 0x0c, 0x26, 0x08, 0x09, 0xc5, 0x01, 0xee, 0x6d, 0x8e, 0xcb, 0x94, + 0xd5, 0x17, 0xd4, 0xd3, 0x54, 0x12, 0x55, 0xd2, 0x93, 0xd3, 0x06, 0x04, + 0xf9, 0x2a, 0x62, 0x02, 0x03, 0xeb, 0xe2, 0x40, 0x57, 0x86, 0x37, 0x41, + 0x48, 0x2a, 0x26, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x30, + 0x1b, 0x10, 0x44, 0x0c, 0xaa, 0x31, 0x98, 0xc8, 0xc0, 0xba, 0x58, 0x8c, + 0xbd, 0xb1, 0xbd, 0xc9, 0x4d, 0x10, 0x12, 0x8b, 0xc6, 0xd0, 0x13, 0xd3, + 0x93, 0x14, 0xcc, 0x06, 0x04, 0x31, 0x83, 0xea, 0x0c, 0x26, 0x34, 0xb0, + 0xae, 0x0d, 0x84, 0x17, 0x06, 0x65, 0x90, 0x06, 0x13, 0x84, 0x4f, 0x0c, + 0x88, 0x40, 0x3d, 0x4d, 0x25, 0x51, 0x25, 0x3d, 0x39, 0x6d, 0x40, 0x90, + 0xaf, 0x22, 0x26, 0x36, 0xb0, 0xae, 0x0d, 0x84, 0xd7, 0x06, 0x65, 0x90, + 0x06, 0x13, 0x04, 0x30, 0x18, 0x83, 0x0d, 0x04, 0xb2, 0x54, 0xc4, 0x06, + 0x81, 0x81, 0x83, 0x09, 0xc2, 0xf0, 0x4d, 0x10, 0x08, 0x6f, 0x43, 0x43, + 0x40, 0x5c, 0xa7, 0x06, 0x6b, 0xe0, 0x06, 0x6f, 0x10, 0x07, 0x72, 0xc0, + 0xcd, 0x41, 0x1c, 0x4c, 0x10, 0x90, 0x60, 0x03, 0xb0, 0x61, 0x20, 0xec, + 0xc0, 0x0e, 0x36, 0x04, 0x77, 0xb0, 0x61, 0x18, 0xea, 0x00, 0x0f, 0x26, + 0x08, 0x61, 0x40, 0x06, 0x1b, 0x02, 0x3d, 0xa0, 0xd1, 0x16, 0x96, 0xe6, + 0xe6, 0x64, 0x35, 0x41, 0x50, 0xb6, 0x09, 0x82, 0xc2, 0x6d, 0x08, 0x88, + 0x09, 0x82, 0x92, 0x6c, 0x10, 0x2a, 0x6b, 0xc3, 0x42, 0xb0, 0x41, 0x1f, + 0xf8, 0xc1, 0x1f, 0xf8, 0xc1, 0x00, 0x0a, 0x84, 0x1f, 0x84, 0x02, 0x11, + 0xaa, 0x22, 0xac, 0xa1, 0xa7, 0x27, 0x29, 0xa2, 0x09, 0x82, 0x82, 0x6c, + 0x10, 0xaa, 0x6a, 0xc3, 0x32, 0x8c, 0x42, 0x1f, 0xf8, 0xc1, 0x1f, 0xf8, + 0xc1, 0x40, 0x0a, 0x83, 0x1f, 0x94, 0x02, 0x8b, 0xa1, 0x27, 0xa6, 0x27, + 0xa9, 0x09, 0x82, 0x72, 0x4c, 0x10, 0x92, 0x6b, 0x83, 0x50, 0xa5, 0xc2, + 0x86, 0x45, 0x3a, 0x85, 0x3e, 0xf0, 0x83, 0x3f, 0xf0, 0x83, 0x01, 0x15, + 0x24, 0x3f, 0x50, 0x85, 0x0d, 0x83, 0x28, 0x98, 0xc2, 0x2a, 0x70, 0x99, + 0xb2, 0xfa, 0x82, 0x7a, 0x9b, 0x4b, 0xa3, 0x4b, 0x7b, 0x73, 0xdb, 0xb0, + 0x10, 0xad, 0xd0, 0x07, 0xa0, 0xf0, 0x07, 0xa8, 0x30, 0xa0, 0x02, 0xe1, + 0x07, 0xaa, 0xb0, 0x61, 0x19, 0x46, 0xa1, 0x0f, 0xfc, 0xe0, 0x0f, 0x48, + 0x61, 0x20, 0x85, 0xc1, 0x0f, 0x4a, 0x61, 0xc3, 0x22, 0x9d, 0x42, 0x1f, + 0xf8, 0xc1, 0x1f, 0x90, 0xc2, 0x80, 0x0a, 0x92, 0x1f, 0xa8, 0xc2, 0x86, + 0xc1, 0x15, 0x5e, 0x01, 0x16, 0x36, 0x0c, 0xac, 0x10, 0x0b, 0xc0, 0x86, + 0xa2, 0x0e, 0xf8, 0x40, 0x16, 0x1e, 0x80, 0x86, 0x19, 0xdb, 0x5b, 0x18, + 0xdd, 0xdc, 0x04, 0x21, 0xc1, 0x58, 0xa4, 0xb9, 0xcd, 0xd1, 0xcd, 0x4d, + 0x10, 0x92, 0x8c, 0xc6, 0x5c, 0xda, 0xd9, 0x17, 0x1b, 0x19, 0x8d, 0xb9, + 0xb4, 0xb3, 0xaf, 0x39, 0xba, 0x09, 0x42, 0xa2, 0x6d, 0x40, 0x68, 0xa1, + 0x16, 0x6c, 0xe1, 0x16, 0x70, 0xe1, 0xca, 0x05, 0x5d, 0xa8, 0xc2, 0xc6, + 0x66, 0xd7, 0xe6, 0x92, 0x46, 0x56, 0xe6, 0x46, 0x37, 0x25, 0x08, 0xaa, + 0x90, 0xe1, 0xb9, 0xd8, 0x95, 0xc9, 0xcd, 0xa5, 0xbd, 0xb9, 0x4d, 0x09, + 0x88, 0x26, 0x64, 0x78, 0x2e, 0x76, 0x61, 0x6c, 0x76, 0x65, 0x72, 0x53, + 0x82, 0xa2, 0x0e, 0x19, 0x9e, 0xcb, 0x1c, 0x5a, 0x18, 0x59, 0x99, 0x5c, + 0xd3, 0x1b, 0x59, 0x19, 0xdb, 0x94, 0x00, 0x29, 0x43, 0x86, 0xe7, 0x22, + 0x57, 0x36, 0xf7, 0x56, 0x27, 0x37, 0x56, 0x36, 0x37, 0x25, 0x70, 0x2a, + 0x91, 0xe1, 0xb9, 0xd0, 0xe5, 0xc1, 0x95, 0x05, 0xb9, 0xb9, 0xbd, 0xd1, + 0x85, 0xd1, 0xa5, 0xbd, 0xb9, 0xcd, 0x4d, 0x11, 0xe6, 0x00, 0x0f, 0xea, + 0x90, 0xe1, 0xb9, 0xd8, 0xa5, 0x95, 0xdd, 0x25, 0x91, 0x4d, 0xd1, 0x85, + 0xd1, 0x95, 0x4d, 0x09, 0xf4, 0xa0, 0x0e, 0x19, 0x9e, 0x4b, 0x99, 0x1b, + 0x9d, 0x5c, 0x1e, 0xd4, 0x5b, 0x9a, 0x1b, 0xdd, 0xdc, 0x94, 0x40, 0x16, + 0xba, 0x90, 0xe1, 0xb9, 0x8c, 0xbd, 0xd5, 0xb9, 0xd1, 0x95, 0xc9, 0xcd, + 0x4d, 0x09, 0x74, 0x01, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x49, + 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, + 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, + 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, + 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, + 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, + 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, + 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, + 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, + 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, + 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, + 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, + 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, + 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, + 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, + 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, + 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, + 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, + 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, + 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, + 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, + 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, + 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, + 0xc3, 0x8c, 0xc8, 0x21, 0x07, 0x7c, 0x70, 0x03, 0x72, 0x10, 0x87, 0x73, + 0x70, 0x03, 0x7b, 0x08, 0x07, 0x79, 0x60, 0x87, 0x70, 0xc8, 0x87, 0x77, + 0xa8, 0x07, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x1c, + 0x00, 0x00, 0x00, 0x06, 0x00, 0x71, 0x4e, 0x23, 0x4d, 0x40, 0x33, 0x49, + 0xff, 0x42, 0x18, 0x80, 0x80, 0x19, 0xc1, 0x36, 0x5c, 0xbe, 0xf3, 0xf8, + 0x42, 0x40, 0x15, 0x05, 0x11, 0x95, 0x0e, 0x30, 0x94, 0x84, 0x01, 0x08, + 0x98, 0x5f, 0xdc, 0xb6, 0x19, 0x48, 0xc3, 0xe5, 0x3b, 0x8f, 0x2f, 0x44, + 0x04, 0x30, 0x11, 0x21, 0xd0, 0x0c, 0x0b, 0x61, 0x02, 0xd3, 0x70, 0xf9, + 0xce, 0xe3, 0x2f, 0x0e, 0x30, 0x88, 0xcd, 0x43, 0x4d, 0x7e, 0x71, 0xdb, + 0x36, 0x50, 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x34, 0x39, 0x11, 0x81, 0x52, + 0xd3, 0x43, 0x4d, 0x7e, 0x71, 0xdb, 0x56, 0x20, 0x0d, 0x97, 0xef, 0x3c, + 0xfe, 0x44, 0x44, 0x13, 0x02, 0x44, 0x98, 0x5f, 0xdc, 0xb6, 0x05, 0x18, + 0x0c, 0x80, 0x34, 0xe7, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, + 0x41, 0x53, 0x48, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, + 0x7e, 0xdd, 0xd9, 0x5c, 0x85, 0x79, 0x2c, 0xb5, 0xd6, 0x2b, 0x4f, 0x5a, + 0xb5, 0xd4, 0xd5, 0x44, 0x58, 0x49, 0x4c, 0x18, 0x09, 0x00, 0x00, 0x60, + 0x00, 0x01, 0x00, 0x46, 0x02, 0x00, 0x00, 0x44, 0x58, 0x49, 0x4c, 0x00, + 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x42, + 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0x3d, 0x02, 0x00, 0x00, 0x0b, + 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, + 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, + 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, + 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, 0x38, + 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x52, 0x88, 0x48, 0x90, 0x14, 0x20, 0x43, + 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, 0x90, 0x91, + 0x22, 0xc4, 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, 0x8a, 0x04, + 0x29, 0x46, 0x06, 0x51, 0x18, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1b, + 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, 0x02, 0xa8, 0x0d, 0x84, + 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x20, 0x6d, 0x30, 0x86, 0xff, 0xff, + 0xff, 0xff, 0x1f, 0x00, 0x09, 0xa8, 0x00, 0x49, 0x18, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, 0x4c, 0x08, 0x06, 0x00, + 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x32, + 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, + 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, + 0x84, 0xa4, 0x4c, 0x10, 0x6c, 0x23, 0x00, 0x25, 0x00, 0x14, 0x66, 0x00, + 0xe6, 0x08, 0xc0, 0x60, 0x8e, 0x00, 0x29, 0xc6, 0x20, 0x84, 0x14, 0x42, + 0xa6, 0x18, 0x80, 0x10, 0x52, 0x06, 0xa1, 0xa3, 0x86, 0xcb, 0x9f, 0xb0, + 0x87, 0x90, 0x7c, 0x6e, 0xa3, 0x8a, 0x95, 0x98, 0xfc, 0xe2, 0xb6, 0x11, + 0x31, 0xc6, 0x18, 0x54, 0xee, 0x19, 0x2e, 0x7f, 0xc2, 0x1e, 0x42, 0xf2, + 0x43, 0xa0, 0x19, 0x16, 0x02, 0x05, 0xab, 0x10, 0x8a, 0x30, 0x42, 0xad, + 0x14, 0x83, 0x8c, 0x31, 0xe8, 0xcd, 0x11, 0x04, 0xc5, 0x60, 0xa4, 0x10, + 0x12, 0x49, 0x0e, 0x04, 0x0c, 0x23, 0x10, 0x43, 0x12, 0xd4, 0x83, 0x83, + 0xe1, 0xf2, 0x81, 0x05, 0x31, 0x1a, 0x86, 0x68, 0x26, 0x7f, 0x21, 0x0c, + 0x40, 0xc0, 0x7c, 0x69, 0x8a, 0x28, 0x61, 0xf2, 0x5f, 0x22, 0x9a, 0x88, + 0x8b, 0x3d, 0x80, 0x81, 0x88, 0x38, 0xa7, 0x91, 0x26, 0xa0, 0x99, 0x24, + 0x24, 0x58, 0x7b, 0xdd, 0x70, 0xf9, 0xc0, 0x82, 0x18, 0x0d, 0x43, 0x34, + 0x93, 0xbf, 0x10, 0x06, 0x20, 0x60, 0x3e, 0xe7, 0x34, 0xd2, 0x04, 0x34, + 0x93, 0x84, 0x82, 0x4b, 0x38, 0x1d, 0x08, 0x00, 0x00, 0x00, 0x00, 0x13, + 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, 0x79, 0x68, + 0x03, 0x72, 0xc0, 0x87, 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, 0x0e, 0x7a, + 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, + 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, + 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, + 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, + 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, + 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, + 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0xa0, 0x07, 0x76, 0x40, 0x07, 0x43, 0x9e, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x3c, 0x06, 0x10, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x79, 0x10, 0x20, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xf2, 0x34, 0x40, + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xe4, 0x79, + 0x80, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xc8, + 0x23, 0x01, 0x01, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, + 0x16, 0x08, 0x00, 0x10, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x14, 0x19, + 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x22, 0x25, + 0x30, 0x02, 0x50, 0x0c, 0x05, 0x28, 0x50, 0x06, 0xe5, 0x50, 0x04, 0xe5, + 0x41, 0xa5, 0x24, 0x46, 0x00, 0xca, 0xa0, 0x08, 0x0a, 0x81, 0xf2, 0x0c, + 0x00, 0xe9, 0xb1, 0x1c, 0x86, 0x79, 0x9e, 0x07, 0x80, 0xc0, 0x00, 0x00, + 0x40, 0x04, 0x84, 0x40, 0x30, 0x00, 0x41, 0x01, 0x00, 0x00, 0x00, 0x79, + 0x18, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, + 0x02, 0x13, 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b, + 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1, + 0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, 0x0a, 0x9a, 0x2a, 0xfa, + 0x9a, 0xb9, 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, 0x63, 0x4b, 0xd9, 0x10, + 0x04, 0x13, 0x04, 0xc2, 0x98, 0x20, 0x10, 0xc7, 0x06, 0x61, 0x20, 0x26, + 0x08, 0x04, 0xb2, 0x41, 0x18, 0x0c, 0x0a, 0x76, 0x73, 0x1b, 0x06, 0xc4, + 0x20, 0x26, 0x08, 0xd9, 0x44, 0x60, 0x82, 0x40, 0x24, 0x1b, 0x10, 0x42, + 0x59, 0x08, 0x62, 0x60, 0x80, 0x0d, 0x41, 0xb3, 0x81, 0x00, 0x00, 0x07, + 0x98, 0x20, 0x68, 0xd4, 0x86, 0x00, 0x9a, 0x20, 0x08, 0x00, 0x8d, 0xb6, + 0xb0, 0x34, 0x37, 0x27, 0x2b, 0x22, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, + 0x4f, 0x4e, 0x13, 0x84, 0xc2, 0x99, 0x20, 0x14, 0xcf, 0x86, 0x80, 0x98, + 0x20, 0x14, 0xd0, 0x04, 0x81, 0x50, 0x26, 0x08, 0xc4, 0xb2, 0x41, 0xc8, + 0xb4, 0x0d, 0x0b, 0x41, 0x55, 0xd6, 0x65, 0x0d, 0x18, 0x61, 0x6d, 0x44, + 0xa8, 0x8a, 0xb0, 0x86, 0x9e, 0x9e, 0xa4, 0x88, 0x26, 0x08, 0x45, 0xb4, + 0x41, 0xc8, 0xb2, 0x0d, 0xcb, 0xd0, 0x55, 0xd6, 0x65, 0x0d, 0xde, 0x60, + 0x7d, 0x13, 0x04, 0x82, 0x61, 0x31, 0xf4, 0xc4, 0xf4, 0x24, 0x35, 0x41, + 0x28, 0xa4, 0x09, 0x02, 0xd1, 0x6c, 0x10, 0x32, 0x32, 0xd8, 0xb0, 0x84, + 0x81, 0x18, 0x54, 0xd6, 0x65, 0x0d, 0x63, 0x10, 0x06, 0x56, 0x19, 0x6c, + 0x18, 0x38, 0x30, 0x30, 0x03, 0x2e, 0x53, 0x56, 0x5f, 0x50, 0x6f, 0x73, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x1b, 0x16, 0x02, 0x0d, 0x2a, 0xec, 0x1a, + 0x83, 0x61, 0x0c, 0x08, 0xab, 0x0c, 0x36, 0x2c, 0x43, 0x57, 0x59, 0x97, + 0x37, 0x78, 0x83, 0xf5, 0x6d, 0x58, 0xc2, 0x40, 0x0c, 0x2a, 0xeb, 0xf2, + 0x86, 0x31, 0x08, 0x03, 0xab, 0x0c, 0x36, 0x0c, 0x69, 0xa0, 0x06, 0x6b, + 0xb0, 0x61, 0x38, 0x03, 0x36, 0x00, 0x36, 0x14, 0xd2, 0xd4, 0x06, 0x0f, + 0x50, 0x85, 0x8d, 0xcd, 0xae, 0xcd, 0x25, 0x8d, 0xac, 0xcc, 0x8d, 0x6e, + 0x4a, 0x10, 0x54, 0x21, 0xc3, 0x73, 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, + 0x73, 0x9b, 0x12, 0x10, 0x4d, 0xc8, 0xf0, 0x5c, 0xec, 0xc2, 0xd8, 0xec, + 0xca, 0xe4, 0xa6, 0x04, 0x46, 0x1d, 0x32, 0x3c, 0x97, 0x39, 0xb4, 0x30, + 0xb2, 0x32, 0xb9, 0xa6, 0x37, 0xb2, 0x32, 0xb6, 0x29, 0x01, 0x52, 0x86, + 0x0c, 0xcf, 0x45, 0xae, 0x6c, 0xee, 0xad, 0x4e, 0x6e, 0xac, 0x6c, 0x6e, + 0x4a, 0xe0, 0xd4, 0x21, 0xc3, 0x73, 0xb1, 0x4b, 0x2b, 0xbb, 0x4b, 0x22, + 0x9b, 0xa2, 0x0b, 0xa3, 0x2b, 0x9b, 0x12, 0x40, 0x75, 0xc8, 0xf0, 0x5c, + 0xca, 0xdc, 0xe8, 0xe4, 0xf2, 0xa0, 0xde, 0xd2, 0xdc, 0xe8, 0xe6, 0xa6, + 0x04, 0x6d, 0x00, 0x79, 0x18, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00, 0x33, + 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, + 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, + 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, + 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, + 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, + 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, + 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, + 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, + 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, + 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, + 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, + 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, + 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, + 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, + 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, + 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, + 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, + 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, + 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, + 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, + 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, + 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x8c, 0xc8, 0x21, + 0x07, 0x7c, 0x70, 0x03, 0x72, 0x10, 0x87, 0x73, 0x70, 0x03, 0x7b, 0x08, + 0x07, 0x79, 0x60, 0x87, 0x70, 0xc8, 0x87, 0x77, 0xa8, 0x07, 0x7a, 0x00, + 0x00, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x36, + 0xb0, 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x10, 0x50, 0x45, 0x41, 0x44, 0xa5, + 0x03, 0x0c, 0x25, 0x61, 0x00, 0x02, 0xe6, 0x17, 0xb7, 0x6d, 0x05, 0xd2, + 0x70, 0xf9, 0xce, 0xe3, 0x0b, 0x11, 0x01, 0x4c, 0x44, 0x08, 0x34, 0xc3, + 0x42, 0x58, 0xc0, 0x34, 0x5c, 0xbe, 0xf3, 0xf8, 0x8b, 0x03, 0x0c, 0x62, + 0xf3, 0x50, 0x93, 0x5f, 0xdc, 0xb6, 0x09, 0x54, 0xc3, 0xe5, 0x3b, 0x8f, + 0x2f, 0x4d, 0x4e, 0x44, 0xa0, 0xd4, 0xf4, 0x50, 0x93, 0x5f, 0xdc, 0xb6, + 0x11, 0x48, 0xc3, 0xe5, 0x3b, 0x8f, 0x3f, 0x11, 0xd1, 0x84, 0x00, 0x11, + 0xe6, 0x17, 0xb7, 0x6d, 0x00, 0x06, 0x03, 0x20, 0xcd, 0xf9, 0x02, 0x61, + 0x20, 0x00, 0x00, 0xcf, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, 0x10, + 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x44, 0x8a, 0xab, 0x14, 0x0a, + 0x61, 0x06, 0xa0, 0xec, 0x4a, 0x8e, 0x4a, 0x09, 0x50, 0x1c, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x20, 0x61, 0x03, + 0x63, 0x59, 0xc1, 0x88, 0x41, 0x02, 0x80, 0x20, 0x18, 0x18, 0xdd, 0x21, + 0x5d, 0x8f, 0x31, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x86, 0x87, 0x4c, + 0x18, 0x71, 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, 0x81, 0xf1, 0x25, 0x54, + 0xf6, 0x20, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0x80, 0x81, 0x52, + 0x69, 0x51, 0x32, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x46, 0x18, 0x2c, + 0xdc, 0x36, 0x29, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0x88, 0x01, + 0xd3, 0x71, 0xc8, 0x32, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0xc6, 0x18, + 0x34, 0x5d, 0x57, 0x31, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0x90, + 0x81, 0xe3, 0x79, 0x4a, 0x33, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x46, + 0x19, 0x3c, 0xdf, 0x57, 0x39, 0x23, 0x06, 0x07, 0x00, 0x82, 0x60, 0xd0, + 0x90, 0x81, 0xa3, 0x80, 0xc1, 0x68, 0x42, 0x00, 0x8c, 0x26, 0x08, 0xc1, + 0x68, 0xc2, 0x20, 0x8c, 0x26, 0x10, 0xc3, 0x88, 0xc1, 0x01, 0x80, 0x20, + 0x18, 0x34, 0x69, 0x30, 0x3d, 0x66, 0x30, 0x9a, 0x10, 0x00, 0xa3, 0x09, + 0x42, 0x30, 0x9a, 0x30, 0x08, 0xa3, 0x09, 0xc4, 0x30, 0x62, 0x70, 0x00, + 0x20, 0x08, 0x06, 0x8d, 0x1b, 0x60, 0x54, 0x19, 0x8c, 0x26, 0x04, 0xc0, + 0x68, 0x82, 0x10, 0x8c, 0x26, 0x0c, 0xc2, 0x68, 0x02, 0x31, 0x8c, 0x18, + 0x1c, 0x00, 0x08, 0x82, 0x41, 0x33, 0x07, 0x5d, 0xc6, 0x06, 0xa3, 0x09, + 0x01, 0x30, 0x9a, 0x20, 0x04, 0xa3, 0x09, 0x83, 0x30, 0x9a, 0x40, 0x0c, + 0x36, 0x5d, 0xf2, 0x19, 0x31, 0x40, 0x00, 0x10, 0x04, 0x83, 0x07, 0x0f, + 0xce, 0xe0, 0x7a, 0x82, 0x11, 0x03, 0x04, 0x00, 0x41, 0x30, 0x78, 0xf2, + 0x00, 0x0d, 0xae, 0x25, 0xb0, 0xe0, 0x80, 0x8e, 0x59, 0x9b, 0x7c, 0x46, + 0x0c, 0x10, 0x00, 0x04, 0xc1, 0xe0, 0xe1, 0x83, 0x35, 0xd8, 0xa4, 0x60, + 0xc4, 0x00, 0x01, 0x40, 0x10, 0x0c, 0x9e, 0x3e, 0x60, 0x83, 0xcd, 0x09, + 0x2c, 0x50, 0xa0, 0x63, 0xd9, 0x27, 0x9f, 0x11, 0x03, 0x04, 0x00, 0x41, + 0x30, 0x78, 0x40, 0xe1, 0x0d, 0xbe, 0x2a, 0x18, 0x31, 0x40, 0x00, 0x10, + 0x04, 0x83, 0x27, 0x14, 0xe0, 0xe0, 0x8b, 0x02, 0x0b, 0x1a, 0xe8, 0x18, + 0x37, 0x06, 0xf2, 0x19, 0x31, 0x40, 0x00, 0x10, 0x04, 0x83, 0x87, 0x14, + 0xe6, 0x60, 0x0c, 0xb0, 0x60, 0xc4, 0x00, 0x01, 0x40, 0x10, 0x0c, 0x9e, + 0x52, 0xa0, 0x83, 0x31, 0xa0, 0x02, 0x0b, 0x20, 0xe8, 0x8c, 0x18, 0x1c, + 0x00, 0x08, 0x82, 0x41, 0x83, 0x0a, 0x72, 0xe0, 0x06, 0x74, 0x30, 0x9a, + 0x10, 0x00, 0xa3, 0x09, 0x42, 0x30, 0x9a, 0x30, 0x08, 0xa3, 0x09, 0xc4, + 0x30, 0x62, 0x70, 0x00, 0x20, 0x08, 0x06, 0x4d, 0x2b, 0xdc, 0xc1, 0x1c, + 0xe8, 0xc1, 0x68, 0x42, 0x00, 0x8c, 0x26, 0x08, 0xc1, 0x68, 0xc2, 0x20, + 0x8c, 0x26, 0x10, 0xc3, 0x88, 0xc1, 0x01, 0x80, 0x20, 0x18, 0x34, 0xb2, + 0xc0, 0x07, 0x78, 0xd0, 0x0a, 0xa3, 0x09, 0x01, 0x30, 0x9a, 0x20, 0x04, + 0xa3, 0x09, 0x83, 0x30, 0x9a, 0x40, 0x0c, 0x23, 0x06, 0x07, 0x00, 0x82, + 0x60, 0xd0, 0xdc, 0x42, 0x28, 0xf4, 0xc1, 0x2b, 0x8c, 0x26, 0x04, 0xc0, + 0x68, 0x82, 0x10, 0x8c, 0x26, 0x0c, 0xc2, 0x68, 0x02, 0x31, 0xd8, 0x14, + 0x06, 0xf2, 0x19, 0x31, 0x40, 0x00, 0x10, 0x04, 0x83, 0x87, 0x17, 0x56, + 0xc1, 0x7b, 0x82, 0x11, 0x03, 0x04, 0x00, 0x41, 0x30, 0x78, 0x7a, 0x81, + 0x15, 0xb6, 0x25, 0x18, 0x31, 0x40, 0x00, 0x10, 0x04, 0x83, 0xc7, 0x17, + 0x5a, 0x01, 0x3b, 0x02, 0xb3, 0xca, 0x40, 0x3e, 0x23, 0x06, 0x08, 0x00, + 0x82, 0x60, 0xf0, 0x80, 0xc3, 0x2b, 0x88, 0x81, 0x14, 0x8c, 0x18, 0x20, + 0x00, 0x08, 0x82, 0xc1, 0x13, 0x0e, 0xb0, 0xf0, 0x39, 0xc1, 0x88, 0x01, + 0x02, 0x80, 0x20, 0x18, 0x3c, 0xe2, 0x10, 0x0b, 0x9c, 0x12, 0x58, 0x96, + 0x06, 0xf2, 0x19, 0x31, 0x40, 0x00, 0x10, 0x04, 0x83, 0x87, 0x1c, 0x66, + 0xc1, 0x0c, 0xaa, 0x60, 0xc4, 0x00, 0x01, 0x40, 0x10, 0x0c, 0x9e, 0x72, + 0xa0, 0x85, 0x31, 0x88, 0x82, 0x11, 0x03, 0x04, 0x00, 0x41, 0x30, 0x78, + 0xcc, 0xa1, 0x16, 0xc0, 0xa0, 0x09, 0x8c, 0x6b, 0x03, 0xf9, 0x8c, 0x18, + 0x20, 0x00, 0x08, 0x82, 0xc1, 0x83, 0x0e, 0xb7, 0xa0, 0x06, 0x58, 0x30, + 0x62, 0x80, 0x00, 0x20, 0x08, 0x06, 0x4f, 0x3a, 0xe0, 0xc2, 0x19, 0x50, + 0xc1, 0x88, 0x01, 0x02, 0x80, 0x20, 0x18, 0x3c, 0xea, 0x90, 0x0b, 0x64, + 0x00, 0x05, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x80, 0xb4, 0x43, 0x2e, + 0xa0, 0x03, 0x3a, 0x80, 0x43, 0x33, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, + 0x48, 0x3b, 0xe4, 0x02, 0x3a, 0xa0, 0x03, 0x2d, 0x24, 0x23, 0x06, 0x09, + 0x00, 0x82, 0x60, 0x80, 0xb4, 0x43, 0x2e, 0xa0, 0x03, 0x3a, 0xf8, 0x42, + 0x31, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x48, 0x3b, 0xe4, 0x02, 0x3a, + 0xa0, 0xc3, 0x2f, 0x04, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x80, 0xb4, + 0x43, 0x2e, 0xa4, 0x03, 0x3a, 0x80, 0x43, 0x2b, 0x8c, 0x18, 0x24, 0x00, + 0x08, 0x82, 0x01, 0xd2, 0x0e, 0xb9, 0x90, 0x0e, 0xe8, 0x40, 0x0b, 0xac, + 0x30, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x48, 0x3b, 0xe4, 0xc2, 0x38, + 0xa0, 0x03, 0x38, 0xc4, 0xc2, 0x88, 0x41, 0x02, 0x80, 0x20, 0x18, 0x20, + 0xed, 0x90, 0x0b, 0xe3, 0x80, 0x0e, 0xb4, 0x00, 0x0b, 0x23, 0x06, 0x09, + 0x00, 0x82, 0x60, 0x80, 0xb4, 0x43, 0x2e, 0x8c, 0x03, 0x3a, 0xf8, 0xc2, + 0x2b, 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, 0x01, 0xd2, 0x0e, 0xb9, 0x30, + 0x0e, 0xe8, 0xf0, 0x0b, 0xae, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +/* Root signature blobs extracted from Vertex Shader + dxc command line is: + dxc -E -T rootsig_1_1 -rootsig-define -Fo D3D12_VertexShader.hlsl + + Variables: + - : the root signature define + - : the output file name. + +*/ + +static unsigned char D3D12_RootSig_Color[] = { + 0x44, 0x58, 0x42, 0x43, 0x16, 0xb1, 0xe2, 0x29, 0x64, 0xb1, 0xb2, 0xe8, + 0x3c, 0xf7, 0xf6, 0x21, 0xad, 0x40, 0xa9, 0x50, 0x01, 0x00, 0x00, 0x00, + 0x5c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x52, 0x54, 0x53, 0x30, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x30, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00 +}; + +static unsigned char D3D12_RootSig_Texture[] = { + 0x44, 0x58, 0x42, 0x43, 0x7a, 0x3c, 0xe5, 0xd1, 0x3c, 0x38, 0x44, 0x34, + 0xda, 0xbc, 0x9b, 0xfc, 0xb3, 0xe7, 0x95, 0xaa, 0x01, 0x00, 0x00, 0x00, + 0xb4, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x52, 0x54, 0x53, 0x30, 0x88, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x88, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff +}; + +static unsigned char D3D12_RootSig_YUV[] = { + 0x44, 0x58, 0x42, 0x43, 0x65, 0xa2, 0x64, 0x32, 0x6e, 0x35, 0x8d, 0x76, + 0xf7, 0x54, 0x3c, 0x62, 0x2e, 0x8e, 0xa4, 0xbc, 0x01, 0x00, 0x00, 0x00, + 0x0c, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x52, 0x54, 0x53, 0x30, 0xe0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xe0, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, + 0x01, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, + 0xc8, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff +}; + +static unsigned char D3D12_RootSig_NV[] = { + 0x44, 0x58, 0x42, 0x43, 0x22, 0xd8, 0x7c, 0x4d, 0xb5, 0x44, 0x4a, 0xcd, + 0x25, 0xc2, 0x80, 0xac, 0x89, 0xb0, 0xa6, 0xfe, 0x01, 0x00, 0x00, 0x00, + 0xe0, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x52, 0x54, 0x53, 0x30, 0xb4, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xb4, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, + 0x01, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff +}; + +static struct +{ + const void *ps_shader_data; + SIZE_T ps_shader_size; + const void* vs_shader_data; + SIZE_T vs_shader_size; + D3D12_RootSignature root_sig; +} D3D12_shaders[NUM_SHADERS] = { + { + D3D12_PixelShader_Colors, sizeof(D3D12_PixelShader_Colors), + D3D12_VertexShader_Colors, sizeof(D3D12_VertexShader_Colors), + ROOTSIG_COLOR + }, + { + D3D12_PixelShader_Textures, sizeof(D3D12_PixelShader_Textures), + D3D12_VertexShader_Textures, sizeof(D3D12_VertexShader_Textures), + ROOTSIG_TEXTURE + }, +#if SDL_HAVE_YUV + { + D3D12_PixelShader_YUV_JPEG, sizeof(D3D12_PixelShader_YUV_JPEG), + D3D12_VertexShader_YUV, sizeof(D3D12_VertexShader_YUV), + ROOTSIG_YUV + }, + { + D3D12_PixelShader_YUV_BT601, sizeof(D3D12_PixelShader_YUV_BT601), + D3D12_VertexShader_YUV, sizeof(D3D12_VertexShader_YUV), + ROOTSIG_YUV + }, + { + D3D12_PixelShader_YUV_BT709, sizeof(D3D12_PixelShader_YUV_BT709), + D3D12_VertexShader_YUV, sizeof(D3D12_VertexShader_YUV), + ROOTSIG_YUV + }, + { + D3D12_PixelShader_NV12_JPEG, sizeof(D3D12_PixelShader_NV12_JPEG), + D3D12_VertexShader_NV, sizeof(D3D12_VertexShader_NV), + ROOTSIG_NV + }, + { + D3D12_PixelShader_NV12_BT601, sizeof(D3D12_PixelShader_NV12_BT601), + D3D12_VertexShader_NV, sizeof(D3D12_VertexShader_NV), + ROOTSIG_NV + }, + { + D3D12_PixelShader_NV12_BT709, sizeof(D3D12_PixelShader_NV12_BT709), + D3D12_VertexShader_NV, sizeof(D3D12_VertexShader_NV), + ROOTSIG_NV + }, + { + D3D12_PixelShader_NV21_JPEG, sizeof(D3D12_PixelShader_NV21_JPEG), + D3D12_VertexShader_NV, sizeof(D3D12_VertexShader_NV), + ROOTSIG_NV + }, + { + D3D12_PixelShader_NV21_BT601, sizeof(D3D12_PixelShader_NV21_BT601), + D3D12_VertexShader_NV, sizeof(D3D12_VertexShader_NV), + ROOTSIG_NV + }, + { + D3D12_PixelShader_NV21_BT709, sizeof(D3D12_PixelShader_NV21_BT709), + D3D12_VertexShader_NV, sizeof(D3D12_VertexShader_NV), + ROOTSIG_NV + }, +#endif +}; + +static struct { + const void* rs_shader_data; + SIZE_T rs_shader_size; +} D3D12_rootsigs[NUM_ROOTSIGS] = { + {D3D12_RootSig_Color, sizeof(D3D12_RootSig_Color)}, + {D3D12_RootSig_Texture, sizeof(D3D12_RootSig_Texture)}, +#if SDL_HAVE_YUV + {D3D12_RootSig_YUV, sizeof(D3D12_RootSig_YUV)}, + {D3D12_RootSig_NV, sizeof(D3D12_RootSig_NV)}, +#endif +}; + +void D3D12_GetVertexShader(D3D12_Shader shader, D3D12_SHADER_BYTECODE *outBytecode) +{ + outBytecode->pShaderBytecode = D3D12_shaders[shader].vs_shader_data; + outBytecode->BytecodeLength = D3D12_shaders[shader].vs_shader_size; +} + +void D3D12_GetPixelShader(D3D12_Shader shader, D3D12_SHADER_BYTECODE *outBytecode) +{ + outBytecode->pShaderBytecode = D3D12_shaders[shader].ps_shader_data; + outBytecode->BytecodeLength = D3D12_shaders[shader].ps_shader_size; +} + +D3D12_RootSignature D3D12_GetRootSignatureType(D3D12_Shader shader) +{ + return D3D12_shaders[shader].root_sig; +} + +void D3D12_GetRootSignatureData(D3D12_RootSignature rootSig, D3D12_SHADER_BYTECODE *outBytecode) +{ + outBytecode->pShaderBytecode = D3D12_rootsigs[rootSig].rs_shader_data; + outBytecode->BytecodeLength = D3D12_rootsigs[rootSig].rs_shader_size; +} + +#endif /* SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) */ + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/render/direct3d12/SDL_shaders_d3d12.h libsdl2-2.24.0+dfsg/src/render/direct3d12/SDL_shaders_d3d12.h --- libsdl2-2.0.22+dfsg/src/render/direct3d12/SDL_shaders_d3d12.h 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/render/direct3d12/SDL_shaders_d3d12.h 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,67 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +/* D3D12 shader implementation */ + +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + SHADER_SOLID, + SHADER_RGB, +#if SDL_HAVE_YUV + SHADER_YUV_JPEG, + SHADER_YUV_BT601, + SHADER_YUV_BT709, + SHADER_NV12_JPEG, + SHADER_NV12_BT601, + SHADER_NV12_BT709, + SHADER_NV21_JPEG, + SHADER_NV21_BT601, + SHADER_NV21_BT709, +#endif + NUM_SHADERS +} D3D12_Shader; + +typedef enum { + ROOTSIG_COLOR, + ROOTSIG_TEXTURE, +#if SDL_HAVE_YUV + ROOTSIG_YUV, + ROOTSIG_NV, +#endif + NUM_ROOTSIGS +} D3D12_RootSignature; + +extern void D3D12_GetVertexShader(D3D12_Shader shader, D3D12_SHADER_BYTECODE *outBytecode); +extern void D3D12_GetPixelShader(D3D12_Shader shader, D3D12_SHADER_BYTECODE *outBytecode); +extern D3D12_RootSignature D3D12_GetRootSignatureType(D3D12_Shader shader); +extern void D3D12_GetRootSignatureData(D3D12_RootSignature rootSig, D3D12_SHADER_BYTECODE* outBytecode); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/render/direct3d12/SDL_shaders_d3d12_xboxone.cpp libsdl2-2.24.0+dfsg/src/render/direct3d12/SDL_shaders_d3d12_xboxone.cpp --- libsdl2-2.0.22+dfsg/src/render/direct3d12/SDL_shaders_d3d12_xboxone.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/render/direct3d12/SDL_shaders_d3d12_xboxone.cpp 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,29 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && defined(__XBOXONE__) + +#error "This is a placeholder Xbox file, as the real one is under NDA. See README-gdk.md for more info." + +#endif /* SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && defined(__XBOXONE__) */ + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/render/direct3d12/SDL_shaders_d3d12_xboxseries.cpp libsdl2-2.24.0+dfsg/src/render/direct3d12/SDL_shaders_d3d12_xboxseries.cpp --- libsdl2-2.0.22+dfsg/src/render/direct3d12/SDL_shaders_d3d12_xboxseries.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/render/direct3d12/SDL_shaders_d3d12_xboxseries.cpp 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,29 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && defined(__XBOXSERIES__) + +#error "This is a placeholder Xbox file, as the real one is under NDA. See README-gdk.md for more info." + +#endif /* SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && defined(__XBOXSERIES__) */ + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/render/metal/SDL_render_metal.m libsdl2-2.24.0+dfsg/src/render/metal/SDL_render_metal.m --- libsdl2-2.0.22+dfsg/src/render/metal/SDL_render_metal.m 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/render/metal/SDL_render_metal.m 2022-08-13 03:48:10.000000000 +0000 @@ -142,24 +142,6 @@ @end @implementation METAL_RenderData -#if !__has_feature(objc_arc) -- (void)dealloc -{ - [_mtldevice release]; - [_mtlcmdqueue release]; - [_mtlcmdbuffer release]; - [_mtlcmdencoder release]; - [_mtllibrary release]; - [_mtlbackbuffer release]; - [_mtlsamplernearest release]; - [_mtlsamplerlinear release]; - [_mtlbufconstants release]; - [_mtlbufquadindices release]; - [_mtllayer release]; - [_mtlpassdesc release]; - [super dealloc]; -} -#endif @end @interface METAL_TextureData : NSObject @@ -178,16 +160,6 @@ @end @implementation METAL_TextureData -#if !__has_feature(objc_arc) -- (void)dealloc -{ - [_mtltexture release]; - [_mtltexture_uv release]; - [_mtlsampler release]; - [_lockedbuffer release]; - [super dealloc]; -} -#endif @end static int @@ -268,16 +240,24 @@ MakePipelineState(METAL_RenderData *data, METAL_PipelineCache *cache, NSString *blendlabel, SDL_BlendMode blendmode) { + MTLRenderPipelineDescriptor *mtlpipedesc; + MTLVertexDescriptor *vertdesc; + MTLRenderPipelineColorAttachmentDescriptor *rtdesc; + NSError *err = nil; + id state; + METAL_PipelineState pipeline; + METAL_PipelineState *states; + id mtlvertfn = [data.mtllibrary newFunctionWithName:GetVertexFunctionName(cache->vertexFunction)]; id mtlfragfn = [data.mtllibrary newFunctionWithName:GetFragmentFunctionName(cache->fragmentFunction)]; SDL_assert(mtlvertfn != nil); SDL_assert(mtlfragfn != nil); - MTLRenderPipelineDescriptor *mtlpipedesc = [[MTLRenderPipelineDescriptor alloc] init]; + mtlpipedesc = [[MTLRenderPipelineDescriptor alloc] init]; mtlpipedesc.vertexFunction = mtlvertfn; mtlpipedesc.fragmentFunction = mtlfragfn; - MTLVertexDescriptor *vertdesc = [MTLVertexDescriptor vertexDescriptor]; + vertdesc = [MTLVertexDescriptor vertexDescriptor]; switch (cache->vertexFunction) { case SDL_METAL_VERTEX_SOLID: @@ -315,7 +295,7 @@ mtlpipedesc.vertexDescriptor = vertdesc; - MTLRenderPipelineColorAttachmentDescriptor *rtdesc = mtlpipedesc.colorAttachments[0]; + rtdesc = mtlpipedesc.colorAttachments[0]; rtdesc.pixelFormat = cache->renderTargetFormat; if (blendmode != SDL_BLENDMODE_NONE) { @@ -332,22 +312,13 @@ mtlpipedesc.label = [@(cache->label) stringByAppendingString:blendlabel]; - NSError *err = nil; - id state = [data.mtldevice newRenderPipelineStateWithDescriptor:mtlpipedesc error:&err]; + state = [data.mtldevice newRenderPipelineStateWithDescriptor:mtlpipedesc error:&err]; SDL_assert(err == nil); - METAL_PipelineState pipeline; pipeline.blendMode = blendmode; pipeline.pipe = (void *)CFBridgingRetain(state); - METAL_PipelineState *states = SDL_realloc(cache->states, (cache->count + 1) * sizeof(pipeline)); - -#if !__has_feature(objc_arc) - [mtlpipedesc release]; // !!! FIXME: can these be reused for each creation, or does the pipeline obtain it? - [mtlvertfn release]; - [mtlfragfn release]; - [state release]; -#endif + states = SDL_realloc(cache->states, (cache->count + 1) * sizeof(pipeline)); if (states) { states[cache->count++] = pipeline; @@ -577,6 +548,10 @@ { @autoreleasepool { METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; MTLPixelFormat pixfmt; + MTLTextureDescriptor *mtltexdesc; + id mtltexture, mtltexture_uv; + BOOL yuv, nv12; + METAL_TextureData *texturedata; switch (texture->format) { case SDL_PIXELFORMAT_ABGR8888: @@ -595,7 +570,7 @@ return SDL_SetError("Texture format %s not supported by Metal", SDL_GetPixelFormatName(texture->format)); } - MTLTextureDescriptor *mtltexdesc = [MTLTextureDescriptor texture2DDescriptorWithPixelFormat:pixfmt + mtltexdesc = [MTLTextureDescriptor texture2DDescriptorWithPixelFormat:pixfmt width:(NSUInteger)texture->w height:(NSUInteger)texture->h mipmapped:NO]; /* Not available in iOS 8. */ @@ -607,15 +582,15 @@ } } - id mtltexture = [data.mtldevice newTextureWithDescriptor:mtltexdesc]; + mtltexture = [data.mtldevice newTextureWithDescriptor:mtltexdesc]; if (mtltexture == nil) { return SDL_SetError("Texture allocation failed"); } - id mtltexture_uv = nil; + mtltexture_uv = nil; #if SDL_HAVE_YUV - BOOL yuv = (texture->format == SDL_PIXELFORMAT_IYUV) || (texture->format == SDL_PIXELFORMAT_YV12); - BOOL nv12 = (texture->format == SDL_PIXELFORMAT_NV12) || (texture->format == SDL_PIXELFORMAT_NV21); + yuv = (texture->format == SDL_PIXELFORMAT_IYUV) || (texture->format == SDL_PIXELFORMAT_YV12); + nv12 = (texture->format == SDL_PIXELFORMAT_NV12) || (texture->format == SDL_PIXELFORMAT_NV21); if (yuv) { mtltexdesc.pixelFormat = MTLPixelFormatR8Unorm; @@ -632,14 +607,11 @@ if (yuv || nv12) { mtltexture_uv = [data.mtldevice newTextureWithDescriptor:mtltexdesc]; if (mtltexture_uv == nil) { -#if !__has_feature(objc_arc) - [mtltexture release]; -#endif return SDL_SetError("Texture allocation failed"); } } #endif /* SDL_HAVE_YUV */ - METAL_TextureData *texturedata = [[METAL_TextureData alloc] init]; + texturedata = [[METAL_TextureData alloc] init]; if (texture->scaleMode == SDL_ScaleModeNearest) { texturedata.mtlsampler = data.mtlsamplernearest; } else { @@ -677,12 +649,6 @@ #endif texture->driverdata = (void*)CFBridgingRetain(texturedata); -#if !__has_feature(objc_arc) - [texturedata release]; - [mtltexture release]; - [mtltexture_uv release]; -#endif - return 0; }} @@ -716,6 +682,8 @@ METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; SDL_Rect stagingrect = {0, 0, rect.w, rect.h}; MTLTextureDescriptor *desc; + id stagingtex; + id blitcmd; /* If the texture is managed or shared and this is the first upload, we can * use replaceRegion to upload to it directly. Otherwise we upload the data @@ -737,15 +705,11 @@ /* TODO: We could have a pool of textures or a MTLHeap we allocate from, * and release a staging texture back to the pool in the command buffer's * completion handler. */ - id stagingtex = [data.mtldevice newTextureWithDescriptor:desc]; + stagingtex = [data.mtldevice newTextureWithDescriptor:desc]; if (stagingtex == nil) { return SDL_OutOfMemory(); } -#if !__has_feature(objc_arc) - [stagingtex autorelease]; -#endif - METAL_UploadTextureData(stagingtex, stagingrect, 0, pixels, pitch); if (data.mtlcmdencoder != nil) { @@ -757,7 +721,7 @@ data.mtlcmdbuffer = [data.mtlcmdqueue commandBuffer]; } - id blitcmd = [data.mtlcmdbuffer blitCommandEncoder]; + blitcmd = [data.mtlcmdbuffer blitCommandEncoder]; [blitcmd copyFromTexture:stagingtex sourceSlice:0 @@ -917,11 +881,6 @@ texturedata.lockedbuffer = lockedbuffer; *pixels = [lockedbuffer contents]; - /* METAL_TextureData.lockedbuffer retains. */ -#if !__has_feature(objc_arc) - [lockedbuffer release]; -#endif - return 0; }} @@ -930,6 +889,7 @@ { @autoreleasepool { METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->driverdata; + id blitcmd; SDL_Rect rect = texturedata.lockedrect; int pitch = SDL_BYTESPERPIXEL(texture->format) * rect.w; SDL_Rect UVrect = {rect.x / 2, rect.y / 2, (rect.w + 1) / 2, (rect.h + 1) / 2}; @@ -947,7 +907,7 @@ data.mtlcmdbuffer = [data.mtlcmdqueue commandBuffer]; } - id blitcmd = [data.mtlcmdbuffer blitCommandEncoder]; + blitcmd = [data.mtlcmdbuffer blitCommandEncoder]; [blitcmd copyFromBuffer:texturedata.lockedbuffer sourceOffset:0 @@ -1121,11 +1081,13 @@ cmd->data.draw.b, cmd->data.draw.a }; + size_t vertlen; + float *verts; SDL_assert(count >= 2); /* should have been checked at the higher level. */ - const size_t vertlen = (2 * sizeof (float) + sizeof (SDL_Color)) * count; - float *verts = (float *) SDL_AllocateRenderVertices(renderer, vertlen, DEVICE_ALIGN(8), &cmd->data.draw.first); + vertlen = (2 * sizeof (float) + sizeof (SDL_Color)) * count; + verts = (float *) SDL_AllocateRenderVertices(renderer, vertlen, DEVICE_ALIGN(8), &cmd->data.draw.first); if (!verts) { return -1; } @@ -1148,15 +1110,17 @@ points -= 2; /* update the last line. */ verts -= 2 + 1; - const float xstart = points[0].x; - const float ystart = points[0].y; - const float xend = points[1].x; - const float yend = points[1].y; - - if (ystart == yend) { /* horizontal line */ - verts[0] += (xend > xstart) ? 1.0f : -1.0f; - } else if (xstart == xend) { /* vertical line */ - verts[1] += (yend > ystart) ? 1.0f : -1.0f; + { + const float xstart = points[0].x; + const float ystart = points[0].y; + const float xend = points[1].x; + const float yend = points[1].y; + + if (ystart == yend) { /* horizontal line */ + verts[0] += (xend > xstart) ? 1.0f : -1.0f; + } else if (xstart == xend) { /* vertical line */ + verts[1] += (yend > ystart) ? 1.0f : -1.0f; + } } return 0; @@ -1180,6 +1144,7 @@ for (int i = 0; i < count; i++) { int j; + float *xy_; if (size_indices == 4) { j = ((const Uint32 *)indices)[i]; } else if (size_indices == 2) { @@ -1190,7 +1155,7 @@ j = i; } - float *xy_ = (float *)((char*)xy + j * xy_stride); + xy_ = (float *)((char*)xy + j * xy_stride); *(verts++) = xy_[0] * scale_x; *(verts++) = xy_[1] * scale_y; @@ -1209,13 +1174,8 @@ typedef struct { - #if __has_feature(objc_arc) __unsafe_unretained id pipeline; __unsafe_unretained id vertex_buffer; - #else - id pipeline; - id vertex_buffer; - #endif size_t constants_offset; SDL_Texture *texture; SDL_bool cliprect_dirty; @@ -1340,11 +1300,10 @@ METAL_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize) { @autoreleasepool { METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + id mtlbufvertex = nil; METAL_DrawStateCache statecache; SDL_zero(statecache); - id mtlbufvertex = nil; - statecache.pipeline = nil; statecache.vertex_buffer = nil; statecache.constants_offset = CONSTANTS_OFFSET_INVALID; @@ -1365,9 +1324,6 @@ * TODO: this buffer is also used for constants. Is performance still * good for those, or should we have a managed buffer for them? */ mtlbufvertex = [data.mtldevice newBufferWithLength:vertsize options:MTLResourceStorageModeShared]; - #if !__has_feature(objc_arc) - [mtlbufvertex autorelease]; - #endif mtlbufvertex.label = @"SDL vertex data"; SDL_memcpy([mtlbufvertex contents], vertices, vertsize); @@ -1424,15 +1380,17 @@ statecache.cliprect_dirty = SDL_TRUE; statecache.viewport_dirty = SDL_TRUE; - const Uint8 r = cmd->data.color.r; - const Uint8 g = cmd->data.color.g; - const Uint8 b = cmd->data.color.b; - const Uint8 a = cmd->data.color.a; - MTLClearColor color = MTLClearColorMake(r / 255.0f, g / 255.0f, b / 255.0f, a / 255.0f); - - // get new command encoder, set up with an initial clear operation. - // (this might fail, and future draw operations will notice.) - METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionClear, &color, mtlbufvertex); + { + const Uint8 r = cmd->data.color.r; + const Uint8 g = cmd->data.color.g; + const Uint8 b = cmd->data.color.b; + const Uint8 a = cmd->data.color.a; + MTLClearColor color = MTLClearColorMake(r / 255.0f, g / 255.0f, b / 255.0f, a / 255.0f); + + // get new command encoder, set up with an initial clear operation. + // (this might fail, and future draw operations will notice.) + METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionClear, &color, mtlbufvertex); + } break; } @@ -1485,12 +1443,17 @@ Uint32 pixel_format, void * pixels, int pitch) { @autoreleasepool { METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + id mtltexture; + MTLRegion mtlregion; + int temp_pitch, status; + Uint32 temp_format; + void *temp_pixels; if (!METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad, NULL, nil)) { return SDL_SetError("Failed to activate render command encoder (is your window in the background?"); } [data.mtlcmdencoder endEncoding]; - id mtltexture = data.mtlpassdesc.colorAttachments[0].texture; + mtltexture = data.mtlpassdesc.colorAttachments[0].texture; #ifdef __MACOSX__ /* on macOS with managed-storage textures, we need to tell the driver to @@ -1511,19 +1474,19 @@ data.mtlcmdencoder = nil; data.mtlcmdbuffer = nil; - MTLRegion mtlregion = MTLRegionMake2D(rect->x, rect->y, rect->w, rect->h); + mtlregion = MTLRegionMake2D(rect->x, rect->y, rect->w, rect->h); // we only do BGRA8 or RGBA8 at the moment, so 4 will do. - const int temp_pitch = rect->w * 4; - void *temp_pixels = SDL_malloc(temp_pitch * rect->h); + temp_pitch = rect->w * 4; + temp_pixels = SDL_malloc(temp_pitch * rect->h); if (!temp_pixels) { return SDL_OutOfMemory(); } [mtltexture getBytes:temp_pixels bytesPerRow:temp_pitch fromRegion:mtlregion mipmapLevel:0]; - const Uint32 temp_format = (mtltexture.pixelFormat == MTLPixelFormatBGRA8Unorm) ? SDL_PIXELFORMAT_ARGB8888 : SDL_PIXELFORMAT_ABGR8888; - const int status = SDL_ConvertPixels(rect->w, rect->h, temp_format, temp_pixels, temp_pitch, pixel_format, pixels, pitch); + temp_format = (mtltexture.pixelFormat == MTLPixelFormatBGRA8Unorm) ? SDL_PIXELFORMAT_ARGB8888 : SDL_PIXELFORMAT_ABGR8888; + status = SDL_ConvertPixels(rect->w, rect->h, temp_format, temp_pixels, temp_pitch, pixel_format, pixels, pitch); SDL_free(temp_pixels); return status; }} @@ -1603,8 +1566,9 @@ // note that data.mtlcmdencoder can be nil if METAL_ActivateRenderCommandEncoder fails. // Before SDL 2.0.18, it might have returned a non-nil encoding that might not have been // usable for presentation. Check your return values! + METAL_RenderData *data; METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad, NULL, nil); - METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + data = (__bridge METAL_RenderData *) renderer->driverdata; return (__bridge void*)data.mtlcmdencoder; }} @@ -1664,8 +1628,58 @@ SDL_MetalView view = NULL; CAMetalLayer *layer = nil; SDL_SysWMinfo syswm; - Uint32 window_flags; SDL_bool changed_window = SDL_FALSE; + NSError *err = nil; + dispatch_data_t mtllibdata; + char *constantdata; + int maxtexsize, quadcount = UINT16_MAX / 4; + UInt16 *indexdata; + Uint32 window_flags; + size_t indicessize = sizeof(UInt16) * quadcount * 6; + MTLSamplerDescriptor *samplerdesc; + id mtlcmdqueue; + id mtllibrary; + id mtlsamplernearest, mtlsamplerlinear; + id mtlbufconstantstaging, mtlbufquadindicesstaging, mtlbufconstants, mtlbufquadindices; + id cmdbuffer; + id blitcmd; + + /* Note: matrices are column major. */ + float identitytransform[16] = { + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f, + }; + + float halfpixeltransform[16] = { + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.5f, 0.5f, 0.0f, 1.0f, + }; + + /* Metal pads float3s to 16 bytes. */ + float decodetransformJPEG[4*4] = { + 0.0, -0.501960814, -0.501960814, 0.0, /* offset */ + 1.0000, 0.0000, 1.4020, 0.0, /* Rcoeff */ + 1.0000, -0.3441, -0.7141, 0.0, /* Gcoeff */ + 1.0000, 1.7720, 0.0000, 0.0, /* Bcoeff */ + }; + + float decodetransformBT601[4*4] = { + -0.0627451017, -0.501960814, -0.501960814, 0.0, /* offset */ + 1.1644, 0.0000, 1.5960, 0.0, /* Rcoeff */ + 1.1644, -0.3918, -0.8130, 0.0, /* Gcoeff */ + 1.1644, 2.0172, 0.0000, 0.0, /* Bcoeff */ + }; + + float decodetransformBT709[4*4] = { + 0.0, -0.501960814, -0.501960814, 0.0, /* offset */ + 1.0000, 0.0000, 1.4020, 0.0, /* Rcoeff */ + 1.0000, -0.3441, -0.7141, 0.0, /* Gcoeff */ + 1.0000, 1.7720, 0.0000, 0.0, /* Bcoeff */ + }; SDL_VERSION(&syswm.version); if (!SDL_GetWindowWMInfo(window, &syswm)) { @@ -1711,9 +1725,6 @@ } if (view == NULL) { -#if !__has_feature(objc_arc) - [mtldevice release]; -#endif SDL_free(renderer); if (changed_window) { SDL_RecreateWindow(window, window_flags); @@ -1725,9 +1736,6 @@ data = [[METAL_RenderData alloc] init]; if (data == nil) { -#if !__has_feature(objc_arc) - [mtldevice release]; -#endif /* Release the metal view instead of destroying it, in case we want to use it later (recreating the renderer) */ @@ -1746,7 +1754,7 @@ data.mtlview = view; #ifdef __MACOSX__ - layer = (CAMetalLayer *)[(NSView *)view layer]; + layer = (CAMetalLayer *)[(__bridge NSView *)view layer]; #else layer = (CAMetalLayer *)[(__bridge UIView *)view layer]; #endif @@ -1758,22 +1766,17 @@ data.mtldevice = layer.device; data.mtllayer = layer; - id mtlcmdqueue = [data.mtldevice newCommandQueue]; + mtlcmdqueue = [data.mtldevice newCommandQueue]; data.mtlcmdqueue = mtlcmdqueue; data.mtlcmdqueue.label = @"SDL Metal Renderer"; data.mtlpassdesc = [MTLRenderPassDescriptor renderPassDescriptor]; - NSError *err = nil; - // The compiled .metallib is embedded in a static array in a header file // but the original shader source code is in SDL_shaders_metal.metal. - dispatch_data_t mtllibdata = dispatch_data_create(sdl_metallib, sdl_metallib_len, dispatch_get_global_queue(0, 0), ^{}); - id mtllibrary = [data.mtldevice newLibraryWithData:mtllibdata error:&err]; + mtllibdata = dispatch_data_create(sdl_metallib, sdl_metallib_len, dispatch_get_global_queue(0, 0), ^{}); + mtllibrary = [data.mtldevice newLibraryWithData:mtllibdata error:&err]; data.mtllibrary = mtllibrary; SDL_assert(err == nil); -#if !__has_feature(objc_arc) - dispatch_release(mtllibdata); -#endif data.mtllibrary.label = @"SDL Metal renderer shader library"; /* Do some shader pipeline state loading up-front rather than on demand. */ @@ -1781,80 +1784,35 @@ data.allpipelines = NULL; ChooseShaderPipelines(data, MTLPixelFormatBGRA8Unorm); - MTLSamplerDescriptor *samplerdesc = [[MTLSamplerDescriptor alloc] init]; + samplerdesc = [[MTLSamplerDescriptor alloc] init]; samplerdesc.minFilter = MTLSamplerMinMagFilterNearest; samplerdesc.magFilter = MTLSamplerMinMagFilterNearest; - id mtlsamplernearest = [data.mtldevice newSamplerStateWithDescriptor:samplerdesc]; + mtlsamplernearest = [data.mtldevice newSamplerStateWithDescriptor:samplerdesc]; data.mtlsamplernearest = mtlsamplernearest; samplerdesc.minFilter = MTLSamplerMinMagFilterLinear; samplerdesc.magFilter = MTLSamplerMinMagFilterLinear; - id mtlsamplerlinear = [data.mtldevice newSamplerStateWithDescriptor:samplerdesc]; + mtlsamplerlinear = [data.mtldevice newSamplerStateWithDescriptor:samplerdesc]; data.mtlsamplerlinear = mtlsamplerlinear; - /* Note: matrices are column major. */ - float identitytransform[16] = { - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f, - }; - - float halfpixeltransform[16] = { - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, 0.0f, - 0.5f, 0.5f, 0.0f, 1.0f, - }; - - /* Metal pads float3s to 16 bytes. */ - float decodetransformJPEG[4*4] = { - 0.0, -0.501960814, -0.501960814, 0.0, /* offset */ - 1.0000, 0.0000, 1.4020, 0.0, /* Rcoeff */ - 1.0000, -0.3441, -0.7141, 0.0, /* Gcoeff */ - 1.0000, 1.7720, 0.0000, 0.0, /* Bcoeff */ - }; + mtlbufconstantstaging = [data.mtldevice newBufferWithLength:CONSTANTS_LENGTH options:MTLResourceStorageModeShared]; - float decodetransformBT601[4*4] = { - -0.0627451017, -0.501960814, -0.501960814, 0.0, /* offset */ - 1.1644, 0.0000, 1.5960, 0.0, /* Rcoeff */ - 1.1644, -0.3918, -0.8130, 0.0, /* Gcoeff */ - 1.1644, 2.0172, 0.0000, 0.0, /* Bcoeff */ - }; - - float decodetransformBT709[4*4] = { - 0.0, -0.501960814, -0.501960814, 0.0, /* offset */ - 1.0000, 0.0000, 1.4020, 0.0, /* Rcoeff */ - 1.0000, -0.3441, -0.7141, 0.0, /* Gcoeff */ - 1.0000, 1.7720, 0.0000, 0.0, /* Bcoeff */ - }; - - id mtlbufconstantstaging = [data.mtldevice newBufferWithLength:CONSTANTS_LENGTH options:MTLResourceStorageModeShared]; - #if !__has_feature(objc_arc) - [mtlbufconstantstaging autorelease]; - #endif - - char *constantdata = [mtlbufconstantstaging contents]; + constantdata = [mtlbufconstantstaging contents]; SDL_memcpy(constantdata + CONSTANTS_OFFSET_IDENTITY, identitytransform, sizeof(identitytransform)); SDL_memcpy(constantdata + CONSTANTS_OFFSET_HALF_PIXEL_TRANSFORM, halfpixeltransform, sizeof(halfpixeltransform)); SDL_memcpy(constantdata + CONSTANTS_OFFSET_DECODE_JPEG, decodetransformJPEG, sizeof(decodetransformJPEG)); SDL_memcpy(constantdata + CONSTANTS_OFFSET_DECODE_BT601, decodetransformBT601, sizeof(decodetransformBT601)); SDL_memcpy(constantdata + CONSTANTS_OFFSET_DECODE_BT709, decodetransformBT709, sizeof(decodetransformBT709)); - int quadcount = UINT16_MAX / 4; - size_t indicessize = sizeof(UInt16) * quadcount * 6; - id mtlbufquadindicesstaging = [data.mtldevice newBufferWithLength:indicessize options:MTLResourceStorageModeShared]; -#if !__has_feature(objc_arc) - [mtlbufquadindicesstaging autorelease]; -#endif + mtlbufquadindicesstaging = [data.mtldevice newBufferWithLength:indicessize options:MTLResourceStorageModeShared]; /* Quads in the following vertex order (matches the FillRects vertices): * 1---3 * | \ | * 0---2 */ - UInt16 *indexdata = [mtlbufquadindicesstaging contents]; + indexdata = [mtlbufquadindicesstaging contents]; for (int i = 0; i < quadcount; i++) { indexdata[i * 6 + 0] = i * 4 + 0; indexdata[i * 6 + 1] = i * 4 + 1; @@ -1865,16 +1823,16 @@ indexdata[i * 6 + 5] = i * 4 + 3; } - id mtlbufconstants = [data.mtldevice newBufferWithLength:CONSTANTS_LENGTH options:MTLResourceStorageModePrivate]; + mtlbufconstants = [data.mtldevice newBufferWithLength:CONSTANTS_LENGTH options:MTLResourceStorageModePrivate]; data.mtlbufconstants = mtlbufconstants; data.mtlbufconstants.label = @"SDL constant data"; - id mtlbufquadindices = [data.mtldevice newBufferWithLength:indicessize options:MTLResourceStorageModePrivate]; + mtlbufquadindices = [data.mtldevice newBufferWithLength:indicessize options:MTLResourceStorageModePrivate]; data.mtlbufquadindices = mtlbufquadindices; data.mtlbufquadindices.label = @"SDL quad index buffer"; - id cmdbuffer = [data.mtlcmdqueue commandBuffer]; - id blitcmd = [cmdbuffer blitCommandEncoder]; + cmdbuffer = [data.mtlcmdqueue commandBuffer]; + blitcmd = [cmdbuffer blitCommandEncoder]; [blitcmd copyFromBuffer:mtlbufconstantstaging sourceOffset:0 toBuffer:mtlbufconstants destinationOffset:0 size:CONSTANTS_LENGTH]; [blitcmd copyFromBuffer:mtlbufquadindicesstaging sourceOffset:0 toBuffer:mtlbufquadindices destinationOffset:0 size:indicessize]; @@ -1929,7 +1887,7 @@ } /* https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf */ - int maxtexsize = 4096; + maxtexsize = 4096; #if defined(__MACOSX__) || TARGET_OS_MACCATALYST maxtexsize = 16384; #elif defined(__TVOS__) @@ -1965,18 +1923,6 @@ renderer->info.max_texture_width = maxtexsize; renderer->info.max_texture_height = maxtexsize; -#if !__has_feature(objc_arc) - [mtlcmdqueue release]; - [mtllibrary release]; - [samplerdesc release]; - [mtlsamplernearest release]; - [mtlsamplerlinear release]; - [mtlbufconstants release]; - [mtlbufquadindices release]; - [data release]; - [mtldevice release]; -#endif - return renderer; }} diff -Nru libsdl2-2.0.22+dfsg/src/render/opengl/SDL_render_gl.c libsdl2-2.24.0+dfsg/src/render/opengl/SDL_render_gl.c --- libsdl2-2.0.22+dfsg/src/render/opengl/SDL_render_gl.c 2022-04-23 17:37:35.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/render/opengl/SDL_render_gl.c 2022-08-19 15:46:21.000000000 +0000 @@ -25,6 +25,7 @@ #include "SDL_opengl.h" #include "../SDL_sysrender.h" #include "SDL_shaders_gl.h" +#include "../../SDL_utils_c.h" #ifdef __MACOSX__ #include @@ -411,17 +412,6 @@ return SDL_TRUE; } -SDL_FORCE_INLINE int -power_of_2(int input) -{ - int value = 1; - - while (value < input) { - value <<= 1; - } - return value; -} - SDL_FORCE_INLINE SDL_bool convert_format(GL_RenderData *renderdata, Uint32 pixel_format, GLint* internalFormat, GLenum* format, GLenum* type) @@ -540,8 +530,8 @@ data->texw = (GLfloat) texture_w; data->texh = (GLfloat) texture_h; } else { - texture_w = power_of_2(texture->w); - texture_h = power_of_2(texture->h); + texture_w = SDL_powerof2(texture->w); + texture_h = SDL_powerof2(texture->h); data->texw = (GLfloat) (texture->w) / texture_w; data->texh = (GLfloat) texture->h / texture_h; } @@ -1254,8 +1244,8 @@ case SDL_RENDERCMD_SETVIEWPORT: { SDL_Rect *viewport = &data->drawstate.viewport; - if (SDL_memcmp(viewport, &cmd->data.viewport.rect, sizeof (SDL_Rect)) != 0) { - SDL_memcpy(viewport, &cmd->data.viewport.rect, sizeof (SDL_Rect)); + if (SDL_memcmp(viewport, &cmd->data.viewport.rect, sizeof(cmd->data.viewport.rect)) != 0) { + SDL_copyp(viewport, &cmd->data.viewport.rect); data->drawstate.viewport_dirty = SDL_TRUE; } break; @@ -1268,8 +1258,8 @@ data->drawstate.cliprect_enabled_dirty = SDL_TRUE; } - if (SDL_memcmp(&data->drawstate.cliprect, rect, sizeof (SDL_Rect)) != 0) { - SDL_memcpy(&data->drawstate.cliprect, rect, sizeof (SDL_Rect)); + if (SDL_memcmp(&data->drawstate.cliprect, rect, sizeof(*rect)) != 0) { + SDL_copyp(&data->drawstate.cliprect, rect); data->drawstate.cliprect_dirty = SDL_TRUE; } break; @@ -1715,7 +1705,7 @@ /*const char *vendor = (const char *) data->glGetString(GL_VENDOR);*/ const char *renderer = (const char *) data->glGetString(GL_RENDERER); -#ifdef __WINDOWS__ +#if defined(__WINDOWS__) || defined(__WINGDK__) if (SDL_strcmp(renderer, "GDI Generic") == 0) { return SDL_FALSE; /* Microsoft's fallback software renderer. Fix your system! */ } @@ -1929,6 +1919,10 @@ if (data->shaders && data->num_texture_units >= 3) { renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_YV12; renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_IYUV; + } + + /* We support NV12 textures using 2 textures and a shader */ + if (data->shaders && data->num_texture_units >= 2) { renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV12; renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV21; } diff -Nru libsdl2-2.0.22+dfsg/src/render/opengles/SDL_render_gles.c libsdl2-2.24.0+dfsg/src/render/opengles/SDL_render_gles.c --- libsdl2-2.0.22+dfsg/src/render/opengles/SDL_render_gles.c 2022-01-08 21:13:56.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/render/opengles/SDL_render_gles.c 2022-08-13 03:48:10.000000000 +0000 @@ -25,6 +25,7 @@ #include "SDL_hints.h" #include "SDL_opengles.h" #include "../SDL_sysrender.h" +#include "../../SDL_utils_c.h" /* To prevent unnecessary window recreation, * these should match the defaults selected in SDL_GL_ResetAttributes @@ -303,17 +304,6 @@ return SDL_TRUE; } -static SDL_INLINE int -power_of_2(int input) -{ - int value = 1; - - while (value < input) { - value <<= 1; - } - return value; -} - static int GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) { @@ -374,8 +364,8 @@ data->type = GL_TEXTURE_2D; /* no NPOV textures allowed in OpenGL ES (yet) */ - texture_w = power_of_2(texture->w); - texture_h = power_of_2(texture->h); + texture_w = SDL_powerof2(texture->w); + texture_h = SDL_powerof2(texture->h); data->texw = (GLfloat) texture->w / texture_w; data->texh = (GLfloat) texture->h / texture_h; @@ -796,8 +786,8 @@ case SDL_RENDERCMD_SETVIEWPORT: { SDL_Rect *viewport = &data->drawstate.viewport; - if (SDL_memcmp(viewport, &cmd->data.viewport.rect, sizeof (SDL_Rect)) != 0) { - SDL_memcpy(viewport, &cmd->data.viewport.rect, sizeof (SDL_Rect)); + if (SDL_memcmp(viewport, &cmd->data.viewport.rect, sizeof(cmd->data.viewport.rect)) != 0) { + SDL_copyp(viewport, &cmd->data.viewport.rect); data->drawstate.viewport_dirty = SDL_TRUE; } break; @@ -809,8 +799,8 @@ data->drawstate.cliprect_enabled = cmd->data.cliprect.enabled; data->drawstate.cliprect_enabled_dirty = SDL_TRUE; } - if (SDL_memcmp(&data->drawstate.cliprect, rect, sizeof (SDL_Rect)) != 0) { - SDL_memcpy(&data->drawstate.cliprect, rect, sizeof (SDL_Rect)); + if (SDL_memcmp(&data->drawstate.cliprect, rect, sizeof(*rect)) != 0) { + SDL_copyp(&data->drawstate.cliprect, rect); data->drawstate.cliprect_dirty = SDL_TRUE; } break; diff -Nru libsdl2-2.0.22+dfsg/src/render/opengles2/SDL_render_gles2.c libsdl2-2.24.0+dfsg/src/render/opengles2/SDL_render_gles2.c --- libsdl2-2.0.22+dfsg/src/render/opengles2/SDL_render_gles2.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/render/opengles2/SDL_render_gles2.c 2022-08-13 03:48:10.000000000 +0000 @@ -1155,8 +1155,8 @@ case SDL_RENDERCMD_SETVIEWPORT: { SDL_Rect *viewport = &data->drawstate.viewport; - if (SDL_memcmp(viewport, &cmd->data.viewport.rect, sizeof (SDL_Rect)) != 0) { - SDL_memcpy(viewport, &cmd->data.viewport.rect, sizeof (SDL_Rect)); + if (SDL_memcmp(viewport, &cmd->data.viewport.rect, sizeof(cmd->data.viewport.rect)) != 0) { + SDL_copyp(viewport, &cmd->data.viewport.rect); data->drawstate.viewport_dirty = SDL_TRUE; } break; @@ -1169,8 +1169,8 @@ data->drawstate.cliprect_enabled_dirty = SDL_TRUE; } - if (SDL_memcmp(&data->drawstate.cliprect, rect, sizeof (SDL_Rect)) != 0) { - SDL_memcpy(&data->drawstate.cliprect, rect, sizeof (SDL_Rect)); + if (SDL_memcmp(&data->drawstate.cliprect, rect, sizeof(*rect)) != 0) { + SDL_copyp(&data->drawstate.cliprect, rect); data->drawstate.cliprect_dirty = SDL_TRUE; } break; diff -Nru libsdl2-2.0.22+dfsg/src/render/opengles2/SDL_shaders_gles2.c libsdl2-2.24.0+dfsg/src/render/opengles2/SDL_shaders_gles2.c --- libsdl2-2.0.22+dfsg/src/render/opengles2/SDL_shaders_gles2.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/render/opengles2/SDL_shaders_gles2.c 2022-08-13 03:48:10.000000000 +0000 @@ -27,6 +27,16 @@ #include "SDL_shaders_gles2.h" #include "SDL_stdinc.h" +#define SHADER_PRELOGUE "\n\ +#if GL_FRAGMENT_PRECISION_HIGH\n\ + precision mediump float;\n\ +#else\n\ + #define mediump\n\ + #define highp\n\ + #define lowp\n\ +#endif\n\ +" + /************************************************************************************************* * Vertex/fragment shader source * *************************************************************************************************/ @@ -47,8 +57,7 @@ } \ "; -static const Uint8 GLES2_Fragment_Solid[] = " \ - precision mediump float; \ +static const Uint8 GLES2_Fragment_Solid[] = SHADER_PRELOGUE" \ varying vec4 v_color; \ \ void main() \ @@ -57,11 +66,14 @@ } \ "; -static const Uint8 GLES2_Fragment_TextureABGR[] = " \ - precision mediump float; \ +static const Uint8 GLES2_Fragment_TextureABGR[] = SHADER_PRELOGUE" \ uniform sampler2D u_texture; \ - varying vec4 v_color; \ - varying vec2 v_texCoord; \ + varying vec4 v_color;\n\ + #ifdef GL_FRAGMENT_PRECISION_HIGH\n\ + varying highp vec2 v_texCoord;\n\ + #else\n\ + varying vec2 v_texCoord;\n\ + #endif\n\ \ void main() \ { \ @@ -71,11 +83,14 @@ "; /* ARGB to ABGR conversion */ -static const Uint8 GLES2_Fragment_TextureARGB[] = " \ - precision mediump float; \ +static const Uint8 GLES2_Fragment_TextureARGB[] = SHADER_PRELOGUE" \ uniform sampler2D u_texture; \ - varying vec4 v_color; \ - varying vec2 v_texCoord; \ + varying vec4 v_color;\n\ + #ifdef GL_FRAGMENT_PRECISION_HIGH\n\ + varying highp vec2 v_texCoord;\n\ + #else\n\ + varying vec2 v_texCoord;\n\ + #endif\n\ \ void main() \ { \ @@ -88,11 +103,14 @@ "; /* RGB to ABGR conversion */ -static const Uint8 GLES2_Fragment_TextureRGB[] = " \ - precision mediump float; \ +static const Uint8 GLES2_Fragment_TextureRGB[] = SHADER_PRELOGUE" \ uniform sampler2D u_texture; \ - varying vec4 v_color; \ - varying vec2 v_texCoord; \ + varying vec4 v_color;\n\ + #ifdef GL_FRAGMENT_PRECISION_HIGH\n\ + varying highp vec2 v_texCoord;\n\ + #else\n\ + varying vec2 v_texCoord;\n\ + #endif\n\ \ void main() \ { \ @@ -106,11 +124,14 @@ "; /* BGR to ABGR conversion */ -static const Uint8 GLES2_Fragment_TextureBGR[] = " \ - precision mediump float; \ +static const Uint8 GLES2_Fragment_TextureBGR[] = SHADER_PRELOGUE" \ uniform sampler2D u_texture; \ - varying vec4 v_color; \ - varying vec2 v_texCoord; \ + varying vec4 v_color;\n\ + #ifdef GL_FRAGMENT_PRECISION_HIGH\n\ + varying highp vec2 v_texCoord;\n\ + #else\n\ + varying vec2 v_texCoord;\n\ + #endif\n\ \ void main() \ { \ @@ -152,12 +173,16 @@ #define YUV_SHADER_PROLOGUE \ -"precision mediump float;\n" \ +SHADER_PRELOGUE \ "uniform sampler2D u_texture;\n" \ "uniform sampler2D u_texture_u;\n" \ "uniform sampler2D u_texture_v;\n" \ "varying vec4 v_color;\n" \ +"#ifdef GL_FRAGMENT_PRECISION_HIGH\n" \ +"varying highp vec2 v_texCoord;\n" \ +"#else\n" \ "varying vec2 v_texCoord;\n" \ +"#endif\n" \ "\n" \ #define YUV_SHADER_BODY \ @@ -308,8 +333,12 @@ #extension GL_OES_EGL_image_external : require\n\ precision mediump float; \ uniform samplerExternalOES u_texture; \ - varying vec4 v_color; \ - varying vec2 v_texCoord; \ + varying vec4 v_color;\n\ + #ifdef GL_FRAGMENT_PRECISION_HIGH\n\ + varying highp vec2 v_texCoord;\n\ + #else\n\ + varying vec2 v_texCoord;\n\ + #endif\n\ \ void main() \ { \ @@ -372,3 +401,4 @@ #endif /* SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED */ /* vi: set ts=4 sw=4 expandtab: */ + diff -Nru libsdl2-2.0.22+dfsg/src/render/ps2/SDL_render_ps2.c libsdl2-2.24.0+dfsg/src/render/ps2/SDL_render_ps2.c --- libsdl2-2.0.22+dfsg/src/render/ps2/SDL_render_ps2.c 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/render/ps2/SDL_render_ps2.c 2022-08-19 15:46:21.000000000 +0000 @@ -0,0 +1,832 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_RENDER_PS2 + +#include "../SDL_sysrender.h" +#include "SDL_hints.h" + +#include +#include +#include +#include +#include +#include + +/* turn black GS Screen */ +#define GS_BLACK GS_SETREG_RGBA(0x00, 0x00, 0x00, 0x80) +/* Size of Persistent drawbuffer (Single Buffered) */ +#define RENDER_QUEUE_PER_POOLSIZE 1024 * 256 // 256K of persistent renderqueue +/* Size of Oneshot drawbuffer (Double Buffered, so it uses this size * 2) */ +#define RENDER_QUEUE_OS_POOLSIZE 1024 * 1024 * 2 // 2048K of oneshot renderqueue + +typedef struct clear_vertex { + float x; + float y; +} clear_vertex; + +typedef struct texture_vertex { + float x; + float y; + float u; + float v; + uint64_t color; +} texture_vertex; + +typedef struct color_vertex { + float x; + float y; + uint64_t color; +} color_vertex; + +typedef struct +{ + GSGLOBAL *gsGlobal; + uint64_t drawColor; + int32_t vsync_callback_id; + SDL_bool vsync; /* wether we do vsync */ +} PS2_RenderData; + + +static int vsync_sema_id = 0; + +/* PRIVATE METHODS */ +static int vsync_handler() +{ + iSignalSema(vsync_sema_id); + + ExitHandler(); + return 0; +} + +/* Copy of gsKit_sync_flip, but without the 'flip' */ +static void gsKit_sync(GSGLOBAL *gsGlobal) +{ + if (!gsGlobal->FirstFrame) WaitSema(vsync_sema_id); + while (PollSema(vsync_sema_id) >= 0) + ; +} + +/* Copy of gsKit_sync_flip, but without the 'sync' */ +static void gsKit_flip(GSGLOBAL *gsGlobal) +{ + if (!gsGlobal->FirstFrame) + { + if (gsGlobal->DoubleBuffering == GS_SETTING_ON) + { + GS_SET_DISPFB2( gsGlobal->ScreenBuffer[ + gsGlobal->ActiveBuffer & 1] / 8192, + gsGlobal->Width / 64, gsGlobal->PSM, 0, 0 ); + + gsGlobal->ActiveBuffer ^= 1; + } + + } + + gsKit_setactive(gsGlobal); +} + +static int PixelFormatToPS2PSM(Uint32 format) +{ + switch (format) { + case SDL_PIXELFORMAT_ABGR1555: + return GS_PSM_CT16; + default: + return GS_PSM_CT32; + } +} + +static void +PS2_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event) +{ + +} + +static int +PS2_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) +{ + GSTEXTURE* ps2_tex = (GSTEXTURE*) SDL_calloc(1, sizeof(GSTEXTURE)); + + if (!ps2_tex) + return SDL_OutOfMemory(); + + ps2_tex->Width = texture->w; + ps2_tex->Height = texture->h; + ps2_tex->PSM = PixelFormatToPS2PSM(texture->format); + ps2_tex->Mem = memalign(128, gsKit_texture_size_ee(ps2_tex->Width, ps2_tex->Height, ps2_tex->PSM)); + + if (!ps2_tex->Mem) + { + SDL_free(ps2_tex); + return SDL_OutOfMemory(); + } + + texture->driverdata = ps2_tex; + + return 0; +} + +static int +PS2_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * rect, void **pixels, int *pitch) +{ + GSTEXTURE *ps2_texture = (GSTEXTURE *) texture->driverdata; + + *pixels = + (void *) ((Uint8 *) ps2_texture->Mem + rect->y * ps2_texture->Width * SDL_BYTESPERPIXEL(texture->format) + + rect->x * SDL_BYTESPERPIXEL(texture->format)); + *pitch = ps2_texture->Width * SDL_BYTESPERPIXEL(texture->format); + return 0; +} + +static void +PS2_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) +{ + GSTEXTURE *ps2_texture = (GSTEXTURE *) texture->driverdata; + PS2_RenderData *data = (PS2_RenderData *) renderer->driverdata; + + gsKit_TexManager_invalidate(data->gsGlobal, ps2_texture); +} + +static int +PS2_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * rect, const void *pixels, int pitch) +{ + const Uint8 *src; + Uint8 *dst; + int row, length,dpitch; + src = pixels; + + PS2_LockTexture(renderer, texture, rect, (void **)&dst, &dpitch); + length = rect->w * SDL_BYTESPERPIXEL(texture->format); + if (length == pitch && length == dpitch) { + SDL_memcpy(dst, src, length*rect->h); + } else { + for (row = 0; row < rect->h; ++row) { + SDL_memcpy(dst, src, length); + src += pitch; + dst += dpitch; + } + } + + PS2_UnlockTexture(renderer, texture); + + return 0; +} + +static void +PS2_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture, SDL_ScaleMode scaleMode) +{ + GSTEXTURE *ps2_texture = (GSTEXTURE *) texture->driverdata; + /* + set texture filtering according to scaleMode + suported hint values are nearest (0, default) or linear (1) + gskit scale mode is either GS_FILTER_NEAREST (good for tile-map) + or GS_FILTER_LINEAR (good for scaling) + */ + uint32_t gsKitScaleMode = (scaleMode == SDL_ScaleModeNearest + ? GS_FILTER_NEAREST + : GS_FILTER_LINEAR); + ps2_texture->Filter = gsKitScaleMode; +} + +static int +PS2_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture) +{ + return 0; +} + +static int +PS2_QueueSetViewport(SDL_Renderer * renderer, SDL_RenderCommand *cmd) +{ + return 0; /* nothing to do in this backend. */ +} + +static int +PS2_QueueDrawLines(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FPoint * points, int count) +{ + PS2_RenderData *data = (PS2_RenderData *) renderer->driverdata; + uint64_t color = data->drawColor; + color_vertex *vertex = (color_vertex *) SDL_AllocateRenderVertices(renderer, (count-1) * sizeof (color_vertex) * 2, 4, &cmd->data.draw.first); + + cmd->data.draw.first = (size_t)vertex; + cmd->data.draw.count = (count-1) * 2; + + for (int i = 0; i < count-1; i++) + { + vertex[i*2].x = points[i].x; + vertex[i*2].y = points[i].y; + vertex[i*2].color = color; + + vertex[i*2+1].x = points[i+1].x; + vertex[i*2+1].y = points[i+1].y; + vertex[i*2+1].color = color; + } + + return 0; +} + +static int +PS2_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FPoint * points, int count) +{ + clear_vertex *verts = (clear_vertex *) SDL_AllocateRenderVertices(renderer, count * sizeof (clear_vertex), 4, &cmd->data.draw.first); + int i; + + if (!verts) { + return -1; + } + + cmd->data.draw.count = count; + + for (i = 0; i < count; i++, verts++, points++) { + verts->x = points->x; + verts->y = points->y; + } + return 0; +} + +static int +PS2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *texture, + const float *xy, int xy_stride, const SDL_Color *color, int color_stride, const float *uv, int uv_stride, + int num_vertices, const void *indices, int num_indices, int size_indices, + float scale_x, float scale_y) +{ + int i; + int count = indices ? num_indices : num_vertices; + + cmd->data.draw.count = count; + size_indices = indices ? size_indices : 0; + + if (texture) { + texture_vertex *vertices; + + vertices = (texture_vertex *)SDL_AllocateRenderVertices(renderer, + count * sizeof(texture_vertex), + 4, + &cmd->data.draw.first); + + if (!vertices) { + return -1; + } + + + for (i = 0; i < count; i++) { + int j; + float *xy_; + float *uv_; + SDL_Color col_; + if (size_indices == 4) { + j = ((const Uint32 *)indices)[i]; + } else if (size_indices == 2) { + j = ((const Uint16 *)indices)[i]; + } else if (size_indices == 1) { + j = ((const Uint8 *)indices)[i]; + } else { + j = i; + } + + xy_ = (float *)((char*)xy + j * xy_stride); + col_ = *(SDL_Color *)((char*)color + j * color_stride); + uv_ = (float *)((char*)uv + j * uv_stride); + + vertices->x = xy_[0] * scale_x; + vertices->y = xy_[1] * scale_y; + vertices->u = uv_[0]; + vertices->v = uv_[1]; + vertices->color = GS_SETREG_RGBAQ(col_.r >> 1, col_.g >> 1, col_.b >> 1, col_.a >> 1, 0x00); + + vertices++; + } + + } else { + color_vertex *vertices; + + vertices = (color_vertex *)SDL_AllocateRenderVertices(renderer, + count * sizeof(color_vertex), + 4, + &cmd->data.draw.first); + + if (!vertices) { + return -1; + } + + + for (i = 0; i < count; i++) { + int j; + float *xy_; + SDL_Color col_; + if (size_indices == 4) { + j = ((const Uint32 *)indices)[i]; + } else if (size_indices == 2) { + j = ((const Uint16 *)indices)[i]; + } else if (size_indices == 1) { + j = ((const Uint8 *)indices)[i]; + } else { + j = i; + } + + xy_ = (float *)((char*)xy + j * xy_stride); + col_ = *(SDL_Color *)((char*)color + j * color_stride); + + vertices->x = xy_[0] * scale_x; + vertices->y = xy_[1] * scale_y; + vertices->color = GS_SETREG_RGBAQ(col_.r >> 1, col_.g >> 1, col_.b >> 1, col_.a >> 1, 0x00);; + + vertices++; + } + + } + + return 0; + +} + +static int +PS2_RenderSetViewPort(SDL_Renderer *renderer, SDL_RenderCommand *cmd) +{ + PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata; + const SDL_Rect *viewport = &cmd->data.viewport.rect; + + gsKit_set_display_offset(data->gsGlobal, viewport->x, viewport->y); + gsKit_set_scissor(data->gsGlobal, GS_SETREG_SCISSOR(viewport->x, viewport->y, viewport->w, viewport->h)); + + return 0; +} + +static int +PS2_RenderSetClipRect(SDL_Renderer *renderer, SDL_RenderCommand *cmd) +{ + PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata; + + const SDL_Rect *rect = &cmd->data.cliprect.rect; + + if(cmd->data.cliprect.enabled){ + gsKit_set_scissor(data->gsGlobal, GS_SETREG_SCISSOR(rect->x, rect->y, rect->w, rect->h)); + } else { + gsKit_set_scissor(data->gsGlobal, GS_SCISSOR_RESET); + } + + return 0; +} + + +static int +PS2_RenderSetDrawColor(SDL_Renderer *renderer, SDL_RenderCommand *cmd) +{ + int colorR, colorG, colorB, colorA; + + PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata; + + colorR = (cmd->data.color.r) >> 1; + colorG = (cmd->data.color.g) >> 1; + colorB = (cmd->data.color.b) >> 1; + colorA = (cmd->data.color.a) >> 1; + data->drawColor = GS_SETREG_RGBAQ(colorR, colorG, colorB, colorA, 0x00); + return 0; +} + +static int +PS2_RenderClear(SDL_Renderer *renderer, SDL_RenderCommand *cmd) +{ + int colorR, colorG, colorB, colorA; + + PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata; + + colorR = (cmd->data.color.r) >> 1; + colorG = (cmd->data.color.g) >> 1; + colorB = (cmd->data.color.b) >> 1; + colorA = (cmd->data.color.a) >> 1; + gsKit_clear(data->gsGlobal, GS_SETREG_RGBAQ(colorR, colorG, colorB, colorA, 0x00)); + + return 0; +} + +static void +PS2_SetBlendMode(PS2_RenderData *data, int blendMode) +{ + #define A_COLOR_SOURCE 0 + #define A_COLOR_DEST 1 + #define A_COLOR_NULL 2 + #define A_ALPHA_SOURCE 0 + #define A_ALPHA_DEST 1 + #define A_ALPHA_FIX 2 + + switch (blendMode) + { + case SDL_BLENDMODE_NONE: { + data->gsGlobal->PrimAlphaEnable = GS_SETTING_OFF; + break; + } + case SDL_BLENDMODE_BLEND:{ + gsKit_set_primalpha(data->gsGlobal, GS_SETREG_ALPHA(A_COLOR_SOURCE, A_COLOR_DEST, A_ALPHA_SOURCE, A_COLOR_DEST, 0), 0); + data->gsGlobal->PrimAlphaEnable = GS_SETTING_ON; + break; + } + case SDL_BLENDMODE_ADD: { + gsKit_set_primalpha(data->gsGlobal, GS_SETREG_ALPHA(A_COLOR_SOURCE, A_COLOR_NULL, A_ALPHA_FIX, A_COLOR_DEST, 0x80), 0); + data->gsGlobal->PrimAlphaEnable = GS_SETTING_ON; + break; + } + case SDL_BLENDMODE_MUL: + case SDL_BLENDMODE_MOD: { + /* We don't fully support MOD and MUL, however this is the best we can do */ + gsKit_set_primalpha(data->gsGlobal, GS_SETREG_ALPHA(A_COLOR_DEST, A_COLOR_NULL, A_ALPHA_SOURCE, A_COLOR_SOURCE, 0x80), 0); + data->gsGlobal->PrimAlphaEnable = GS_SETTING_ON; + break; + } + } +} + +static int +PS2_RenderGeometry(SDL_Renderer *renderer, void *vertices, SDL_RenderCommand *cmd) +{ + + int i; + uint64_t c1, c2, c3; + float x1, y1, x2, y2, x3, y3; + float u1, v1, u2, v2, u3, v3; + PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata; + + const size_t count = cmd->data.draw.count; + + PS2_SetBlendMode(data, cmd->data.draw.blend); + + if (cmd->data.draw.texture) { + const texture_vertex *verts = (texture_vertex *) (vertices + cmd->data.draw.first); + GSTEXTURE *ps2_tex = (GSTEXTURE *) cmd->data.draw.texture->driverdata; + + for (i = 0; i < count/3; i++) { + x1 = verts->x; + y1 = verts->y; + + u1 = verts->u * ps2_tex->Width; + v1 = verts->v * ps2_tex->Height; + + c1 = verts->color; + + verts++; + + x2 = verts->x; + y2 = verts->y; + + u2 = verts->u * ps2_tex->Width; + v2 = verts->v * ps2_tex->Height; + + c2 = verts->color; + + verts++; + + x3 = verts->x; + y3 = verts->y; + + u3 = verts->u * ps2_tex->Width; + v3 = verts->v * ps2_tex->Height; + + c3 = verts->color; + + verts++; + + gsKit_TexManager_bind(data->gsGlobal, ps2_tex); + + gsKit_prim_triangle_goraud_texture(data->gsGlobal, ps2_tex, x1, y1, u1, v1, x2, y2, u2, v2, x3, y3, u3, v3, 0, c1, c2, c3); + } + } else { + const color_vertex *verts = (color_vertex *) (vertices + cmd->data.draw.first); + + for (i = 0; i < count/3; i++) { + x1 = verts->x; + y1 = verts->y; + + c1 = verts->color; + + verts++; + + x2 = verts->x; + y2 = verts->y; + + c2 = verts->color; + + verts++; + + x3 = verts->x; + y3 = verts->y; + + c3 = verts->color; + + verts++; + + gsKit_prim_triangle_gouraud(data->gsGlobal, x1, y1, x2, y2, x3, y3, 0, c1, c2, c3); + + } + } + + return 0; +} + + +int +PS2_RenderLines(SDL_Renderer *renderer, void *vertices, SDL_RenderCommand * cmd) +{ + PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata; + float x1, y1, x2, y2; + uint64_t c1, c2; + int i; + + const size_t count = cmd->data.draw.count; + + const color_vertex *verts = (color_vertex *) (vertices + cmd->data.draw.first); + + PS2_SetBlendMode(data, cmd->data.draw.blend); + + for (i = 0; i < count-1; i++, verts++) { + x1 = verts[i*2].x; + y1 = verts[i*2].y; + c1 = verts[i*2].color; + + x2 = verts[i*2+1].x; + y2 = verts[i*2+1].y; + c2 = verts[i*2+1].color; + gsKit_prim_line_goraud(data->gsGlobal, x1, y1, x2, y2, 0, c1, c2); + } + + /* We're done! */ + return 0; +} + +int +PS2_RenderPoints(SDL_Renderer *renderer, void *vertices, SDL_RenderCommand * cmd) +{ + PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata; + uint64_t color; + int i; + + const size_t count = cmd->data.draw.count; + + const uint8_t ColorR = cmd->data.draw.r >> 1; + const uint8_t ColorG = cmd->data.draw.g >> 1; + const uint8_t ColorB = cmd->data.draw.b >> 1; + const uint8_t ColorA = cmd->data.draw.a >> 1; + + const clear_vertex *verts = (clear_vertex *) (vertices + cmd->data.draw.first); + + PS2_SetBlendMode(data, cmd->data.draw.blend); + + color = GS_SETREG_RGBAQ(ColorR, ColorG, ColorB, ColorA, 0x00); + + for (i = 0; i < count; i++, verts++) { + gsKit_prim_point(data->gsGlobal, verts->x, verts->y, 0, color); + } + + /* We're done! */ + return 0; +} + +static int +PS2_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize) +{ + while (cmd) { + switch (cmd->command) { + case SDL_RENDERCMD_SETVIEWPORT: { + PS2_RenderSetViewPort(renderer, cmd); + break; + } + case SDL_RENDERCMD_SETCLIPRECT: { + PS2_RenderSetClipRect(renderer, cmd); + break; + } + case SDL_RENDERCMD_SETDRAWCOLOR: { + PS2_RenderSetDrawColor(renderer, cmd); + break; + } + case SDL_RENDERCMD_CLEAR: { + PS2_RenderClear(renderer, cmd); + break; + } + case SDL_RENDERCMD_DRAW_POINTS: { + PS2_RenderPoints(renderer, vertices, cmd); + break; + } + case SDL_RENDERCMD_DRAW_LINES: { + PS2_RenderLines(renderer, vertices, cmd); + break; + } + case SDL_RENDERCMD_FILL_RECTS: /* unused */ + break; + case SDL_RENDERCMD_COPY: /* unused */ + break; + case SDL_RENDERCMD_COPY_EX: /* unused */ + break; + case SDL_RENDERCMD_GEOMETRY: { + PS2_RenderGeometry(renderer, vertices, cmd); + break; + } + case SDL_RENDERCMD_NO_OP: + break; + } + cmd = cmd->next; + } + return 0; +} + +static int +PS2_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, + Uint32 format, void * pixels, int pitch) +{ + return SDL_Unsupported(); +} + +static void +PS2_RenderPresent(SDL_Renderer * renderer) +{ + PS2_RenderData *data = (PS2_RenderData *) renderer->driverdata; + + if (data->gsGlobal->DoubleBuffering == GS_SETTING_OFF) { + if (data->vsync) + gsKit_sync(data->gsGlobal); + gsKit_queue_exec(data->gsGlobal); + } else { + gsKit_queue_exec(data->gsGlobal); + gsKit_finish(); + if (data->vsync) + gsKit_sync(data->gsGlobal); + gsKit_flip(data->gsGlobal); + } + gsKit_TexManager_nextFrame(data->gsGlobal); + gsKit_clear(data->gsGlobal, GS_BLACK); +} + +static void +PS2_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture) +{ + GSTEXTURE *ps2_texture = (GSTEXTURE *) texture->driverdata; + PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata; + + if (data == 0) + return; + + if(ps2_texture == 0) + return; + + // Free from vram + gsKit_TexManager_free(data->gsGlobal, ps2_texture); + + SDL_free(ps2_texture->Mem); + SDL_free(ps2_texture); + texture->driverdata = NULL; +} + +static void +PS2_DestroyRenderer(SDL_Renderer * renderer) +{ + PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata; + + if (data) { + gsKit_clear(data->gsGlobal, GS_BLACK); + gsKit_vram_clear(data->gsGlobal); + gsKit_deinit_global(data->gsGlobal); + gsKit_remove_vsync_handler(data->vsync_callback_id); + + SDL_free(data); + } + + if (vsync_sema_id >= 0) + DeleteSema(vsync_sema_id); + + SDL_free(renderer); +} + +static int +PS2_SetVSync(SDL_Renderer * renderer, const int vsync) +{ + PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata; + data->vsync = vsync; + return 0; +} + +static SDL_Renderer * +PS2_CreateRenderer(SDL_Window * window, Uint32 flags) +{ + SDL_Renderer *renderer; + PS2_RenderData *data; + GSGLOBAL *gsGlobal; + ee_sema_t sema; + + renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer)); + if (!renderer) { + SDL_OutOfMemory(); + return NULL; + } + + data = (PS2_RenderData *) SDL_calloc(1, sizeof(*data)); + if (!data) { + PS2_DestroyRenderer(renderer); + SDL_OutOfMemory(); + return NULL; + } + + /* Specific gsKit init */ + sema.init_count = 0; + sema.max_count = 1; + sema.option = 0; + vsync_sema_id = CreateSema(&sema); + + gsGlobal = gsKit_init_global_custom(RENDER_QUEUE_OS_POOLSIZE, RENDER_QUEUE_PER_POOLSIZE); + + gsGlobal->Mode = GS_MODE_NTSC; + gsGlobal->Height = 448; + + gsGlobal->PSM = GS_PSM_CT24; + gsGlobal->PSMZ = GS_PSMZ_16S; + gsGlobal->ZBuffering = GS_SETTING_OFF; + gsGlobal->DoubleBuffering = GS_SETTING_ON; + gsGlobal->PrimAlphaEnable = GS_SETTING_ON; + gsGlobal->Dithering = GS_SETTING_OFF; + + gsKit_set_primalpha(gsGlobal, GS_SETREG_ALPHA(0, 1, 0, 1, 0), 0); + + dmaKit_init(D_CTRL_RELE_OFF, D_CTRL_MFD_OFF, D_CTRL_STS_UNSPEC, D_CTRL_STD_OFF, D_CTRL_RCYC_8, 1 << DMA_CHANNEL_GIF); + dmaKit_chan_init(DMA_CHANNEL_GIF); + + gsKit_set_clamp(gsGlobal, GS_CMODE_REPEAT); + + gsKit_vram_clear(gsGlobal); + + gsKit_init_screen(gsGlobal); + + gsKit_TexManager_init(gsGlobal); + + data->vsync_callback_id = gsKit_add_vsync_handler(vsync_handler); + + gsKit_mode_switch(gsGlobal, GS_ONESHOT); + + gsKit_clear(gsGlobal, GS_BLACK); + + data->gsGlobal = gsGlobal; + if (flags & SDL_RENDERER_PRESENTVSYNC) { + data->vsync = SDL_TRUE; + } else { + data->vsync = SDL_FALSE; + } + + renderer->WindowEvent = PS2_WindowEvent; + renderer->CreateTexture = PS2_CreateTexture; + renderer->UpdateTexture = PS2_UpdateTexture; + renderer->LockTexture = PS2_LockTexture; + renderer->UnlockTexture = PS2_UnlockTexture; + renderer->SetTextureScaleMode = PS2_SetTextureScaleMode; + renderer->SetRenderTarget = PS2_SetRenderTarget; + renderer->QueueSetViewport = PS2_QueueSetViewport; + renderer->QueueSetDrawColor = PS2_QueueSetViewport; + renderer->QueueDrawPoints = PS2_QueueDrawPoints; + renderer->QueueDrawLines = PS2_QueueDrawLines; + renderer->QueueGeometry = PS2_QueueGeometry; + renderer->RunCommandQueue = PS2_RunCommandQueue; + renderer->RenderReadPixels = PS2_RenderReadPixels; + renderer->RenderPresent = PS2_RenderPresent; + renderer->DestroyTexture = PS2_DestroyTexture; + renderer->DestroyRenderer = PS2_DestroyRenderer; + renderer->SetVSync = PS2_SetVSync; + renderer->info = PS2_RenderDriver.info; + renderer->driverdata = data; + renderer->window = window; + + return renderer; +} + +SDL_RenderDriver PS2_RenderDriver = { + .CreateRenderer = PS2_CreateRenderer, + .info = { + .name = "PS2 gsKit", + .flags = SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE, + .num_texture_formats = 2, + .texture_formats = { + [0] = SDL_PIXELFORMAT_ABGR1555, + [1] = SDL_PIXELFORMAT_ABGR8888, + }, + .max_texture_width = 1024, + .max_texture_height = 1024, + } +}; + +#endif /* SDL_VIDEO_RENDER_PS2 */ + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/render/SDL_d3dmath.c libsdl2-2.24.0+dfsg/src/render/SDL_d3dmath.c --- libsdl2-2.0.22+dfsg/src/render/SDL_d3dmath.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/render/SDL_d3dmath.c 2022-06-16 20:16:31.000000000 +0000 @@ -20,7 +20,7 @@ */ #include "../SDL_internal.h" -#if (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11) && !SDL_RENDER_DISABLED +#if (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) && !SDL_RENDER_DISABLED #include "SDL_stdinc.h" #include "SDL_d3dmath.h" @@ -131,6 +131,6 @@ } -#endif /* (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11) && !SDL_RENDER_DISABLED */ +#endif /* (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) && !SDL_RENDER_DISABLED */ /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/render/SDL_d3dmath.h libsdl2-2.24.0+dfsg/src/render/SDL_d3dmath.h --- libsdl2-2.0.22+dfsg/src/render/SDL_d3dmath.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/render/SDL_d3dmath.h 2022-08-13 03:48:10.000000000 +0000 @@ -20,7 +20,12 @@ */ #include "../SDL_internal.h" -#if (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11) && !SDL_RENDER_DISABLED +#if (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) && !SDL_RENDER_DISABLED + +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif /* Direct3D matrix math functions */ @@ -67,6 +72,11 @@ Float4X4 MatrixRotationY(float r); Float4X4 MatrixRotationZ(float r); -#endif /* (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11) && !SDL_RENDER_DISABLED */ +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif + +#endif /* (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) && !SDL_RENDER_DISABLED */ /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/render/SDL_render.c libsdl2-2.24.0+dfsg/src/render/SDL_render.c --- libsdl2-2.0.22+dfsg/src/render/SDL_render.c 2022-04-21 17:37:37.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/render/SDL_render.c 2022-08-13 03:48:10.000000000 +0000 @@ -96,6 +96,9 @@ #if SDL_VIDEO_RENDER_D3D11 &D3D11_RenderDriver, #endif +#if SDL_VIDEO_RENDER_D3D12 + &D3D12_RenderDriver, +#endif #if SDL_VIDEO_RENDER_METAL &METAL_RenderDriver, #endif @@ -111,6 +114,9 @@ #if SDL_VIDEO_RENDER_DIRECTFB &DirectFB_RenderDriver, #endif +#if SDL_VIDEO_RENDER_PS2 && !SDL_RENDER_DISABLED + &PS2_RenderDriver, +#endif #if SDL_VIDEO_RENDER_PSP &PSP_RenderDriver, #endif @@ -350,7 +356,7 @@ QueueCmdSetViewport(SDL_Renderer *renderer) { int retval = 0; - if (!renderer->viewport_queued || (SDL_memcmp(&renderer->viewport, &renderer->last_queued_viewport, sizeof (SDL_Rect)) != 0)) { + if (!renderer->viewport_queued || (SDL_memcmp(&renderer->viewport, &renderer->last_queued_viewport, sizeof (SDL_DRect)) != 0)) { SDL_RenderCommand *cmd = AllocateRenderCommand(renderer); retval = -1; if (cmd != NULL) { @@ -365,7 +371,7 @@ if (retval < 0) { cmd->command = SDL_RENDERCMD_NO_OP; } else { - SDL_memcpy(&renderer->last_queued_viewport, &renderer->viewport, sizeof (SDL_Rect)); + SDL_copyp(&renderer->last_queued_viewport, &renderer->viewport); renderer->viewport_queued = SDL_TRUE; } } @@ -379,7 +385,7 @@ int retval = 0; if ((!renderer->cliprect_queued) || (renderer->clipping_enabled != renderer->last_queued_cliprect_enabled) || - (SDL_memcmp(&renderer->clip_rect, &renderer->last_queued_cliprect, sizeof (SDL_Rect)) != 0)) { + (SDL_memcmp(&renderer->clip_rect, &renderer->last_queued_cliprect, sizeof (SDL_DRect)) != 0)) { SDL_RenderCommand *cmd = AllocateRenderCommand(renderer); if (cmd == NULL) { retval = -1; @@ -391,7 +397,7 @@ cmd->data.cliprect.rect.y = (int)SDL_floor(renderer->clip_rect.y); cmd->data.cliprect.rect.w = (int)SDL_floor(renderer->clip_rect.w); cmd->data.cliprect.rect.h = (int)SDL_floor(renderer->clip_rect.h); - SDL_memcpy(&renderer->last_queued_cliprect, &renderer->clip_rect, sizeof (SDL_Rect)); + SDL_copyp(&renderer->last_queued_cliprect, &renderer->clip_rect); renderer->last_queued_cliprect_enabled = renderer->clipping_enabled; renderer->cliprect_queued = SDL_TRUE; } @@ -649,7 +655,7 @@ return retval; } -static int UpdateLogicalSize(SDL_Renderer *renderer); +static int UpdateLogicalSize(SDL_Renderer *renderer, SDL_bool flush_viewport_cmd); int SDL_GetNumRenderDrivers(void) @@ -699,16 +705,11 @@ } /* In addition to size changes, we also want to do this block for - * moves as well, for two reasons: - * - * 1. The window could be moved to a new display, which has a new - * DPI and therefore a new window/drawable ratio - * 2. For whatever reason, the viewport can get messed up during - * window movement (this has been observed on macOS), so this is - * also a good opportunity to force viewport updates + * window display changes as well! If the new display has a new DPI, + * we need to update the viewport for the new window/drawable ratio. */ if (event->window.event == SDL_WINDOWEVENT_SIZE_CHANGED || - event->window.event == SDL_WINDOWEVENT_MOVED) { + event->window.event == SDL_WINDOWEVENT_DISPLAY_CHANGED) { /* Make sure we're operating on the default render target */ SDL_Texture *saved_target = SDL_GetRenderTarget(renderer); if (saved_target) { @@ -727,7 +728,14 @@ } if (renderer->logical_w) { - UpdateLogicalSize(renderer); +#if defined(__ANDROID__) + /* Don't immediatly flush because the app may be in + * background, and the egl context shouldn't be used. */ + SDL_bool flush_viewport_cmd = SDL_FALSE; +#else + SDL_bool flush_viewport_cmd = SDL_TRUE; +#endif + UpdateLogicalSize(renderer, flush_viewport_cmd); } else { /* Window was resized, reset viewport */ int w, h; @@ -743,7 +751,12 @@ renderer->viewport.w = (double)w; renderer->viewport.h = (double)h; QueueCmdSetViewport(renderer); +#if defined(__ANDROID__) + /* Don't immediatly flush because the app may be in + * background, and the egl context shouldn't be used. */ +#else FlushRenderCommandsIfNotBatching(renderer); +#endif } if (saved_target) { @@ -2269,7 +2282,7 @@ } static int -UpdateLogicalSize(SDL_Renderer *renderer) +UpdateLogicalSize(SDL_Renderer *renderer, SDL_bool flush_viewport_cmd) { int w = 1, h = 1; float want_aspect; @@ -2326,12 +2339,12 @@ viewport.x = (w - viewport.w) / 2; viewport.h = (int)SDL_floor(renderer->logical_h * scale); viewport.y = (h - viewport.h) / 2; - - SDL_RenderSetViewport(renderer, &viewport); } else if (SDL_fabs(want_aspect-real_aspect) < 0.0001) { /* The aspect ratios are the same, just scale appropriately */ scale = (float)w / renderer->logical_w; - SDL_RenderSetViewport(renderer, NULL); + + SDL_zero(viewport); + SDL_GetRendererOutputSize(renderer, &viewport.w, &viewport.h); } else if (want_aspect > real_aspect) { if (scale_policy == 1) { /* We want a wider aspect ratio than is available - @@ -2343,7 +2356,6 @@ viewport.h = h; viewport.w = (int)SDL_floor(renderer->logical_w * scale); viewport.x = (w - viewport.w) / 2; - SDL_RenderSetViewport(renderer, &viewport); } else { /* We want a wider aspect ratio than is available - letterbox it */ scale = (float)w / renderer->logical_w; @@ -2351,7 +2363,6 @@ viewport.w = w; viewport.h = (int)SDL_floor(renderer->logical_h * scale); viewport.y = (h - viewport.h) / 2; - SDL_RenderSetViewport(renderer, &viewport); } } else { if (scale_policy == 1) { @@ -2364,7 +2375,6 @@ viewport.w = w; viewport.h = (int)SDL_floor(renderer->logical_h * scale); viewport.y = (h - viewport.h) / 2; - SDL_RenderSetViewport(renderer, &viewport); } else { /* We want a narrower aspect ratio than is available - use side-bars */ scale = (float)h / renderer->logical_h; @@ -2372,10 +2382,19 @@ viewport.h = h; viewport.w = (int)SDL_floor(renderer->logical_w * scale); viewport.x = (w - viewport.w) / 2; - SDL_RenderSetViewport(renderer, &viewport); } } + /* Set the new viewport */ + renderer->viewport.x = (double)viewport.x * renderer->scale.x; + renderer->viewport.y = (double)viewport.y * renderer->scale.y; + renderer->viewport.w = (double)viewport.w * renderer->scale.x; + renderer->viewport.h = (double)viewport.h * renderer->scale.y; + QueueCmdSetViewport(renderer); + if (flush_viewport_cmd) { + FlushRenderCommandsIfNotBatching(renderer); + } + /* Set the new scale */ SDL_RenderSetScale(renderer, scale, scale); @@ -2399,7 +2418,7 @@ renderer->logical_w = w; renderer->logical_h = h; - return UpdateLogicalSize(renderer); + return UpdateLogicalSize(renderer, SDL_TRUE); } void @@ -2422,7 +2441,7 @@ renderer->integer_scale = enable; - return UpdateLogicalSize(renderer); + return UpdateLogicalSize(renderer, SDL_TRUE); } SDL_bool @@ -2670,11 +2689,16 @@ RenderDrawPointsWithRects(SDL_Renderer * renderer, const SDL_Point * points, const int count) { - int retval = -1; + int retval; SDL_bool isstack; - SDL_FRect *frects = SDL_small_alloc(SDL_FRect, count, &isstack); + SDL_FRect *frects; int i; + if (count < 1) { + return 0; + } + + frects = SDL_small_alloc(SDL_FRect, count, &isstack); if (!frects) { return SDL_OutOfMemory(); } @@ -2686,9 +2710,7 @@ frects[i].h = renderer->scale.y; } - if (count) { - retval = QueueCmdFillRects(renderer, frects, count); - } + retval = QueueCmdFillRects(renderer, frects, count); SDL_small_free(frects, isstack); @@ -2743,11 +2765,16 @@ RenderDrawPointsWithRectsF(SDL_Renderer * renderer, const SDL_FPoint * fpoints, const int count) { - int retval = -1; + int retval; SDL_bool isstack; - SDL_FRect *frects = SDL_small_alloc(SDL_FRect, count, &isstack); + SDL_FRect *frects; int i; + if (count < 1) { + return 0; + } + + frects = SDL_small_alloc(SDL_FRect, count, &isstack); if (!frects) { return SDL_OutOfMemory(); } @@ -2759,9 +2786,7 @@ frects[i].h = renderer->scale.y; } - if (count) { - retval = QueueCmdFillRects(renderer, frects, count); - } + retval = QueueCmdFillRects(renderer, frects, count); SDL_small_free(frects, isstack); @@ -3998,7 +4023,23 @@ if (texture && s.w != 0 && s.h != 0) { SDL_SetTextureAlphaMod(texture, col0_.a); SDL_SetTextureColorMod(texture, col0_.r, col0_.g, col0_.b); - SDL_RenderCopyF(renderer, texture, &s, &d); + if (s.w > 0 && s.h > 0) { + SDL_RenderCopyF(renderer, texture, &s, &d); + } else { + int flags = 0; + if (s.w < 0) { + flags |= SDL_FLIP_HORIZONTAL; + s.w *= -1; + s.x -= s.w; + } + if (s.h < 0) { + flags |= SDL_FLIP_VERTICAL; + s.h *= -1; + s.y -= s.h; + } + SDL_RenderCopyExF(renderer, texture, &s, &d, 0, NULL, flags); + } + #if DEBUG_SW_RENDER_GEOMETRY SDL_Log("Rect-COPY: RGB %d %d %d - Alpha:%d - texture=%p: src=(%d,%d, %d x %d) dst (%f, %f, %f x %f)", col0_.r, col0_.g, col0_.b, col0_.a, (void *)texture, s.x, s.y, s.w, s.h, d.x, d.y, d.w, d.h); @@ -4008,8 +4049,8 @@ SDL_SetRenderDrawColor(renderer, col0_.r, col0_.g, col0_.b, col0_.a); SDL_RenderFillRectF(renderer, &d); #if DEBUG_SW_RENDER_GEOMETRY - SDL_Log("Rect-FILL: RGB %d %d %d - Alpha:%d - texture=%p: src=(%d,%d, %d x %d) dst (%f, %f, %f x %f)", col0_.r, col0_.g, col0_.b, col0_.a, - (void *)texture, s.x, s.y, s.w, s.h, d.x, d.y, d.w, d.h); + SDL_Log("Rect-FILL: RGB %d %d %d - Alpha:%d - texture=%p: dst (%f, %f, %f x %f)", col0_.r, col0_.g, col0_.b, col0_.a, + (void *)texture, d.x, d.y, d.w, d.h); } else { SDL_Log("Rect-DISMISS: RGB %d %d %d - Alpha:%d - texture=%p: src=(%d,%d, %d x %d) dst (%f, %f, %f x %f)", col0_.r, col0_.g, col0_.b, col0_.a, (void *)texture, s.x, s.y, s.w, s.h, d.x, d.y, d.w, d.h); diff -Nru libsdl2-2.0.22+dfsg/src/render/SDL_sysrender.h libsdl2-2.24.0+dfsg/src/render/SDL_sysrender.h --- libsdl2-2.0.22+dfsg/src/render/SDL_sysrender.h 2022-04-21 17:37:37.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/render/SDL_sysrender.h 2022-08-13 03:48:10.000000000 +0000 @@ -28,6 +28,10 @@ #include "SDL_mutex.h" #include "SDL_yuv_sw_c.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif /** * A rectangle, with the origin at the upper left (double precision). @@ -283,11 +287,13 @@ /* Not all of these are available in a given build. Use #ifdefs, etc. */ extern SDL_RenderDriver D3D_RenderDriver; extern SDL_RenderDriver D3D11_RenderDriver; +extern SDL_RenderDriver D3D12_RenderDriver; extern SDL_RenderDriver GL_RenderDriver; extern SDL_RenderDriver GLES2_RenderDriver; extern SDL_RenderDriver GLES_RenderDriver; extern SDL_RenderDriver DirectFB_RenderDriver; extern SDL_RenderDriver METAL_RenderDriver; +extern SDL_RenderDriver PS2_RenderDriver; extern SDL_RenderDriver PSP_RenderDriver; extern SDL_RenderDriver SW_RenderDriver; extern SDL_RenderDriver VITA_GXM_RenderDriver; @@ -308,6 +314,11 @@ extern int SDL_PrivateLowerBlitScaled(SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect, SDL_ScaleMode scaleMode); extern int SDL_PrivateUpperBlitScaled(SDL_Surface * src, const SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect, SDL_ScaleMode scaleMode); +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif + #endif /* SDL_sysrender_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/render/software/SDL_render_sw.c libsdl2-2.24.0+dfsg/src/render/software/SDL_render_sw.c --- libsdl2-2.0.22+dfsg/src/render/software/SDL_render_sw.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/render/software/SDL_render_sw.c 2022-08-13 03:48:10.000000000 +0000 @@ -255,7 +255,7 @@ cmd->data.draw.count = 1; - SDL_memcpy(verts, srcrect, sizeof (SDL_Rect)); + SDL_copyp(verts, srcrect); verts++; verts->x = (int)dstrect->x; @@ -290,14 +290,14 @@ cmd->data.draw.count = 1; - SDL_memcpy(&verts->srcrect, srcrect, sizeof (SDL_Rect)); + SDL_copyp(&verts->srcrect, srcrect); verts->dstrect.x = (int)dstrect->x; verts->dstrect.y = (int)dstrect->y; verts->dstrect.w = (int)dstrect->w; verts->dstrect.h = (int)dstrect->h; verts->angle = angle; - SDL_memcpy(&verts->center, center, sizeof (SDL_FPoint)); + SDL_copyp(&verts->center, center); verts->flip = flip; verts->scale_x = scale_x; verts->scale_y = scale_y; diff -Nru libsdl2-2.0.22+dfsg/src/render/software/SDL_rotate.c libsdl2-2.24.0+dfsg/src/render/software/SDL_rotate.c --- libsdl2-2.0.22+dfsg/src/render/software/SDL_rotate.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/render/software/SDL_rotate.c 2022-08-13 03:48:10.000000000 +0000 @@ -32,7 +32,7 @@ #if SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED -#if defined(__WIN32__) +#if defined(__WIN32__) || defined(__GDK__) #include "../../core/windows/SDL_windows.h" #endif @@ -62,11 +62,6 @@ } tColorY; /* ! -\brief Returns maximum of two numbers a and b. -*/ -#define MAX(a,b) (((a) > (b)) ? (a) : (b)) - -/* ! \brief Number of guard rows added to destination surfaces. This is a simple but effective workaround for observed issues. diff -Nru libsdl2-2.0.22+dfsg/src/render/software/SDL_rotate.h libsdl2-2.24.0+dfsg/src/render/software/SDL_rotate.h --- libsdl2-2.0.22+dfsg/src/render/software/SDL_rotate.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/render/software/SDL_rotate.h 2022-06-02 02:01:57.000000000 +0000 @@ -22,10 +22,6 @@ #ifndef SDL_rotate_h_ #define SDL_rotate_h_ -#ifndef MIN -#define MIN(a,b) (((a) < (b)) ? (a) : (b)) -#endif - extern SDL_Surface *SDLgfx_rotateSurface(SDL_Surface * src, double angle, int smooth, int flipx, int flipy, const SDL_Rect *rect_dest, double cangle, double sangle, const SDL_FPoint *center); extern void SDLgfx_rotozoomSurfaceSizeTrig(int width, int height, double angle, const SDL_FPoint *center, diff -Nru libsdl2-2.0.22+dfsg/src/render/vitagxm/SDL_render_vita_gxm.c libsdl2-2.24.0+dfsg/src/render/vitagxm/SDL_render_vita_gxm.c --- libsdl2-2.0.22+dfsg/src/render/vitagxm/SDL_render_vita_gxm.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/render/vitagxm/SDL_render_vita_gxm.c 2022-08-13 03:48:10.000000000 +0000 @@ -999,8 +999,8 @@ case SDL_RENDERCMD_SETVIEWPORT: { SDL_Rect *viewport = &data->drawstate.viewport; - if (SDL_memcmp(viewport, &cmd->data.viewport.rect, sizeof (SDL_Rect)) != 0) { - SDL_memcpy(viewport, &cmd->data.viewport.rect, sizeof (SDL_Rect)); + if (SDL_memcmp(viewport, &cmd->data.viewport.rect, sizeof(cmd->data.viewport.rect)) != 0) { + SDL_copyp(viewport, &cmd->data.viewport.rect); data->drawstate.viewport_dirty = SDL_TRUE; } break; @@ -1013,8 +1013,8 @@ data->drawstate.cliprect_enabled_dirty = SDL_TRUE; } - if (SDL_memcmp(&data->drawstate.cliprect, rect, sizeof (SDL_Rect)) != 0) { - SDL_memcpy(&data->drawstate.cliprect, rect, sizeof (SDL_Rect)); + if (SDL_memcmp(&data->drawstate.cliprect, rect, sizeof(*rect)) != 0) { + SDL_copyp(&data->drawstate.cliprect, rect); data->drawstate.cliprect_dirty = SDL_TRUE; } break; diff -Nru libsdl2-2.0.22+dfsg/src/render/vitagxm/SDL_render_vita_gxm_tools.c libsdl2-2.24.0+dfsg/src/render/vitagxm/SDL_render_vita_gxm_tools.c --- libsdl2-2.0.22+dfsg/src/render/vitagxm/SDL_render_vita_gxm_tools.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/render/vitagxm/SDL_render_vita_gxm_tools.c 2022-08-13 03:48:10.000000000 +0000 @@ -1008,6 +1008,26 @@ return sceGxmTextureGetData(&texture->gxm_tex); } +static SceGxmColorFormat tex_format_to_color_format(SceGxmTextureFormat format) +{ + switch (format) { + case SCE_GXM_TEXTURE_FORMAT_U8U8U8U8_ARGB: + return SCE_GXM_COLOR_FORMAT_U8U8U8U8_ARGB; + case SCE_GXM_TEXTURE_FORMAT_U8U8U8_RGB: + return SCE_GXM_COLOR_FORMAT_U8U8U8_RGB; + case SCE_GXM_TEXTURE_FORMAT_U8U8U8_BGR: + return SCE_GXM_COLOR_FORMAT_U8U8U8_BGR; + case SCE_GXM_TEXTURE_FORMAT_U8U8U8U8_ABGR: + return SCE_GXM_COLOR_FORMAT_U8U8U8U8_ABGR; + case SCE_GXM_TEXTURE_FORMAT_U5U6U5_RGB: + return SCE_GXM_COLOR_FORMAT_U5U6U5_RGB; + case SCE_GXM_TEXTURE_FORMAT_U5U6U5_BGR: + return SCE_GXM_COLOR_FORMAT_U5U6U5_BGR; + default: + return SCE_GXM_COLOR_FORMAT_U8U8U8U8_ABGR; + } +} + gxm_texture * create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsigned int h, SceGxmTextureFormat format, unsigned int isRenderTarget, unsigned int *return_w, unsigned int *return_h, unsigned int *return_pitch, float *return_wscale) { @@ -1082,9 +1102,10 @@ uint32_t depthStrideInSamples = alignedWidth; const uint32_t alignedColorSurfaceStride = ALIGN(w, 8); + int err = sceGxmColorSurfaceInit( &texture->gxm_colorsurface, - SCE_GXM_COLOR_FORMAT_A8B8G8R8, + tex_format_to_color_format(format), SCE_GXM_COLOR_SURFACE_LINEAR, SCE_GXM_COLOR_SURFACE_SCALE_NONE, SCE_GXM_OUTPUT_REGISTER_SIZE_32BIT, diff -Nru libsdl2-2.0.22+dfsg/src/SDL_assert.c libsdl2-2.24.0+dfsg/src/SDL_assert.c --- libsdl2-2.0.22+dfsg/src/SDL_assert.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/SDL_assert.c 2022-08-13 03:48:10.000000000 +0000 @@ -20,7 +20,7 @@ */ #include "./SDL_internal.h" -#if defined(__WIN32__) +#if defined(__WIN32__) || defined(__GDK__) #include "core/windows/SDL_windows.h" #endif @@ -32,7 +32,7 @@ #include "SDL_assert_c.h" #include "video/SDL_sysvideo.h" -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__GDK__) #ifndef WS_OVERLAPPEDWINDOW #define WS_OVERLAPPEDWINDOW 0 #endif @@ -45,6 +45,8 @@ #include #endif +/* The size of the stack buffer to use for rendering assert messages. */ +#define SDL_MAX_ASSERT_MESSAGE_STACK 256 static SDL_assert_state SDLCALL SDL_PromptAssertion(const SDL_assert_data *data, void *userdata); @@ -88,6 +90,20 @@ } } +#if defined(__WIN32__) || defined(__GDK__) + #define ENDLINE "\r\n" +#else + #define ENDLINE "\n" +#endif + +static int SDL_RenderAssertMessage(char *buf, size_t buf_len, const SDL_assert_data *data) { + return SDL_snprintf(buf, buf_len, + "Assertion failure at %s (%s:%d), triggered %u %s:" ENDLINE " '%s'", + data->function, data->filename, data->linenum, + data->trigger_count, (data->trigger_count == 1) ? "time" : "times", + data->condition + ); +} static void SDL_GenerateAssertionReport(void) { @@ -137,16 +153,9 @@ SDL_ExitProcess(42); } - static SDL_assert_state SDLCALL SDL_PromptAssertion(const SDL_assert_data *data, void *userdata) { -#ifdef __WIN32__ - #define ENDLINE "\r\n" -#else - #define ENDLINE "\n" -#endif - const char *envr; SDL_assert_state state = SDL_ASSERTION_ABORT; SDL_Window *window; @@ -160,30 +169,46 @@ { SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, SDL_ASSERTION_ALWAYS_IGNORE, "Always Ignore" } }; - char *message; int selected; + char stack_buf[SDL_MAX_ASSERT_MESSAGE_STACK]; + char *message = stack_buf; + size_t buf_len = sizeof(stack_buf); + int len; + (void) userdata; /* unused in default handler. */ - /* !!! FIXME: why is this using SDL_stack_alloc and not just "char message[SDL_MAX_LOG_MESSAGE];" ? */ - message = SDL_stack_alloc(char, SDL_MAX_LOG_MESSAGE); - if (!message) { - /* Uh oh, we're in real trouble now... */ + /* Assume the output will fit... */ + len = SDL_RenderAssertMessage(message, buf_len, data); + + /* .. and if it didn't, try to allocate as much room as we actually need. */ + if (len >= (int)buf_len) { + if (SDL_size_add_overflow(len, 1, &buf_len) == 0) { + message = (char *)SDL_malloc(buf_len); + if (message) { + len = SDL_RenderAssertMessage(message, buf_len, data); + } else { + message = stack_buf; + } + } + } + + /* Something went very wrong */ + if (len < 0) { + if (message != stack_buf) { + SDL_free(message); + } return SDL_ASSERTION_ABORT; } - SDL_snprintf(message, SDL_MAX_LOG_MESSAGE, - "Assertion failure at %s (%s:%d), triggered %u %s:" ENDLINE - " '%s'", - data->function, data->filename, data->linenum, - data->trigger_count, (data->trigger_count == 1) ? "time" : "times", - data->condition); debug_print("\n\n%s\n\n", message); /* let env. variable override, so unit tests won't block in a GUI. */ envr = SDL_getenv("SDL_ASSERT"); if (envr != NULL) { - SDL_stack_free(message); + if (message != stack_buf) { + SDL_free(message); + } if (SDL_strcmp(envr, "abort") == 0) { return SDL_ASSERTION_ABORT; @@ -301,7 +326,9 @@ SDL_RestoreWindow(window); } - SDL_stack_free(message); + if (message != stack_buf) { + SDL_free(message); + } return state; } @@ -384,6 +411,7 @@ void SDL_AssertionsQuit(void) { +#if SDL_ASSERT_LEVEL > 0 SDL_GenerateAssertionReport(); #ifndef SDL_THREADS_DISABLED if (assertion_mutex != NULL) { @@ -391,6 +419,7 @@ assertion_mutex = NULL; } #endif +#endif /* SDL_ASSERT_LEVEL > 0 */ } void SDL_SetAssertionHandler(SDL_AssertionHandler handler, void *userdata) diff -Nru libsdl2-2.0.22+dfsg/src/SDL.c libsdl2-2.24.0+dfsg/src/SDL.c --- libsdl2-2.0.22+dfsg/src/SDL.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/SDL.c 2022-08-13 03:48:10.000000000 +0000 @@ -20,7 +20,7 @@ */ #include "./SDL_internal.h" -#if defined(__WIN32__) +#if defined(__WIN32__) || defined(__GDK__) #include "core/windows/SDL_windows.h" #elif defined(__OS2__) #include /* _exit() */ @@ -47,6 +47,7 @@ #include "SDL_bits.h" #include "SDL_revision.h" #include "SDL_assert_c.h" +#include "SDL_log_c.h" #include "events/SDL_events_c.h" #include "haptic/SDL_haptic_c.h" #include "joystick/SDL_joystick_c.h" @@ -61,6 +62,26 @@ extern int SDL_HelperWindowDestroy(void); #endif +#ifdef SDL_BUILD_MAJOR_VERSION +SDL_COMPILE_TIME_ASSERT(SDL_BUILD_MAJOR_VERSION, + SDL_MAJOR_VERSION == SDL_BUILD_MAJOR_VERSION); +SDL_COMPILE_TIME_ASSERT(SDL_BUILD_MINOR_VERSION, + SDL_MINOR_VERSION == SDL_BUILD_MINOR_VERSION); +SDL_COMPILE_TIME_ASSERT(SDL_BUILD_MICRO_VERSION, + SDL_PATCHLEVEL == SDL_BUILD_MICRO_VERSION); +#endif + +SDL_COMPILE_TIME_ASSERT(SDL_MAJOR_VERSION_min, SDL_MAJOR_VERSION >= 0); +/* Limited only by the need to fit in SDL_version */ +SDL_COMPILE_TIME_ASSERT(SDL_MAJOR_VERSION_max, SDL_MAJOR_VERSION <= 255); + +SDL_COMPILE_TIME_ASSERT(SDL_MINOR_VERSION_min, SDL_MINOR_VERSION >= 0); +/* Limited only by the need to fit in SDL_version */ +SDL_COMPILE_TIME_ASSERT(SDL_MINOR_VERSION_max, SDL_MINOR_VERSION <= 255); + +SDL_COMPILE_TIME_ASSERT(SDL_PATCHLEVEL_min, SDL_PATCHLEVEL >= 0); +/* Limited by its encoding in SDL_VERSIONNUM and in the ABI versions */ +SDL_COMPILE_TIME_ASSERT(SDL_PATCHLEVEL_max, SDL_PATCHLEVEL <= 99); /* This is not declared in any header, although it is shared between some parts of SDL, because we don't want anything calling it without an @@ -68,7 +89,7 @@ extern SDL_NORETURN void SDL_ExitProcess(int exitcode); SDL_NORETURN void SDL_ExitProcess(int exitcode) { -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__GDK__) /* "if you do not know the state of all threads in your process, it is better to call TerminateProcess than ExitProcess" https://msdn.microsoft.com/en-us/library/windows/desktop/ms682658(v=vs.85).aspx */ @@ -156,6 +177,8 @@ return SDL_SetError("Application didn't initialize properly, did you include SDL_main.h in the file containing your main() function?"); } + SDL_LogInit(); + /* Clear the error message */ SDL_ClearError(); @@ -470,12 +493,13 @@ SDL_ClearHints(); SDL_AssertionsQuit(); - SDL_LogResetPriorities(); #if SDL_USE_LIBDBUS SDL_DBus_Quit(); #endif + SDL_LogQuit(); + /* Now that every subsystem has been quit, we reset the subsystem refcount * and the list of initialized subsystems. */ @@ -555,14 +579,24 @@ return "Windows"; #elif __WINRT__ return "WinRT"; +#elif __WINGDK__ + return "WinGDK"; +#elif __XBOXONE__ + return "Xbox One"; +#elif __XBOXSERIES__ + return "Xbox Series"; #elif __TVOS__ return "tvOS"; #elif __IPHONEOS__ return "iOS"; +#elif __PS2__ + return "PlayStation 2"; #elif __PSP__ return "PlayStation Portable"; #elif __VITA__ return "PlayStation Vita"; +#elif __NGAGE__ + return "Nokia N-Gage"; #else return "Unknown (see SDL_platform.h)"; #endif @@ -602,6 +636,6 @@ } #endif /* Building DLL */ -#endif /* __WIN32__ */ +#endif /* defined(__WIN32__) || defined(__GDK__) */ /* vi: set sts=4 ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/SDL_error.c libsdl2-2.24.0+dfsg/src/SDL_error.c --- libsdl2-2.0.22+dfsg/src/SDL_error.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/SDL_error.c 2022-08-13 03:48:10.000000000 +0000 @@ -25,22 +25,34 @@ #include "SDL_error.h" #include "SDL_error_c.h" -#define SDL_ERRBUFIZE 1024 - int SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { /* Ignore call if invalid format pointer was passed */ if (fmt != NULL) { va_list ap; + int result; SDL_error *error = SDL_GetErrBuf(); error->error = 1; /* mark error as valid */ va_start(ap, fmt); - SDL_vsnprintf(error->str, ERR_MAX_STRLEN, fmt, ap); + result = SDL_vsnprintf(error->str, error->len, fmt, ap); va_end(ap); + if (result >= 0 && (size_t)result >= error->len && error->realloc_func) { + size_t len = (size_t)result + 1; + char *str = (char *)error->realloc_func(error->str, len); + if (str) { + error->str = str; + error->len = len; + va_start(ap, fmt); + SDL_vsnprintf(error->str, error->len, fmt, ap); + va_end(ap); + } + } + + if (SDL_LogGetPriority(SDL_LOG_CATEGORY_ERROR) <= SDL_LOG_PRIORITY_DEBUG) { /* If we are in debug mode, print out the error message */ SDL_LogDebug(SDL_LOG_CATEGORY_ERROR, "%s", error->str); diff -Nru libsdl2-2.0.22+dfsg/src/SDL_error_c.h libsdl2-2.24.0+dfsg/src/SDL_error_c.h --- libsdl2-2.0.22+dfsg/src/SDL_error_c.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/SDL_error_c.h 2022-08-13 03:48:10.000000000 +0000 @@ -27,12 +27,13 @@ #ifndef SDL_error_c_h_ #define SDL_error_c_h_ -#define ERR_MAX_STRLEN 128 - typedef struct SDL_error { int error; /* This is a numeric value corresponding to the current error */ - char str[ERR_MAX_STRLEN]; + char *str; + size_t len; + SDL_realloc_func realloc_func; + SDL_free_func free_func; } SDL_error; /* Defined in SDL_thread.c */ diff -Nru libsdl2-2.0.22+dfsg/src/SDL_guid.c libsdl2-2.24.0+dfsg/src/SDL_guid.c --- libsdl2-2.0.22+dfsg/src/SDL_guid.c 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/SDL_guid.c 2022-06-16 20:16:31.000000000 +0000 @@ -0,0 +1,91 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "SDL_internal.h" + + +#include "SDL_guid.h" + +/* convert the guid to a printable string */ +void SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID) +{ + static const char k_rgchHexToASCII[] = "0123456789abcdef"; + int i; + + if ((pszGUID == NULL) || (cbGUID <= 0)) { + return; + } + + for (i = 0; i < sizeof(guid.data) && i < (cbGUID-1)/2; i++) { + /* each input byte writes 2 ascii chars, and might write a null byte. */ + /* If we don't have room for next input byte, stop */ + unsigned char c = guid.data[i]; + + *pszGUID++ = k_rgchHexToASCII[c >> 4]; + *pszGUID++ = k_rgchHexToASCII[c & 0x0F]; + } + *pszGUID = '\0'; +} + +/*----------------------------------------------------------------------------- + * Purpose: Returns the 4 bit nibble for a hex character + * Input : c - + * Output : unsigned char + *-----------------------------------------------------------------------------*/ +static unsigned char nibble(unsigned char c) +{ + if ((c >= '0') && (c <= '9')) { + return (c - '0'); + } + + if ((c >= 'A') && (c <= 'F')) { + return (c - 'A' + 0x0a); + } + + if ((c >= 'a') && (c <= 'f')) { + return (c - 'a' + 0x0a); + } + + /* received an invalid character, and no real way to return an error */ + /* AssertMsg1(false, "Q_nibble invalid hex character '%c' ", c); */ + return 0; +} + +/* convert the string version of a guid to the struct */ +SDL_GUID SDL_GUIDFromString(const char *pchGUID) +{ + SDL_GUID guid; + int maxoutputbytes= sizeof(guid); + size_t len = SDL_strlen(pchGUID); + Uint8 *p; + size_t i; + + /* Make sure it's even */ + len = (len) & ~0x1; + + SDL_memset(&guid, 0x00, sizeof(guid)); + + p = (Uint8 *)&guid; + for (i = 0; (i < len) && ((p - (Uint8 *)&guid) < maxoutputbytes); i+=2, p++) { + *p = (nibble((unsigned char)pchGUID[i]) << 4) | nibble((unsigned char)pchGUID[i+1]); + } + + return guid; +} diff -Nru libsdl2-2.0.22+dfsg/src/SDL_hints.c libsdl2-2.24.0+dfsg/src/SDL_hints.c --- libsdl2-2.0.22+dfsg/src/SDL_hints.c 2022-04-21 17:37:37.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/SDL_hints.c 2022-08-13 03:48:10.000000000 +0000 @@ -52,7 +52,7 @@ SDL_Hint *hint; SDL_HintWatch *entry; - if (!name || !value) { + if (!name) { return SDL_FALSE; } @@ -66,7 +66,8 @@ if (priority < hint->priority) { return SDL_FALSE; } - if (!hint->value || !value || SDL_strcmp(hint->value, value) != 0) { + if (hint->value != value && + (!value || !hint->value || SDL_strcmp(hint->value, value) != 0)) { for (entry = hint->callbacks; entry; ) { /* Save the next entry in case this one is deleted */ SDL_HintWatch *next = entry->next; @@ -96,6 +97,43 @@ } SDL_bool +SDL_ResetHint(const char *name) +{ + const char *env; + SDL_Hint *hint, *prev; + SDL_HintWatch *entry; + + if (!name) { + return SDL_FALSE; + } + + env = SDL_getenv(name); + for (prev = NULL, hint = SDL_hints; hint; prev = hint, hint = hint->next) { + if (SDL_strcmp(name, hint->name) == 0) { + if ((env == NULL && hint->value != NULL) || + (env != NULL && hint->value == NULL) || + (env && SDL_strcmp(env, hint->value) != 0)) { + for (entry = hint->callbacks; entry; ) { + /* Save the next entry in case this one is deleted */ + SDL_HintWatch *next = entry->next; + entry->callback(entry->userdata, name, hint->value, env); + entry = next; + } + } + if (prev) { + prev->next = hint->next; + } else { + SDL_hints = hint->next; + } + SDL_free(hint->value); + SDL_free(hint); + return SDL_TRUE; + } + } + return SDL_FALSE; +} + +SDL_bool SDL_SetHint(const char *name, const char *value) { return SDL_SetHintWithPriority(name, value, SDL_HINT_NORMAL); @@ -179,6 +217,7 @@ } hint->name = SDL_strdup(name); if (!hint->name) { + SDL_free(entry); SDL_free(hint); SDL_OutOfMemory(); return; diff -Nru libsdl2-2.0.22+dfsg/src/SDL_internal.h libsdl2-2.24.0+dfsg/src/SDL_internal.h --- libsdl2-2.0.22+dfsg/src/SDL_internal.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/SDL_internal.h 2022-06-02 02:01:57.000000000 +0000 @@ -43,10 +43,9 @@ #if SDL_DYNAMIC_API #include "dynapi/SDL_dynapi_overrides.h" -/* force DECLSPEC and SDLCALL off...it's all internal symbols now. +/* force DECLSPEC off...it's all internal symbols now. These will have actual #defines during SDL_dynapi.c only */ #define DECLSPEC -#define SDLCALL #endif #include "SDL_config.h" diff -Nru libsdl2-2.0.22+dfsg/src/SDL_log.c libsdl2-2.24.0+dfsg/src/SDL_log.c --- libsdl2-2.0.22+dfsg/src/SDL_log.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/SDL_log.c 2022-08-13 03:48:10.000000000 +0000 @@ -20,7 +20,7 @@ */ #include "./SDL_internal.h" -#if defined(__WIN32__) || defined(__WINRT__) +#if defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__) #include "core/windows/SDL_windows.h" #endif @@ -28,6 +28,8 @@ #include "SDL_error.h" #include "SDL_log.h" +#include "SDL_mutex.h" +#include "SDL_log_c.h" #if HAVE_STDIO_H #include @@ -37,6 +39,12 @@ #include #endif +#include "stdlib/SDL_vacopy.h" + + +/* The size of the stack buffer to use for rendering log messages. */ +#define SDL_MAX_LOG_MESSAGE_STACK 256 + #define DEFAULT_PRIORITY SDL_LOG_PRIORITY_CRITICAL #define DEFAULT_ASSERT_PRIORITY SDL_LOG_PRIORITY_WARN #define DEFAULT_APPLICATION_PRIORITY SDL_LOG_PRIORITY_INFO @@ -59,6 +67,7 @@ static SDL_LogPriority SDL_test_priority = DEFAULT_TEST_PRIORITY; static SDL_LogOutputFunction SDL_log_function = SDL_LogOutput; static void *SDL_log_userdata = NULL; +static SDL_mutex *log_function_mutex = NULL; static const char *SDL_priority_prefixes[SDL_NUM_LOG_PRIORITIES] = { NULL, @@ -71,16 +80,20 @@ }; #ifdef __ANDROID__ -static const char *SDL_category_prefixes[SDL_LOG_CATEGORY_RESERVED1] = { +static const char *SDL_category_prefixes[] = { "APP", "ERROR", + "ASSERT", "SYSTEM", "AUDIO", "VIDEO", "RENDER", - "INPUT" + "INPUT", + "TEST" }; +SDL_COMPILE_TIME_ASSERT(category_prefixes_enum, SDL_TABLESIZE(SDL_category_prefixes) == SDL_LOG_CATEGORY_RESERVED1); + static int SDL_android_priority[SDL_NUM_LOG_PRIORITIES] = { ANDROID_LOG_UNKNOWN, ANDROID_LOG_VERBOSE, @@ -92,6 +105,24 @@ }; #endif /* __ANDROID__ */ +void +SDL_LogInit(void) +{ + if (!log_function_mutex) { + /* if this fails we'll try to continue without it. */ + log_function_mutex = SDL_CreateMutex(); + } +} + +void +SDL_LogQuit(void) +{ + SDL_LogResetPriorities(); + if (log_function_mutex) { + SDL_DestroyMutex(log_function_mutex); + log_function_mutex = NULL; + } +} void SDL_LogSetAllPriority(SDL_LogPriority priority) @@ -264,8 +295,11 @@ void SDL_LogMessageV(int category, SDL_LogPriority priority, const char *fmt, va_list ap) { - char *message; - size_t len; + char *message = NULL; + char stack_buf[SDL_MAX_LOG_MESSAGE_STACK]; + size_t len_plus_term; + int len; + va_list aq; /* Nothing to do if we don't have an output function */ if (!SDL_log_function) { @@ -282,16 +316,33 @@ return; } - /* !!! FIXME: why not just "char message[SDL_MAX_LOG_MESSAGE];" ? */ - message = SDL_stack_alloc(char, SDL_MAX_LOG_MESSAGE); - if (!message) { - return; + if (!log_function_mutex) { + /* this mutex creation can race if you log from two threads at startup. You should have called SDL_Init first! */ + log_function_mutex = SDL_CreateMutex(); } - SDL_vsnprintf(message, SDL_MAX_LOG_MESSAGE, fmt, ap); + /* Render into stack buffer */ + va_copy(aq, ap); + len = SDL_vsnprintf(stack_buf, sizeof(stack_buf), fmt, aq); + va_end(aq); + + if (len < 0) + return; + + /* If message truncated, allocate and re-render */ + if (len >= sizeof(stack_buf) && SDL_size_add_overflow(len, 1, &len_plus_term) == 0) { + /* Allocate exactly what we need, including the zero-terminator */ + message = (char *)SDL_malloc(len_plus_term); + if (!message) + return; + va_copy(aq, ap); + len = SDL_vsnprintf(message, len_plus_term, fmt, aq); + va_end(aq); + } else { + message = stack_buf; + } /* Chop off final endline. */ - len = SDL_strlen(message); if ((len > 0) && (message[len-1] == '\n')) { message[--len] = '\0'; if ((len > 0) && (message[len-1] == '\r')) { /* catch "\r\n", too. */ @@ -299,11 +350,23 @@ } } + if (log_function_mutex) { + SDL_LockMutex(log_function_mutex); + } + SDL_log_function(SDL_log_userdata, category, priority, message); - SDL_stack_free(message); + + if (log_function_mutex) { + SDL_UnlockMutex(log_function_mutex); + } + + /* Free only if dynamically allocated */ + if (message != stack_buf) { + SDL_free(message); + } } -#if defined(__WIN32__) && !defined(HAVE_STDIO_H) && !defined(__WINRT__) +#if defined(__WIN32__) && !defined(HAVE_STDIO_H) && !defined(__WINRT__) && !defined(__GDK__) /* Flag tracking the attachment of the console: 0=unattached, 1=attached to a console, 2=attached to a file, -1=error */ static int consoleAttached = 0; @@ -315,7 +378,7 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, const char *message) { -#if defined(__WIN32__) || defined(__WINRT__) +#if defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__) /* Way too many allocations here, urgh */ /* Note: One can't call SDL_SetError here, since that function itself logs. */ { @@ -324,7 +387,7 @@ LPTSTR tstr; SDL_bool isstack; -#if !defined(HAVE_STDIO_H) && !defined(__WINRT__) +#if !defined(HAVE_STDIO_H) && !defined(__WINRT__) && !defined(__GDK__) BOOL attachResult; DWORD attachError; DWORD charsWritten; @@ -363,7 +426,7 @@ } } } -#endif /* !defined(HAVE_STDIO_H) && !defined(__WINRT__) */ +#endif /* !defined(HAVE_STDIO_H) && !defined(__WINRT__) && !defined(__GDK__) */ length = SDL_strlen(SDL_priority_prefixes[priority]) + 2 + SDL_strlen(message) + 1 + 1 + 1; output = SDL_small_alloc(char, length, &isstack); @@ -373,7 +436,7 @@ /* Output to debugger */ OutputDebugString(tstr); -#if !defined(HAVE_STDIO_H) && !defined(__WINRT__) +#if !defined(HAVE_STDIO_H) && !defined(__WINRT__) && !defined(__GDK__) /* Screen output to stderr, if console was attached. */ if (consoleAttached == 1) { if (!WriteConsole(stderrHandle, tstr, (DWORD) SDL_tcslen(tstr), &charsWritten, NULL)) { @@ -388,7 +451,7 @@ OutputDebugString(TEXT("Error calling WriteFile\r\n")); } } -#endif /* !defined(HAVE_STDIO_H) && !defined(__WINRT__) */ +#endif /* !defined(HAVE_STDIO_H) && !defined(__WINRT__) && !defined(__GDK__) */ SDL_free(tstr); SDL_small_free(output, isstack); @@ -403,19 +466,12 @@ #elif defined(__APPLE__) && (defined(SDL_VIDEO_DRIVER_COCOA) || defined(SDL_VIDEO_DRIVER_UIKIT)) /* Technically we don't need Cocoa/UIKit, but that's where this function is defined for now. */ - extern void SDL_NSLog(const char *text); + extern void SDL_NSLog(const char *prefix, const char *text); { - char *text; - /* !!! FIXME: why not just "char text[SDL_MAX_LOG_MESSAGE];" ? */ - text = SDL_stack_alloc(char, SDL_MAX_LOG_MESSAGE); - if (text) { - SDL_snprintf(text, SDL_MAX_LOG_MESSAGE, "%s: %s", SDL_priority_prefixes[priority], message); - SDL_NSLog(text); - SDL_stack_free(text); - return; - } + SDL_NSLog(SDL_priority_prefixes[priority], message); + return; } -#elif defined(__PSP__) +#elif defined(__PSP__) || defined(__PS2__) { FILE* pFile; pFile = fopen ("SDL_Log.txt", "a"); diff -Nru libsdl2-2.0.22+dfsg/src/SDL_log_c.h libsdl2-2.24.0+dfsg/src/SDL_log_c.h --- libsdl2-2.0.22+dfsg/src/SDL_log_c.h 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/SDL_log_c.h 2022-06-02 02:01:57.000000000 +0000 @@ -0,0 +1,33 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "./SDL_internal.h" + +/* This file defines useful function for working with SDL logging */ + +#ifndef SDL_log_c_h_ +#define SDL_log_c_h_ + +extern void SDL_LogInit(void); +extern void SDL_LogQuit(void); + +#endif /* SDL_log_c_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/SDL_utils.c libsdl2-2.24.0+dfsg/src/SDL_utils.c --- libsdl2-2.0.22+dfsg/src/SDL_utils.c 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/SDL_utils.c 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,52 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "SDL_internal.h" + +#include "SDL_utils_c.h" + +/* Common utility functions that aren't in the public API */ + +int SDL_powerof2(int x) +{ + int value; + + if (x <= 0) { + /* Return some sane value - we shouldn't hit this in our use cases */ + return 1; + } + + /* This trick works for 32-bit values */ + { + SDL_COMPILE_TIME_ASSERT(SDL_powerof2, sizeof(x) == sizeof(Uint32)); + } + value = x; + value -= 1; + value |= value >> 1; + value |= value >> 2; + value |= value >> 4; + value |= value >> 8; + value |= value >> 16; + value += 1; + + return value; +} + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/SDL_utils_c.h libsdl2-2.24.0+dfsg/src/SDL_utils_c.h --- libsdl2-2.0.22+dfsg/src/SDL_utils_c.h 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/SDL_utils_c.h 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,32 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_utils_h_ +#define SDL_utils_h_ + +/* Common utility functions that aren't in the public API */ + +/* Return the smallest power of 2 greater than or equal to 'x' */ +int SDL_powerof2(int x); + +#endif /* SDL_utils_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/stdlib/SDL_crc16.c libsdl2-2.24.0+dfsg/src/stdlib/SDL_crc16.c --- libsdl2-2.0.22+dfsg/src/stdlib/SDL_crc16.c 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/stdlib/SDL_crc16.c 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,57 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../SDL_internal.h" + +#include "SDL_stdinc.h" + + +/* Public domain CRC implementation adapted from: + http://home.thep.lu.se/~bjorn/crc/crc32_simple.c + + This algorithm is compatible with the 16-bit CRC described here: + https://www.lammertbies.nl/comm/info/crc-calculation +*/ +/* NOTE: DO NOT CHANGE THIS ALGORITHM + There is code that relies on this in the joystick code +*/ + +static Uint16 crc16_for_byte(Uint8 r) +{ + Uint16 crc = 0; + int i; + for (i = 0; i < 8; ++i) { + crc = ((crc ^ r) & 1? 0xA001 : 0) ^ crc >> 1; + r >>= 1; + } + return crc; +} + +Uint16 SDL_crc16(Uint16 crc, const void *data, size_t len) +{ + /* As an optimization we can precalculate a 256 entry table for each byte */ + size_t i; + for(i = 0; i < len; ++i) { + crc = crc16_for_byte((Uint8)crc ^ ((const Uint8*)data)[i]) ^ crc >> 8; + } + return crc; +} + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/stdlib/SDL_crc32.c libsdl2-2.24.0+dfsg/src/stdlib/SDL_crc32.c --- libsdl2-2.0.22+dfsg/src/stdlib/SDL_crc32.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/stdlib/SDL_crc32.c 2022-08-13 03:48:10.000000000 +0000 @@ -25,6 +25,9 @@ /* Public domain CRC implementation adapted from: http://home.thep.lu.se/~bjorn/crc/crc32_simple.c + + This algorithm is compatible with the 32-bit CRC described here: + https://www.lammertbies.nl/comm/info/crc-calculation */ /* NOTE: DO NOT CHANGE THIS ALGORITHM There is code that relies on this in the joystick code @@ -33,7 +36,7 @@ static Uint32 crc32_for_byte(Uint32 r) { int i; - for(i = 0; i < 8; ++i) { + for (i = 0; i < 8; ++i) { r = (r & 1? 0: (Uint32)0xEDB88320L) ^ r >> 1; } return r ^ (Uint32)0xFF000000L; diff -Nru libsdl2-2.0.22+dfsg/src/stdlib/SDL_getenv.c libsdl2-2.24.0+dfsg/src/stdlib/SDL_getenv.c --- libsdl2-2.0.22+dfsg/src/stdlib/SDL_getenv.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/stdlib/SDL_getenv.c 2022-08-13 03:48:10.000000000 +0000 @@ -25,7 +25,7 @@ #include "../SDL_internal.h" -#if defined(__WIN32__) +#if defined(__WIN32__) || defined(__WINGDK__) #include "../core/windows/SDL_windows.h" #endif @@ -35,7 +35,7 @@ #include "SDL_stdinc.h" -#if defined(__WIN32__) && (!defined(HAVE_SETENV) || !defined(HAVE_GETENV)) +#if (defined(__WIN32__) || defined(__WINGDK__)) && (!defined(HAVE_SETENV) || !defined(HAVE_GETENV)) /* Note this isn't thread-safe! */ static char *SDL_envmem = NULL; /* Ugh, memory leak */ static size_t SDL_envmemlen = 0; @@ -54,7 +54,7 @@ return setenv(name, value, overwrite); } -#elif defined(__WIN32__) +#elif defined(__WIN32__) || defined(__WINGDK__) int SDL_setenv(const char *name, const char *value, int overwrite) { @@ -187,7 +187,7 @@ return getenv(name); } -#elif defined(__WIN32__) +#elif defined(__WIN32__) || defined(__WINGDK__) char * SDL_getenv(const char *name) { diff -Nru libsdl2-2.0.22+dfsg/src/stdlib/SDL_iconv.c libsdl2-2.24.0+dfsg/src/stdlib/SDL_iconv.c --- libsdl2-2.0.22+dfsg/src/stdlib/SDL_iconv.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/stdlib/SDL_iconv.c 2022-08-13 03:48:10.000000000 +0000 @@ -126,12 +126,12 @@ const char *name; int format; } encodings[] = { -/* *INDENT-OFF* */ +/* *INDENT-OFF* */ /* clang-format off */ { "ASCII", ENCODING_ASCII }, { "US-ASCII", ENCODING_ASCII }, { "8859-1", ENCODING_LATIN1 }, { "ISO-8859-1", ENCODING_LATIN1 }, -#if defined(__WIN32__) || defined(__OS2__) +#if defined(__WIN32__) || defined(__OS2__) || defined(__GDK__) { "WCHAR_T", ENCODING_UTF16LE }, #else { "WCHAR_T", ENCODING_UCS4NATIVE }, @@ -160,7 +160,7 @@ { "UCS-4LE", ENCODING_UCS4LE }, { "UCS-4BE", ENCODING_UCS4BE }, { "UCS-4-INTERNAL", ENCODING_UCS4NATIVE }, -/* *INDENT-ON* */ +/* *INDENT-ON* */ /* clang-format on */ }; static const char * diff -Nru libsdl2-2.0.22+dfsg/src/stdlib/SDL_malloc.c libsdl2-2.24.0+dfsg/src/stdlib/SDL_malloc.c --- libsdl2-2.0.22+dfsg/src/stdlib/SDL_malloc.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/stdlib/SDL_malloc.c 2022-08-13 03:48:10.000000000 +0000 @@ -487,7 +487,9 @@ #endif /* WIN32 */ #ifdef WIN32 +#ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN +#endif #include #define HAVE_MMAP 1 #define HAVE_MORECORE 0 @@ -733,7 +735,7 @@ maximum supported value of n differs across systems, but is in all cases less than the maximum representable value of a size_t. */ - void *dlmalloc(size_t); + void * SDLCALL dlmalloc(size_t); /* free(void* p) @@ -742,14 +744,14 @@ It has no effect if p is null. If p was not malloced or already freed, free(p) will by default cause the current program to abort. */ - void dlfree(void *); + void SDLCALL dlfree(void *); /* calloc(size_t n_elements, size_t element_size); Returns a pointer to n_elements * element_size bytes, with all locations set to zero. */ - void *dlcalloc(size_t, size_t); + void * SDLCALL dlcalloc(size_t, size_t); /* realloc(void* p, size_t n) @@ -774,7 +776,7 @@ to be used as an argument to realloc is not supported. */ - void *dlrealloc(void *, size_t); + void * SDLCALL dlrealloc(void *, size_t); /* memalign(size_t alignment, size_t n); @@ -1247,7 +1249,7 @@ #ifndef LACKS_UNISTD_H #include /* for sbrk */ #else /* LACKS_UNISTD_H */ -#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) +#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__) extern void *sbrk(ptrdiff_t); #endif /* FreeBSD etc */ #endif /* LACKS_UNISTD_H */ @@ -5305,10 +5307,10 @@ #endif /* !HAVE_MALLOC */ #ifdef HAVE_MALLOC -#define real_malloc malloc -#define real_calloc calloc -#define real_realloc realloc -#define real_free free +static void* SDLCALL real_malloc(size_t s) { return malloc(s); } +static void* SDLCALL real_calloc(size_t n, size_t s) { return calloc(n, s); } +static void* SDLCALL real_realloc(void *p, size_t s) { return realloc(p,s); } +static void SDLCALL real_free(void *p) { free(p); } #else #define real_malloc dlmalloc #define real_calloc dlcalloc @@ -5328,6 +5330,25 @@ real_malloc, real_calloc, real_realloc, real_free, { 0 } }; +void SDL_GetOriginalMemoryFunctions(SDL_malloc_func *malloc_func, + SDL_calloc_func *calloc_func, + SDL_realloc_func *realloc_func, + SDL_free_func *free_func) +{ + if (malloc_func) { + *malloc_func = real_malloc; + } + if (calloc_func) { + *calloc_func = real_calloc; + } + if (realloc_func) { + *realloc_func = real_realloc; + } + if (free_func) { + *free_func = real_free; + } +} + void SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func, SDL_calloc_func *calloc_func, SDL_realloc_func *realloc_func, diff -Nru libsdl2-2.0.22+dfsg/src/stdlib/SDL_mslibc.c libsdl2-2.24.0+dfsg/src/stdlib/SDL_mslibc.c --- libsdl2-2.0.22+dfsg/src/stdlib/SDL_mslibc.c 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/stdlib/SDL_mslibc.c 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,718 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#if defined(__clang_analyzer__) && !defined(SDL_DISABLE_ANALYZE_MACROS) +#define SDL_DISABLE_ANALYZE_MACROS 1 +#endif + +#include "../SDL_internal.h" + +/* This file contains SDL replacements for functions in the C library */ + +#if !defined(HAVE_LIBC) && !defined(SDL_STATIC_LIB) + +/* These are some C runtime intrinsics that need to be defined */ + +#if defined(_MSC_VER) + +#ifndef __FLTUSED__ +#define __FLTUSED__ +__declspec(selectany) int _fltused = 1; +#endif + +/* The optimizer on Visual Studio 2005 and later generates memcpy() and memset() calls. + Always provide it for the SDL2 DLL, but skip it when building static lib w/ static runtime. */ +#if (_MSC_VER >= 1400) && (!defined(_MT) || defined(DLL_EXPORT)) +extern void *memcpy(void* dst, const void* src, size_t len); +#pragma intrinsic(memcpy) + +#pragma function(memcpy) +void * +memcpy(void *dst, const void *src, size_t len) +{ + return SDL_memcpy(dst, src, len); +} + +extern void *memset(void* dst, int c, size_t len); +#pragma intrinsic(memset) + +#pragma function(memset) +void * +memset(void *dst, int c, size_t len) +{ + return SDL_memset(dst, c, len); +} +#endif /* (_MSC_VER >= 1400) && (!defined(_MT) || defined(DLL_EXPORT)) */ + +#ifdef _M_IX86 + +/* Float to long */ +void +__declspec(naked) +_ftol() +{ + /* *INDENT-OFF* */ + __asm { + push ebp + mov ebp,esp + sub esp,20h + and esp,0FFFFFFF0h + fld st(0) + fst dword ptr [esp+18h] + fistp qword ptr [esp+10h] + fild qword ptr [esp+10h] + mov edx,dword ptr [esp+18h] + mov eax,dword ptr [esp+10h] + test eax,eax + je integer_QnaN_or_zero +arg_is_not_integer_QnaN: + fsubp st(1),st + test edx,edx + jns positive + fstp dword ptr [esp] + mov ecx,dword ptr [esp] + xor ecx,80000000h + add ecx,7FFFFFFFh + adc eax,0 + mov edx,dword ptr [esp+14h] + adc edx,0 + jmp localexit +positive: + fstp dword ptr [esp] + mov ecx,dword ptr [esp] + add ecx,7FFFFFFFh + sbb eax,0 + mov edx,dword ptr [esp+14h] + sbb edx,0 + jmp localexit +integer_QnaN_or_zero: + mov edx,dword ptr [esp+14h] + test edx,7FFFFFFFh + jne arg_is_not_integer_QnaN + fstp dword ptr [esp+18h] + fstp dword ptr [esp+18h] +localexit: + leave + ret + } + /* *INDENT-ON* */ +} + +void +_ftol2_sse() +{ + _ftol(); +} + +/* 64-bit math operators for 32-bit systems */ +void +__declspec(naked) +_allmul() +{ + /* *INDENT-OFF* */ + __asm { + mov eax, dword ptr[esp+8] + mov ecx, dword ptr[esp+10h] + or ecx, eax + mov ecx, dword ptr[esp+0Ch] + jne hard + mov eax, dword ptr[esp+4] + mul ecx + ret 10h +hard: + push ebx + mul ecx + mov ebx, eax + mov eax, dword ptr[esp+8] + mul dword ptr[esp+14h] + add ebx, eax + mov eax, dword ptr[esp+8] + mul ecx + add edx, ebx + pop ebx + ret 10h + } + /* *INDENT-ON* */ +} + +void +__declspec(naked) +_alldiv() +{ + /* *INDENT-OFF* */ + __asm { + push edi + push esi + push ebx + xor edi,edi + mov eax,dword ptr [esp+14h] + or eax,eax + jge L1 + inc edi + mov edx,dword ptr [esp+10h] + neg eax + neg edx + sbb eax,0 + mov dword ptr [esp+14h],eax + mov dword ptr [esp+10h],edx +L1: + mov eax,dword ptr [esp+1Ch] + or eax,eax + jge L2 + inc edi + mov edx,dword ptr [esp+18h] + neg eax + neg edx + sbb eax,0 + mov dword ptr [esp+1Ch],eax + mov dword ptr [esp+18h],edx +L2: + or eax,eax + jne L3 + mov ecx,dword ptr [esp+18h] + mov eax,dword ptr [esp+14h] + xor edx,edx + div ecx + mov ebx,eax + mov eax,dword ptr [esp+10h] + div ecx + mov edx,ebx + jmp L4 +L3: + mov ebx,eax + mov ecx,dword ptr [esp+18h] + mov edx,dword ptr [esp+14h] + mov eax,dword ptr [esp+10h] +L5: + shr ebx,1 + rcr ecx,1 + shr edx,1 + rcr eax,1 + or ebx,ebx + jne L5 + div ecx + mov esi,eax + mul dword ptr [esp+1Ch] + mov ecx,eax + mov eax,dword ptr [esp+18h] + mul esi + add edx,ecx + jb L6 + cmp edx,dword ptr [esp+14h] + ja L6 + jb L7 + cmp eax,dword ptr [esp+10h] + jbe L7 +L6: + dec esi +L7: + xor edx,edx + mov eax,esi +L4: + dec edi + jne L8 + neg edx + neg eax + sbb edx,0 +L8: + pop ebx + pop esi + pop edi + ret 10h + } + /* *INDENT-ON* */ +} + +void +__declspec(naked) +_aulldiv() +{ + /* *INDENT-OFF* */ + __asm { + push ebx + push esi + mov eax,dword ptr [esp+18h] + or eax,eax + jne L1 + mov ecx,dword ptr [esp+14h] + mov eax,dword ptr [esp+10h] + xor edx,edx + div ecx + mov ebx,eax + mov eax,dword ptr [esp+0Ch] + div ecx + mov edx,ebx + jmp L2 +L1: + mov ecx,eax + mov ebx,dword ptr [esp+14h] + mov edx,dword ptr [esp+10h] + mov eax,dword ptr [esp+0Ch] +L3: + shr ecx,1 + rcr ebx,1 + shr edx,1 + rcr eax,1 + or ecx,ecx + jne L3 + div ebx + mov esi,eax + mul dword ptr [esp+18h] + mov ecx,eax + mov eax,dword ptr [esp+14h] + mul esi + add edx,ecx + jb L4 + cmp edx,dword ptr [esp+10h] + ja L4 + jb L5 + cmp eax,dword ptr [esp+0Ch] + jbe L5 +L4: + dec esi +L5: + xor edx,edx + mov eax,esi +L2: + pop esi + pop ebx + ret 10h + } + /* *INDENT-ON* */ +} + +void +__declspec(naked) +_allrem() +{ + /* *INDENT-OFF* */ + __asm { + push ebx + push edi + xor edi,edi + mov eax,dword ptr [esp+10h] + or eax,eax + jge L1 + inc edi + mov edx,dword ptr [esp+0Ch] + neg eax + neg edx + sbb eax,0 + mov dword ptr [esp+10h],eax + mov dword ptr [esp+0Ch],edx +L1: + mov eax,dword ptr [esp+18h] + or eax,eax + jge L2 + mov edx,dword ptr [esp+14h] + neg eax + neg edx + sbb eax,0 + mov dword ptr [esp+18h],eax + mov dword ptr [esp+14h],edx +L2: + or eax,eax + jne L3 + mov ecx,dword ptr [esp+14h] + mov eax,dword ptr [esp+10h] + xor edx,edx + div ecx + mov eax,dword ptr [esp+0Ch] + div ecx + mov eax,edx + xor edx,edx + dec edi + jns L4 + jmp L8 +L3: + mov ebx,eax + mov ecx,dword ptr [esp+14h] + mov edx,dword ptr [esp+10h] + mov eax,dword ptr [esp+0Ch] +L5: + shr ebx,1 + rcr ecx,1 + shr edx,1 + rcr eax,1 + or ebx,ebx + jne L5 + div ecx + mov ecx,eax + mul dword ptr [esp+18h] + xchg eax,ecx + mul dword ptr [esp+14h] + add edx,ecx + jb L6 + cmp edx,dword ptr [esp+10h] + ja L6 + jb L7 + cmp eax,dword ptr [esp+0Ch] + jbe L7 +L6: + sub eax,dword ptr [esp+14h] + sbb edx,dword ptr [esp+18h] +L7: + sub eax,dword ptr [esp+0Ch] + sbb edx,dword ptr [esp+10h] + dec edi + jns L8 +L4: + neg edx + neg eax + sbb edx,0 +L8: + pop edi + pop ebx + ret 10h + } + /* *INDENT-ON* */ +} + +void +__declspec(naked) +_aullrem() +{ + /* *INDENT-OFF* */ + __asm { + push ebx + mov eax,dword ptr [esp+14h] + or eax,eax + jne L1 + mov ecx,dword ptr [esp+10h] + mov eax,dword ptr [esp+0Ch] + xor edx,edx + div ecx + mov eax,dword ptr [esp+8] + div ecx + mov eax,edx + xor edx,edx + jmp L2 +L1: + mov ecx,eax + mov ebx,dword ptr [esp+10h] + mov edx,dword ptr [esp+0Ch] + mov eax,dword ptr [esp+8] +L3: + shr ecx,1 + rcr ebx,1 + shr edx,1 + rcr eax,1 + or ecx,ecx + jne L3 + div ebx + mov ecx,eax + mul dword ptr [esp+14h] + xchg eax,ecx + mul dword ptr [esp+10h] + add edx,ecx + jb L4 + cmp edx,dword ptr [esp+0Ch] + ja L4 + jb L5 + cmp eax,dword ptr [esp+8] + jbe L5 +L4: + sub eax,dword ptr [esp+10h] + sbb edx,dword ptr [esp+14h] +L5: + sub eax,dword ptr [esp+8] + sbb edx,dword ptr [esp+0Ch] + neg edx + neg eax + sbb edx,0 +L2: + pop ebx + ret 10h + } + /* *INDENT-ON* */ +} + +void +__declspec(naked) +_alldvrm() +{ + /* *INDENT-OFF* */ + __asm { + push edi + push esi + push ebp + xor edi,edi + xor ebp,ebp + mov eax,dword ptr [esp+14h] + or eax,eax + jge L1 + inc edi + inc ebp + mov edx,dword ptr [esp+10h] + neg eax + neg edx + sbb eax,0 + mov dword ptr [esp+14h],eax + mov dword ptr [esp+10h],edx +L1: + mov eax,dword ptr [esp+1Ch] + or eax,eax + jge L2 + inc edi + mov edx,dword ptr [esp+18h] + neg eax + neg edx + sbb eax,0 + mov dword ptr [esp+1Ch],eax + mov dword ptr [esp+18h],edx +L2: + or eax,eax + jne L3 + mov ecx,dword ptr [esp+18h] + mov eax,dword ptr [esp+14h] + xor edx,edx + div ecx + mov ebx,eax + mov eax,dword ptr [esp+10h] + div ecx + mov esi,eax + mov eax,ebx + mul dword ptr [esp+18h] + mov ecx,eax + mov eax,esi + mul dword ptr [esp+18h] + add edx,ecx + jmp L4 +L3: + mov ebx,eax + mov ecx,dword ptr [esp+18h] + mov edx,dword ptr [esp+14h] + mov eax,dword ptr [esp+10h] +L5: + shr ebx,1 + rcr ecx,1 + shr edx,1 + rcr eax,1 + or ebx,ebx + jne L5 + div ecx + mov esi,eax + mul dword ptr [esp+1Ch] + mov ecx,eax + mov eax,dword ptr [esp+18h] + mul esi + add edx,ecx + jb L6 + cmp edx,dword ptr [esp+14h] + ja L6 + jb L7 + cmp eax,dword ptr [esp+10h] + jbe L7 +L6: + dec esi + sub eax,dword ptr [esp+18h] + sbb edx,dword ptr [esp+1Ch] +L7: + xor ebx,ebx +L4: + sub eax,dword ptr [esp+10h] + sbb edx,dword ptr [esp+14h] + dec ebp + jns L9 + neg edx + neg eax + sbb edx,0 +L9: + mov ecx,edx + mov edx,ebx + mov ebx,ecx + mov ecx,eax + mov eax,esi + dec edi + jne L8 + neg edx + neg eax + sbb edx,0 +L8: + pop ebp + pop esi + pop edi + ret 10h + } + /* *INDENT-ON* */ +} + +void +__declspec(naked) +_aulldvrm() +{ + /* *INDENT-OFF* */ + __asm { + push esi + mov eax,dword ptr [esp+14h] + or eax,eax + jne L1 + mov ecx,dword ptr [esp+10h] + mov eax,dword ptr [esp+0Ch] + xor edx,edx + div ecx + mov ebx,eax + mov eax,dword ptr [esp+8] + div ecx + mov esi,eax + mov eax,ebx + mul dword ptr [esp+10h] + mov ecx,eax + mov eax,esi + mul dword ptr [esp+10h] + add edx,ecx + jmp L2 +L1: + mov ecx,eax + mov ebx,dword ptr [esp+10h] + mov edx,dword ptr [esp+0Ch] + mov eax,dword ptr [esp+8] +L3: + shr ecx,1 + rcr ebx,1 + shr edx,1 + rcr eax,1 + or ecx,ecx + jne L3 + div ebx + mov esi,eax + mul dword ptr [esp+14h] + mov ecx,eax + mov eax,dword ptr [esp+10h] + mul esi + add edx,ecx + jb L4 + cmp edx,dword ptr [esp+0Ch] + ja L4 + jb L5 + cmp eax,dword ptr [esp+8] + jbe L5 +L4: + dec esi + sub eax,dword ptr [esp+10h] + sbb edx,dword ptr [esp+14h] +L5: + xor ebx,ebx +L2: + sub eax,dword ptr [esp+8] + sbb edx,dword ptr [esp+0Ch] + neg edx + neg eax + sbb edx,0 + mov ecx,edx + mov edx,ebx + mov ebx,ecx + mov ecx,eax + mov eax,esi + pop esi + ret 10h + } + /* *INDENT-ON* */ +} + +void +__declspec(naked) +_allshl() +{ + /* *INDENT-OFF* */ + __asm { + cmp cl,40h + jae RETZERO + cmp cl,20h + jae MORE32 + shld edx,eax,cl + shl eax,cl + ret +MORE32: + mov edx,eax + xor eax,eax + and cl,1Fh + shl edx,cl + ret +RETZERO: + xor eax,eax + xor edx,edx + ret + } + /* *INDENT-ON* */ +} + +void +__declspec(naked) +_allshr() +{ + /* *INDENT-OFF* */ + __asm { + cmp cl,3Fh + jae RETSIGN + cmp cl,20h + jae MORE32 + shrd eax,edx,cl + sar edx,cl + ret +MORE32: + mov eax,edx + sar edx,1Fh + and cl,1Fh + sar eax,cl + ret +RETSIGN: + sar edx,1Fh + mov eax,edx + ret + } + /* *INDENT-ON* */ +} + +void +__declspec(naked) +_aullshr() +{ + /* *INDENT-OFF* */ + __asm { + cmp cl,40h + jae RETZERO + cmp cl,20h + jae MORE32 + shrd eax,edx,cl + shr edx,cl + ret +MORE32: + mov eax,edx + xor edx,edx + and cl,1Fh + shr eax,cl + ret +RETZERO: + xor eax,eax + xor edx,edx + ret + } + /* *INDENT-ON* */ +} + +#endif /* _M_IX86 */ + +#endif /* MSC_VER */ + +#endif /* !HAVE_LIBC && !SDL_STATIC_LIB */ + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/stdlib/SDL_qsort.c libsdl2-2.24.0+dfsg/src/stdlib/SDL_qsort.c --- libsdl2-2.0.22+dfsg/src/stdlib/SDL_qsort.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/stdlib/SDL_qsort.c 2022-06-02 02:01:57.000000000 +0000 @@ -534,5 +534,38 @@ #endif /* HAVE_QSORT */ +void * +SDL_bsearch(const void *key, const void *base, size_t nmemb, size_t size, int (*compare)(const void *, const void *)) +{ +#if defined(HAVE_BSEARCH) + return bsearch(key, base, nmemb, size, compare); +#else +/* SDL's replacement: Taken from the Public Domain C Library (PDCLib): + Permission is granted to use, modify, and / or redistribute at will. +*/ + const void *pivot; + size_t corr; + int rc; + + while (nmemb) { + /* algorithm needs -1 correction if remaining elements are an even number. */ + corr = nmemb % 2; + nmemb /= 2; + pivot = (const char *)base + (nmemb * size); + rc = compare(key, pivot); + + if (rc > 0) { + base = (const char *)pivot + size; + /* applying correction */ + nmemb -= (1 - corr); + } else if (rc == 0) { + return (void *)pivot; + } + } + + return NULL; +#endif /* HAVE_BSEARCH */ +} + /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/stdlib/SDL_stdlib.c libsdl2-2.24.0+dfsg/src/stdlib/SDL_stdlib.c --- libsdl2-2.0.22+dfsg/src/stdlib/SDL_stdlib.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/stdlib/SDL_stdlib.c 2022-08-13 03:48:10.000000000 +0000 @@ -533,696 +533,114 @@ int SDL_tolower(int x) { return ((x) >= 'A') && ((x) <= 'Z') ? ('a'+((x)-'A')) : (x); } #endif -#if defined(HAVE_CTYPE_H) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L -int SDL_isblank(int x) { return isblank(x); } -#else -int SDL_isblank(int x) { return ((x) == ' ') || ((x) == '\t'); } -#endif - -#ifndef HAVE_LIBC -/* These are some C runtime intrinsics that need to be defined */ - -#if defined(_MSC_VER) - -#ifndef __FLTUSED__ -#define __FLTUSED__ -__declspec(selectany) int _fltused = 1; -#endif +/* This file contains a portable memcpy manipulation function for SDL */ -/* The optimizer on Visual Studio 2005 and later generates memcpy() and memset() calls */ -#if _MSC_VER >= 1400 -extern void *memcpy(void* dst, const void* src, size_t len); -#pragma intrinsic(memcpy) - -#pragma function(memcpy) -void * -memcpy(void *dst, const void *src, size_t len) -{ - return SDL_memcpy(dst, src, len); -} - -extern void *memset(void* dst, int c, size_t len); -#pragma intrinsic(memset) - -#pragma function(memset) void * -memset(void *dst, int c, size_t len) -{ - return SDL_memset(dst, c, len); -} -#endif /* _MSC_VER >= 1400 */ - -#ifdef _M_IX86 - -/* Float to long */ -void -__declspec(naked) -_ftol() -{ - /* *INDENT-OFF* */ - __asm { - push ebp - mov ebp,esp - sub esp,20h - and esp,0FFFFFFF0h - fld st(0) - fst dword ptr [esp+18h] - fistp qword ptr [esp+10h] - fild qword ptr [esp+10h] - mov edx,dword ptr [esp+18h] - mov eax,dword ptr [esp+10h] - test eax,eax - je integer_QnaN_or_zero -arg_is_not_integer_QnaN: - fsubp st(1),st - test edx,edx - jns positive - fstp dword ptr [esp] - mov ecx,dword ptr [esp] - xor ecx,80000000h - add ecx,7FFFFFFFh - adc eax,0 - mov edx,dword ptr [esp+14h] - adc edx,0 - jmp localexit -positive: - fstp dword ptr [esp] - mov ecx,dword ptr [esp] - add ecx,7FFFFFFFh - sbb eax,0 - mov edx,dword ptr [esp+14h] - sbb edx,0 - jmp localexit -integer_QnaN_or_zero: - mov edx,dword ptr [esp+14h] - test edx,7FFFFFFFh - jne arg_is_not_integer_QnaN - fstp dword ptr [esp+18h] - fstp dword ptr [esp+18h] -localexit: - leave - ret - } - /* *INDENT-ON* */ -} - -void -_ftol2_sse() -{ - _ftol(); -} - -/* 64-bit math operators for 32-bit systems */ -void -__declspec(naked) -_allmul() -{ - /* *INDENT-OFF* */ - __asm { - mov eax, dword ptr[esp+8] - mov ecx, dword ptr[esp+10h] - or ecx, eax - mov ecx, dword ptr[esp+0Ch] - jne hard - mov eax, dword ptr[esp+4] - mul ecx - ret 10h -hard: - push ebx - mul ecx - mov ebx, eax - mov eax, dword ptr[esp+8] - mul dword ptr[esp+14h] - add ebx, eax - mov eax, dword ptr[esp+8] - mul ecx - add edx, ebx - pop ebx - ret 10h - } - /* *INDENT-ON* */ -} - -void -__declspec(naked) -_alldiv() -{ - /* *INDENT-OFF* */ - __asm { - push edi - push esi - push ebx - xor edi,edi - mov eax,dword ptr [esp+14h] - or eax,eax - jge L1 - inc edi - mov edx,dword ptr [esp+10h] - neg eax - neg edx - sbb eax,0 - mov dword ptr [esp+14h],eax - mov dword ptr [esp+10h],edx -L1: - mov eax,dword ptr [esp+1Ch] - or eax,eax - jge L2 - inc edi - mov edx,dword ptr [esp+18h] - neg eax - neg edx - sbb eax,0 - mov dword ptr [esp+1Ch],eax - mov dword ptr [esp+18h],edx -L2: - or eax,eax - jne L3 - mov ecx,dword ptr [esp+18h] - mov eax,dword ptr [esp+14h] - xor edx,edx - div ecx - mov ebx,eax - mov eax,dword ptr [esp+10h] - div ecx - mov edx,ebx - jmp L4 -L3: - mov ebx,eax - mov ecx,dword ptr [esp+18h] - mov edx,dword ptr [esp+14h] - mov eax,dword ptr [esp+10h] -L5: - shr ebx,1 - rcr ecx,1 - shr edx,1 - rcr eax,1 - or ebx,ebx - jne L5 - div ecx - mov esi,eax - mul dword ptr [esp+1Ch] - mov ecx,eax - mov eax,dword ptr [esp+18h] - mul esi - add edx,ecx - jb L6 - cmp edx,dword ptr [esp+14h] - ja L6 - jb L7 - cmp eax,dword ptr [esp+10h] - jbe L7 -L6: - dec esi -L7: - xor edx,edx - mov eax,esi -L4: - dec edi - jne L8 - neg edx - neg eax - sbb edx,0 -L8: - pop ebx - pop esi - pop edi - ret 10h - } - /* *INDENT-ON* */ -} - -void -__declspec(naked) -_aulldiv() +SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len) { - /* *INDENT-OFF* */ - __asm { - push ebx - push esi - mov eax,dword ptr [esp+18h] - or eax,eax - jne L1 - mov ecx,dword ptr [esp+14h] - mov eax,dword ptr [esp+10h] - xor edx,edx - div ecx - mov ebx,eax - mov eax,dword ptr [esp+0Ch] - div ecx - mov edx,ebx - jmp L2 -L1: - mov ecx,eax - mov ebx,dword ptr [esp+14h] - mov edx,dword ptr [esp+10h] - mov eax,dword ptr [esp+0Ch] -L3: - shr ecx,1 - rcr ebx,1 - shr edx,1 - rcr eax,1 - or ecx,ecx - jne L3 - div ebx - mov esi,eax - mul dword ptr [esp+18h] - mov ecx,eax - mov eax,dword ptr [esp+14h] - mul esi - add edx,ecx - jb L4 - cmp edx,dword ptr [esp+10h] - ja L4 - jb L5 - cmp eax,dword ptr [esp+0Ch] - jbe L5 -L4: - dec esi -L5: - xor edx,edx - mov eax,esi -L2: - pop esi - pop ebx - ret 10h - } - /* *INDENT-ON* */ -} - -void -__declspec(naked) -_allrem() -{ - /* *INDENT-OFF* */ - __asm { - push ebx - push edi - xor edi,edi - mov eax,dword ptr [esp+10h] - or eax,eax - jge L1 - inc edi - mov edx,dword ptr [esp+0Ch] - neg eax - neg edx - sbb eax,0 - mov dword ptr [esp+10h],eax - mov dword ptr [esp+0Ch],edx -L1: - mov eax,dword ptr [esp+18h] - or eax,eax - jge L2 - mov edx,dword ptr [esp+14h] - neg eax - neg edx - sbb eax,0 - mov dword ptr [esp+18h],eax - mov dword ptr [esp+14h],edx -L2: - or eax,eax - jne L3 - mov ecx,dword ptr [esp+14h] - mov eax,dword ptr [esp+10h] - xor edx,edx - div ecx - mov eax,dword ptr [esp+0Ch] - div ecx - mov eax,edx - xor edx,edx - dec edi - jns L4 - jmp L8 -L3: - mov ebx,eax - mov ecx,dword ptr [esp+14h] - mov edx,dword ptr [esp+10h] - mov eax,dword ptr [esp+0Ch] -L5: - shr ebx,1 - rcr ecx,1 - shr edx,1 - rcr eax,1 - or ebx,ebx - jne L5 - div ecx - mov ecx,eax - mul dword ptr [esp+18h] - xchg eax,ecx - mul dword ptr [esp+14h] - add edx,ecx - jb L6 - cmp edx,dword ptr [esp+10h] - ja L6 - jb L7 - cmp eax,dword ptr [esp+0Ch] - jbe L7 -L6: - sub eax,dword ptr [esp+14h] - sbb edx,dword ptr [esp+18h] -L7: - sub eax,dword ptr [esp+0Ch] - sbb edx,dword ptr [esp+10h] - dec edi - jns L8 -L4: - neg edx - neg eax - sbb edx,0 -L8: - pop edi - pop ebx - ret 10h - } - /* *INDENT-ON* */ -} - -void -__declspec(naked) -_aullrem() -{ - /* *INDENT-OFF* */ - __asm { - push ebx - mov eax,dword ptr [esp+14h] - or eax,eax - jne L1 - mov ecx,dword ptr [esp+10h] - mov eax,dword ptr [esp+0Ch] - xor edx,edx - div ecx - mov eax,dword ptr [esp+8] - div ecx - mov eax,edx - xor edx,edx - jmp L2 -L1: - mov ecx,eax - mov ebx,dword ptr [esp+10h] - mov edx,dword ptr [esp+0Ch] - mov eax,dword ptr [esp+8] -L3: - shr ecx,1 - rcr ebx,1 - shr edx,1 - rcr eax,1 - or ecx,ecx - jne L3 - div ebx - mov ecx,eax - mul dword ptr [esp+14h] - xchg eax,ecx - mul dword ptr [esp+10h] - add edx,ecx - jb L4 - cmp edx,dword ptr [esp+0Ch] - ja L4 - jb L5 - cmp eax,dword ptr [esp+8] - jbe L5 -L4: - sub eax,dword ptr [esp+10h] - sbb edx,dword ptr [esp+14h] -L5: - sub eax,dword ptr [esp+8] - sbb edx,dword ptr [esp+0Ch] - neg edx - neg eax - sbb edx,0 -L2: - pop ebx - ret 10h - } - /* *INDENT-ON* */ -} - -void -__declspec(naked) -_alldvrm() -{ - /* *INDENT-OFF* */ - __asm { - push edi - push esi - push ebp - xor edi,edi - xor ebp,ebp - mov eax,dword ptr [esp+14h] - or eax,eax - jge L1 - inc edi - inc ebp - mov edx,dword ptr [esp+10h] - neg eax - neg edx - sbb eax,0 - mov dword ptr [esp+14h],eax - mov dword ptr [esp+10h],edx -L1: - mov eax,dword ptr [esp+1Ch] - or eax,eax - jge L2 - inc edi - mov edx,dword ptr [esp+18h] - neg eax - neg edx - sbb eax,0 - mov dword ptr [esp+1Ch],eax - mov dword ptr [esp+18h],edx -L2: - or eax,eax - jne L3 - mov ecx,dword ptr [esp+18h] - mov eax,dword ptr [esp+14h] - xor edx,edx - div ecx - mov ebx,eax - mov eax,dword ptr [esp+10h] - div ecx - mov esi,eax - mov eax,ebx - mul dword ptr [esp+18h] - mov ecx,eax - mov eax,esi - mul dword ptr [esp+18h] - add edx,ecx - jmp L4 -L3: - mov ebx,eax - mov ecx,dword ptr [esp+18h] - mov edx,dword ptr [esp+14h] - mov eax,dword ptr [esp+10h] -L5: - shr ebx,1 - rcr ecx,1 - shr edx,1 - rcr eax,1 - or ebx,ebx - jne L5 - div ecx - mov esi,eax - mul dword ptr [esp+1Ch] - mov ecx,eax - mov eax,dword ptr [esp+18h] - mul esi - add edx,ecx - jb L6 - cmp edx,dword ptr [esp+14h] - ja L6 - jb L7 - cmp eax,dword ptr [esp+10h] - jbe L7 -L6: - dec esi - sub eax,dword ptr [esp+18h] - sbb edx,dword ptr [esp+1Ch] -L7: - xor ebx,ebx -L4: - sub eax,dword ptr [esp+10h] - sbb edx,dword ptr [esp+14h] - dec ebp - jns L9 - neg edx - neg eax - sbb edx,0 -L9: - mov ecx,edx - mov edx,ebx - mov ebx,ecx - mov ecx,eax - mov eax,esi - dec edi - jne L8 - neg edx - neg eax - sbb edx,0 -L8: - pop ebp - pop esi - pop edi - ret 10h - } - /* *INDENT-ON* */ -} - -void -__declspec(naked) -_aulldvrm() -{ - /* *INDENT-OFF* */ - __asm { - push esi - mov eax,dword ptr [esp+14h] - or eax,eax - jne L1 - mov ecx,dword ptr [esp+10h] - mov eax,dword ptr [esp+0Ch] - xor edx,edx - div ecx - mov ebx,eax - mov eax,dword ptr [esp+8] - div ecx - mov esi,eax - mov eax,ebx - mul dword ptr [esp+10h] - mov ecx,eax - mov eax,esi - mul dword ptr [esp+10h] - add edx,ecx - jmp L2 -L1: - mov ecx,eax - mov ebx,dword ptr [esp+10h] - mov edx,dword ptr [esp+0Ch] - mov eax,dword ptr [esp+8] -L3: - shr ecx,1 - rcr ebx,1 - shr edx,1 - rcr eax,1 - or ecx,ecx - jne L3 - div ebx - mov esi,eax - mul dword ptr [esp+14h] - mov ecx,eax - mov eax,dword ptr [esp+10h] - mul esi - add edx,ecx - jb L4 - cmp edx,dword ptr [esp+0Ch] - ja L4 - jb L5 - cmp eax,dword ptr [esp+8] - jbe L5 -L4: - dec esi - sub eax,dword ptr [esp+10h] - sbb edx,dword ptr [esp+14h] -L5: - xor ebx,ebx -L2: - sub eax,dword ptr [esp+8] - sbb edx,dword ptr [esp+0Ch] - neg edx - neg eax - sbb edx,0 - mov ecx,edx - mov edx,ebx - mov ebx,ecx - mov ecx,eax - mov eax,esi - pop esi - ret 10h - } - /* *INDENT-ON* */ -} - -void -__declspec(naked) -_allshl() -{ - /* *INDENT-OFF* */ - __asm { - cmp cl,40h - jae RETZERO - cmp cl,20h - jae MORE32 - shld edx,eax,cl - shl eax,cl - ret -MORE32: - mov edx,eax - xor eax,eax - and cl,1Fh - shl edx,cl - ret -RETZERO: - xor eax,eax - xor edx,edx - ret +#ifdef __GNUC__ + /* Presumably this is well tuned for speed. + On my machine this is twice as fast as the C code below. + */ + return __builtin_memcpy(dst, src, len); +#elif defined(HAVE_MEMCPY) + return memcpy(dst, src, len); +#elif defined(HAVE_BCOPY) + bcopy(src, dst, len); + return dst; +#else + /* GCC 4.9.0 with -O3 will generate movaps instructions with the loop + using Uint32* pointers, so we need to make sure the pointers are + aligned before we loop using them. + */ + if (((uintptr_t)src & 0x3) || ((uintptr_t)dst & 0x3)) { + /* Do an unaligned byte copy */ + Uint8 *srcp1 = (Uint8 *)src; + Uint8 *dstp1 = (Uint8 *)dst; + + while (len--) { + *dstp1++ = *srcp1++; + } + } else { + size_t left = (len % 4); + Uint32 *srcp4, *dstp4; + Uint8 *srcp1, *dstp1; + + srcp4 = (Uint32 *) src; + dstp4 = (Uint32 *) dst; + len /= 4; + while (len--) { + *dstp4++ = *srcp4++; + } + + srcp1 = (Uint8 *) srcp4; + dstp1 = (Uint8 *) dstp4; + switch (left) { + case 3: + *dstp1++ = *srcp1++; + case 2: + *dstp1++ = *srcp1++; + case 1: + *dstp1++ = *srcp1++; + } } - /* *INDENT-ON* */ + return dst; +#endif /* __GNUC__ */ } -void -__declspec(naked) -_allshr() +void * +SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len) { - /* *INDENT-OFF* */ - __asm { - cmp cl,3Fh - jae RETSIGN - cmp cl,20h - jae MORE32 - shrd eax,edx,cl - sar edx,cl - ret -MORE32: - mov eax,edx - sar edx,1Fh - and cl,1Fh - sar eax,cl - ret -RETSIGN: - sar edx,1Fh - mov eax,edx - ret +#if defined(HAVE_MEMSET) + return memset(dst, c, len); +#else + size_t left; + Uint32 *dstp4; + Uint8 *dstp1 = (Uint8 *) dst; + Uint8 value1; + Uint32 value4; + + /* The value used in memset() is a byte, passed as an int */ + c &= 0xff; + + /* The destination pointer needs to be aligned on a 4-byte boundary to + * execute a 32-bit set. Set first bytes manually if needed until it is + * aligned. */ + value1 = (Uint8)c; + while ((uintptr_t)dstp1 & 0x3) { + if (len--) { + *dstp1++ = value1; + } else { + return dst; + } + } + + value4 = ((Uint32)c | ((Uint32)c << 8) | ((Uint32)c << 16) | ((Uint32)c << 24)); + dstp4 = (Uint32 *) dstp1; + left = (len % 4); + len /= 4; + while (len--) { + *dstp4++ = value4; + } + + dstp1 = (Uint8 *) dstp4; + switch (left) { + case 3: + *dstp1++ = value1; + case 2: + *dstp1++ = value1; + case 1: + *dstp1++ = value1; } - /* *INDENT-ON* */ -} -void -__declspec(naked) -_aullshr() -{ - /* *INDENT-OFF* */ - __asm { - cmp cl,40h - jae RETZERO - cmp cl,20h - jae MORE32 - shrd eax,edx,cl - shr edx,cl - ret -MORE32: - mov eax,edx - xor edx,edx - and cl,1Fh - shr eax,cl - ret -RETZERO: - xor eax,eax - xor edx,edx - ret - } - /* *INDENT-ON* */ + return dst; +#endif /* HAVE_MEMSET */ } -#endif /* _M_IX86 */ - -#endif /* MSC_VER */ - -#endif /* !HAVE_LIBC */ +#if defined(HAVE_CTYPE_H) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +int SDL_isblank(int x) { return isblank(x); } +#else +int SDL_isblank(int x) { return ((x) == ' ') || ((x) == '\t'); } +#endif /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/stdlib/SDL_string.c libsdl2-2.24.0+dfsg/src/stdlib/SDL_string.c --- libsdl2-2.0.22+dfsg/src/stdlib/SDL_string.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/stdlib/SDL_string.c 2022-08-13 15:09:00.000000000 +0000 @@ -27,14 +27,7 @@ /* This file contains portable string manipulation functions for SDL */ #include "SDL_stdinc.h" - -#if defined(_MSC_VER) && _MSC_VER <= 1800 -/* Visual Studio 2013 tries to link with _vacopy in the C runtime. Newer versions do an inline assignment */ -#undef va_copy -#define va_copy(dst, src) dst = src -#elif defined(__GNUC__) && (__GNUC__ < 3) -#define va_copy(to, from) __va_copy(to, from) -#endif +#include "SDL_vacopy.h" #if !defined(HAVE_VSSCANF) || !defined(HAVE_STRTOL) || !defined(HAVE_STRTOUL) || !defined(HAVE_STRTOD) || !defined(HAVE_STRTOLL) || !defined(HAVE_STRTOULL) #define SDL_isupperhex(X) (((X) >= 'A') && ((X) <= 'F')) @@ -58,7 +51,7 @@ #if !defined(HAVE_VSSCANF) || !defined(HAVE_STRTOL) static size_t -SDL_ScanLong(const char *text, int radix, long *valuep) +SDL_ScanLong(const char *text, int count, int radix, long *valuep) { const char *textstart = text; long value = 0; @@ -85,6 +78,10 @@ value *= radix; value += v; ++text; + + if (count > 0 && (text - textstart) == count) { + break; + } } if (valuep && text > textstart) { if (negative && value) { @@ -99,7 +96,7 @@ #if !defined(HAVE_VSSCANF) || !defined(HAVE_STRTOUL) || !defined(HAVE_STRTOD) static size_t -SDL_ScanUnsignedLong(const char *text, int radix, unsigned long *valuep) +SDL_ScanUnsignedLong(const char *text, int count, int radix, unsigned long *valuep) { const char *textstart = text; unsigned long value = 0; @@ -121,6 +118,10 @@ value *= radix; value += v; ++text; + + if (count > 0 && (text - textstart) == count) { + break; + } } if (valuep && text > textstart) { *valuep = value; @@ -163,7 +164,7 @@ #if !defined(HAVE_VSSCANF) || !defined(HAVE_STRTOLL) static size_t -SDL_ScanLongLong(const char *text, int radix, Sint64 * valuep) +SDL_ScanLongLong(const char *text, int count, int radix, Sint64 * valuep) { const char *textstart = text; Sint64 value = 0; @@ -190,6 +191,10 @@ value *= radix; value += v; ++text; + + if (count > 0 && (text - textstart) == count) { + break; + } } if (valuep && text > textstart) { if (negative && value) { @@ -204,7 +209,7 @@ #if !defined(HAVE_VSSCANF) || !defined(HAVE_STRTOULL) static size_t -SDL_ScanUnsignedLongLong(const char *text, int radix, Uint64 * valuep) +SDL_ScanUnsignedLongLong(const char *text, int count, int radix, Uint64 * valuep) { const char *textstart = text; Uint64 value = 0; @@ -226,6 +231,10 @@ value *= radix; value += v; ++text; + + if (count > 0 && (text - textstart) == count) { + break; + } } if (valuep && text > textstart) { *valuep = value; @@ -247,7 +256,7 @@ negative = SDL_TRUE; ++text; } - text += SDL_ScanUnsignedLong(text, 10, &lvalue); + text += SDL_ScanUnsignedLong(text, 0, 10, &lvalue); value += lvalue; if (*text == '.') { int mult = 10; @@ -271,108 +280,6 @@ #endif void * -SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len) -{ -#if defined(HAVE_MEMSET) - return memset(dst, c, len); -#else - size_t left; - Uint32 *dstp4; - Uint8 *dstp1 = (Uint8 *) dst; - Uint8 value1; - Uint32 value4; - - /* The value used in memset() is a byte, passed as an int */ - c &= 0xff; - - /* The destination pointer needs to be aligned on a 4-byte boundary to - * execute a 32-bit set. Set first bytes manually if needed until it is - * aligned. */ - value1 = (Uint8)c; - while ((uintptr_t)dstp1 & 0x3) { - if (len--) { - *dstp1++ = value1; - } else { - return dst; - } - } - - value4 = ((Uint32)c | ((Uint32)c << 8) | ((Uint32)c << 16) | ((Uint32)c << 24)); - dstp4 = (Uint32 *) dstp1; - left = (len % 4); - len /= 4; - while (len--) { - *dstp4++ = value4; - } - - dstp1 = (Uint8 *) dstp4; - switch (left) { - case 3: - *dstp1++ = value1; - case 2: - *dstp1++ = value1; - case 1: - *dstp1++ = value1; - } - - return dst; -#endif /* HAVE_MEMSET */ -} - -void * -SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len) -{ -#ifdef __GNUC__ - /* Presumably this is well tuned for speed. - On my machine this is twice as fast as the C code below. - */ - return __builtin_memcpy(dst, src, len); -#elif defined(HAVE_MEMCPY) - return memcpy(dst, src, len); -#elif defined(HAVE_BCOPY) - bcopy(src, dst, len); - return dst; -#else - /* GCC 4.9.0 with -O3 will generate movaps instructions with the loop - using Uint32* pointers, so we need to make sure the pointers are - aligned before we loop using them. - */ - if (((uintptr_t)src & 0x3) || ((uintptr_t)dst & 0x3)) { - /* Do an unaligned byte copy */ - Uint8 *srcp1 = (Uint8 *)src; - Uint8 *dstp1 = (Uint8 *)dst; - - while (len--) { - *dstp1++ = *srcp1++; - } - } else { - size_t left = (len % 4); - Uint32 *srcp4, *dstp4; - Uint8 *srcp1, *dstp1; - - srcp4 = (Uint32 *) src; - dstp4 = (Uint32 *) dst; - len /= 4; - while (len--) { - *dstp4++ = *srcp4++; - } - - srcp1 = (Uint8 *) srcp4; - dstp1 = (Uint8 *) dstp4; - switch (left) { - case 3: - *dstp1++ = *srcp1++; - case 2: - *dstp1++ = *srcp1++; - case 1: - *dstp1++ = *srcp1++; - } - } - return dst; -#endif /* __GNUC__ */ -} - -void * SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len) { #if defined(HAVE_MEMMOVE) @@ -683,6 +590,23 @@ } size_t +SDL_utf8strnlen(const char *str, size_t bytes) +{ + size_t retval = 0; + const char *p = str; + unsigned char ch; + + while ((ch = *(p++)) != 0 && bytes-- > 0) { + /* if top two bits are 1 and 0, it's a continuation byte. */ + if ((ch & 0xc0) != 0x80) { + retval++; + } + } + + return retval; +} + +size_t SDL_strlcat(SDL_INOUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen) { #if defined(HAVE_STRLCAT) @@ -771,6 +695,9 @@ } ++string; } + if (c == '\0') { + return (char *) string; + } return NULL; #endif /* HAVE_STRCHR */ } @@ -783,7 +710,7 @@ #elif defined(HAVE_RINDEX) return SDL_const_cast(char*,rindex(string, c)); #else - const char *bufp = string + SDL_strlen(string) - 1; + const char *bufp = string + SDL_strlen(string); while (bufp >= string) { if (*bufp == c) { return (char *) bufp; @@ -964,7 +891,7 @@ } } - len = SDL_ScanLong(string, base, &value); + len = SDL_ScanLong(string, 0, base, &value); if (endp) { *endp = (char *) string + len; } @@ -989,7 +916,7 @@ } } - len = SDL_ScanUnsignedLong(string, base, &value); + len = SDL_ScanUnsignedLong(string, 0, base, &value); if (endp) { *endp = (char *) string + len; } @@ -1014,7 +941,7 @@ } } - len = SDL_ScanLongLong(string, base, &value); + len = SDL_ScanLongLong(string, 0, base, &value); if (endp) { *endp = (char *) string + len; } @@ -1039,7 +966,7 @@ } } - len = SDL_ScanUnsignedLongLong(string, base, &value); + len = SDL_ScanUnsignedLongLong(string, 0, base, &value); if (endp) { *endp = (char *) string + len; } @@ -1217,7 +1144,7 @@ suppress = SDL_TRUE; ++fmt; } - fmt += SDL_ScanLong(fmt, 10, &count); + fmt += SDL_ScanLong(fmt, 0, 10, &count); if (*fmt == 'c') { if (!count) { @@ -1280,8 +1207,8 @@ SDL_FALLTHROUGH; case 'd': if (inttype == DO_LONGLONG) { - Sint64 value; - advance = SDL_ScanLongLong(text, radix, &value); + Sint64 value = 0; + advance = SDL_ScanLongLong(text, count, radix, &value); text += advance; if (advance && !suppress) { Sint64 *valuep = va_arg(ap, Sint64 *); @@ -1289,8 +1216,8 @@ ++retval; } } else { - long value; - advance = SDL_ScanLong(text, radix, &value); + long value = 0; + advance = SDL_ScanLong(text, count, radix, &value); text += advance; if (advance && !suppress) { switch (inttype) { @@ -1335,7 +1262,7 @@ case 'u': if (inttype == DO_LONGLONG) { Uint64 value = 0; - advance = SDL_ScanUnsignedLongLong(text, radix, &value); + advance = SDL_ScanUnsignedLongLong(text, count, radix, &value); text += advance; if (advance && !suppress) { Uint64 *valuep = va_arg(ap, Uint64 *); @@ -1344,7 +1271,7 @@ } } else { unsigned long value = 0; - advance = SDL_ScanUnsignedLong(text, radix, &value); + advance = SDL_ScanUnsignedLong(text, count, radix, &value); text += advance; if (advance && !suppress) { switch (inttype) { diff -Nru libsdl2-2.0.22+dfsg/src/stdlib/SDL_vacopy.h libsdl2-2.24.0+dfsg/src/stdlib/SDL_vacopy.h --- libsdl2-2.0.22+dfsg/src/stdlib/SDL_vacopy.h 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/stdlib/SDL_vacopy.h 2022-06-02 02:01:57.000000000 +0000 @@ -0,0 +1,36 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* Do our best to make sure va_copy is working */ +#if defined(__NGAGE__) +#undef va_copy +#define va_copy(dst, src) dst = src + +#elif defined(_MSC_VER) && _MSC_VER <= 1800 +/* Visual Studio 2013 tries to link with _vacopy in the C runtime. Newer versions do an inline assignment */ +#undef va_copy +#define va_copy(dst, src) dst = src + +#elif defined(__GNUC__) && (__GNUC__ < 3) +#define va_copy(dst, src) __va_copy(dst, src) +#endif + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/test/SDL_test_common.c libsdl2-2.24.0+dfsg/src/test/SDL_test_common.c --- libsdl2-2.0.22+dfsg/src/test/SDL_test_common.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/test/SDL_test_common.c 2022-08-13 03:48:10.000000000 +0000 @@ -28,7 +28,7 @@ static const char *video_usage[] = { "[--video driver]", "[--renderer driver]", "[--gldebug]", - "[--info all|video|modes|render|event]", + "[--info all|video|modes|render|event|event_motion]", "[--log all|error|system|audio|video|render|input]", "[--display N]", "[--metal-window | --opengl-window | --vulkan-window]", "[--fullscreen | --fullscreen-desktop | --windows N]", "[--title title]", @@ -168,6 +168,10 @@ state->verbose |= VERBOSE_EVENT; return 2; } + if (SDL_strcasecmp(argv[index], "event_motion") == 0) { + state->verbose |= (VERBOSE_EVENT | VERBOSE_MOTION); + return 2; + } return -1; } if (SDL_strcasecmp(argv[index], "--log") == 0) { @@ -1196,7 +1200,7 @@ } } -#if SDL_VIDEO_DRIVER_WINDOWS +#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) /* Print the D3D9 adapter index */ adapterIndex = SDL_Direct3D9GetAdapterIndex( i ); SDL_Log("D3D9 Adapter Index: %d", adapterIndex); @@ -1464,13 +1468,6 @@ static void SDLTest_PrintEvent(SDL_Event * event) { -#ifndef VERBOSE_MOTION_EVENTS - if ((event->type == SDL_MOUSEMOTION) || (event->type == SDL_FINGERMOTION)) { - /* Mouse and finger motion are really spammy */ - return; - } -#endif - switch (event->type) { case SDL_DISPLAYEVENT: switch (event->display.event) { @@ -1811,12 +1808,12 @@ flags = SDL_GetWindowFlags(window); if (flags & SDL_WINDOW_FULLSCREEN) { - SDL_SetWindowFullscreen( window, SDL_FALSE ); + SDL_SetWindowFullscreen( window, 0); SDL_Delay( 15 ); } SDL_SetWindowPosition( window, rect.x, rect.y ); - SDL_SetWindowFullscreen( window, SDL_TRUE ); + SDL_SetWindowFullscreen( window, SDL_WINDOW_FULLSCREEN ); } void @@ -1826,7 +1823,11 @@ static SDL_MouseMotionEvent lastEvent; if (state->verbose & VERBOSE_EVENT) { - SDLTest_PrintEvent(event); + if (((event->type != SDL_MOUSEMOTION) && + (event->type != SDL_FINGERMOTION)) || + ((state->verbose & VERBOSE_MOTION) != 0)) { + SDLTest_PrintEvent(event); + } } switch (event->type) { diff -Nru libsdl2-2.0.22+dfsg/src/test/SDL_test_font.c libsdl2-2.24.0+dfsg/src/test/SDL_test_font.c --- libsdl2-2.0.22+dfsg/src/test/SDL_test_font.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/test/SDL_test_font.c 2022-08-13 03:48:10.000000000 +0000 @@ -24,488 +24,1539 @@ /* ---- 8x8 font definition ---- */ -/* Originally part of SDL2_gfx */ +/* +; Summary: font8_8.asm +; 8x8 monochrome bitmap fonts for rendering +; +; Author: +; Marcel Sondaar +; International Business Machines (public domain VGA fonts) +; +; License: +; Public Domain +; +*/ + +static unsigned char SDLTest_FontData[] = { + + /* + * 0 0x00 '^@' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 1 0x01 '^A' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 2 0x02 '^B' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 3 0x03 '^C' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 4 0x04 '^D' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 5 0x05 '^E' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 6 0x06 '^F' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 7 0x07 '^G' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 8 0x08 '^H' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 9 0x09 '^I' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 10 0x0a '^J' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 11 0x0b '^K' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 12 0x0c '^L' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 13 0x0d '^M' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 14 0x0e '^N' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 15 0x0f '^O' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 16 0x10 '^P' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 17 0x11 '^Q' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 18 0x12 '^R' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 19 0x13 '^S' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 20 0x14 '^T' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 21 0x15 '^U' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 22 0x16 '^V' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 23 0x17 '^W' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 24 0x18 '^X' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 25 0x19 '^Y' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 26 0x1a '^Z' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 27 0x1b '^[' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 28 0x1c '^\' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 29 0x1d '^]' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 30 0x1e '^^' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 31 0x1f '^_' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 32 0x20 ' ' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 33 0x21 '!' + */ + 0x18, /* 00011000 */ + 0x3c, /* 00111100 */ + 0x3c, /* 00111100 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + + /* + * 34 0x22 '"' + */ + 0x36, /* 01101100 */ + 0x36, /* 01101100 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 35 0x23 '#' + */ + 0x36, /* 01101100 */ + 0x36, /* 01101100 */ + 0x7f, /* 11111110 */ + 0x36, /* 01101100 */ + 0x7f, /* 11111110 */ + 0x36, /* 01101100 */ + 0x36, /* 01101100 */ + 0x00, /* 00000000 */ + + /* + * 36 0x24 '$' + */ + 0x0c, /* 00110000 */ + 0x3e, /* 01111100 */ + 0x03, /* 11000000 */ + 0x1e, /* 01111000 */ + 0x30, /* 00001100 */ + 0x1f, /* 11111000 */ + 0x0c, /* 00110000 */ + 0x00, /* 00000000 */ -/* ZLIB (c) A. Schiffler 2012 */ + /* + * 37 0x25 '%' + */ + 0x00, /* 00000000 */ + 0x63, /* 11000110 */ + 0x33, /* 11001100 */ + 0x18, /* 00011000 */ + 0x0c, /* 00110000 */ + 0x66, /* 01100110 */ + 0x63, /* 11000110 */ + 0x00, /* 00000000 */ -#define SDL_TESTFONTDATAMAX (8*256) + /* + * 38 0x26 '&' + */ + 0x1c, /* 00111000 */ + 0x36, /* 01101100 */ + 0x1c, /* 00111000 */ + 0x6e, /* 01110110 */ + 0x3b, /* 11011100 */ + 0x33, /* 11001100 */ + 0x6e, /* 01110110 */ + 0x00, /* 00000000 */ -static unsigned char SDLTest_FontData[SDL_TESTFONTDATAMAX] = { + /* + * 39 0x27 ''' + */ + 0x06, /* 01100000 */ + 0x06, /* 01100000 */ + 0x03, /* 11000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ /* - * 0 0x00 '^@' - */ + * 40 0x28 '(' + */ + 0x18, /* 00011000 */ + 0x0c, /* 00110000 */ + 0x06, /* 01100000 */ + 0x06, /* 01100000 */ + 0x06, /* 01100000 */ + 0x0c, /* 00110000 */ + 0x18, /* 00011000 */ 0x00, /* 00000000 */ + + /* + * 41 0x29 ')' + */ + 0x06, /* 01100000 */ + 0x0c, /* 00110000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x0c, /* 00110000 */ + 0x06, /* 01100000 */ 0x00, /* 00000000 */ + + /* + * 42 0x2a '*' + */ 0x00, /* 00000000 */ + 0x66, /* 01100110 */ + 0x3c, /* 00111100 */ + 0xff, /* 11111111 */ + 0x3c, /* 00111100 */ + 0x66, /* 01100110 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ + + /* + * 43 0x2b '+' + */ 0x00, /* 00000000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x3f, /* 11111100 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ /* - * 1 0x01 '^A' - */ - 0x7e, /* 01111110 */ - 0x81, /* 10000001 */ - 0xa5, /* 10100101 */ - 0x81, /* 10000001 */ - 0xbd, /* 10111101 */ - 0x99, /* 10011001 */ - 0x81, /* 10000001 */ - 0x7e, /* 01111110 */ + * 44 0x2c ',' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x06, /* 01100000 */ /* - * 2 0x02 '^B' - */ - 0x7e, /* 01111110 */ - 0xff, /* 11111111 */ - 0xdb, /* 11011011 */ - 0xff, /* 11111111 */ - 0xc3, /* 11000011 */ - 0xe7, /* 11100111 */ - 0xff, /* 11111111 */ - 0x7e, /* 01111110 */ + * 45 0x2d '-' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x3f, /* 11111100 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 46 0x2e '.' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x00, /* 00000000 */ + + /* + * 47 0x2f '/' + */ + 0x60, /* 00000110 */ + 0x30, /* 00001100 */ + 0x18, /* 00011000 */ + 0x0c, /* 00110000 */ + 0x06, /* 01100000 */ + 0x03, /* 11000000 */ + 0x01, /* 10000000 */ + 0x00, /* 00000000 */ + + /* + * 48 0x30 '0' + */ + 0x3e, /* 01111100 */ + 0x63, /* 11000110 */ + 0x73, /* 11001110 */ + 0x7b, /* 11011110 */ + 0x6f, /* 11110110 */ + 0x67, /* 11100110 */ + 0x3e, /* 01111100 */ + 0x00, /* 00000000 */ + + /* + * 49 0x31 '1' + */ + 0x0c, /* 00110000 */ + 0x0e, /* 01110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x3f, /* 11111100 */ + 0x00, /* 00000000 */ + + /* + * 50 0x32 '2' + */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x30, /* 00001100 */ + 0x1c, /* 00111000 */ + 0x06, /* 01100000 */ + 0x33, /* 11001100 */ + 0x3f, /* 11111100 */ + 0x00, /* 00000000 */ + + /* + * 51 0x33 '3' + */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x30, /* 00001100 */ + 0x1c, /* 00111000 */ + 0x30, /* 00001100 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ + 0x00, /* 00000000 */ + + /* + * 52 0x34 '4' + */ + 0x38, /* 00011100 */ + 0x3c, /* 00111100 */ + 0x36, /* 01101100 */ + 0x33, /* 11001100 */ + 0x7f, /* 11111110 */ + 0x30, /* 00001100 */ + 0x78, /* 00011110 */ + 0x00, /* 00000000 */ + + /* + * 53 0x35 '5' + */ + 0x3f, /* 11111100 */ + 0x03, /* 11000000 */ + 0x1f, /* 11111000 */ + 0x30, /* 00001100 */ + 0x30, /* 00001100 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ + 0x00, /* 00000000 */ + + /* + * 54 0x36 '6' + */ + 0x1c, /* 00111000 */ + 0x06, /* 01100000 */ + 0x03, /* 11000000 */ + 0x1f, /* 11111000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ + 0x00, /* 00000000 */ + + /* + * 55 0x37 '7' + */ + 0x3f, /* 11111100 */ + 0x33, /* 11001100 */ + 0x30, /* 00001100 */ + 0x18, /* 00011000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x00, /* 00000000 */ + + /* + * 56 0x38 '8' + */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ + 0x00, /* 00000000 */ + + /* + * 57 0x39 '9' + */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x3e, /* 01111100 */ + 0x30, /* 00001100 */ + 0x18, /* 00011000 */ + 0x0e, /* 01110000 */ + 0x00, /* 00000000 */ + + /* + * 58 0x3a ':' + */ + 0x00, /* 00000000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x00, /* 00000000 */ + + /* + * 59 0x3b ';' + */ + 0x00, /* 00000000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x06, /* 01100000 */ + + /* + * 60 0x3c '<' + */ + 0x18, /* 00011000 */ + 0x0c, /* 00110000 */ + 0x06, /* 01100000 */ + 0x03, /* 11000000 */ + 0x06, /* 01100000 */ + 0x0c, /* 00110000 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + + /* + * 61 0x3d '=' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x3f, /* 11111100 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x3f, /* 11111100 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 62 0x3e '>' + */ + 0x06, /* 01100000 */ + 0x0c, /* 00110000 */ + 0x18, /* 00011000 */ + 0x30, /* 00001100 */ + 0x18, /* 00011000 */ + 0x0c, /* 00110000 */ + 0x06, /* 01100000 */ + 0x00, /* 00000000 */ + + /* + * 63 0x3f '?' + */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x30, /* 00001100 */ + 0x18, /* 00011000 */ + 0x0c, /* 00110000 */ + 0x00, /* 00000000 */ + 0x0c, /* 00110000 */ + 0x00, /* 00000000 */ + + /* + * 64 0x40 '@' + */ + 0x3e, /* 01111100 */ + 0x63, /* 11000110 */ + 0x7b, /* 11011110 */ + 0x7b, /* 11011110 */ + 0x7b, /* 11011110 */ + 0x03, /* 11000000 */ + 0x1e, /* 01111000 */ + 0x00, /* 00000000 */ + + /* + * 65 0x41 'A' + */ + 0x0c, /* 00110000 */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x3f, /* 11111100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x00, /* 00000000 */ + + /* + * 66 0x42 'B' + */ + 0x3f, /* 11111100 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x3e, /* 01111100 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x3f, /* 11111100 */ + 0x00, /* 00000000 */ + + /* + * 67 0x43 'C' + */ + 0x3c, /* 00111100 */ + 0x66, /* 01100110 */ + 0x03, /* 11000000 */ + 0x03, /* 11000000 */ + 0x03, /* 11000000 */ + 0x66, /* 01100110 */ + 0x3c, /* 00111100 */ + 0x00, /* 00000000 */ + + /* + * 68 0x44 'D' + */ + 0x1f, /* 11111000 */ + 0x36, /* 01101100 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x36, /* 01101100 */ + 0x1f, /* 11111000 */ + 0x00, /* 00000000 */ + + /* + * 69 0x45 'E' + */ + 0x7f, /* 11111110 */ + 0x46, /* 01100010 */ + 0x16, /* 01101000 */ + 0x1e, /* 01111000 */ + 0x16, /* 01101000 */ + 0x46, /* 01100010 */ + 0x7f, /* 11111110 */ + 0x00, /* 00000000 */ + + /* + * 70 0x46 'F' + */ + 0x7f, /* 11111110 */ + 0x46, /* 01100010 */ + 0x16, /* 01101000 */ + 0x1e, /* 01111000 */ + 0x16, /* 01101000 */ + 0x06, /* 01100000 */ + 0x0f, /* 11110000 */ + 0x00, /* 00000000 */ + + /* + * 71 0x47 'G' + */ + 0x3c, /* 00111100 */ + 0x66, /* 01100110 */ + 0x03, /* 11000000 */ + 0x03, /* 11000000 */ + 0x73, /* 11001110 */ + 0x66, /* 01100110 */ + 0x7c, /* 00111110 */ + 0x00, /* 00000000 */ + + /* + * 72 0x48 'H' + */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x3f, /* 11111100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x00, /* 00000000 */ + + /* + * 73 0x49 'I' + */ + 0x1e, /* 01111000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x1e, /* 01111000 */ + 0x00, /* 00000000 */ + + /* + * 74 0x4a 'J' + */ + 0x78, /* 00011110 */ + 0x30, /* 00001100 */ + 0x30, /* 00001100 */ + 0x30, /* 00001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ + 0x00, /* 00000000 */ + + /* + * 75 0x4b 'K' + */ + 0x67, /* 11100110 */ + 0x66, /* 01100110 */ + 0x36, /* 01101100 */ + 0x1e, /* 01111000 */ + 0x36, /* 01101100 */ + 0x66, /* 01100110 */ + 0x67, /* 11100110 */ + 0x00, /* 00000000 */ + + /* + * 76 0x4c 'L' + */ + 0x0f, /* 11110000 */ + 0x06, /* 01100000 */ + 0x06, /* 01100000 */ + 0x06, /* 01100000 */ + 0x46, /* 01100010 */ + 0x66, /* 01100110 */ + 0x7f, /* 11111110 */ + 0x00, /* 00000000 */ + + /* + * 77 0x4d 'M' + */ + 0x63, /* 11000110 */ + 0x77, /* 11101110 */ + 0x7f, /* 11111110 */ + 0x7f, /* 11111110 */ + 0x6b, /* 11010110 */ + 0x63, /* 11000110 */ + 0x63, /* 11000110 */ + 0x00, /* 00000000 */ + + /* + * 78 0x4e 'N' + */ + 0x63, /* 11000110 */ + 0x67, /* 11100110 */ + 0x6f, /* 11110110 */ + 0x7b, /* 11011110 */ + 0x73, /* 11001110 */ + 0x63, /* 11000110 */ + 0x63, /* 11000110 */ + 0x00, /* 00000000 */ + + /* + * 79 0x4f 'O' + */ + 0x1c, /* 00111000 */ + 0x36, /* 01101100 */ + 0x63, /* 11000110 */ + 0x63, /* 11000110 */ + 0x63, /* 11000110 */ + 0x36, /* 01101100 */ + 0x1c, /* 00111000 */ + 0x00, /* 00000000 */ + + /* + * 80 0x50 'P' + */ + 0x3f, /* 11111100 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x3e, /* 01111100 */ + 0x06, /* 01100000 */ + 0x06, /* 01100000 */ + 0x0f, /* 11110000 */ + 0x00, /* 00000000 */ + + /* + * 81 0x51 'Q' + */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x3b, /* 11011100 */ + 0x1e, /* 01111000 */ + 0x38, /* 00011100 */ + 0x00, /* 00000000 */ + + /* + * 82 0x52 'R' + */ + 0x3f, /* 11111100 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x3e, /* 01111100 */ + 0x36, /* 01101100 */ + 0x66, /* 01100110 */ + 0x67, /* 11100110 */ + 0x00, /* 00000000 */ /* - * 3 0x03 '^C' - */ - 0x6c, /* 01101100 */ - 0xfe, /* 11111110 */ - 0xfe, /* 11111110 */ - 0xfe, /* 11111110 */ - 0x7c, /* 01111100 */ - 0x38, /* 00111000 */ - 0x10, /* 00010000 */ + * 83 0x53 'S' + */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x07, /* 11100000 */ + 0x0e, /* 01110000 */ + 0x38, /* 00011100 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ 0x00, /* 00000000 */ /* - * 4 0x04 '^D' - */ - 0x10, /* 00010000 */ - 0x38, /* 00111000 */ - 0x7c, /* 01111100 */ - 0xfe, /* 11111110 */ - 0x7c, /* 01111100 */ - 0x38, /* 00111000 */ - 0x10, /* 00010000 */ + * 84 0x54 'T' + */ + 0x3f, /* 11111100 */ + 0x2d, /* 10110100 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x1e, /* 01111000 */ 0x00, /* 00000000 */ /* - * 5 0x05 '^E' - */ - 0x38, /* 00111000 */ - 0x7c, /* 01111100 */ - 0x38, /* 00111000 */ - 0xfe, /* 11111110 */ - 0xfe, /* 11111110 */ - 0xd6, /* 11010110 */ - 0x10, /* 00010000 */ - 0x38, /* 00111000 */ + * 85 0x55 'U' + */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x3f, /* 11111100 */ + 0x00, /* 00000000 */ /* - * 6 0x06 '^F' - */ - 0x10, /* 00010000 */ - 0x38, /* 00111000 */ - 0x7c, /* 01111100 */ - 0xfe, /* 11111110 */ - 0xfe, /* 11111110 */ - 0x7c, /* 01111100 */ - 0x10, /* 00010000 */ - 0x38, /* 00111000 */ + * 86 0x56 'V' + */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ + 0x0c, /* 00110000 */ + 0x00, /* 00000000 */ /* - * 7 0x07 '^G' - */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ - 0x3c, /* 00111100 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ + * 87 0x57 'W' + */ + 0x63, /* 11000110 */ + 0x63, /* 11000110 */ + 0x63, /* 11000110 */ + 0x6b, /* 11010110 */ + 0x7f, /* 11111110 */ + 0x77, /* 11101110 */ + 0x63, /* 11000110 */ 0x00, /* 00000000 */ /* - * 8 0x08 '^H' - */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - 0xe7, /* 11100111 */ - 0xc3, /* 11000011 */ - 0xc3, /* 11000011 */ - 0xe7, /* 11100111 */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ + * 88 0x58 'X' + */ + 0x63, /* 11000110 */ + 0x63, /* 11000110 */ + 0x36, /* 01101100 */ + 0x1c, /* 00111000 */ + 0x1c, /* 00111000 */ + 0x36, /* 01101100 */ + 0x63, /* 11000110 */ + 0x00, /* 00000000 */ /* - * 9 0x09 '^I' - */ + * 89 0x59 'Y' + */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x1e, /* 01111000 */ 0x00, /* 00000000 */ - 0x3c, /* 00111100 */ - 0x66, /* 01100110 */ - 0x42, /* 01000010 */ - 0x42, /* 01000010 */ + + /* + * 90 0x5a 'Z' + */ + 0x7f, /* 11111110 */ + 0x63, /* 11000110 */ + 0x31, /* 10001100 */ + 0x18, /* 00011000 */ + 0x4c, /* 00110010 */ 0x66, /* 01100110 */ - 0x3c, /* 00111100 */ + 0x7f, /* 11111110 */ 0x00, /* 00000000 */ /* - * 10 0x0a '^J' - */ - 0xff, /* 11111111 */ - 0xc3, /* 11000011 */ - 0x99, /* 10011001 */ - 0xbd, /* 10111101 */ - 0xbd, /* 10111101 */ - 0x99, /* 10011001 */ - 0xc3, /* 11000011 */ - 0xff, /* 11111111 */ + * 91 0x5b '[' + */ + 0x1e, /* 01111000 */ + 0x06, /* 01100000 */ + 0x06, /* 01100000 */ + 0x06, /* 01100000 */ + 0x06, /* 01100000 */ + 0x06, /* 01100000 */ + 0x1e, /* 01111000 */ + 0x00, /* 00000000 */ /* - * 11 0x0b '^K' - */ - 0x0f, /* 00001111 */ - 0x07, /* 00000111 */ - 0x0f, /* 00001111 */ - 0x7d, /* 01111101 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0x78, /* 01111000 */ + * 92 0x5c '\' + */ + 0x03, /* 11000000 */ + 0x06, /* 01100000 */ + 0x0c, /* 00110000 */ + 0x18, /* 00011000 */ + 0x30, /* 00001100 */ + 0x60, /* 00000110 */ + 0x40, /* 00000010 */ + 0x00, /* 00000000 */ /* - * 12 0x0c '^L' - */ - 0x3c, /* 00111100 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x3c, /* 00111100 */ + * 93 0x5d ']' + */ + 0x1e, /* 01111000 */ 0x18, /* 00011000 */ - 0x7e, /* 01111110 */ 0x18, /* 00011000 */ - - /* - * 13 0x0d '^M' - */ - 0x3f, /* 00111111 */ - 0x33, /* 00110011 */ - 0x3f, /* 00111111 */ - 0x30, /* 00110000 */ - 0x30, /* 00110000 */ - 0x70, /* 01110000 */ - 0xf0, /* 11110000 */ - 0xe0, /* 11100000 */ - - /* - * 14 0x0e '^N' - */ - 0x7f, /* 01111111 */ - 0x63, /* 01100011 */ - 0x7f, /* 01111111 */ - 0x63, /* 01100011 */ - 0x63, /* 01100011 */ - 0x67, /* 01100111 */ - 0xe6, /* 11100110 */ - 0xc0, /* 11000000 */ - - /* - * 15 0x0f '^O' - */ 0x18, /* 00011000 */ - 0xdb, /* 11011011 */ - 0x3c, /* 00111100 */ - 0xe7, /* 11100111 */ - 0xe7, /* 11100111 */ - 0x3c, /* 00111100 */ - 0xdb, /* 11011011 */ 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x1e, /* 01111000 */ + 0x00, /* 00000000 */ /* - * 16 0x10 '^P' - */ - 0x80, /* 10000000 */ - 0xe0, /* 11100000 */ - 0xf8, /* 11111000 */ - 0xfe, /* 11111110 */ - 0xf8, /* 11111000 */ - 0xe0, /* 11100000 */ - 0x80, /* 10000000 */ + * 94 0x5e '^' + */ + 0x08, /* 00010000 */ + 0x1c, /* 00111000 */ + 0x36, /* 01101100 */ + 0x63, /* 11000110 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ 0x00, /* 00000000 */ /* - * 17 0x11 '^Q' - */ - 0x02, /* 00000010 */ - 0x0e, /* 00001110 */ - 0x3e, /* 00111110 */ - 0xfe, /* 11111110 */ - 0x3e, /* 00111110 */ - 0x0e, /* 00001110 */ - 0x02, /* 00000010 */ + * 95 0x5f '_' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0xff, /* 11111111 */ /* - * 18 0x12 '^R' - */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ - 0x7e, /* 01111110 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x7e, /* 01111110 */ - 0x3c, /* 00111100 */ + * 96 0x60 '`' + */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ /* - * 19 0x13 '^S' - */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ + * 97 0x61 'a' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x1e, /* 01111000 */ + 0x30, /* 00001100 */ + 0x3e, /* 01111100 */ + 0x33, /* 11001100 */ + 0x6e, /* 01110110 */ + 0x00, /* 00000000 */ + + /* + * 98 0x62 'b' + */ + 0x07, /* 11100000 */ + 0x06, /* 01100000 */ + 0x06, /* 01100000 */ + 0x3e, /* 01111100 */ 0x66, /* 01100110 */ 0x66, /* 01100110 */ + 0x3b, /* 11011100 */ + 0x00, /* 00000000 */ + + /* + * 99 0x63 'c' + */ 0x00, /* 00000000 */ - 0x66, /* 01100110 */ + 0x00, /* 00000000 */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x03, /* 11000000 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ 0x00, /* 00000000 */ /* - * 20 0x14 '^T' - */ - 0x7f, /* 01111111 */ - 0xdb, /* 11011011 */ - 0xdb, /* 11011011 */ - 0x7b, /* 01111011 */ - 0x1b, /* 00011011 */ - 0x1b, /* 00011011 */ - 0x1b, /* 00011011 */ + * 100 0x64 'd' + */ + 0x38, /* 00011100 */ + 0x30, /* 00001100 */ + 0x30, /* 00001100 */ + 0x3e, /* 01111100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x6e, /* 01110110 */ 0x00, /* 00000000 */ /* - * 21 0x15 '^U' - */ - 0x3e, /* 00111110 */ - 0x61, /* 01100001 */ - 0x3c, /* 00111100 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x3c, /* 00111100 */ - 0x86, /* 10000110 */ - 0x7c, /* 01111100 */ + * 101 0x65 'e' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x3f, /* 11111100 */ + 0x03, /* 11000000 */ + 0x1e, /* 01111000 */ + 0x00, /* 00000000 */ /* - * 22 0x16 '^V' - */ + * 102 0x66 'f' + */ + 0x1c, /* 00111000 */ + 0x36, /* 01101100 */ + 0x06, /* 01100000 */ + 0x0f, /* 11110000 */ + 0x06, /* 01100000 */ + 0x06, /* 01100000 */ + 0x0f, /* 11110000 */ 0x00, /* 00000000 */ + + /* + * 103 0x67 'g' + */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ + 0x6e, /* 01110110 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x3e, /* 01111100 */ + 0x30, /* 00001100 */ + 0x1f, /* 11111000 */ + + /* + * 104 0x68 'h' + */ + 0x07, /* 11100000 */ + 0x06, /* 01100000 */ + 0x36, /* 01101100 */ + 0x6e, /* 01110110 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x67, /* 11100110 */ 0x00, /* 00000000 */ - 0x7e, /* 01111110 */ - 0x7e, /* 01111110 */ - 0x7e, /* 01111110 */ + + /* + * 105 0x69 'i' + */ + 0x0c, /* 00110000 */ + 0x00, /* 00000000 */ + 0x0e, /* 01110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x1e, /* 01111000 */ 0x00, /* 00000000 */ /* - * 23 0x17 '^W' - */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ - 0x7e, /* 01111110 */ - 0x18, /* 00011000 */ - 0x7e, /* 01111110 */ - 0x3c, /* 00111100 */ - 0x18, /* 00011000 */ - 0xff, /* 11111111 */ + * 106 0x6a 'j' + */ + 0x30, /* 00001100 */ + 0x00, /* 00000000 */ + 0x30, /* 00001100 */ + 0x30, /* 00001100 */ + 0x30, /* 00001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ /* - * 24 0x18 '^X' - */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ - 0x7e, /* 01111110 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ + * 107 0x6b 'k' + */ + 0x07, /* 11100000 */ + 0x06, /* 01100000 */ + 0x66, /* 01100110 */ + 0x36, /* 01101100 */ + 0x1e, /* 01111000 */ + 0x36, /* 01101100 */ + 0x67, /* 11100110 */ 0x00, /* 00000000 */ /* - * 25 0x19 '^Y' - */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x7e, /* 01111110 */ - 0x3c, /* 00111100 */ - 0x18, /* 00011000 */ + * 108 0x6c 'l' + */ + 0x0e, /* 01110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x1e, /* 01111000 */ 0x00, /* 00000000 */ /* - * 26 0x1a '^Z' - */ + * 109 0x6d 'm' + */ 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x0c, /* 00001100 */ - 0xfe, /* 11111110 */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ 0x00, /* 00000000 */ + 0x33, /* 11001100 */ + 0x7f, /* 11111110 */ + 0x7f, /* 11111110 */ + 0x6b, /* 11010110 */ + 0x63, /* 11000110 */ 0x00, /* 00000000 */ /* - * 27 0x1b '^[' - */ + * 110 0x6e 'n' + */ 0x00, /* 00000000 */ - 0x30, /* 00110000 */ - 0x60, /* 01100000 */ - 0xfe, /* 11111110 */ - 0x60, /* 01100000 */ - 0x30, /* 00110000 */ 0x00, /* 00000000 */ + 0x1f, /* 11111000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ 0x00, /* 00000000 */ /* - * 28 0x1c '^\' - */ - 0x00, /* 00000000 */ + * 111 0x6f 'o' + */ 0x00, /* 00000000 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xfe, /* 11111110 */ 0x00, /* 00000000 */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ 0x00, /* 00000000 */ /* - * 29 0x1d '^]' - */ + * 112 0x70 'p' + */ 0x00, /* 00000000 */ - 0x24, /* 00100100 */ + 0x00, /* 00000000 */ + 0x3b, /* 11011100 */ 0x66, /* 01100110 */ - 0xff, /* 11111111 */ 0x66, /* 01100110 */ - 0x24, /* 00100100 */ + 0x3e, /* 01111100 */ + 0x06, /* 01100000 */ + 0x0f, /* 11110000 */ + + /* + * 113 0x71 'q' + */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ + 0x6e, /* 01110110 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x3e, /* 01111100 */ + 0x30, /* 00001100 */ + 0x78, /* 00011110 */ /* - * 30 0x1e '^^' - */ + * 114 0x72 'r' + */ 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ - 0x7e, /* 01111110 */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ 0x00, /* 00000000 */ + 0x3b, /* 11011100 */ + 0x6e, /* 01110110 */ + 0x66, /* 01100110 */ + 0x06, /* 01100000 */ + 0x0f, /* 11110000 */ 0x00, /* 00000000 */ /* - * 31 0x1f '^_' - */ + * 115 0x73 's' + */ 0x00, /* 00000000 */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - 0x7e, /* 01111110 */ - 0x3c, /* 00111100 */ - 0x18, /* 00011000 */ 0x00, /* 00000000 */ + 0x3e, /* 01111100 */ + 0x03, /* 11000000 */ + 0x1e, /* 01111000 */ + 0x30, /* 00001100 */ + 0x1f, /* 11111000 */ 0x00, /* 00000000 */ /* - * 32 0x20 ' ' - */ - 0x00, /* 00000000 */ + * 116 0x74 't' + */ + 0x08, /* 00010000 */ + 0x0c, /* 00110000 */ + 0x3e, /* 01111100 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x2c, /* 00110100 */ + 0x18, /* 00011000 */ 0x00, /* 00000000 */ + + /* + * 117 0x75 'u' + */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x6e, /* 01110110 */ 0x00, /* 00000000 */ + + /* + * 118 0x76 'v' + */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ + 0x0c, /* 00110000 */ 0x00, /* 00000000 */ /* - * 33 0x21 '!' - */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ - 0x3c, /* 00111100 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ + * 119 0x77 'w' + */ 0x00, /* 00000000 */ - 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + 0x63, /* 11000110 */ + 0x6b, /* 11010110 */ + 0x7f, /* 11111110 */ + 0x7f, /* 11111110 */ + 0x36, /* 01101100 */ 0x00, /* 00000000 */ /* - * 34 0x22 '"' - */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x24, /* 00100100 */ + * 120 0x78 'x' + */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ + 0x63, /* 11000110 */ + 0x36, /* 01101100 */ + 0x1c, /* 00111000 */ + 0x36, /* 01101100 */ + 0x63, /* 11000110 */ 0x00, /* 00000000 */ + + /* + * 121 0x79 'y' + */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x3e, /* 01111100 */ + 0x30, /* 00001100 */ + 0x1f, /* 11111000 */ /* - * 35 0x23 '#' - */ - 0x6c, /* 01101100 */ - 0x6c, /* 01101100 */ - 0xfe, /* 11111110 */ - 0x6c, /* 01101100 */ - 0xfe, /* 11111110 */ - 0x6c, /* 01101100 */ - 0x6c, /* 01101100 */ + * 122 0x7a 'z' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x3f, /* 11111100 */ + 0x19, /* 10011000 */ + 0x0c, /* 00110000 */ + 0x26, /* 01100100 */ + 0x3f, /* 11111100 */ 0x00, /* 00000000 */ /* - * 36 0x24 '$' - */ - 0x18, /* 00011000 */ - 0x3e, /* 00111110 */ - 0x60, /* 01100000 */ - 0x3c, /* 00111100 */ - 0x06, /* 00000110 */ - 0x7c, /* 01111100 */ - 0x18, /* 00011000 */ + * 123 0x7b '{' + */ + 0x38, /* 00011100 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x07, /* 11100000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x38, /* 00011100 */ 0x00, /* 00000000 */ /* - * 37 0x25 '%' - */ + * 124 0x7c '|' + */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ 0x00, /* 00000000 */ - 0xc6, /* 11000110 */ - 0xcc, /* 11001100 */ 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0x66, /* 01100110 */ - 0xc6, /* 11000110 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ 0x00, /* 00000000 */ /* - * 38 0x26 '&' - */ - 0x38, /* 00111000 */ - 0x6c, /* 01101100 */ - 0x38, /* 00111000 */ - 0x76, /* 01110110 */ - 0xdc, /* 11011100 */ - 0xcc, /* 11001100 */ - 0x76, /* 01110110 */ + * 125 0x7d '}' + */ + 0x07, /* 11100000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x38, /* 00011100 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x07, /* 11100000 */ 0x00, /* 00000000 */ /* - * 39 0x27 ''' - */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ + * 126 0x7e '~' + */ + 0x6e, /* 01110110 */ + 0x3b, /* 11011100 */ + 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ @@ -513,668 +1564,178 @@ 0x00, /* 00000000 */ /* - * 40 0x28 '(' - */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0x30, /* 00110000 */ - 0x30, /* 00110000 */ - 0x18, /* 00011000 */ - 0x0c, /* 00001100 */ + * 127 0x7f '^?' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ 0x00, /* 00000000 */ /* - * 41 0x29 ')' - */ - 0x30, /* 00110000 */ - 0x18, /* 00011000 */ - 0x0c, /* 00001100 */ - 0x0c, /* 00001100 */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ + * 128 0x80 '€' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ 0x00, /* 00000000 */ /* - * 42 0x2a '*' - */ + * 129 0x81 'Â' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0x66, /* 01100110 */ - 0x3c, /* 00111100 */ - 0xff, /* 11111111 */ - 0x3c, /* 00111100 */ - 0x66, /* 01100110 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ /* - * 43 0x2b '+' - */ + * 130 0x82 '‚' + */ 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x7e, /* 01111110 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - - /* - * 44 0x2c ',' - */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ /* - * 45 0x2d '-' - */ + * 131 0x83 'ƒ' + */ + 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0x7e, /* 01111110 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ /* - * 46 0x2e '.' - */ + * 132 0x84 '„' + */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ 0x00, /* 00000000 */ - - /* - * 47 0x2f '/' - */ - 0x06, /* 00000110 */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0x60, /* 01100000 */ - 0xc0, /* 11000000 */ - 0x80, /* 10000000 */ 0x00, /* 00000000 */ - - /* - * 48 0x30 '0' - */ - 0x38, /* 00111000 */ - 0x6c, /* 01101100 */ - 0xc6, /* 11000110 */ - 0xd6, /* 11010110 */ - 0xc6, /* 11000110 */ - 0x6c, /* 01101100 */ - 0x38, /* 00111000 */ 0x00, /* 00000000 */ /* - * 49 0x31 '1' - */ - 0x18, /* 00011000 */ - 0x38, /* 00111000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x7e, /* 01111110 */ + * 133 0x85 ' +' + */ 0x00, /* 00000000 */ - - /* - * 50 0x32 '2' - */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0x06, /* 00000110 */ - 0x1c, /* 00011100 */ - 0x30, /* 00110000 */ - 0x66, /* 01100110 */ - 0xfe, /* 11111110 */ 0x00, /* 00000000 */ - - /* - * 51 0x33 '3' - */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0x06, /* 00000110 */ - 0x3c, /* 00111100 */ - 0x06, /* 00000110 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ 0x00, /* 00000000 */ - - /* - * 52 0x34 '4' - */ - 0x1c, /* 00011100 */ - 0x3c, /* 00111100 */ - 0x6c, /* 01101100 */ - 0xcc, /* 11001100 */ - 0xfe, /* 11111110 */ - 0x0c, /* 00001100 */ - 0x1e, /* 00011110 */ 0x00, /* 00000000 */ - - /* - * 53 0x35 '5' - */ - 0xfe, /* 11111110 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xfc, /* 11111100 */ - 0x06, /* 00000110 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ 0x00, /* 00000000 */ - - /* - * 54 0x36 '6' - */ - 0x38, /* 00111000 */ - 0x60, /* 01100000 */ - 0xc0, /* 11000000 */ - 0xfc, /* 11111100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ 0x00, /* 00000000 */ - - /* - * 55 0x37 '7' - */ - 0xfe, /* 11111110 */ - 0xc6, /* 11000110 */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0x30, /* 00110000 */ - 0x30, /* 00110000 */ 0x00, /* 00000000 */ - - /* - * 56 0x38 '8' - */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ 0x00, /* 00000000 */ /* - * 57 0x39 '9' - */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x7e, /* 01111110 */ - 0x06, /* 00000110 */ - 0x0c, /* 00001100 */ - 0x78, /* 01111000 */ + * 134 0x86 '†' + */ 0x00, /* 00000000 */ - - /* - * 58 0x3a ':' - */ 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ 0x00, /* 00000000 */ - - /* - * 59 0x3b ';' - */ 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ /* - * 60 0x3c '<' - */ - 0x06, /* 00000110 */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0x18, /* 00011000 */ - 0x0c, /* 00001100 */ - 0x06, /* 00000110 */ + * 135 0x87 '‡' + */ 0x00, /* 00000000 */ - - /* - * 61 0x3d '=' - */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0x7e, /* 01111110 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0x7e, /* 01111110 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - - /* - * 62 0x3e '>' - */ - 0x60, /* 01100000 */ - 0x30, /* 00110000 */ - 0x18, /* 00011000 */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0x60, /* 01100000 */ 0x00, /* 00000000 */ /* - * 63 0x3f '?' - */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ + * 136 0x88 'ˆ' + */ 0x00, /* 00000000 */ - 0x18, /* 00011000 */ 0x00, /* 00000000 */ - - /* - * 64 0x40 '@' - */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xde, /* 11011110 */ - 0xde, /* 11011110 */ - 0xde, /* 11011110 */ - 0xc0, /* 11000000 */ - 0x78, /* 01111000 */ 0x00, /* 00000000 */ - - /* - * 65 0x41 'A' - */ - 0x38, /* 00111000 */ - 0x6c, /* 01101100 */ - 0xc6, /* 11000110 */ - 0xfe, /* 11111110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ 0x00, /* 00000000 */ - - /* - * 66 0x42 'B' - */ - 0xfc, /* 11111100 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x7c, /* 01111100 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0xfc, /* 11111100 */ 0x00, /* 00000000 */ - - /* - * 67 0x43 'C' - */ - 0x3c, /* 00111100 */ - 0x66, /* 01100110 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0x66, /* 01100110 */ - 0x3c, /* 00111100 */ 0x00, /* 00000000 */ - - /* - * 68 0x44 'D' - */ - 0xf8, /* 11111000 */ - 0x6c, /* 01101100 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x6c, /* 01101100 */ - 0xf8, /* 11111000 */ 0x00, /* 00000000 */ - - /* - * 69 0x45 'E' - */ - 0xfe, /* 11111110 */ - 0x62, /* 01100010 */ - 0x68, /* 01101000 */ - 0x78, /* 01111000 */ - 0x68, /* 01101000 */ - 0x62, /* 01100010 */ - 0xfe, /* 11111110 */ 0x00, /* 00000000 */ /* - * 70 0x46 'F' - */ - 0xfe, /* 11111110 */ - 0x62, /* 01100010 */ - 0x68, /* 01101000 */ - 0x78, /* 01111000 */ - 0x68, /* 01101000 */ - 0x60, /* 01100000 */ - 0xf0, /* 11110000 */ + * 137 0x89 '‰' + */ 0x00, /* 00000000 */ - - /* - * 71 0x47 'G' - */ - 0x3c, /* 00111100 */ - 0x66, /* 01100110 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xce, /* 11001110 */ - 0x66, /* 01100110 */ - 0x3a, /* 00111010 */ 0x00, /* 00000000 */ - - /* - * 72 0x48 'H' - */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xfe, /* 11111110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ 0x00, /* 00000000 */ - - /* - * 73 0x49 'I' - */ - 0x3c, /* 00111100 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ 0x00, /* 00000000 */ - - /* - * 74 0x4a 'J' - */ - 0x1e, /* 00011110 */ - 0x0c, /* 00001100 */ - 0x0c, /* 00001100 */ - 0x0c, /* 00001100 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0x78, /* 01111000 */ 0x00, /* 00000000 */ - - /* - * 75 0x4b 'K' - */ - 0xe6, /* 11100110 */ - 0x66, /* 01100110 */ - 0x6c, /* 01101100 */ - 0x78, /* 01111000 */ - 0x6c, /* 01101100 */ - 0x66, /* 01100110 */ - 0xe6, /* 11100110 */ 0x00, /* 00000000 */ - - /* - * 76 0x4c 'L' - */ - 0xf0, /* 11110000 */ - 0x60, /* 01100000 */ - 0x60, /* 01100000 */ - 0x60, /* 01100000 */ - 0x62, /* 01100010 */ - 0x66, /* 01100110 */ - 0xfe, /* 11111110 */ 0x00, /* 00000000 */ - - /* - * 77 0x4d 'M' - */ - 0xc6, /* 11000110 */ - 0xee, /* 11101110 */ - 0xfe, /* 11111110 */ - 0xfe, /* 11111110 */ - 0xd6, /* 11010110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ 0x00, /* 00000000 */ /* - * 78 0x4e 'N' - */ - 0xc6, /* 11000110 */ - 0xe6, /* 11100110 */ - 0xf6, /* 11110110 */ - 0xde, /* 11011110 */ - 0xce, /* 11001110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ + * 138 0x8a 'Š' + */ 0x00, /* 00000000 */ - - /* - * 79 0x4f 'O' - */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ 0x00, /* 00000000 */ - - /* - * 80 0x50 'P' - */ - 0xfc, /* 11111100 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x7c, /* 01111100 */ - 0x60, /* 01100000 */ - 0x60, /* 01100000 */ - 0xf0, /* 11110000 */ 0x00, /* 00000000 */ - - /* - * 81 0x51 'Q' - */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xce, /* 11001110 */ - 0x7c, /* 01111100 */ - 0x0e, /* 00001110 */ - - /* - * 82 0x52 'R' - */ - 0xfc, /* 11111100 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x7c, /* 01111100 */ - 0x6c, /* 01101100 */ - 0x66, /* 01100110 */ - 0xe6, /* 11100110 */ 0x00, /* 00000000 */ - - /* - * 83 0x53 'S' - */ - 0x3c, /* 00111100 */ - 0x66, /* 01100110 */ - 0x30, /* 00110000 */ - 0x18, /* 00011000 */ - 0x0c, /* 00001100 */ - 0x66, /* 01100110 */ - 0x3c, /* 00111100 */ 0x00, /* 00000000 */ - - /* - * 84 0x54 'T' - */ - 0x7e, /* 01111110 */ - 0x7e, /* 01111110 */ - 0x5a, /* 01011010 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ 0x00, /* 00000000 */ - - /* - * 85 0x55 'U' - */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ 0x00, /* 00000000 */ - - /* - * 86 0x56 'V' - */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x6c, /* 01101100 */ - 0x38, /* 00111000 */ 0x00, /* 00000000 */ /* - * 87 0x57 'W' - */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xd6, /* 11010110 */ - 0xd6, /* 11010110 */ - 0xfe, /* 11111110 */ - 0x6c, /* 01101100 */ + * 139 0x8b '‹' + */ + 0x00, /* 00000000 */ 0x00, /* 00000000 */ - - /* - * 88 0x58 'X' - */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x6c, /* 01101100 */ - 0x38, /* 00111000 */ - 0x6c, /* 01101100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ 0x00, /* 00000000 */ - - /* - * 89 0x59 'Y' - */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x3c, /* 00111100 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ 0x00, /* 00000000 */ - - /* - * 90 0x5a 'Z' - */ - 0xfe, /* 11111110 */ - 0xc6, /* 11000110 */ - 0x8c, /* 10001100 */ - 0x18, /* 00011000 */ - 0x32, /* 00110010 */ - 0x66, /* 01100110 */ - 0xfe, /* 11111110 */ 0x00, /* 00000000 */ - - /* - * 91 0x5b '[' - */ - 0x3c, /* 00111100 */ - 0x30, /* 00110000 */ - 0x30, /* 00110000 */ - 0x30, /* 00110000 */ - 0x30, /* 00110000 */ - 0x30, /* 00110000 */ - 0x3c, /* 00111100 */ 0x00, /* 00000000 */ - - /* - * 92 0x5c '\' - */ - 0xc0, /* 11000000 */ - 0x60, /* 01100000 */ - 0x30, /* 00110000 */ - 0x18, /* 00011000 */ - 0x0c, /* 00001100 */ - 0x06, /* 00000110 */ - 0x02, /* 00000010 */ 0x00, /* 00000000 */ - - /* - * 93 0x5d ']' - */ - 0x3c, /* 00111100 */ - 0x0c, /* 00001100 */ - 0x0c, /* 00001100 */ - 0x0c, /* 00001100 */ - 0x0c, /* 00001100 */ - 0x0c, /* 00001100 */ - 0x3c, /* 00111100 */ 0x00, /* 00000000 */ /* - * 94 0x5e '^' - */ - 0x10, /* 00010000 */ - 0x38, /* 00111000 */ - 0x6c, /* 01101100 */ - 0xc6, /* 11000110 */ + * 140 0x8c 'ÂŒ' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ /* - * 95 0x5f '_' - */ + * 141 0x8d 'Â' + */ + 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ @@ -1182,1927 +1743,1374 @@ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0xff, /* 11111111 */ /* - * 96 0x60 '`' - */ - 0x30, /* 00110000 */ - 0x18, /* 00011000 */ - 0x0c, /* 00001100 */ + * 142 0x8e 'ÂŽ' + */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - - /* - * 97 0x61 'a' - */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0x78, /* 01111000 */ - 0x0c, /* 00001100 */ - 0x7c, /* 01111100 */ - 0xcc, /* 11001100 */ - 0x76, /* 01110110 */ 0x00, /* 00000000 */ /* - * 98 0x62 'b' - */ - 0xe0, /* 11100000 */ - 0x60, /* 01100000 */ - 0x7c, /* 01111100 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0xdc, /* 11011100 */ + * 143 0x8f 'Â' + */ 0x00, /* 00000000 */ - - /* - * 99 0x63 'c' - */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xc0, /* 11000000 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ 0x00, /* 00000000 */ - - /* - * 100 0x64 'd' - */ - 0x1c, /* 00011100 */ - 0x0c, /* 00001100 */ - 0x7c, /* 01111100 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0x76, /* 01110110 */ 0x00, /* 00000000 */ - - /* - * 101 0x65 'e' - */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xfe, /* 11111110 */ - 0xc0, /* 11000000 */ - 0x7c, /* 01111100 */ 0x00, /* 00000000 */ /* - * 102 0x66 'f' - */ - 0x3c, /* 00111100 */ - 0x66, /* 01100110 */ - 0x60, /* 01100000 */ - 0xf8, /* 11111000 */ - 0x60, /* 01100000 */ - 0x60, /* 01100000 */ - 0xf0, /* 11110000 */ + * 144 0x90 'Â' + */ 0x00, /* 00000000 */ - - /* - * 103 0x67 'g' - */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0x76, /* 01110110 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0x7c, /* 01111100 */ - 0x0c, /* 00001100 */ - 0xf8, /* 11111000 */ - - /* - * 104 0x68 'h' - */ - 0xe0, /* 11100000 */ - 0x60, /* 01100000 */ - 0x6c, /* 01101100 */ - 0x76, /* 01110110 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0xe6, /* 11100110 */ 0x00, /* 00000000 */ - - /* - * 105 0x69 'i' - */ - 0x18, /* 00011000 */ 0x00, /* 00000000 */ - 0x38, /* 00111000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ 0x00, /* 00000000 */ - - /* - * 106 0x6a 'j' - */ - 0x06, /* 00000110 */ 0x00, /* 00000000 */ - 0x06, /* 00000110 */ - 0x06, /* 00000110 */ - 0x06, /* 00000110 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x3c, /* 00111100 */ - - /* - * 107 0x6b 'k' - */ - 0xe0, /* 11100000 */ - 0x60, /* 01100000 */ - 0x66, /* 01100110 */ - 0x6c, /* 01101100 */ - 0x78, /* 01111000 */ - 0x6c, /* 01101100 */ - 0xe6, /* 11100110 */ 0x00, /* 00000000 */ /* - * 108 0x6c 'l' - */ - 0x38, /* 00111000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ + * 145 0x91 '‘' + */ + 0x00, /* 00000000 */ 0x00, /* 00000000 */ - - /* - * 109 0x6d 'm' - */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0xec, /* 11101100 */ - 0xfe, /* 11111110 */ - 0xd6, /* 11010110 */ - 0xd6, /* 11010110 */ - 0xd6, /* 11010110 */ 0x00, /* 00000000 */ - - /* - * 110 0x6e 'n' - */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0xdc, /* 11011100 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ 0x00, /* 00000000 */ /* - * 111 0x6f 'o' - */ + * 146 0x92 'Â’' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ 0x00, /* 00000000 */ - - /* - * 112 0x70 'p' - */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0xdc, /* 11011100 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x7c, /* 01111100 */ - 0x60, /* 01100000 */ - 0xf0, /* 11110000 */ /* - * 113 0x71 'q' - */ + * 147 0x93 '“' + */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0x76, /* 01110110 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0x7c, /* 01111100 */ - 0x0c, /* 00001100 */ - 0x1e, /* 00011110 */ - - /* - * 114 0x72 'r' - */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0xdc, /* 11011100 */ - 0x76, /* 01110110 */ - 0x60, /* 01100000 */ - 0x60, /* 01100000 */ - 0xf0, /* 11110000 */ 0x00, /* 00000000 */ - - /* - * 115 0x73 's' - */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0x7e, /* 01111110 */ - 0xc0, /* 11000000 */ - 0x7c, /* 01111100 */ - 0x06, /* 00000110 */ - 0xfc, /* 11111100 */ 0x00, /* 00000000 */ /* - * 116 0x74 't' - */ - 0x30, /* 00110000 */ - 0x30, /* 00110000 */ - 0xfc, /* 11111100 */ - 0x30, /* 00110000 */ - 0x30, /* 00110000 */ - 0x36, /* 00110110 */ - 0x1c, /* 00011100 */ + * 148 0x94 '”' + */ + 0x00, /* 00000000 */ 0x00, /* 00000000 */ - - /* - * 117 0x75 'u' - */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0x76, /* 01110110 */ 0x00, /* 00000000 */ - - /* - * 118 0x76 'v' - */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x6c, /* 01101100 */ - 0x38, /* 00111000 */ 0x00, /* 00000000 */ /* - * 119 0x77 'w' - */ + * 149 0x95 '•' + */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0xc6, /* 11000110 */ - 0xd6, /* 11010110 */ - 0xd6, /* 11010110 */ - 0xfe, /* 11111110 */ - 0x6c, /* 01101100 */ 0x00, /* 00000000 */ - - /* - * 120 0x78 'x' - */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0xc6, /* 11000110 */ - 0x6c, /* 01101100 */ - 0x38, /* 00111000 */ - 0x6c, /* 01101100 */ - 0xc6, /* 11000110 */ 0x00, /* 00000000 */ - - /* - * 121 0x79 'y' - */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x7e, /* 01111110 */ - 0x06, /* 00000110 */ - 0xfc, /* 11111100 */ /* - * 122 0x7a 'z' - */ + * 150 0x96 '–' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0x7e, /* 01111110 */ - 0x4c, /* 01001100 */ - 0x18, /* 00011000 */ - 0x32, /* 00110010 */ - 0x7e, /* 01111110 */ 0x00, /* 00000000 */ - - /* - * 123 0x7b '{' - */ - 0x0e, /* 00001110 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x70, /* 01110000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x0e, /* 00001110 */ 0x00, /* 00000000 */ - - /* - * 124 0x7c '|' - */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ 0x00, /* 00000000 */ - - /* - * 125 0x7d '}' - */ - 0x70, /* 01110000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x0e, /* 00001110 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x70, /* 01110000 */ 0x00, /* 00000000 */ /* - * 126 0x7e '~' - */ - 0x76, /* 01110110 */ - 0xdc, /* 11011100 */ + * 151 0x97 '—' + */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - - /* - * 127 0x7f '' - */ 0x00, /* 00000000 */ - 0x10, /* 00010000 */ - 0x38, /* 00111000 */ - 0x6c, /* 01101100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xfe, /* 11111110 */ 0x00, /* 00000000 */ /* - * 128 0x80 '€' - */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ - 0x0c, /* 00001100 */ - 0x78, /* 01111000 */ - - /* - * 129 0x81 '' - */ - 0xcc, /* 11001100 */ + * 152 0x98 '˜' + */ 0x00, /* 00000000 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0x76, /* 01110110 */ 0x00, /* 00000000 */ - - /* - * 130 0x82 '‚' - */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xfe, /* 11111110 */ - 0xc0, /* 11000000 */ - 0x7c, /* 01111100 */ 0x00, /* 00000000 */ - - /* - * 131 0x83 'ƒ' - */ - 0x7c, /* 01111100 */ - 0x82, /* 10000010 */ - 0x78, /* 01111000 */ - 0x0c, /* 00001100 */ - 0x7c, /* 01111100 */ - 0xcc, /* 11001100 */ - 0x76, /* 01110110 */ 0x00, /* 00000000 */ - - /* - * 132 0x84 '„' - */ - 0xc6, /* 11000110 */ 0x00, /* 00000000 */ - 0x78, /* 01111000 */ - 0x0c, /* 00001100 */ - 0x7c, /* 01111100 */ - 0xcc, /* 11001100 */ - 0x76, /* 01110110 */ 0x00, /* 00000000 */ - - /* - * 133 0x85 '…' - */ - 0x30, /* 00110000 */ - 0x18, /* 00011000 */ - 0x78, /* 01111000 */ - 0x0c, /* 00001100 */ - 0x7c, /* 01111100 */ - 0xcc, /* 11001100 */ - 0x76, /* 01110110 */ 0x00, /* 00000000 */ - - /* - * 134 0x86 '†' - */ - 0x30, /* 00110000 */ - 0x30, /* 00110000 */ - 0x78, /* 01111000 */ - 0x0c, /* 00001100 */ - 0x7c, /* 01111100 */ - 0xcc, /* 11001100 */ - 0x76, /* 01110110 */ 0x00, /* 00000000 */ /* - * 135 0x87 '‡' - */ + * 153 0x99 '™' + */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0x7e, /* 01111110 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0x7e, /* 01111110 */ - 0x0c, /* 00001100 */ - 0x38, /* 00111000 */ - - /* - * 136 0x88 'ˆ' - */ - 0x7c, /* 01111100 */ - 0x82, /* 10000010 */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xfe, /* 11111110 */ - 0xc0, /* 11000000 */ - 0x7c, /* 01111100 */ 0x00, /* 00000000 */ - - /* - * 137 0x89 '‰' - */ - 0xc6, /* 11000110 */ 0x00, /* 00000000 */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xfe, /* 11111110 */ - 0xc0, /* 11000000 */ - 0x7c, /* 01111100 */ 0x00, /* 00000000 */ - - /* - * 138 0x8a 'Š' - */ - 0x30, /* 00110000 */ - 0x18, /* 00011000 */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xfe, /* 11111110 */ - 0xc0, /* 11000000 */ - 0x7c, /* 01111100 */ 0x00, /* 00000000 */ - - /* - * 139 0x8b '‹' - */ - 0x66, /* 01100110 */ 0x00, /* 00000000 */ - 0x38, /* 00111000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ 0x00, /* 00000000 */ /* - * 140 0x8c 'Œ' - */ - 0x7c, /* 01111100 */ - 0x82, /* 10000010 */ - 0x38, /* 00111000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ + * 154 0x9a 'š' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ 0x00, /* 00000000 */ - - /* - * 141 0x8d '' - */ - 0x30, /* 00110000 */ - 0x18, /* 00011000 */ 0x00, /* 00000000 */ - 0x38, /* 00111000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ 0x00, /* 00000000 */ - - /* - * 142 0x8e 'Ž' - */ - 0xc6, /* 11000110 */ - 0x38, /* 00111000 */ - 0x6c, /* 01101100 */ - 0xc6, /* 11000110 */ - 0xfe, /* 11111110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ 0x00, /* 00000000 */ - - /* - * 143 0x8f '' - */ - 0x38, /* 00111000 */ - 0x6c, /* 01101100 */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xfe, /* 11111110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ 0x00, /* 00000000 */ - - /* - * 144 0x90 '' - */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0xfe, /* 11111110 */ - 0xc0, /* 11000000 */ - 0xf8, /* 11111000 */ - 0xc0, /* 11000000 */ - 0xfe, /* 11111110 */ 0x00, /* 00000000 */ /* - * 145 0x91 '‘' - */ + * 155 0x9b '›' + */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0x7e, /* 01111110 */ - 0x18, /* 00011000 */ - 0x7e, /* 01111110 */ - 0xd8, /* 11011000 */ - 0x7e, /* 01111110 */ 0x00, /* 00000000 */ - - /* - * 146 0x92 '’' - */ - 0x3e, /* 00111110 */ - 0x6c, /* 01101100 */ - 0xcc, /* 11001100 */ - 0xfe, /* 11111110 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0xce, /* 11001110 */ 0x00, /* 00000000 */ - - /* - * 147 0x93 '“' - */ - 0x7c, /* 01111100 */ - 0x82, /* 10000010 */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ 0x00, /* 00000000 */ - - /* - * 148 0x94 '”' - */ - 0xc6, /* 11000110 */ 0x00, /* 00000000 */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ 0x00, /* 00000000 */ - - /* - * 149 0x95 '•' - */ - 0x30, /* 00110000 */ - 0x18, /* 00011000 */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ 0x00, /* 00000000 */ /* - * 150 0x96 '–' - */ - 0x78, /* 01111000 */ - 0x84, /* 10000100 */ + * 156 0x9c 'Âœ' + */ 0x00, /* 00000000 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0x76, /* 01110110 */ 0x00, /* 00000000 */ - - /* - * 151 0x97 '—' - */ - 0x60, /* 01100000 */ - 0x30, /* 00110000 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0x76, /* 01110110 */ 0x00, /* 00000000 */ - - /* - * 152 0x98 '˜' - */ - 0xc6, /* 11000110 */ 0x00, /* 00000000 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x7e, /* 01111110 */ - 0x06, /* 00000110 */ - 0xfc, /* 11111100 */ - - /* - * 153 0x99 '™' - */ - 0xc6, /* 11000110 */ - 0x38, /* 00111000 */ - 0x6c, /* 01101100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x6c, /* 01101100 */ - 0x38, /* 00111000 */ 0x00, /* 00000000 */ - - /* - * 154 0x9a 'š' - */ - 0xc6, /* 11000110 */ 0x00, /* 00000000 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ 0x00, /* 00000000 */ - - /* - * 155 0x9b '›' - */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x7e, /* 01111110 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0x7e, /* 01111110 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - - /* - * 156 0x9c 'œ' - */ - 0x38, /* 00111000 */ - 0x6c, /* 01101100 */ - 0x64, /* 01100100 */ - 0xf0, /* 11110000 */ - 0x60, /* 01100000 */ - 0x66, /* 01100110 */ - 0xfc, /* 11111100 */ 0x00, /* 00000000 */ /* - * 157 0x9d '' - */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x3c, /* 00111100 */ - 0x7e, /* 01111110 */ - 0x18, /* 00011000 */ - 0x7e, /* 01111110 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - - /* - * 158 0x9e 'ž' - */ - 0xf8, /* 11111000 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0xfa, /* 11111010 */ - 0xc6, /* 11000110 */ - 0xcf, /* 11001111 */ - 0xc6, /* 11000110 */ - 0xc7, /* 11000111 */ - - /* - * 159 0x9f 'Ÿ' - */ - 0x0e, /* 00001110 */ - 0x1b, /* 00011011 */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ - 0x18, /* 00011000 */ - 0xd8, /* 11011000 */ - 0x70, /* 01110000 */ + * 157 0x9d 'Â' + */ 0x00, /* 00000000 */ - - /* - * 160 0xa0 ' ' - */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0x78, /* 01111000 */ - 0x0c, /* 00001100 */ - 0x7c, /* 01111100 */ - 0xcc, /* 11001100 */ - 0x76, /* 01110110 */ 0x00, /* 00000000 */ - - /* - * 161 0xa1 '¡' - */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ 0x00, /* 00000000 */ - 0x38, /* 00111000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ 0x00, /* 00000000 */ - - /* - * 162 0xa2 '¢' - */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x7c, /* 01111100 */ 0x00, /* 00000000 */ - - /* - * 163 0xa3 '£' - */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0x76, /* 01110110 */ 0x00, /* 00000000 */ - - /* - * 164 0xa4 '¤' - */ - 0x76, /* 01110110 */ - 0xdc, /* 11011100 */ 0x00, /* 00000000 */ - 0xdc, /* 11011100 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ 0x00, /* 00000000 */ /* - * 165 0xa5 '¥' - */ - 0x76, /* 01110110 */ - 0xdc, /* 11011100 */ + * 158 0x9e 'ž' + */ 0x00, /* 00000000 */ - 0xe6, /* 11100110 */ - 0xf6, /* 11110110 */ - 0xde, /* 11011110 */ - 0xce, /* 11001110 */ 0x00, /* 00000000 */ - - /* - * 166 0xa6 '¦' - */ - 0x3c, /* 00111100 */ - 0x6c, /* 01101100 */ - 0x6c, /* 01101100 */ - 0x3e, /* 00111110 */ 0x00, /* 00000000 */ - 0x7e, /* 01111110 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - - /* - * 167 0xa7 '§' - */ - 0x38, /* 00111000 */ - 0x6c, /* 01101100 */ - 0x6c, /* 01101100 */ - 0x38, /* 00111000 */ 0x00, /* 00000000 */ - 0x7c, /* 01111100 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ /* - * 168 0xa8 '¨' - */ - 0x18, /* 00011000 */ + * 159 0x9f 'Ÿ' + */ + 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0x63, /* 01100011 */ - 0x3e, /* 00111110 */ 0x00, /* 00000000 */ - - /* - * 169 0xa9 '©' - */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0xfe, /* 11111110 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ /* - * 170 0xaa 'ª' - */ + * 160 0xa0 ' ' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0xfe, /* 11111110 */ - 0x06, /* 00000110 */ - 0x06, /* 00000110 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ /* - * 171 0xab '«' - */ - 0x63, /* 01100011 */ - 0xe6, /* 11100110 */ - 0x6c, /* 01101100 */ - 0x7e, /* 01111110 */ - 0x33, /* 00110011 */ - 0x66, /* 01100110 */ - 0xcc, /* 11001100 */ - 0x0f, /* 00001111 */ - - /* - * 172 0xac '¬' - */ - 0x63, /* 01100011 */ - 0xe6, /* 11100110 */ - 0x6c, /* 01101100 */ - 0x7a, /* 01111010 */ - 0x36, /* 00110110 */ - 0x6a, /* 01101010 */ - 0xdf, /* 11011111 */ - 0x06, /* 00000110 */ - - /* - * 173 0xad '­' - */ + * 161 0xa1 '¡' + */ + 0x18, /* 00011000 */ 0x18, /* 00011000 */ 0x00, /* 00000000 */ 0x18, /* 00011000 */ 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ - 0x3c, /* 00111100 */ + 0x18, /* 00011000 */ 0x18, /* 00011000 */ 0x00, /* 00000000 */ /* - * 174 0xae '®' - */ - 0x00, /* 00000000 */ - 0x33, /* 00110011 */ - 0x66, /* 01100110 */ - 0xcc, /* 11001100 */ - 0x66, /* 01100110 */ - 0x33, /* 00110011 */ - 0x00, /* 00000000 */ + * 162 0xa2 '¢' + */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x7e, /* 01111110 */ + 0x03, /* 11000000 */ + 0x03, /* 11000000 */ + 0x7e, /* 01111110 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + + /* + * 163 0xa3 '£' + */ + 0x1c, /* 00111000 */ + 0x36, /* 01101100 */ + 0x26, /* 01100100 */ + 0x0f, /* 11110000 */ + 0x06, /* 01100000 */ + 0x67, /* 11100110 */ + 0x3f, /* 11111100 */ 0x00, /* 00000000 */ /* - * 175 0xaf '¯' - */ + * 164 0xa4 '¤' + */ 0x00, /* 00000000 */ - 0xcc, /* 11001100 */ - 0x66, /* 01100110 */ - 0x33, /* 00110011 */ - 0x66, /* 01100110 */ - 0xcc, /* 11001100 */ 0x00, /* 00000000 */ + 0x63, /* 11000110 */ + 0x3e, /* 01111100 */ + 0x36, /* 01101100 */ + 0x3e, /* 01111100 */ + 0x63, /* 11000110 */ 0x00, /* 00000000 */ /* - * 176 0xb0 '°' - */ - 0x22, /* 00100010 */ - 0x88, /* 10001000 */ - 0x22, /* 00100010 */ - 0x88, /* 10001000 */ - 0x22, /* 00100010 */ - 0x88, /* 10001000 */ - 0x22, /* 00100010 */ - 0x88, /* 10001000 */ - - /* - * 177 0xb1 '±' - */ - 0x55, /* 01010101 */ - 0xaa, /* 10101010 */ - 0x55, /* 01010101 */ - 0xaa, /* 10101010 */ - 0x55, /* 01010101 */ - 0xaa, /* 10101010 */ - 0x55, /* 01010101 */ - 0xaa, /* 10101010 */ - - /* - * 178 0xb2 '²' - */ - 0x77, /* 01110111 */ - 0xdd, /* 11011101 */ - 0x77, /* 01110111 */ - 0xdd, /* 11011101 */ - 0x77, /* 01110111 */ - 0xdd, /* 11011101 */ - 0x77, /* 01110111 */ - 0xdd, /* 11011101 */ + * 165 0xa5 'Â¥' + */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ + 0x3f, /* 11111100 */ + 0x0c, /* 00110000 */ + 0x3f, /* 11111100 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ /* - * 179 0xb3 '³' - */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ + * 166 0xa6 '¦' + */ 0x18, /* 00011000 */ 0x18, /* 00011000 */ 0x18, /* 00011000 */ + 0x00, /* 00000000 */ 0x18, /* 00011000 */ 0x18, /* 00011000 */ 0x18, /* 00011000 */ + 0x00, /* 00000000 */ /* - * 180 0xb4 '´' - */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0xf8, /* 11111000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ + * 167 0xa7 '§' + */ + 0x7c, /* 00111110 */ + 0xc6, /* 01100011 */ + 0x1c, /* 00111000 */ + 0x36, /* 01101100 */ + 0x36, /* 01101100 */ + 0x1c, /* 00111000 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ /* - * 181 0xb5 'µ' - */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0xf8, /* 11111000 */ - 0x18, /* 00011000 */ - 0xf8, /* 11111000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ + * 168 0xa8 '¨' + */ + 0x33, /* 11001100 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ /* - * 182 0xb6 '¶' - */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0xf6, /* 11110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ + * 169 0xa9 '©' + */ + 0x3c, /* 00111100 */ + 0x42, /* 01000010 */ + 0x99, /* 10011001 */ + 0x85, /* 10100001 */ + 0x85, /* 10100001 */ + 0x99, /* 10011001 */ + 0x42, /* 01000010 */ + 0x3c, /* 00111100 */ /* - * 183 0xb7 '·' - */ + * 170 0xaa 'ª' + */ + 0x3c, /* 00111100 */ + 0x36, /* 01101100 */ + 0x36, /* 01101100 */ + 0x7c, /* 00111110 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0xfe, /* 11111110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ /* - * 184 0xb8 '¸' - */ + * 171 0xab '«' + */ + 0x00, /* 00000000 */ + 0xcc, /* 00110011 */ + 0x66, /* 01100110 */ + 0x33, /* 11001100 */ + 0x66, /* 01100110 */ + 0xcc, /* 00110011 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0xf8, /* 11111000 */ - 0x18, /* 00011000 */ - 0xf8, /* 11111000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - - /* - * 185 0xb9 '¹' - */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0xf6, /* 11110110 */ - 0x06, /* 00000110 */ - 0xf6, /* 11110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - - /* - * 186 0xba 'º' - */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ /* - * 187 0xbb '»' - */ + * 172 0xac '¬' + */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0xfe, /* 11111110 */ - 0x06, /* 00000110 */ - 0xf6, /* 11110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - - /* - * 188 0xbc '¼' - */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0xf6, /* 11110110 */ - 0x06, /* 00000110 */ - 0xfe, /* 11111110 */ 0x00, /* 00000000 */ + 0x3f, /* 11111100 */ + 0x30, /* 00001100 */ + 0x30, /* 00001100 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ /* - * 189 0xbd '½' - */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0xfe, /* 11111110 */ + * 173 0xad '­' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ /* - * 190 0xbe '¾' - */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0xf8, /* 11111000 */ - 0x18, /* 00011000 */ - 0xf8, /* 11111000 */ + * 174 0xae '®' + */ + 0x3c, /* 00111100 */ + 0x42, /* 01000010 */ + 0x9d, /* 10111001 */ + 0xa5, /* 10100101 */ + 0x9d, /* 10111001 */ + 0xa5, /* 10100101 */ + 0x42, /* 01000010 */ + 0x3c, /* 00111100 */ + + /* + * 175 0xaf '¯' + */ + 0x7e, /* 01111110 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ /* - * 191 0xbf '¿' - */ + * 176 0xb0 '°' + */ + 0x1c, /* 00111000 */ + 0x36, /* 01101100 */ + 0x36, /* 01101100 */ + 0x1c, /* 00111000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0xf8, /* 11111000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ /* - * 192 0xc0 'À' - */ + * 177 0xb1 '±' + */ 0x18, /* 00011000 */ 0x18, /* 00011000 */ + 0x7e, /* 01111110 */ 0x18, /* 00011000 */ 0x18, /* 00011000 */ - 0x1f, /* 00011111 */ - 0x00, /* 00000000 */ 0x00, /* 00000000 */ + 0x7e, /* 01111110 */ 0x00, /* 00000000 */ /* - * 193 0xc1 'Á' - */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ + * 178 0xb2 '²' + */ + 0x1c, /* 00111000 */ + 0x30, /* 00001100 */ 0x18, /* 00011000 */ - 0xff, /* 11111111 */ + 0x0c, /* 00110000 */ + 0x3c, /* 00111100 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ /* - * 194 0xc2 'Â' - */ - 0x00, /* 00000000 */ + * 179 0xb3 '³' + */ + 0x1c, /* 00111000 */ + 0x30, /* 00001100 */ + 0x18, /* 00011000 */ + 0x30, /* 00001100 */ + 0x1c, /* 00111000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0xff, /* 11111111 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ /* - * 195 0xc3 'Ã' - */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x1f, /* 00011111 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ + * 180 0xb4 '´' + */ 0x18, /* 00011000 */ - - /* - * 196 0xc4 'Ä' - */ - 0x00, /* 00000000 */ + 0x0c, /* 00110000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0xff, /* 11111111 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ /* - * 197 0xc5 'Å' - */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0xff, /* 11111111 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - - /* - * 198 0xc6 'Æ' - */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x1f, /* 00011111 */ - 0x18, /* 00011000 */ - 0x1f, /* 00011111 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ + * 181 0xb5 'µ' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x3e, /* 01111100 */ + 0x06, /* 01100000 */ + 0x03, /* 11000000 */ /* - * 199 0xc7 'Ç' - */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x37, /* 00110111 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ + * 182 0xb6 '¶' + */ + 0xfe, /* 01111111 */ + 0xdb, /* 11011011 */ + 0xdb, /* 11011011 */ + 0xde, /* 01111011 */ + 0xd8, /* 00011011 */ + 0xd8, /* 00011011 */ + 0xd8, /* 00011011 */ + 0x00, /* 00000000 */ /* - * 200 0xc8 'È' - */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x37, /* 00110111 */ - 0x30, /* 00110000 */ - 0x3f, /* 00111111 */ + * 183 0xb7 '·' + */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - - /* - * 201 0xc9 'É' - */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0x3f, /* 00111111 */ - 0x30, /* 00110000 */ - 0x37, /* 00110111 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ /* - * 202 0xca 'Ê' - */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0xf7, /* 11110111 */ + * 184 0xb8 '¸' + */ + 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0xff, /* 11111111 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ + 0x18, /* 00011000 */ + 0x30, /* 00001100 */ + 0x1e, /* 01111000 */ /* - * 203 0xcb 'Ë' - */ + * 185 0xb9 '¹' + */ + 0x08, /* 00010000 */ + 0x0c, /* 00110000 */ + 0x08, /* 00010000 */ + 0x1c, /* 00111000 */ + 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0xff, /* 11111111 */ 0x00, /* 00000000 */ - 0xf7, /* 11110111 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - - /* - * 204 0xcc 'Ì' - */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x37, /* 00110111 */ - 0x30, /* 00110000 */ - 0x37, /* 00110111 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ /* - * 205 0xcd 'Í' - */ + * 186 0xba 'º' + */ + 0x1c, /* 00111000 */ + 0x36, /* 01101100 */ + 0x36, /* 01101100 */ + 0x1c, /* 00111000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ - 0xff, /* 11111111 */ 0x00, /* 00000000 */ - 0xff, /* 11111111 */ 0x00, /* 00000000 */ + + /* + * 187 0xbb '»' + */ + 0x00, /* 00000000 */ + 0x33, /* 11001100 */ + 0x66, /* 01100110 */ + 0xcc, /* 00110011 */ + 0x66, /* 01100110 */ + 0x33, /* 11001100 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ /* - * 206 0xce 'Î' - */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0xf7, /* 11110111 */ - 0x00, /* 00000000 */ - 0xf7, /* 11110111 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ + * 188 0xbc '¼' + */ + 0xc3, /* 11000011 */ + 0x63, /* 11000110 */ + 0x33, /* 11001100 */ + 0xbd, /* 10111101 */ + 0xec, /* 00110111 */ + 0xf6, /* 01101111 */ + 0xf3, /* 11001111 */ + 0x03, /* 11000000 */ /* - * 207 0xcf 'Ï' - */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0xff, /* 11111111 */ - 0x00, /* 00000000 */ - 0xff, /* 11111111 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ + * 189 0xbd '½' + */ + 0xc3, /* 11000011 */ + 0x63, /* 11000110 */ + 0x33, /* 11001100 */ + 0x7b, /* 11011110 */ + 0xcc, /* 00110011 */ + 0x66, /* 01100110 */ + 0x33, /* 11001100 */ + 0xf0, /* 00001111 */ /* - * 208 0xd0 'Ð' - */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0xff, /* 11111111 */ - 0x00, /* 00000000 */ + * 190 0xbe '¾' + */ + 0x03, /* 11000000 */ + 0xc4, /* 00100011 */ + 0x63, /* 11000110 */ + 0xb4, /* 00101101 */ + 0xdb, /* 11011011 */ + 0xac, /* 00110101 */ + 0xe6, /* 01100111 */ + 0x80, /* 00000001 */ + + /* + * 191 0xbf '¿' + */ + 0x0c, /* 00110000 */ 0x00, /* 00000000 */ + 0x0c, /* 00110000 */ + 0x06, /* 01100000 */ + 0x03, /* 11000000 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ 0x00, /* 00000000 */ /* - * 209 0xd1 'Ñ' - */ - 0x00, /* 00000000 */ + * 192 0xc0 'À' + */ + 0x07, /* 11100000 */ 0x00, /* 00000000 */ - 0xff, /* 11111111 */ + 0x1c, /* 00111000 */ + 0x36, /* 01101100 */ + 0x63, /* 11000110 */ + 0x7f, /* 11111110 */ + 0x63, /* 11000110 */ 0x00, /* 00000000 */ - 0xff, /* 11111111 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ /* - * 210 0xd2 'Ò' - */ + * 193 0xc1 'Ã' + */ + 0x70, /* 00001110 */ 0x00, /* 00000000 */ + 0x1c, /* 00111000 */ + 0x36, /* 01101100 */ + 0x63, /* 11000110 */ + 0x7f, /* 11111110 */ + 0x63, /* 11000110 */ 0x00, /* 00000000 */ + + /* + * 194 0xc2 'Â' + */ + 0x1c, /* 00111000 */ + 0x36, /* 01101100 */ 0x00, /* 00000000 */ + 0x3e, /* 01111100 */ + 0x63, /* 11000110 */ + 0x7f, /* 11111110 */ + 0x63, /* 11000110 */ 0x00, /* 00000000 */ - 0xff, /* 11111111 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ /* - * 211 0xd3 'Ó' - */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x3f, /* 00111111 */ - 0x00, /* 00000000 */ + * 195 0xc3 'Ã' + */ + 0x6e, /* 01110110 */ + 0x3b, /* 11011100 */ 0x00, /* 00000000 */ + 0x3e, /* 01111100 */ + 0x63, /* 11000110 */ + 0x7f, /* 11111110 */ + 0x63, /* 11000110 */ 0x00, /* 00000000 */ /* - * 212 0xd4 'Ô' - */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x1f, /* 00011111 */ - 0x18, /* 00011000 */ - 0x1f, /* 00011111 */ + * 196 0xc4 'Ä' + */ + 0x63, /* 11000110 */ + 0x1c, /* 00111000 */ + 0x36, /* 01101100 */ + 0x63, /* 11000110 */ + 0x7f, /* 11111110 */ + 0x63, /* 11000110 */ + 0x63, /* 11000110 */ 0x00, /* 00000000 */ + + /* + * 197 0xc5 'Ã…' + */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ 0x00, /* 00000000 */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x3f, /* 11111100 */ + 0x33, /* 11001100 */ 0x00, /* 00000000 */ /* - * 213 0xd5 'Õ' - */ - 0x00, /* 00000000 */ + * 198 0xc6 'Æ' + */ + 0x7c, /* 00111110 */ + 0x36, /* 01101100 */ + 0x33, /* 11001100 */ + 0x7f, /* 11111110 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x73, /* 11001110 */ 0x00, /* 00000000 */ - 0x1f, /* 00011111 */ - 0x18, /* 00011000 */ - 0x1f, /* 00011111 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ + + /* + * 199 0xc7 'Ç' + */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x03, /* 11000000 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ 0x18, /* 00011000 */ + 0x30, /* 00001100 */ + 0x1e, /* 01111000 */ /* - * 214 0xd6 'Ö' - */ + * 200 0xc8 'È' + */ + 0x07, /* 11100000 */ 0x00, /* 00000000 */ + 0x3f, /* 11111100 */ + 0x06, /* 01100000 */ + 0x1e, /* 01111000 */ + 0x06, /* 01100000 */ + 0x3f, /* 11111100 */ 0x00, /* 00000000 */ + + /* + * 201 0xc9 'É' + */ + 0x38, /* 00011100 */ 0x00, /* 00000000 */ + 0x3f, /* 11111100 */ + 0x06, /* 01100000 */ + 0x1e, /* 01111000 */ + 0x06, /* 01100000 */ + 0x3f, /* 11111100 */ 0x00, /* 00000000 */ - 0x3f, /* 00111111 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ /* - * 215 0xd7 '×' - */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0xff, /* 11111111 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ + * 202 0xca 'Ê' + */ + 0x0c, /* 00110000 */ + 0x12, /* 01001000 */ + 0x3f, /* 11111100 */ + 0x06, /* 01100000 */ + 0x1e, /* 01111000 */ + 0x06, /* 01100000 */ + 0x3f, /* 11111100 */ + 0x00, /* 00000000 */ /* - * 216 0xd8 'Ø' - */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0xff, /* 11111111 */ - 0x18, /* 00011000 */ - 0xff, /* 11111111 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ + * 203 0xcb 'Ë' + */ + 0x36, /* 01101100 */ + 0x00, /* 00000000 */ + 0x3f, /* 11111100 */ + 0x06, /* 01100000 */ + 0x1e, /* 01111000 */ + 0x06, /* 01100000 */ + 0x3f, /* 11111100 */ + 0x00, /* 00000000 */ /* - * 217 0xd9 'Ù' - */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0xf8, /* 11111000 */ - 0x00, /* 00000000 */ + * 204 0xcc 'ÃŒ' + */ + 0x07, /* 11100000 */ 0x00, /* 00000000 */ + 0x1e, /* 01111000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x1e, /* 01111000 */ 0x00, /* 00000000 */ /* - * 218 0xda 'Ú' - */ + * 205 0xcd 'Ã' + */ + 0x38, /* 00011100 */ 0x00, /* 00000000 */ + 0x1e, /* 01111000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x1e, /* 01111000 */ 0x00, /* 00000000 */ + + /* + * 206 0xce 'ÃŽ' + */ + 0x0c, /* 00110000 */ + 0x12, /* 01001000 */ 0x00, /* 00000000 */ + 0x1e, /* 01111000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x1e, /* 01111000 */ 0x00, /* 00000000 */ - 0x1f, /* 00011111 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ /* - * 219 0xdb 'Û' - */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ + * 207 0xcf 'Ã' + */ + 0x33, /* 11001100 */ + 0x00, /* 00000000 */ + 0x1e, /* 01111000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x1e, /* 01111000 */ + 0x00, /* 00000000 */ /* - * 220 0xdc 'Ü' - */ - 0x00, /* 00000000 */ + * 208 0xd0 'Ã' + */ + 0x3f, /* 11111100 */ + 0x66, /* 01100110 */ + 0x6f, /* 11110110 */ + 0x6f, /* 11110110 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x3f, /* 11111100 */ 0x00, /* 00000000 */ + + /* + * 209 0xd1 'Ñ' + */ + 0x3f, /* 11111100 */ 0x00, /* 00000000 */ + 0x33, /* 11001100 */ + 0x37, /* 11101100 */ + 0x3f, /* 11111100 */ + 0x3b, /* 11011100 */ + 0x33, /* 11001100 */ 0x00, /* 00000000 */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ /* - * 221 0xdd 'Ý' - */ - 0xf0, /* 11110000 */ - 0xf0, /* 11110000 */ - 0xf0, /* 11110000 */ - 0xf0, /* 11110000 */ - 0xf0, /* 11110000 */ - 0xf0, /* 11110000 */ - 0xf0, /* 11110000 */ - 0xf0, /* 11110000 */ - - /* - * 222 0xde 'Þ' - */ - 0x0f, /* 00001111 */ - 0x0f, /* 00001111 */ - 0x0f, /* 00001111 */ - 0x0f, /* 00001111 */ - 0x0f, /* 00001111 */ - 0x0f, /* 00001111 */ - 0x0f, /* 00001111 */ - 0x0f, /* 00001111 */ + * 210 0xd2 'Ã’' + */ + 0x0e, /* 01110000 */ + 0x00, /* 00000000 */ + 0x18, /* 00011000 */ + 0x3c, /* 00111100 */ + 0x66, /* 01100110 */ + 0x3c, /* 00111100 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ /* - * 223 0xdf 'ß' - */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - 0x00, /* 00000000 */ + * 211 0xd3 'Ó' + */ + 0x70, /* 00001110 */ 0x00, /* 00000000 */ + 0x18, /* 00011000 */ + 0x3c, /* 00111100 */ + 0x66, /* 01100110 */ + 0x3c, /* 00111100 */ + 0x18, /* 00011000 */ 0x00, /* 00000000 */ + + /* + * 212 0xd4 'Ô' + */ + 0x3c, /* 00111100 */ + 0x66, /* 01100110 */ + 0x18, /* 00011000 */ + 0x3c, /* 00111100 */ + 0x66, /* 01100110 */ + 0x3c, /* 00111100 */ + 0x18, /* 00011000 */ 0x00, /* 00000000 */ /* - * 224 0xe0 'à' - */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x76, /* 01110110 */ - 0xdc, /* 11011100 */ - 0xc8, /* 11001000 */ - 0xdc, /* 11011100 */ - 0x76, /* 01110110 */ + * 213 0xd5 'Õ' + */ + 0x6e, /* 01110110 */ + 0x3b, /* 11011100 */ 0x00, /* 00000000 */ - - /* - * 225 0xe1 'á' - */ - 0x78, /* 01111000 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0xd8, /* 11011000 */ - 0xcc, /* 11001100 */ - 0xc6, /* 11000110 */ - 0xcc, /* 11001100 */ + 0x3e, /* 01111100 */ + 0x63, /* 11000110 */ + 0x63, /* 11000110 */ + 0x3e, /* 01111100 */ 0x00, /* 00000000 */ /* - * 226 0xe2 'â' - */ - 0xfe, /* 11111110 */ - 0xc6, /* 11000110 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ + * 214 0xd6 'Ö' + */ + 0xc3, /* 11000011 */ + 0x18, /* 00011000 */ + 0x3c, /* 00111100 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x3c, /* 00111100 */ + 0x18, /* 00011000 */ 0x00, /* 00000000 */ /* - * 227 0xe3 'ã' - */ + * 215 0xd7 '×' + */ 0x00, /* 00000000 */ + 0x36, /* 01101100 */ + 0x1c, /* 00111000 */ + 0x08, /* 00010000 */ + 0x1c, /* 00111000 */ + 0x36, /* 01101100 */ 0x00, /* 00000000 */ - 0xfe, /* 11111110 */ - 0x6c, /* 01101100 */ - 0x6c, /* 01101100 */ - 0x6c, /* 01101100 */ - 0x6c, /* 01101100 */ 0x00, /* 00000000 */ /* - * 228 0xe4 'ä' - */ - 0xfe, /* 11111110 */ - 0xc6, /* 11000110 */ - 0x60, /* 01100000 */ - 0x30, /* 00110000 */ - 0x60, /* 01100000 */ - 0xc6, /* 11000110 */ - 0xfe, /* 11111110 */ + * 216 0xd8 'Ø' + */ + 0x5c, /* 00111010 */ + 0x36, /* 01101100 */ + 0x73, /* 11001110 */ + 0x7b, /* 11011110 */ + 0x6f, /* 11110110 */ + 0x36, /* 01101100 */ + 0x1d, /* 10111000 */ 0x00, /* 00000000 */ /* - * 229 0xe5 'å' - */ - 0x00, /* 00000000 */ + * 217 0xd9 'Ù' + */ + 0x0e, /* 01110000 */ 0x00, /* 00000000 */ - 0x7e, /* 01111110 */ - 0xd8, /* 11011000 */ - 0xd8, /* 11011000 */ - 0xd8, /* 11011000 */ - 0x70, /* 01110000 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x3c, /* 00111100 */ 0x00, /* 00000000 */ /* - * 230 0xe6 'æ' - */ - 0x00, /* 00000000 */ + * 218 0xda 'Ú' + */ + 0x70, /* 00001110 */ 0x00, /* 00000000 */ 0x66, /* 01100110 */ 0x66, /* 01100110 */ 0x66, /* 01100110 */ 0x66, /* 01100110 */ - 0x7c, /* 01111100 */ - 0xc0, /* 11000000 */ - - /* - * 231 0xe7 'ç' - */ - 0x00, /* 00000000 */ - 0x76, /* 01110110 */ - 0xdc, /* 11011100 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ + 0x3c, /* 00111100 */ 0x00, /* 00000000 */ /* - * 232 0xe8 'è' - */ - 0x7e, /* 01111110 */ - 0x18, /* 00011000 */ + * 219 0xdb 'Û' + */ 0x3c, /* 00111100 */ 0x66, /* 01100110 */ + 0x00, /* 00000000 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ 0x66, /* 01100110 */ 0x3c, /* 00111100 */ - 0x18, /* 00011000 */ - 0x7e, /* 01111110 */ - - /* - * 233 0xe9 'é' - */ - 0x38, /* 00111000 */ - 0x6c, /* 01101100 */ - 0xc6, /* 11000110 */ - 0xfe, /* 11111110 */ - 0xc6, /* 11000110 */ - 0x6c, /* 01101100 */ - 0x38, /* 00111000 */ 0x00, /* 00000000 */ /* - * 234 0xea 'ê' - */ - 0x38, /* 00111000 */ - 0x6c, /* 01101100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x6c, /* 01101100 */ - 0x6c, /* 01101100 */ - 0xee, /* 11101110 */ + * 220 0xdc 'Ãœ' + */ + 0x33, /* 11001100 */ + 0x00, /* 00000000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ 0x00, /* 00000000 */ /* - * 235 0xeb 'ë' - */ - 0x0e, /* 00001110 */ - 0x18, /* 00011000 */ - 0x0c, /* 00001100 */ - 0x3e, /* 00111110 */ + * 221 0xdd 'Ã' + */ + 0x70, /* 00001110 */ + 0x00, /* 00000000 */ 0x66, /* 01100110 */ 0x66, /* 01100110 */ 0x3c, /* 00111100 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ 0x00, /* 00000000 */ /* - * 236 0xec 'ì' - */ + * 222 0xde 'Þ' + */ + 0x0f, /* 11110000 */ + 0x06, /* 01100000 */ + 0x3e, /* 01111100 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x3e, /* 01111100 */ + 0x06, /* 01100000 */ + 0x0f, /* 11110000 */ + + /* + * 223 0xdf 'ß' + */ 0x00, /* 00000000 */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x1f, /* 11111000 */ + 0x33, /* 11001100 */ + 0x1f, /* 11111000 */ + 0x03, /* 11000000 */ + 0x03, /* 11000000 */ + + /* + * 224 0xe0 'à' + */ + 0x07, /* 11100000 */ 0x00, /* 00000000 */ + 0x1e, /* 01111000 */ + 0x30, /* 00001100 */ + 0x3e, /* 01111100 */ + 0x33, /* 11001100 */ 0x7e, /* 01111110 */ - 0xdb, /* 11011011 */ - 0xdb, /* 11011011 */ + 0x00, /* 00000000 */ + + /* + * 225 0xe1 'á' + */ + 0x38, /* 00011100 */ + 0x00, /* 00000000 */ + 0x1e, /* 01111000 */ + 0x30, /* 00001100 */ + 0x3e, /* 01111100 */ + 0x33, /* 11001100 */ 0x7e, /* 01111110 */ 0x00, /* 00000000 */ + + /* + * 226 0xe2 'â' + */ + 0x7e, /* 01111110 */ + 0xc3, /* 11000011 */ + 0x3c, /* 00111100 */ + 0x60, /* 00000110 */ + 0x7c, /* 00111110 */ + 0x66, /* 01100110 */ + 0xfc, /* 00111111 */ 0x00, /* 00000000 */ /* - * 237 0xed 'í' - */ - 0x06, /* 00000110 */ - 0x0c, /* 00001100 */ + * 227 0xe3 'ã' + */ + 0x6e, /* 01110110 */ + 0x3b, /* 11011100 */ + 0x1e, /* 01111000 */ + 0x30, /* 00001100 */ + 0x3e, /* 01111100 */ + 0x33, /* 11001100 */ 0x7e, /* 01111110 */ - 0xdb, /* 11011011 */ - 0xdb, /* 11011011 */ + 0x00, /* 00000000 */ + + /* + * 228 0xe4 'ä' + */ + 0x33, /* 11001100 */ + 0x00, /* 00000000 */ + 0x1e, /* 01111000 */ + 0x30, /* 00001100 */ + 0x3e, /* 01111100 */ + 0x33, /* 11001100 */ 0x7e, /* 01111110 */ - 0x60, /* 01100000 */ - 0xc0, /* 11000000 */ + 0x00, /* 00000000 */ /* - * 238 0xee 'î' - */ - 0x1e, /* 00011110 */ - 0x30, /* 00110000 */ - 0x60, /* 01100000 */ + * 229 0xe5 'Ã¥' + */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x1e, /* 01111000 */ + 0x30, /* 00001100 */ + 0x3e, /* 01111100 */ + 0x33, /* 11001100 */ 0x7e, /* 01111110 */ - 0x60, /* 01100000 */ - 0x30, /* 00110000 */ - 0x1e, /* 00011110 */ 0x00, /* 00000000 */ /* - * 239 0xef 'ï' - */ + * 230 0xe6 'æ' + */ 0x00, /* 00000000 */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ + 0x00, /* 00000000 */ + 0xfe, /* 01111111 */ + 0x30, /* 00001100 */ + 0xfe, /* 01111111 */ + 0x33, /* 11001100 */ + 0xfe, /* 01111111 */ 0x00, /* 00000000 */ /* - * 240 0xf0 'ð' - */ + * 231 0xe7 'ç' + */ 0x00, /* 00000000 */ - 0xfe, /* 11111110 */ 0x00, /* 00000000 */ - 0xfe, /* 11111110 */ + 0x1e, /* 01111000 */ + 0x03, /* 11000000 */ + 0x03, /* 11000000 */ + 0x1e, /* 01111000 */ + 0x30, /* 00001100 */ + 0x1c, /* 00111000 */ + + /* + * 232 0xe8 'è' + */ + 0x07, /* 11100000 */ + 0x00, /* 00000000 */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x3f, /* 11111100 */ + 0x03, /* 11000000 */ + 0x1e, /* 01111000 */ 0x00, /* 00000000 */ - 0xfe, /* 11111110 */ + + /* + * 233 0xe9 'é' + */ + 0x38, /* 00011100 */ 0x00, /* 00000000 */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x3f, /* 11111100 */ + 0x03, /* 11000000 */ + 0x1e, /* 01111000 */ 0x00, /* 00000000 */ /* - * 241 0xf1 'ñ' - */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ + * 234 0xea 'ê' + */ 0x7e, /* 01111110 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ + 0xc3, /* 11000011 */ + 0x3c, /* 00111100 */ + 0x66, /* 01100110 */ 0x7e, /* 01111110 */ + 0x06, /* 01100000 */ + 0x3c, /* 00111100 */ 0x00, /* 00000000 */ /* - * 242 0xf2 'ò' - */ - 0x30, /* 00110000 */ - 0x18, /* 00011000 */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ + * 235 0xeb 'ë' + */ + 0x33, /* 11001100 */ 0x00, /* 00000000 */ - 0x7e, /* 01111110 */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x3f, /* 11111100 */ + 0x03, /* 11000000 */ + 0x1e, /* 01111000 */ 0x00, /* 00000000 */ /* - * 243 0xf3 'ó' - */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0x18, /* 00011000 */ - 0x0c, /* 00001100 */ + * 236 0xec 'ì' + */ + 0x07, /* 11100000 */ 0x00, /* 00000000 */ - 0x7e, /* 01111110 */ + 0x0e, /* 01110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x1e, /* 01111000 */ 0x00, /* 00000000 */ /* - * 244 0xf4 'ô' - */ - 0x0e, /* 00001110 */ - 0x1b, /* 00011011 */ - 0x1b, /* 00011011 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ + * 237 0xed 'í' + */ + 0x1c, /* 00111000 */ + 0x00, /* 00000000 */ + 0x0e, /* 01110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x1e, /* 01111000 */ + 0x00, /* 00000000 */ /* - * 245 0xf5 'õ' - */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ + * 238 0xee 'î' + */ + 0x3e, /* 01111100 */ + 0x63, /* 11000110 */ + 0x1c, /* 00111000 */ 0x18, /* 00011000 */ 0x18, /* 00011000 */ 0x18, /* 00011000 */ - 0xd8, /* 11011000 */ - 0xd8, /* 11011000 */ - 0x70, /* 01110000 */ + 0x3c, /* 00111100 */ + 0x00, /* 00000000 */ /* - * 246 0xf6 'ö' - */ - 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - 0x7e, /* 01111110 */ - 0x00, /* 00000000 */ - 0x18, /* 00011000 */ + * 239 0xef 'ï' + */ + 0x33, /* 11001100 */ 0x00, /* 00000000 */ + 0x0e, /* 01110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x1e, /* 01111000 */ 0x00, /* 00000000 */ /* - * 247 0xf7 '÷' - */ + * 240 0xf0 'ð' + */ + 0x1b, /* 11011000 */ + 0x0e, /* 01110000 */ + 0x1b, /* 11011000 */ + 0x30, /* 00001100 */ + 0x3e, /* 01111100 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ 0x00, /* 00000000 */ - 0x76, /* 01110110 */ - 0xdc, /* 11011100 */ + + /* + * 241 0xf1 'ñ' + */ 0x00, /* 00000000 */ - 0x76, /* 01110110 */ - 0xdc, /* 11011100 */ + 0x1f, /* 11111000 */ 0x00, /* 00000000 */ + 0x1f, /* 11111000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ 0x00, /* 00000000 */ /* - * 248 0xf8 'ø' - */ - 0x38, /* 00111000 */ - 0x6c, /* 01101100 */ - 0x6c, /* 01101100 */ - 0x38, /* 00111000 */ - 0x00, /* 00000000 */ + * 242 0xf2 'ò' + */ 0x00, /* 00000000 */ + 0x07, /* 11100000 */ 0x00, /* 00000000 */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ 0x00, /* 00000000 */ /* - * 249 0xf9 'ù' - */ + * 243 0xf3 'ó' + */ 0x00, /* 00000000 */ + 0x38, /* 00011100 */ 0x00, /* 00000000 */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ + + /* + * 244 0xf4 'ô' + */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x00, /* 00000000 */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ 0x00, /* 00000000 */ + + /* + * 245 0xf5 'õ' + */ + 0x6e, /* 01110110 */ + 0x3b, /* 11011100 */ 0x00, /* 00000000 */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ 0x00, /* 00000000 */ /* - * 250 0xfa 'ú' - */ + * 246 0xf6 'ö' + */ 0x00, /* 00000000 */ + 0x33, /* 11001100 */ 0x00, /* 00000000 */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ 0x00, /* 00000000 */ + + /* + * 247 0xf7 '÷' + */ + 0x18, /* 00011000 */ 0x18, /* 00011000 */ 0x00, /* 00000000 */ + 0x7e, /* 01111110 */ 0x00, /* 00000000 */ - 0x00, /* 00000000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ 0x00, /* 00000000 */ /* - * 251 0xfb 'û' - */ - 0x0f, /* 00001111 */ - 0x0c, /* 00001100 */ - 0x0c, /* 00001100 */ - 0x0c, /* 00001100 */ - 0xec, /* 11101100 */ - 0x6c, /* 01101100 */ + * 248 0xf8 'ø' + */ + 0x00, /* 00000000 */ + 0x60, /* 00000110 */ + 0x3c, /* 00111100 */ + 0x76, /* 01101110 */ + 0x7e, /* 01111110 */ + 0x6e, /* 01110110 */ 0x3c, /* 00111100 */ - 0x1c, /* 00011100 */ + 0x06, /* 01100000 */ /* - * 252 0xfc 'ü' - */ - 0x6c, /* 01101100 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ + * 249 0xf9 'ù' + */ 0x00, /* 00000000 */ + 0x07, /* 11100000 */ 0x00, /* 00000000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x7e, /* 01111110 */ 0x00, /* 00000000 */ /* - * 253 0xfd 'ý' - */ - 0x78, /* 01111000 */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0x7c, /* 01111100 */ + * 250 0xfa 'ú' + */ 0x00, /* 00000000 */ + 0x38, /* 00011100 */ 0x00, /* 00000000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x7e, /* 01111110 */ 0x00, /* 00000000 */ /* - * 254 0xfe 'þ' - */ + * 251 0xfb 'û' + */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ 0x00, /* 00000000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x7e, /* 01111110 */ 0x00, /* 00000000 */ - 0x3c, /* 00111100 */ - 0x3c, /* 00111100 */ - 0x3c, /* 00111100 */ - 0x3c, /* 00111100 */ + + /* + * 252 0xfc 'ü' + */ 0x00, /* 00000000 */ + 0x33, /* 11001100 */ + 0x00, /* 00000000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x7e, /* 01111110 */ 0x00, /* 00000000 */ /* - * 255 0xff ' ' - */ - 0x00, /* 00000000 */ + * 253 0xfd 'ý' + */ 0x00, /* 00000000 */ + 0x38, /* 00011100 */ 0x00, /* 00000000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x3e, /* 01111100 */ + 0x30, /* 00001100 */ + 0x1f, /* 11111000 */ + + /* + * 254 0xfe 'þ' + */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ + 0x06, /* 01100000 */ + 0x3e, /* 01111100 */ + 0x66, /* 01100110 */ + 0x3e, /* 01111100 */ + 0x06, /* 01100000 */ 0x00, /* 00000000 */ + + /* + * 255 0xff 'ÿ' + */ 0x00, /* 00000000 */ + 0x33, /* 11001100 */ 0x00, /* 00000000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x3e, /* 01111100 */ + 0x30, /* 00001100 */ + 0x1f, /* 11111000 */ }; @@ -3120,7 +3128,7 @@ */ static struct SDLTest_CharTextureCache *SDLTest_CharTextureCacheList; -int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c) +int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, Uint32 c) { const Uint32 charWidth = FONT_CHARACTER_SIZE; const Uint32 charHeight = FONT_CHARACTER_SIZE; @@ -3130,8 +3138,7 @@ int result; Uint32 ix, iy; const unsigned char *charpos; - Uint8 *curpos; - Uint8 patt, mask; + Uint32 *curpos; Uint8 *linepos; Uint32 pitch; SDL_Surface *character; @@ -3156,7 +3163,7 @@ drect.h = charHeight; /* Character index in cache */ - ci = (unsigned char)c; + ci = c; /* Search for this renderer's cache */ for (cache = SDLTest_CharTextureCacheList; cache != NULL; cache = cache->next) { @@ -3194,23 +3201,18 @@ /* * Drawing loop */ - patt = 0; for (iy = 0; iy < charWidth; iy++) { - mask = 0x00; - curpos = linepos; + curpos = (Uint32 *)linepos; for (ix = 0; ix < charWidth; ix++) { - if (!(mask >>= 1)) { - patt = *charpos++; - mask = 0x80; - } - if (patt & mask) { - *(Uint32 *)curpos = 0xffffffff; + if ((*charpos) & (1 << ix)) { + *curpos = 0xffffffff; } else { - *(Uint32 *)curpos = 0; + *curpos = 0; } - curpos += 4; + ++curpos; } linepos += pitch; + ++charpos; } @@ -3242,30 +3244,241 @@ return (result); } +/* Gets a unicode value from a UTF-8 encoded string + * Outputs increment to advance the string */ +#define UNKNOWN_UNICODE 0xFFFD +static Uint32 UTF8_getch(const char *src, size_t srclen, int *inc) +{ + const Uint8 *p = (const Uint8 *)src; + size_t left = 0; + size_t save_srclen = srclen; + SDL_bool overlong = SDL_FALSE; + SDL_bool underflow = SDL_FALSE; + Uint32 ch = UNKNOWN_UNICODE; + + if (srclen == 0) { + return UNKNOWN_UNICODE; + } + if (p[0] >= 0xFC) { + if ((p[0] & 0xFE) == 0xFC) { + if (p[0] == 0xFC && (p[1] & 0xFC) == 0x80) { + overlong = SDL_TRUE; + } + ch = (Uint32) (p[0] & 0x01); + left = 5; + } + } else if (p[0] >= 0xF8) { + if ((p[0] & 0xFC) == 0xF8) { + if (p[0] == 0xF8 && (p[1] & 0xF8) == 0x80) { + overlong = SDL_TRUE; + } + ch = (Uint32) (p[0] & 0x03); + left = 4; + } + } else if (p[0] >= 0xF0) { + if ((p[0] & 0xF8) == 0xF0) { + if (p[0] == 0xF0 && (p[1] & 0xF0) == 0x80) { + overlong = SDL_TRUE; + } + ch = (Uint32) (p[0] & 0x07); + left = 3; + } + } else if (p[0] >= 0xE0) { + if ((p[0] & 0xF0) == 0xE0) { + if (p[0] == 0xE0 && (p[1] & 0xE0) == 0x80) { + overlong = SDL_TRUE; + } + ch = (Uint32) (p[0] & 0x0F); + left = 2; + } + } else if (p[0] >= 0xC0) { + if ((p[0] & 0xE0) == 0xC0) { + if ((p[0] & 0xDE) == 0xC0) { + overlong = SDL_TRUE; + } + ch = (Uint32) (p[0] & 0x1F); + left = 1; + } + } else { + if ((p[0] & 0x80) == 0x00) { + ch = (Uint32) p[0]; + } + } + --srclen; + while (left > 0 && srclen > 0) { + ++p; + if ((p[0] & 0xC0) != 0x80) { + ch = UNKNOWN_UNICODE; + break; + } + ch <<= 6; + ch |= (p[0] & 0x3F); + --srclen; + --left; + } + if (left > 0) { + underflow = SDL_TRUE; + } + + if (overlong || underflow || + (ch >= 0xD800 && ch <= 0xDFFF) || + (ch == 0xFFFE || ch == 0xFFFF) || ch > 0x10FFFF) { + ch = UNKNOWN_UNICODE; + } + + *inc = (int)(save_srclen - srclen); + + return ch; +} + +#define UTF8_IsTrailingByte(c) ((c) >= 0x80 && (c) <= 0xBF) + int SDLTest_DrawString(SDL_Renderer * renderer, int x, int y, const char *s) { const Uint32 charWidth = FONT_CHARACTER_SIZE; int result = 0; int curx = x; int cury = y; - const char *curchar = s; + size_t len = SDL_strlen(s); - while (*curchar && !result) { - result |= SDLTest_DrawCharacter(renderer, curx, cury, *curchar); + while (len > 0 && !result) { + int advance = 0; + Uint32 ch = UTF8_getch(s, len, &advance); + if (ch < 256) { + result |= SDLTest_DrawCharacter(renderer, curx, cury, ch); + } curx += charWidth; - curchar++; + s += advance; + len -= advance; } return (result); } +SDLTest_TextWindow *SDLTest_TextWindowCreate(int x, int y, int w, int h) +{ + SDLTest_TextWindow *textwin = (SDLTest_TextWindow *)SDL_malloc(sizeof(*textwin)); + + if ( !textwin ) { + return NULL; + } + + textwin->rect.x = x; + textwin->rect.y = y; + textwin->rect.w = w; + textwin->rect.h = h; + textwin->current = 0; + textwin->numlines = (h / FONT_LINE_HEIGHT); + textwin->lines = (char **)SDL_calloc(textwin->numlines, sizeof(*textwin->lines)); + if ( !textwin->lines ) { + SDL_free(textwin); + return NULL; + } + return textwin; +} + +void SDLTest_TextWindowDisplay(SDLTest_TextWindow *textwin, SDL_Renderer *renderer) +{ + int i, y; + + for ( y = textwin->rect.y, i = 0; i < textwin->numlines; ++i, y += FONT_LINE_HEIGHT ) { + if ( textwin->lines[i] ) { + SDLTest_DrawString(renderer, textwin->rect.x, y, textwin->lines[i]); + } + } +} + +void SDLTest_TextWindowAddText(SDLTest_TextWindow *textwin, const char *fmt, ...) +{ + char text[1024]; + va_list ap; + + va_start(ap, fmt); + SDL_vsnprintf(text, sizeof(text), fmt, ap); + va_end(ap); + + SDLTest_TextWindowAddTextWithLength(textwin, text, SDL_strlen(text)); +} + +void SDLTest_TextWindowAddTextWithLength(SDLTest_TextWindow *textwin, const char *text, size_t len) +{ + size_t existing; + SDL_bool newline = SDL_FALSE; + char *line; + + if ( len > 0 && text[len - 1] == '\n' ) { + --len; + newline = SDL_TRUE; + } + + if ( textwin->lines[textwin->current] ) { + existing = SDL_strlen(textwin->lines[textwin->current]); + } else { + existing = 0; + } + + if ( *text == '\b' ) { + if ( existing ) { + while (existing > 1 && UTF8_IsTrailingByte((Uint8)textwin->lines[textwin->current][existing - 1])) { + --existing; + } + --existing; + textwin->lines[textwin->current][existing] = '\0'; + } else if (textwin->current > 0) { + SDL_free(textwin->lines[textwin->current]); + textwin->lines[textwin->current] = NULL; + --textwin->current; + } + return; + } + + line = (char *)SDL_realloc(textwin->lines[textwin->current], existing + len + 1); + if ( line ) { + SDL_memcpy(&line[existing], text, len); + line[existing + len] = '\0'; + textwin->lines[textwin->current] = line; + if ( newline ) { + if (textwin->current == textwin->numlines - 1) { + SDL_free(textwin->lines[0]); + SDL_memcpy(&textwin->lines[0], &textwin->lines[1], (textwin->numlines-1) * sizeof(textwin->lines[1])); + textwin->lines[textwin->current] = NULL; + } else { + ++textwin->current; + } + } + } +} + +void SDLTest_TextWindowClear(SDLTest_TextWindow *textwin) +{ + int i; + + for ( i = 0; i < textwin->numlines; ++i ) + { + if ( textwin->lines[i] ) { + SDL_free(textwin->lines[i]); + textwin->lines[i] = NULL; + } + } + textwin->current = 0; +} + +void SDLTest_TextWindowDestroy(SDLTest_TextWindow *textwin) +{ + if ( textwin ) { + SDLTest_TextWindowClear(textwin); + SDL_free(textwin->lines); + SDL_free(textwin); + } +} + void SDLTest_CleanupTextDrawing(void) { unsigned int i; struct SDLTest_CharTextureCache* cache, *next; cache = SDLTest_CharTextureCacheList; - do { + while (cache) { for (i = 0; i < SDL_arraysize(cache->charTextureCache); ++i) { if (cache->charTextureCache[i]) { SDL_DestroyTexture(cache->charTextureCache[i]); @@ -3276,7 +3489,7 @@ next = cache->next; SDL_free(cache); cache = next; - } while (cache); + } SDLTest_CharTextureCacheList = NULL; } diff -Nru libsdl2-2.0.22+dfsg/src/test/SDL_test_harness.c libsdl2-2.24.0+dfsg/src/test/SDL_test_harness.c --- libsdl2-2.0.22+dfsg/src/test/SDL_test_harness.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/test/SDL_test_harness.c 2022-08-13 03:48:10.000000000 +0000 @@ -169,7 +169,7 @@ * \return Timer id or -1 on failure. */ static SDL_TimerID -SDLTest_SetTestTimeout(int timeout, void (*callback)(void)) +SDLTest_SetTestTimeout(int timeout, void (SDLCALL *callback)(void)) { Uint32 timeoutInMilliseconds; SDL_TimerID timerID; @@ -209,7 +209,7 @@ #if defined(__WATCOMC__) #pragma aux SDLTest_BailOut aborts; #endif -static SDL_NORETURN void +static SDL_NORETURN void SDLCALL SDLTest_BailOut(void) { SDLTest_LogError("TestCaseTimeout timer expired. Aborting test run."); @@ -349,7 +349,7 @@ /* Gets a timer value in seconds */ static float GetClock() { - float currentClock = clock() / (float) CLOCKS_PER_SEC; + float currentClock = SDL_GetPerformanceCounter() / (float) SDL_GetPerformanceFrequency(); return currentClock; } @@ -443,6 +443,11 @@ } } + if (totalNumberOfTests == 0) { + SDLTest_LogError("No tests to run?"); + return -1; + } + /* Pre-allocate an array for tracking failed tests (potentially all test cases) */ failedTests = (const SDLTest_TestCaseReference **)SDL_malloc(totalNumberOfTests * sizeof(SDLTest_TestCaseReference *)); if (failedTests == NULL) { @@ -468,8 +473,7 @@ /* Within each suite, loop over all test cases to check if we have a filter match */ testCounter = 0; - while (testSuite->testCases[testCounter] && testFilter == 0) - { + while (testSuite->testCases[testCounter] && testFilter == 0) { testCase = testSuite->testCases[testCounter]; testCounter++; if (testCase->name != NULL && SDL_strcmp(filter, testCase->name) == 0) { @@ -486,6 +490,18 @@ if (suiteFilter == 0 && testFilter == 0) { SDLTest_LogError("Filter '%s' did not match any test suite/case.", filter); + for (suiteCounter = 0; testSuites[suiteCounter]; ++suiteCounter) { + testSuite = testSuites[suiteCounter]; + if (testSuite->name != NULL) { + SDLTest_Log("Test suite: %s", testSuite->name); + } + + /* Within each suite, loop over all test cases to check if we have a filter match */ + for (testCounter = 0; testSuite->testCases[testCounter]; ++testCounter) { + testCase = testSuite->testCases[testCounter]; + SDLTest_Log(" test: %s", testCase->name); + } + } SDLTest_Log("Exit code: 2"); SDL_free((void *) failedTests); return 2; diff -Nru libsdl2-2.0.22+dfsg/src/test/SDL_test_random.c libsdl2-2.24.0+dfsg/src/test/SDL_test_random.c --- libsdl2-2.0.22+dfsg/src/test/SDL_test_random.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/test/SDL_test_random.c 2022-06-16 20:16:31.000000000 +0000 @@ -70,7 +70,7 @@ srand((unsigned int)time(NULL)); a=rand(); - srand((unsigned int)clock()); + srand((unsigned int)SDL_GetPerformanceCounter()); b=rand(); SDLTest_RandomInit(rndContext, a, b); } diff -Nru libsdl2-2.0.22+dfsg/src/thread/ngage/SDL_sysmutex.cpp libsdl2-2.24.0+dfsg/src/thread/ngage/SDL_sysmutex.cpp --- libsdl2-2.0.22+dfsg/src/thread/ngage/SDL_sysmutex.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/thread/ngage/SDL_sysmutex.cpp 2022-06-02 02:01:57.000000000 +0000 @@ -0,0 +1,123 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +/* An implementation of mutexes using the Symbian API. */ + +#include + +#include "SDL_thread.h" +#include "SDL_systhread_c.h" + +struct SDL_mutex +{ + TInt handle; +}; + +extern TInt CreateUnique(TInt (*aFunc)(const TDesC& aName, TAny*, TAny*), TAny*, TAny*); + +static TInt NewMutex(const TDesC& aName, TAny* aPtr1, TAny*) +{ + return ((RMutex*)aPtr1)->CreateGlobal(aName); +} + +/* Create a mutex */ +SDL_mutex * +SDL_CreateMutex(void) +{ + RMutex rmutex; + + TInt status = CreateUnique(NewMutex, &rmutex, NULL); + if(status != KErrNone) + { + SDL_SetError("Couldn't create mutex."); + } + SDL_mutex* mutex = new /*(ELeave)*/ SDL_mutex; + mutex->handle = rmutex.Handle(); + return(mutex); +} + +/* Free the mutex */ +void +SDL_DestroyMutex(SDL_mutex * mutex) +{ + if (mutex) + { + RMutex rmutex; + rmutex.SetHandle(mutex->handle); + rmutex.Signal(); + rmutex.Close(); + delete(mutex); + mutex = NULL; + } +} + +/* Try to lock the mutex */ +#if 0 +int +SDL_TryLockMutex(SDL_mutex * mutex) +{ + if (mutex == NULL) + { + SDL_SetError("Passed a NULL mutex."); + return -1; + } + + // Not yet implemented. + return 0; +} +#endif + +/* Lock the mutex */ +int +SDL_LockMutex(SDL_mutex * mutex) +{ + if (mutex == NULL) + { + SDL_SetError("Passed a NULL mutex."); + return -1; + } + + RMutex rmutex; + rmutex.SetHandle(mutex->handle); + rmutex.Wait(); + + return(0); +} + +/* Unlock the mutex */ +int +SDL_UnlockMutex(SDL_mutex * mutex) +{ + if ( mutex == NULL ) + { + SDL_SetError("Passed a NULL mutex."); + return -1; + } + + RMutex rmutex; + rmutex.SetHandle(mutex->handle); + rmutex.Signal(); + + return(0); +} + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/thread/ngage/SDL_syssem.cpp libsdl2-2.24.0+dfsg/src/thread/ngage/SDL_syssem.cpp --- libsdl2-2.0.22+dfsg/src/thread/ngage/SDL_syssem.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/thread/ngage/SDL_syssem.cpp 2022-06-02 02:01:57.000000000 +0000 @@ -0,0 +1,195 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +/* An implementation of semaphores using the Symbian API. */ + +#include + +#include "SDL_error.h" +#include "SDL_thread.h" + +#define SDL_MUTEX_TIMEOUT -2 + +struct SDL_semaphore +{ + TInt handle; + TInt count; +}; + +struct TInfo +{ + TInfo(TInt aTime, TInt aHandle) : + iTime(aTime), iHandle(aHandle), iVal(0) {} + TInt iTime; + TInt iHandle; + TInt iVal; +}; + +extern TInt CreateUnique(TInt (*aFunc)(const TDesC& aName, TAny*, TAny*), TAny*, TAny*); + +static TBool RunThread(TAny* aInfo) +{ + TInfo* info = STATIC_CAST(TInfo*, aInfo); + User::After(info->iTime); + RSemaphore sema; + sema.SetHandle(info->iHandle); + sema.Signal(); + info->iVal = SDL_MUTEX_TIMEOUT; + return 0; +} + +static TInt +NewThread(const TDesC& aName, TAny* aPtr1, TAny* aPtr2) +{ + return ((RThread*)(aPtr1))->Create + (aName, + RunThread, + KDefaultStackSize, + NULL, + aPtr2); +} + +static TInt NewSema(const TDesC& aName, TAny* aPtr1, TAny* aPtr2) +{ + TInt value = *((TInt*) aPtr2); + return ((RSemaphore*)aPtr1)->CreateGlobal(aName, value); +} + +static void WaitAll(SDL_sem *sem) +{ + RSemaphore sema; + sema.SetHandle(sem->handle); + sema.Wait(); + while(sem->count < 0) + { + sema.Wait(); + } +} + +SDL_sem * +SDL_CreateSemaphore(Uint32 initial_value) +{ + RSemaphore s; + TInt status = CreateUnique(NewSema, &s, &initial_value); + if(status != KErrNone) + { + SDL_SetError("Couldn't create semaphore"); + } + SDL_semaphore* sem = new /*(ELeave)*/ SDL_semaphore; + sem->handle = s.Handle(); + sem->count = initial_value; + return(sem); +} + +void +SDL_DestroySemaphore(SDL_sem * sem) +{ + if (sem) + { + RSemaphore sema; + sema.SetHandle(sem->handle); + sema.Signal(sema.Count()); + sema.Close(); + delete sem; + sem = NULL; + } +} + +int +SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout) +{ + if (! sem) + { + SDL_SetError("Passed a NULL sem"); + return -1; + } + + if (timeout == SDL_MUTEX_MAXWAIT) + { + WaitAll(sem); + return SDL_MUTEX_MAXWAIT; + } + + RThread thread; + TInfo* info = new (ELeave)TInfo(timeout, sem->handle); + TInt status = CreateUnique(NewThread, &thread, info); + + if(status != KErrNone) + { + return status; + } + + thread.Resume(); + WaitAll(sem); + + if(thread.ExitType() == EExitPending) + { + thread.Kill(SDL_MUTEX_TIMEOUT); + } + + thread.Close(); + return info->iVal; +} + +int +SDL_SemTryWait(SDL_sem *sem) +{ + if(sem->count > 0) + { + sem->count--; + } + return SDL_MUTEX_TIMEOUT; +} + +int +SDL_SemWait(SDL_sem * sem) +{ + return SDL_SemWaitTimeout(sem, SDL_MUTEX_MAXWAIT); +} + +Uint32 +SDL_SemValue(SDL_sem * sem) +{ + if (! sem) + { + SDL_SetError("Passed a NULL sem."); + return 0; + } + return sem->count; +} + +int +SDL_SemPost(SDL_sem * sem) +{ + if (! sem) + { + SDL_SetError("Passed a NULL sem."); + return -1; + } + sem->count++; + RSemaphore sema; + sema.SetHandle(sem->handle); + sema.Signal(); + return 0; +} + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/thread/ngage/SDL_systhread_c.h libsdl2-2.24.0+dfsg/src/thread/ngage/SDL_systhread_c.h --- libsdl2-2.0.22+dfsg/src/thread/ngage/SDL_systhread_c.h 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/thread/ngage/SDL_systhread_c.h 2022-06-02 02:01:57.000000000 +0000 @@ -0,0 +1,25 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +typedef int SYS_ThreadHandle; + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/thread/ngage/SDL_systhread.cpp libsdl2-2.24.0+dfsg/src/thread/ngage/SDL_systhread.cpp --- libsdl2-2.0.22+dfsg/src/thread/ngage/SDL_systhread.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/thread/ngage/SDL_systhread.cpp 2022-06-02 02:01:57.000000000 +0000 @@ -0,0 +1,134 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_THREAD_NGAGE + +/* N-Gage thread management routines for SDL */ + +#include + +extern "C" { +#undef NULL +#include "SDL_error.h" +#include "SDL_thread.h" +#include "../SDL_systhread.h" +#include "../SDL_thread_c.h" +}; + +static int object_count; + +static int +RunThread(TAny* data) +{ + SDL_RunThread((SDL_Thread*)data); + return(0); +} + +static TInt +NewThread(const TDesC& aName, TAny* aPtr1, TAny* aPtr2) +{ + return ((RThread*)(aPtr1))->Create + (aName, + RunThread, + KDefaultStackSize, + NULL, + aPtr2); +} + +int +CreateUnique(TInt (*aFunc)(const TDesC& aName, TAny*, TAny*), TAny* aPtr1, TAny* aPtr2) +{ + TBuf<16> name; + TInt status = KErrNone; + do + { + object_count++; + name.Format(_L("SDL_%x"), object_count); + status = aFunc(name, aPtr1, aPtr2); + } + while(status == KErrAlreadyExists); + return status; +} + +int +SDL_SYS_CreateThread(SDL_Thread *thread) +{ + RThread rthread; + + TInt status = CreateUnique(NewThread, &rthread, thread); + if (status != KErrNone) + { + delete(((RThread*)(thread->handle))); + thread->handle = NULL; + SDL_SetError("Not enough resources to create thread"); + return(-1); + } + + rthread.Resume(); + thread->handle = rthread.Handle(); + return(0); +} + +void +SDL_SYS_SetupThread(const char *name) +{ + return; +} + +SDL_threadID +SDL_ThreadID(void) +{ + RThread current; + TThreadId id = current.Id(); + return id; +} + +int +SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority) +{ + return (0); +} + +void +SDL_SYS_WaitThread(SDL_Thread * thread) +{ + RThread t; + t.Open(thread->threadid); + if(t.ExitReason() == EExitPending) + { + TRequestStatus status; + t.Logon(status); + User::WaitForRequest(status); + } + t.Close(); +} + +void +SDL_SYS_DetachThread(SDL_Thread * thread) +{ + return; +} + +#endif /* SDL_THREAD_NGAGE */ + +/* vim: ts=4 sw=4 + */ diff -Nru libsdl2-2.0.22+dfsg/src/thread/ps2/SDL_syssem.c libsdl2-2.24.0+dfsg/src/thread/ps2/SDL_syssem.c --- libsdl2-2.0.22+dfsg/src/thread/ps2/SDL_syssem.c 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/thread/ps2/SDL_syssem.c 2022-06-16 20:16:31.000000000 +0000 @@ -0,0 +1,159 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_THREAD_PS2 + +/* Semaphore functions for the PS2. */ + +#include +#include +#include + +#include "SDL_error.h" +#include "SDL_thread.h" + +#include + +struct SDL_semaphore { + s32 semid; +}; + +static void usercb(struct timer_alarm_t *alarm, void *arg) { + iReleaseWaitThread((int)arg); +} + +/* Create a semaphore */ +SDL_sem *SDL_CreateSemaphore(Uint32 initial_value) +{ + SDL_sem *sem; + ee_sema_t sema; + + sem = (SDL_sem *) SDL_malloc(sizeof(*sem)); + if (sem != NULL) { + /* TODO: Figure out the limit on the maximum value. */ + sema.init_count = initial_value; + sema.max_count = 255; + sema.option = 0; + sem->semid = CreateSema(&sema); + + if (sem->semid < 0) { + SDL_SetError("Couldn't create semaphore"); + SDL_free(sem); + sem = NULL; + } + } else { + SDL_OutOfMemory(); + } + + return sem; +} + +/* Free the semaphore */ +void SDL_DestroySemaphore(SDL_sem *sem) +{ + if (sem != NULL) { + if (sem->semid > 0) { + DeleteSema(sem->semid); + sem->semid = 0; + } + + SDL_free(sem); + } +} + +int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout) +{ + int ret; + struct timer_alarm_t alarm; + InitializeTimerAlarm(&alarm); + + if (sem == NULL) { + SDL_InvalidParamError("sem"); + return 0; + } + + if (timeout == 0) { + if (PollSema(sem->semid) < 0) { + return SDL_MUTEX_TIMEDOUT; + } + return 0; + } + + if (timeout != SDL_MUTEX_MAXWAIT) { + SetTimerAlarm(&alarm, MSec2TimerBusClock(timeout), &usercb, (void *)GetThreadId()); + } + + ret = WaitSema(sem->semid); + StopTimerAlarm(&alarm); + + if (ret < 0) + return SDL_MUTEX_TIMEDOUT; + return 0; //Wait condition satisfied. +} + +int SDL_SemTryWait(SDL_sem *sem) +{ + return SDL_SemWaitTimeout(sem, 0); +} + +int SDL_SemWait(SDL_sem *sem) +{ + return SDL_SemWaitTimeout(sem, SDL_MUTEX_MAXWAIT); +} + +/* Returns the current count of the semaphore */ +Uint32 SDL_SemValue(SDL_sem *sem) +{ + ee_sema_t info; + + if (sem == NULL) { + SDL_InvalidParamError("sem"); + return 0; + } + + if (ReferSemaStatus(sem->semid, &info) >= 0) { + return info.count; + } + + return 0; +} + +int SDL_SemPost(SDL_sem *sem) +{ + int res; + + if (sem == NULL) { + return SDL_InvalidParamError("sem"); + } + + res = SignalSema(sem->semid); + if (res < 0) { + return SDL_SetError("sceKernelSignalSema() failed"); + } + + return 0; +} + +#endif /* SDL_THREAD_PS2 */ + +/* vim: ts=4 sw=4 + */ diff -Nru libsdl2-2.0.22+dfsg/src/thread/ps2/SDL_systhread.c libsdl2-2.24.0+dfsg/src/thread/ps2/SDL_systhread.c --- libsdl2-2.0.22+dfsg/src/thread/ps2/SDL_systhread.c 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/thread/ps2/SDL_systhread.c 2022-06-16 20:16:31.000000000 +0000 @@ -0,0 +1,140 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_THREAD_PS2 + +/* PS2 thread management routines for SDL */ + +#include +#include + +#include "SDL_error.h" +#include "SDL_thread.h" +#include "../SDL_systhread.h" +#include "../SDL_thread_c.h" +#include + +static void FinishThread(SDL_Thread *thread) { + ee_thread_status_t info; + int res; + + res = ReferThreadStatus(thread->handle, &info); + TerminateThread(thread->handle); + DeleteThread(thread->handle); + DeleteSema((int)thread->endfunc); + + if (res > 0) { + SDL_free(info.stack); + } +} + +static int childThread(void *arg) +{ + SDL_Thread *thread = (SDL_Thread *)arg; + int res = thread->userfunc(thread->userdata); + SignalSema((int)thread->endfunc); + return res; +} + +int SDL_SYS_CreateThread(SDL_Thread *thread) +{ + ee_thread_status_t status; + ee_thread_t eethread; + ee_sema_t sema; + size_t stack_size; + int priority = 32; + + /* Set priority of new thread to the same as the current thread */ + // status.size = sizeof(ee_thread_t); + if (ReferThreadStatus(GetThreadId(), &status) == 0) { + priority = status.current_priority; + } + + stack_size = thread->stacksize ? ((int) thread->stacksize) : 0x1800; + + + /* Create EE Thread */ + eethread.attr = 0; + eethread.option = 0; + eethread.func = &childThread; + eethread.stack = SDL_malloc(stack_size); + eethread.stack_size = stack_size; + eethread.gp_reg = &_gp; + eethread.initial_priority = priority; + thread->handle = CreateThread(&eethread); + + if (thread->handle < 0) { + return SDL_SetError("CreateThread() failed"); + } + + // Prepare el semaphore for the ending function + sema.init_count = 0; + sema.max_count = 1; + sema.option = 0; + thread->endfunc = (void *)CreateSema(&sema); + + return StartThread(thread->handle, thread); +} + +void SDL_SYS_SetupThread(const char *name) +{ + /* Do nothing. */ +} + +SDL_threadID SDL_ThreadID(void) +{ + return (SDL_threadID) GetThreadId(); +} + +void SDL_SYS_WaitThread(SDL_Thread *thread) +{ + WaitSema((int)thread->endfunc); + ReleaseWaitThread(thread->handle); + FinishThread(thread); +} + +void SDL_SYS_DetachThread(SDL_Thread *thread) +{ + /* Do nothing. */ +} + +int SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority) +{ + int value; + + if (priority == SDL_THREAD_PRIORITY_LOW) { + value = 111; + } else if (priority == SDL_THREAD_PRIORITY_HIGH) { + value = 32; + } else if (priority == SDL_THREAD_PRIORITY_TIME_CRITICAL) { + value = 16; + } else { + value = 50; + } + + return ChangeThreadPriority(GetThreadId(),value); +} + +#endif /* SDL_THREAD_PS2 */ + +/* vim: ts=4 sw=4 + */ diff -Nru libsdl2-2.0.22+dfsg/src/thread/ps2/SDL_systhread_c.h libsdl2-2.24.0+dfsg/src/thread/ps2/SDL_systhread_c.h --- libsdl2-2.0.22+dfsg/src/thread/ps2/SDL_systhread_c.h 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/thread/ps2/SDL_systhread_c.h 2022-06-16 20:16:31.000000000 +0000 @@ -0,0 +1,24 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include + +typedef int32_t SYS_ThreadHandle; diff -Nru libsdl2-2.0.22+dfsg/src/thread/SDL_systhread.h libsdl2-2.24.0+dfsg/src/thread/SDL_systhread.h --- libsdl2-2.0.22+dfsg/src/thread/SDL_systhread.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/thread/SDL_systhread.h 2022-08-13 03:48:10.000000000 +0000 @@ -28,6 +28,11 @@ #include "SDL_thread.h" #include "SDL_thread_c.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + /* This function creates a thread, passing args to SDL_RunThread(), saves a system-dependent thread id in thread->id, and returns 0 on success. @@ -65,6 +70,11 @@ SDL_CreateThreadInternal(int (SDLCALL * fn) (void *), const char *name, const size_t stacksize, void *data); +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif + #endif /* SDL_systhread_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/thread/SDL_thread.c libsdl2-2.24.0+dfsg/src/thread/SDL_thread.c --- libsdl2-2.0.22+dfsg/src/thread/SDL_thread.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/thread/SDL_thread.c 2022-08-13 03:48:10.000000000 +0000 @@ -200,19 +200,38 @@ return 0; } +/* Non-thread-safe global error variable */ +static SDL_error * +SDL_GetStaticErrBuf() +{ + static SDL_error SDL_global_error; + static char SDL_global_error_str[128]; + SDL_global_error.str = SDL_global_error_str; + SDL_global_error.len = sizeof(SDL_global_error_str); + return &SDL_global_error; +} + +static void SDLCALL +SDL_FreeErrBuf(void *data) +{ + SDL_error *errbuf = (SDL_error *)data; + + if (errbuf->str) { + errbuf->free_func(errbuf->str); + } + errbuf->free_func(errbuf); +} + /* Routine to get the thread-specific error variable */ SDL_error * SDL_GetErrBuf(void) { #if SDL_THREADS_DISABLED - /* Non-thread-safe global error variable */ - static SDL_error SDL_global_error; - return &SDL_global_error; + return SDL_GetStaticErrBuf(); #else static SDL_SpinLock tls_lock; static SDL_bool tls_being_created; static SDL_TLSID tls_errbuf; - static SDL_error SDL_global_errbuf; const SDL_error *ALLOCATION_IN_PROGRESS = (SDL_error *)-1; SDL_error *errbuf; @@ -233,24 +252,33 @@ SDL_AtomicUnlock(&tls_lock); } if (!tls_errbuf) { - return &SDL_global_errbuf; + return SDL_GetStaticErrBuf(); } SDL_MemoryBarrierAcquire(); errbuf = (SDL_error *)SDL_TLSGet(tls_errbuf); if (errbuf == ALLOCATION_IN_PROGRESS) { - return &SDL_global_errbuf; + return SDL_GetStaticErrBuf(); } if (!errbuf) { + /* Get the original memory functions for this allocation because the lifetime + * of the error buffer may span calls to SDL_SetMemoryFunctions() by the app + */ + SDL_realloc_func realloc_func; + SDL_free_func free_func; + SDL_GetOriginalMemoryFunctions(NULL, NULL, &realloc_func, &free_func); + /* Mark that we're in the middle of allocating our buffer */ SDL_TLSSet(tls_errbuf, ALLOCATION_IN_PROGRESS, NULL); - errbuf = (SDL_error *)SDL_malloc(sizeof(*errbuf)); + errbuf = (SDL_error *)realloc_func(NULL, sizeof(*errbuf)); if (!errbuf) { SDL_TLSSet(tls_errbuf, NULL, NULL); - return &SDL_global_errbuf; + return SDL_GetStaticErrBuf(); } SDL_zerop(errbuf); - SDL_TLSSet(tls_errbuf, errbuf, SDL_free); + errbuf->realloc_func = realloc_func; + errbuf->free_func = free_func; + SDL_TLSSet(tls_errbuf, errbuf, SDL_FreeErrBuf); } return errbuf; #endif /* SDL_THREADS_DISABLED */ diff -Nru libsdl2-2.0.22+dfsg/src/thread/SDL_thread_c.h libsdl2-2.24.0+dfsg/src/thread/SDL_thread_c.h --- libsdl2-2.0.22+dfsg/src/thread/SDL_thread_c.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/thread/SDL_thread_c.h 2022-06-16 20:16:31.000000000 +0000 @@ -32,6 +32,8 @@ #include "pthread/SDL_systhread_c.h" #elif SDL_THREAD_WINDOWS #include "windows/SDL_systhread_c.h" +#elif SDL_THREAD_PS2 +#include "ps2/SDL_systhread_c.h" #elif SDL_THREAD_PSP #include "psp/SDL_systhread_c.h" #elif SDL_THREAD_VITA @@ -40,6 +42,8 @@ #include "stdcpp/SDL_systhread_c.h" #elif SDL_THREAD_OS2 #include "os2/SDL_systhread_c.h" +#elif SDL_THREAD_NGAGE +#include "ngage/SDL_systhread_c.h" #else #error Need thread implementation for this platform #include "generic/SDL_systhread_c.h" diff -Nru libsdl2-2.0.22+dfsg/src/thread/windows/SDL_syscond_cv.c libsdl2-2.24.0+dfsg/src/thread/windows/SDL_syscond_cv.c --- libsdl2-2.0.22+dfsg/src/thread/windows/SDL_syscond_cv.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/thread/windows/SDL_syscond_cv.c 2022-08-13 03:48:10.000000000 +0000 @@ -261,7 +261,7 @@ } #endif - SDL_memcpy(&SDL_cond_impl_active, impl, sizeof(SDL_cond_impl_active)); + SDL_copyp(&SDL_cond_impl_active, impl); } return SDL_cond_impl_active.Create(); } diff -Nru libsdl2-2.0.22+dfsg/src/thread/windows/SDL_sysmutex.c libsdl2-2.24.0+dfsg/src/thread/windows/SDL_sysmutex.c --- libsdl2-2.0.22+dfsg/src/thread/windows/SDL_sysmutex.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/thread/windows/SDL_sysmutex.c 2022-08-13 03:48:10.000000000 +0000 @@ -287,7 +287,7 @@ } /* Copy instead of using pointer to save one level of indirection */ - SDL_memcpy(&SDL_mutex_impl_active, impl, sizeof(SDL_mutex_impl_active)); + SDL_copyp(&SDL_mutex_impl_active, impl); } return SDL_mutex_impl_active.Create(); } diff -Nru libsdl2-2.0.22+dfsg/src/thread/windows/SDL_syssem.c libsdl2-2.24.0+dfsg/src/thread/windows/SDL_syssem.c --- libsdl2-2.0.22+dfsg/src/thread/windows/SDL_syssem.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/thread/windows/SDL_syssem.c 2022-08-13 03:48:10.000000000 +0000 @@ -430,7 +430,7 @@ #endif /* Copy instead of using pointer to save one level of indirection */ - SDL_memcpy(&SDL_sem_impl_active, impl, sizeof(SDL_sem_impl_active)); + SDL_copyp(&SDL_sem_impl_active, impl); } return SDL_sem_impl_active.Create(initial_value); } diff -Nru libsdl2-2.0.22+dfsg/src/timer/ngage/SDL_systimer.cpp libsdl2-2.24.0+dfsg/src/timer/ngage/SDL_systimer.cpp --- libsdl2-2.0.22+dfsg/src/timer/ngage/SDL_systimer.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/timer/ngage/SDL_systimer.cpp 2022-06-02 02:01:57.000000000 +0000 @@ -0,0 +1,100 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if defined(SDL_TIMER_NGAGE) + +#include +#include + +#include "SDL_timer.h" + +static SDL_bool ticks_started = SDL_FALSE; +static TUint start = 0; +static TInt tickPeriodMilliSeconds; + +#ifdef __cplusplus +extern "C" { +#endif + +void +SDL_TicksInit(void) +{ + if (ticks_started) + { + return; + } + ticks_started = SDL_TRUE; + start = User::TickCount(); + + TTimeIntervalMicroSeconds32 period; + TInt tmp = UserHal::TickPeriod(period); + + (void)tmp; /* Suppress redundant warning. */ + + tickPeriodMilliSeconds = period.Int() / 1000; +} + +void +SDL_TicksQuit(void) +{ + ticks_started = SDL_FALSE; +} + +Uint64 +SDL_GetTicks64(void) +{ + if (! ticks_started) + { + SDL_TicksInit(); + } + + TUint deltaTics = User::TickCount() - start; + + // Overlaps early, but should do the trick for now. + return (Uint64)(deltaTics * tickPeriodMilliSeconds); +} + +Uint64 +SDL_GetPerformanceCounter(void) +{ + return (Uint64)User::TickCount(); +} + +Uint64 +SDL_GetPerformanceFrequency(void) +{ + return 1000000; +} + +void +SDL_Delay(Uint32 ms) +{ + User::After(TTimeIntervalMicroSeconds32(ms * 1000)); +} + +#ifdef __cplusplus +} +#endif + +#endif /* SDL_TIMER_NGAGE */ + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/timer/ps2/SDL_systimer.c libsdl2-2.24.0+dfsg/src/timer/ps2/SDL_systimer.c --- libsdl2-2.0.22+dfsg/src/timer/ps2/SDL_systimer.c 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/timer/ps2/SDL_systimer.c 2022-06-16 20:16:31.000000000 +0000 @@ -0,0 +1,90 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifdef SDL_TIMER_PS2 + +#include "SDL_thread.h" +#include "SDL_timer.h" +#include "SDL_error.h" +#include "../SDL_timer_c.h" +#include +#include +#include +#include + +static uint64_t start; +static SDL_bool ticks_started = SDL_FALSE; + +void +SDL_TicksInit(void) +{ + if (ticks_started) { + return; + } + ticks_started = SDL_TRUE; + + start = GetTimerSystemTime(); +} + +void +SDL_TicksQuit(void) +{ + ticks_started = SDL_FALSE; +} + +Uint64 +SDL_GetTicks64(void) +{ + uint64_t now; + + if (!ticks_started) { + SDL_TicksInit(); + } + + now = GetTimerSystemTime(); + return (Uint64)((now - start) / (kBUSCLK / CLOCKS_PER_SEC)); +} + +Uint64 +SDL_GetPerformanceCounter(void) +{ + return SDL_GetTicks64(); +} + +Uint64 +SDL_GetPerformanceFrequency(void) +{ + return 1000; +} + +void SDL_Delay(Uint32 ms) +{ + struct timespec tv = {0}; + tv.tv_sec = ms / 1000; + tv.tv_nsec = (ms % 1000) * 1000000; + nanosleep(&tv, NULL); +} + +#endif /* SDL_TIMER_PS2 */ + +/* vim: ts=4 sw=4 + */ diff -Nru libsdl2-2.0.22+dfsg/src/timer/unix/SDL_systimer.c libsdl2-2.24.0+dfsg/src/timer/unix/SDL_systimer.c --- libsdl2-2.0.22+dfsg/src/timer/unix/SDL_systimer.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/timer/unix/SDL_systimer.c 2022-08-13 03:48:10.000000000 +0000 @@ -87,8 +87,7 @@ has_monotonic_time = SDL_TRUE; } else #elif defined(__APPLE__) - kern_return_t ret = mach_timebase_info(&mach_base_info); - if (ret == 0) { + if (mach_timebase_info(&mach_base_info) == 0) { has_monotonic_time = SDL_TRUE; start_mach = mach_absolute_time(); } else diff -Nru libsdl2-2.0.22+dfsg/src/timer/windows/SDL_systimer.c libsdl2-2.24.0+dfsg/src/timer/windows/SDL_systimer.c --- libsdl2-2.0.22+dfsg/src/timer/windows/SDL_systimer.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/timer/windows/SDL_systimer.c 2022-08-13 03:48:10.000000000 +0000 @@ -41,7 +41,7 @@ static void SDL_SetSystemTimerResolution(const UINT uPeriod) { -#ifndef __WINRT__ +#if !defined(__WINRT__) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) static UINT timer_period = 0; if (uPeriod != timer_period) { diff -Nru libsdl2-2.0.22+dfsg/src/video/android/SDL_androidkeyboard.c libsdl2-2.24.0+dfsg/src/video/android/SDL_androidkeyboard.c --- libsdl2-2.0.22+dfsg/src/video/android/SDL_androidkeyboard.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/android/SDL_androidkeyboard.c 2022-08-13 03:48:10.000000000 +0000 @@ -30,23 +30,14 @@ #include "../../core/android/SDL_android.h" -void Android_InitKeyboard(void) -{ - SDL_Keycode keymap[SDL_NUM_SCANCODES]; - - /* Add default scancode to key mapping */ - SDL_GetDefaultKeymap(keymap); - SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES); -} - static SDL_Scancode Android_Keycodes[] = { SDL_SCANCODE_UNKNOWN, /* AKEYCODE_UNKNOWN */ - SDL_SCANCODE_UNKNOWN, /* AKEYCODE_SOFT_LEFT */ - SDL_SCANCODE_UNKNOWN, /* AKEYCODE_SOFT_RIGHT */ + SDL_SCANCODE_SOFTLEFT, /* AKEYCODE_SOFT_LEFT */ + SDL_SCANCODE_SOFTRIGHT, /* AKEYCODE_SOFT_RIGHT */ SDL_SCANCODE_AC_HOME, /* AKEYCODE_HOME */ SDL_SCANCODE_AC_BACK, /* AKEYCODE_BACK */ - SDL_SCANCODE_UNKNOWN, /* AKEYCODE_CALL */ - SDL_SCANCODE_UNKNOWN, /* AKEYCODE_ENDCALL */ + SDL_SCANCODE_CALL, /* AKEYCODE_CALL */ + SDL_SCANCODE_ENDCALL, /* AKEYCODE_ENDCALL */ SDL_SCANCODE_0, /* AKEYCODE_0 */ SDL_SCANCODE_1, /* AKEYCODE_1 */ SDL_SCANCODE_2, /* AKEYCODE_2 */ @@ -374,7 +365,7 @@ } void -Android_SetTextInputRect(_THIS, SDL_Rect *rect) +Android_SetTextInputRect(_THIS, const SDL_Rect *rect) { SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata; diff -Nru libsdl2-2.0.22+dfsg/src/video/android/SDL_androidkeyboard.h libsdl2-2.24.0+dfsg/src/video/android/SDL_androidkeyboard.h --- libsdl2-2.0.22+dfsg/src/video/android/SDL_androidkeyboard.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/android/SDL_androidkeyboard.h 2022-08-13 03:48:10.000000000 +0000 @@ -22,7 +22,6 @@ #include "SDL_androidvideo.h" -extern void Android_InitKeyboard(void); extern int Android_OnKeyDown(int keycode); extern int Android_OnKeyUp(int keycode); @@ -31,6 +30,6 @@ extern void Android_StartTextInput(_THIS); extern void Android_StopTextInput(_THIS); -extern void Android_SetTextInputRect(_THIS, SDL_Rect *rect); +extern void Android_SetTextInputRect(_THIS, const SDL_Rect *rect); /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/video/android/SDL_androidvideo.c libsdl2-2.24.0+dfsg/src/video/android/SDL_androidvideo.c --- libsdl2-2.0.22+dfsg/src/video/android/SDL_androidvideo.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/android/SDL_androidvideo.c 2022-08-13 03:48:10.000000000 +0000 @@ -84,7 +84,7 @@ } static SDL_VideoDevice * -Android_CreateDevice(int devindex) +Android_CreateDevice(void) { SDL_VideoDevice *device; SDL_VideoData *data; @@ -201,8 +201,6 @@ SDL_AddDisplayMode(&_this->displays[0], &mode); - Android_InitKeyboard(); - Android_InitTouch(); Android_InitMouse(); diff -Nru libsdl2-2.0.22+dfsg/src/video/android/SDL_androidwindow.c libsdl2-2.24.0+dfsg/src/video/android/SDL_androidwindow.c --- libsdl2-2.0.22+dfsg/src/video/android/SDL_androidwindow.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/android/SDL_androidwindow.c 2022-06-02 02:01:57.000000000 +0000 @@ -116,6 +116,8 @@ SDL_LockMutex(Android_ActivityMutex); if (window == Android_Window) { + SDL_WindowData *data; + int old_w, old_h, new_w, new_h; /* If the window is being destroyed don't change visible state */ if (!window->is_destroying) { @@ -132,8 +134,7 @@ goto endfunction; } - SDL_WindowData *data = (SDL_WindowData *)window->driverdata; - + data = (SDL_WindowData *)window->driverdata; if (!data || !data->native_window) { if (data && !data->native_window) { SDL_SetError("Missing native window"); @@ -141,11 +142,11 @@ goto endfunction; } - int old_w = window->w; - int old_h = window->h; + old_w = window->w; + old_h = window->h; - int new_w = ANativeWindow_getWidth(data->native_window); - int new_h = ANativeWindow_getHeight(data->native_window); + new_w = ANativeWindow_getWidth(data->native_window); + new_h = ANativeWindow_getHeight(data->native_window); if (new_w < 0 || new_h < 0) { SDL_SetError("ANativeWindow_getWidth/Height() fails"); @@ -206,8 +207,7 @@ { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - if (info->version.major == SDL_MAJOR_VERSION && - info->version.minor == SDL_MINOR_VERSION) { + if (info->version.major == SDL_MAJOR_VERSION) { info->subsystem = SDL_SYSWM_ANDROID; info->info.android.window = data->native_window; @@ -217,8 +217,8 @@ return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d", - SDL_MAJOR_VERSION, SDL_MINOR_VERSION); + SDL_SetError("Application not compiled with SDL %d", + SDL_MAJOR_VERSION); return SDL_FALSE; } } diff -Nru libsdl2-2.0.22+dfsg/src/video/cocoa/SDL_cocoaclipboard.h libsdl2-2.24.0+dfsg/src/video/cocoa/SDL_cocoaclipboard.h --- libsdl2-2.0.22+dfsg/src/video/cocoa/SDL_cocoaclipboard.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/cocoa/SDL_cocoaclipboard.h 2022-06-02 02:01:57.000000000 +0000 @@ -24,12 +24,12 @@ #define SDL_cocoaclipboard_h_ /* Forward declaration */ -struct SDL_VideoData; +@class SDL_VideoData; extern int Cocoa_SetClipboardText(_THIS, const char *text); extern char *Cocoa_GetClipboardText(_THIS); extern SDL_bool Cocoa_HasClipboardText(_THIS); -extern void Cocoa_CheckClipboardUpdate(struct SDL_VideoData * data); +extern void Cocoa_CheckClipboardUpdate(SDL_VideoData * data); #endif /* SDL_cocoaclipboard_h_ */ diff -Nru libsdl2-2.0.22+dfsg/src/video/cocoa/SDL_cocoaclipboard.m libsdl2-2.24.0+dfsg/src/video/cocoa/SDL_cocoaclipboard.m --- libsdl2-2.0.22+dfsg/src/video/cocoa/SDL_cocoaclipboard.m 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/cocoa/SDL_cocoaclipboard.m 2022-06-02 02:01:57.000000000 +0000 @@ -29,7 +29,7 @@ Cocoa_SetClipboardText(_THIS, const char *text) { @autoreleasepool { - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + SDL_VideoData *data = (__bridge SDL_VideoData *) _this->driverdata; NSPasteboard *pasteboard; NSString *format = NSPasteboardTypeString; NSString *nsstr = [NSString stringWithUTF8String:text]; @@ -38,7 +38,7 @@ } pasteboard = [NSPasteboard generalPasteboard]; - data->clipboard_count = [pasteboard declareTypes:[NSArray arrayWithObject:format] owner:nil]; + data.clipboard_count = [pasteboard declareTypes:[NSArray arrayWithObject:format] owner:nil]; [pasteboard setString:nsstr forType:format]; return 0; @@ -86,7 +86,7 @@ } void -Cocoa_CheckClipboardUpdate(struct SDL_VideoData * data) +Cocoa_CheckClipboardUpdate(SDL_VideoData * data) { @autoreleasepool { NSPasteboard *pasteboard; @@ -94,11 +94,11 @@ pasteboard = [NSPasteboard generalPasteboard]; count = [pasteboard changeCount]; - if (count != data->clipboard_count) { - if (data->clipboard_count) { + if (count != data.clipboard_count) { + if (data.clipboard_count) { SDL_SendClipboardUpdate(); } - data->clipboard_count = count; + data.clipboard_count = count; } }} diff -Nru libsdl2-2.0.22+dfsg/src/video/cocoa/SDL_cocoaevents.m libsdl2-2.24.0+dfsg/src/video/cocoa/SDL_cocoaevents.m --- libsdl2-2.0.22+dfsg/src/video/cocoa/SDL_cocoaevents.m 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/cocoa/SDL_cocoaevents.m 2022-08-13 03:48:10.000000000 +0000 @@ -45,7 +45,7 @@ SDL_VideoDevice *device = SDL_GetVideoDevice(); if (device && device->windows) { for (sdlwindow = device->windows; sdlwindow; sdlwindow = sdlwindow->next) { - NSWindow *nswindow = ((SDL_WindowData *) sdlwindow->driverdata)->nswindow; + NSWindow *nswindow = ((__bridge SDL_WindowData *) sdlwindow->driverdata).nswindow; if (win == nswindow) return sdlwindow; } @@ -121,7 +121,6 @@ [NSNumber numberWithBool:YES], @"ApplePersistenceIgnoreState", nil]; [[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults]; - [appDefaults release]; } @end // SDLApplication @@ -182,8 +181,6 @@ removeEventHandlerForEventClass:kInternetEventClass andEventID:kAEGetURL]; } - - [super dealloc]; } - (void)windowWillClose:(NSNotification *)notification; @@ -232,6 +229,7 @@ - (void)focusSomeWindow:(NSNotification *)aNotification { + SDL_VideoDevice *device; /* HACK: Ignore the first call. The application gets a * applicationDidBecomeActive: a little bit after the first window is * created, and if we don't ignore it, a window that has been created with @@ -249,7 +247,7 @@ return; } - SDL_VideoDevice *device = SDL_GetVideoDevice(); + device = SDL_GetVideoDevice(); if (device && device->windows) { SDL_Window *window = device->windows; int i; @@ -374,9 +372,6 @@ /* Create the main menu bar */ [NSApp setMainMenu:mainMenu]; - [mainMenu release]; /* we're done with it, let NSApp own it. */ - mainMenu = nil; - /* Create the application menu */ appName = GetApplicationName(); appleMenu = [[NSMenu alloc] initWithTitle:@""]; @@ -396,7 +391,6 @@ [menuItem setSubmenu:serviceMenu]; [NSApp setServicesMenu:serviceMenu]; - [serviceMenu release]; [appleMenu addItem:[NSMenuItem separatorItem]]; @@ -417,12 +411,9 @@ menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""]; [menuItem setSubmenu:appleMenu]; [[NSApp mainMenu] addItem:menuItem]; - [menuItem release]; /* Tell the application object that this is now the application menu */ [NSApp setAppleMenu:appleMenu]; - [appleMenu release]; - /* Create the window menu */ windowMenu = [[NSMenu alloc] initWithTitle:@"Window"]; @@ -434,26 +425,21 @@ [windowMenu addItemWithTitle:@"Zoom" action:@selector(performZoom:) keyEquivalent:@""]; - /* Add the fullscreen toggle menu option, if supported */ - if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) { - /* Cocoa should update the title to Enter or Exit Full Screen automatically. - * But if not, then just fallback to Toggle Full Screen. - */ - menuItem = [[NSMenuItem alloc] initWithTitle:@"Toggle Full Screen" action:@selector(toggleFullScreen:) keyEquivalent:@"f"]; - [menuItem setKeyEquivalentModifierMask:NSEventModifierFlagControl | NSEventModifierFlagCommand]; - [windowMenu addItem:menuItem]; - [menuItem release]; - } + /* Add the fullscreen toggle menu option. */ + /* Cocoa should update the title to Enter or Exit Full Screen automatically. + * But if not, then just fallback to Toggle Full Screen. + */ + menuItem = [[NSMenuItem alloc] initWithTitle:@"Toggle Full Screen" action:@selector(toggleFullScreen:) keyEquivalent:@"f"]; + [menuItem setKeyEquivalentModifierMask:NSEventModifierFlagControl | NSEventModifierFlagCommand]; + [windowMenu addItem:menuItem]; /* Put menu into the menubar */ menuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""]; [menuItem setSubmenu:windowMenu]; [[NSApp mainMenu] addItem:menuItem]; - [menuItem release]; /* Tell the application object that this is now the window menu */ [NSApp setWindowsMenu:windowMenu]; - [windowMenu release]; } void @@ -518,19 +504,6 @@ int Cocoa_PumpEventsUntilDate(_THIS, NSDate *expiration, bool accumulate) { -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 - /* Update activity every 30 seconds to prevent screensaver */ - SDL_VideoData *data = (SDL_VideoData *)_this->driverdata; - if (_this->suspend_screensaver && !data->screensaver_use_iopm) { - Uint32 now = SDL_GetTicks(); - if (!data->screensaver_activity || - SDL_TICKS_PASSED(now, data->screensaver_activity + 30000)) { - UpdateSystemActivity(UsrActivity); - data->screensaver_activity = now; - } - } -#endif - for ( ; ; ) { NSEvent *event = [NSApp nextEventMatchingMask:NSEventMaskAny untilDate:expiration inMode:NSDefaultRunLoopMode dequeue:YES ]; if ( event == nil ) { @@ -576,13 +549,11 @@ void Cocoa_SendWakeupEvent(_THIS, SDL_Window *window) { @autoreleasepool { - NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow; - NSEvent* event = [NSEvent otherEventWithType: NSEventTypeApplicationDefined location: NSMakePoint(0,0) modifierFlags: 0 timestamp: 0.0 - windowNumber: nswindow.windowNumber + windowNumber: ((__bridge SDL_WindowData *) window->driverdata).window_number context: nil subtype: 0 data1: 0 @@ -595,15 +566,11 @@ Cocoa_SuspendScreenSaver(_THIS) { @autoreleasepool { - SDL_VideoData *data = (SDL_VideoData *)_this->driverdata; - - if (!data->screensaver_use_iopm) { - return; - } + SDL_VideoData *data = (__bridge SDL_VideoData *)_this->driverdata; - if (data->screensaver_assertion) { - IOPMAssertionRelease(data->screensaver_assertion); - data->screensaver_assertion = 0; + if (data.screensaver_assertion) { + IOPMAssertionRelease(data.screensaver_assertion); + data.screensaver_assertion = kIOPMNullAssertionID; } if (_this->suspend_screensaver) { @@ -612,11 +579,13 @@ * seen by OS X power users. there's an additional optional human-readable * (localized) reason parameter which we don't set. */ + IOPMAssertionID assertion = kIOPMNullAssertionID; NSString *name = [GetApplicationName() stringByAppendingString:@" using SDL_DisableScreenSaver"]; IOPMAssertionCreateWithDescription(kIOPMAssertPreventUserIdleDisplaySleep, - (CFStringRef) name, + (__bridge CFStringRef) name, NULL, NULL, NULL, 0, NULL, - &data->screensaver_assertion); + &assertion); + data.screensaver_assertion = assertion; } }} diff -Nru libsdl2-2.0.22+dfsg/src/video/cocoa/SDL_cocoakeyboard.h libsdl2-2.24.0+dfsg/src/video/cocoa/SDL_cocoakeyboard.h --- libsdl2-2.0.22+dfsg/src/video/cocoa/SDL_cocoakeyboard.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/cocoa/SDL_cocoakeyboard.h 2022-08-13 03:48:10.000000000 +0000 @@ -29,7 +29,7 @@ extern void Cocoa_StartTextInput(_THIS); extern void Cocoa_StopTextInput(_THIS); -extern void Cocoa_SetTextInputRect(_THIS, SDL_Rect *rect); +extern void Cocoa_SetTextInputRect(_THIS, const SDL_Rect *rect); extern void Cocoa_SetWindowKeyboardGrab(_THIS, SDL_Window * window, SDL_bool grabbed); diff -Nru libsdl2-2.0.22+dfsg/src/video/cocoa/SDL_cocoakeyboard.m libsdl2-2.24.0+dfsg/src/video/cocoa/SDL_cocoakeyboard.m --- libsdl2-2.0.22+dfsg/src/video/cocoa/SDL_cocoakeyboard.m 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/cocoa/SDL_cocoakeyboard.m 2022-08-13 03:48:10.000000000 +0000 @@ -40,12 +40,12 @@ SDL_Rect _inputRect; } - (void)doCommandBySelector:(SEL)myselector; -- (void)setInputRect:(SDL_Rect *)rect; +- (void)setInputRect:(const SDL_Rect *)rect; @end @implementation SDLTranslatorResponder -- (void)setInputRect:(SDL_Rect *)rect +- (void)setInputRect:(const SDL_Rect *)rect { _inputRect = *rect; } @@ -104,8 +104,7 @@ } if (_markedText != aString) { - [_markedText release]; - _markedText = [aString retain]; + _markedText = aString; } _selectedRange = selectedRange; @@ -120,7 +119,6 @@ - (void)unmarkText { - [_markedText release]; _markedText = nil; SDL_SendEditingText("", 0, 0); @@ -142,14 +140,7 @@ aRange.location, aRange.length, windowHeight, NSStringFromRect(rect)); -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 - if (![window respondsToSelector:@selector(convertRectToScreen:)]) { - rect.origin = [window convertBaseToScreen:rect.origin]; - } else -#endif - { - rect = [window convertRectToScreen:rect]; - } + rect = [window convertRectToScreen:rect]; return rect; } @@ -381,14 +372,14 @@ static void HandleModifiers(_THIS, unsigned short scancode, unsigned int modifierFlags) { - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + SDL_VideoData *data = (__bridge SDL_VideoData *) _this->driverdata; - if (modifierFlags == data->modifierFlags) { + if (modifierFlags == data.modifierFlags) { return; } - DoSidedModifiers(scancode, data->modifierFlags, modifierFlags); - data->modifierFlags = modifierFlags; + DoSidedModifiers(scancode, data.modifierFlags, modifierFlags); + data.modifierFlags = modifierFlags; } static void @@ -399,18 +390,19 @@ int i; SDL_Scancode scancode; SDL_Keycode keymap[SDL_NUM_SCANCODES]; + CFDataRef uchrDataRef; /* See if the keymap needs to be updated */ key_layout = TISCopyCurrentKeyboardLayoutInputSource(); - if (key_layout == data->key_layout) { + if (key_layout == data.key_layout) { return; } - data->key_layout = key_layout; + data.key_layout = key_layout; SDL_GetDefaultKeymap(keymap); /* Try Unicode data first */ - CFDataRef uchrDataRef = TISGetInputSourceProperty(key_layout, kTISPropertyUnicodeKeyLayoutData); + uchrDataRef = TISGetInputSourceProperty(key_layout, kTISPropertyUnicodeKeyLayoutData); if (uchrDataRef) { chr_data = CFDataGetBytePtr(uchrDataRef); } else { @@ -447,10 +439,7 @@ keymap[scancode] = s[0]; } } - SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES); - if (send_event) { - SDL_SendKeymapChangedEvent(); - } + SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES, send_event); return; } @@ -461,7 +450,7 @@ void Cocoa_InitKeyboard(_THIS) { - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + SDL_VideoData *data = (__bridge SDL_VideoData *) _this->driverdata; UpdateKeymap(data, SDL_FALSE); @@ -473,38 +462,39 @@ SDL_SetScancodeName(SDL_SCANCODE_RALT, "Right Option"); SDL_SetScancodeName(SDL_SCANCODE_RGUI, "Right Command"); - data->modifierFlags = (unsigned int)[NSEvent modifierFlags]; - SDL_ToggleModState(KMOD_CAPS, (data->modifierFlags & NSEventModifierFlagCapsLock) != 0); + data.modifierFlags = (unsigned int)[NSEvent modifierFlags]; + SDL_ToggleModState(KMOD_CAPS, (data.modifierFlags & NSEventModifierFlagCapsLock) != 0); } void Cocoa_StartTextInput(_THIS) { @autoreleasepool { - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + NSView *parentView; + SDL_VideoData *data = (__bridge SDL_VideoData *) _this->driverdata; SDL_Window *window = SDL_GetKeyboardFocus(); NSWindow *nswindow = nil; if (window) { - nswindow = ((SDL_WindowData*)window->driverdata)->nswindow; + nswindow = ((__bridge SDL_WindowData*)window->driverdata).nswindow; } - NSView *parentView = [nswindow contentView]; + parentView = [nswindow contentView]; /* We only keep one field editor per process, since only the front most * window can receive text input events, so it make no sense to keep more * than one copy. When we switched to another window and requesting for * text input, simply remove the field editor from its superview then add * it to the front most window's content view */ - if (!data->fieldEdit) { - data->fieldEdit = + if (!data.fieldEdit) { + data.fieldEdit = [[SDLTranslatorResponder alloc] initWithFrame: NSMakeRect(0.0, 0.0, 0.0, 0.0)]; } - if (![[data->fieldEdit superview] isEqual:parentView]) { + if (![[data.fieldEdit superview] isEqual:parentView]) { /* DEBUG_IME(@"add fieldEdit to window contentView"); */ - [data->fieldEdit removeFromSuperview]; - [parentView addSubview: data->fieldEdit]; - [nswindow makeFirstResponder: data->fieldEdit]; + [data.fieldEdit removeFromSuperview]; + [parentView addSubview: data.fieldEdit]; + [nswindow makeFirstResponder: data.fieldEdit]; } }} @@ -512,38 +502,38 @@ Cocoa_StopTextInput(_THIS) { @autoreleasepool { - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + SDL_VideoData *data = (__bridge SDL_VideoData *) _this->driverdata; - if (data && data->fieldEdit) { - [data->fieldEdit removeFromSuperview]; - [data->fieldEdit release]; - data->fieldEdit = nil; + if (data && data.fieldEdit) { + [data.fieldEdit removeFromSuperview]; + data.fieldEdit = nil; } }} void -Cocoa_SetTextInputRect(_THIS, SDL_Rect *rect) +Cocoa_SetTextInputRect(_THIS, const SDL_Rect *rect) { - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + SDL_VideoData *data = (__bridge SDL_VideoData *) _this->driverdata; if (!rect) { SDL_InvalidParamError("rect"); return; } - [data->fieldEdit setInputRect:rect]; + [data.fieldEdit setInputRect:rect]; } void Cocoa_HandleKeyEvent(_THIS, NSEvent *event) { - SDL_VideoData *data = _this ? ((SDL_VideoData *) _this->driverdata) : NULL; + unsigned short scancode; + SDL_Scancode code; + SDL_VideoData *data = _this ? ((__bridge SDL_VideoData *) _this->driverdata) : nil; if (!data) { return; /* can happen when returning from fullscreen Space on shutdown */ } - unsigned short scancode = [event keyCode]; - SDL_Scancode code; + scancode = [event keyCode]; #if 0 const char *text; #endif @@ -575,7 +565,7 @@ #endif if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) { /* FIXME CW 2007-08-16: only send those events to the field editor for which we actually want text events, not e.g. esc or function keys. Arrow keys in particular seem to produce crashes sometimes. */ - [data->fieldEdit interpretKeyEvents:[NSArray arrayWithObject:event]]; + [data.fieldEdit interpretKeyEvents:[NSArray arrayWithObject:event]]; #if 0 text = [[event characters] UTF8String]; if(text && *text) { diff -Nru libsdl2-2.0.22+dfsg/src/video/cocoa/SDL_cocoamessagebox.m libsdl2-2.24.0+dfsg/src/video/cocoa/SDL_cocoamessagebox.m --- libsdl2-2.0.22+dfsg/src/video/cocoa/SDL_cocoamessagebox.m 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/cocoa/SDL_cocoamessagebox.m 2022-08-13 03:48:10.000000000 +0000 @@ -45,9 +45,9 @@ /* Retain the NSWindow because we'll show the alert later on the main thread */ if (window) { - nswindow = [((SDL_WindowData *) window->driverdata)->nswindow retain]; + nswindow = ((__bridge SDL_WindowData *) window->driverdata).nswindow; } else { - nswindow = NULL; + nswindow = nil; } } @@ -60,7 +60,7 @@ #ifdef MAC_OS_X_VERSION_10_9 if ([alert respondsToSelector:@selector(beginSheetModalForWindow:completionHandler:)]) { [alert beginSheetModalForWindow:nswindow completionHandler:^(NSModalResponse returnCode) { - clicked = returnCode; + self->clicked = returnCode; }]; } else #endif @@ -75,7 +75,7 @@ SDL_Delay(100); } - [nswindow release]; + nswindow = nil; } else { clicked = [alert runModal]; } @@ -92,9 +92,14 @@ static void Cocoa_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, int *buttonid, int *returnValue) { + NSAlert* alert; + const SDL_MessageBoxButtonData *buttons = messageboxdata->buttons; + SDLMessageBoxPresenter* presenter; + NSInteger clicked; + int i; Cocoa_RegisterApp(); - NSAlert* alert = [[[NSAlert alloc] init] autorelease]; + alert = [[NSAlert alloc] init]; if (messageboxdata->flags & SDL_MESSAGEBOX_ERROR) { [alert setAlertStyle:NSAlertStyleCritical]; @@ -107,8 +112,6 @@ [alert setMessageText:[NSString stringWithUTF8String:messageboxdata->title]]; [alert setInformativeText:[NSString stringWithUTF8String:messageboxdata->message]]; - const SDL_MessageBoxButtonData *buttons = messageboxdata->buttons; - int i; for (i = 0; i < messageboxdata->numbuttons; ++i) { const SDL_MessageBoxButtonData *sdlButton; NSButton *button; @@ -129,11 +132,11 @@ } } - SDLMessageBoxPresenter* presenter = [[[SDLMessageBoxPresenter alloc] initWithParentWindow:messageboxdata->window] autorelease]; + presenter = [[SDLMessageBoxPresenter alloc] initWithParentWindow:messageboxdata->window]; [presenter showAlert:alert]; - NSInteger clicked = presenter->clicked; + clicked = presenter->clicked; if (clicked >= NSAlertFirstButtonReturn) { clicked -= NSAlertFirstButtonReturn; if (messageboxdata->flags & SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT) { diff -Nru libsdl2-2.0.22+dfsg/src/video/cocoa/SDL_cocoametalview.m libsdl2-2.24.0+dfsg/src/video/cocoa/SDL_cocoametalview.m --- libsdl2-2.0.22+dfsg/src/video/cocoa/SDL_cocoametalview.m 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/cocoa/SDL_cocoametalview.m 2022-06-02 02:01:57.000000000 +0000 @@ -89,7 +89,7 @@ /* Allow resize. */ self.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable; - SDL_AddEventWatch(SDL_MetalViewEventWatch, self); + SDL_AddEventWatch(SDL_MetalViewEventWatch, (__bridge void *)(self)); [self updateDrawableSize]; } @@ -99,8 +99,7 @@ - (void)dealloc { - SDL_DelEventWatch(SDL_MetalViewEventWatch, self); - [super dealloc]; + SDL_DelEventWatch(SDL_MetalViewEventWatch, (__bridge void *)(self)); } - (NSInteger)tag @@ -135,7 +134,7 @@ Cocoa_Metal_CreateView(_THIS, SDL_Window * window) { @autoreleasepool { SDL_WindowData* data = (__bridge SDL_WindowData *)window->driverdata; - NSView *view = data->nswindow.contentView; + NSView *view = data.nswindow.contentView; BOOL highDPI = (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) != 0; Uint32 windowID = SDL_GetWindowID(window); SDL_cocoametalview *newview; @@ -151,7 +150,6 @@ [view addSubview:newview]; metalview = (SDL_MetalView)CFBridgingRetain(newview); - [newview release]; return metalview; }} @@ -174,7 +172,7 @@ Cocoa_Metal_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h) { @autoreleasepool { SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata; - NSView *contentView = data->sdlContentView; + NSView *contentView = data.sdlContentView; SDL_cocoametalview* metalview = [contentView viewWithTag:SDL_METALVIEW_TAG]; if (metalview) { CAMetalLayer *layer = (CAMetalLayer*)metalview.layer; @@ -189,11 +187,8 @@ /* Fall back to the viewport size. */ NSRect viewport = [contentView bounds]; if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { - /* This gives us the correct viewport for a Retina-enabled view, only - * supported on 10.7+. */ - if ([contentView respondsToSelector:@selector(convertRectToBacking:)]) { - viewport = [contentView convertRectToBacking:viewport]; - } + /* This gives us the correct viewport for a Retina-enabled view. */ + viewport = [contentView convertRectToBacking:viewport]; } if (w) { *w = viewport.size.width; diff -Nru libsdl2-2.0.22+dfsg/src/video/cocoa/SDL_cocoamodes.m libsdl2-2.24.0+dfsg/src/video/cocoa/SDL_cocoamodes.m --- libsdl2-2.0.22+dfsg/src/video/cocoa/SDL_cocoamodes.m 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/cocoa/SDL_cocoamodes.m 2022-08-13 03:48:10.000000000 +0000 @@ -31,9 +31,6 @@ #include #include -/* we need this for ShowMenuBar() and HideMenuBar(). */ -#include - /* This gets us MAC_OS_X_VERSION_MIN_REQUIRED... */ #include @@ -45,23 +42,6 @@ #endif -static void -Cocoa_ToggleMenuBar(const BOOL show) -{ - /* !!! FIXME: keep an eye on this. - * ShowMenuBar/HideMenuBar is officially unavailable for 64-bit binaries. - * It happens to work, as of 10.7, but we're going to see if - * we can just simply do without it on newer OSes... - */ -#if (MAC_OS_X_VERSION_MIN_REQUIRED < 1070) && !defined(__LP64__) - if (show) { - ShowMenuBar(); - } else { - HideMenuBar(); - } -#endif -} - static int CG_SetError(const char *prefix, CGDisplayErr result) { @@ -205,6 +185,9 @@ int i; for (i = 0; i < modescount; i++) { + int otherW, otherH, otherpixelW, otherpixelH, otherrefresh; + Uint32 otherformat; + bool otherGUI; CGDisplayModeRef othermode = (CGDisplayModeRef) CFArrayGetValueAtIndex(modelist, i); uint32_t otherioflags = CGDisplayModeGetIOFlags(othermode); @@ -216,13 +199,13 @@ continue; } - int otherW = (int) CGDisplayModeGetWidth(othermode); - int otherH = (int) CGDisplayModeGetHeight(othermode); - int otherpixelW = (int) CGDisplayModeGetPixelWidth(othermode); - int otherpixelH = (int) CGDisplayModeGetPixelHeight(othermode); - int otherrefresh = GetDisplayModeRefreshRate(othermode, link); - Uint32 otherformat = GetDisplayModePixelFormat(othermode); - bool otherGUI = CGDisplayModeIsUsableForDesktopGUI(othermode); + otherW = (int) CGDisplayModeGetWidth(othermode); + otherH = (int) CGDisplayModeGetHeight(othermode); + otherpixelW = (int) CGDisplayModeGetPixelWidth(othermode); + otherpixelH = (int) CGDisplayModeGetPixelHeight(othermode); + otherrefresh = GetDisplayModeRefreshRate(othermode, link); + otherformat = GetDisplayModePixelFormat(othermode); + otherGUI = CGDisplayModeIsUsableForDesktopGUI(othermode); /* Ignore this mode if it's low-dpi (@1x) and we have a high-dpi * mode in the list with the same size in points. @@ -306,7 +289,7 @@ /* This API is deprecated in 10.9 with no good replacement (as of 10.15). */ io_service_t servicePort = CGDisplayIOServicePort(displayID); CFDictionaryRef deviceInfo = IODisplayCreateInfoDictionary(servicePort, kIODisplayOnlyPreferredName); - NSDictionary *localizedNames = [(NSDictionary *)deviceInfo objectForKey:[NSString stringWithUTF8String:kDisplayProductName]]; + NSDictionary *localizedNames = [(__bridge NSDictionary *)deviceInfo objectForKey:[NSString stringWithUTF8String:kDisplayProductName]]; const char* displayName = NULL; if ([localizedNames count] > 0) { @@ -437,11 +420,13 @@ return -1; } - const NSRect frame = [screen visibleFrame]; - rect->x = (int)frame.origin.x; - rect->y = (int)(CGDisplayPixelsHigh(kCGDirectMainDisplay) - frame.origin.y - frame.size.height); - rect->w = (int)frame.size.width; - rect->h = (int)frame.size.height; + { + const NSRect frame = [screen visibleFrame]; + rect->x = (int)frame.origin.x; + rect->y = (int)(CGDisplayPixelsHigh(kCGDirectMainDisplay) - frame.origin.y - frame.size.height); + rect->w = (int)frame.size.width; + rect->h = (int)frame.size.height; + } return 0; } @@ -497,7 +482,7 @@ CFRelease(dmOptions); } else #endif - if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) { + { // fallback for 10.7 scaleFactor = [screen backingScaleFactor]; displayNativeSize.width = displayNativeSize.width * scaleFactor; @@ -507,20 +492,21 @@ } } - const CGSize displaySize = CGDisplayScreenSize(data->display); - const int pixelWidth = displayNativeSize.width; - const int pixelHeight = displayNativeSize.height; + { + const CGSize displaySize = CGDisplayScreenSize(data->display); + const int pixelWidth = displayNativeSize.width; + const int pixelHeight = displayNativeSize.height; - if (ddpi) { - *ddpi = (SDL_ComputeDiagonalDPI(pixelWidth, pixelHeight, displaySize.width / MM_IN_INCH, displaySize.height / MM_IN_INCH)); - } - if (hdpi) { - *hdpi = (pixelWidth * MM_IN_INCH / displaySize.width); - } - if (vdpi) { - *vdpi = (pixelHeight * MM_IN_INCH / displaySize.height); + if (ddpi) { + *ddpi = (SDL_ComputeDiagonalDPI(pixelWidth, pixelHeight, displaySize.width / MM_IN_INCH, displaySize.height / MM_IN_INCH)); + } + if (hdpi) { + *hdpi = (pixelWidth * MM_IN_INCH / displaySize.width); + } + if (vdpi) { + *vdpi = (pixelHeight * MM_IN_INCH / displaySize.height); + } } - return 0; }} @@ -646,10 +632,6 @@ } else { CGDisplayRelease(displaydata->display); } - - if (CGDisplayIsMain(displaydata->display)) { - Cocoa_ToggleMenuBar(YES); - } } else { /* Put up the blanking window (a window above all other windows) */ if (CGDisplayIsMain(displaydata->display)) { @@ -669,11 +651,6 @@ CG_SetError("CGDisplaySwitchToMode()", result); goto ERR_NO_SWITCH; } - - /* Hide the menu bar so it doesn't intercept events */ - if (CGDisplayIsMain(displaydata->display)) { - Cocoa_ToggleMenuBar(NO); - } } /* Fade in again (asynchronously) */ @@ -720,7 +697,6 @@ CFRelease(mode->modes); } } - Cocoa_ToggleMenuBar(YES); } #endif /* SDL_VIDEO_DRIVER_COCOA */ diff -Nru libsdl2-2.0.22+dfsg/src/video/cocoa/SDL_cocoamouse.m libsdl2-2.24.0+dfsg/src/video/cocoa/SDL_cocoamouse.m --- libsdl2-2.0.22+dfsg/src/video/cocoa/SDL_cocoamouse.m 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/cocoa/SDL_cocoamouse.m 2022-08-13 03:48:10.000000000 +0000 @@ -53,7 +53,7 @@ NSData *cursorData = [NSData dataWithBytesNoCopy:&cursorBytes[0] length:sizeof(cursorBytes) freeWhenDone:NO]; - NSImage *cursorImage = [[[NSImage alloc] initWithData:cursorData] autorelease]; + NSImage *cursorImage = [[NSImage alloc] initWithData:cursorData]; invisibleCursor = [[NSCursor alloc] initWithImage:cursorImage hotSpot:NSZeroPoint]; } @@ -75,8 +75,7 @@ if (nscursor) { cursor = SDL_calloc(1, sizeof(*cursor)); if (cursor) { - cursor->driverdata = nscursor; - [nscursor retain]; + cursor->driverdata = (void *)CFBridgingRetain(nscursor); } } @@ -99,15 +98,54 @@ if (nscursor) { cursor = SDL_calloc(1, sizeof(*cursor)); if (cursor) { - cursor->driverdata = nscursor; - } else { - [nscursor release]; + cursor->driverdata = (void *)CFBridgingRetain(nscursor); } } return cursor; }} +/* there are .pdf files of some of the cursors we need, installed by default on macOS, but not available through NSCursor. + If we can load them ourselves, use them, otherwise fallback to something standard but not super-great. + Since these are under /System, they should be available even to sandboxed apps. */ +static NSCursor * +LoadHiddenSystemCursor(NSString *cursorName, SEL fallback) +{ + NSString *cursorPath = [@"/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/Resources/cursors" stringByAppendingPathComponent:cursorName]; + NSDictionary *info = [NSDictionary dictionaryWithContentsOfFile:[cursorPath stringByAppendingPathComponent:@"info.plist"]]; + /* we can't do animation atm. :/ */ + const int frames = (int)[[info valueForKey:@"frames"] integerValue]; + NSCursor *cursor; + NSImage *image = [[NSImage alloc] initWithContentsOfFile:[cursorPath stringByAppendingPathComponent:@"cursor.pdf"]]; + if ((image == nil) || (image.isValid == NO)) { + return [NSCursor performSelector:fallback]; + } + + if (frames > 1) { + #ifdef MAC_OS_VERSION_12_0 /* same value as deprecated symbol. */ + const NSCompositingOperation operation = NSCompositingOperationCopy; + #else + const NSCompositingOperation operation = NSCompositeCopy; + #endif + const NSSize cropped_size = NSMakeSize(image.size.width, (int) (image.size.height / frames)); + NSImage *cropped = [[NSImage alloc] initWithSize:cropped_size]; + if (cropped == nil) { + return [NSCursor performSelector:fallback]; + } + + [cropped lockFocus]; + { + const NSRect cropped_rect = NSMakeRect(0, 0, cropped_size.width, cropped_size.height); + [image drawInRect:cropped_rect fromRect:cropped_rect operation:operation fraction:1]; + } + [cropped unlockFocus]; + image = cropped; + } + + cursor = [[NSCursor alloc] initWithImage:image hotSpot:NSMakePoint([[info valueForKey:@"hotx"] doubleValue], [[info valueForKey:@"hoty"] doubleValue])]; + return cursor; +} + static SDL_Cursor * Cocoa_CreateSystemCursor(SDL_SystemCursor id) { @autoreleasepool @@ -122,27 +160,29 @@ case SDL_SYSTEM_CURSOR_IBEAM: nscursor = [NSCursor IBeamCursor]; break; - case SDL_SYSTEM_CURSOR_WAIT: - nscursor = [NSCursor arrowCursor]; - break; case SDL_SYSTEM_CURSOR_CROSSHAIR: nscursor = [NSCursor crosshairCursor]; break; - case SDL_SYSTEM_CURSOR_WAITARROW: - nscursor = [NSCursor arrowCursor]; + case SDL_SYSTEM_CURSOR_WAIT: /* !!! FIXME: this is more like WAITARROW */ + nscursor = LoadHiddenSystemCursor(@"busybutclickable", @selector(arrowCursor)); + break; + case SDL_SYSTEM_CURSOR_WAITARROW: /* !!! FIXME: this is meant to be animated */ + nscursor = LoadHiddenSystemCursor(@"busybutclickable", @selector(arrowCursor)); break; case SDL_SYSTEM_CURSOR_SIZENWSE: + nscursor = LoadHiddenSystemCursor(@"resizenorthwestsoutheast", @selector(closedHandCursor)); + break; case SDL_SYSTEM_CURSOR_SIZENESW: - nscursor = [NSCursor closedHandCursor]; + nscursor = LoadHiddenSystemCursor(@"resizenortheastsouthwest", @selector(closedHandCursor)); break; case SDL_SYSTEM_CURSOR_SIZEWE: - nscursor = [NSCursor resizeLeftRightCursor]; + nscursor = LoadHiddenSystemCursor(@"resizeeastwest", @selector(resizeLeftRightCursor)); break; case SDL_SYSTEM_CURSOR_SIZENS: - nscursor = [NSCursor resizeUpDownCursor]; + nscursor = LoadHiddenSystemCursor(@"resizenorthsouth", @selector(resizeUpDownCursor)); break; case SDL_SYSTEM_CURSOR_SIZEALL: - nscursor = [NSCursor closedHandCursor]; + nscursor = LoadHiddenSystemCursor(@"move", @selector(closedHandCursor)); break; case SDL_SYSTEM_CURSOR_NO: nscursor = [NSCursor operationNotAllowedCursor]; @@ -159,8 +199,7 @@ cursor = SDL_calloc(1, sizeof(*cursor)); if (cursor) { /* We'll free it later, so retain it here */ - [nscursor retain]; - cursor->driverdata = nscursor; + cursor->driverdata = (void *)CFBridgingRetain(nscursor); } } @@ -171,9 +210,7 @@ Cocoa_FreeCursor(SDL_Cursor * cursor) { @autoreleasepool { - NSCursor *nscursor = (NSCursor *)cursor->driverdata; - - [nscursor release]; + CFBridgingRelease(cursor->driverdata); SDL_free(cursor); }} @@ -184,11 +221,11 @@ SDL_VideoDevice *device = SDL_GetVideoDevice(); SDL_Window *window = (device ? device->windows : NULL); for (; window != NULL; window = window->next) { - SDL_WindowData *driverdata = (SDL_WindowData *)window->driverdata; + SDL_WindowData *driverdata = (__bridge SDL_WindowData *)window->driverdata; if (driverdata) { - [driverdata->nswindow performSelectorOnMainThread:@selector(invalidateCursorRectsForView:) - withObject:[driverdata->nswindow contentView] - waitUntilDone:NO]; + [driverdata.nswindow performSelectorOnMainThread:@selector(invalidateCursorRectsForView:) + withObject:[driverdata.nswindow contentView] + waitUntilDone:NO]; } } return 0; @@ -212,16 +249,17 @@ static int Cocoa_WarpMouseGlobal(int x, int y) { + CGPoint point; SDL_Mouse *mouse = SDL_GetMouse(); if (mouse->focus) { - SDL_WindowData *data = (SDL_WindowData *) mouse->focus->driverdata; - if ([data->listener isMovingOrFocusClickPending]) { + SDL_WindowData *data = (__bridge SDL_WindowData *) mouse->focus->driverdata; + if ([data.listener isMovingOrFocusClickPending]) { DLog("Postponing warp, window being moved or focused."); - [data->listener setPendingMoveX:x Y:y]; + [data.listener setPendingMoveX:x Y:y]; return 0; } } - const CGPoint point = CGPointMake((float)x, (float)y); + point = CGPointMake((float)x, (float)y); Cocoa_HandleMouseWarp(point.x, point.y); @@ -259,23 +297,9 @@ static int Cocoa_SetRelativeMouseMode(SDL_bool enabled) { - /* We will re-apply the relative mode when the window gets focus, if it - * doesn't have focus right now. - */ - SDL_Window *window = SDL_GetKeyboardFocus(); - if (!window) { - return 0; - } - - /* We will re-apply the relative mode when the window finishes being moved, - * if it is being moved right now. - */ - SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - if ([data->listener isMovingOrFocusClickPending]) { - return 0; - } - CGError result; + SDL_Window *window; + SDL_WindowData *data; if (enabled) { DLog("Turning on."); result = CGAssociateMouseAndMouseCursorPosition(NO); @@ -287,6 +311,22 @@ return SDL_SetError("CGAssociateMouseAndMouseCursorPosition() failed"); } + /* We will re-apply the non-relative mode when the window gets focus, if it + * doesn't have focus right now. + */ + window = SDL_GetKeyboardFocus(); + if (!window) { + return 0; + } + + /* We will re-apply the non-relative mode when the window finishes being moved, + * if it is being moved right now. + */ + data = (__bridge SDL_WindowData *) window->driverdata; + if ([data.listener isMovingOrFocusClickPending]) { + return 0; + } + /* The hide/unhide calls are redundant most of the time, but they fix * https://bugzilla.libsdl.org/show_bug.cgi?id=2550 */ @@ -328,6 +368,7 @@ int Cocoa_InitMouse(_THIS) { + NSPoint location; SDL_Mouse *mouse = SDL_GetMouse(); SDL_MouseData *driverdata = (SDL_MouseData*) SDL_calloc(1, sizeof(SDL_MouseData)); if (driverdata == NULL) { @@ -347,7 +388,7 @@ SDL_SetDefaultCursor(Cocoa_CreateDefaultCursor()); - const NSPoint location = [NSEvent mouseLocation]; + location = [NSEvent mouseLocation]; driverdata->lastMoveX = location.x; driverdata->lastMoveY = location.y; return 0; @@ -359,19 +400,25 @@ SDL_Window *window; NSWindow *nswindow = [event window]; + /* You might land in this function before SDL_Init if showing a message box. + Don't derefence a NULL pointer if that happens. */ + if (_this == NULL) { + return; + } + for (window = _this->windows; window; window = window->next) { - SDL_WindowData *data = (SDL_WindowData *)window->driverdata; - if (data && data->nswindow == nswindow) { + SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata; + if (data && data.nswindow == nswindow) { switch ([event type]) { case NSEventTypeLeftMouseDown: case NSEventTypeRightMouseDown: case NSEventTypeOtherMouseDown: - [data->listener setFocusClickPending:[event buttonNumber]]; + [data.listener setFocusClickPending:[event buttonNumber]]; break; case NSEventTypeLeftMouseUp: case NSEventTypeRightMouseUp: case NSEventTypeOtherMouseUp: - [data->listener clearFocusClickPending:[event buttonNumber]]; + [data.listener clearFocusClickPending:[event buttonNumber]]; break; default: break; @@ -384,6 +431,13 @@ void Cocoa_HandleMouseEvent(_THIS, NSEvent *event) { + SDL_Mouse *mouse; + SDL_MouseData *driverdata; + SDL_MouseID mouseID; + NSPoint location; + CGFloat lastMoveX, lastMoveY; + float deltaX, deltaY; + SDL_bool seenWarp; switch ([event type]) { case NSEventTypeMouseMoved: case NSEventTypeLeftMouseDragged: @@ -411,19 +465,19 @@ return; } - SDL_Mouse *mouse = SDL_GetMouse(); - SDL_MouseData *driverdata = (SDL_MouseData*)mouse->driverdata; + mouse = SDL_GetMouse(); + driverdata = (SDL_MouseData*)mouse->driverdata; if (!driverdata) { return; /* can happen when returning from fullscreen Space on shutdown */ } - SDL_MouseID mouseID = mouse ? mouse->mouseID : 0; - const SDL_bool seenWarp = driverdata->seenWarp; + mouseID = mouse ? mouse->mouseID : 0; + seenWarp = driverdata->seenWarp; driverdata->seenWarp = NO; - const NSPoint location = [NSEvent mouseLocation]; - const CGFloat lastMoveX = driverdata->lastMoveX; - const CGFloat lastMoveY = driverdata->lastMoveY; + location = [NSEvent mouseLocation]; + lastMoveX = driverdata->lastMoveX; + lastMoveY = driverdata->lastMoveY; driverdata->lastMoveX = location.x; driverdata->lastMoveY = location.y; DLog("Last seen mouse: (%g, %g)", location.x, location.y); @@ -441,8 +495,8 @@ } } - float deltaX = [event deltaX]; - float deltaY = [event deltaY]; + deltaX = [event deltaX]; + deltaY = [event deltaY]; if (seenWarp) { deltaX += (lastMoveX - driverdata->lastWarpX); @@ -457,25 +511,26 @@ void Cocoa_HandleMouseWheel(SDL_Window *window, NSEvent *event) { + SDL_MouseID mouseID; + SDL_MouseWheelDirection direction; + CGFloat x, y; SDL_Mouse *mouse = SDL_GetMouse(); if (!mouse) { return; } - SDL_MouseID mouseID = mouse->mouseID; - CGFloat x = -[event deltaX]; - CGFloat y = [event deltaY]; - SDL_MouseWheelDirection direction = SDL_MOUSEWHEEL_NORMAL; - - if ([event respondsToSelector:@selector(isDirectionInvertedFromDevice)]) { - if ([event isDirectionInvertedFromDevice] == YES) { - direction = SDL_MOUSEWHEEL_FLIPPED; - } + mouseID = mouse->mouseID; + x = -[event deltaX]; + y = [event deltaY]; + direction = SDL_MOUSEWHEEL_NORMAL; + + if ([event isDirectionInvertedFromDevice] == YES) { + direction = SDL_MOUSEWHEEL_FLIPPED; } /* For discrete scroll events from conventional mice, always send a full tick. For continuous scroll events from trackpads, send fractional deltas for smoother scrolling. */ - if (![event respondsToSelector:@selector(hasPreciseScrollingDeltas)] || ![event hasPreciseScrollingDeltas]) { + if (![event hasPreciseScrollingDeltas]) { if (x > 0) { x = SDL_ceil(x); } else if (x < 0) { diff -Nru libsdl2-2.0.22+dfsg/src/video/cocoa/SDL_cocoaopengles.m libsdl2-2.24.0+dfsg/src/video/cocoa/SDL_cocoaopengles.m --- libsdl2-2.0.22+dfsg/src/video/cocoa/SDL_cocoaopengles.m 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/cocoa/SDL_cocoaopengles.m 2022-08-13 03:48:10.000000000 +0000 @@ -29,8 +29,8 @@ /* EGL implementation of SDL OpenGL support */ int -Cocoa_GLES_LoadLibrary(_THIS, const char *path) { - +Cocoa_GLES_LoadLibrary(_THIS, const char *path) +{ /* If the profile requested is not GL ES, switch over to WIN_GL functions */ if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) { #if SDL_VIDEO_OPENGL_CGL @@ -59,9 +59,10 @@ SDL_GLContext Cocoa_GLES_CreateContext(_THIS, SDL_Window * window) +{ @autoreleasepool { SDL_GLContext context; - SDL_WindowData *data = (SDL_WindowData *)window->driverdata; + SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata; #if SDL_VIDEO_OPENGL_CGL if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) { @@ -85,25 +86,38 @@ } #endif - context = SDL_EGL_CreateContext(_this, data->egl_surface); + context = SDL_EGL_CreateContext(_this, data.egl_surface); return context; -} +}} void Cocoa_GLES_DeleteContext(_THIS, SDL_GLContext context) +{ @autoreleasepool { SDL_EGL_DeleteContext(_this, context); Cocoa_GLES_UnloadLibrary(_this); -} +}} -SDL_EGL_SwapWindow_impl(Cocoa) -SDL_EGL_MakeCurrent_impl(Cocoa) +int +Cocoa_GLES_SwapWindow(_THIS, SDL_Window * window) +{ @autoreleasepool +{ + return SDL_EGL_SwapBuffers(_this, ((__bridge SDL_WindowData *) window->driverdata).egl_surface); +}} + +int +Cocoa_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) +{ @autoreleasepool +{ + return SDL_EGL_MakeCurrent(_this, window ? ((__bridge SDL_WindowData *) window->driverdata).egl_surface : EGL_NO_SURFACE, context); +}} int Cocoa_GLES_SetupWindow(_THIS, SDL_Window * window) { + NSView* v; /* The current context is lost in here; save it and reset it. */ - SDL_WindowData *windowdata = (SDL_WindowData *) window->driverdata; + SDL_WindowData *windowdata = (__bridge SDL_WindowData *) window->driverdata; SDL_Window *current_win = SDL_GL_GetCurrentWindow(); SDL_GLContext current_ctx = SDL_GL_GetCurrentContext(); @@ -121,10 +135,10 @@ } /* Create the GLES window surface */ - NSView* v = windowdata->nswindow.contentView; - windowdata->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType)[v layer]); + v = windowdata.nswindow.contentView; + windowdata.egl_surface = SDL_EGL_CreateSurface(_this, (__bridge NativeWindowType)[v layer]); - if (windowdata->egl_surface == EGL_NO_SURFACE) { + if (windowdata.egl_surface == EGL_NO_SURFACE) { return SDL_SetError("Could not create GLES window surface"); } diff -Nru libsdl2-2.0.22+dfsg/src/video/cocoa/SDL_cocoaopengl.m libsdl2-2.24.0+dfsg/src/video/cocoa/SDL_cocoaopengl.m --- libsdl2-2.0.22+dfsg/src/video/cocoa/SDL_cocoaopengl.m 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/cocoa/SDL_cocoaopengl.m 2022-08-13 03:48:10.000000000 +0000 @@ -31,8 +31,10 @@ #include #include +#include "SDL_hints.h" #include "SDL_loadso.h" #include "SDL_opengl.h" +#include "../../SDL_hints_c.h" #define DEFAULT_OPENGL "/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib" @@ -42,6 +44,14 @@ #pragma clang diagnostic ignored "-Wdeprecated-declarations" #endif +static SDL_bool SDL_opengl_async_dispatch = SDL_FALSE; + +static void SDLCALL +SDL_OpenGLAsyncDispatchChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + SDL_opengl_async_dispatch = SDL_GetStringBoolean(hint, SDL_FALSE); +} + @implementation SDLOpenGLContext : NSOpenGLContext - (id)initWithFormat:(NSOpenGLPixelFormat *)format @@ -52,6 +62,8 @@ SDL_AtomicSet(&self->dirty, 0); self->window = NULL; } + + SDL_AddHintCallback(SDL_HINT_MAC_OPENGL_ASYNC_DISPATCH, SDL_OpenGLAsyncDispatchChanged, NULL); return self; } @@ -82,10 +94,10 @@ - (void)setWindow:(SDL_Window *)newWindow { if (self->window) { - SDL_WindowData *oldwindowdata = (SDL_WindowData *)self->window->driverdata; + SDL_WindowData *oldwindowdata = (__bridge SDL_WindowData *)self->window->driverdata; /* Make sure to remove us from the old window's context list, or we'll get scheduled updates from it too. */ - NSMutableArray *contexts = oldwindowdata->nscontexts; + NSMutableArray *contexts = oldwindowdata.nscontexts; @synchronized (contexts) { [contexts removeObject:self]; } @@ -94,11 +106,11 @@ self->window = newWindow; if (newWindow) { - SDL_WindowData *windowdata = (SDL_WindowData *)newWindow->driverdata; - NSView *contentview = windowdata->sdlContentView; + SDL_WindowData *windowdata = (__bridge SDL_WindowData *)newWindow->driverdata; + NSView *contentview = windowdata.sdlContentView; /* Now sign up for scheduled updates for the new window. */ - NSMutableArray *contexts = windowdata->nscontexts; + NSMutableArray *contexts = windowdata.nscontexts; @synchronized (contexts) { [contexts addObject:self]; } @@ -135,10 +147,19 @@ if ([NSThread isMainThread]) { [super update]; } else { - dispatch_async(dispatch_get_main_queue(), ^{ [super update]; }); + if (SDL_opengl_async_dispatch) { + dispatch_async(dispatch_get_main_queue(), ^{ [super update]; }); + } else { + dispatch_sync(dispatch_get_main_queue(), ^{ [super update]; }); + } } } +- (void)dealloc +{ + SDL_DelHintCallback(SDL_HINT_MAC_OPENGL_ASYNC_DISPATCH, SDL_OpenGLAsyncDispatchChanged, NULL); +} + @end @@ -180,15 +201,16 @@ { SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata; - SDL_bool lion_or_later = floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6; NSOpenGLPixelFormatAttribute attr[32]; NSOpenGLPixelFormat *fmt; SDLOpenGLContext *context; + SDL_GLContext sdlcontext; NSOpenGLContext *share_context = nil; int i = 0; const char *glversion; int glversion_major; int glversion_minor; + NSOpenGLPixelFormatAttribute profile; if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) { #if SDL_VIDEO_OPENGL_EGL @@ -213,22 +235,15 @@ return NULL; #endif } - if ((_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_CORE) && !lion_or_later) { - SDL_SetError ("OpenGL Core Profile is not supported on this platform version"); - return NULL; - } attr[i++] = NSOpenGLPFAAllowOfflineRenderers; - /* specify a profile if we're on Lion (10.7) or later. */ - if (lion_or_later) { - NSOpenGLPixelFormatAttribute profile = NSOpenGLProfileVersionLegacy; - if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_CORE) { - profile = NSOpenGLProfileVersion3_2Core; - } - attr[i++] = NSOpenGLPFAOpenGLProfile; - attr[i++] = profile; + profile = NSOpenGLProfileVersionLegacy; + if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_CORE) { + profile = NSOpenGLProfileVersion3_2Core; } + attr[i++] = NSOpenGLPFAOpenGLProfile; + attr[i++] = profile; attr[i++] = NSOpenGLPFAColorSize; attr[i++] = SDL_BYTESPERPIXEL(display->current_mode.format)*8; @@ -267,6 +282,9 @@ attr[i++] = _this->gl_config.multisamplesamples; attr[i++] = NSOpenGLPFANoRecovery; } + if (_this->gl_config.floatbuffers) { + attr[i++] = NSOpenGLPFAColorFloat; + } if (_this->gl_config.accelerated >= 0) { if (_this->gl_config.accelerated) { @@ -288,20 +306,20 @@ } if (_this->gl_config.share_with_current_context) { - share_context = (NSOpenGLContext*)SDL_GL_GetCurrentContext(); + share_context = (__bridge NSOpenGLContext*)SDL_GL_GetCurrentContext(); } context = [[SDLOpenGLContext alloc] initWithFormat:fmt shareContext:share_context]; - [fmt release]; - if (context == nil) { SDL_SetError("Failed creating OpenGL context"); return NULL; } - if ( Cocoa_GL_MakeCurrent(_this, window, context) < 0 ) { - Cocoa_GL_DeleteContext(_this, context); + sdlcontext = (SDL_GLContext)CFBridgingRetain(context); + + if ( Cocoa_GL_MakeCurrent(_this, window, (__bridge SDL_GLContext)context) < 0 ) { + Cocoa_GL_DeleteContext(_this, (__bridge SDL_GLContext)context); SDL_SetError("Failed making OpenGL context current"); return NULL; } @@ -315,27 +333,27 @@ glGetStringFunc = (const GLubyte *(APIENTRY *)(GLenum)) SDL_GL_GetProcAddress("glGetString"); if (!glGetStringFunc) { - Cocoa_GL_DeleteContext(_this, context); + Cocoa_GL_DeleteContext(_this, (__bridge SDL_GLContext)context); SDL_SetError ("Failed getting OpenGL glGetString entry point"); return NULL; } glversion = (const char *)glGetStringFunc(GL_VERSION); if (glversion == NULL) { - Cocoa_GL_DeleteContext(_this, context); + Cocoa_GL_DeleteContext(_this, (__bridge SDL_GLContext)context); SDL_SetError ("Failed getting OpenGL context version"); return NULL; } if (SDL_sscanf(glversion, "%d.%d", &glversion_major, &glversion_minor) != 2) { - Cocoa_GL_DeleteContext(_this, context); + Cocoa_GL_DeleteContext(_this, (__bridge SDL_GLContext)context); SDL_SetError ("Failed parsing OpenGL context version"); return NULL; } if ((glversion_major < _this->gl_config.major_version) || ((glversion_major == _this->gl_config.major_version) && (glversion_minor < _this->gl_config.minor_version))) { - Cocoa_GL_DeleteContext(_this, context); + Cocoa_GL_DeleteContext(_this, (__bridge SDL_GLContext)context); SDL_SetError ("Failed creating OpenGL context at version requested"); return NULL; } @@ -346,7 +364,7 @@ /*_this->gl_config.major_version = glversion_major;*/ /*_this->gl_config.minor_version = glversion_minor;*/ } - return context; + return sdlcontext; }} int @@ -354,7 +372,7 @@ { @autoreleasepool { if (context) { - SDLOpenGLContext *nscontext = (SDLOpenGLContext *)context; + SDLOpenGLContext *nscontext = (__bridge SDLOpenGLContext *)context; if ([nscontext window] != window) { [nscontext setWindow:window]; [nscontext updateIfNeeded]; @@ -369,17 +387,15 @@ void Cocoa_GL_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h) +{ @autoreleasepool { - SDL_WindowData *windata = (SDL_WindowData *) window->driverdata; - NSView *contentView = windata->sdlContentView; + SDL_WindowData *windata = (__bridge SDL_WindowData *) window->driverdata; + NSView *contentView = windata.sdlContentView; NSRect viewport = [contentView bounds]; if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { - /* This gives us the correct viewport for a Retina-enabled view, only - * supported on 10.7+. */ - if ([contentView respondsToSelector:@selector(convertRectToBacking:)]) { - viewport = [contentView convertRectToBacking:viewport]; - } + /* This gives us the correct viewport for a Retina-enabled view. */ + viewport = [contentView convertRectToBacking:viewport]; } if (w) { @@ -389,7 +405,7 @@ if (h) { *h = viewport.size.height; } -} +}} int Cocoa_GL_SetSwapInterval(_THIS, int interval) @@ -403,7 +419,7 @@ return SDL_SetError("Late swap tearing currently unsupported"); } - nscontext = (NSOpenGLContext*)SDL_GL_GetCurrentContext(); + nscontext = (__bridge NSOpenGLContext*)SDL_GL_GetCurrentContext(); if (nscontext != nil) { value = interval; [nscontext setValues:&value forParameter:NSOpenGLCPSwapInterval]; @@ -423,7 +439,7 @@ GLint value; int status = 0; - nscontext = (NSOpenGLContext*)SDL_GL_GetCurrentContext(); + nscontext = (__bridge NSOpenGLContext*)SDL_GL_GetCurrentContext(); if (nscontext != nil) { [nscontext getValues:&value forParameter:NSOpenGLCPSwapInterval]; status = (int)value; @@ -436,15 +452,15 @@ Cocoa_GL_SwapWindow(_THIS, SDL_Window * window) { @autoreleasepool { - SDLOpenGLContext* nscontext = (SDLOpenGLContext*)SDL_GL_GetCurrentContext(); - SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; + SDLOpenGLContext* nscontext = (__bridge SDLOpenGLContext*)SDL_GL_GetCurrentContext(); + SDL_VideoData *videodata = (__bridge SDL_VideoData *) _this->driverdata; /* on 10.14 ("Mojave") and later, this deadlocks if two contexts in two threads try to swap at the same time, so put a mutex around it. */ - SDL_LockMutex(videodata->swaplock); + SDL_LockMutex(videodata.swaplock); [nscontext flushBuffer]; [nscontext updateIfNeeded]; - SDL_UnlockMutex(videodata->swaplock); + SDL_UnlockMutex(videodata.swaplock); return 0; }} @@ -452,10 +468,8 @@ Cocoa_GL_DeleteContext(_THIS, SDL_GLContext context) { @autoreleasepool { - SDLOpenGLContext *nscontext = (SDLOpenGLContext *)context; - + SDLOpenGLContext *nscontext = (SDLOpenGLContext *)CFBridgingRelease(context); [nscontext setWindow:NULL]; - [nscontext release]; }} /* We still support OpenGL as long as Apple offers it, deprecated or not, so disable deprecation warnings about it. */ diff -Nru libsdl2-2.0.22+dfsg/src/video/cocoa/SDL_cocoashape.m libsdl2-2.24.0+dfsg/src/video/cocoa/SDL_cocoashape.m --- libsdl2-2.0.22+dfsg/src/video/cocoa/SDL_cocoashape.m 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/cocoa/SDL_cocoashape.m 2022-08-13 03:48:10.000000000 +0000 @@ -29,29 +29,33 @@ SDL_WindowShaper* Cocoa_CreateShaper(SDL_Window* window) +{ @autoreleasepool { - SDL_WindowData* windata = (SDL_WindowData*)window->driverdata; - [windata->nswindow setOpaque:NO]; + SDL_WindowShaper* result; + SDL_ShapeData* data; + int resized_properly; + SDL_WindowData* windata = (__bridge SDL_WindowData*)window->driverdata; + [windata.nswindow setOpaque:NO]; - [windata->nswindow setStyleMask:NSWindowStyleMaskBorderless]; + [windata.nswindow setStyleMask:NSWindowStyleMaskBorderless]; - SDL_WindowShaper* result = (SDL_WindowShaper *)SDL_malloc(sizeof(SDL_WindowShaper)); + result = (SDL_WindowShaper *)SDL_malloc(sizeof(SDL_WindowShaper)); result->window = window; result->mode.mode = ShapeModeDefault; result->mode.parameters.binarizationCutoff = 1; result->userx = result->usery = 0; window->shaper = result; - SDL_ShapeData* data = (SDL_ShapeData *)SDL_malloc(sizeof(SDL_ShapeData)); + data = (SDL_ShapeData *)SDL_malloc(sizeof(SDL_ShapeData)); result->driverdata = data; - data->context = [windata->nswindow graphicsContext]; + data->context = [windata.nswindow graphicsContext]; data->saved = SDL_FALSE; data->shape = NULL; - int resized_properly = Cocoa_ResizeWindowShape(window); + resized_properly = Cocoa_ResizeWindowShape(window); SDL_assert(resized_properly == 0); return result; -} +}} typedef struct { NSView* view; @@ -74,7 +78,7 @@ { @autoreleasepool { SDL_ShapeData* data = (SDL_ShapeData*)shaper->driverdata; - SDL_WindowData* windata = (SDL_WindowData*)shaper->window->driverdata; + SDL_WindowData* windata = (__bridge SDL_WindowData*)shaper->window->driverdata; SDL_CocoaClosure closure; if(data->saved == SDL_TRUE) { [data->context restoreGraphicsState]; @@ -86,10 +90,10 @@ [NSGraphicsContext setCurrentContext:data->context]; [[NSColor clearColor] set]; - NSRectFill([windata->sdlContentView frame]); + NSRectFill([windata.sdlContentView frame]); data->shape = SDL_CalculateShapeTree(*shape_mode,shape); - closure.view = windata->sdlContentView; + closure.view = windata.sdlContentView; closure.path = [NSBezierPath bezierPath]; closure.window = shaper->window; SDL_TraverseShapeTree(data->shape,&ConvertRects,&closure); diff -Nru libsdl2-2.0.22+dfsg/src/video/cocoa/SDL_cocoavideo.h libsdl2-2.24.0+dfsg/src/video/cocoa/SDL_cocoavideo.h --- libsdl2-2.0.22+dfsg/src/video/cocoa/SDL_cocoavideo.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/cocoa/SDL_cocoavideo.h 2022-08-13 03:48:10.000000000 +0000 @@ -97,18 +97,16 @@ @class SDLTranslatorResponder; -typedef struct SDL_VideoData -{ - int allow_spaces; - unsigned int modifierFlags; - void *key_layout; - SDLTranslatorResponder *fieldEdit; - NSInteger clipboard_count; - Uint32 screensaver_activity; - BOOL screensaver_use_iopm; - IOPMAssertionID screensaver_assertion; - SDL_mutex *swaplock; -} SDL_VideoData; +@interface SDL_VideoData : NSObject + @property (nonatomic) int allow_spaces; + @property (nonatomic) int trackpad_is_touch_only; + @property (nonatomic) unsigned int modifierFlags; + @property (nonatomic) void *key_layout; + @property (nonatomic) SDLTranslatorResponder *fieldEdit; + @property (nonatomic) NSInteger clipboard_count; + @property (nonatomic) IOPMAssertionID screensaver_assertion; + @property (nonatomic) SDL_mutex *swaplock; +@end /* Utility functions */ extern NSImage * Cocoa_CreateImage(SDL_Surface * surface); diff -Nru libsdl2-2.0.22+dfsg/src/video/cocoa/SDL_cocoavideo.m libsdl2-2.24.0+dfsg/src/video/cocoa/SDL_cocoavideo.m --- libsdl2-2.0.22+dfsg/src/video/cocoa/SDL_cocoavideo.m 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/cocoa/SDL_cocoavideo.m 2022-08-13 03:48:10.000000000 +0000 @@ -22,6 +22,10 @@ #if SDL_VIDEO_DRIVER_COCOA +#if !__has_feature(objc_arc) +#error SDL must be built with Objective-C ARC (automatic reference counting) enabled +#endif + #include "SDL.h" #include "SDL_endian.h" #include "SDL_cocoavideo.h" @@ -29,6 +33,10 @@ #include "SDL_cocoavulkan.h" #include "SDL_cocoametalview.h" +@implementation SDL_VideoData + +@end + /* Initialization/Query functions */ static int Cocoa_VideoInit(_THIS); static void Cocoa_VideoQuit(_THIS); @@ -37,16 +45,18 @@ static void Cocoa_DeleteDevice(SDL_VideoDevice * device) +{ @autoreleasepool { if (device->wakeup_lock) { SDL_DestroyMutex(device->wakeup_lock); } - SDL_free(device->driverdata); + CFBridgingRelease(device->driverdata); SDL_free(device); -} +}} static SDL_VideoDevice * -Cocoa_CreateDevice(int devindex) +Cocoa_CreateDevice(void) +{ @autoreleasepool { SDL_VideoDevice *device; SDL_VideoData *data; @@ -56,16 +66,16 @@ /* Initialize all variables that we clean on shutdown */ device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); if (device) { - data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData)); + data = [[SDL_VideoData alloc] init]; } else { - data = NULL; + data = nil; } if (!data) { SDL_OutOfMemory(); SDL_free(device); return NULL; } - device->driverdata = data; + device->driverdata = (void *)CFBridgingRetain(data); device->wakeup_lock = SDL_CreateMutex(); /* Set the function pointers */ @@ -103,6 +113,7 @@ device->SetWindowGammaRamp = Cocoa_SetWindowGammaRamp; device->GetWindowGammaRamp = Cocoa_GetWindowGammaRamp; device->GetWindowICCProfile = Cocoa_GetWindowICCProfile; + device->GetWindowDisplayIndex = Cocoa_GetWindowDisplayIndex; device->SetWindowMouseRect = Cocoa_SetWindowMouseRect; device->SetWindowMouseGrab = Cocoa_SetWindowMouseGrab; device->SetWindowKeyboardGrab = Cocoa_SetWindowKeyboardGrab; @@ -165,7 +176,7 @@ device->free = Cocoa_DeleteDevice; return device; -} +}} VideoBootStrap COCOA_bootstrap = { "cocoa", "SDL Cocoa video driver", @@ -175,8 +186,9 @@ int Cocoa_VideoInit(_THIS) +{ @autoreleasepool { - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + SDL_VideoData *data = (__bridge SDL_VideoData *) _this->driverdata; Cocoa_InitModes(_this); Cocoa_InitKeyboard(_this); @@ -184,29 +196,28 @@ return -1; } - data->allow_spaces = ((floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) && SDL_GetHintBoolean(SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES, SDL_TRUE)); - - /* The IOPM assertion API can disable the screensaver as of 10.7. */ - data->screensaver_use_iopm = floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6; + data.allow_spaces = SDL_GetHintBoolean(SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES, SDL_TRUE); + data.trackpad_is_touch_only = SDL_GetHintBoolean(SDL_HINT_TRACKPAD_IS_TOUCH_ONLY, SDL_FALSE); - data->swaplock = SDL_CreateMutex(); - if (!data->swaplock) { + data.swaplock = SDL_CreateMutex(); + if (!data.swaplock) { return -1; } return 0; -} +}} void Cocoa_VideoQuit(_THIS) +{ @autoreleasepool { - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + SDL_VideoData *data = (__bridge SDL_VideoData *) _this->driverdata; Cocoa_QuitModes(_this); Cocoa_QuitKeyboard(_this); Cocoa_QuitMouse(_this); - SDL_DestroyMutex(data->swaplock); - data->swaplock = NULL; -} + SDL_DestroyMutex(data.swaplock); + data.swaplock = NULL; +}} /* This function assumes that it's called from within an autorelease pool */ NSImage * @@ -223,7 +234,7 @@ return nil; } - imgrep = [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes: NULL + imgrep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes: NULL pixelsWide: converted->w pixelsHigh: converted->h bitsPerSample: 8 @@ -232,7 +243,7 @@ isPlanar: NO colorSpaceName: NSDeviceRGBColorSpace bytesPerRow: converted->pitch - bitsPerPixel: converted->format->BitsPerPixel] autorelease]; + bitsPerPixel: converted->format->BitsPerPixel]; if (imgrep == nil) { SDL_FreeSurface(converted); return nil; @@ -252,7 +263,7 @@ pixels += 4; } - img = [[[NSImage alloc] initWithSize: NSMakeSize(surface->w, surface->h)] autorelease]; + img = [[NSImage alloc] initWithSize: NSMakeSize(surface->w, surface->h)]; if (img != nil) { [img addRepresentation: imgrep]; } @@ -269,11 +280,16 @@ * versions remain identical! */ -void SDL_NSLog(const char *text) +void SDL_NSLog(const char *prefix, const char *text) { @autoreleasepool { - NSString *str = [NSString stringWithUTF8String:text]; - NSLog(@"%@", str); + NSString *nsText = [NSString stringWithUTF8String:text]; + if (prefix) { + NSString *nsPrefix = [NSString stringWithUTF8String:prefix]; + NSLog(@"%@: %@", nsPrefix, nsText); + } else { + NSLog(@"%@", nsText); + } } } diff -Nru libsdl2-2.0.22+dfsg/src/video/cocoa/SDL_cocoawindow.h libsdl2-2.24.0+dfsg/src/video/cocoa/SDL_cocoawindow.h --- libsdl2-2.0.22+dfsg/src/video/cocoa/SDL_cocoawindow.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/cocoa/SDL_cocoawindow.h 2022-08-13 03:48:10.000000000 +0000 @@ -29,7 +29,7 @@ #include "../SDL_egl_c.h" #endif -typedef struct SDL_WindowData SDL_WindowData; +@class SDL_WindowData; typedef enum { @@ -40,7 +40,10 @@ } PendingWindowOperation; @interface Cocoa_WindowListener : NSResponder { - SDL_WindowData *_data; + /* SDL_WindowData owns this Listener and has a strong reference to it. + * To avoid reference cycles, we could have either a weak or an + * unretained ref to the WindowData. */ + __weak SDL_WindowData *_data; BOOL observingVisible; BOOL wasCtrlLeft; BOOL wasVisible; @@ -53,6 +56,7 @@ BOOL isDragAreaRunning; } +-(BOOL) isTouchFromTrackpad:(NSEvent *)theEvent; -(void) listen:(SDL_WindowData *) data; -(void) pauseVisibleObservation; -(void) resumeVisibleObservation; @@ -114,22 +118,23 @@ /* *INDENT-ON* */ @class SDLOpenGLContext; +@class SDL_VideoData; -struct SDL_WindowData -{ - SDL_Window *window; - NSWindow *nswindow; - NSView *sdlContentView; - NSMutableArray *nscontexts; - SDL_bool created; - SDL_bool inWindowFullscreenTransition; - NSInteger flash_request; - Cocoa_WindowListener *listener; - struct SDL_VideoData *videodata; +@interface SDL_WindowData : NSObject + @property (nonatomic) SDL_Window *window; + @property (nonatomic) NSWindow *nswindow; + @property (nonatomic) NSView *sdlContentView; + @property (nonatomic) NSMutableArray *nscontexts; + @property (nonatomic) SDL_bool created; + @property (nonatomic) SDL_bool inWindowFullscreenTransition; + @property (nonatomic) NSInteger window_number; + @property (nonatomic) NSInteger flash_request; + @property (nonatomic) Cocoa_WindowListener *listener; + @property (nonatomic) SDL_VideoData *videodata; #if SDL_VIDEO_OPENGL_EGL - EGLSurface egl_surface; + @property (nonatomic) EGLSurface egl_surface; #endif -}; +@end extern int Cocoa_CreateWindow(_THIS, SDL_Window * window); extern int Cocoa_CreateWindowFrom(_THIS, SDL_Window * window, @@ -153,6 +158,7 @@ extern void Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen); extern int Cocoa_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp); extern void* Cocoa_GetWindowICCProfile(_THIS, SDL_Window * window, size_t * size); +extern int Cocoa_GetWindowDisplayIndex(_THIS, SDL_Window * window); extern int Cocoa_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp); extern void Cocoa_SetWindowMouseRect(_THIS, SDL_Window * window); extern void Cocoa_SetWindowMouseGrab(_THIS, SDL_Window * window, SDL_bool grabbed); diff -Nru libsdl2-2.0.22+dfsg/src/video/cocoa/SDL_cocoawindow.m libsdl2-2.24.0+dfsg/src/video/cocoa/SDL_cocoawindow.m --- libsdl2-2.0.22+dfsg/src/video/cocoa/SDL_cocoawindow.m 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/cocoa/SDL_cocoawindow.m 2022-08-19 15:46:21.000000000 +0000 @@ -62,6 +62,10 @@ #define NSAppKitVersionNumber10_14 1671 #endif +@implementation SDL_WindowData + +@end + @interface NSWindow (SDL) #if MAC_OS_X_VERSION_MAX_ALLOWED < 101000 /* Added in the 10.10 SDK */ @property (readonly) NSRect contentLayoutRect; @@ -119,13 +123,14 @@ - (void)sendEvent:(NSEvent *)event { + id delegate; [super sendEvent:event]; if ([event type] != NSEventTypeLeftMouseUp) { return; } - id delegate = [self delegate]; + delegate = [self delegate]; if (![delegate isKindOfClass:[Cocoa_WindowListener class]]) { return; } @@ -159,24 +164,29 @@ NSArray *types = [NSArray arrayWithObject:NSFilenamesPboardType]; NSString *desiredType = [pasteboard availableTypeFromArray:types]; SDL_Window *sdlwindow = [self findSDLWindow]; + NSData *data; + NSArray *array; + NSPoint point; + SDL_Mouse *mouse; + int x, y; if (desiredType == nil) { return NO; /* can't accept anything that's being dropped here. */ } - NSData *data = [pasteboard dataForType:desiredType]; + data = [pasteboard dataForType:desiredType]; if (data == nil) { return NO; } SDL_assert([desiredType isEqualToString:NSFilenamesPboardType]); - NSArray *array = [pasteboard propertyListForType:@"NSFilenamesPboardType"]; + array = [pasteboard propertyListForType:@"NSFilenamesPboardType"]; /* Code addon to update the mouse location */ - NSPoint point = [sender draggingLocation]; - SDL_Mouse *mouse = SDL_GetMouse(); - int x = (int)point.x; - int y = (int)(sdlwindow->h - point.y); + point = [sender draggingLocation]; + mouse = SDL_GetMouse(); + x = (int)point.x; + y = (int)(sdlwindow->h - point.y); if (x >= 0 && x < sdlwindow->w && y >= 0 && y < sdlwindow->h) { SDL_SendMouseMotion(sdlwindow, mouse->mouseID, 0, x, y); } @@ -227,7 +237,7 @@ /* !!! FIXME: is there a better way to do this? */ if (_this) { for (sdlwindow = _this->windows; sdlwindow; sdlwindow = sdlwindow->next) { - NSWindow *nswindow = ((SDL_WindowData *) sdlwindow->driverdata)->nswindow; + NSWindow *nswindow = ((__bridge SDL_WindowData *) sdlwindow->driverdata).nswindow; if (nswindow == self) { break; } @@ -250,7 +260,9 @@ static void ScheduleContextUpdates(SDL_WindowData *data) { - if (!data || !data->nscontexts) { + NSOpenGLContext *currentContext; + NSMutableArray *contexts; + if (!data || !data.nscontexts) { return; } @@ -260,8 +272,8 @@ #pragma clang diagnostic ignored "-Wdeprecated-declarations" #endif - NSOpenGLContext *currentContext = [NSOpenGLContext currentContext]; - NSMutableArray *contexts = data->nscontexts; + currentContext = [NSOpenGLContext currentContext]; + contexts = data.nscontexts; @synchronized (contexts) { for (SDLOpenGLContext *context in contexts) { if (context == currentContext) { @@ -287,12 +299,14 @@ static NSUInteger GetWindowWindowedStyle(SDL_Window * window) { - NSUInteger style = 0; + /* always allow miniaturization, otherwise you can't programatically + minimize the window, whether there's a title bar or not */ + NSUInteger style = NSWindowStyleMaskMiniaturizable; if (window->flags & SDL_WINDOW_BORDERLESS) { - style = NSWindowStyleMaskBorderless; + style |= NSWindowStyleMaskBorderless; } else { - style = (NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskMiniaturizable); + style |= (NSWindowStyleMaskTitled|NSWindowStyleMaskClosable); } if (window->flags & SDL_WINDOW_RESIZABLE) { style |= NSWindowStyleMaskResizable; @@ -316,19 +330,19 @@ static SDL_bool SetWindowStyle(SDL_Window * window, NSUInteger style) { - SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - NSWindow *nswindow = data->nswindow; + SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; + NSWindow *nswindow = data.nswindow; /* The view responder chain gets messed with during setStyleMask */ - if ([data->sdlContentView nextResponder] == data->listener) { - [data->sdlContentView setNextResponder:nil]; + if ([data.sdlContentView nextResponder] == data.listener) { + [data.sdlContentView setNextResponder:nil]; } [nswindow setStyleMask:style]; /* The view responder chain gets messed with during setStyleMask */ - if ([data->sdlContentView nextResponder] != data->listener) { - [data->sdlContentView setNextResponder:data->listener]; + if ([data.sdlContentView nextResponder] != data.listener) { + [data.sdlContentView setNextResponder:data.listener]; } return SDL_TRUE; @@ -337,9 +351,9 @@ static SDL_bool ShouldAdjustCoordinatesForGrab(SDL_Window * window) { - SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; - if (!data || [data->listener isMovingOrFocusClickPending]) { + if (!data || [data.listener isMovingOrFocusClickPending]) { return SDL_FALSE; } @@ -396,10 +410,10 @@ static void Cocoa_UpdateClipCursor(SDL_Window * window) { - SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; if (NSAppKitVersionNumber >= NSAppKitVersionNumber10_13_2) { - NSWindow *nswindow = data->nswindow; + NSWindow *nswindow = data.nswindow; SDL_Rect mouse_rect; SDL_zero(mouse_rect); @@ -453,8 +467,8 @@ - (void)listen:(SDL_WindowData *)data { NSNotificationCenter *center; - NSWindow *window = data->nswindow; - NSView *view = data->sdlContentView; + NSWindow *window = data.nswindow; + NSView *view = data.sdlContentView; _data = data; observingVisible = YES; @@ -515,12 +529,12 @@ return; } - if (object == _data->nswindow && [keyPath isEqualToString:@"visible"]) { + if (object == _data.nswindow && [keyPath isEqualToString:@"visible"]) { int newVisibility = [[change objectForKey:@"new"] intValue]; if (newVisibility) { - SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_SHOWN, 0, 0); + SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_SHOWN, 0, 0); } else { - SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_HIDDEN, 0, 0); + SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_HIDDEN, 0, 0); } } } @@ -528,18 +542,18 @@ -(void) pauseVisibleObservation { observingVisible = NO; - wasVisible = [_data->nswindow isVisible]; + wasVisible = [_data.nswindow isVisible]; } -(void) resumeVisibleObservation { - BOOL isVisible = [_data->nswindow isVisible]; + BOOL isVisible = [_data.nswindow isVisible]; observingVisible = YES; if (wasVisible != isVisible) { if (isVisible) { - SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_SHOWN, 0, 0); + SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_SHOWN, 0, 0); } else { - SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_HIDDEN, 0, 0); + SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_HIDDEN, 0, 0); } wasVisible = isVisible; @@ -548,11 +562,11 @@ -(BOOL) setFullscreenSpace:(BOOL) state { - SDL_Window *window = _data->window; - NSWindow *nswindow = _data->nswindow; - SDL_VideoData *videodata = ((SDL_WindowData *) window->driverdata)->videodata; + SDL_Window *window = _data.window; + NSWindow *nswindow = _data.nswindow; + SDL_VideoData *videodata = ((__bridge SDL_WindowData *) window->driverdata).videodata; - if (!videodata->allow_spaces) { + if (!videodata.allow_spaces) { return NO; /* Spaces are forcibly disabled. */ } else if (state && ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP)) { return NO; /* we only allow you to make a Space on FULLSCREEN_DESKTOP windows. */ @@ -596,7 +610,7 @@ - (void)close { NSNotificationCenter *center; - NSWindow *window = _data->nswindow; + NSWindow *window = _data.nswindow; NSView *view = [window contentView]; center = [NSNotificationCenter defaultCenter]; @@ -678,15 +692,15 @@ mouse->WarpMouseGlobal(pendingWindowWarpX, pendingWindowWarpY); pendingWindowWarpX = pendingWindowWarpY = INT_MAX; } - if (mouse->relative_mode && !mouse->relative_mode_warp && mouse->focus == _data->window) { + if (mouse->relative_mode && !mouse->relative_mode_warp && mouse->focus == _data.window) { /* Move the cursor to the nearest point in the window */ { int x, y; CGPoint cgpoint; SDL_GetMouseState(&x, &y); - cgpoint.x = _data->window->x + x; - cgpoint.y = _data->window->y + y; + cgpoint.x = _data.window->x + x; + cgpoint.y = _data.window->y + y; Cocoa_HandleMouseWarp(cgpoint.x, cgpoint.y); @@ -696,25 +710,25 @@ mouse->SetRelativeMouseMode(SDL_TRUE); } else { - Cocoa_UpdateClipCursor(_data->window); + Cocoa_UpdateClipCursor(_data.window); } } } - (BOOL)windowShouldClose:(id)sender { - SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_CLOSE, 0, 0); + SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_CLOSE, 0, 0); return NO; } - (void)windowDidExpose:(NSNotification *)aNotification { - SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_EXPOSED, 0, 0); + SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_EXPOSED, 0, 0); } - (void)windowWillMove:(NSNotification *)aNotification { - if ([_data->nswindow isKindOfClass:[SDLWindow class]]) { + if ([_data.nswindow isKindOfClass:[SDLWindow class]]) { pendingWindowWarpX = pendingWindowWarpY = INT_MAX; isMoving = YES; } @@ -723,8 +737,8 @@ - (void)windowDidMove:(NSNotification *)aNotification { int x, y; - SDL_Window *window = _data->window; - NSWindow *nswindow = _data->nswindow; + SDL_Window *window = _data.window; + NSWindow *nswindow = _data.nswindow; BOOL fullscreen = window->flags & FULLSCREEN_MASK; NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]]; ConvertNSRect([nswindow screen], fullscreen, &rect); @@ -759,15 +773,19 @@ - (void)windowDidResize:(NSNotification *)aNotification { + SDL_Window *window; + NSWindow *nswindow; + NSRect rect; + int x, y, w, h; + BOOL zoomed; if (inFullscreenTransition) { /* We'll take care of this at the end of the transition */ return; } - SDL_Window *window = _data->window; - NSWindow *nswindow = _data->nswindow; - int x, y, w, h; - NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]]; + window = _data.window; + nswindow = _data.nswindow; + rect = [nswindow contentRectForFrameRect:[nswindow frame]]; ConvertNSRect([nswindow screen], (window->flags & FULLSCREEN_MASK), &rect); x = (int)rect.origin.x; y = (int)rect.origin.y; @@ -785,7 +803,7 @@ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, x, y); SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, w, h); - const BOOL zoomed = [nswindow isZoomed]; + zoomed = [nswindow isZoomed]; if (!zoomed) { SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0); } else if (zoomed) { @@ -799,17 +817,17 @@ focusClickPending = 0; [self onMovingOrFocusClickPendingStateCleared]; } - SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_MINIMIZED, 0, 0); + SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_MINIMIZED, 0, 0); } - (void)windowDidDeminiaturize:(NSNotification *)aNotification { - SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_RESTORED, 0, 0); + SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_RESTORED, 0, 0); } - (void)windowDidBecomeKey:(NSNotification *)aNotification { - SDL_Window *window = _data->window; + SDL_Window *window = _data.window; SDL_Mouse *mouse = SDL_GetMouse(); /* We're going to get keyboard events, since we're key. */ @@ -825,7 +843,7 @@ NSPoint point; int x, y; - point = [_data->nswindow mouseLocationOutsideOfEventStream]; + point = [_data.nswindow mouseLocationOutsideOfEventStream]; x = (int)point.x; y = (int)(window->h - point.y); @@ -835,15 +853,16 @@ } /* Check to see if someone updated the clipboard */ - Cocoa_CheckClipboardUpdate(_data->videodata); + Cocoa_CheckClipboardUpdate(_data.videodata); if ((isFullscreenSpace) && ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP)) { [NSMenu setMenuBarVisible:NO]; } - - const unsigned int newflags = [NSEvent modifierFlags] & NSEventModifierFlagCapsLock; - _data->videodata->modifierFlags = (_data->videodata->modifierFlags & ~NSEventModifierFlagCapsLock) | newflags; - SDL_ToggleModState(KMOD_CAPS, newflags != 0); + { + const unsigned int newflags = [NSEvent modifierFlags] & NSEventModifierFlagCapsLock; + _data.videodata.modifierFlags = (_data.videodata.modifierFlags & ~NSEventModifierFlagCapsLock) | newflags; + SDL_ToggleModState(KMOD_CAPS, newflags != 0); + } } - (void)windowDidResignKey:(NSNotification *)aNotification @@ -854,12 +873,12 @@ } /* Some other window will get mouse events, since we're not key. */ - if (SDL_GetMouseFocus() == _data->window) { + if (SDL_GetMouseFocus() == _data.window) { SDL_SetMouseFocus(NULL); } /* Some other window will get keyboard events, since we're not key. */ - if (SDL_GetKeyboardFocus() == _data->window) { + if (SDL_GetKeyboardFocus() == _data.window) { SDL_SetKeyboardFocus(NULL); } @@ -876,22 +895,22 @@ return; } - if ([oldscale doubleValue] != [_data->nswindow backingScaleFactor]) { + if ([oldscale doubleValue] != [_data.nswindow backingScaleFactor]) { /* Force a resize event when the backing scale factor changes. */ - _data->window->w = 0; - _data->window->h = 0; + _data.window->w = 0; + _data.window->h = 0; [self windowDidResize:aNotification]; } } - (void)windowDidChangeScreenProfile:(NSNotification *)aNotification { - SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_ICCPROF_CHANGED, 0, 0); + SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_ICCPROF_CHANGED, 0, 0); } - (void)windowWillEnterFullScreen:(NSNotification *)aNotification { - SDL_Window *window = _data->window; + SDL_Window *window = _data.window; SetWindowStyle(window, (NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskMiniaturizable|NSWindowStyleMaskResizable)); @@ -901,7 +920,7 @@ - (void)windowDidFailToEnterFullScreen:(NSNotification *)aNotification { - SDL_Window *window = _data->window; + SDL_Window *window = _data.window; if (window->is_destroying) { return; @@ -917,9 +936,7 @@ - (void)windowDidEnterFullScreen:(NSNotification *)aNotification { - SDL_Window *window = _data->window; - SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - NSWindow *nswindow = data->nswindow; + SDL_Window *window = _data.window; inFullscreenTransition = NO; @@ -927,11 +944,6 @@ pendingWindowOperation = PENDING_OPERATION_NONE; [self setFullscreenSpace:NO]; } else { - /* Unset the resizable flag. - This is a workaround for https://bugzilla.libsdl.org/show_bug.cgi?id=3697 - */ - SetWindowStyle(window, [nswindow styleMask] & (~NSWindowStyleMaskResizable)); - if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) { [NSMenu setMenuBarVisible:NO]; } @@ -949,7 +961,7 @@ - (void)windowWillExitFullScreen:(NSNotification *)aNotification { - SDL_Window *window = _data->window; + SDL_Window *window = _data.window; isFullscreenSpace = NO; inFullscreenTransition = YES; @@ -967,7 +979,7 @@ - (void)windowDidFailToExitFullScreen:(NSNotification *)aNotification { - SDL_Window *window = _data->window; + SDL_Window *window = _data.window; if (window->is_destroying) { return; @@ -983,8 +995,8 @@ - (void)windowDidExitFullScreen:(NSNotification *)aNotification { - SDL_Window *window = _data->window; - NSWindow *nswindow = _data->nswindow; + SDL_Window *window = _data.window; + NSWindow *nswindow = _data.nswindow; NSButton *button = nil; inFullscreenTransition = NO; @@ -1077,7 +1089,7 @@ -(NSApplicationPresentationOptions)window:(NSWindow *)window willUseFullScreenPresentationOptions:(NSApplicationPresentationOptions)proposedOptions { - if ((_data->window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) { + if ((_data.window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) { return NSApplicationPresentationFullScreen | NSApplicationPresentationHideDock | NSApplicationPresentationHideMenuBar; } else { return proposedOptions; @@ -1127,16 +1139,16 @@ - (BOOL)processHitTest:(NSEvent *)theEvent { - SDL_assert(isDragAreaRunning == [_data->nswindow isMovableByWindowBackground]); + SDL_assert(isDragAreaRunning == [_data.nswindow isMovableByWindowBackground]); - if (_data->window->hit_test) { /* if no hit-test, skip this. */ + if (_data.window->hit_test) { /* if no hit-test, skip this. */ const NSPoint location = [theEvent locationInWindow]; - const SDL_Point point = { (int) location.x, _data->window->h - (((int) location.y)-1) }; - const SDL_HitTestResult rc = _data->window->hit_test(_data->window, &point, _data->window->hit_test_data); + const SDL_Point point = { (int) location.x, _data.window->h - (((int) location.y)-1) }; + const SDL_HitTestResult rc = _data.window->hit_test(_data.window, &point, _data.window->hit_test_data); if (rc == SDL_HITTEST_DRAGGABLE) { if (!isDragAreaRunning) { isDragAreaRunning = YES; - [_data->nswindow setMovableByWindowBackground:YES]; + [_data.nswindow setMovableByWindowBackground:YES]; } return YES; /* dragging! */ } @@ -1144,7 +1156,7 @@ if (isDragAreaRunning) { isDragAreaRunning = NO; - [_data->nswindow setMovableByWindowBackground:NO]; + [_data.nswindow setMovableByWindowBackground:NO]; return YES; /* was dragging, drop event. */ } @@ -1164,7 +1176,7 @@ // the position in the currently-focused window. We don't (currently) send a mousemove // event for the background window, this just makes sure the button is reported at the // correct position in its own event. - if ( focus && ([theEvent window] == ((SDL_WindowData *) focus->driverdata)->nswindow) ) { + if ( focus && ([theEvent window] == ((__bridge SDL_WindowData *) focus->driverdata).nswindow) ) { rc = SDL_SendMouseButtonClicks(window, mouseID, state, button, clicks); } else { const int orig_x = mouse->x; @@ -1183,12 +1195,12 @@ - (void)mouseDown:(NSEvent *)theEvent { SDL_Mouse *mouse = SDL_GetMouse(); + int button; + if (!mouse) { return; } - int button; - /* Ignore events that aren't inside the client area (i.e. title bar.) */ if ([theEvent window]) { NSRect windowRect = [[[theEvent window] contentView] frame]; @@ -1198,7 +1210,7 @@ } if ([self processHitTest:theEvent]) { - SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_HIT_TEST, 0, 0); + SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_HIT_TEST, 0, 0); return; /* dragging, drop event. */ } @@ -1224,7 +1236,7 @@ break; } - Cocoa_SendMouseButtonClicks(mouse, theEvent, _data->window, SDL_PRESSED, button); + Cocoa_SendMouseButtonClicks(mouse, theEvent, _data.window, SDL_PRESSED, button); } - (void)rightMouseDown:(NSEvent *)theEvent @@ -1240,14 +1252,14 @@ - (void)mouseUp:(NSEvent *)theEvent { SDL_Mouse *mouse = SDL_GetMouse(); + int button; + if (!mouse) { return; } - int button; - if ([self processHitTest:theEvent]) { - SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_HIT_TEST, 0, 0); + SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_HIT_TEST, 0, 0); return; /* stopped dragging, drop event. */ } @@ -1271,7 +1283,7 @@ break; } - Cocoa_SendMouseButtonClicks(mouse, theEvent, _data->window, SDL_RELEASED, button); + Cocoa_SendMouseButtonClicks(mouse, theEvent, _data.window, SDL_RELEASED, button); } - (void)rightMouseUp:(NSEvent *)theEvent @@ -1287,14 +1299,17 @@ - (void)mouseMoved:(NSEvent *)theEvent { SDL_Mouse *mouse = SDL_GetMouse(); + SDL_MouseID mouseID; + NSPoint point; + int x, y; + SDL_Window *window; + if (!mouse) { return; } - const SDL_MouseID mouseID = mouse->mouseID; - SDL_Window *window = _data->window; - NSPoint point; - int x, y; + mouseID = mouse->mouseID; + window = _data.window; if ([self processHitTest:theEvent]) { SDL_SendWindowEvent(window, SDL_WINDOWEVENT_HIT_TEST, 0, 0); @@ -1341,29 +1356,46 @@ - (void)scrollWheel:(NSEvent *)theEvent { - Cocoa_HandleMouseWheel(_data->window, theEvent); + Cocoa_HandleMouseWheel(_data.window, theEvent); } -- (void)touchesBeganWithEvent:(NSEvent *) theEvent + +- (BOOL)isTouchFromTrackpad:(NSEvent *)theEvent { - /* probably a MacBook trackpad; make this look like a synthesized event. - This is backwards from reality, but better matches user expectations. */ + SDL_Window *window = _data.window; + SDL_VideoData *videodata = ((__bridge SDL_WindowData *) window->driverdata).videodata; + + /* if this a MacBook trackpad, we'll make input look like a synthesized + event. This is backwards from reality, but better matches user + expectations. You can make it look like a generic touch device instead + with the SDL_HINT_TRACKPAD_IS_TOUCH_ONLY hint. */ BOOL istrackpad = NO; - @try { - istrackpad = ([theEvent subtype] == NSEventSubtypeMouseEvent); - } - @catch (NSException *e) { - /* if NSEvent type doesn't have subtype, such as NSEventTypeBeginGesture on - * macOS 10.5 to 10.10, then NSInternalInconsistencyException is thrown. - * This still prints a message to terminal so catching it's not an ideal solution. - * - * *** Assertion failure in -[NSEvent subtype] - */ + if (!videodata.trackpad_is_touch_only) { + @try { + istrackpad = ([theEvent subtype] == NSEventSubtypeMouseEvent); + } + @catch (NSException *e) { + /* if NSEvent type doesn't have subtype, such as NSEventTypeBeginGesture on + * macOS 10.5 to 10.10, then NSInternalInconsistencyException is thrown. + * This still prints a message to terminal so catching it's not an ideal solution. + * + * *** Assertion failure in -[NSEvent subtype] + */ + } } + return istrackpad; +} - NSSet *touches = [theEvent touchesMatchingPhase:NSTouchPhaseAny inView:nil]; - const SDL_TouchID touchID = istrackpad ? SDL_MOUSE_TOUCHID : (SDL_TouchID)(intptr_t)[[touches anyObject] device]; - int existingTouchCount = 0; +- (void)touchesBeganWithEvent:(NSEvent *) theEvent +{ + NSSet *touches; + SDL_TouchID touchID; + int existingTouchCount; + const BOOL istrackpad = [self isTouchFromTrackpad:theEvent]; + + touches = [theEvent touchesMatchingPhase:NSTouchPhaseAny inView:nil]; + touchID = istrackpad ? SDL_MOUSE_TOUCHID : (SDL_TouchID)(intptr_t)[[touches anyObject] device]; + existingTouchCount = 0; for (NSTouch* touch in touches) { if ([touch phase] != NSTouchPhaseBegan) { @@ -1407,21 +1439,9 @@ - (void)handleTouches:(NSTouchPhase) phase withEvent:(NSEvent *) theEvent { NSSet *touches = [theEvent touchesMatchingPhase:phase inView:nil]; - - /* probably a MacBook trackpad; make this look like a synthesized event. - This is backwards from reality, but better matches user expectations. */ - BOOL istrackpad = NO; - @try { - istrackpad = ([theEvent subtype] == NSEventSubtypeMouseEvent); - } - @catch (NSException *e) { - /* if NSEvent type doesn't have subtype, such as NSEventTypeBeginGesture on - * macOS 10.5 to 10.10, then NSInternalInconsistencyException is thrown. - * This still prints a message to terminal so catching it's not an ideal solution. - * - * *** Assertion failure in -[NSEvent subtype] - */ - } + const BOOL istrackpad = [self isTouchFromTrackpad:theEvent]; + SDL_FingerID fingerId; + float x, y; for (NSTouch *touch in touches) { const SDL_TouchID touchId = istrackpad ? SDL_MOUSE_TOUCHID : (SDL_TouchID)(intptr_t)[touch device]; @@ -1453,9 +1473,9 @@ return; } - const SDL_FingerID fingerId = (SDL_FingerID)(intptr_t)[touch identity]; - float x = [touch normalizedPosition].x; - float y = [touch normalizedPosition].y; + fingerId = (SDL_FingerID)(intptr_t)[touch identity]; + x = [touch normalizedPosition].x; + y = [touch normalizedPosition].y; /* Make the origin the upper left instead of the lower left */ y = 1.0f - y; @@ -1531,7 +1551,7 @@ white until the app is ready to draw. In practice on modern macOS, this only gets called for window creation and other extraordinary events. */ self.layer.backgroundColor = CGColorGetConstantColor(kCGColorBlack); - ScheduleContextUpdates((SDL_WindowData *) _sdlWindow->driverdata); + ScheduleContextUpdates((__bridge SDL_WindowData *) _sdlWindow->driverdata); SDL_SendWindowEvent(_sdlWindow, SDL_WINDOWEVENT_EXPOSED, 0, 0); } @@ -1550,12 +1570,13 @@ - (void)resetCursorRects { + SDL_Mouse *mouse; [super resetCursorRects]; - SDL_Mouse *mouse = SDL_GetMouse(); + mouse = SDL_GetMouse(); if (mouse->cursor_shown && mouse->cur_cursor && !mouse->relative_mode) { [self addCursorRect:[self bounds] - cursor:mouse->cur_cursor->driverdata]; + cursor:(__bridge NSCursor *)mouse->cur_cursor->driverdata]; } else { [self addCursorRect:[self bounds] cursor:[NSCursor invisibleCursor]]; @@ -1576,23 +1597,24 @@ SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, NSView *nsview, SDL_bool created) { @autoreleasepool { - SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; + SDL_VideoData *videodata = (__bridge SDL_VideoData *) _this->driverdata; SDL_WindowData *data; /* Allocate the window data */ - window->driverdata = data = (SDL_WindowData *) SDL_calloc(1, sizeof(*data)); + data = [[SDL_WindowData alloc] init]; if (!data) { return SDL_OutOfMemory(); } - data->window = window; - data->nswindow = nswindow; - data->created = created; - data->videodata = videodata; - data->nscontexts = [[NSMutableArray alloc] init]; - data->sdlContentView = nsview; + data.window = window; + data.nswindow = nswindow; + data.created = created; + data.videodata = videodata; + data.window_number = nswindow.windowNumber; + data.nscontexts = [[NSMutableArray alloc] init]; + data.sdlContentView = nsview; /* Create an event listener for the window */ - data->listener = [[Cocoa_WindowListener alloc] init]; + data.listener = [[Cocoa_WindowListener alloc] init]; /* Fill in the SDL window with the window data */ { @@ -1605,7 +1627,7 @@ } /* Set up the listener after we create the view */ - [data->listener listen:data]; + [data.listener listen:data]; if ([nswindow isVisible]) { window->flags |= SDL_WINDOW_SHOWN; @@ -1646,16 +1668,22 @@ if ([nswindow isKeyWindow]) { window->flags |= SDL_WINDOW_INPUT_FOCUS; - SDL_SetKeyboardFocus(data->window); + SDL_SetKeyboardFocus(data.window); } + /* SDL_WindowData will be holding a strong reference to the NSWindow, and + * it will also call [NSWindow close] in DestroyWindow before releasing the + * NSWindow, so the extra release provided by releasedWhenClosed isn't + * necessary. */ + nswindow.releasedWhenClosed = NO; + /* Prevents the window's "window device" from being destroyed when it is * hidden. See http://www.mikeash.com/pyblog/nsopenglcontext-and-one-shot.html */ [nswindow setOneShot:NO]; /* All done! */ - window->driverdata = data; + window->driverdata = (void *)CFBridgingRetain(data); return 0; }} @@ -1663,13 +1691,16 @@ Cocoa_CreateWindow(_THIS, SDL_Window * window) { @autoreleasepool { - SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; + SDL_VideoData *videodata = (__bridge SDL_VideoData *) _this->driverdata; NSWindow *nswindow; SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); NSRect rect; SDL_Rect bounds; NSUInteger style; NSArray *screens = [NSScreen screens]; + NSScreen *screen = nil; + SDLView *contentView; + BOOL highdpi; Cocoa_GetDisplayBounds(_this, display, &bounds); rect.origin.x = window->x; @@ -1681,7 +1712,6 @@ style = GetWindowStyle(window); /* Figure out which screen to place this window */ - NSScreen *screen = nil; for (NSScreen *candidate in screens) { NSRect screenRect = [candidate frame]; if (rect.origin.x >= screenRect.origin.x && @@ -1708,9 +1738,7 @@ } #endif - if (videodata->allow_spaces) { - SDL_assert(floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6); - SDL_assert([nswindow respondsToSelector:@selector(toggleFullScreen:)]); + if (videodata.allow_spaces) { /* we put FULLSCREEN_DESKTOP windows in their own Space, without a toggle button or menubar, later */ if (window->flags & SDL_WINDOW_RESIZABLE) { /* resizable windows are Spaces-friendly: they get the "go fullscreen" toggle button on their titlebar. */ @@ -1724,7 +1752,7 @@ /* Create a default view for this window */ rect = [nswindow contentRectForFrameRect:[nswindow frame]]; - SDLView *contentView = [[SDLView alloc] initWithFrame:rect]; + contentView = [[SDLView alloc] initWithFrame:rect]; [contentView setSDLWindow:window]; /* We still support OpenGL as long as Apple offers it, deprecated or not, so disable deprecation warnings about it. */ @@ -1734,10 +1762,8 @@ #endif /* Note: as of the macOS 10.15 SDK, this defaults to YES instead of NO when * the NSHighResolutionCapable boolean is set in Info.plist. */ - if ([contentView respondsToSelector:@selector(setWantsBestResolutionOpenGLSurface:)]) { - BOOL highdpi = (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) != 0; - [contentView setWantsBestResolutionOpenGLSurface:highdpi]; - } + highdpi = (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) != 0; + [contentView setWantsBestResolutionOpenGLSurface:highdpi]; #ifdef __clang__ #pragma clang diagnostic pop #endif @@ -1751,10 +1777,8 @@ #endif /* SDL_VIDEO_OPENGL_EGL */ #endif /* SDL_VIDEO_OPENGL_ES2 */ [nswindow setContentView:contentView]; - [contentView release]; if (SetupWindowData(_this, window, nswindow, contentView, SDL_TRUE) < 0) { - [nswindow release]; return -1; } @@ -1785,19 +1809,19 @@ { NSView* nsview = nil; NSWindow *nswindow = nil; + NSString *title; + BOOL highdpi; - if ([(id)data isKindOfClass:[NSWindow class]]) { - nswindow = (NSWindow*)data; + if ([(__bridge id)data isKindOfClass:[NSWindow class]]) { + nswindow = (__bridge NSWindow*)data; nsview = [nswindow contentView]; - } else if ([(id)data isKindOfClass:[NSView class]]) { - nsview = (NSView*)data; + } else if ([(__bridge id)data isKindOfClass:[NSView class]]) { + nsview = (__bridge NSView*)data; nswindow = [nsview window]; } else { SDL_assert(false); } - NSString *title; - /* Query the title from the existing window */ title = [nswindow title]; if (title) { @@ -1811,10 +1835,8 @@ #endif /* Note: as of the macOS 10.15 SDK, this defaults to YES instead of NO when * the NSHighResolutionCapable boolean is set in Info.plist. */ - if ([nsview respondsToSelector:@selector(setWantsBestResolutionOpenGLSurface:)]) { - BOOL highdpi = (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) != 0; - [nsview setWantsBestResolutionOpenGLSurface:highdpi]; - } + highdpi = (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) != 0; + [nsview setWantsBestResolutionOpenGLSurface:highdpi]; #ifdef __clang__ #pragma clang diagnostic pop #endif @@ -1827,10 +1849,9 @@ { @autoreleasepool { const char *title = window->title ? window->title : ""; - NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow; + NSWindow *nswindow = ((__bridge SDL_WindowData *) window->driverdata).nswindow; NSString *string = [[NSString alloc] initWithUTF8String:title]; [nswindow setTitle:string]; - [string release]; }} void @@ -1848,8 +1869,8 @@ Cocoa_SetWindowPosition(_THIS, SDL_Window * window) { @autoreleasepool { - SDL_WindowData *windata = (SDL_WindowData *) window->driverdata; - NSWindow *nswindow = windata->nswindow; + SDL_WindowData *windata = (__bridge SDL_WindowData *) window->driverdata; + NSWindow *nswindow = windata.nswindow; NSRect rect; Uint32 moveHack; @@ -1871,8 +1892,8 @@ Cocoa_SetWindowSize(_THIS, SDL_Window * window) { @autoreleasepool { - SDL_WindowData *windata = (SDL_WindowData *) window->driverdata; - NSWindow *nswindow = windata->nswindow; + SDL_WindowData *windata = (__bridge SDL_WindowData *) window->driverdata; + NSWindow *nswindow = windata.nswindow; NSRect rect; Uint32 moveHack; @@ -1898,39 +1919,39 @@ Cocoa_SetWindowMinimumSize(_THIS, SDL_Window * window) { @autoreleasepool { - SDL_WindowData *windata = (SDL_WindowData *) window->driverdata; + SDL_WindowData *windata = (__bridge SDL_WindowData *) window->driverdata; NSSize minSize; minSize.width = window->min_w; minSize.height = window->min_h; - [windata->nswindow setContentMinSize:minSize]; + [windata.nswindow setContentMinSize:minSize]; }} void Cocoa_SetWindowMaximumSize(_THIS, SDL_Window * window) { @autoreleasepool { - SDL_WindowData *windata = (SDL_WindowData *) window->driverdata; + SDL_WindowData *windata = (__bridge SDL_WindowData *) window->driverdata; NSSize maxSize; maxSize.width = window->max_w; maxSize.height = window->max_h; - [windata->nswindow setContentMaxSize:maxSize]; + [windata.nswindow setContentMaxSize:maxSize]; }} void Cocoa_ShowWindow(_THIS, SDL_Window * window) { @autoreleasepool { - SDL_WindowData *windowData = ((SDL_WindowData *) window->driverdata); - NSWindow *nswindow = windowData->nswindow; + SDL_WindowData *windowData = ((__bridge SDL_WindowData *) window->driverdata); + NSWindow *nswindow = windowData.nswindow; if (![nswindow isMiniaturized]) { - [windowData->listener pauseVisibleObservation]; + [windowData.listener pauseVisibleObservation]; [nswindow makeKeyAndOrderFront:nil]; - [windowData->listener resumeVisibleObservation]; + [windowData.listener resumeVisibleObservation]; } }} @@ -1938,7 +1959,7 @@ Cocoa_HideWindow(_THIS, SDL_Window * window) { @autoreleasepool { - NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow; + NSWindow *nswindow = ((__bridge SDL_WindowData *) window->driverdata).nswindow; [nswindow orderOut:nil]; }} @@ -1947,26 +1968,26 @@ Cocoa_RaiseWindow(_THIS, SDL_Window * window) { @autoreleasepool { - SDL_WindowData *windowData = ((SDL_WindowData *) window->driverdata); - NSWindow *nswindow = windowData->nswindow; + SDL_WindowData *windowData = ((__bridge SDL_WindowData *) window->driverdata); + NSWindow *nswindow = windowData.nswindow; /* makeKeyAndOrderFront: has the side-effect of deminiaturizing and showing a minimized or hidden window, so check for that before showing it. */ - [windowData->listener pauseVisibleObservation]; + [windowData.listener pauseVisibleObservation]; if (![nswindow isMiniaturized] && [nswindow isVisible]) { [NSApp activateIgnoringOtherApps:YES]; [nswindow makeKeyAndOrderFront:nil]; } - [windowData->listener resumeVisibleObservation]; + [windowData.listener resumeVisibleObservation]; }} void Cocoa_MaximizeWindow(_THIS, SDL_Window * window) { @autoreleasepool { - SDL_WindowData *windata = (SDL_WindowData *) window->driverdata; - NSWindow *nswindow = windata->nswindow; + SDL_WindowData *windata = (__bridge SDL_WindowData *) window->driverdata; + NSWindow *nswindow = windata.nswindow; [nswindow zoom:nil]; @@ -1977,10 +1998,10 @@ Cocoa_MinimizeWindow(_THIS, SDL_Window * window) { @autoreleasepool { - SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - NSWindow *nswindow = data->nswindow; - if ([data->listener isInFullscreenSpaceTransition]) { - [data->listener addPendingWindowOperation:PENDING_OPERATION_MINIMIZE]; + SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; + NSWindow *nswindow = data.nswindow; + if ([data.listener isInFullscreenSpaceTransition]) { + [data.listener addPendingWindowOperation:PENDING_OPERATION_MINIMIZE]; } else { [nswindow miniaturize:nil]; } @@ -1990,7 +2011,7 @@ Cocoa_RestoreWindow(_THIS, SDL_Window * window) { @autoreleasepool { - NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow; + NSWindow *nswindow = ((__bridge SDL_WindowData *) window->driverdata).nswindow; if ([nswindow isMiniaturized]) { [nswindow deminiaturize:nil]; @@ -2018,14 +2039,14 @@ * The window will get permanently stuck if resizable is false. * -flibit */ - SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - Cocoa_WindowListener *listener = data->listener; - NSWindow *nswindow = data->nswindow; - SDL_VideoData *videodata = ((SDL_WindowData *) window->driverdata)->videodata; + SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; + Cocoa_WindowListener *listener = data.listener; + NSWindow *nswindow = data.nswindow; + SDL_VideoData *videodata = data.videodata; if (![listener isInFullscreenSpace]) { SetWindowStyle(window, GetWindowStyle(window)); } - if (videodata->allow_spaces) { + if (videodata.allow_spaces) { if (resizable) { /* resizable windows are Spaces-friendly: they get the "go fullscreen" toggle button on their titlebar. */ [nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; @@ -2039,7 +2060,7 @@ Cocoa_SetWindowAlwaysOnTop(_THIS, SDL_Window * window, SDL_bool on_top) { @autoreleasepool { - NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow; + NSWindow *nswindow = ((__bridge SDL_WindowData *) window->driverdata).nswindow; if (on_top) { [nswindow setLevel:NSFloatingWindowLevel]; } else { @@ -2051,13 +2072,13 @@ Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen) { @autoreleasepool { - SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - NSWindow *nswindow = data->nswindow; + SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; + NSWindow *nswindow = data.nswindow; NSRect rect; /* The view responder chain gets messed with during setStyleMask */ - if ([data->sdlContentView nextResponder] == data->listener) { - [data->sdlContentView setNextResponder:nil]; + if ([data.sdlContentView nextResponder] == data.listener) { + [data.sdlContentView setNextResponder:nil]; } if (fullscreen) { @@ -2082,6 +2103,7 @@ [nswindow setStyleMask:NSWindowStyleMaskBorderless]; } else { + NSRect frameRect; rect.origin.x = window->windowed.x; rect.origin.y = window->windowed.y; rect.size.width = window->windowed.w; @@ -2097,14 +2119,14 @@ [nswindow setStyleMask:GetWindowWindowedStyle(window)]; /* Hack to restore window decorations on Mac OS X 10.10 */ - NSRect frameRect = [nswindow frame]; + frameRect = [nswindow frame]; [nswindow setFrame:NSMakeRect(frameRect.origin.x, frameRect.origin.y, frameRect.size.width + 1, frameRect.size.height) display:NO]; [nswindow setFrame:frameRect display:NO]; } /* The view responder chain gets messed with during setStyleMask */ - if ([data->sdlContentView nextResponder] != data->listener) { - [data->sdlContentView setNextResponder:data->listener]; + if ([data.sdlContentView nextResponder] != data.listener) { + [data.sdlContentView setNextResponder:data.listener]; } s_moveHack = 0; @@ -2127,9 +2149,9 @@ } if ([nswindow isVisible] || fullscreen) { - [data->listener pauseVisibleObservation]; + [data.listener pauseVisibleObservation]; [nswindow makeKeyAndOrderFront:nil]; - [data->listener resumeVisibleObservation]; + [data.listener resumeVisibleObservation]; } ScheduleContextUpdates(data); @@ -2137,6 +2159,7 @@ int Cocoa_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp) +{ @autoreleasepool { SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); CGDirectDisplayID display_id = ((SDL_DisplayData *)display->driverdata)->display; @@ -2159,13 +2182,14 @@ return SDL_SetError("CGSetDisplayTransferByTable()"); } return 0; -} +}} void* Cocoa_GetWindowICCProfile(_THIS, SDL_Window * window, size_t * size) +{ @autoreleasepool { - SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - NSWindow *nswindow = data->nswindow; + SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; + NSWindow *nswindow = data.nswindow; NSScreen *screen = [nswindow screen]; NSData* iccProfileData = nil; void* retIccProfileData = NULL; @@ -2195,7 +2219,44 @@ [iccProfileData getBytes:retIccProfileData length:[iccProfileData length]]; *size = [iccProfileData length]; return retIccProfileData; -} +}} + +int +Cocoa_GetWindowDisplayIndex(_THIS, SDL_Window * window) +{ @autoreleasepool +{ + NSScreen *screen; + SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; + + /* Not recognized via CHECK_WINDOW_MAGIC */ + if (data == nil) { + return SDL_SetError("Window data not set"); + } + + /* NSWindow.screen may be nil when the window is off-screen. */ + screen = data.nswindow.screen; + + if (screen != nil) { + CGDirectDisplayID displayid; + int i; + + /* https://developer.apple.com/documentation/appkit/nsscreen/1388360-devicedescription?language=objc */ + displayid = [[screen.deviceDescription objectForKey:@"NSScreenNumber"] unsignedIntValue]; + + for (i = 0; i < _this->num_displays; i++) { + SDL_DisplayData *displaydata = (SDL_DisplayData *)_this->displays[i].driverdata; + if (displaydata != NULL && displaydata->display == displayid) { + return i; + } + } + } + + /* Other code may expect SDL_GetWindowDisplayIndex to always return a valid + * index for a window. The higher level GetWindowDisplayIndex code will fall + * back to a generic position-based query if the backend implementation + * fails. */ + return SDL_SetError("Couldn't find the display where the window is located."); +}} int Cocoa_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp) @@ -2229,96 +2290,97 @@ void Cocoa_SetWindowMouseGrab(_THIS, SDL_Window * window, SDL_bool grabbed) +{ @autoreleasepool { - SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; Cocoa_UpdateClipCursor(window); if (data && (window->flags & SDL_WINDOW_FULLSCREEN)) { if (SDL_ShouldAllowTopmost() && (window->flags & SDL_WINDOW_INPUT_FOCUS) - && ![data->listener isInFullscreenSpace]) { + && ![data.listener isInFullscreenSpace]) { /* OpenGL is rendering to the window, so make it visible! */ /* Doing this in 10.11 while in a Space breaks things (bug #3152) */ - [data->nswindow setLevel:CGShieldingWindowLevel()]; + [data.nswindow setLevel:CGShieldingWindowLevel()]; } else if (window->flags & SDL_WINDOW_ALWAYS_ON_TOP) { - [data->nswindow setLevel:NSFloatingWindowLevel]; + [data.nswindow setLevel:NSFloatingWindowLevel]; } else { - [data->nswindow setLevel:kCGNormalWindowLevel]; + [data.nswindow setLevel:kCGNormalWindowLevel]; } } -} +}} void Cocoa_DestroyWindow(_THIS, SDL_Window * window) { @autoreleasepool { - SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + SDL_WindowData *data = (SDL_WindowData *) CFBridgingRelease(window->driverdata); if (data) { - if ([data->listener isInFullscreenSpace]) { + NSArray *contexts; + if ([data.listener isInFullscreenSpace]) { [NSMenu setMenuBarVisible:YES]; } - [data->listener close]; - [data->listener release]; - if (data->created) { + [data.listener close]; + data.listener = nil; + if (data.created) { /* Release the content view to avoid further updateLayer callbacks */ - [data->nswindow setContentView:nil]; - [data->nswindow close]; + [data.nswindow setContentView:nil]; + [data.nswindow close]; } - NSArray *contexts = [[data->nscontexts copy] autorelease]; + contexts = [data.nscontexts copy]; for (SDLOpenGLContext *context in contexts) { /* Calling setWindow:NULL causes the context to remove itself from the context list. */ [context setWindow:NULL]; } - [data->nscontexts release]; - - SDL_free(data); } window->driverdata = NULL; }} SDL_bool Cocoa_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) +{ @autoreleasepool { - NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow; + NSWindow *nswindow = ((__bridge SDL_WindowData *) window->driverdata).nswindow; if (info->version.major <= SDL_MAJOR_VERSION) { info->subsystem = SDL_SYSWM_COCOA; info->info.cocoa.window = nswindow; return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d", - SDL_MAJOR_VERSION, SDL_MINOR_VERSION); + SDL_SetError("Application not compiled with SDL %d", + SDL_MAJOR_VERSION); return SDL_FALSE; } -} +}} SDL_bool Cocoa_IsWindowInFullscreenSpace(SDL_Window * window) +{ @autoreleasepool { - SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; - if ([data->listener isInFullscreenSpace]) { + if ([data.listener isInFullscreenSpace]) { return SDL_TRUE; } else { return SDL_FALSE; } -} +}} SDL_bool Cocoa_SetWindowFullscreenSpace(SDL_Window * window, SDL_bool state) { @autoreleasepool { SDL_bool succeeded = SDL_FALSE; - SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; - if (data->inWindowFullscreenTransition) { + if (data.inWindowFullscreenTransition) { return SDL_FALSE; } - data->inWindowFullscreenTransition = SDL_TRUE; - if ([data->listener setFullscreenSpace:(state ? YES : NO)]) { + data.inWindowFullscreenTransition = SDL_TRUE; + if ([data.listener setFullscreenSpace:(state ? YES : NO)]) { const int maxattempts = 3; int attempt = 0; while (++attempt <= maxattempts) { @@ -2327,7 +2389,7 @@ */ const int limit = 10000; int count = 0; - while ([data->listener isInFullscreenSpaceTransition]) { + while ([data.listener isInFullscreenSpaceTransition]) { if ( ++count == limit ) { /* Uh oh, transition isn't completing. Should we assert? */ break; @@ -2335,16 +2397,16 @@ SDL_Delay(1); SDL_PumpEvents(); } - if ([data->listener isInFullscreenSpace] == (state ? YES : NO)) + if ([data.listener isInFullscreenSpace] == (state ? YES : NO)) break; /* Try again, the last attempt was interrupted by user gestures */ - if (![data->listener setFullscreenSpace:(state ? YES : NO)]) + if (![data.listener setFullscreenSpace:(state ? YES : NO)]) break; /* ??? */ } /* Return TRUE to prevent non-space fullscreen logic from running */ succeeded = SDL_TRUE; } - data->inWindowFullscreenTransition = SDL_FALSE; + data.inWindowFullscreenTransition = SDL_FALSE; return succeeded; }} @@ -2357,25 +2419,26 @@ void Cocoa_AcceptDragAndDrop(SDL_Window * window, SDL_bool accept) +{ @autoreleasepool { - SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; if (accept) { - [data->nswindow registerForDraggedTypes:[NSArray arrayWithObject:(NSString *)kUTTypeFileURL]]; + [data.nswindow registerForDraggedTypes:[NSArray arrayWithObject:(NSString *)kUTTypeFileURL]]; } else { - [data->nswindow unregisterDraggedTypes]; + [data.nswindow unregisterDraggedTypes]; } -} +}} int Cocoa_FlashWindow(_THIS, SDL_Window *window, SDL_FlashOperation operation) { @autoreleasepool { /* Note that this is app-wide and not window-specific! */ - SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; - if (data->flash_request) { - [NSApp cancelUserAttentionRequest:data->flash_request]; - data->flash_request = 0; + if (data.flash_request) { + [NSApp cancelUserAttentionRequest:data.flash_request]; + data.flash_request = 0; } switch (operation) { @@ -2383,10 +2446,10 @@ /* Canceled above */ break; case SDL_FLASH_BRIEFLY: - data->flash_request = [NSApp requestUserAttention:NSInformationalRequest]; + data.flash_request = [NSApp requestUserAttention:NSInformationalRequest]; break; case SDL_FLASH_UNTIL_FOCUSED: - data->flash_request = [NSApp requestUserAttention:NSCriticalRequest]; + data.flash_request = [NSApp requestUserAttention:NSCriticalRequest]; break; default: return SDL_Unsupported(); @@ -2396,11 +2459,12 @@ int Cocoa_SetWindowOpacity(_THIS, SDL_Window * window, float opacity) +{ @autoreleasepool { - SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - [data->nswindow setAlphaValue:opacity]; + SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; + [data.nswindow setAlphaValue:opacity]; return 0; -} +}} #endif /* SDL_VIDEO_DRIVER_COCOA */ diff -Nru libsdl2-2.0.22+dfsg/src/video/directfb/SDL_DirectFB_events.c libsdl2-2.24.0+dfsg/src/video/directfb/SDL_DirectFB_events.c --- libsdl2-2.0.22+dfsg/src/video/directfb/SDL_DirectFB_events.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/directfb/SDL_DirectFB_events.c 2022-08-13 03:48:10.000000000 +0000 @@ -661,7 +661,6 @@ #if USE_MULTI_API SDL_Keyboard keyboard; #endif - SDL_Keycode keymap[SDL_NUM_SCANCODES]; if (!cb->sys_kbd) { if (cb->sys_ids) { @@ -696,12 +695,6 @@ SDL_DFB_LOG("Keyboard %d - %s\n", device_id, desc.name); - SDL_GetDefaultKeymap(keymap); -#if USE_MULTI_API - SDL_SetKeymap(devdata->num_keyboard, 0, keymap, SDL_NUM_SCANCODES); -#else - SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES); -#endif devdata->num_keyboard++; if (cb->sys_kbd) diff -Nru libsdl2-2.0.22+dfsg/src/video/directfb/SDL_DirectFB_video.c libsdl2-2.24.0+dfsg/src/video/directfb/SDL_DirectFB_video.c --- libsdl2-2.0.22+dfsg/src/video/directfb/SDL_DirectFB_video.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/directfb/SDL_DirectFB_video.c 2022-08-13 03:48:10.000000000 +0000 @@ -61,7 +61,7 @@ static int DirectFB_VideoInit(_THIS); static void DirectFB_VideoQuit(_THIS); -static SDL_VideoDevice *DirectFB_CreateDevice(int devindex); +static SDL_VideoDevice *DirectFB_CreateDevice(void); VideoBootStrap DirectFB_bootstrap = { "directfb", "DirectFB", @@ -83,7 +83,7 @@ } static SDL_VideoDevice * -DirectFB_CreateDevice(int devindex) +DirectFB_CreateDevice(void) { SDL_VideoDevice *device; diff -Nru libsdl2-2.0.22+dfsg/src/video/directfb/SDL_DirectFB_window.c libsdl2-2.24.0+dfsg/src/video/directfb/SDL_DirectFB_window.c --- libsdl2-2.0.22+dfsg/src/video/directfb/SDL_DirectFB_window.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/directfb/SDL_DirectFB_window.c 2022-06-02 02:01:57.000000000 +0000 @@ -482,16 +482,15 @@ return SDL_FALSE; } - if (info->version.major == SDL_MAJOR_VERSION && - info->version.minor == SDL_MINOR_VERSION) { + if (info->version.major == SDL_MAJOR_VERSION) { info->subsystem = SDL_SYSWM_DIRECTFB; info->info.dfb.dfb = devdata->dfb; info->info.dfb.window = windata->dfbwin; info->info.dfb.surface = windata->surface; return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d", - SDL_MAJOR_VERSION, SDL_MINOR_VERSION); + SDL_SetError("Application not compiled with SDL %d", + SDL_MAJOR_VERSION); return SDL_FALSE; } } diff -Nru libsdl2-2.0.22+dfsg/src/video/dummy/SDL_nullvideo.c libsdl2-2.24.0+dfsg/src/video/dummy/SDL_nullvideo.c --- libsdl2-2.0.22+dfsg/src/video/dummy/SDL_nullvideo.c 2022-04-21 17:37:37.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/dummy/SDL_nullvideo.c 2022-08-13 03:48:10.000000000 +0000 @@ -49,23 +49,36 @@ #include "SDL_hints.h" #define DUMMYVID_DRIVER_NAME "dummy" +#define DUMMYVID_DRIVER_EVDEV_NAME "evdev" /* Initialization/Query functions */ static int DUMMY_VideoInit(_THIS); static int DUMMY_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode); static void DUMMY_VideoQuit(_THIS); +#if SDL_INPUT_LINUXEV +static int evdev = 0; +static void DUMMY_EVDEV_Poll(_THIS); +#endif + /* DUMMY driver bootstrap functions */ static int DUMMY_Available(void) { const char *envr = SDL_GetHint(SDL_HINT_VIDEODRIVER); - if ((envr) && (SDL_strcmp(envr, DUMMYVID_DRIVER_NAME) == 0)) { - return (1); + if (envr) { + if (SDL_strcmp(envr, DUMMYVID_DRIVER_NAME) == 0) { + return 1; + } + #if SDL_INPUT_LINUXEV + if (SDL_strcmp(envr, DUMMYVID_DRIVER_EVDEV_NAME) == 0) { + evdev = 1; + return 1; + } + #endif } - - return (0); + return 0; } static void @@ -75,7 +88,7 @@ } static SDL_VideoDevice * -DUMMY_CreateDevice(int devindex) +DUMMY_CreateDevice(void) { SDL_VideoDevice *device; @@ -96,6 +109,11 @@ device->VideoQuit = DUMMY_VideoQuit; device->SetDisplayMode = DUMMY_SetDisplayMode; device->PumpEvents = DUMMY_PumpEvents; + #if SDL_INPUT_LINUXEV + if (evdev) { + device->PumpEvents = DUMMY_EVDEV_Poll; + } + #endif device->CreateWindowFramebuffer = SDL_DUMMY_CreateWindowFramebuffer; device->UpdateWindowFramebuffer = SDL_DUMMY_UpdateWindowFramebuffer; device->DestroyWindowFramebuffer = SDL_DUMMY_DestroyWindowFramebuffer; @@ -110,6 +128,19 @@ DUMMY_CreateDevice }; +#if SDL_INPUT_LINUXEV +VideoBootStrap DUMMY_evdev_bootstrap = { + DUMMYVID_DRIVER_EVDEV_NAME, "SDL dummy video driver with evdev", + DUMMY_CreateDevice +}; +void SDL_EVDEV_Init(void); +void SDL_EVDEV_Poll(); +void SDL_EVDEV_Quit(void); +static void DUMMY_EVDEV_Poll(_THIS) { + (void) _this; + SDL_EVDEV_Poll(); +} +#endif int DUMMY_VideoInit(_THIS) @@ -129,6 +160,10 @@ SDL_AddDisplayMode(&_this->displays[0], &mode); + #if SDL_INPUT_LINUXEV + SDL_EVDEV_Init(); + #endif + /* We're done! */ return 0; } @@ -139,9 +174,13 @@ return 0; } + void DUMMY_VideoQuit(_THIS) { + #if SDL_INPUT_LINUXEV + SDL_EVDEV_Quit(); + #endif } #endif /* SDL_VIDEO_DRIVER_DUMMY */ diff -Nru libsdl2-2.0.22+dfsg/src/video/emscripten/SDL_emscriptenframebuffer.c libsdl2-2.24.0+dfsg/src/video/emscripten/SDL_emscriptenframebuffer.c --- libsdl2-2.0.22+dfsg/src/video/emscripten/SDL_emscriptenframebuffer.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/emscripten/SDL_emscriptenframebuffer.c 2022-06-16 20:16:31.000000000 +0000 @@ -59,10 +59,19 @@ return 0; } -static void -Emscripten_UpdateWindowFramebufferWorker(SDL_Surface* surface) +int Emscripten_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect * rects, int numrects) { - EM_ASM_INT({ + SDL_Surface *surface; + + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + surface = data->surface; + if (!surface) { + return SDL_SetError("Couldn't find framebuffer surface for window"); + } + + /* Send the data to the display */ + + MAIN_THREAD_EM_ASM({ var w = $0; var h = $1; var pixels = $2; @@ -147,31 +156,7 @@ } SDL2.ctx.putImageData(SDL2.image, 0, 0); - return 0; }, surface->w, surface->h, surface->pixels); -} - -int Emscripten_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect * rects, int numrects) -{ - SDL_Surface *surface; - - SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - surface = data->surface; - if (!surface) { - return SDL_SetError("Couldn't find framebuffer surface for window"); - } - - /* Send the data to the display */ - - if (emscripten_is_main_runtime_thread()) { - Emscripten_UpdateWindowFramebufferWorker(surface); - } else { - emscripten_sync_run_in_main_runtime_thread( - EM_FUNC_SIG_VI, - Emscripten_UpdateWindowFramebufferWorker, - (uint32_t)surface - ); - } if (emscripten_has_asyncify() && SDL_GetHintBoolean(SDL_HINT_EMSCRIPTEN_ASYNCIFY, SDL_TRUE)) { /* give back control to browser for screen refresh */ diff -Nru libsdl2-2.0.22+dfsg/src/video/emscripten/SDL_emscriptenmouse.c libsdl2-2.24.0+dfsg/src/video/emscripten/SDL_emscriptenmouse.c --- libsdl2-2.0.22+dfsg/src/video/emscripten/SDL_emscriptenmouse.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/emscripten/SDL_emscriptenmouse.c 2022-06-16 20:16:31.000000000 +0000 @@ -63,10 +63,20 @@ return Emscripten_CreateCursorFromString("default", SDL_FALSE); } -static const char* -Emscripten_GetCursorUrl(int w, int h, int hot_x, int hot_y, void* pixels) + +static SDL_Cursor* +Emscripten_CreateCursor(SDL_Surface* surface, int hot_x, int hot_y) { - return (const char *)EM_ASM_INT({ + const char *cursor_url = NULL; + SDL_Surface *conv_surf; + + conv_surf = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_ABGR8888, 0); + + if (!conv_surf) { + return NULL; + } + + cursor_url = (const char *)MAIN_THREAD_EM_ASM_INT({ var w = $0; var h = $1; var hot_x = $2; @@ -114,40 +124,7 @@ stringToUTF8(url, urlBuf, url.length + 1); return urlBuf; - }, w, h, hot_x, hot_y, pixels); -} - -static SDL_Cursor* -Emscripten_CreateCursor(SDL_Surface* surface, int hot_x, int hot_y) -{ - const char *cursor_url = NULL; - SDL_Surface *conv_surf; - - conv_surf = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_ABGR8888, 0); - - if (!conv_surf) { - return NULL; - } - - if (emscripten_is_main_runtime_thread()) { - cursor_url = Emscripten_GetCursorUrl( - surface->w, - surface->h, - hot_x, - hot_y, - conv_surf->pixels - ); - } else { - cursor_url = (const char *)emscripten_sync_run_in_main_runtime_thread( - EM_FUNC_SIG_IIIIIII, - Emscripten_GetCursorUrl, - surface->w, - surface->h, - hot_x, - hot_y, - conv_surf->pixels - ); - } + }, surface->w, surface->h, hot_x, hot_y, conv_surf->pixels); SDL_FreeSurface(conv_surf); diff -Nru libsdl2-2.0.22+dfsg/src/video/emscripten/SDL_emscriptenvideo.c libsdl2-2.24.0+dfsg/src/video/emscripten/SDL_emscriptenvideo.c --- libsdl2-2.0.22+dfsg/src/video/emscripten/SDL_emscriptenvideo.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/emscripten/SDL_emscriptenvideo.c 2022-08-13 03:48:10.000000000 +0000 @@ -62,7 +62,7 @@ } static SDL_VideoDevice * -Emscripten_CreateDevice(int devindex) +Emscripten_CreateDevice(void) { SDL_VideoDevice *device; diff -Nru libsdl2-2.0.22+dfsg/src/video/haiku/SDL_bvideo.cc libsdl2-2.24.0+dfsg/src/video/haiku/SDL_bvideo.cc --- libsdl2-2.0.22+dfsg/src/video/haiku/SDL_bvideo.cc 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/haiku/SDL_bvideo.cc 2022-08-13 03:48:10.000000000 +0000 @@ -55,7 +55,7 @@ /* End undefined functions */ static SDL_VideoDevice * -HAIKU_CreateDevice(int devindex) +HAIKU_CreateDevice(void) { SDL_VideoDevice *device; /*SDL_VideoData *data;*/ diff -Nru libsdl2-2.0.22+dfsg/src/video/haiku/SDL_bwindow.cc libsdl2-2.24.0+dfsg/src/video/haiku/SDL_bwindow.cc --- libsdl2-2.0.22+dfsg/src/video/haiku/SDL_bwindow.cc 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/haiku/SDL_bwindow.cc 2022-06-02 02:01:57.000000000 +0000 @@ -226,13 +226,12 @@ SDL_bool HAIKU_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) { /* FIXME: What is the point of this? What information should be included? */ - if (info->version.major == SDL_MAJOR_VERSION && - info->version.minor == SDL_MINOR_VERSION) { + if (info->version.major == SDL_MAJOR_VERSION) { info->subsystem = SDL_SYSWM_HAIKU; return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d", - SDL_MAJOR_VERSION, SDL_MINOR_VERSION); + SDL_SetError("Application not compiled with SDL %d", + SDL_MAJOR_VERSION); return SDL_FALSE; } } diff -Nru libsdl2-2.0.22+dfsg/src/video/kmsdrm/SDL_kmsdrmsym.h libsdl2-2.24.0+dfsg/src/video/kmsdrm/SDL_kmsdrmsym.h --- libsdl2-2.0.22+dfsg/src/video/kmsdrm/SDL_kmsdrmsym.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/kmsdrm/SDL_kmsdrmsym.h 2022-06-02 02:01:57.000000000 +0000 @@ -19,7 +19,7 @@ 3. This notice may not be removed or altered from any source distribution. */ -/* *INDENT-OFF* */ +/* *INDENT-OFF* */ /* clang-format off */ #ifndef SDL_KMSDRM_MODULE #define SDL_KMSDRM_MODULE(modname) @@ -125,6 +125,6 @@ #undef SDL_KMSDRM_SYM #undef SDL_KMSDRM_SYM_CONST -/* *INDENT-ON* */ +/* *INDENT-ON* */ /* clang-format on */ /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/video/kmsdrm/SDL_kmsdrmvideo.c libsdl2-2.24.0+dfsg/src/video/kmsdrm/SDL_kmsdrmvideo.c --- libsdl2-2.0.22+dfsg/src/video/kmsdrm/SDL_kmsdrmvideo.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/kmsdrm/SDL_kmsdrmvideo.c 2022-08-13 03:48:10.000000000 +0000 @@ -53,131 +53,122 @@ #include #ifdef __OpenBSD__ -static SDL_bool openbsd69orgreater = SDL_FALSE; -#define KMSDRM_DRI_PATH openbsd69orgreater ? "/dev/dri/" : "/dev/" -#define KMSDRM_DRI_DEVFMT openbsd69orgreater ? "%scard%d" : "%sdrm%d" -#define KMSDRM_DRI_DEVNAME openbsd69orgreater ? "card" : "drm" -#define KMSDRM_DRI_DEVNAMESIZE openbsd69orgreater ? 4 : 3 -#define KMSDRM_DRI_CARDPATHFMT openbsd69orgreater ? "/dev/dri/card%d" : "/dev/drm%d" +static SDL_bool moderndri = SDL_FALSE; #else -#define KMSDRM_DRI_PATH "/dev/dri/" -#define KMSDRM_DRI_DEVFMT "%scard%d" -#define KMSDRM_DRI_DEVNAME "card" -#define KMSDRM_DRI_DEVNAMESIZE 4 -#define KMSDRM_DRI_CARDPATHFMT "/dev/dri/card%d" +static SDL_bool moderndri = SDL_TRUE; #endif +static char kmsdrm_dri_path[16]; +static int kmsdrm_dri_pathsize = 0; +static char kmsdrm_dri_devname[8]; +static int kmsdrm_dri_devnamesize = 0; +static char kmsdrm_dri_cardpath[32]; + #ifndef EGL_PLATFORM_GBM_MESA #define EGL_PLATFORM_GBM_MESA 0x31D7 #endif static int -check_modestting(int devindex) +get_driindex(void) { - SDL_bool available = SDL_FALSE; - char device[512]; + int available = -ENOENT; + char device[sizeof(kmsdrm_dri_cardpath)]; int drm_fd; int i; + int devindex = -1; + DIR *folder; + const char *hint; - SDL_snprintf(device, sizeof (device), KMSDRM_DRI_DEVFMT, KMSDRM_DRI_PATH, devindex); - - drm_fd = open(device, O_RDWR | O_CLOEXEC); - if (drm_fd >= 0) { - if (SDL_KMSDRM_LoadSymbols()) { - drmModeRes *resources = KMSDRM_drmModeGetResources(drm_fd); - if (resources) { - SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, - KMSDRM_DRI_DEVFMT - " connector, encoder and CRTC counts are: %d %d %d", - KMSDRM_DRI_PATH, devindex, - resources->count_connectors, resources->count_encoders, - resources->count_crtcs); - - if (resources->count_connectors > 0 - && resources->count_encoders > 0 - && resources->count_crtcs > 0) - { - available = SDL_FALSE; - for (i = 0; i < resources->count_connectors; i++) { - drmModeConnector *conn = KMSDRM_drmModeGetConnector(drm_fd, - resources->connectors[i]); + hint = SDL_GetHint(SDL_HINT_KMSDRM_DEVICE_INDEX); + if (hint && *hint) { + char *endptr = NULL; + const int idx = (int) SDL_strtol(hint, &endptr, 10); + if ((*endptr == '\0') && (idx >= 0)) { /* *endptr==0 means "whole string was a valid number" */ + return idx; /* we'll take the user's request here. */ + } + } - if (!conn) { - continue; - } + SDL_strlcpy(device, kmsdrm_dri_path, sizeof(device)); + folder = opendir(device); + if (!folder) { + SDL_SetError("Failed to open directory '%s'", device); + return -ENOENT; + } + + SDL_strlcpy(device + kmsdrm_dri_pathsize, kmsdrm_dri_devname, + sizeof(device) - kmsdrm_dri_devnamesize); + for (struct dirent *res; (res = readdir(folder));) { + if (SDL_memcmp(res->d_name, kmsdrm_dri_devname, + kmsdrm_dri_devnamesize) == 0) { + SDL_strlcpy(device + kmsdrm_dri_pathsize + kmsdrm_dri_devnamesize, + res->d_name + kmsdrm_dri_devnamesize, + sizeof(device) - kmsdrm_dri_pathsize - + kmsdrm_dri_devnamesize); + + drm_fd = open(device, O_RDWR | O_CLOEXEC); + if (drm_fd >= 0) { + devindex = SDL_atoi(device + kmsdrm_dri_pathsize + + kmsdrm_dri_devnamesize); + if (SDL_KMSDRM_LoadSymbols()) { + drmModeRes *resources = KMSDRM_drmModeGetResources(drm_fd); + if (resources) { + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, + "%s%d connector, encoder and CRTC counts are: %d %d %d", + kmsdrm_dri_cardpath, devindex, + resources->count_connectors, + resources->count_encoders, + resources->count_crtcs); + + if (resources->count_connectors > 0 && + resources->count_encoders > 0 && + resources->count_crtcs > 0) { + available = -ENOENT; + for (i = 0; i < resources->count_connectors; i++) { + drmModeConnector *conn = + KMSDRM_drmModeGetConnector( + drm_fd, resources->connectors[i]); - if (conn->connection == DRM_MODE_CONNECTED && conn->count_modes) { - if (SDL_GetHintBoolean(SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER, SDL_TRUE)) { - /* Skip this device if we can't obtain DRM master */ - KMSDRM_drmSetMaster(drm_fd); - if (KMSDRM_drmAuthMagic(drm_fd, 0) == -EACCES) { + if (!conn) { continue; } - } - available = SDL_TRUE; - break; - } + if (conn->connection == DRM_MODE_CONNECTED && + conn->count_modes) { + if (SDL_GetHintBoolean( + SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER, + SDL_TRUE)) { + /* Skip this device if we can't obtain + * DRM master */ + KMSDRM_drmSetMaster(drm_fd); + if (KMSDRM_drmAuthMagic(drm_fd, 0) == + -EACCES) { + continue; + } + } + + available = devindex; + break; + } - KMSDRM_drmModeFreeConnector(conn); + KMSDRM_drmModeFreeConnector(conn); + } + } + KMSDRM_drmModeFreeResources(resources); } + SDL_KMSDRM_UnloadSymbols(); } - KMSDRM_drmModeFreeResources(resources); + close(drm_fd); } - SDL_KMSDRM_UnloadSymbols(); - } - close(drm_fd); - } - - return available; -} - -static int get_dricount(void) -{ - int devcount = 0; - struct dirent *res; - struct stat sb; - DIR *folder; - if (!(stat(KMSDRM_DRI_PATH, &sb) == 0 - && S_ISDIR(sb.st_mode))) { - /*printf("The path %s cannot be opened or is not available\n", KMSDRM_DRI_PATH);*/ - return 0; - } - - if (access(KMSDRM_DRI_PATH, F_OK) == -1) { - /*printf("The path %s cannot be opened\n", KMSDRM_DRI_PATH);*/ - return 0; - } - - folder = opendir(KMSDRM_DRI_PATH); - if (folder) { - while ((res = readdir(folder))) { - int len = SDL_strlen(res->d_name); - if (len > KMSDRM_DRI_DEVNAMESIZE && SDL_strncmp(res->d_name, - KMSDRM_DRI_DEVNAME, KMSDRM_DRI_DEVNAMESIZE) == 0) { - devcount++; - } + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, + "Failed to open KMSDRM device %s, errno: %d\n", device, + errno); } - closedir(folder); } - return devcount; -} - -static int -get_driindex(void) -{ - const int devcount = get_dricount(); - int i; - - for (i = 0; i < devcount; i++) { - if (check_modestting(i)) { - return i; - } - } + closedir(folder); - return -ENOENT; + return available; } static int @@ -193,13 +184,28 @@ if (!(uname(&nameofsystem) < 0)) { releaseversion = SDL_atof(nameofsystem.release); if (releaseversion >= 6.9) { - openbsd69orgreater = SDL_TRUE; + moderndri = SDL_TRUE; } } #endif + + if (moderndri) { + SDL_strlcpy(kmsdrm_dri_path, "/dev/dri/", sizeof(kmsdrm_dri_path)); + SDL_strlcpy(kmsdrm_dri_devname, "card", sizeof(kmsdrm_dri_devname)); + } else { + SDL_strlcpy(kmsdrm_dri_path, "/dev/", sizeof(kmsdrm_dri_path)); + SDL_strlcpy(kmsdrm_dri_devname, "drm", sizeof(kmsdrm_dri_devname)); + } + + kmsdrm_dri_pathsize = SDL_strlen(kmsdrm_dri_path); + kmsdrm_dri_devnamesize = SDL_strlen(kmsdrm_dri_devname); + SDL_snprintf(kmsdrm_dri_cardpath, sizeof(kmsdrm_dri_cardpath), "%s%s", + kmsdrm_dri_path, kmsdrm_dri_devname); + ret = get_driindex(); - if (ret >= 0) + if (ret >= 0) { return 1; + } return ret; } @@ -218,21 +224,19 @@ } static SDL_VideoDevice * -KMSDRM_CreateDevice(int devindex) +KMSDRM_CreateDevice(void) { SDL_VideoDevice *device; SDL_VideoData *viddata; + int devindex; if (!KMSDRM_Available()) { return NULL; } - if (!devindex || (devindex > 99)) { - devindex = get_driindex(); - } - + devindex = get_driindex(); if (devindex < 0) { - SDL_SetError("devindex (%d) must be between 0 and 99.\n", devindex); + SDL_SetError("devindex (%d) must be between 0 and 99.", devindex); return NULL; } @@ -732,8 +736,9 @@ int ret = 0; int i; - /* Open /dev/dri/cardNN (/dev/drmN if on OpenBSD) */ - SDL_snprintf(viddata->devpath, sizeof(viddata->devpath), KMSDRM_DRI_CARDPATHFMT, viddata->devindex); + /* Open /dev/dri/cardNN (/dev/drmN if on OpenBSD version less than 6.9) */ + SDL_snprintf(viddata->devpath, sizeof(viddata->devpath), "%s%d", + kmsdrm_dri_cardpath, viddata->devindex); SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Opening device %s", viddata->devpath); viddata->drm_fd = open(viddata->devpath, O_RDWR | O_CLOEXEC); diff -Nru libsdl2-2.0.22+dfsg/src/video/kmsdrm/SDL_kmsdrmvulkan.c libsdl2-2.24.0+dfsg/src/video/kmsdrm/SDL_kmsdrmvulkan.c --- libsdl2-2.0.22+dfsg/src/video/kmsdrm/SDL_kmsdrmvulkan.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/kmsdrm/SDL_kmsdrmvulkan.c 2022-06-16 20:16:31.000000000 +0000 @@ -476,9 +476,9 @@ } } - /* If we couldn't find an appropiate plane, error out. */ + /* If we couldn't find an appropriate plane, error out. */ if (plane == UINT32_MAX) { - SDL_SetError("Vulkan couldn't find an appropiate plane."); + SDL_SetError("Vulkan couldn't find an appropriate plane."); goto clean; } diff -Nru libsdl2-2.0.22+dfsg/src/video/nacl/SDL_naclevents.c libsdl2-2.24.0+dfsg/src/video/nacl/SDL_naclevents.c --- libsdl2-2.0.22+dfsg/src/video/nacl/SDL_naclevents.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/nacl/SDL_naclevents.c 2022-08-13 03:48:10.000000000 +0000 @@ -23,8 +23,8 @@ #if SDL_VIDEO_DRIVER_NACL #include "SDL.h" -#include "../../events/SDL_sysevents.h" #include "../../events/SDL_events_c.h" +#include "../SDL_sysvideo.h" #include "SDL_naclevents_c.h" #include "SDL_naclvideo.h" #include "ppapi_simple/ps_event.h" diff -Nru libsdl2-2.0.22+dfsg/src/video/nacl/SDL_naclvideo.c libsdl2-2.24.0+dfsg/src/video/nacl/SDL_naclvideo.c --- libsdl2-2.0.22+dfsg/src/video/nacl/SDL_naclvideo.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/nacl/SDL_naclvideo.c 2022-08-13 03:48:10.000000000 +0000 @@ -91,7 +91,7 @@ return 0; } -static SDL_VideoDevice *NACL_CreateDevice(int devindex) { +static SDL_VideoDevice *NACL_CreateDevice(void) { SDL_VideoDevice *device; if (!NACL_Available()) { diff -Nru libsdl2-2.0.22+dfsg/src/video/ngage/SDL_ngageevents_c.h libsdl2-2.24.0+dfsg/src/video/ngage/SDL_ngageevents_c.h --- libsdl2-2.0.22+dfsg/src/video/ngage/SDL_ngageevents_c.h 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/ngage/SDL_ngageevents_c.h 2022-06-02 02:01:57.000000000 +0000 @@ -0,0 +1,28 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#include "SDL_ngagevideo.h" + +extern void NGAGE_PumpEvents(_THIS); + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/video/ngage/SDL_ngageevents.cpp libsdl2-2.24.0+dfsg/src/video/ngage/SDL_ngageevents.cpp --- libsdl2-2.0.22+dfsg/src/video/ngage/SDL_ngageevents.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/ngage/SDL_ngageevents.cpp 2022-06-02 02:01:57.000000000 +0000 @@ -0,0 +1,200 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_NGAGE + +/* Being a ngage driver, there's no event stream. We just define stubs for + most of the API. */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "../../events/SDL_events_c.h" +#include "../../events/SDL_keyboard_c.h" + +#ifdef __cplusplus +} +#endif + +#include "SDL_ngagevideo.h" +#include "SDL_ngageevents_c.h" + +int HandleWsEvent(_THIS, const TWsEvent& aWsEvent); + +void +NGAGE_PumpEvents(_THIS) +{ + SDL_VideoData *phdata = (SDL_VideoData*)_this->driverdata; + + while (phdata->NGAGE_WsEventStatus != KRequestPending) + { + phdata->NGAGE_WsSession.GetEvent(phdata->NGAGE_WsEvent); + + HandleWsEvent(_this, phdata->NGAGE_WsEvent); + + phdata->NGAGE_WsEventStatus = KRequestPending; + phdata->NGAGE_WsSession.EventReady(&phdata->NGAGE_WsEventStatus); + } +} + +/*****************************************************************************/ +/* Internal */ +/*****************************************************************************/ + +#include +#include + +extern void DisableKeyBlocking(_THIS); +extern void RedrawWindowL(_THIS); + +TBool isCursorVisible = EFalse; + +static SDL_Scancode ConvertScancode(_THIS, int key) +{ + SDL_Keycode keycode; + + switch(key) + { + case EStdKeyBackspace: // Clear key + keycode = SDLK_BACKSPACE; + break; + case 0x31: // 1 + keycode = SDLK_1; + break; + case 0x32: // 2 + keycode = SDLK_2; + break; + case 0x33: // 3 + keycode = SDLK_3; + break; + case 0x34: // 4 + keycode = SDLK_4; + break; + case 0x35: // 5 + keycode = SDLK_5; + break; + case 0x36: // 6 + keycode = SDLK_6; + break; + case 0x37: // 7 + keycode = SDLK_7; + break; + case 0x38: // 8 + keycode = SDLK_8; + break; + case 0x39: // 9 + keycode = SDLK_9; + break; + case 0x30: // 0 + keycode = SDLK_0; + break; + case 0x2a: // Asterisk + keycode = SDLK_ASTERISK; + break; + case EStdKeyHash: // Hash + keycode = SDLK_HASH; + break; + case EStdKeyDevice0: // Left softkey + keycode = SDLK_SOFTLEFT; + break; + case EStdKeyDevice1: // Right softkey + keycode = SDLK_SOFTRIGHT; + break; + case EStdKeyApplication0: // Call softkey + keycode = SDLK_CALL; + break; + case EStdKeyApplication1: // End call softkey + keycode = SDLK_ENDCALL; + break; + case EStdKeyDevice3: // Middle softkey + keycode = SDLK_SELECT; + break; + case EStdKeyUpArrow: // Up arrow + keycode = SDLK_UP; + break; + case EStdKeyDownArrow: // Down arrow + keycode = SDLK_DOWN; + break; + case EStdKeyLeftArrow: // Left arrow + keycode = SDLK_LEFT; + break; + case EStdKeyRightArrow: // Right arrow + keycode = SDLK_RIGHT; + break; + default: + keycode = SDLK_UNKNOWN; + break; + } + + return SDL_GetScancodeFromKey(keycode); +} + +int HandleWsEvent(_THIS, const TWsEvent& aWsEvent) +{ + SDL_VideoData *phdata = (SDL_VideoData*)_this->driverdata; + int posted = 0; + + switch (aWsEvent.Type()) + { + case EEventKeyDown: /* Key events */ + SDL_SendKeyboardKey(SDL_PRESSED, ConvertScancode(_this, aWsEvent.Key()->iScanCode)); + break; + case EEventKeyUp: /* Key events */ + SDL_SendKeyboardKey(SDL_RELEASED, ConvertScancode(_this, aWsEvent.Key()->iScanCode)); + break; + case EEventFocusGained: /* SDL window got focus */ + phdata->NGAGE_IsWindowFocused = ETrue; + /* Draw window background and screen buffer */ + DisableKeyBlocking(_this); + RedrawWindowL(_this); + break; + case EEventFocusLost: /* SDL window lost focus */ + { + phdata->NGAGE_IsWindowFocused = EFalse; + RWsSession s; + s.Connect(); + RWindowGroup g(s); + g.Construct(TUint32(&g), EFalse); + g.EnableReceiptOfFocus(EFalse); + RWindow w(s); + w.Construct(g, TUint32(&w)); + w.SetExtent(TPoint(0, 0), phdata->NGAGE_WsWindow.Size()); + w.SetOrdinalPosition(0); + w.Activate(); + w.Close(); + g.Close(); + s.Close(); + break; + } + case EEventModifiersChanged: + break; + default: + break; + } + return posted; +} + +#endif /* SDL_VIDEO_DRIVER_NGAGE */ + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/video/ngage/SDL_ngageframebuffer_c.h libsdl2-2.24.0+dfsg/src/video/ngage/SDL_ngageframebuffer_c.h --- libsdl2-2.0.22+dfsg/src/video/ngage/SDL_ngageframebuffer_c.h 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/ngage/SDL_ngageframebuffer_c.h 2022-06-02 02:01:57.000000000 +0000 @@ -0,0 +1,38 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +extern int SDL_NGAGE_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch); +extern int SDL_NGAGE_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect * rects, int numrects); +extern void SDL_NGAGE_DestroyWindowFramebuffer(_THIS, SDL_Window * window); + +/****************************************************************************/ +/* Runtime */ +/****************************************************************************/ + +class NGAGE_Runtime +{ +public: + IMPORT_C static void GetScreenInfo(TScreenInfoV01& screenInfo2); +}; + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/video/ngage/SDL_ngageframebuffer.cpp libsdl2-2.24.0+dfsg/src/video/ngage/SDL_ngageframebuffer.cpp --- libsdl2-2.0.22+dfsg/src/video/ngage/SDL_ngageframebuffer.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/ngage/SDL_ngageframebuffer.cpp 2022-06-02 02:01:57.000000000 +0000 @@ -0,0 +1,431 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_NGAGE + +#include + +#include "../SDL_sysvideo.h" +#include "SDL_ngagevideo.h" +#include "SDL_ngageframebuffer_c.h" + +#define NGAGE_SURFACE "NGAGE_FrameBuffer" + +/* For 12 bit screen HW. Table for fast conversion from 8 bit to 12 bit + * + * TUint16 is enough, but using TUint32 so we can use better instruction + * selection on ARMI. + */ +static TUint32 NGAGE_HWPalette_256_to_Screen[256]; + +int GetBpp(TDisplayMode displaymode); +void DirectUpdate(_THIS, int numrects, SDL_Rect *rects); +void DrawBackground(_THIS); +void DirectDraw(_THIS, int numrects, SDL_Rect *rects, TUint16* screenBuffer); +void RedrawWindowL(_THIS); + +int SDL_NGAGE_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch) +{ + SDL_VideoData *phdata = (SDL_VideoData*)_this->driverdata; + SDL_Surface *surface; + const Uint32 surface_format = SDL_PIXELFORMAT_RGB444; + int w, h; + + /* Free the old framebuffer surface */ + SDL_NGAGE_DestroyWindowFramebuffer(_this, window); + + /* Create a new one */ + SDL_GetWindowSize(window, &w, &h); + surface = SDL_CreateRGBSurfaceWithFormat(0, w, h, 0, surface_format); + if (! surface) { + return -1; + } + + /* Save the info and return! */ + SDL_SetWindowData(window, NGAGE_SURFACE, surface); + *format = surface_format; + *pixels = surface->pixels; + *pitch = surface->pitch; + + /* Initialise Epoc frame buffer */ + + TDisplayMode displayMode = phdata->NGAGE_WsScreen->DisplayMode(); + + TScreenInfoV01 screenInfo; + TPckg sInfo(screenInfo); + UserSvr::ScreenInfo(sInfo); + + phdata->NGAGE_ScreenSize = screenInfo.iScreenSize; + phdata->NGAGE_DisplayMode = displayMode; + phdata->NGAGE_HasFrameBuffer = screenInfo.iScreenAddressValid; + phdata->NGAGE_FrameBuffer = phdata->NGAGE_HasFrameBuffer ? (TUint8*) screenInfo.iScreenAddress : NULL; + phdata->NGAGE_BytesPerPixel = ((GetBpp(displayMode)-1) / 8) + 1; + + phdata->NGAGE_BytesPerScanLine = screenInfo.iScreenSize.iWidth * phdata->NGAGE_BytesPerPixel; + phdata->NGAGE_BytesPerScreen = phdata->NGAGE_BytesPerScanLine * phdata->NGAGE_ScreenSize.iHeight; + + SDL_Log("Screen width %d", screenInfo.iScreenSize.iWidth); + SDL_Log("Screen height %d", screenInfo.iScreenSize.iHeight); + SDL_Log("Screen dmode %d", displayMode); + SDL_Log("Screen valid %d", screenInfo.iScreenAddressValid); + + SDL_Log("Bytes per pixel %d", phdata->NGAGE_BytesPerPixel); + SDL_Log("Bytes per scan line %d", phdata->NGAGE_BytesPerScanLine); + SDL_Log("Bytes per screen %d", phdata->NGAGE_BytesPerScreen); + + /* It seems that in SA1100 machines for 8bpp displays there is a 512 + * palette table at the beginning of the frame buffer. + * + * In 12 bpp machines the table has 16 entries. + */ + if (phdata->NGAGE_HasFrameBuffer && GetBpp(displayMode) == 8) + { + phdata->NGAGE_FrameBuffer += 512; + } + else + { + phdata->NGAGE_FrameBuffer += 32; + } + #if 0 + if (phdata->NGAGE_HasFrameBuffer && GetBpp(displayMode) == 12) + { + phdata->NGAGE_FrameBuffer += 16 * 2; + } + if (phdata->NGAGE_HasFrameBuffer && GetBpp(displayMode) == 16) + { + phdata->NGAGE_FrameBuffer += 16 * 2; + } + #endif + + // Get draw device for updating the screen + TScreenInfoV01 screenInfo2; + + NGAGE_Runtime::GetScreenInfo(screenInfo2); + + TRAPD(status, phdata->NGAGE_DrawDevice = CFbsDrawDevice::NewScreenDeviceL(screenInfo2, displayMode)); + User::LeaveIfError(status); + + /* Activate events for me */ + phdata->NGAGE_WsEventStatus = KRequestPending; + phdata->NGAGE_WsSession.EventReady(&phdata->NGAGE_WsEventStatus); + + SDL_Log("SDL:WsEventStatus"); + User::WaitForRequest(phdata->NGAGE_WsEventStatus); + + phdata->NGAGE_RedrawEventStatus = KRequestPending; + phdata->NGAGE_WsSession.RedrawReady(&phdata->NGAGE_RedrawEventStatus); + + SDL_Log("SDL:RedrawEventStatus"); + User::WaitForRequest(phdata->NGAGE_RedrawEventStatus); + + phdata->NGAGE_WsWindow.PointerFilter(EPointerFilterDrag, 0); + + phdata->NGAGE_ScreenOffset = TPoint(0, 0); + + SDL_Log("SDL:DrawBackground"); + DrawBackground(_this); // Clear screen + + return 0; +} + +int SDL_NGAGE_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect * rects, int numrects) +{ + static int frame_number; + SDL_Surface *surface; + + surface = (SDL_Surface *) SDL_GetWindowData(window, NGAGE_SURFACE); + if (! surface) + { + return SDL_SetError("Couldn't find ngage surface for window"); + } + + /* Send the data to the display */ + if (SDL_getenv("SDL_VIDEO_NGAGE_SAVE_FRAMES")) + { + char file[128]; + SDL_snprintf(file, sizeof(file), "SDL_window%d-%8.8d.bmp", + (int)SDL_GetWindowID(window), ++frame_number); + SDL_SaveBMP(surface, file); + } + + DirectUpdate(_this, numrects, (SDL_Rect*)rects); + + return 0; +} + +void SDL_NGAGE_DestroyWindowFramebuffer(_THIS, SDL_Window * window) +{ + SDL_Surface *surface; + + surface = (SDL_Surface *) SDL_SetWindowData(window, NGAGE_SURFACE, NULL); + SDL_FreeSurface(surface); +} + +/*****************************************************************************/ +/* Runtime */ +/*****************************************************************************/ + +#include +#include +#include + +EXPORT_C void NGAGE_Runtime::GetScreenInfo(TScreenInfoV01& screenInfo2) +{ + TPckg sInfo2(screenInfo2); + UserSvr::ScreenInfo(sInfo2); +} + +/*****************************************************************************/ +/* Internal */ +/*****************************************************************************/ + +int GetBpp(TDisplayMode displaymode) +{ + return TDisplayModeUtils::NumDisplayModeBitsPerPixel(displaymode); +} + +void DrawBackground(_THIS) +{ + SDL_VideoData *phdata = (SDL_VideoData*)_this->driverdata; + /* Draw background */ + TUint16* screenBuffer = (TUint16*)phdata->NGAGE_FrameBuffer; + /* Draw black background */ + Mem::FillZ(screenBuffer, phdata->NGAGE_BytesPerScreen); +} + +void DirectDraw(_THIS, int numrects, SDL_Rect *rects, TUint16* screenBuffer) +{ + SDL_VideoData *phdata = (SDL_VideoData*)_this->driverdata; + SDL_Surface *screen = (SDL_Surface*)SDL_GetWindowData(_this->windows, NGAGE_SURFACE); + + TInt i; + + //const TInt sourceNumBytesPerPixel = ((screen->format->BitsPerPixel-1) >> 3) + 1; + TDisplayMode displayMode = phdata->NGAGE_DisplayMode; + const TInt sourceNumBytesPerPixel = ((GetBpp(displayMode)-1) / 8) + 1; + // + const TPoint fixedOffset = phdata->NGAGE_ScreenOffset; + const TInt screenW = screen->w; + const TInt screenH = screen->h; + const TInt sourceScanlineLength = screenW; + const TInt targetScanlineLength = phdata->NGAGE_ScreenSize.iWidth; + + /* Render the rectangles in the list */ + + for (i = 0; i < numrects; ++i) + { + const SDL_Rect& currentRect = rects[i]; + SDL_Rect rect2; + rect2.x = currentRect.x; + rect2.y = currentRect.y; + rect2.w = currentRect.w; + rect2.h = currentRect.h; + + if (rect2.w <= 0 || rect2.h <= 0) /* Sanity check */ + { + continue; + } + + /* All variables are measured in pixels */ + + /* Check rects validity, i.e. upper and lower bounds */ + TInt maxX = Min(screenW - 1, rect2.x + rect2.w - 1); + TInt maxY = Min(screenH - 1, rect2.y + rect2.h - 1); + if (maxX < 0 || maxY < 0) /* sanity check */ + { + continue; + } + /* Clip from bottom */ + + maxY = Min(maxY, phdata->NGAGE_ScreenSize.iHeight-1); + /* TODO: Clip from the right side */ + + const TInt sourceRectWidth = maxX - rect2.x + 1; + const TInt sourceRectWidthInBytes = sourceRectWidth * sourceNumBytesPerPixel; + const TInt sourceRectHeight = maxY - rect2.y + 1; + const TInt sourceStartOffset = rect2.x + rect2.y * sourceScanlineLength; + const TUint skipValue = 1; /* 1 = No skip */ + + TInt targetStartOffset = fixedOffset.iX + rect2.x + (fixedOffset.iY +rect2.y) * targetScanlineLength; + + switch (screen->format->BitsPerPixel) + { + case 12: + { + TUint16* bitmapLine = (TUint16*)screen->pixels + sourceStartOffset; + TUint16* screenMemory = screenBuffer + targetStartOffset; + + if (skipValue == 1) + { + for(TInt y = 0 ; y < sourceRectHeight ; y++) + { + Mem::Copy(screenMemory, bitmapLine, sourceRectWidthInBytes); + bitmapLine += sourceScanlineLength; + screenMemory += targetScanlineLength; + } + } + else + { + for(TInt y = 0 ; y < sourceRectHeight ; y++) + { + TUint16* bitmapPos = bitmapLine; /* 2 bytes per pixel */ + TUint16* screenMemoryLinePos = screenMemory; /* 2 bytes per pixel */ + for(TInt x = 0 ; x < sourceRectWidth ; x++) + { + __ASSERT_DEBUG(screenMemory < (screenBuffer + phdata->NGAGE_ScreenSize.iWidth * phdata->NGAGE_ScreenSize.iHeight), User::Panic(_L("SDL"), KErrCorrupt)); + __ASSERT_DEBUG(screenMemory >= screenBuffer, User::Panic(_L("SDL"), KErrCorrupt)); + __ASSERT_DEBUG(bitmapLine < ((TUint16*)screen->pixels + (screen->w * screen->h)), User::Panic(_L("SDL"), KErrCorrupt)); + __ASSERT_DEBUG(bitmapLine >= (TUint16*)screen->pixels, User::Panic(_L("SDL"), KErrCorrupt)); + + *screenMemoryLinePos++ = *bitmapPos; + bitmapPos += skipValue; + } + bitmapLine += sourceScanlineLength; + screenMemory += targetScanlineLength; + } + } + } + break; + // 256 color paletted mode: 8 bpp --> 12 bpp + default: + { + if(phdata->NGAGE_BytesPerPixel <= 2) + { + TUint8* bitmapLine = (TUint8*)screen->pixels + sourceStartOffset; + TUint16* screenMemory = screenBuffer + targetStartOffset; + + for(TInt y = 0 ; y < sourceRectHeight ; y++) + { + TUint8* bitmapPos = bitmapLine; /* 1 byte per pixel */ + TUint16* screenMemoryLinePos = screenMemory; /* 2 bytes per pixel */ + /* Convert each pixel from 256 palette to 4k color values */ + for(TInt x = 0 ; x < sourceRectWidth ; x++) + { + __ASSERT_DEBUG(screenMemoryLinePos < (screenBuffer + (phdata->NGAGE_ScreenSize.iWidth * phdata->NGAGE_ScreenSize.iHeight)), User::Panic(_L("SDL"), KErrCorrupt)); + __ASSERT_DEBUG(screenMemoryLinePos >= screenBuffer, User::Panic(_L("SDL"), KErrCorrupt)); + __ASSERT_DEBUG(bitmapPos < ((TUint8*)screen->pixels + (screen->w * screen->h)), User::Panic(_L("SDL"), KErrCorrupt)); + __ASSERT_DEBUG(bitmapPos >= (TUint8*)screen->pixels, User::Panic(_L("SDL"), KErrCorrupt)); + *screenMemoryLinePos++ = NGAGE_HWPalette_256_to_Screen[*bitmapPos++]; + } + bitmapLine += sourceScanlineLength; + screenMemory += targetScanlineLength; + } + } + else + { + TUint8* bitmapLine = (TUint8*)screen->pixels + sourceStartOffset; + TUint32* screenMemory = reinterpret_cast(screenBuffer + targetStartOffset); + for(TInt y = 0 ; y < sourceRectHeight ; y++) + { + TUint8* bitmapPos = bitmapLine; /* 1 byte per pixel */ + TUint32* screenMemoryLinePos = screenMemory; /* 2 bytes per pixel */ + /* Convert each pixel from 256 palette to 4k color values */ + for(TInt x = 0 ; x < sourceRectWidth ; x++) + { + __ASSERT_DEBUG(screenMemoryLinePos < (reinterpret_cast(screenBuffer) + (phdata->NGAGE_ScreenSize.iWidth * phdata->NGAGE_ScreenSize.iHeight)), User::Panic(_L("SDL"), KErrCorrupt)); + __ASSERT_DEBUG(screenMemoryLinePos >= reinterpret_cast(screenBuffer), User::Panic(_L("SDL"), KErrCorrupt)); + __ASSERT_DEBUG(bitmapPos < ((TUint8*)screen->pixels + (screen->w * screen->h)), User::Panic(_L("SDL"), KErrCorrupt)); + __ASSERT_DEBUG(bitmapPos >= (TUint8*)screen->pixels, User::Panic(_L("SDL"), KErrCorrupt)); + *screenMemoryLinePos++ = NGAGE_HWPalette_256_to_Screen[*bitmapPos++]; + } + bitmapLine += sourceScanlineLength; + screenMemory += targetScanlineLength; + } + } + } + } + } +} + +void DirectUpdate(_THIS, int numrects, SDL_Rect *rects) +{ + SDL_VideoData *phdata = (SDL_VideoData*)_this->driverdata; + + if (! phdata->NGAGE_IsWindowFocused) + { + SDL_PauseAudio(1); + SDL_Delay(1000); + return; + } + + SDL_PauseAudio(0); + + TUint16* screenBuffer = (TUint16*)phdata->NGAGE_FrameBuffer; + +#if 0 + if (phdata->NGAGE_ScreenOrientation == CFbsBitGc::EGraphicsOrientationRotated270) + { + // ... + } + else +#endif + { + DirectDraw(_this, numrects, rects, screenBuffer); + } + + //TRect rect2 = TRect(phdata->NGAGE_WsWindow.Size()); + for (int i = 0; i < numrects; ++i) + { + TInt aAx = rects[i].x; + TInt aAy = rects[i].y; + TInt aBx = rects[i].w; + TInt aBy = rects[i].h; + TRect rect2 = TRect(aAx, aAy, aBx, aBy); + + phdata->NGAGE_DrawDevice->UpdateRegion(rect2); /* Should we update rects parameter area only? */ + phdata->NGAGE_DrawDevice->Update(); + } +} + +void RedrawWindowL(_THIS) +{ + SDL_VideoData *phdata = (SDL_VideoData*)_this->driverdata; + SDL_Surface *screen = (SDL_Surface*)SDL_GetWindowData(_this->windows, NGAGE_SURFACE); + + int w = screen->w; + int h = screen->h; + if (phdata->NGAGE_ScreenOrientation == CFbsBitGc::EGraphicsOrientationRotated270) { + w = screen->h; + h = screen->w; + } + if ((w < phdata->NGAGE_ScreenSize.iWidth) + || (h < phdata->NGAGE_ScreenSize.iHeight)) { + DrawBackground(_this); + } + + /* Tell the system that something has been drawn */ + TRect rect = TRect(phdata->NGAGE_WsWindow.Size()); + phdata->NGAGE_WsWindow.Invalidate(rect); + + /* Draw current buffer */ + SDL_Rect fullScreen; + fullScreen.x = 0; + fullScreen.y = 0; + fullScreen.w = screen->w; + fullScreen.h = screen->h; + DirectUpdate(_this, 1, &fullScreen); +} + +#endif /* SDL_VIDEO_DRIVER_NGAGE */ + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/video/ngage/SDL_ngagevideo.cpp libsdl2-2.24.0+dfsg/src/video/ngage/SDL_ngagevideo.cpp --- libsdl2-2.0.22+dfsg/src/video/ngage/SDL_ngagevideo.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/ngage/SDL_ngagevideo.cpp 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,192 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include +#ifdef NULL +#undef NULL +#endif +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_NGAGE + +#ifdef __cplusplus +extern "C" { +#endif + +#include "SDL_video.h" +#include "../SDL_sysvideo.h" +#include "../SDL_pixels_c.h" +#include "../../events/SDL_events_c.h" + +#ifdef __cplusplus +} +#endif + +#include "SDL_ngagevideo.h" +#include "SDL_ngagewindow.h" +#include "SDL_ngageevents_c.h" +#include "SDL_ngageframebuffer_c.h" + +#define NGAGEVID_DRIVER_NAME "ngage" + +/* Initialization/Query functions */ +static int NGAGE_VideoInit(_THIS); +static int NGAGE_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode); +static void NGAGE_VideoQuit(_THIS); + +/* NGAGE driver bootstrap functions */ + +static void +NGAGE_DeleteDevice(SDL_VideoDevice * device) +{ + SDL_VideoData *phdata = (SDL_VideoData*)device->driverdata; + + if (phdata) + { + /* Free Epoc resources */ + + /* Disable events for me */ + if (phdata->NGAGE_WsEventStatus != KRequestPending) + { + phdata->NGAGE_WsSession.EventReadyCancel(); + } + if (phdata->NGAGE_RedrawEventStatus != KRequestPending) + { + phdata->NGAGE_WsSession.RedrawReadyCancel(); + } + + free(phdata->NGAGE_DrawDevice); + + if (phdata->NGAGE_WsWindow.WsHandle()) + { + phdata->NGAGE_WsWindow.Close(); + } + + if (phdata->NGAGE_WsWindowGroup.WsHandle()) + { + phdata->NGAGE_WsWindowGroup.Close(); + } + + delete phdata->NGAGE_WindowGc; + phdata->NGAGE_WindowGc = NULL; + + delete phdata->NGAGE_WsScreen; + phdata->NGAGE_WsScreen = NULL; + + if (phdata->NGAGE_WsSession.WsHandle()) + { + phdata->NGAGE_WsSession.Close(); + } + + SDL_free(phdata); + phdata = NULL; + } + + if (device) + { + SDL_free(device); + device = NULL; + } +} + +static SDL_VideoDevice * +NGAGE_CreateDevice(void) +{ + SDL_VideoDevice *device; + SDL_VideoData *phdata; + + /* Initialize all variables that we clean on shutdown */ + device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); + if (!device) { + SDL_OutOfMemory(); + return (0); + } + + /* Initialize internal N-Gage specific data */ + phdata = (SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData)); + if (! phdata) + { + SDL_OutOfMemory(); + SDL_free(device); + return (0); + } + + /* General video */ + device->VideoInit = NGAGE_VideoInit; + device->VideoQuit = NGAGE_VideoQuit; + device->SetDisplayMode = NGAGE_SetDisplayMode; + device->PumpEvents = NGAGE_PumpEvents; + device->CreateWindowFramebuffer = SDL_NGAGE_CreateWindowFramebuffer; + device->UpdateWindowFramebuffer = SDL_NGAGE_UpdateWindowFramebuffer; + device->DestroyWindowFramebuffer = SDL_NGAGE_DestroyWindowFramebuffer; + device->free = NGAGE_DeleteDevice; + + /* "Window" */ + device->CreateSDLWindow = NGAGE_CreateWindow; + device->DestroyWindow = NGAGE_DestroyWindow; + + /* N-Gage specific data */ + device->driverdata = phdata; + + return device; +} + +VideoBootStrap NGAGE_bootstrap = { + NGAGEVID_DRIVER_NAME, "SDL ngage video driver", + NGAGE_CreateDevice +}; + +int +NGAGE_VideoInit(_THIS) +{ + SDL_DisplayMode mode; + + /* Use 12-bpp desktop mode */ + mode.format = SDL_PIXELFORMAT_RGB444; + mode.w = 176; + mode.h = 208; + mode.refresh_rate = 0; + mode.driverdata = NULL; + if (SDL_AddBasicVideoDisplay(&mode) < 0) { + return -1; + } + + SDL_zero(mode); + SDL_AddDisplayMode(&_this->displays[0], &mode); + + /* We're done! */ + return 0; +} + +static int +NGAGE_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) +{ + return 0; +} + +void +NGAGE_VideoQuit(_THIS) +{ +} + +#endif /* SDL_VIDEO_DRIVER_NGAGE */ + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/video/ngage/SDL_ngagevideo.h libsdl2-2.24.0+dfsg/src/video/ngage/SDL_ngagevideo.h --- libsdl2-2.0.22+dfsg/src/video/ngage/SDL_ngagevideo.h 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/ngage/SDL_ngagevideo.h 2022-06-02 02:01:57.000000000 +0000 @@ -0,0 +1,75 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#ifndef _SDL_ngagevideo_h +#define _SDL_ngagevideo_h + +#include "../SDL_sysvideo.h" + +#include +#include +#include +#include +#include // CFbsDrawDevice + +#define _THIS SDL_VideoDevice *_this + +typedef struct SDL_VideoData +{ + /* Epoc window server info */ + RWsSession NGAGE_WsSession; + RWindowGroup NGAGE_WsWindowGroup; + TInt NGAGE_WsWindowGroupID; + RWindow NGAGE_WsWindow; + CWsScreenDevice* NGAGE_WsScreen; + CWindowGc* NGAGE_WindowGc; + TRequestStatus NGAGE_WsEventStatus; + TRequestStatus NGAGE_RedrawEventStatus; + TWsEvent NGAGE_WsEvent; + //TWsRedrawEvent NGAGE_RedrawEvent; + + CFbsDrawDevice* NGAGE_DrawDevice; + + TBool NGAGE_IsWindowFocused; /* Not used yet */ + + /* Screen hardware frame buffer info */ + TBool NGAGE_HasFrameBuffer; + TInt NGAGE_BytesPerPixel; + TInt NGAGE_BytesPerScanLine; + TInt NGAGE_BytesPerScreen; + TDisplayMode NGAGE_DisplayMode; + TSize NGAGE_ScreenSize; + TUint8* NGAGE_FrameBuffer; + TPoint NGAGE_ScreenOffset; + + CFbsBitGc::TGraphicsOrientation NGAGE_ScreenOrientation; + + /* Simulate double screen height */ + //TInt NGAGE_ScreenXScaleValue; + //TInt NGAGE_ScreenYScaleValue; + +} SDL_VideoData; + +#endif /* _SDL_ngagevideo_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/video/ngage/SDL_ngagewindow.cpp libsdl2-2.24.0+dfsg/src/video/ngage/SDL_ngagewindow.cpp --- libsdl2-2.0.22+dfsg/src/video/ngage/SDL_ngagewindow.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/ngage/SDL_ngagewindow.cpp 2022-06-02 02:01:57.000000000 +0000 @@ -0,0 +1,129 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_NGAGE + +#include "../SDL_sysvideo.h" + +#include "SDL_ngagewindow.h" + +const TUint32 WindowClientHandle = 9210; + +void DisableKeyBlocking(_THIS); +void ConstructWindowL(_THIS); + +int +NGAGE_CreateWindow(_THIS, SDL_Window* window) +{ + NGAGE_Window* ngage_window = (NGAGE_Window*)SDL_calloc(1, sizeof(NGAGE_Window)); + + if (!ngage_window) { + return SDL_OutOfMemory(); + } + + window->driverdata = ngage_window; + + if (window->x == SDL_WINDOWPOS_UNDEFINED) { + window->x = 0; + } + + if (window->y == SDL_WINDOWPOS_UNDEFINED) { + window->y = 0; + } + + ngage_window->sdl_window = window; + + ConstructWindowL(_this); + + return 0; +} + +void +NGAGE_DestroyWindow(_THIS, SDL_Window* window) +{ + NGAGE_Window* ngage_window = (NGAGE_Window*)window->driverdata; + + if (ngage_window) { + SDL_free(ngage_window); + } + + window->driverdata = NULL; +} + +/*****************************************************************************/ +/* Internal */ +/*****************************************************************************/ + +void DisableKeyBlocking(_THIS) +{ + SDL_VideoData *phdata = (SDL_VideoData*)_this->driverdata; + TRawEvent event; + + event.Set((TRawEvent::TType) /*EDisableKeyBlock*/ 51); + phdata->NGAGE_WsSession.SimulateRawEvent(event); +} + +void ConstructWindowL(_THIS) +{ + SDL_VideoData *phdata = (SDL_VideoData*)_this->driverdata; + TInt error; + + error = phdata->NGAGE_WsSession.Connect(); + User::LeaveIfError(error); + phdata->NGAGE_WsScreen=new(ELeave) CWsScreenDevice(phdata->NGAGE_WsSession); + User::LeaveIfError(phdata->NGAGE_WsScreen->Construct()); + User::LeaveIfError(phdata->NGAGE_WsScreen->CreateContext(phdata->NGAGE_WindowGc)); + + phdata->NGAGE_WsWindowGroup=RWindowGroup(phdata->NGAGE_WsSession); + User::LeaveIfError(phdata->NGAGE_WsWindowGroup.Construct(WindowClientHandle)); + phdata->NGAGE_WsWindowGroup.SetOrdinalPosition(0); + + RProcess thisProcess; + TParse exeName; + exeName.Set(thisProcess.FileName(), NULL, NULL); + TBuf<32> winGroupName; + winGroupName.Append(0); + winGroupName.Append(0); + winGroupName.Append(0); // UID + winGroupName.Append(0); + winGroupName.Append(exeName.Name()); // Caption + winGroupName.Append(0); + winGroupName.Append(0); // DOC name + phdata->NGAGE_WsWindowGroup.SetName(winGroupName); + + phdata->NGAGE_WsWindow=RWindow(phdata->NGAGE_WsSession); + User::LeaveIfError(phdata->NGAGE_WsWindow.Construct(phdata->NGAGE_WsWindowGroup,WindowClientHandle - 1)); + phdata->NGAGE_WsWindow.SetBackgroundColor(KRgbWhite); + phdata->NGAGE_WsWindow.Activate(); + phdata->NGAGE_WsWindow.SetSize(phdata->NGAGE_WsScreen->SizeInPixels()); + phdata->NGAGE_WsWindow.SetVisible(ETrue); + + phdata->NGAGE_WsWindowGroupID = phdata->NGAGE_WsWindowGroup.Identifier(); + phdata->NGAGE_IsWindowFocused = EFalse; + + DisableKeyBlocking(_this); +} + +#endif /* SDL_VIDEO_DRIVER_NGAGE */ + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/video/ngage/SDL_ngagewindow.h libsdl2-2.24.0+dfsg/src/video/ngage/SDL_ngagewindow.h --- libsdl2-2.0.22+dfsg/src/video/ngage/SDL_ngagewindow.h 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/ngage/SDL_ngagewindow.h 2022-06-02 02:01:57.000000000 +0000 @@ -0,0 +1,45 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef _SDL_ngagewindow_h +#define _SDL_ngagewindow_h + +#include "../SDL_sysvideo.h" +#include "SDL_syswm.h" + +#include "SDL_ngagevideo.h" + +typedef struct { + SDL_Window* sdl_window; + +} NGAGE_Window; + + +extern int +NGAGE_CreateWindow(_THIS, SDL_Window* window); + +extern void +NGAGE_DestroyWindow(_THIS, SDL_Window* window); + +#endif /* _SDL_ngagewindow */ + +/* vi: set ts=4 sw=4 expandtab: */ + diff -Nru libsdl2-2.0.22+dfsg/src/video/offscreen/SDL_offscreenvideo.c libsdl2-2.24.0+dfsg/src/video/offscreen/SDL_offscreenvideo.c --- libsdl2-2.0.22+dfsg/src/video/offscreen/SDL_offscreenvideo.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/offscreen/SDL_offscreenvideo.c 2022-08-13 03:48:10.000000000 +0000 @@ -58,7 +58,7 @@ } static SDL_VideoDevice * -OFFSCREEN_CreateDevice(int devindex) +OFFSCREEN_CreateDevice(void) { SDL_VideoDevice *device; diff -Nru libsdl2-2.0.22+dfsg/src/video/os2/SDL_os2video.c libsdl2-2.24.0+dfsg/src/video/os2/SDL_os2video.c --- libsdl2-2.0.22+dfsg/src/video/os2/SDL_os2video.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/os2/SDL_os2video.c 2022-08-13 03:48:10.000000000 +0000 @@ -855,8 +855,9 @@ if (cbText != 0) window->title = OS2_SysToUTF8(pszText); - if (pszText != NULL) + if (pszText != NULL) { SDL_stack_free(pszText); + } /* Set SDL-window flags */ window->flags &= ~(SDL_WINDOW_SHOWN | SDL_WINDOW_BORDERLESS | @@ -1137,8 +1138,8 @@ return SDL_TRUE; } - SDL_SetError("Application not compiled with SDL %u.%u", - SDL_MAJOR_VERSION, SDL_MINOR_VERSION); + SDL_SetError("Application not compiled with SDL %u", + SDL_MAJOR_VERSION); return SDL_FALSE; } @@ -1572,7 +1573,7 @@ SDL_DisplayMode mode; debug_os2("Enter"); - SDL_memcpy(&mode, &display->current_mode, sizeof(SDL_DisplayMode)); + SDL_copyp(&mode, &display->current_mode); mode.driverdata = (MODEDATA *) SDL_malloc(sizeof(MODEDATA)); if (!mode.driverdata) return; /* yikes.. */ SDL_memcpy(mode.driverdata, display->current_mode.driverdata, sizeof(MODEDATA)); @@ -1592,7 +1593,7 @@ SDL_free(device); } -static SDL_VideoDevice *OS2_CreateDevice(int devindex) +static SDL_VideoDevice *OS2_CreateDevice(void) { SDL_VideoDevice *device; @@ -1647,37 +1648,36 @@ return device; } -static SDL_VideoDevice *OS2DIVE_CreateDevice(int devindex) +static SDL_VideoDevice *OS2DIVE_CreateDevice(void) { VIDEOOUTPUTINFO stVOInfo; if (!voDive.QueryInfo(&stVOInfo)) { return NULL; } - return OS2_CreateDevice(devindex); + return OS2_CreateDevice(); } -static SDL_VideoDevice *OS2VMAN_CreateDevice(int devindex) +static SDL_VideoDevice *OS2VMAN_CreateDevice(void) { VIDEOOUTPUTINFO stVOInfo; if (!voVMan.QueryInfo(&stVOInfo)) { return NULL; } - return OS2_CreateDevice(devindex); + return OS2_CreateDevice(); } -/* Both bootstraps for DIVE and VMAN are uing same function OS2_CreateDevice(). +/* DIVE and VMAN bootstraps both call the same OS2_CreateDevice() function. * Video output system will be selected in OS2_VideoInit() by driver name. */ VideoBootStrap OS2DIVE_bootstrap = { - OS2DRIVER_NAME_DIVE, "OS/2 video driver", - OS2DIVE_CreateDevice + OS2DRIVER_NAME_DIVE, "OS/2 video driver", + OS2DIVE_CreateDevice }; - VideoBootStrap OS2VMAN_bootstrap = { - OS2DRIVER_NAME_VMAN, "OS/2 video driver", - OS2VMAN_CreateDevice + OS2DRIVER_NAME_VMAN, "OS/2 video driver", + OS2VMAN_CreateDevice }; #endif /* SDL_VIDEO_DRIVER_OS2 */ diff -Nru libsdl2-2.0.22+dfsg/src/video/pandora/SDL_pandora.c libsdl2-2.24.0+dfsg/src/video/pandora/SDL_pandora.c --- libsdl2-2.0.22+dfsg/src/video/pandora/SDL_pandora.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/pandora/SDL_pandora.c 2022-06-02 02:01:57.000000000 +0000 @@ -302,8 +302,8 @@ if (info->version.major <= SDL_MAJOR_VERSION) { return SDL_TRUE; } else { - SDL_SetError("application not compiled with SDL %d.%d", - SDL_MAJOR_VERSION, SDL_MINOR_VERSION); + SDL_SetError("application not compiled with SDL %d", + SDL_MAJOR_VERSION); return SDL_FALSE; } diff -Nru libsdl2-2.0.22+dfsg/src/video/ps2/SDL_ps2video.c libsdl2-2.24.0+dfsg/src/video/ps2/SDL_ps2video.c --- libsdl2-2.0.22+dfsg/src/video/ps2/SDL_ps2video.c 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/ps2/SDL_ps2video.c 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,135 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_PS2 + +/* PS2 SDL video driver implementation; this is just enough to make an + * SDL-based application THINK it's got a working video driver, for + * applications that call SDL_Init(SDL_INIT_VIDEO) when they don't need it, + * and also for use as a collection of stubs when porting SDL to a new + * platform for which you haven't yet written a valid video driver. + * + * This is also a great way to determine bottlenecks: if you think that SDL + * is a performance problem for a given platform, enable this driver, and + * then see if your application runs faster without video overhead. + * + * Initial work by Ryan C. Gordon (icculus@icculus.org). A good portion + * of this was cut-and-pasted from Stephane Peter's work in the AAlib + * SDL video driver. Renamed to "PS2" by Sam Lantinga. + */ + +#include "SDL_video.h" +#include "SDL_mouse.h" +#include "../SDL_sysvideo.h" +#include "../SDL_pixels_c.h" +#include "../../events/SDL_events_c.h" + +#include "SDL_ps2video.h" +#include "SDL_hints.h" + +/* PS2 driver bootstrap functions */ + +static int PS2_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) +{ + return 0; +} + +static void PS2_DeleteDevice(SDL_VideoDevice * device) +{ + SDL_free(device); +} + +static int PS2_CreateWindow(_THIS, SDL_Window * window) +{ + SDL_SetKeyboardFocus(window); + + /* Window has been successfully created */ + return 0; +} + +static int PS2_VideoInit(_THIS) +{ + SDL_VideoDisplay display; + SDL_DisplayMode current_mode; + + SDL_zero(current_mode); + + current_mode.w = 640; + current_mode.h = 480; + current_mode.refresh_rate = 60; + + /* 32 bpp for default */ + current_mode.format = SDL_PIXELFORMAT_ABGR8888; + current_mode.driverdata = NULL; + + SDL_zero(display); + display.desktop_mode = current_mode; + display.current_mode = current_mode; + display.driverdata = NULL; + SDL_AddDisplayMode(&display, ¤t_mode); + + SDL_AddVideoDisplay(&display, SDL_FALSE); + + return 1; +} + +static void PS2_VideoQuit(_THIS) +{ + +} + +static void PS2_PumpEvents(_THIS) +{ + /* do nothing. */ +} + +static SDL_VideoDevice *PS2_CreateDevice(void) +{ + SDL_VideoDevice *device; + + /* Initialize all variables that we clean on shutdown */ + device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); + if (!device) { + SDL_OutOfMemory(); + return (0); + } + + /* Set the function pointers */ + device->VideoInit = PS2_VideoInit; + device->VideoQuit = PS2_VideoQuit; + device->SetDisplayMode = PS2_SetDisplayMode; + device->CreateSDLWindow = PS2_CreateWindow; + device->PumpEvents = PS2_PumpEvents; + device->free = PS2_DeleteDevice; + + return device; +} + +VideoBootStrap PS2_bootstrap = { + "PS2", + "PS2 Video Driver", + PS2_CreateDevice +}; + +#endif /* SDL_VIDEO_DRIVER_PS2 */ + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/video/ps2/SDL_ps2video.h libsdl2-2.24.0+dfsg/src/video/ps2/SDL_ps2video.h --- libsdl2-2.0.22+dfsg/src/video/ps2/SDL_ps2video.h 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/ps2/SDL_ps2video.h 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,38 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifndef SDL_ps2video_h_ +#define SDL_ps2video_h_ + +#include "../SDL_sysvideo.h" + +#include + +#include +#include + +#include +#include + +#endif /* SDL_ps2video_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/video/psp/SDL_pspevents.c libsdl2-2.24.0+dfsg/src/video/psp/SDL_pspevents.c --- libsdl2-2.0.22+dfsg/src/video/psp/SDL_pspevents.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/psp/SDL_pspevents.c 2022-08-13 03:48:10.000000000 +0000 @@ -26,9 +26,9 @@ most of the API. */ #include "SDL.h" -#include "../../events/SDL_sysevents.h" #include "../../events/SDL_events_c.h" #include "../../events/SDL_keyboard_c.h" +#include "../SDL_sysvideo.h" #include "SDL_pspvideo.h" #include "SDL_pspevents_c.h" #include "SDL_keyboard.h" diff -Nru libsdl2-2.0.22+dfsg/src/video/psp/SDL_pspevents_c.h libsdl2-2.24.0+dfsg/src/video/psp/SDL_pspevents_c.h --- libsdl2-2.0.22+dfsg/src/video/psp/SDL_pspevents_c.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/psp/SDL_pspevents_c.h 2022-08-13 03:48:10.000000000 +0000 @@ -21,9 +21,6 @@ #include "SDL_pspvideo.h" -/* Variables and functions exported by SDL_sysevents.c to other parts - of the native video subsystem (SDL_sysvideo.c) -*/ extern void PSP_InitOSKeymap(_THIS); extern void PSP_PumpEvents(_THIS); diff -Nru libsdl2-2.0.22+dfsg/src/video/psp/SDL_pspvideo.c libsdl2-2.24.0+dfsg/src/video/psp/SDL_pspvideo.c --- libsdl2-2.0.22+dfsg/src/video/psp/SDL_pspvideo.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/psp/SDL_pspvideo.c 2022-06-02 02:01:57.000000000 +0000 @@ -287,8 +287,8 @@ if (info->version.major <= SDL_MAJOR_VERSION) { return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d", - SDL_MAJOR_VERSION, SDL_MINOR_VERSION); + SDL_SetError("Application not compiled with SDL %d", + SDL_MAJOR_VERSION); return SDL_FALSE; } diff -Nru libsdl2-2.0.22+dfsg/src/video/raspberry/SDL_rpievents.c libsdl2-2.24.0+dfsg/src/video/raspberry/SDL_rpievents.c --- libsdl2-2.0.22+dfsg/src/video/raspberry/SDL_rpievents.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/raspberry/SDL_rpievents.c 2022-08-13 03:48:10.000000000 +0000 @@ -23,9 +23,9 @@ #if SDL_VIDEO_DRIVER_RPI -#include "../../events/SDL_sysevents.h" #include "../../events/SDL_events_c.h" #include "../../events/SDL_keyboard_c.h" +#include "../SDL_sysvideo.h" #include "SDL_rpivideo.h" #include "SDL_rpievents_c.h" diff -Nru libsdl2-2.0.22+dfsg/src/video/raspberry/SDL_rpivideo.c libsdl2-2.24.0+dfsg/src/video/raspberry/SDL_rpivideo.c --- libsdl2-2.0.22+dfsg/src/video/raspberry/SDL_rpivideo.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/raspberry/SDL_rpivideo.c 2022-06-02 02:01:57.000000000 +0000 @@ -431,8 +431,8 @@ if (info->version.major <= SDL_MAJOR_VERSION) { return SDL_TRUE; } else { - SDL_SetError("application not compiled with SDL %d.%d", - SDL_MAJOR_VERSION, SDL_MINOR_VERSION); + SDL_SetError("application not compiled with SDL %d", + SDL_MAJOR_VERSION); return SDL_FALSE; } diff -Nru libsdl2-2.0.22+dfsg/src/video/riscos/scancodes_riscos.h libsdl2-2.24.0+dfsg/src/video/riscos/scancodes_riscos.h --- libsdl2-2.0.22+dfsg/src/video/riscos/scancodes_riscos.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/riscos/scancodes_riscos.h 2022-06-02 02:01:57.000000000 +0000 @@ -24,7 +24,7 @@ Sources: - https://www.riscosopen.org/wiki/documentation/show/Keyboard Scan Codes */ -/* *INDENT-OFF* */ +/* *INDENT-OFF* */ /* clang-format off */ static SDL_Scancode const riscos_scancode_table[] = { /* 0 */ SDL_SCANCODE_UNKNOWN, /* Shift */ /* 1 */ SDL_SCANCODE_UNKNOWN, /* Ctrl */ @@ -155,4 +155,4 @@ /* 126 */ SDL_SCANCODE_RGUI, /* 127 */ SDL_SCANCODE_MENU }; -/* *INDENT-ON* */ +/* *INDENT-ON* */ /* clang-format on */ diff -Nru libsdl2-2.0.22+dfsg/src/video/riscos/SDL_riscosevents.c libsdl2-2.24.0+dfsg/src/video/riscos/SDL_riscosevents.c --- libsdl2-2.0.22+dfsg/src/video/riscos/SDL_riscosevents.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/riscos/SDL_riscosevents.c 2022-06-02 02:01:57.000000000 +0000 @@ -143,6 +143,7 @@ RISCOS_InitEvents(_THIS) { SDL_VideoData *driverdata = (SDL_VideoData *) _this->driverdata; + _kernel_swi_regs regs; int i, status; for (i = 0; i < RISCOS_MAX_KEYS_PRESSED; i++) @@ -153,6 +154,9 @@ SDL_ToggleModState(KMOD_CAPS, (status & (1 << 4)) == 0); SDL_ToggleModState(KMOD_SCROLL, (status & (1 << 1)) != 0); + _kernel_swi(OS_Mouse, ®s, ®s); + driverdata->last_mouse_buttons = regs.r[2]; + /* Disable escape. */ _kernel_osbyte(229, 1, 0); diff -Nru libsdl2-2.0.22+dfsg/src/video/riscos/SDL_riscosmodes.c libsdl2-2.24.0+dfsg/src/video/riscos/SDL_riscosmodes.c --- libsdl2-2.0.22+dfsg/src/video/riscos/SDL_riscosmodes.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/riscos/SDL_riscosmodes.c 2022-06-02 02:01:57.000000000 +0000 @@ -23,6 +23,7 @@ #if SDL_VIDEO_DRIVER_RISCOS #include "../SDL_sysvideo.h" +#include "../../events/SDL_mouse_c.h" #include "SDL_riscosvideo.h" #include "SDL_riscosmodes.h" @@ -304,8 +305,8 @@ _kernel_oswrch(disable_cursor[i]); } - /* Turn the mouse pointer on */ - /* _kernel_osbyte(106, 1, 0); */ + /* Update cursor visibility, since it may have been disabled by the mode change. */ + SDL_SetCursor(NULL); return 0; } diff -Nru libsdl2-2.0.22+dfsg/src/video/riscos/SDL_riscosmouse.c libsdl2-2.24.0+dfsg/src/video/riscos/SDL_riscosmouse.c --- libsdl2-2.0.22+dfsg/src/video/riscos/SDL_riscosmouse.c 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/riscos/SDL_riscosmouse.c 2022-06-02 02:01:57.000000000 +0000 @@ -0,0 +1,88 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_RISCOS + +#include "../../events/SDL_mouse_c.h" + +#include + + +static SDL_Cursor * +RISCOS_CreateDefaultCursor() +{ + SDL_Cursor *cursor; + + cursor = SDL_calloc(1, sizeof(*cursor)); + if (cursor) { + /* NULL is used to indicate the default cursor */ + cursor->driverdata = NULL; + } else { + SDL_OutOfMemory(); + } + + return cursor; +} + +static void +RISCOS_FreeCursor(SDL_Cursor * cursor) +{ + SDL_free(cursor); +} + +static int +RISCOS_ShowCursor(SDL_Cursor * cursor) +{ + if (cursor) { + /* Turn the mouse pointer on */ + _kernel_osbyte(106, 1, 0); + } else { + /* Turn the mouse pointer off */ + _kernel_osbyte(106, 0, 0); + } + + return 0; +} + +int +RISCOS_InitMouse(_THIS) +{ + SDL_Mouse *mouse = SDL_GetMouse(); + + /* mouse->CreateCursor = RISCOS_CreateCursor; */ + /* mouse->CreateSystemCursor = RISCOS_CreateSystemCursor; */ + mouse->ShowCursor = RISCOS_ShowCursor; + mouse->FreeCursor = RISCOS_FreeCursor; + /* mouse->WarpMouse = RISCOS_WarpMouse; */ + /* mouse->WarpMouseGlobal = RISCOS_WarpMouseGlobal; */ + /* mouse->SetRelativeMouseMode = RISCOS_SetRelativeMouseMode; */ + /* mouse->CaptureMouse = RISCOS_CaptureMouse; */ + /* mouse->GetGlobalMouseState = RISCOS_GetGlobalMouseState; */ + + SDL_SetDefaultCursor(RISCOS_CreateDefaultCursor()); + + return 0; +} + +#endif /* SDL_VIDEO_DRIVER_RISCOS */ + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/video/riscos/SDL_riscosmouse.h libsdl2-2.24.0+dfsg/src/video/riscos/SDL_riscosmouse.h --- libsdl2-2.0.22+dfsg/src/video/riscos/SDL_riscosmouse.h 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/riscos/SDL_riscosmouse.h 2022-06-02 02:01:57.000000000 +0000 @@ -0,0 +1,30 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifndef SDL_riscosmouse_h_ +#define SDL_riscosmouse_h_ + +extern int RISCOS_InitMouse(_THIS); + +#endif /* SDL_riscosmouse_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/video/riscos/SDL_riscosvideo.c libsdl2-2.24.0+dfsg/src/video/riscos/SDL_riscosvideo.c --- libsdl2-2.0.22+dfsg/src/video/riscos/SDL_riscosvideo.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/riscos/SDL_riscosvideo.c 2022-08-13 03:48:10.000000000 +0000 @@ -31,6 +31,7 @@ #include "SDL_riscosvideo.h" #include "SDL_riscosevents_c.h" #include "SDL_riscosframebuffer_c.h" +#include "SDL_riscosmouse.h" #include "SDL_riscosmodes.h" #include "SDL_riscoswindow.h" @@ -50,7 +51,7 @@ } static SDL_VideoDevice * -RISCOS_CreateDevice(int devindex) +RISCOS_CreateDevice(void) { SDL_VideoDevice *device; SDL_VideoData *phdata; @@ -105,6 +106,10 @@ return -1; } + if (RISCOS_InitMouse(_this) < 0) { + return -1; + } + if (RISCOS_InitModes(_this) < 0) { return -1; } diff -Nru libsdl2-2.0.22+dfsg/src/video/riscos/SDL_riscoswindow.c libsdl2-2.24.0+dfsg/src/video/riscos/SDL_riscoswindow.c --- libsdl2-2.0.22+dfsg/src/video/riscos/SDL_riscoswindow.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/riscos/SDL_riscoswindow.c 2022-06-02 02:01:57.000000000 +0000 @@ -25,6 +25,8 @@ #include "SDL_version.h" #include "SDL_syswm.h" #include "../SDL_sysvideo.h" +#include "../../events/SDL_mouse_c.h" + #include "SDL_riscosvideo.h" #include "SDL_riscoswindow.h" @@ -42,6 +44,8 @@ window->flags |= SDL_WINDOW_FULLSCREEN; + SDL_SetMouseFocus(window); + /* All done! */ window->driverdata = driverdata; return 0; @@ -62,13 +66,12 @@ SDL_bool RISCOS_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) { - if (info->version.major == SDL_MAJOR_VERSION && - info->version.minor == SDL_MINOR_VERSION) { + if (info->version.major == SDL_MAJOR_VERSION) { info->subsystem = SDL_SYSWM_RISCOS; return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d", - SDL_MAJOR_VERSION, SDL_MINOR_VERSION); + SDL_SetError("Application not compiled with SDL %d", + SDL_MAJOR_VERSION); return SDL_FALSE; } } diff -Nru libsdl2-2.0.22+dfsg/src/video/SDL_blit_1.c libsdl2-2.24.0+dfsg/src/video/SDL_blit_1.c --- libsdl2-2.0.22+dfsg/src/video/SDL_blit_1.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/SDL_blit_1.c 2022-06-02 02:01:57.000000000 +0000 @@ -50,7 +50,7 @@ while (height--) { #ifdef USE_DUFFS_LOOP - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { *dst = map[*src]; @@ -58,7 +58,7 @@ dst++; src++; , width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ #else for (c = width; c; --c) { *dst = map[*src]; @@ -103,14 +103,14 @@ #ifdef USE_DUFFS_LOOP while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { *(Uint16 *)dst = map[*src++]; dst += 2; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -210,7 +210,7 @@ while (height--) { #ifdef USE_DUFFS_LOOP - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { o = *src * 4; @@ -221,7 +221,7 @@ src++; dst += 3; , width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ #else for (c = width; c; --c) { o = *src * 4; @@ -259,11 +259,11 @@ while (height--) { #ifdef USE_DUFFS_LOOP - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( *dst++ = map[*src++]; , width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ #else for (c = width / 4; c; --c) { *dst++ = map[*src++]; @@ -299,7 +299,7 @@ if (palmap) { while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { if ( *src != ckey ) { @@ -309,13 +309,13 @@ src++; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } } else { while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { if ( *src != ckey ) { @@ -325,7 +325,7 @@ src++; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -348,7 +348,7 @@ dstskip /= 2; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { if ( *src != ckey ) { @@ -358,7 +358,7 @@ dstp++; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dstp += dstskip; } @@ -378,7 +378,7 @@ int o; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { if ( *src != ckey ) { @@ -391,7 +391,7 @@ dst += 3; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -413,7 +413,7 @@ dstskip /= 4; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { if ( *src != ckey ) { @@ -423,7 +423,7 @@ dstp++; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dstp += dstskip; } @@ -450,7 +450,7 @@ dstbpp = dstfmt->BytesPerPixel; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP4( { sR = srcpal[*src].r; @@ -463,7 +463,7 @@ dst += dstbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -491,7 +491,7 @@ dstbpp = dstfmt->BytesPerPixel; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { if ( *src != ckey ) { @@ -506,7 +506,7 @@ dst += dstbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } diff -Nru libsdl2-2.0.22+dfsg/src/video/SDL_blit_A.c libsdl2-2.24.0+dfsg/src/video/SDL_blit_A.c --- libsdl2-2.0.22+dfsg/src/video/SDL_blit_A.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/SDL_blit_A.c 2022-06-02 02:01:57.000000000 +0000 @@ -47,7 +47,7 @@ const unsigned A = info->a; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP4( { DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB); @@ -68,7 +68,7 @@ src += srcbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -93,7 +93,7 @@ unsigned dR, dG, dB; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP4( { DISEMBLE_RGBA(src,srcbpp,srcfmt,Pixel,sR,sG,sB,sA); @@ -114,7 +114,7 @@ src += srcbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -141,7 +141,7 @@ const unsigned A = info->a; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB); @@ -164,7 +164,7 @@ src += srcbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -348,7 +348,7 @@ multmask2 = 0x00FF00FF00FF00FFULL; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP4({ Uint32 alpha = *srcp & amask; if (alpha == 0) { @@ -382,7 +382,7 @@ ++srcp; ++dstp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ srcp += srcskip; dstp += dstskip; } @@ -467,14 +467,14 @@ int dstskip = info->dst_skip >> 2; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP4({ Uint32 s = *srcp++; Uint32 d = *dstp; *dstp++ = ((((s & 0x00fefefe) + (d & 0x00fefefe)) >> 1) + (s & d & 0x00010101)) | 0xff000000; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ srcp += srcskip; dstp += dstskip; } @@ -500,7 +500,7 @@ Uint32 d1; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP4({ s = *srcp; d = *dstp; @@ -515,7 +515,7 @@ ++srcp; ++dstp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ srcp += srcskip; dstp += dstskip; } @@ -534,7 +534,7 @@ int dstskip = info->dst_skip >> 2; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP4({ Uint32 dalpha; Uint32 d; @@ -569,7 +569,7 @@ ++srcp; ++dstp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ srcp += srcskip; dstp += dstskip; } @@ -587,7 +587,7 @@ int dstskip = info->dst_skip >> 2; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP4({ Uint32 dalpha; Uint32 d; @@ -624,7 +624,7 @@ ++srcp; ++dstp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ srcp += srcskip; dstp += dstskip; } @@ -654,7 +654,7 @@ multmask2 = 0x00FF00FF00FF00FFULL; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP4({ Uint32 alpha; @@ -694,7 +694,7 @@ ++srcp; ++dstp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ srcp += srcskip; dstp += dstskip; } @@ -848,7 +848,7 @@ bmask = _mm_set_pi32(0x001F001F, 0x001F001F); /* MASKBLUE -> bmask */ while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP_124( { s = *srcp++; @@ -944,7 +944,7 @@ srcp += 4; dstp += 4; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ srcp += srcskip; dstp += dstskip; } @@ -986,7 +986,7 @@ bmask = _mm_set_pi32(0x001F001F, 0x001F001F); /* MASKBLUE -> bmask */ while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP_124( { s = *srcp++; @@ -1082,7 +1082,7 @@ srcp += 4; dstp += 4; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ srcp += srcskip; dstp += dstskip; } @@ -1109,7 +1109,7 @@ alpha >>= 3; /* downscale alpha to 5 bits */ while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP4({ Uint32 s = *srcp++; Uint32 d = *dstp; @@ -1124,7 +1124,7 @@ d &= 0x07e0f81f; *dstp++ = (Uint16)(d | d >> 16); }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ srcp += srcskip; dstp += dstskip; } @@ -1148,7 +1148,7 @@ alpha >>= 3; /* downscale alpha to 5 bits */ while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP4({ Uint32 s = *srcp++; Uint32 d = *dstp; @@ -1163,7 +1163,7 @@ d &= 0x03e07c1f; *dstp++ = (Uint16)(d | d >> 16); }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ srcp += srcskip; dstp += dstskip; } @@ -1182,7 +1182,7 @@ int dstskip = info->dst_skip >> 1; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP4({ Uint32 s = *srcp; unsigned alpha = s >> 27; /* downscale alpha to 5 bits */ @@ -1210,7 +1210,7 @@ srcp++; dstp++; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ srcp += srcskip; dstp += dstskip; } @@ -1228,7 +1228,7 @@ int dstskip = info->dst_skip >> 1; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP4({ unsigned alpha; Uint32 s = *srcp; @@ -1257,7 +1257,7 @@ srcp++; dstp++; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ srcp += srcskip; dstp += dstskip; } @@ -1284,7 +1284,7 @@ if (sA) { while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP4( { DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB); @@ -1295,7 +1295,7 @@ dst += dstbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -1323,7 +1323,7 @@ const unsigned sA = info->a; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP4( { RETRIEVE_RGB_PIXEL(src, srcbpp, Pixel); @@ -1337,7 +1337,7 @@ dst += dstbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -1366,7 +1366,7 @@ dstbpp = dstfmt->BytesPerPixel; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP4( { DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, sR, sG, sB, sA); @@ -1379,7 +1379,7 @@ dst += dstbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } diff -Nru libsdl2-2.0.22+dfsg/src/video/SDL_blit_auto.c libsdl2-2.24.0+dfsg/src/video/SDL_blit_auto.c --- libsdl2-2.0.22+dfsg/src/video/SDL_blit_auto.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/SDL_blit_auto.c 2022-06-02 02:01:57.000000000 +0000 @@ -23,7 +23,7 @@ #if SDL_HAVE_BLIT_AUTO -/* *INDENT-OFF* */ +/* *INDENT-OFF* */ /* clang-format off */ #include "SDL_video.h" #include "SDL_blit.h" @@ -7014,7 +7014,7 @@ { 0, 0, 0, 0, NULL } }; -/* *INDENT-ON* */ +/* *INDENT-ON* */ /* clang-format on */ #endif /* SDL_HAVE_BLIT_AUTO */ diff -Nru libsdl2-2.0.22+dfsg/src/video/SDL_blit.h libsdl2-2.24.0+dfsg/src/video/SDL_blit.h --- libsdl2-2.0.22+dfsg/src/video/SDL_blit.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/SDL_blit.h 2022-08-13 03:48:10.000000000 +0000 @@ -90,7 +90,8 @@ } SDL_BlitFuncEntry; /* Blit mapping definition */ -typedef struct SDL_BlitMap +/* typedef'ed in SDL_surface.h */ +struct SDL_BlitMap { SDL_Surface *dst; int identity; @@ -102,7 +103,7 @@ an invalid mapping */ Uint32 dst_palette_version; Uint32 src_palette_version; -} SDL_BlitMap; +}; /* Functions found in SDL_blit.c */ extern int SDL_CalculateBlit(SDL_Surface * surface); diff -Nru libsdl2-2.0.22+dfsg/src/video/SDL_blit_N.c libsdl2-2.24.0+dfsg/src/video/SDL_blit_N.c --- libsdl2-2.0.22+dfsg/src/video/SDL_blit_N.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/SDL_blit_N.c 2022-06-02 02:01:57.000000000 +0000 @@ -1008,11 +1008,11 @@ if (map == NULL) { while (height--) { #ifdef USE_DUFFS_LOOP - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( RGB888_RGB332(*dst++, *src); , width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ #else for (c = width / 4; c; --c) { /* Pack RGB into 8bit pixel */ @@ -1044,13 +1044,13 @@ while (height--) { #ifdef USE_DUFFS_LOOP - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( RGB888_RGB332(Pixel, *src); *dst++ = map[Pixel]; ++src; , width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ #else for (c = width / 4; c; --c) { /* Pack RGB into 8bit pixel */ @@ -1118,11 +1118,11 @@ if (map == NULL) { while (height--) { #ifdef USE_DUFFS_LOOP - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( RGB101010_RGB332(*dst++, *src); , width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ #else for (c = width / 4; c; --c) { /* Pack RGB into 8bit pixel */ @@ -1154,13 +1154,13 @@ while (height--) { #ifdef USE_DUFFS_LOOP - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( RGB101010_RGB332(Pixel, *src); *dst++ = map[Pixel]; ++src; , width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ #else for (c = width / 4; c; --c) { /* Pack RGB into 8bit pixel */ @@ -1235,13 +1235,13 @@ #ifdef USE_DUFFS_LOOP while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( RGB888_RGB555(dst, src); ++src; ++dst; , width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -1361,13 +1361,13 @@ #ifdef USE_DUFFS_LOOP while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( RGB888_RGB565(dst, src); ++src; ++dst; , width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -1476,14 +1476,14 @@ #ifdef USE_DUFFS_LOOP while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { *dst++ = RGB565_32(dst, src, map); src += 2; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -2088,7 +2088,7 @@ Uint16 mask = ((Uint32)info->a >> dstfmt->Aloss) << dstfmt->Ashift; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { *dst = *src | mask; @@ -2096,7 +2096,7 @@ ++src; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src = (Uint16 *) ((Uint8 *) src + srcskip); dst = (Uint16 *) ((Uint8 *) dst + dstskip); } @@ -2132,7 +2132,7 @@ if (map == NULL) { while (height--) { #ifdef USE_DUFFS_LOOP - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB); @@ -2145,7 +2145,7 @@ dst++; src += srcbpp; , width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ #else for (c = width; c; --c) { DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB); @@ -2164,7 +2164,7 @@ } else { while (height--) { #ifdef USE_DUFFS_LOOP - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB); @@ -2177,7 +2177,7 @@ dst++; src += srcbpp; , width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ #else for (c = width; c; --c) { DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB); @@ -2214,7 +2214,7 @@ Uint32 mask = ((Uint32)info->a >> dstfmt->Aloss) << dstfmt->Ashift; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { *dst = *src | mask; @@ -2222,7 +2222,7 @@ ++src; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src = (Uint32 *) ((Uint8 *) src + srcskip); dst = (Uint32 *) ((Uint8 *) dst + dstskip); } @@ -2231,7 +2231,7 @@ Uint32 mask = srcfmt->Rmask | srcfmt->Gmask | srcfmt->Bmask; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { *dst = *src & mask; @@ -2239,7 +2239,7 @@ ++src; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src = (Uint32 *) ((Uint8 *) src + srcskip); dst = (Uint32 *) ((Uint8 *) dst + dstskip); } @@ -2259,7 +2259,7 @@ /* RGBA->RGBA, COPY_ALPHA */ while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { *dst = *src; @@ -2267,7 +2267,7 @@ ++src; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src = (Uint32 *) ((Uint8 *) src + srcskip); dst = (Uint32 *) ((Uint8 *) dst + dstskip); } @@ -2380,7 +2380,7 @@ get_permutation(srcfmt, dstfmt, &p0, &p1, &p2, &p3, &alpha_channel); while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { dst[0] = src[p0]; @@ -2391,7 +2391,7 @@ src += 4; dst += 4; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -2408,7 +2408,7 @@ get_permutation(srcfmt, dstfmt, &p0, &p1, &p2, &p3, NULL); while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { dst[0] = src[p0]; @@ -2417,7 +2417,7 @@ src += 4; dst += 3; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -2434,7 +2434,7 @@ get_permutation(srcfmt, dstfmt, &p0, &p1, &p2, &p3, &alpha_channel); while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { dst[0] = src[p0]; @@ -2445,7 +2445,7 @@ src += 3; dst += 4; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -2454,7 +2454,7 @@ #endif while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { Uint32 Pixel; @@ -2467,7 +2467,7 @@ src += srcbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -2499,7 +2499,7 @@ get_permutation(srcfmt, dstfmt, &p0, &p1, &p2, &p3, NULL); while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { dst[0] = src[p0]; @@ -2509,7 +2509,7 @@ src += 4; dst += 4; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -2554,7 +2554,7 @@ if (palmap == NULL) { while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, @@ -2569,13 +2569,13 @@ src += srcbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } } else { while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, @@ -2590,7 +2590,7 @@ src += srcbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -2615,7 +2615,7 @@ ckey &= rgbmask; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { if ( (*srcp & rgbmask) != ckey ) { @@ -2625,7 +2625,7 @@ srcp++; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ srcp += srcskip; dstp += dstskip; } @@ -2662,7 +2662,7 @@ /* RGB->RGBA, SET_ALPHA */ Uint32 mask = ((Uint32)info->a) << dstfmt->Ashift; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { if ((*src32 & rgbmask) != ckey) { @@ -2671,7 +2671,7 @@ ++dst32; ++src32; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src32 = (Uint32 *) ((Uint8 *) src32 + srcskip); dst32 = (Uint32 *) ((Uint8 *) dst32 + dstskip); } @@ -2680,7 +2680,7 @@ /* RGBA->RGB, NO_ALPHA */ Uint32 mask = srcfmt->Rmask | srcfmt->Gmask | srcfmt->Bmask; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { if ((*src32 & rgbmask) != ckey) { @@ -2689,7 +2689,7 @@ ++dst32; ++src32; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src32 = (Uint32 *) ((Uint8 *) src32 + srcskip); dst32 = (Uint32 *) ((Uint8 *) dst32 + dstskip); } @@ -2708,7 +2708,7 @@ get_permutation(srcfmt, dstfmt, &p0, &p1, &p2, &p3, &alpha_channel); while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { Uint32 *src32 = (Uint32*)src; @@ -2723,7 +2723,7 @@ src += 4; dst += 4; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -2746,7 +2746,7 @@ #endif while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { Uint8 s0 = src[0]; @@ -2762,7 +2762,7 @@ dst += 3; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -2784,7 +2784,7 @@ #endif while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { Uint8 s0 = src[0]; @@ -2800,7 +2800,7 @@ dst += 3; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -2816,7 +2816,7 @@ get_permutation(srcfmt, dstfmt, &p0, &p1, &p2, &p3, NULL); while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { Uint32 *src32 = (Uint32*)src; @@ -2828,7 +2828,7 @@ src += 4; dst += 3; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -2855,7 +2855,7 @@ get_permutation(srcfmt, dstfmt, &p0, &p1, &p2, &p3, &alpha_channel); while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { Uint8 s0 = src[0]; @@ -2872,7 +2872,7 @@ src += 3; dst += 4; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -2881,7 +2881,7 @@ #endif while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { Uint32 Pixel; @@ -2897,7 +2897,7 @@ src += srcbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -2938,7 +2938,7 @@ Uint32 *src32 = (Uint32*)src; Uint32 *dst32 = (Uint32*)dst; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { if ((*src32 & rgbmask) != ckey) { @@ -2948,7 +2948,7 @@ ++dst32; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src32 = (Uint32 *)((Uint8 *)src32 + srcskip); dst32 = (Uint32 *)((Uint8 *)dst32 + dstskip); } @@ -2967,7 +2967,7 @@ get_permutation(srcfmt, dstfmt, &p0, &p1, &p2, &p3, NULL); while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { Uint32 *src32 = (Uint32*)src; @@ -2980,7 +2980,7 @@ src += 4; dst += 4; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -2989,7 +2989,7 @@ #endif while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, sR, sG, sB, sA); @@ -3000,7 +3000,7 @@ src += srcbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -3022,7 +3022,7 @@ unsigned sR, sG, sB, sA; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { Pixel = *(Uint32 *)src; @@ -3032,7 +3032,7 @@ src += 4; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -3054,7 +3054,7 @@ unsigned sR, sG, sB, sA; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, sR, sG, sB, sA); @@ -3064,7 +3064,7 @@ src += srcbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -3096,7 +3096,7 @@ int i2 = srcbpp - 1 - 2; #endif while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { Uint32 *dst32 = (Uint32*)dst; @@ -3107,7 +3107,7 @@ dst += 4; src += srcbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -3125,7 +3125,7 @@ int j2 = dstbpp - 1 - 2; #endif while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { Uint8 s0 = src[i0]; @@ -3137,7 +3137,7 @@ dst += dstbpp; src += srcbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -3169,7 +3169,7 @@ #else int i0 = 3, i1 = 2, i2 = 1, i3 = 0; #endif - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { Uint32 *dst32 = (Uint32*)dst; @@ -3182,7 +3182,7 @@ dst += 4; src += 4; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -3197,7 +3197,7 @@ int i2 = srcbpp - 1 - 2; #endif while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { Uint32 *dst32 = (Uint32*)dst; @@ -3209,7 +3209,7 @@ dst += 4; src += srcbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -3228,7 +3228,7 @@ int j2 = dstbpp - 1 - 0; #endif while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { Uint8 s0 = src[i0]; @@ -3241,7 +3241,7 @@ dst += dstbpp; src += srcbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } diff -Nru libsdl2-2.0.22+dfsg/src/video/SDL_egl.c libsdl2-2.24.0+dfsg/src/video/SDL_egl.c --- libsdl2-2.0.22+dfsg/src/video/SDL_egl.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/SDL_egl.c 2022-08-13 03:48:10.000000000 +0000 @@ -45,6 +45,13 @@ #endif #endif /* EGL_KHR_create_context */ +#ifndef EGL_EXT_pixel_format_float +#define EGL_EXT_pixel_format_float +#define EGL_COLOR_COMPONENT_TYPE_EXT 0x3339 +#define EGL_COLOR_COMPONENT_TYPE_FIXED_EXT 0x333A +#define EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT 0x333B +#endif + #ifndef EGL_EXT_present_opaque #define EGL_EXT_present_opaque 1 #define EGL_PRESENT_OPAQUE_EXT 0x31DF @@ -114,7 +121,7 @@ _this->egl_data->NAME = (void *)NAME; #else #define LOAD_FUNC(NAME) \ -_this->egl_data->NAME = SDL_LoadFunction(_this->egl_data->dll_handle, #NAME); \ +_this->egl_data->NAME = SDL_LoadFunction(_this->egl_data->egl_dll_handle, #NAME); \ if (!_this->egl_data->NAME) \ { \ return SDL_SetError("Could not retrieve EGL function " #NAME); \ @@ -250,12 +257,12 @@ /* Try SDL_LoadFunction() first for EGL <= 1.4, or as a fallback for >= 1.5. */ if (!retval) { static char procname[64]; - retval = SDL_LoadFunction(_this->egl_data->egl_dll_handle, proc); + retval = SDL_LoadFunction(_this->egl_data->opengl_dll_handle, proc); /* just in case you need an underscore prepended... */ if (!retval && (SDL_strlen(proc) < (sizeof (procname) - 1))) { procname[0] = '_'; SDL_strlcpy(procname + 1, proc, sizeof (procname) - 1); - retval = SDL_LoadFunction(_this->egl_data->egl_dll_handle, procname); + retval = SDL_LoadFunction(_this->egl_data->opengl_dll_handle, procname); } } #endif @@ -280,14 +287,14 @@ _this->egl_data->egl_display = NULL; } - if (_this->egl_data->dll_handle) { - SDL_UnloadObject(_this->egl_data->dll_handle); - _this->egl_data->dll_handle = NULL; - } if (_this->egl_data->egl_dll_handle) { SDL_UnloadObject(_this->egl_data->egl_dll_handle); _this->egl_data->egl_dll_handle = NULL; } + if (_this->egl_data->opengl_dll_handle) { + SDL_UnloadObject(_this->egl_data->opengl_dll_handle); + _this->egl_data->opengl_dll_handle = NULL; + } SDL_free(_this->egl_data); _this->egl_data = NULL; @@ -297,7 +304,7 @@ int SDL_EGL_LoadLibraryOnly(_THIS, const char *egl_path) { - void *dll_handle = NULL, *egl_dll_handle = NULL; /* The naming is counter intuitive, but hey, I just work here -- Gabriel */ + void *egl_dll_handle = NULL, *opengl_dll_handle = NULL; const char *path = NULL; #if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT const char *d3dcompiler; @@ -349,32 +356,32 @@ /* A funny thing, loading EGL.so first does not work on the Raspberry, so we load libGL* first */ path = SDL_getenv("SDL_VIDEO_GL_DRIVER"); if (path != NULL) { - egl_dll_handle = SDL_LoadObject(path); + opengl_dll_handle = SDL_LoadObject(path); } - if (egl_dll_handle == NULL) { + if (opengl_dll_handle == NULL) { if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) { if (_this->gl_config.major_version > 1) { path = DEFAULT_OGL_ES2; - egl_dll_handle = SDL_LoadObject(path); + opengl_dll_handle = SDL_LoadObject(path); #ifdef ALT_OGL_ES2 - if (egl_dll_handle == NULL && !vc4) { + if (opengl_dll_handle == NULL && !vc4) { path = ALT_OGL_ES2; - egl_dll_handle = SDL_LoadObject(path); + opengl_dll_handle = SDL_LoadObject(path); } #endif } else { path = DEFAULT_OGL_ES; - egl_dll_handle = SDL_LoadObject(path); - if (egl_dll_handle == NULL) { + opengl_dll_handle = SDL_LoadObject(path); + if (opengl_dll_handle == NULL) { path = DEFAULT_OGL_ES_PVR; - egl_dll_handle = SDL_LoadObject(path); + opengl_dll_handle = SDL_LoadObject(path); } #ifdef ALT_OGL_ES2 - if (egl_dll_handle == NULL && !vc4) { + if (opengl_dll_handle == NULL && !vc4) { path = ALT_OGL_ES2; - egl_dll_handle = SDL_LoadObject(path); + opengl_dll_handle = SDL_LoadObject(path); } #endif } @@ -382,47 +389,47 @@ #ifdef DEFAULT_OGL else { path = DEFAULT_OGL; - egl_dll_handle = SDL_LoadObject(path); + opengl_dll_handle = SDL_LoadObject(path); #ifdef ALT_OGL - if (egl_dll_handle == NULL) { + if (opengl_dll_handle == NULL) { path = ALT_OGL; - egl_dll_handle = SDL_LoadObject(path); + opengl_dll_handle = SDL_LoadObject(path); } #endif } #endif } - _this->egl_data->egl_dll_handle = egl_dll_handle; + _this->egl_data->opengl_dll_handle = opengl_dll_handle; - if (egl_dll_handle == NULL) { + if (opengl_dll_handle == NULL) { return SDL_SetError("Could not initialize OpenGL / GLES library"); } /* Loading libGL* in the previous step took care of loading libEGL.so, but we future proof by double checking */ if (egl_path != NULL) { - dll_handle = SDL_LoadObject(egl_path); + egl_dll_handle = SDL_LoadObject(egl_path); } /* Try loading a EGL symbol, if it does not work try the default library paths */ - if (dll_handle == NULL || SDL_LoadFunction(dll_handle, "eglChooseConfig") == NULL) { - if (dll_handle != NULL) { - SDL_UnloadObject(dll_handle); + if (egl_dll_handle == NULL || SDL_LoadFunction(egl_dll_handle, "eglChooseConfig") == NULL) { + if (egl_dll_handle != NULL) { + SDL_UnloadObject(egl_dll_handle); } path = SDL_getenv("SDL_VIDEO_EGL_DRIVER"); if (path == NULL) { path = DEFAULT_EGL; } - dll_handle = SDL_LoadObject(path); + egl_dll_handle = SDL_LoadObject(path); #ifdef ALT_EGL - if (dll_handle == NULL && !vc4) { + if (egl_dll_handle == NULL && !vc4) { path = ALT_EGL; - dll_handle = SDL_LoadObject(path); + egl_dll_handle = SDL_LoadObject(path); } #endif - if (dll_handle == NULL || SDL_LoadFunction(dll_handle, "eglChooseConfig") == NULL) { - if (dll_handle != NULL) { - SDL_UnloadObject(dll_handle); + if (egl_dll_handle == NULL || SDL_LoadFunction(egl_dll_handle, "eglChooseConfig") == NULL) { + if (egl_dll_handle != NULL) { + SDL_UnloadObject(egl_dll_handle); } return SDL_SetError("Could not load EGL library"); } @@ -430,9 +437,9 @@ } #endif - _this->egl_data->dll_handle = dll_handle; -#if SDL_VIDEO_DRIVER_VITA _this->egl_data->egl_dll_handle = egl_dll_handle; +#if SDL_VIDEO_DRIVER_VITA + _this->egl_data->opengl_dll_handle = opengl_dll_handle; #endif /* Load new function pointers */ @@ -762,6 +769,11 @@ attribs[i++] = _this->gl_config.multisamplesamples; } + if (_this->gl_config.floatbuffers) { + attribs[i++] = EGL_COLOR_COMPONENT_TYPE_EXT; + attribs[i++] = EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT; + } + if (_this->egl_data->is_offscreen) { attribs[i++] = EGL_SURFACE_TYPE; attribs[i++] = EGL_PBUFFER_BIT; @@ -1250,10 +1262,12 @@ SDL_EGL_CreateOffscreenSurface(_THIS, int width, int height) { EGLint attributes[] = { - EGL_WIDTH, width, - EGL_HEIGHT, height, + EGL_WIDTH, 0, + EGL_HEIGHT, 0, EGL_NONE }; + attributes[1] = width; + attributes[3] = height; if (SDL_EGL_ChooseConfig(_this) != 0) { return EGL_NO_SURFACE; diff -Nru libsdl2-2.0.22+dfsg/src/video/SDL_egl_c.h libsdl2-2.24.0+dfsg/src/video/SDL_egl_c.h --- libsdl2-2.0.22+dfsg/src/video/SDL_egl_c.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/SDL_egl_c.h 2022-06-16 20:16:31.000000000 +0000 @@ -33,7 +33,7 @@ typedef struct SDL_EGL_VideoData { - void *egl_dll_handle, *dll_handle; + void *opengl_dll_handle, *egl_dll_handle; EGLDisplay egl_display; EGLConfig egl_config; int egl_swapinterval; diff -Nru libsdl2-2.0.22+dfsg/src/video/SDL_fillrect.c libsdl2-2.24.0+dfsg/src/video/SDL_fillrect.c --- libsdl2-2.0.22+dfsg/src/video/SDL_fillrect.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/SDL_fillrect.c 2022-06-02 02:01:57.000000000 +0000 @@ -26,7 +26,7 @@ #ifdef __SSE__ -/* *INDENT-OFF* */ +/* *INDENT-OFF* */ /* clang-format off */ #if defined(_MSC_VER) && !defined(__clang__) #define SSE_BEGIN \ @@ -128,7 +128,7 @@ DEFINE_SSE_FILLRECT(2, Uint16) DEFINE_SSE_FILLRECT(4, Uint32) -/* *INDENT-ON* */ +/* *INDENT-ON* */ /* clang-format on */ #endif /* __SSE__ */ static void diff -Nru libsdl2-2.0.22+dfsg/src/video/sdlgenblit.pl libsdl2-2.24.0+dfsg/src/video/sdlgenblit.pl --- libsdl2-2.0.22+dfsg/src/video/sdlgenblit.pl 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/sdlgenblit.pl 2022-06-02 02:01:57.000000000 +0000 @@ -114,7 +114,7 @@ #if SDL_HAVE_BLIT_AUTO -/* *INDENT-OFF* */ +/* *INDENT-OFF* */ /* clang-format off */ __EOF__ } @@ -122,7 +122,7 @@ sub close_file { my $name = shift; print FILE <<__EOF__; -/* *INDENT-ON* */ +/* *INDENT-ON* */ /* clang-format on */ #endif /* SDL_HAVE_BLIT_AUTO */ diff -Nru libsdl2-2.0.22+dfsg/src/video/SDL_pixels.c libsdl2-2.24.0+dfsg/src/video/SDL_pixels.c --- libsdl2-2.0.22+dfsg/src/video/SDL_pixels.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/SDL_pixels.c 2022-08-19 15:46:21.000000000 +0000 @@ -126,6 +126,7 @@ CASE(SDL_PIXELFORMAT_YVYU) CASE(SDL_PIXELFORMAT_NV12) CASE(SDL_PIXELFORMAT_NV21) + CASE(SDL_PIXELFORMAT_EXTERNAL_OES) #undef CASE default: return "SDL_PIXELFORMAT_UNKNOWN"; diff -Nru libsdl2-2.0.22+dfsg/src/video/SDL_RLEaccel.c libsdl2-2.24.0+dfsg/src/video/SDL_RLEaccel.c --- libsdl2-2.0.22+dfsg/src/video/SDL_RLEaccel.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/SDL_RLEaccel.c 2022-06-02 02:01:57.000000000 +0000 @@ -92,10 +92,6 @@ #include "SDL_blit.h" #include "SDL_RLEaccel_c.h" -#ifndef MIN -#define MIN(a, b) ((a) < (b) ? (a) : (b)) -#endif - #define PIXEL_COPY(to, from, len, bpp) \ SDL_memcpy(to, from, (size_t)(len) * (bpp)) @@ -1161,13 +1157,13 @@ ADD_OPAQUE_COUNTS(max_opaque_run, 0); skip -= max_opaque_run; } - len = MIN(run, max_opaque_run); + len = SDL_min(run, max_opaque_run); ADD_OPAQUE_COUNTS(skip, len); dst += copy_opaque(dst, src + runstart, len, sf, df); runstart += len; run -= len; while (run) { - len = MIN(run, max_opaque_run); + len = SDL_min(run, max_opaque_run); ADD_OPAQUE_COUNTS(0, len); dst += copy_opaque(dst, src + runstart, len, sf, df); runstart += len; @@ -1195,13 +1191,13 @@ ADD_TRANSL_COUNTS(max_transl_run, 0); skip -= max_transl_run; } - len = MIN(run, max_transl_run); + len = SDL_min(run, max_transl_run); ADD_TRANSL_COUNTS(skip, len); dst += copy_transl(dst, src + runstart, len, sf, df); runstart += len; run -= len; while (run) { - len = MIN(run, max_transl_run); + len = SDL_min(run, max_transl_run); ADD_TRANSL_COUNTS(0, len); dst += copy_transl(dst, src + runstart, len, sf, df); runstart += len; @@ -1222,9 +1218,13 @@ /* Now that we have it encoded, release the original pixels */ if (!(surface->flags & SDL_PREALLOC)) { - SDL_SIMDFree(surface->pixels); + if (surface->flags & SDL_SIMD_ALIGNED) { + SDL_SIMDFree(surface->pixels); + surface->flags &= ~SDL_SIMD_ALIGNED; + } else { + SDL_free(surface->pixels); + } surface->pixels = NULL; - surface->flags &= ~SDL_SIMD_ALIGNED; } /* reallocate the buffer to release unused memory */ @@ -1359,14 +1359,14 @@ ADD_COUNTS(maxn, 0); skip -= maxn; } - len = MIN(run, maxn); + len = SDL_min(run, maxn); ADD_COUNTS(skip, len); SDL_memcpy(dst, srcbuf + runstart * bpp, len * bpp); dst += len * bpp; run -= len; runstart += len; while (run) { - len = MIN(run, maxn); + len = SDL_min(run, maxn); ADD_COUNTS(0, len); SDL_memcpy(dst, srcbuf + runstart * bpp, len * bpp); dst += len * bpp; @@ -1386,9 +1386,13 @@ /* Now that we have it encoded, release the original pixels */ if (!(surface->flags & SDL_PREALLOC)) { - SDL_SIMDFree(surface->pixels); + if (surface->flags & SDL_SIMD_ALIGNED) { + SDL_SIMDFree(surface->pixels); + surface->flags &= ~SDL_SIMD_ALIGNED; + } else { + SDL_free(surface->pixels); + } surface->pixels = NULL; - surface->flags &= ~SDL_SIMD_ALIGNED; } /* reallocate the buffer to release unused memory */ diff -Nru libsdl2-2.0.22+dfsg/src/video/SDL_surface.c libsdl2-2.24.0+dfsg/src/video/SDL_surface.c --- libsdl2-2.0.22+dfsg/src/video/SDL_surface.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/SDL_surface.c 2022-06-16 20:16:31.000000000 +0000 @@ -33,25 +33,43 @@ SDL_COMPILE_TIME_ASSERT(surface_size_assumptions, sizeof(int) == sizeof(Sint32) && sizeof(size_t) >= sizeof(Sint32)); +SDL_COMPILE_TIME_ASSERT(can_indicate_overflow, SDL_SIZE_MAX > SDL_MAX_SINT32); + /* Public routines */ /* - * Calculate the pad-aligned scanline width of a surface + * Calculate the pad-aligned scanline width of a surface. + * Return SDL_SIZE_MAX on overflow. */ -static Sint64 -SDL_CalculatePitch(Uint32 format, int width) +static size_t +SDL_CalculatePitch(Uint32 format, size_t width, SDL_bool minimal) { - Sint64 pitch; + size_t pitch; if (SDL_ISPIXELFORMAT_FOURCC(format) || SDL_BITSPERPIXEL(format) >= 8) { - pitch = ((Sint64)width * SDL_BYTESPERPIXEL(format)); + if (SDL_size_mul_overflow(width, SDL_BYTESPERPIXEL(format), &pitch)) { + return SDL_SIZE_MAX; + } } else { - pitch = (((Sint64)width * SDL_BITSPERPIXEL(format)) + 7) / 8; + if (SDL_size_mul_overflow(width, SDL_BITSPERPIXEL(format), &pitch)) { + return SDL_SIZE_MAX; + } + if (SDL_size_add_overflow(pitch, 7, &pitch)) { + return SDL_SIZE_MAX; + } + pitch /= 8; + } + if (!minimal) { + /* 4-byte aligning for speed */ + if (SDL_size_add_overflow(pitch, 3, &pitch)) { + return SDL_SIZE_MAX; + } + pitch &= ~3; } - pitch = (pitch + 3) & ~3; /* 4-byte aligning for speed */ return pitch; } +/* TODO: In SDL 3, drop the unused flags and depth parameters */ /* * Create an empty RGB surface of the appropriate depth using the given * enum SDL_PIXELFORMAT_* format @@ -60,14 +78,24 @@ SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth, Uint32 format) { - Sint64 pitch; + size_t pitch; SDL_Surface *surface; /* The flags are no longer used, make the compiler happy */ (void)flags; - pitch = SDL_CalculatePitch(format, width); - if (pitch < 0 || pitch > SDL_MAX_SINT32) { + if (width < 0) { + SDL_InvalidParamError("width"); + return NULL; + } + + if (height < 0) { + SDL_InvalidParamError("height"); + return NULL; + } + + pitch = SDL_CalculatePitch(format, width, SDL_FALSE); + if (pitch > SDL_MAX_SINT32) { /* Overflow... */ SDL_OutOfMemory(); return NULL; @@ -113,15 +141,15 @@ /* Get the pixels */ if (surface->w && surface->h) { /* Assumptions checked in surface_size_assumptions assert above */ - Sint64 size = ((Sint64)surface->h * surface->pitch); - if (size < 0 || size > SDL_MAX_SINT32) { + size_t size; + if (SDL_size_mul_overflow(surface->h, surface->pitch, &size)) { /* Overflow... */ SDL_FreeSurface(surface); SDL_OutOfMemory(); return NULL; } - surface->pixels = SDL_SIMDAlloc((size_t)size); + surface->pixels = SDL_SIMDAlloc(size); if (!surface->pixels) { SDL_FreeSurface(surface); SDL_OutOfMemory(); @@ -129,7 +157,7 @@ } surface->flags |= SDL_SIMD_ALIGNED; /* This is important for bitmaps */ - SDL_memset(surface->pixels, 0, surface->h * surface->pitch); + SDL_memset(surface->pixels, 0, size); } /* Allocate an empty mapping */ @@ -149,6 +177,7 @@ return surface; } +/* TODO: In SDL 3, drop the unused flags parameter */ /* * Create an empty RGB surface of the appropriate depth */ @@ -179,8 +208,34 @@ Uint32 Amask) { SDL_Surface *surface; + Uint32 format; + size_t minimalPitch; + + if (width < 0) { + SDL_InvalidParamError("width"); + return NULL; + } + + if (height < 0) { + SDL_InvalidParamError("height"); + return NULL; + } + + format = SDL_MasksToPixelFormatEnum(depth, Rmask, Gmask, Bmask, Amask); - surface = SDL_CreateRGBSurface(0, 0, 0, depth, Rmask, Gmask, Bmask, Amask); + if (format == SDL_PIXELFORMAT_UNKNOWN) { + SDL_SetError("Unknown pixel format"); + return NULL; + } + + minimalPitch = SDL_CalculatePitch(format, width, SDL_TRUE); + + if (pitch < 0 || ((size_t) pitch) < minimalPitch) { + SDL_InvalidParamError("pitch"); + return NULL; + } + + surface = SDL_CreateRGBSurfaceWithFormat(0, 0, 0, depth, format); if (surface != NULL) { surface->flags |= SDL_PREALLOC; surface->pixels = pixels; @@ -192,6 +247,7 @@ return surface; } +/* TODO: In SDL 3, drop the unused depth parameter */ /* * Create an RGB surface from an existing memory buffer using the given given * enum SDL_PIXELFORMAT_* format @@ -202,6 +258,24 @@ Uint32 format) { SDL_Surface *surface; + size_t minimalPitch; + + if (width < 0) { + SDL_InvalidParamError("width"); + return NULL; + } + + if (height < 0) { + SDL_InvalidParamError("height"); + return NULL; + } + + minimalPitch = SDL_CalculatePitch(format, width, SDL_TRUE); + + if (pitch < 0 || ((size_t) pitch) < minimalPitch) { + SDL_InvalidParamError("pitch"); + return NULL; + } surface = SDL_CreateRGBSurfaceWithFormat(0, 0, 0, depth, format); if (surface != NULL) { diff -Nru libsdl2-2.0.22+dfsg/src/video/SDL_sysvideo.h libsdl2-2.24.0+dfsg/src/video/SDL_sysvideo.h --- libsdl2-2.0.22+dfsg/src/video/SDL_sysvideo.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/SDL_sysvideo.h 2022-08-19 15:46:21.000000000 +0000 @@ -149,6 +149,12 @@ /* Define the SDL video driver structure */ #define _THIS SDL_VideoDevice *_this +/* Video device flags */ +typedef enum { + VIDEO_DEVICE_QUIRK_DISABLE_DISPLAY_MODE_SWITCHING = 0x01, + VIDEO_DEVICE_QUIRK_DISABLE_UNSET_FULLSCREEN_ON_MINIMIZE = 0x02, +} DeviceQuirkFlags; + struct SDL_VideoDevice { /* * * */ @@ -237,6 +243,7 @@ int (*SetWindowGammaRamp) (_THIS, SDL_Window * window, const Uint16 * ramp); int (*GetWindowGammaRamp) (_THIS, SDL_Window * window, Uint16 * ramp); void* (*GetWindowICCProfile) (_THIS, SDL_Window * window, size_t* size); + int (*GetWindowDisplayIndex)(_THIS, SDL_Window * window); void (*SetWindowMouseRect)(_THIS, SDL_Window * window); void (*SetWindowMouseGrab) (_THIS, SDL_Window * window, SDL_bool grabbed); void (*SetWindowKeyboardGrab) (_THIS, SDL_Window * window, SDL_bool grabbed); @@ -306,7 +313,7 @@ /* Text input */ void (*StartTextInput) (_THIS); void (*StopTextInput) (_THIS); - void (*SetTextInputRect) (_THIS, SDL_Rect *rect); + void (*SetTextInputRect) (_THIS, const SDL_Rect *rect); void (*ClearComposition) (_THIS); SDL_bool (*IsTextInputShown) (_THIS); @@ -332,6 +339,7 @@ /* * * */ /* Data common to all drivers */ + SDL_threadID thread; SDL_bool checked_texture_framebuffer; SDL_bool is_dummy; SDL_bool suspend_screensaver; @@ -345,7 +353,7 @@ Uint32 next_object_id; char *clipboard_text; SDL_bool setting_display_mode; - SDL_bool disable_display_mode_switching; + Uint32 quirk_flags; /* * * */ /* Data used by the GL drivers */ @@ -366,6 +374,7 @@ int stereo; int multisamplebuffers; int multisamplesamples; + int floatbuffers; int accelerated; int major_version; int minor_version; @@ -430,7 +439,7 @@ { const char *name; const char *desc; - SDL_VideoDevice *(*create) (int devindex); + SDL_VideoDevice *(*create) (void); } VideoBootStrap; /* Not all of these are available in a given build. Use #ifdefs, etc. */ @@ -443,6 +452,7 @@ extern VideoBootStrap PND_bootstrap; extern VideoBootStrap UIKIT_bootstrap; extern VideoBootStrap Android_bootstrap; +extern VideoBootStrap PS2_bootstrap; extern VideoBootStrap PSP_bootstrap; extern VideoBootStrap VITA_bootstrap; extern VideoBootStrap RISCOS_bootstrap; @@ -450,15 +460,19 @@ extern VideoBootStrap KMSDRM_bootstrap; extern VideoBootStrap KMSDRM_LEGACY_bootstrap; extern VideoBootStrap DUMMY_bootstrap; +extern VideoBootStrap DUMMY_evdev_bootstrap; extern VideoBootStrap Wayland_bootstrap; extern VideoBootStrap NACL_bootstrap; extern VideoBootStrap VIVANTE_bootstrap; extern VideoBootStrap Emscripten_bootstrap; extern VideoBootStrap QNX_bootstrap; extern VideoBootStrap OFFSCREEN_bootstrap; +extern VideoBootStrap NGAGE_bootstrap; extern VideoBootStrap OS2DIVE_bootstrap; extern VideoBootStrap OS2VMAN_bootstrap; +/* Use SDL_OnVideoThread() sparingly, to avoid regressions in use cases that currently happen to work */ +extern SDL_bool SDL_OnVideoThread(void); extern SDL_VideoDevice *SDL_GetVideoDevice(void); extern int SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode); extern int SDL_AddVideoDisplay(const SDL_VideoDisplay * display, SDL_bool send_event); @@ -472,6 +486,7 @@ extern SDL_VideoDisplay *SDL_GetDisplayForWindow(SDL_Window *window); extern void *SDL_GetDisplayDriverData( int displayIndex ); extern SDL_bool SDL_IsVideoContextExternal(void); +extern int SDL_GetMessageBoxCount(void); extern void SDL_GL_DeduceMaxSupportedESProfile(int* major, int* minor); @@ -497,6 +512,8 @@ extern void SDL_ToggleDragAndDropSupport(void); +extern int SDL_GetPointDisplayIndex(const SDL_Point * point); + #endif /* SDL_sysvideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/video/SDL_video.c libsdl2-2.24.0+dfsg/src/video/SDL_video.c --- libsdl2-2.0.22+dfsg/src/video/SDL_video.c 2022-04-21 17:37:37.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/SDL_video.c 2022-08-19 15:46:21.000000000 +0000 @@ -91,6 +91,9 @@ #if SDL_VIDEO_DRIVER_ANDROID &Android_bootstrap, #endif +#if SDL_VIDEO_DRIVER_PS2 + &PS2_bootstrap, +#endif #if SDL_VIDEO_DRIVER_PSP &PSP_bootstrap, #endif @@ -118,12 +121,18 @@ #if SDL_VIDEO_DRIVER_OFFSCREEN &OFFSCREEN_bootstrap, #endif +#if SDL_VIDEO_DRIVER_NGAGE + &NGAGE_bootstrap, +#endif #if SDL_VIDEO_DRIVER_OS2 &OS2DIVE_bootstrap, &OS2VMAN_bootstrap, #endif #if SDL_VIDEO_DRIVER_DUMMY &DUMMY_bootstrap, +#if SDL_INPUT_LINUXEV + &DUMMY_evdev_bootstrap, +#endif #endif NULL }; @@ -157,6 +166,18 @@ extern SDL_bool Cocoa_SetWindowFullscreenSpace(SDL_Window * window, SDL_bool state); #endif +/* Convenience functions for reading driver flags */ +static SDL_bool +DisableDisplayModeSwitching(_THIS) +{ + return !!(_this->quirk_flags & VIDEO_DEVICE_QUIRK_DISABLE_DISPLAY_MODE_SWITCHING); +} + +static SDL_bool +DisableUnsetFullscreenOnMinimize(_THIS) +{ + return !!(_this->quirk_flags & VIDEO_DEVICE_QUIRK_DISABLE_UNSET_FULLSCREEN_ON_MINIMIZE); +} /* Support for framebuffer emulation using an accelerated renderer */ @@ -288,6 +309,7 @@ } static SDL_VideoDevice *_this = NULL; +static SDL_atomic_t SDL_messagebox_count; static int SDL_UpdateWindowTexture(SDL_VideoDevice *unused, SDL_Window * window, const SDL_Rect * rects, int numrects) @@ -338,7 +360,7 @@ SDL_free(data); } -static int +static int SDLCALL cmpmodes(const void *A, const void *B) { const SDL_DisplayMode *a = (const SDL_DisplayMode *) A; @@ -387,12 +409,11 @@ SDL_VideoInit(const char *driver_name) { SDL_VideoDevice *video; - int index; - int i; SDL_bool init_events = SDL_FALSE; SDL_bool init_keyboard = SDL_FALSE; SDL_bool init_mouse = SDL_FALSE; SDL_bool init_touch = SDL_FALSE; + int i; /* Check to make sure we don't overwrite '_this' */ if (_this != NULL) { @@ -422,7 +443,6 @@ init_touch = SDL_TRUE; /* Select the proper video driver */ - i = index = 0; video = NULL; if (driver_name == NULL) { driver_name = SDL_GetHint(SDL_HINT_VIDEODRIVER); @@ -437,7 +457,7 @@ for (i = 0; bootstrap[i]; ++i) { if ((driver_attempt_len == SDL_strlen(bootstrap[i]->name)) && (SDL_strncasecmp(bootstrap[i]->name, driver_attempt, driver_attempt_len) == 0)) { - video = bootstrap[i]->create(index); + video = bootstrap[i]->create(); break; } } @@ -446,7 +466,7 @@ } } else { for (i = 0; bootstrap[i]; ++i) { - video = bootstrap[i]->create(index); + video = bootstrap[i]->create(); if (video != NULL) { break; } @@ -466,6 +486,7 @@ _this = video; _this->name = bootstrap[i]->name; _this->next_object_id = 1; + _this->thread = SDL_ThreadID(); /* Set some very sane GL defaults */ @@ -545,6 +566,12 @@ return _this; } +SDL_bool +SDL_OnVideoThread() +{ + return (_this && SDL_ThreadID() == _this->thread) ? SDL_TRUE : SDL_FALSE; +} + int SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode) { @@ -1057,66 +1084,130 @@ return &_this->displays[displayIndex]; } -int -SDL_GetWindowDisplayIndex(SDL_Window * window) +/** + * If x, y are outside of rect, snaps them to the closest point inside rect + * (between rect->x, rect->y, inclusive, and rect->x + w, rect->y + h, exclusive) + */ +static void +SDL_GetClosestPointOnRect(const SDL_Rect *rect, SDL_Point *point) +{ + const int right = rect->x + rect->w - 1; + const int bottom = rect->y + rect->h - 1; + + if (point->x < rect->x) { + point->x = rect->x; + } else if (point->x > right) { + point->x = right; + } + + if (point->y < rect->y) { + point->y = rect->y; + } else if (point->y > bottom) { + point->y = bottom; + } +} + +static int +GetRectDisplayIndex(int x, int y, int w, int h) { - int displayIndex; int i, dist; int closest = -1; int closest_dist = 0x7FFFFFFF; - SDL_Point center; + SDL_Point closest_point_on_display; SDL_Point delta; - SDL_Rect rect; - - CHECK_WINDOW_MAGIC(window, -1); - - if (SDL_WINDOWPOS_ISUNDEFINED(window->x) || - SDL_WINDOWPOS_ISCENTERED(window->x)) { - displayIndex = (window->x & 0xFFFF); - if (displayIndex >= _this->num_displays) { - displayIndex = 0; - } - return displayIndex; - } - if (SDL_WINDOWPOS_ISUNDEFINED(window->y) || - SDL_WINDOWPOS_ISCENTERED(window->y)) { - displayIndex = (window->y & 0xFFFF); - if (displayIndex >= _this->num_displays) { - displayIndex = 0; - } - return displayIndex; - } + SDL_Point center; + center.x = x + w / 2; + center.y = y + h / 2; - /* Find the display containing the window */ for (i = 0; i < _this->num_displays; ++i) { - SDL_VideoDisplay *display = &_this->displays[i]; + SDL_Rect display_rect; + SDL_GetDisplayBounds(i, &display_rect); - if (display->fullscreen_window == window) { - return i; - } - } - center.x = window->x + window->w / 2; - center.y = window->y + window->h / 2; - for (i = 0; i < _this->num_displays; ++i) { - SDL_GetDisplayBounds(i, &rect); - if (SDL_EnclosePoints(¢er, 1, &rect, NULL)) { + /* Check if the window is fully enclosed */ + if (SDL_EnclosePoints(¢er, 1, &display_rect, NULL)) { return i; } - delta.x = center.x - (rect.x + rect.w / 2); - delta.y = center.y - (rect.y + rect.h / 2); + /* Snap window center to the display rect */ + closest_point_on_display = center; + SDL_GetClosestPointOnRect(&display_rect, &closest_point_on_display); + + delta.x = center.x - closest_point_on_display.x; + delta.y = center.y - closest_point_on_display.y; dist = (delta.x*delta.x + delta.y*delta.y); if (dist < closest_dist) { closest = i; closest_dist = dist; } } + if (closest < 0) { SDL_SetError("Couldn't find any displays"); } + return closest; } +int +SDL_GetPointDisplayIndex(const SDL_Point *point) +{ + return GetRectDisplayIndex(point->x, point->y, 1, 1); +} + +int +SDL_GetRectDisplayIndex(const SDL_Rect *rect) +{ + return GetRectDisplayIndex(rect->x, rect->y, rect->w, rect->h); +} + +int +SDL_GetWindowDisplayIndex(SDL_Window * window) +{ + int displayIndex = -1; + + CHECK_WINDOW_MAGIC(window, -1); + if (_this->GetWindowDisplayIndex) { + displayIndex = _this->GetWindowDisplayIndex(_this, window); + } + + /* A backend implementation may fail to get a display index for the window + * (for example if the window is off-screen), but other code may expect it + * to succeed in that situation, so we fall back to a generic position- + * based implementation in that case. */ + if (displayIndex >= 0) { + return displayIndex; + } else { + int i; + if (SDL_WINDOWPOS_ISUNDEFINED(window->x) || + SDL_WINDOWPOS_ISCENTERED(window->x)) { + displayIndex = (window->x & 0xFFFF); + if (displayIndex >= _this->num_displays) { + displayIndex = 0; + } + return displayIndex; + } + if (SDL_WINDOWPOS_ISUNDEFINED(window->y) || + SDL_WINDOWPOS_ISCENTERED(window->y)) { + displayIndex = (window->y & 0xFFFF); + if (displayIndex >= _this->num_displays) { + displayIndex = 0; + } + return displayIndex; + } + + /* Find the display containing the window if fullscreen */ + for (i = 0; i < _this->num_displays; ++i) { + SDL_VideoDisplay *display = &_this->displays[i]; + + if (display->fullscreen_window == window) { + return i; + } + } + + return GetRectDisplayIndex(window->x, window->y, window->w, window->h); + } +} + SDL_VideoDisplay * SDL_GetDisplayForWindow(SDL_Window *window) { @@ -1340,7 +1431,7 @@ } /* Don't try to change the display mode if the driver doesn't want it. */ - if (_this->disable_display_mode_switching == SDL_FALSE) { + if (DisableDisplayModeSwitching(_this) == SDL_FALSE) { /* only do the mode change if we want exclusive fullscreen */ if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP) { if (SDL_SetDisplayModeForDisplay(display, &fullscreen_mode) < 0) { @@ -1360,12 +1451,17 @@ /* Generate a mode change event here */ if (resized) { -#ifndef ANDROID +#if !defined(ANDROID) && !defined(WIN32) /* Android may not resize the window to exactly what our fullscreen mode is, especially on * windowed Android environments like the Chromebook or Samsung DeX. Given this, we shouldn't * use fullscreen_mode.w and fullscreen_mode.h, but rather get our current native size. As such, * Android's SetWindowFullscreen will generate the window event for us with the proper final size. */ + + /* This is also unnecessary on Win32 (WIN_SetWindowFullscreen calls SetWindowPos, + * WM_WINDOWPOSCHANGED will send SDL_WINDOWEVENT_RESIZED). Also, on Windows with DPI scaling enabled, + * we're keeping modes in pixels, but window sizes in dpi-scaled points, so this would be a unit mismatch. + */ SDL_SendWindowEvent(other, SDL_WINDOWEVENT_RESIZED, fullscreen_mode.w, fullscreen_mode.h); #endif @@ -1648,7 +1744,7 @@ /* Clear minimized if not on windows, only windows handles it at create rather than FinishWindowCreation, * but it's important or window focus will get broken on windows! */ -#if !defined(__WIN32__) +#if !defined(__WIN32__) && !defined(__GDK__) if (window->flags & SDL_WINDOW_MINIMIZED) { window->flags &= ~SDL_WINDOW_MINIMIZED; } @@ -2440,7 +2536,9 @@ return; } - SDL_UpdateFullscreenMode(window, SDL_FALSE); + if (!DisableUnsetFullscreenOnMinimize(_this)) { + SDL_UpdateFullscreenMode(window, SDL_FALSE); + } if (_this->MinimizeWindow) { _this->MinimizeWindow(_this, window); @@ -2503,11 +2601,19 @@ if (!_this->checked_texture_framebuffer) { SDL_bool attempt_texture_framebuffer = SDL_TRUE; + /* See if the user or application wants to specifically disable the framebuffer */ + const char *hint = SDL_GetHint(SDL_HINT_FRAMEBUFFER_ACCELERATION); + if (hint) { + if (*hint == '0' || SDL_strcasecmp(hint, "false") == 0) { + attempt_texture_framebuffer = SDL_FALSE; + } + } + if (_this->is_dummy) { /* dummy driver never has GPU support, of course. */ attempt_texture_framebuffer = SDL_FALSE; } - #if defined(__WIN32__) /* GDI BitBlt() is way faster than Direct3D dynamic textures right now. (!!! FIXME: is this still true?) */ + #if defined(__WIN32__) || defined(__WINGDK__) /* GDI BitBlt() is way faster than Direct3D dynamic textures right now. (!!! FIXME: is this still true?) */ else if ((_this->CreateWindowFramebuffer != NULL) && (SDL_strcmp(_this->name, "windows") == 0)) { attempt_texture_framebuffer = SDL_FALSE; } @@ -2980,7 +3086,9 @@ void SDL_OnWindowMinimized(SDL_Window * window) { - SDL_UpdateFullscreenMode(window, SDL_FALSE); + if (!DisableUnsetFullscreenOnMinimize(_this)) { + SDL_UpdateFullscreenMode(window, SDL_FALSE); + } } void @@ -3024,7 +3132,7 @@ if (mouse && mouse->relative_mode) { SDL_SetMouseFocus(window); if (mouse->relative_mode_warp) { - SDL_WarpMouseInWindow(window, window->w/2, window->h/2); + SDL_PerformWarpMouseInWindow(window, window->w/2, window->h/2, SDL_TRUE); } } @@ -3061,7 +3169,7 @@ hint = SDL_GetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS); if (!hint || !*hint || SDL_strcasecmp(hint, "auto") == 0) { if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP || - _this->disable_display_mode_switching == SDL_TRUE) { + DisableDisplayModeSwitching(_this) == SDL_TRUE) { return SDL_FALSE; } else { return SDL_TRUE; @@ -3482,6 +3590,7 @@ _this->gl_config.stereo = 0; _this->gl_config.multisamplebuffers = 0; _this->gl_config.multisamplesamples = 0; + _this->gl_config.floatbuffers = 0; _this->gl_config.retained_backing = 1; _this->gl_config.accelerated = -1; /* accelerated or not, both are fine */ @@ -3570,6 +3679,9 @@ case SDL_GL_MULTISAMPLESAMPLES: _this->gl_config.multisamplesamples = value; break; + case SDL_GL_FLOATBUFFERS: + _this->gl_config.floatbuffers = value; + break; case SDL_GL_ACCELERATED_VISUAL: _this->gl_config.accelerated = value; break; @@ -4232,7 +4344,7 @@ } void -SDL_SetTextInputRect(SDL_Rect *rect) +SDL_SetTextInputRect(const SDL_Rect *rect) { if (_this && _this->SetTextInputRect) { _this->SetTextInputRect(_this, rect); @@ -4257,6 +4369,12 @@ return SDL_FALSE; } +int +SDL_GetMessageBoxCount(void) +{ + return SDL_AtomicGet(&SDL_messagebox_count); +} + #if SDL_VIDEO_DRIVER_ANDROID #include "android/SDL_androidmessagebox.h" #endif @@ -4317,7 +4435,6 @@ int retval = -1; SDL_bool relative_mode; int show_cursor_prev; - SDL_bool mouse_captured; SDL_Window *current_window; SDL_MessageBoxData mbdata; @@ -4327,10 +4444,11 @@ return SDL_SetError("Invalid number of buttons"); } + (void)SDL_AtomicIncRef(&SDL_messagebox_count); + current_window = SDL_GetKeyboardFocus(); - mouse_captured = current_window && ((SDL_GetWindowFlags(current_window) & SDL_WINDOW_MOUSE_CAPTURE) != 0); relative_mode = SDL_GetRelativeMouseMode(); - SDL_CaptureMouse(SDL_FALSE); + SDL_UpdateMouseCapture(SDL_FALSE); SDL_SetRelativeMouseMode(SDL_FALSE); show_cursor_prev = SDL_ShowCursor(1); SDL_ResetKeyboard(); @@ -4357,7 +4475,7 @@ retval = 0; } #endif -#if SDL_VIDEO_DRIVER_WINDOWS +#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) if (retval == -1 && SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_WINDOWS) && WIN_ShowMessageBox(messageboxdata, buttonid) == 0) { @@ -4434,15 +4552,15 @@ } } + (void)SDL_AtomicDecRef(&SDL_messagebox_count); + if (current_window) { SDL_RaiseWindow(current_window); - if (mouse_captured) { - SDL_CaptureMouse(SDL_TRUE); - } } SDL_ShowCursor(show_cursor_prev); SDL_SetRelativeMouseMode(relative_mode); + SDL_UpdateMouseCapture(SDL_FALSE); return retval; } diff -Nru libsdl2-2.0.22+dfsg/src/video/SDL_yuv.c libsdl2-2.24.0+dfsg/src/video/SDL_yuv.c --- libsdl2-2.0.22+dfsg/src/video/SDL_yuv.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/SDL_yuv.c 2022-06-16 20:16:31.000000000 +0000 @@ -290,6 +290,48 @@ return SDL_FALSE; } +static SDL_bool yuv_rgb_lsx( + Uint32 src_format, Uint32 dst_format, + Uint32 width, Uint32 height, + const Uint8 *y, const Uint8 *u, const Uint8 *v, Uint32 y_stride, Uint32 uv_stride, + Uint8 *rgb, Uint32 rgb_stride, + YCbCrType yuv_type) +{ +#ifdef __loongarch_sx + if (!SDL_HasLSX()) { + return SDL_FALSE; + } + if (src_format == SDL_PIXELFORMAT_YV12 || + src_format == SDL_PIXELFORMAT_IYUV) { + + switch (dst_format) { + case SDL_PIXELFORMAT_RGB24: + yuv420_rgb24_lsx(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGBX8888: + case SDL_PIXELFORMAT_RGBA8888: + yuv420_rgba_lsx(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGRX8888: + case SDL_PIXELFORMAT_BGRA8888: + yuv420_bgra_lsx(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB888: + case SDL_PIXELFORMAT_ARGB8888: + yuv420_argb_lsx(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGR888: + case SDL_PIXELFORMAT_ABGR8888: + yuv420_abgr_lsx(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + default: + break; + } + } +#endif + return SDL_FALSE; +} + static SDL_bool yuv_rgb_std( Uint32 src_format, Uint32 dst_format, Uint32 width, Uint32 height, @@ -417,6 +459,10 @@ return 0; } + if (yuv_rgb_lsx(src_format, dst_format, width, height, y, u, v, y_stride, uv_stride, (Uint8*)dst, dst_pitch, yuv_type)) { + return 0; + } + if (yuv_rgb_std(src_format, dst_format, width, height, y, u, v, y_stride, uv_stride, (Uint8*)dst, dst_pitch, yuv_type)) { return 0; } diff -Nru libsdl2-2.0.22+dfsg/src/video/uikit/keyinfotable.h libsdl2-2.24.0+dfsg/src/video/uikit/keyinfotable.h --- libsdl2-2.0.22+dfsg/src/video/uikit/keyinfotable.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/uikit/keyinfotable.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,174 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef _UIKIT_KeyInfo -#define _UIKIT_KeyInfo - -#include "SDL_scancode.h" - -/* - This file is used by the keyboard code in SDL_uikitview.m to convert between characters - passed in from the iPhone's virtual keyboard, and tuples of SDL_Scancode and SDL_keymods. - For example unicharToUIKeyInfoTable['a'] would give you the scan code and keymod for lower - case a. -*/ - -typedef struct -{ - SDL_Scancode code; - Uint16 mod; -} UIKitKeyInfo; - -/* So far only ASCII characters here */ -static UIKitKeyInfo unicharToUIKeyInfoTable[] = { -/* 0 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 1 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 2 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 3 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 4 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 5 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 6 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 7 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 8 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 9 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 10 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 11 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 12 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 13 */ { SDL_SCANCODE_RETURN, 0 }, -/* 14 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 15 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 16 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 17 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 18 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 19 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 20 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 21 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 22 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 23 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 24 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 25 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 26 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 27 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 28 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 29 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 30 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 31 */ { SDL_SCANCODE_UNKNOWN, 0 }, -/* 32 */ { SDL_SCANCODE_SPACE, 0 }, -/* 33 */ { SDL_SCANCODE_1, KMOD_SHIFT }, /* plus shift modifier '!' */ -/* 34 */ { SDL_SCANCODE_APOSTROPHE, KMOD_SHIFT }, /* plus shift modifier '"' */ -/* 35 */ { SDL_SCANCODE_3, KMOD_SHIFT }, /* plus shift modifier '#' */ -/* 36 */ { SDL_SCANCODE_4, KMOD_SHIFT }, /* plus shift modifier '$' */ -/* 37 */ { SDL_SCANCODE_5, KMOD_SHIFT }, /* plus shift modifier '%' */ -/* 38 */ { SDL_SCANCODE_7, KMOD_SHIFT }, /* plus shift modifier '&' */ -/* 39 */ { SDL_SCANCODE_APOSTROPHE, 0 }, /* ''' */ -/* 40 */ { SDL_SCANCODE_9, KMOD_SHIFT }, /* plus shift modifier '(' */ -/* 41 */ { SDL_SCANCODE_0, KMOD_SHIFT }, /* plus shift modifier ')' */ -/* 42 */ { SDL_SCANCODE_8, KMOD_SHIFT }, /* '*' */ -/* 43 */ { SDL_SCANCODE_EQUALS, KMOD_SHIFT }, /* plus shift modifier '+' */ -/* 44 */ { SDL_SCANCODE_COMMA, 0 }, /* ',' */ -/* 45 */ { SDL_SCANCODE_MINUS, 0 }, /* '-' */ -/* 46 */ { SDL_SCANCODE_PERIOD, 0 }, /* '.' */ -/* 47 */ { SDL_SCANCODE_SLASH, 0 }, /* '/' */ -/* 48 */ { SDL_SCANCODE_0, 0 }, -/* 49 */ { SDL_SCANCODE_1, 0 }, -/* 50 */ { SDL_SCANCODE_2, 0 }, -/* 51 */ { SDL_SCANCODE_3, 0 }, -/* 52 */ { SDL_SCANCODE_4, 0 }, -/* 53 */ { SDL_SCANCODE_5, 0 }, -/* 54 */ { SDL_SCANCODE_6, 0 }, -/* 55 */ { SDL_SCANCODE_7, 0 }, -/* 56 */ { SDL_SCANCODE_8, 0 }, -/* 57 */ { SDL_SCANCODE_9, 0 }, -/* 58 */ { SDL_SCANCODE_SEMICOLON, KMOD_SHIFT }, /* plus shift modifier ';' */ -/* 59 */ { SDL_SCANCODE_SEMICOLON, 0 }, -/* 60 */ { SDL_SCANCODE_COMMA, KMOD_SHIFT }, /* plus shift modifier '<' */ -/* 61 */ { SDL_SCANCODE_EQUALS, 0 }, -/* 62 */ { SDL_SCANCODE_PERIOD, KMOD_SHIFT }, /* plus shift modifier '>' */ -/* 63 */ { SDL_SCANCODE_SLASH, KMOD_SHIFT }, /* plus shift modifier '?' */ -/* 64 */ { SDL_SCANCODE_2, KMOD_SHIFT }, /* plus shift modifier '@' */ -/* 65 */ { SDL_SCANCODE_A, KMOD_SHIFT }, /* all the following need shift modifiers */ -/* 66 */ { SDL_SCANCODE_B, KMOD_SHIFT }, -/* 67 */ { SDL_SCANCODE_C, KMOD_SHIFT }, -/* 68 */ { SDL_SCANCODE_D, KMOD_SHIFT }, -/* 69 */ { SDL_SCANCODE_E, KMOD_SHIFT }, -/* 70 */ { SDL_SCANCODE_F, KMOD_SHIFT }, -/* 71 */ { SDL_SCANCODE_G, KMOD_SHIFT }, -/* 72 */ { SDL_SCANCODE_H, KMOD_SHIFT }, -/* 73 */ { SDL_SCANCODE_I, KMOD_SHIFT }, -/* 74 */ { SDL_SCANCODE_J, KMOD_SHIFT }, -/* 75 */ { SDL_SCANCODE_K, KMOD_SHIFT }, -/* 76 */ { SDL_SCANCODE_L, KMOD_SHIFT }, -/* 77 */ { SDL_SCANCODE_M, KMOD_SHIFT }, -/* 78 */ { SDL_SCANCODE_N, KMOD_SHIFT }, -/* 79 */ { SDL_SCANCODE_O, KMOD_SHIFT }, -/* 80 */ { SDL_SCANCODE_P, KMOD_SHIFT }, -/* 81 */ { SDL_SCANCODE_Q, KMOD_SHIFT }, -/* 82 */ { SDL_SCANCODE_R, KMOD_SHIFT }, -/* 83 */ { SDL_SCANCODE_S, KMOD_SHIFT }, -/* 84 */ { SDL_SCANCODE_T, KMOD_SHIFT }, -/* 85 */ { SDL_SCANCODE_U, KMOD_SHIFT }, -/* 86 */ { SDL_SCANCODE_V, KMOD_SHIFT }, -/* 87 */ { SDL_SCANCODE_W, KMOD_SHIFT }, -/* 88 */ { SDL_SCANCODE_X, KMOD_SHIFT }, -/* 89 */ { SDL_SCANCODE_Y, KMOD_SHIFT }, -/* 90 */ { SDL_SCANCODE_Z, KMOD_SHIFT }, -/* 91 */ { SDL_SCANCODE_LEFTBRACKET, 0 }, -/* 92 */ { SDL_SCANCODE_BACKSLASH, 0 }, -/* 93 */ { SDL_SCANCODE_RIGHTBRACKET, 0 }, -/* 94 */ { SDL_SCANCODE_6, KMOD_SHIFT }, /* plus shift modifier '^' */ -/* 95 */ { SDL_SCANCODE_MINUS, KMOD_SHIFT }, /* plus shift modifier '_' */ -/* 96 */ { SDL_SCANCODE_GRAVE, KMOD_SHIFT }, /* '`' */ -/* 97 */ { SDL_SCANCODE_A, 0 }, -/* 98 */ { SDL_SCANCODE_B, 0 }, -/* 99 */ { SDL_SCANCODE_C, 0 }, -/* 100 */{ SDL_SCANCODE_D, 0 }, -/* 101 */{ SDL_SCANCODE_E, 0 }, -/* 102 */{ SDL_SCANCODE_F, 0 }, -/* 103 */{ SDL_SCANCODE_G, 0 }, -/* 104 */{ SDL_SCANCODE_H, 0 }, -/* 105 */{ SDL_SCANCODE_I, 0 }, -/* 106 */{ SDL_SCANCODE_J, 0 }, -/* 107 */{ SDL_SCANCODE_K, 0 }, -/* 108 */{ SDL_SCANCODE_L, 0 }, -/* 109 */{ SDL_SCANCODE_M, 0 }, -/* 110 */{ SDL_SCANCODE_N, 0 }, -/* 111 */{ SDL_SCANCODE_O, 0 }, -/* 112 */{ SDL_SCANCODE_P, 0 }, -/* 113 */{ SDL_SCANCODE_Q, 0 }, -/* 114 */{ SDL_SCANCODE_R, 0 }, -/* 115 */{ SDL_SCANCODE_S, 0 }, -/* 116 */{ SDL_SCANCODE_T, 0 }, -/* 117 */{ SDL_SCANCODE_U, 0 }, -/* 118 */{ SDL_SCANCODE_V, 0 }, -/* 119 */{ SDL_SCANCODE_W, 0 }, -/* 120 */{ SDL_SCANCODE_X, 0 }, -/* 121 */{ SDL_SCANCODE_Y, 0 }, -/* 122 */{ SDL_SCANCODE_Z, 0 }, -/* 123 */{ SDL_SCANCODE_LEFTBRACKET, KMOD_SHIFT }, /* plus shift modifier '{' */ -/* 124 */{ SDL_SCANCODE_BACKSLASH, KMOD_SHIFT }, /* plus shift modifier '|' */ -/* 125 */{ SDL_SCANCODE_RIGHTBRACKET, KMOD_SHIFT }, /* plus shift modifier '}' */ -/* 126 */{ SDL_SCANCODE_GRAVE, KMOD_SHIFT }, /* plus shift modifier '~' */ -/* 127 */{ SDL_SCANCODE_BACKSPACE, KMOD_SHIFT } -}; - -#endif /* _UIKIT_KeyInfo */ - -/* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/video/uikit/SDL_uikitevents.m libsdl2-2.24.0+dfsg/src/video/uikit/SDL_uikitevents.m --- libsdl2-2.0.22+dfsg/src/video/uikit/SDL_uikitevents.m 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/uikit/SDL_uikitevents.m 2022-08-19 15:46:21.000000000 +0000 @@ -24,6 +24,7 @@ #include "../../events/SDL_events_c.h" +#include "SDL_system.h" #include "SDL_uikitevents.h" #include "SDL_uikitopengles.h" #include "SDL_uikitvideo.h" diff -Nru libsdl2-2.0.22+dfsg/src/video/uikit/SDL_uikitopenglview.m libsdl2-2.24.0+dfsg/src/video/uikit/SDL_uikitopenglview.m --- libsdl2-2.0.22+dfsg/src/video/uikit/SDL_uikitopenglview.m 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/uikit/SDL_uikitopenglview.m 2022-06-02 02:01:57.000000000 +0000 @@ -89,7 +89,7 @@ glGetIntegerv(GL_MAX_SAMPLES, &maxsamples); /* Clamp the samples to the max supported count. */ - samples = MIN(samples, maxsamples); + samples = SDL_min(samples, maxsamples); } if (sRGB) { diff -Nru libsdl2-2.0.22+dfsg/src/video/uikit/SDL_uikitvideo.m libsdl2-2.24.0+dfsg/src/video/uikit/SDL_uikitvideo.m --- libsdl2-2.0.22+dfsg/src/video/uikit/SDL_uikitvideo.m 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/uikit/SDL_uikitvideo.m 2022-08-13 03:48:10.000000000 +0000 @@ -61,7 +61,7 @@ } static SDL_VideoDevice * -UIKit_CreateDevice(int devindex) +UIKit_CreateDevice(void) { @autoreleasepool { SDL_VideoDevice *device; @@ -278,11 +278,16 @@ */ #if !defined(SDL_VIDEO_DRIVER_COCOA) -void SDL_NSLog(const char *text) +void SDL_NSLog(const char *prefix, const char *text) { @autoreleasepool { - NSString *str = [NSString stringWithUTF8String:text]; - NSLog(@"%@", str); + NSString *nsText = [NSString stringWithUTF8String:text]; + if (prefix) { + NSString *nsPrefix = [NSString stringWithUTF8String:prefix]; + NSLog(@"%@: %@", nsPrefix, nsText); + } else { + NSLog(@"%@", nsText); + } } } #endif /* SDL_VIDEO_DRIVER_COCOA */ diff -Nru libsdl2-2.0.22+dfsg/src/video/uikit/SDL_uikitviewcontroller.h libsdl2-2.24.0+dfsg/src/video/uikit/SDL_uikitviewcontroller.h --- libsdl2-2.0.22+dfsg/src/video/uikit/SDL_uikitviewcontroller.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/uikit/SDL_uikitviewcontroller.h 2022-08-13 03:48:10.000000000 +0000 @@ -87,5 +87,5 @@ void UIKit_ShowScreenKeyboard(_THIS, SDL_Window *window); void UIKit_HideScreenKeyboard(_THIS, SDL_Window *window); SDL_bool UIKit_IsScreenKeyboardShown(_THIS, SDL_Window *window); -void UIKit_SetTextInputRect(_THIS, SDL_Rect *rect); +void UIKit_SetTextInputRect(_THIS, const SDL_Rect *rect); #endif diff -Nru libsdl2-2.0.22+dfsg/src/video/uikit/SDL_uikitviewcontroller.m libsdl2-2.24.0+dfsg/src/video/uikit/SDL_uikitviewcontroller.m --- libsdl2-2.0.22+dfsg/src/video/uikit/SDL_uikitviewcontroller.m 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/uikit/SDL_uikitviewcontroller.m 2022-08-13 03:48:10.000000000 +0000 @@ -35,10 +35,6 @@ #include "SDL_uikitwindow.h" #include "SDL_uikitopengles.h" -#if SDL_IPHONE_KEYBOARD -#include "keyinfotable.h" -#endif - #if TARGET_OS_TV static void SDLCALL SDL_AppleTVControllerUIHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint) @@ -421,33 +417,7 @@ * convert them to key presses */ int i; for (i = 0; i < len; i++) { - unichar c = [changeText characterAtIndex:i]; - SDL_Scancode code; - Uint16 mod; - - if (c < 127) { - /* Figure out the SDL_Scancode and SDL_keymod for this unichar */ - code = unicharToUIKeyInfoTable[c].code; - mod = unicharToUIKeyInfoTable[c].mod; - } else { - /* We only deal with ASCII right now */ - code = SDL_SCANCODE_UNKNOWN; - mod = 0; - } - - if (mod & KMOD_SHIFT) { - /* If character uses shift, press shift */ - SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LSHIFT); - } - - /* send a keydown and keyup even for the character */ - SDL_SendKeyboardKey(SDL_PRESSED, code); - SDL_SendKeyboardKey(SDL_RELEASED, code); - - if (mod & KMOD_SHIFT) { - /* If character uses shift, release shift */ - SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LSHIFT); - } + SDL_SendKeyboardUnicodeKey([changeText characterAtIndex:i]); } } SDL_SendKeyboardText([changeText UTF8String]); @@ -577,7 +547,7 @@ } void -UIKit_SetTextInputRect(_THIS, SDL_Rect *rect) +UIKit_SetTextInputRect(_THIS, const SDL_Rect *rect) { if (!rect) { SDL_InvalidParamError("rect"); diff -Nru libsdl2-2.0.22+dfsg/src/video/uikit/SDL_uikitwindow.m libsdl2-2.24.0+dfsg/src/video/uikit/SDL_uikitwindow.m --- libsdl2-2.0.22+dfsg/src/video/uikit/SDL_uikitwindow.m 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/uikit/SDL_uikitwindow.m 2022-08-19 15:46:21.000000000 +0000 @@ -22,10 +22,11 @@ #if SDL_VIDEO_DRIVER_UIKIT +#include "SDL_hints.h" +#include "SDL_mouse.h" +#include "SDL_system.h" #include "SDL_syswm.h" #include "SDL_video.h" -#include "SDL_mouse.h" -#include "SDL_hints.h" #include "../SDL_sysvideo.h" #include "../SDL_pixels_c.h" #include "../../events/SDL_events_c.h" @@ -403,8 +404,8 @@ return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d", - SDL_MAJOR_VERSION, SDL_MINOR_VERSION); + SDL_SetError("Application not compiled with SDL %d", + SDL_MAJOR_VERSION); return SDL_FALSE; } } diff -Nru libsdl2-2.0.22+dfsg/src/video/vita/SDL_vitavideo.c libsdl2-2.24.0+dfsg/src/video/vita/SDL_vitavideo.c --- libsdl2-2.0.22+dfsg/src/video/vita/SDL_vitavideo.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/vita/SDL_vitavideo.c 2022-06-02 02:01:57.000000000 +0000 @@ -404,8 +404,8 @@ if (info->version.major <= SDL_MAJOR_VERSION) { return SDL_TRUE; } else { - SDL_SetError("application not compiled with SDL %d.%d\n", - SDL_MAJOR_VERSION, SDL_MINOR_VERSION); + SDL_SetError("application not compiled with SDL %d\n", + SDL_MAJOR_VERSION); return SDL_FALSE; } diff -Nru libsdl2-2.0.22+dfsg/src/video/vivante/SDL_vivantevideo.c libsdl2-2.24.0+dfsg/src/video/vivante/SDL_vivantevideo.c --- libsdl2-2.0.22+dfsg/src/video/vivante/SDL_vivantevideo.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/vivante/SDL_vivantevideo.c 2022-06-02 02:01:57.000000000 +0000 @@ -382,15 +382,14 @@ SDL_WindowData *data = (SDL_WindowData *) window->driverdata; SDL_DisplayData *displaydata = SDL_GetDisplayDriverData(0); - if (info->version.major == SDL_MAJOR_VERSION && - info->version.minor == SDL_MINOR_VERSION) { + if (info->version.major == SDL_MAJOR_VERSION) { info->subsystem = SDL_SYSWM_VIVANTE; info->info.vivante.display = displaydata->native_display; info->info.vivante.window = data->native_window; return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d", - SDL_MAJOR_VERSION, SDL_MINOR_VERSION); + SDL_SetError("Application not compiled with SDL %d", + SDL_MAJOR_VERSION); return SDL_FALSE; } } diff -Nru libsdl2-2.0.22+dfsg/src/video/wayland/SDL_waylandclipboard.c libsdl2-2.24.0+dfsg/src/video/wayland/SDL_waylandclipboard.c --- libsdl2-2.0.22+dfsg/src/video/wayland/SDL_waylandclipboard.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/wayland/SDL_waylandclipboard.c 2022-08-19 15:46:21.000000000 +0000 @@ -43,7 +43,7 @@ if (text[0] != '\0') { SDL_WaylandDataSource* source = Wayland_data_source_create(_this); Wayland_data_source_add_data(source, TEXT_MIME, text, - SDL_strlen(text) + 1); + SDL_strlen(text)); status = Wayland_data_device_set_selection(data_device, source); if (status != 0) { diff -Nru libsdl2-2.0.22+dfsg/src/video/wayland/SDL_waylanddatamanager.c libsdl2-2.24.0+dfsg/src/video/wayland/SDL_waylanddatamanager.c --- libsdl2-2.0.22+dfsg/src/video/wayland/SDL_waylanddatamanager.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/wayland/SDL_waylanddatamanager.c 2022-08-19 15:46:21.000000000 +0000 @@ -305,14 +305,22 @@ } else { mime_data = mime_data_list_find(&source->mimes, mime_type); if (mime_data != NULL && mime_data->length > 0) { - buffer = SDL_malloc(mime_data->length); + size_t buffer_length = mime_data->length; + + if (null_terminate == SDL_TRUE) { + ++buffer_length; + } + buffer = SDL_malloc(buffer_length); if (buffer == NULL) { *length = SDL_OutOfMemory(); } else { *length = mime_data->length; SDL_memcpy(buffer, mime_data->data, mime_data->length); + if (null_terminate) { + *((Uint8 *)buffer + mime_data->length) = 0; + } } - } + } } return buffer; @@ -322,6 +330,10 @@ Wayland_data_source_destroy(SDL_WaylandDataSource *source) { if (source != NULL) { + SDL_WaylandDataDevice *data_device = (SDL_WaylandDataDevice *) source->data_device; + if (data_device && (data_device->selection_source == source)) { + data_device->selection_source = NULL; + } wl_data_source_destroy(source->source); mime_data_list_free(&source->mimes); SDL_free(source); @@ -449,6 +461,7 @@ Wayland_data_source_destroy(data_device->selection_source); } data_device->selection_source = source; + source->data_device = data_device; } } diff -Nru libsdl2-2.0.22+dfsg/src/video/wayland/SDL_waylanddatamanager.h libsdl2-2.24.0+dfsg/src/video/wayland/SDL_waylanddatamanager.h --- libsdl2-2.0.22+dfsg/src/video/wayland/SDL_waylanddatamanager.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/wayland/SDL_waylanddatamanager.h 2022-08-13 03:48:10.000000000 +0000 @@ -40,6 +40,7 @@ typedef struct { struct wl_data_source *source; struct wl_list mimes; + void *data_device; } SDL_WaylandDataSource; typedef struct { diff -Nru libsdl2-2.0.22+dfsg/src/video/wayland/SDL_waylanddyn.h libsdl2-2.24.0+dfsg/src/video/wayland/SDL_waylanddyn.h --- libsdl2-2.0.22+dfsg/src/video/wayland/SDL_waylanddyn.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/wayland/SDL_waylanddyn.h 2022-06-02 02:01:57.000000000 +0000 @@ -153,6 +153,7 @@ #define libdecor_state_free (*WAYLAND_libdecor_state_free) #define libdecor_configuration_get_content_size (*WAYLAND_libdecor_configuration_get_content_size) #define libdecor_configuration_get_window_state (*WAYLAND_libdecor_configuration_get_window_state) +#define libdecor_dispatch (*WAYLAND_libdecor_dispatch) #endif #else /* SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC */ diff -Nru libsdl2-2.0.22+dfsg/src/video/wayland/SDL_waylandevents.c libsdl2-2.24.0+dfsg/src/video/wayland/SDL_waylandevents.c --- libsdl2-2.0.22+dfsg/src/video/wayland/SDL_waylandevents.c 2022-04-21 17:37:37.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/wayland/SDL_waylandevents.c 2022-08-13 03:48:10.000000000 +0000 @@ -25,11 +25,12 @@ #include "SDL_stdinc.h" #include "SDL_timer.h" +#include "SDL_hints.h" #include "../../core/unix/SDL_poll.h" -#include "../../events/SDL_sysevents.h" #include "../../events/SDL_events_c.h" #include "../../events/scancodes_xfree86.h" +#include "../SDL_sysvideo.h" #include "SDL_waylandvideo.h" #include "SDL_waylandevents_c.h" @@ -294,6 +295,12 @@ } } +#ifdef HAVE_LIBDECOR_H + if (d->shell.libdecor) { + libdecor_dispatch(d->shell.libdecor, timeout); + } +#endif + /* wl_display_prepare_read() will return -1 if the default queue is not empty. * If the default queue is empty, it will prepare us for our SDL_IOReady() call. */ if (WAYLAND_wl_display_prepare_read(d->display) == 0) { @@ -472,23 +479,24 @@ }; #ifdef HAVE_LIBDECOR_H - /* ditto for libdecor. */ - const uint32_t *directions_libdecor = directions; + static const uint32_t directions_libdecor[] = { + LIBDECOR_RESIZE_EDGE_TOP_LEFT, LIBDECOR_RESIZE_EDGE_TOP, + LIBDECOR_RESIZE_EDGE_TOP_RIGHT, LIBDECOR_RESIZE_EDGE_RIGHT, + LIBDECOR_RESIZE_EDGE_BOTTOM_RIGHT, LIBDECOR_RESIZE_EDGE_BOTTOM, + LIBDECOR_RESIZE_EDGE_BOTTOM_LEFT, LIBDECOR_RESIZE_EDGE_LEFT + }; #endif - /* Hit tests shouldn't apply to xdg_popups, right? */ - SDL_assert(!WINDOW_IS_XDG_POPUP(window)); - switch (rc) { case SDL_HITTEST_DRAGGABLE: #ifdef HAVE_LIBDECOR_H - if (input->display->shell.libdecor) { + if (window_data->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { if (window_data->shell_surface.libdecor.frame) { libdecor_frame_move(window_data->shell_surface.libdecor.frame, input->seat, serial); } } else #endif - if (input->display->shell.xdg) { + if (window_data->shell_surface_type == WAYLAND_SURFACE_XDG_TOPLEVEL) { if (window_data->shell_surface.xdg.roleobj.toplevel) { xdg_toplevel_move(window_data->shell_surface.xdg.roleobj.toplevel, input->seat, @@ -506,13 +514,13 @@ case SDL_HITTEST_RESIZE_BOTTOMLEFT: case SDL_HITTEST_RESIZE_LEFT: #ifdef HAVE_LIBDECOR_H - if (input->display->shell.libdecor) { + if (window_data->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { if (window_data->shell_surface.libdecor.frame) { libdecor_frame_resize(window_data->shell_surface.libdecor.frame, input->seat, serial, directions_libdecor[rc - SDL_HITTEST_RESIZE_TOPLEFT]); } } else #endif - if (input->display->shell.xdg) { + if (window_data->shell_surface_type == WAYLAND_SURFACE_XDG_TOPLEVEL) { if (window_data->shell_surface.xdg.roleobj.toplevel) { xdg_toplevel_resize(window_data->shell_surface.xdg.roleobj.toplevel, input->seat, @@ -537,7 +545,7 @@ enum wl_pointer_button_state state = state_w; uint32_t sdl_button; - if (input->pointer_focus) { + if (window) { switch (button) { case BTN_LEFT: sdl_button = SDL_BUTTON_LEFT; @@ -561,6 +569,23 @@ return; } + /* Wayland won't let you "capture" the mouse, but it will + automatically track the mouse outside the window if you + drag outside of it, until you let go of all buttons (even + if you add or remove presses outside the window, as long + as any button is still down, the capture remains) */ + if (state) { /* update our mask of currently-pressed buttons */ + input->buttons_pressed |= SDL_BUTTON(sdl_button); + } else { + input->buttons_pressed &= ~(SDL_BUTTON(sdl_button)); + } + + if (input->buttons_pressed != 0) { + window->sdlwindow->flags |= SDL_WINDOW_MOUSE_CAPTURE; + } else { + window->sdlwindow->flags &= ~SDL_WINDOW_MOUSE_CAPTURE; + } + Wayland_data_device_set_serial(input->data_device, serial); SDL_SendMouseButton(window->sdlwindow, 0, @@ -905,11 +930,17 @@ uint32_t serial, struct wl_surface *surface) { struct SDL_WaylandInput *input = data; + SDL_WindowData *window; if (!surface || !SDL_WAYLAND_own_surface(surface)) { return; } + window = wl_surface_get_user_data(surface); + if (window) { + window->sdlwindow->flags &= ~SDL_WINDOW_MOUSE_CAPTURE; + } + /* Stop key repeat before clearing keyboard focus */ keyboard_repeat_clear(&input->keyboard_repeat); @@ -1103,8 +1134,7 @@ WAYLAND_xkb_keymap_key_for_each(input->xkb.keymap, Wayland_keymap_iter, &keymap); - SDL_SetKeymap(0, keymap.keymap, SDL_NUM_SCANCODES); - SDL_SendKeymapChangedEvent(); + SDL_SetKeymap(0, keymap.keymap, SDL_NUM_SCANCODES, SDL_TRUE); } static void @@ -1551,18 +1581,33 @@ char buf[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; text_input->has_preedit = SDL_TRUE; if (text) { - size_t text_bytes = SDL_strlen(text), i = 0; - size_t cursor = 0; - - do { - const size_t sz = SDL_utf8strlcpy(buf, text+i, sizeof(buf)); - const size_t chars = SDL_utf8strlen(buf); - - SDL_SendEditingText(buf, cursor, chars); - - i += sz; - cursor += chars; - } while (i < text_bytes); + if (SDL_GetHintBoolean(SDL_HINT_IME_SUPPORT_EXTENDED_TEXT, SDL_FALSE)) { + int cursor_begin_utf8 = cursor_begin >= 0 ? (int)SDL_utf8strnlen(text, cursor_begin) : -1; + int cursor_end_utf8 = cursor_end >= 0 ? (int)SDL_utf8strnlen(text, cursor_end) : -1; + int cursor_size_utf8; + if (cursor_end_utf8 >= 0) { + if (cursor_begin_utf8 >= 0) { + cursor_size_utf8 = cursor_end_utf8 - cursor_begin_utf8; + } else { + cursor_size_utf8 = cursor_end_utf8; + } + } else { + cursor_size_utf8 = -1; + } + SDL_SendEditingText(text, cursor_begin_utf8, cursor_size_utf8); + } else { + int text_bytes = (int)SDL_strlen(text), i = 0; + int cursor = 0; + do { + const int sz = (int)SDL_utf8strlcpy(buf, text+i, sizeof(buf)); + const int chars = (int)SDL_utf8strlen(buf); + + SDL_SendEditingText(buf, cursor, chars); + + i += sz; + cursor += chars; + } while (i < text_bytes); + } } else { buf[0] = '\0'; SDL_SendEditingText(buf, 0, 0); diff -Nru libsdl2-2.0.22+dfsg/src/video/wayland/SDL_waylandevents_c.h libsdl2-2.24.0+dfsg/src/video/wayland/SDL_waylandevents_c.h --- libsdl2-2.0.22+dfsg/src/video/wayland/SDL_waylandevents_c.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/wayland/SDL_waylandevents_c.h 2022-08-13 03:48:10.000000000 +0000 @@ -88,6 +88,8 @@ wl_fixed_t sx_w; wl_fixed_t sy_w; + uint32_t buttons_pressed; + double dx_frac; double dy_frac; diff -Nru libsdl2-2.0.22+dfsg/src/video/wayland/SDL_waylandkeyboard.c libsdl2-2.24.0+dfsg/src/video/wayland/SDL_waylandkeyboard.c --- libsdl2-2.0.22+dfsg/src/video/wayland/SDL_waylandkeyboard.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/wayland/SDL_waylandkeyboard.c 2022-08-13 03:48:10.000000000 +0000 @@ -108,7 +108,7 @@ } void -Wayland_SetTextInputRect(_THIS, SDL_Rect *rect) +Wayland_SetTextInputRect(_THIS, const SDL_Rect *rect) { SDL_VideoData *driverdata = _this->driverdata; @@ -120,7 +120,7 @@ if (driverdata->text_input_manager) { struct SDL_WaylandInput *input = driverdata->input; if (input != NULL && input->text_input) { - SDL_memcpy(&input->text_input->cursor_rect, rect, sizeof(SDL_Rect)); + SDL_copyp(&input->text_input->cursor_rect, rect); zwp_text_input_v3_set_cursor_rectangle(input->text_input->text_input, rect->x, rect->y, diff -Nru libsdl2-2.0.22+dfsg/src/video/wayland/SDL_waylandkeyboard.h libsdl2-2.24.0+dfsg/src/video/wayland/SDL_waylandkeyboard.h --- libsdl2-2.0.22+dfsg/src/video/wayland/SDL_waylandkeyboard.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/wayland/SDL_waylandkeyboard.h 2022-08-13 03:48:10.000000000 +0000 @@ -34,7 +34,7 @@ extern void Wayland_QuitKeyboard(_THIS); extern void Wayland_StartTextInput(_THIS); extern void Wayland_StopTextInput(_THIS); -extern void Wayland_SetTextInputRect(_THIS, SDL_Rect *rect); +extern void Wayland_SetTextInputRect(_THIS, const SDL_Rect *rect); extern SDL_bool Wayland_HasScreenKeyboardSupport(_THIS); #endif /* SDL_waylandkeyboard_h_ */ diff -Nru libsdl2-2.0.22+dfsg/src/video/wayland/SDL_waylandmessagebox.c libsdl2-2.24.0+dfsg/src/video/wayland/SDL_waylandmessagebox.c --- libsdl2-2.0.22+dfsg/src/video/wayland/SDL_waylandmessagebox.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/wayland/SDL_waylandmessagebox.c 2022-08-13 03:48:10.000000000 +0000 @@ -118,7 +118,7 @@ size_t output_len = 1; char* output = NULL; char* tmp = NULL; - FILE* stdout = NULL; + FILE* outputfp = NULL; close(fd_pipe[1]); /* no writing to pipe */ /* At this point, if no button ID is needed, we can just bail as soon as the @@ -146,14 +146,14 @@ } output[0] = '\0'; - stdout = fdopen(fd_pipe[0], "r"); - if (!stdout) { + outputfp = fdopen(fd_pipe[0], "r"); + if (!outputfp) { SDL_free(output); close(fd_pipe[0]); return SDL_SetError("Couldn't open pipe for reading: %s", strerror(errno)); } - tmp = fgets(output, output_len + 1, stdout); - fclose(stdout); + tmp = fgets(output, output_len + 1, outputfp); + fclose(outputfp); if ((tmp == NULL) || (*tmp == '\0') || (*tmp == '\n')) { SDL_free(output); diff -Nru libsdl2-2.0.22+dfsg/src/video/wayland/SDL_waylandmouse.c libsdl2-2.24.0+dfsg/src/video/wayland/SDL_waylandmouse.c --- libsdl2-2.0.22+dfsg/src/video/wayland/SDL_waylandmouse.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/wayland/SDL_waylandmouse.c 2022-08-13 03:48:10.000000000 +0000 @@ -55,6 +55,106 @@ void *shm_data; } Wayland_CursorData; +#ifdef SDL_USE_LIBDBUS + +#include "../../core/linux/SDL_dbus.h" + +static DBusMessage* +wayland_read_dbus_setting(SDL_DBusContext *dbus, const char *key) +{ + static const char *iface = "org.gnome.desktop.interface"; + + DBusMessage *reply = NULL; + DBusMessage *msg = dbus->message_new_method_call("org.freedesktop.portal.Desktop", /* Node */ + "/org/freedesktop/portal/desktop", /* Path */ + "org.freedesktop.portal.Settings", /* Interface */ + "Read"); /* Method */ + + if (msg) { + if (dbus->message_append_args(msg, DBUS_TYPE_STRING, &iface, DBUS_TYPE_STRING, &key, DBUS_TYPE_INVALID)) { + reply = dbus->connection_send_with_reply_and_block(dbus->session_conn, msg, DBUS_TIMEOUT_USE_DEFAULT, NULL); + } + dbus->message_unref(msg); + } + + return reply; +} + +static SDL_bool +wayland_parse_dbus_reply(SDL_DBusContext *dbus, DBusMessage *reply, int type, void *value) +{ + DBusMessageIter iter[3]; + + dbus->message_iter_init(reply, &iter[0]); + if (dbus->message_iter_get_arg_type(&iter[0]) != DBUS_TYPE_VARIANT) { + return SDL_FALSE; + } + + dbus->message_iter_recurse(&iter[0], &iter[1]); + if (dbus->message_iter_get_arg_type(&iter[1]) != DBUS_TYPE_VARIANT) { + return SDL_FALSE; + } + + dbus->message_iter_recurse(&iter[1], &iter[2]); + if (dbus->message_iter_get_arg_type(&iter[2]) != type) { + return SDL_FALSE; + } + + dbus->message_iter_get_basic(&iter[2], value); + + return SDL_TRUE; +} + +static SDL_bool +wayland_dbus_read_cursor_size(int *size) +{ + static const char *cursor_size_value = "cursor-size"; + + DBusMessage *reply; + SDL_DBusContext *dbus = SDL_DBus_GetContext(); + + if (!dbus || !size) { + return SDL_FALSE; + } + + if ((reply = wayland_read_dbus_setting(dbus, cursor_size_value))) { + if (wayland_parse_dbus_reply(dbus, reply, DBUS_TYPE_INT32, size)) { + dbus->message_unref(reply); + return SDL_TRUE; + } + dbus->message_unref(reply); + } + + return SDL_FALSE; +} + +static SDL_bool +wayland_dbus_read_cursor_theme(char **theme) +{ + static const char *cursor_theme_value = "cursor-theme"; + + DBusMessage *reply; + SDL_DBusContext *dbus = SDL_DBus_GetContext(); + + if (!dbus || !theme) { + return SDL_FALSE; + } + + if ((reply = wayland_read_dbus_setting(dbus, cursor_theme_value))) { + const char *temp; + if (wayland_parse_dbus_reply(dbus, reply, DBUS_TYPE_STRING, &temp)) { + *theme = SDL_strdup(temp); + dbus->message_unref(reply); + return SDL_TRUE; + } + dbus->message_unref(reply); + } + + return SDL_FALSE; +} + +#endif + static SDL_bool wayland_get_system_cursor(SDL_VideoData *vdata, Wayland_CursorData *cdata, float *scale) { @@ -68,20 +168,25 @@ SDL_WindowData *focusdata; int i; - /* FIXME: We need to be able to query the cursor size from the desktop at - * some point! For a while this was 32, but when testing on real desktops it - * seems like most of them default to 24. We'll need a protocol to get this - * for real, but for now this is a pretty safe bet. - * -flibit + /* + * GNOME based desktops expose the cursor size and theme via the + * org.freedesktop.portal.Settings interface of the xdg-desktop portal. + * Try XCURSOR_SIZE and XCURSOR_THEME first, so user specified sizes and + * themes take precedence over all, then try D-Bus if the envvar isn't + * set, then fall back to the defaults if none of the preceding values + * are available or valid. */ - xcursor_size = SDL_getenv("XCURSOR_SIZE"); - if (xcursor_size != NULL) { + if ((xcursor_size = SDL_getenv("XCURSOR_SIZE"))) { size = SDL_atoi(xcursor_size); } +#if SDL_USE_LIBDBUS + if (size <= 0) { + wayland_dbus_read_cursor_size(&size); + } +#endif if (size <= 0) { size = 24; } - /* First, find the appropriate theme based on the current scale... */ focus = SDL_GetMouse()->focus; if (focus == NULL) { @@ -98,15 +203,29 @@ } } if (theme == NULL) { + char *xcursor_theme = NULL; + SDL_bool free_theme_str = SDL_FALSE; + vdata->cursor_themes = SDL_realloc(vdata->cursor_themes, sizeof(SDL_WaylandCursorTheme) * (vdata->num_cursor_themes + 1)); if (vdata->cursor_themes == NULL) { SDL_OutOfMemory(); return SDL_FALSE; } - theme = WAYLAND_wl_cursor_theme_load(SDL_getenv("XCURSOR_THEME"), size, vdata->shm); + xcursor_theme = SDL_getenv("XCURSOR_THEME"); +#if SDL_USE_LIBDBUS + if (xcursor_theme == NULL) { + /* Allocates the string with SDL_strdup, which must be freed. */ + free_theme_str = wayland_dbus_read_cursor_theme(&xcursor_theme); + } +#endif + theme = WAYLAND_wl_cursor_theme_load(xcursor_theme, size, vdata->shm); vdata->cursor_themes[vdata->num_cursor_themes].size = size; vdata->cursor_themes[vdata->num_cursor_themes++].theme = theme; + + if (free_theme_str) { + SDL_free(xcursor_theme); + } } /* Next, find the cursor from the theme... */ diff -Nru libsdl2-2.0.22+dfsg/src/video/wayland/SDL_waylandopengles.c libsdl2-2.24.0+dfsg/src/video/wayland/SDL_waylandopengles.c --- libsdl2-2.0.22+dfsg/src/video/wayland/SDL_waylandopengles.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/wayland/SDL_waylandopengles.c 2022-06-16 20:16:31.000000000 +0000 @@ -140,9 +140,9 @@ /* wl_display_prepare_read_queue() will return -1 if the event queue is not empty. * If the event queue is empty, it will prepare us for our SDL_IOReady() call. */ - if (WAYLAND_wl_display_prepare_read_queue(display, data->frame_event_queue) != 0) { + if (WAYLAND_wl_display_prepare_read_queue(display, data->gles_swap_frame_event_queue) != 0) { /* We have some pending events. Check if the frame callback happened. */ - WAYLAND_wl_display_dispatch_queue_pending(display, data->frame_event_queue); + WAYLAND_wl_display_dispatch_queue_pending(display, data->gles_swap_frame_event_queue); continue; } @@ -163,7 +163,7 @@ /* We have events. Read and dispatch them. */ WAYLAND_wl_display_read_events(display); - WAYLAND_wl_display_dispatch_queue_pending(display, data->frame_event_queue); + WAYLAND_wl_display_dispatch_queue_pending(display, data->gles_swap_frame_event_queue); } SDL_AtomicSet(&data->swap_interval_ready, 0); } diff -Nru libsdl2-2.0.22+dfsg/src/video/wayland/SDL_waylandsym.h libsdl2-2.24.0+dfsg/src/video/wayland/SDL_waylandsym.h --- libsdl2-2.0.22+dfsg/src/video/wayland/SDL_waylandsym.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/wayland/SDL_waylandsym.h 2022-06-02 02:01:57.000000000 +0000 @@ -19,7 +19,7 @@ 3. This notice may not be removed or altered from any source distribution. */ -/* *INDENT-OFF* */ +/* *INDENT-OFF* */ /* clang-format off */ #ifndef SDL_WAYLAND_MODULE #define SDL_WAYLAND_MODULE(modname) @@ -204,12 +204,13 @@ int *)) SDL_WAYLAND_SYM(bool, libdecor_configuration_get_window_state, (struct libdecor_configuration *,\ enum libdecor_window_state *)) +SDL_WAYLAND_SYM(bool, libdecor_dispatch, (struct libdecor *, int)) #endif #undef SDL_WAYLAND_MODULE #undef SDL_WAYLAND_SYM #undef SDL_WAYLAND_INTERFACE -/* *INDENT-ON* */ +/* *INDENT-ON* */ /* clang-format on */ /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/video/wayland/SDL_waylandvideo.c libsdl2-2.24.0+dfsg/src/video/wayland/SDL_waylandvideo.c --- libsdl2-2.0.22+dfsg/src/video/wayland/SDL_waylandvideo.c 2022-04-21 17:37:37.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/wayland/SDL_waylandvideo.c 2022-08-19 15:46:21.000000000 +0000 @@ -174,7 +174,7 @@ } static SDL_VideoDevice * -Wayland_CreateDevice(int devindex) +Wayland_CreateDevice(void) { SDL_VideoDevice *device; SDL_VideoData *data; @@ -279,7 +279,8 @@ device->free = Wayland_DeleteDevice; - device->disable_display_mode_switching = SDL_TRUE; + device->quirk_flags = VIDEO_DEVICE_QUIRK_DISABLE_DISPLAY_MODE_SWITCHING | + VIDEO_DEVICE_QUIRK_DISABLE_UNSET_FULLSCREEN_ON_MINIMIZE; return device; } @@ -354,6 +355,16 @@ xdg_output_handle_description(void *data, struct zxdg_output_v1 *xdg_output, const char *description) { + SDL_WaylandOutputData* driverdata = data; + + if (driverdata->index == -1) { + /* xdg-output descriptions, if available, supersede wl-output model names. */ + if (driverdata->placeholder.name != NULL) { + SDL_free(driverdata->placeholder.name); + } + + driverdata->placeholder.name = SDL_strdup(description); + } } static const struct zxdg_output_v1_listener xdg_output_listener = { @@ -416,23 +427,25 @@ }; int i; + SDL_DisplayMode mode; const int native_width = dpy->display_modes->w; const int native_height = dpy->display_modes->h; for (i = 0; i < SDL_arraysize(mode_list); ++i) { - /* Only add modes that are smaller than the native mode */ - if ((mode_list[i].w < native_width && mode_list[i].h < native_height) || - (mode_list[i].w < native_width && mode_list[i].h == native_height)) { - SDL_DisplayMode mode = *dpy->display_modes; - - if (rot_90) { - mode.w = mode_list[i].h; - mode.h = mode_list[i].w; - } else { - mode.w = mode_list[i].w; - mode.h = mode_list[i].h; - } + mode = *dpy->display_modes; + if (rot_90) { + mode.w = mode_list[i].h; + mode.h = mode_list[i].w; + } else { + mode.w = mode_list[i].w; + mode.h = mode_list[i].h; + } + + /* Only add modes that are smaller than the native mode. */ + if ((mode.w < native_width && mode.h < native_height) || + (mode.w < native_width && mode.h == native_height) || + (mode.w == native_width && mode.h < native_height)) { SDL_AddDisplayMode(dpy, &mode); } } @@ -475,7 +488,9 @@ } driverdata->physical_width = physical_width; driverdata->physical_height = physical_height; - if (driverdata->index == -1) { + + /* The output name is only set if xdg-output hasn't provided a description. */ + if (driverdata->index == -1 && driverdata->placeholder.name == NULL) { driverdata->placeholder.name = SDL_strdup(model); } @@ -545,6 +560,7 @@ SDL_VideoData* video = driverdata->videodata; SDL_DisplayMode native_mode, desktop_mode; SDL_VideoDisplay *dpy; + const SDL_bool mode_emulation_enabled = SDL_GetHintBoolean(SDL_HINT_VIDEO_WAYLAND_MODE_EMULATION, SDL_TRUE); /* * When using xdg-output, two wl-output.done events will be emitted: @@ -578,8 +594,9 @@ SDL_zero(desktop_mode); desktop_mode.format = SDL_PIXELFORMAT_RGB888; - /* Scale the desktop coordinates, if xdg-output isn't present */ - if (!driverdata->has_logical_size) { + if (driverdata->has_logical_size) { /* If xdg-output is present, calculate the true scale of the desktop */ + driverdata->scale_factor = (float)native_mode.w / (float)driverdata->width; + } else { /* Scale the desktop coordinates, if xdg-output isn't present */ driverdata->width /= driverdata->scale_factor; driverdata->height /= driverdata->scale_factor; } @@ -596,8 +613,8 @@ desktop_mode.driverdata = driverdata->output; /* - * The native display mode is only exposed separately from the desktop size if: - * the desktop is scaled and the wp_viewporter protocol is supported. + * The native display mode is only exposed separately from the desktop size if the + * desktop is scaled and the wp_viewporter protocol is supported. */ if (driverdata->scale_factor > 1.0f && video->viewporter != NULL) { if (driverdata->index > -1) { @@ -642,9 +659,11 @@ SDL_SetCurrentDisplayMode(dpy, &desktop_mode); SDL_SetDesktopDisplayMode(dpy, &desktop_mode); - /* Add emulated modes if wp_viewporter is supported. */ - if (video->viewporter) { - AddEmulatedModes(dpy, (driverdata->transform & WL_OUTPUT_TRANSFORM_90) != 0); + /* Add emulated modes if wp_viewporter is supported and mode emulation is enabled. */ + if (video->viewporter && mode_emulation_enabled) { + const SDL_bool rot_90 = ((driverdata->transform & WL_OUTPUT_TRANSFORM_90) != 0) || + (driverdata->width < driverdata->height); + AddEmulatedModes(dpy, rot_90); } if (driverdata->index == -1) { @@ -718,7 +737,7 @@ } static void -Wayland_free_display(uint32_t id) +Wayland_free_display(SDL_VideoData *d, uint32_t id) { int num_displays = SDL_GetNumVideoDisplays(); SDL_VideoDisplay *display; @@ -729,6 +748,19 @@ display = SDL_GetDisplay(i); data = (SDL_WaylandOutputData *) display->driverdata; if (data->registry_id == id) { + if (d->output_list != NULL) { + SDL_WaylandOutputData *node = d->output_list; + if (node == data) { + d->output_list = node->next; + } else { + while (node->next != data && node->next != NULL) { + node = node->next; + } + if (node->next != NULL) { + node->next = node->next->next; + } + } + } SDL_DelVideoDisplay(i); if (data->xdg_output) { zxdg_output_v1_destroy(data->xdg_output); @@ -868,8 +900,9 @@ static void display_remove_global(void *data, struct wl_registry *registry, uint32_t id) { + SDL_VideoData *d = data; /* We don't get an interface, just an ID, so assume it's a wl_output :shrug: */ - Wayland_free_display(id); + Wayland_free_display(d, id); } static const struct wl_registry_listener registry_listener = { @@ -878,7 +911,7 @@ }; #ifdef HAVE_LIBDECOR_H -static SDL_bool should_use_libdecor(SDL_VideoData *data) +static SDL_bool should_use_libdecor(SDL_VideoData *data, SDL_bool ignore_xdg) { if (!SDL_WAYLAND_HAVE_WAYLAND_LIBDECOR) { return SDL_FALSE; @@ -892,6 +925,10 @@ return SDL_TRUE; } + if (ignore_xdg) { + return SDL_TRUE; + } + if (data->decoration_manager) { return SDL_FALSE; } @@ -900,6 +937,21 @@ } #endif +SDL_bool +Wayland_LoadLibdecor(SDL_VideoData *data, SDL_bool ignore_xdg) +{ +#ifdef HAVE_LIBDECOR_H + if (data->shell.libdecor != NULL) { + return SDL_TRUE; /* Already loaded! */ + } + if (should_use_libdecor(data, ignore_xdg)) { + data->shell.libdecor = libdecor_new(data->display, &libdecor_interface); + return data->shell.libdecor != NULL; + } +#endif + return SDL_FALSE; +} + int Wayland_VideoInit(_THIS) { @@ -920,12 +972,8 @@ // First roundtrip to receive all registry objects. WAYLAND_wl_display_roundtrip(data->display); -#ifdef HAVE_LIBDECOR_H - /* Don't have server-side decorations? Try client-side instead. */ - if (should_use_libdecor(data)) { - data->shell.libdecor = libdecor_new(data->display, &libdecor_interface); - } -#endif + /* Now that we have all the protocols, load libdecor if applicable */ + Wayland_LoadLibdecor(data, SDL_FALSE); // Second roundtrip to receive all output events. WAYLAND_wl_display_roundtrip(data->display); diff -Nru libsdl2-2.0.22+dfsg/src/video/wayland/SDL_waylandvideo.h libsdl2-2.24.0+dfsg/src/video/wayland/SDL_waylandvideo.h --- libsdl2-2.0.22+dfsg/src/video/wayland/SDL_waylandvideo.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/wayland/SDL_waylandvideo.h 2022-06-02 02:01:57.000000000 +0000 @@ -122,6 +122,8 @@ extern SDL_bool SDL_WAYLAND_own_surface(struct wl_surface *surface); extern SDL_bool SDL_WAYLAND_own_output(struct wl_output *output); +extern SDL_bool Wayland_LoadLibdecor(SDL_VideoData *data, SDL_bool ignore_xdg); + #endif /* SDL_waylandvideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/video/wayland/SDL_waylandwindow.c libsdl2-2.24.0+dfsg/src/video/wayland/SDL_waylandwindow.c --- libsdl2-2.0.22+dfsg/src/video/wayland/SDL_waylandwindow.c 2022-04-21 17:37:37.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/wayland/SDL_waylandwindow.c 2022-08-19 15:46:21.000000000 +0000 @@ -44,6 +44,21 @@ #include #endif +SDL_FORCE_INLINE SDL_bool +EGLTransparencyEnabled() +{ + return SDL_GetHintBoolean(SDL_HINT_VIDEO_EGL_ALLOW_TRANSPARENCY, SDL_FALSE); +} + +SDL_FORCE_INLINE SDL_bool +FloatEqual(float a, float b) +{ + const float diff = SDL_fabsf(a - b); + const float largest = SDL_max(SDL_fabsf(a), SDL_fabsf(b)); + + return diff <= largest * SDL_FLT_EPSILON; +} + static void GetFullScreenDimensions(SDL_Window *window, int *width, int *height, int *drawable_width, int *drawable_height) { @@ -103,61 +118,40 @@ } } -static inline SDL_bool -DesktopIsScaled(SDL_Window *window) +SDL_FORCE_INLINE SDL_bool +SurfaceScaleIsFractional(SDL_Window *window) { SDL_WindowData *data = window->driverdata; - - return data->scale_factor != 1.0f; + return !FloatEqual(SDL_roundf(data->scale_factor), data->scale_factor); } -static inline SDL_bool -DesktopIsFractionalScaled(SDL_Window *window) +SDL_FORCE_INLINE SDL_bool +FullscreenModeEmulation(SDL_Window *window) { - SDL_WindowData *data = window->driverdata; - SDL_WaylandOutputData *output = (SDL_WaylandOutputData *)SDL_GetDisplayForWindow(window)->driverdata; - - if ((output->native_width != (int)(output->width * data->scale_factor) || - output->native_height != (int)(output->height * data->scale_factor))) { - return SDL_TRUE; - } - - return SDL_FALSE; + return (window->flags & SDL_WINDOW_FULLSCREEN) && + ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP); } -static SDL_bool -NeedFullscreenViewport(SDL_Window *window) +SDL_bool +NeedViewport(SDL_Window *window) { - SDL_WindowData *data = window->driverdata; - SDL_VideoData *video = data->waylandData; - SDL_WaylandOutputData *output = (SDL_WaylandOutputData *)SDL_GetDisplayForWindow(window)->driverdata; - - int fs_width, fs_height; - - GetFullScreenDimensions(window, &fs_width, &fs_height, NULL, NULL); + SDL_WindowData *wind = window->driverdata; + SDL_VideoData *video = wind->waylandData; + SDL_WaylandOutputData *output = ((SDL_WaylandOutputData *)SDL_GetDisplayForWindow(window)->driverdata); + int fs_width, fs_height; /* - * Fullscreen needs a viewport: - * - If the desktop uses fractional scaling - * - Fullscreen desktop was not requested OR the window is DPI aware - * - * - The desktop uses non-fractional scaling - * - Fullscreen desktop was NOT requested - * - * - The desktop is not scaled - * - A non-native fullscreen mode was explicitly set by the client + * A viewport is only required when scaling is enabled and: + * - A fullscreen mode is being emulated and the mode does not match the logical desktop dimensions. + * - The desktop uses fractional scaling and the high-DPI flag is set. */ - if (video->viewporter != NULL && (window->flags & SDL_WINDOW_FULLSCREEN)) { - if (DesktopIsFractionalScaled(window)) { - if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP || - (window->flags & SDL_WINDOW_ALLOW_HIGHDPI)) { - return SDL_TRUE; - } - } else if (DesktopIsScaled(window)) { - if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP) { + if (video->viewporter != NULL) { + if (FullscreenModeEmulation(window)) { + GetFullScreenDimensions(window, &fs_width, &fs_height, NULL, NULL); + if (fs_width != output->width || fs_height != output->height) { return SDL_TRUE; } - } else if (fs_width != output->native_width && fs_height != output->native_height) { + } else if (SurfaceScaleIsFractional(window) && (window->flags & SDL_WINDOW_ALLOW_HIGHDPI)) { return SDL_TRUE; } } @@ -165,46 +159,45 @@ return SDL_FALSE; } -static inline SDL_bool -NeedWindowedViewport(SDL_Window *window) -{ - SDL_WindowData *data = window->driverdata; - SDL_VideoData *video = data->waylandData; - - return !(window->flags & SDL_WINDOW_FULLSCREEN) && (video->viewporter != NULL) && - DesktopIsFractionalScaled(window) && (window->flags & SDL_WINDOW_ALLOW_HIGHDPI); -} - -/* Never set a fullscreen window size larger than the desktop. */ +/* If a viewport is active, use the width and height for the window dimensions. */ SDL_FORCE_INLINE int GetWindowWidth(SDL_Window *window) { - return NeedFullscreenViewport(window) ? ((SDL_WaylandOutputData *)SDL_GetDisplayForWindow(window)->driverdata)->width : window->w; + SDL_WindowData *data = (SDL_WindowData *)window->driverdata; + return SDL_RectEmpty(&data->viewport_rect) ? window->w : data->viewport_rect.w; } SDL_FORCE_INLINE int GetWindowHeight(SDL_Window *window) { - return NeedFullscreenViewport(window) ? ((SDL_WaylandOutputData *)SDL_GetDisplayForWindow(window)->driverdata)->height : window->h; + SDL_WindowData *data = (SDL_WindowData *)window->driverdata; + return SDL_RectEmpty(&data->viewport_rect) ? window->h : data->viewport_rect.h; } static void -GetWindowBufferSize(SDL_Window *window, int *width, int *height) +GetBufferSize(SDL_Window *window, int *width, int *height) { - SDL_WindowData *data = window->driverdata; - SDL_WaylandOutputData *output = (SDL_WaylandOutputData *)SDL_GetDisplayForWindow(window)->driverdata; - int buf_width; - int buf_height; + SDL_WindowData *data = window->driverdata; + int buf_width; + int buf_height; + + if (FullscreenModeEmulation(window)) { + GetFullScreenDimensions(window, NULL, NULL, &buf_width, &buf_height); + } else if (NeedViewport(window)) { + /* Round fractional backbuffer sizes halfway away from zero. */ + buf_width = (int)SDL_lroundf(window->w * data->scale_factor); + buf_height = (int)SDL_lroundf(window->h * data->scale_factor); + } else { + /* + * Integer scaled windowed or fullscreen with no viewport + * + * Round the scale factor up in the unlikely scenario of a compositor + * that supports fractional scaling, but not viewports. + */ + int scale_factor = (int)SDL_ceilf(data->scale_factor); - if (NeedWindowedViewport(window)) { - const float frac_scale_x = (float)output->native_width / (float)output->width; - const float frac_scale_y = (float)output->native_height / (float)output->height; - - buf_width = (int)SDL_lroundf(window->w * frac_scale_x); - buf_height = (int)SDL_lroundf(window->h * frac_scale_y); - } else { /* Windowed or fullscreen with no viewport */ - buf_width = window->w * data->scale_factor; - buf_height = window->h * data->scale_factor; + buf_width = window->w * scale_factor; + buf_height = window->h * scale_factor; } if (width) { @@ -216,100 +209,102 @@ } static void -SetViewport(SDL_Window *window, int src_width, int src_height, int dst_width, int dst_height) +SetDrawSurfaceViewport(SDL_Window *window, int src_width, int src_height, int dst_width, int dst_height) { SDL_WindowData *wind = window->driverdata; SDL_VideoData *video = wind->waylandData; if (video->viewporter) { - if (wind->viewport == NULL) { - wind->viewport = wp_viewporter_get_viewport(video->viewporter, wind->surface); + if (wind->draw_viewport == NULL) { + wind->draw_viewport = wp_viewporter_get_viewport(video->viewporter, wind->surface); } - wp_viewport_set_source(wind->viewport, wl_fixed_from_int(0), wl_fixed_from_int(0), wl_fixed_from_int(src_width), wl_fixed_from_int(src_height)); - wp_viewport_set_destination(wind->viewport, dst_width, dst_height); + wp_viewport_set_source(wind->draw_viewport, wl_fixed_from_int(0), wl_fixed_from_int(0), wl_fixed_from_int(src_width), wl_fixed_from_int(src_height)); + wp_viewport_set_destination(wind->draw_viewport, dst_width, dst_height); } } static void -UnsetViewport(SDL_Window *window) +UnsetDrawSurfaceViewport(SDL_Window *window) { SDL_WindowData *wind = window->driverdata; - if (wind->viewport) { - wp_viewport_destroy(wind->viewport); - wind->viewport = NULL; + if (wind->draw_viewport) { + wp_viewport_destroy(wind->draw_viewport); + wind->draw_viewport = NULL; } } static void -ConfigureViewport(SDL_Window *window) +ConfigureWindowGeometry(SDL_Window *window) { SDL_WindowData *data = window->driverdata; SDL_VideoData *viddata = data->waylandData; SDL_WaylandOutputData *output = (SDL_WaylandOutputData *)SDL_GetDisplayForWindow(window)->driverdata; + struct wl_region *region; - if (NeedFullscreenViewport(window)) { + /* Set the drawable backbuffer size. */ + GetBufferSize(window, &data->drawable_width, &data->drawable_height); + + if (data->egl_window) { + WAYLAND_wl_egl_window_resize(data->egl_window, + data->drawable_width, + data->drawable_height, + 0, 0); + } + + if (FullscreenModeEmulation(window) && NeedViewport(window)) { int fs_width, fs_height; int src_width, src_height; GetFullScreenDimensions(window, &fs_width, &fs_height, &src_width, &src_height); - SetViewport(window, src_width, src_height, output->width, output->height); - data->damage_region.x = 0; - data->damage_region.y = 0; - data->damage_region.w = output->width; - data->damage_region.h = output->height; + /* Set the buffer scale to 1 since a viewport will be used. */ + wl_surface_set_buffer_scale(data->surface, 1); + SetDrawSurfaceViewport(window, src_width, src_height, output->width, output->height); + + data->viewport_rect.x = 0; + data->viewport_rect.y = 0; + data->viewport_rect.w = output->width; + data->viewport_rect.h = output->height; data->pointer_scale_x = (float)fs_width / (float)output->width; data->pointer_scale_y = (float)fs_height / (float)output->height; - } else { - if (NeedWindowedViewport(window)) { - int src_width, src_height; - GetWindowBufferSize(window, &src_width, &src_height); - SetViewport(window, src_width, src_height, window->w, window->h); + if (!EGLTransparencyEnabled()) { + region = wl_compositor_create_region(viddata->compositor); + wl_region_add(region, data->viewport_rect.x, data->viewport_rect.y, + data->viewport_rect.w, data->viewport_rect.h); + wl_surface_set_opaque_region(data->surface, region); + wl_region_destroy(region); + } + } else { + if (NeedViewport(window)) { + wl_surface_set_buffer_scale(data->surface, 1); + SetDrawSurfaceViewport(window, data->drawable_width, data->drawable_height, window->w, window->h); } else { - UnsetViewport(window); + UnsetDrawSurfaceViewport(window); + + /* Round to the next integer in case of a fractional value. */ + wl_surface_set_buffer_scale(data->surface, (int32_t)SDL_ceilf(data->scale_factor)); } - SDL_zero(data->damage_region); + SDL_zero(data->viewport_rect); data->pointer_scale_x = 1.0f; data->pointer_scale_y = 1.0f; - } - /* - * If mouse_rect is not empty, re-create the confinement region with the new scale value. - * If the pointer is locked to the general surface with unspecified coordinates, it will - * be confined to the viewport region, so no update is required. - */ - if (!SDL_RectEmpty(&window->mouse_rect)) { - Wayland_input_confine_pointer(viddata->input, window); + if (!EGLTransparencyEnabled()) { + region = wl_compositor_create_region(viddata->compositor); + wl_region_add(region, 0, 0, window->w, window->h); + wl_surface_set_opaque_region(data->surface, region); + wl_region_destroy(region); + } } -} - -static void -SetDrawScale(SDL_Window *window) -{ - SDL_WindowData *data = window->driverdata; - - if (NeedFullscreenViewport(window)) { - int fs_width, fs_height; - GetFullScreenDimensions(window, &fs_width, &fs_height, &data->drawable_width, &data->drawable_height); - - /* Set the buffer scale to 1 since a viewport will be used. */ - wl_surface_set_buffer_scale(data->surface, 1); - } else { - GetWindowBufferSize(window, &data->drawable_width, &data->drawable_height); - - if (NeedWindowedViewport(window)) { - /* Set the buffer scale to 1 since a viewport will be used. */ - wl_surface_set_buffer_scale(data->surface, 1); - } else { - wl_surface_set_buffer_scale(data->surface, (int32_t)data->scale_factor); - } + /* Recreate the pointer confinement region when the window geometry changes. */ + if (data->confined_pointer) { + Wayland_input_confine_pointer(viddata->input, window); } } @@ -357,6 +352,13 @@ libdecor_frame_set_max_content_size(wind->shell_surface.libdecor.frame, max_width, max_height); + + if (commit) { + struct libdecor_state *state = libdecor_state_new(GetWindowWidth(window), GetWindowHeight(window)); + libdecor_frame_commit(wind->shell_surface.libdecor.frame, state, NULL); + libdecor_state_free(state); + wl_surface_commit(wind->surface); + } } else #endif if (viddata->shell.xdg) { @@ -402,17 +404,31 @@ } if (output) { if (!(window->flags & SDL_WINDOW_RESIZABLE)) { - /* ensure that window is resizable before going into fullscreen */ + /* Ensure that window is resizable before going into fullscreen. + * This triggers a frame commit internally, so a separate one is not necessary. + */ libdecor_frame_set_capabilities(wind->shell_surface.libdecor.frame, LIBDECOR_ACTION_RESIZE); wl_surface_commit(wind->surface); + } else if (commit) { + struct libdecor_state *state = libdecor_state_new(GetWindowWidth(window), GetWindowHeight(window)); + libdecor_frame_commit(wind->shell_surface.libdecor.frame, state, NULL); + libdecor_state_free(state); + wl_surface_commit(wind->surface); } + libdecor_frame_set_fullscreen(wind->shell_surface.libdecor.frame, output); } else { libdecor_frame_unset_fullscreen(wind->shell_surface.libdecor.frame); + if (!(window->flags & SDL_WINDOW_RESIZABLE)) { /* restore previous RESIZE capability */ libdecor_frame_unset_capabilities(wind->shell_surface.libdecor.frame, LIBDECOR_ACTION_RESIZE); wl_surface_commit(wind->surface); + } else if (commit) { + struct libdecor_state *state = libdecor_state_new(GetWindowWidth(window), GetWindowHeight(window)); + libdecor_frame_commit(wind->shell_surface.libdecor.frame, state, NULL); + libdecor_state_free(state); + wl_surface_commit(wind->surface); } } } else @@ -421,38 +437,55 @@ if (wind->shell_surface.xdg.roleobj.toplevel == NULL) { return; /* Can't do anything yet, wait for ShowWindow */ } + if (commit) { + wl_surface_commit(wind->surface); + } if (output) { xdg_toplevel_set_fullscreen(wind->shell_surface.xdg.roleobj.toplevel, output); } else { xdg_toplevel_unset_fullscreen(wind->shell_surface.xdg.roleobj.toplevel); } - if (commit) { - wl_surface_commit(wind->surface); - } } } -static const struct wl_callback_listener surface_frame_listener; +const struct wl_callback_listener surface_damage_frame_listener; static void -handle_surface_frame_done(void *data, struct wl_callback *cb, uint32_t time) +surface_damage_frame_done(void *data, struct wl_callback *cb, uint32_t time) { - SDL_WindowData *wind = (SDL_WindowData *) data; - SDL_AtomicSet(&wind->swap_interval_ready, 1); /* mark window as ready to present again. */ + SDL_WindowData *wind = (SDL_WindowData *)data; - if (!SDL_RectEmpty(&wind->damage_region)) { - wl_surface_damage(wind->surface, wind->damage_region.x, wind->damage_region.y, - wind->damage_region.w, wind->damage_region.h); + /* Manually set the damage region when using a viewport. */ + if (!SDL_RectEmpty(&wind->viewport_rect)) { + wl_surface_damage(wind->surface, wind->viewport_rect.x, wind->viewport_rect.y, + wind->viewport_rect.w, wind->viewport_rect.h); } + wl_callback_destroy(cb); + wind->surface_damage_frame_callback = wl_surface_frame(wind->surface); + wl_callback_add_listener(wind->surface_damage_frame_callback, &surface_damage_frame_listener, data); +} + +const struct wl_callback_listener surface_damage_frame_listener = { + surface_damage_frame_done +}; + +static const struct wl_callback_listener gles_swap_frame_listener; + +static void +gles_swap_frame_done(void *data, struct wl_callback *cb, uint32_t time) +{ + SDL_WindowData *wind = (SDL_WindowData *) data; + SDL_AtomicSet(&wind->swap_interval_ready, 1); /* mark window as ready to present again. */ + /* reset this callback to fire again once a new frame was presented and compositor wants the next one. */ - wind->frame_callback = wl_surface_frame(wind->frame_surface_wrapper); + wind->gles_swap_frame_callback = wl_surface_frame(wind->gles_swap_frame_surface_wrapper); wl_callback_destroy(cb); - wl_callback_add_listener(wind->frame_callback, &surface_frame_listener, data); + wl_callback_add_listener(wind->gles_swap_frame_callback, &gles_swap_frame_listener, data); } -static const struct wl_callback_listener surface_frame_listener = { - handle_surface_frame_done +static const struct wl_callback_listener gles_swap_frame_listener = { + gles_swap_frame_done }; @@ -514,9 +547,6 @@ if (!fullscreen) { if (window->flags & SDL_WINDOW_FULLSCREEN) { - /* We might need to re-enter fullscreen after being restored from minimized */ - SetFullscreen(window, driverdata->output, SDL_FALSE); - /* Foolishly do what the compositor says here. If it's wrong, don't * blame us, we were explicitly instructed to do this. * @@ -531,7 +561,7 @@ } /* This part is good though. */ - if ((window->flags & SDL_WINDOW_ALLOW_HIGHDPI) && wind->scale_factor != driverdata->scale_factor) { + if ((window->flags & SDL_WINDOW_ALLOW_HIGHDPI) && !FloatEqual(wind->scale_factor, driverdata->scale_factor)) { wind->scale_factor = driverdata->scale_factor; wind->needs_resize_event = SDL_TRUE; } @@ -598,19 +628,17 @@ * UPDATE: Nope, sure enough a compositor sends 0,0. This is a known bug: * https://bugs.kde.org/show_bug.cgi?id=444962 */ - if (!NeedFullscreenViewport(window)) { - if (width != 0 && height != 0 && (window->w != width || window->h != height)) { - window->w = width; - window->h = height; - wind->needs_resize_event = SDL_TRUE; - } - } else { - GetFullScreenDimensions(window, &window->w, &window->h, NULL, NULL); + if (FullscreenModeEmulation(window)) { + GetFullScreenDimensions(window, &width, &height, NULL, NULL); + } + if (width != 0 && height != 0 && (window->w != width || window->h != height)) { + window->w = width; + window->h = height; wind->needs_resize_event = SDL_TRUE; } /* This part is good though. */ - if ((window->flags & SDL_WINDOW_ALLOW_HIGHDPI) && wind->scale_factor != driverdata->scale_factor) { + if ((window->flags & SDL_WINDOW_ALLOW_HIGHDPI) && !FloatEqual(wind->scale_factor, driverdata->scale_factor)) { wind->scale_factor = driverdata->scale_factor; wind->needs_resize_event = SDL_TRUE; } @@ -683,6 +711,39 @@ return 1; } +static void +handle_configure_zxdg_decoration(void *data, + struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1, + uint32_t mode) +{ + SDL_Window *window = (SDL_Window *) data; + SDL_WindowData *driverdata = (SDL_WindowData *) window->driverdata; + + /* If the compositor tries to force CSD anyway, bail on direct XDG support + * and fall back to libdecor, it will handle these events from then on. + * + * To do this we have to fully unmap, then map with libdecor loaded. + */ + if (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE) { + if (window->flags & SDL_WINDOW_BORDERLESS) { + /* borderless windows do request CSD, so we got what we wanted */ + return; + } + if (!Wayland_LoadLibdecor(driverdata->waylandData, SDL_TRUE)) { + /* libdecor isn't available, so no borders for you... oh well */ + return; + } + WAYLAND_wl_display_roundtrip(driverdata->waylandData->display); + SDL_HideWindow(window); + driverdata->shell_surface_type = WAYLAND_SURFACE_LIBDECOR; + SDL_ShowWindow(window); + } +} + +static const struct zxdg_toplevel_decoration_v1_listener decoration_listener = { + handle_configure_zxdg_decoration +}; + #ifdef HAVE_LIBDECOR_H static void decoration_frame_configure(struct libdecor_frame *frame, @@ -721,13 +782,6 @@ driverdata = (SDL_WaylandOutputData *) SDL_GetDisplayForWindow(window)->driverdata; if (!fullscreen) { - if (window->flags & SDL_WINDOW_FULLSCREEN) { - /* We might need to re-enter fullscreen after being restored from minimized */ - SetFullscreen(window, driverdata->output, SDL_FALSE); - fullscreen = SDL_TRUE; - floating = SDL_FALSE; - } - /* Always send a maximized/restore event; if the event is redundant it will * automatically be discarded (see src/events/SDL_windowevents.c) * @@ -753,7 +807,7 @@ * Always assume the configure is wrong. */ if (fullscreen) { - if (!NeedFullscreenViewport(window)) { + if (!FullscreenModeEmulation(window)) { /* FIXME: We have been explicitly told to respect the fullscreen size * parameters here, even though they are known to be wrong on GNOME at * bare minimum. If this is wrong, don't blame us, we were explicitly @@ -768,8 +822,6 @@ GetFullScreenDimensions(window, &width, &height, NULL, NULL); } - wind->needs_resize_event = SDL_TRUE; - /* This part is good though. */ if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { scale_factor = driverdata->scale_factor; @@ -892,13 +944,11 @@ new_factor = 0.0f; for (i = 0; i < window->num_outputs; i++) { SDL_WaylandOutputData* driverdata = window->outputs[i]; - if (driverdata->scale_factor > new_factor) { - new_factor = driverdata->scale_factor; - } + new_factor = SDL_max(new_factor, driverdata->scale_factor); } } - if (new_factor != old_factor) { + if (!FloatEqual(new_factor, old_factor)) { Wayland_HandleResize(window->sdlwindow, window->sdlwindow->w, window->sdlwindow->h, new_factor); } } @@ -1164,15 +1214,21 @@ /* Create the shell surface and map the toplevel/popup */ #ifdef HAVE_LIBDECOR_H if (WINDOW_IS_LIBDECOR(c, window)) { - data->shell_surface.libdecor.frame = libdecor_decorate(c->shell.libdecor, - data->surface, - &libdecor_frame_interface, - data); - if (data->shell_surface.libdecor.frame == NULL) { - SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Failed to create libdecor frame!"); - } else { + if (data->shell_surface.libdecor.frame) { + /* If the frame already exists, just set the visibility. */ + libdecor_frame_set_visibility(data->shell_surface.libdecor.frame, true); libdecor_frame_set_app_id(data->shell_surface.libdecor.frame, c->classname); - libdecor_frame_map(data->shell_surface.libdecor.frame); + } else { + data->shell_surface.libdecor.frame = libdecor_decorate(c->shell.libdecor, + data->surface, + &libdecor_frame_interface, + data); + if (data->shell_surface.libdecor.frame == NULL) { + SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Failed to create libdecor frame!"); + } else { + libdecor_frame_set_app_id(data->shell_surface.libdecor.frame, c->classname); + libdecor_frame_map(data->shell_surface.libdecor.frame); + } } } else #endif @@ -1246,8 +1302,7 @@ * libdecor will call this as part of their configure event! * -flibit */ - SDL_WaylandOutputData *odata = SDL_GetDisplayForWindow(window)->driverdata; - SetFullscreen(window, (window->flags & SDL_WINDOW_FULLSCREEN) ? odata->output : NULL, SDL_TRUE); + wl_surface_commit(data->surface); if (data->shell_surface.xdg.surface) { while (!data->shell_surface.xdg.initial_configure_seen) { WAYLAND_wl_display_flush(c->display); @@ -1258,6 +1313,9 @@ /* Create the window decorations */ if (!WINDOW_IS_XDG_POPUP(window) && data->shell_surface.xdg.roleobj.toplevel && c->decoration_manager) { data->server_decoration = zxdg_decoration_manager_v1_get_toplevel_decoration(c->decoration_manager, data->shell_surface.xdg.roleobj.toplevel); + zxdg_toplevel_decoration_v1_add_listener(data->server_decoration, + &decoration_listener, + window); } } else { /* Nothing to see here, just commit. */ @@ -1297,6 +1355,12 @@ unsetenv("XDG_ACTIVATION_TOKEN"); } } + + /* + * Roundtrip required to avoid a possible protocol violation when + * HideWindow was called immediately before ShowWindow. + */ + WAYLAND_wl_display_roundtrip(c->display); } static void @@ -1345,11 +1409,15 @@ wind->server_decoration = NULL; } + /* Be sure to detach after this is done, otherwise ShowWindow crashes! */ + wl_surface_attach(wind->surface, NULL, 0, 0); + wl_surface_commit(wind->surface); + #ifdef HAVE_LIBDECOR_H if (WINDOW_IS_LIBDECOR(data, window)) { if (wind->shell_surface.libdecor.frame) { - libdecor_frame_unref(wind->shell_surface.libdecor.frame); - wind->shell_surface.libdecor.frame = NULL; + libdecor_frame_set_visibility(wind->shell_surface.libdecor.frame, false); + libdecor_frame_set_app_id(wind->shell_surface.libdecor.frame, data->classname); } } else #endif @@ -1366,9 +1434,11 @@ } } - /* Be sure to detach after this is done, otherwise ShowWindow crashes! */ - wl_surface_attach(wind->surface, NULL, 0, 0); - wl_surface_commit(wind->surface); + /* + * Roundtrip required to avoid a possible protocol violation when + * ShowWindow is called immediately after HideWindow. + */ + WAYLAND_wl_display_roundtrip(data->display); } static void @@ -1564,7 +1634,8 @@ SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata; SetFullscreen(window, fullscreen ? output : NULL, SDL_TRUE); - WAYLAND_wl_display_flush(viddata->display); + /* Roundtrip required to receive the updated window dimensions */ + WAYLAND_wl_display_roundtrip(viddata->display); } void @@ -1628,7 +1699,6 @@ Wayland_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable) { #ifdef HAVE_LIBDECOR_H - SDL_VideoData *data = _this->driverdata; const SDL_WindowData *wind = window->driverdata; if (WINDOW_IS_LIBDECOR(data, window)) { @@ -1794,9 +1864,7 @@ int i; for (i=0; i < SDL_GetVideoDevice()->num_displays; i++) { float scale = ((SDL_WaylandOutputData*)SDL_GetVideoDevice()->displays[i].driverdata)->scale_factor; - if (scale > data->scale_factor) { - data->scale_factor = scale; - } + data->scale_factor = SDL_max(data->scale_factor, scale); } } @@ -1818,13 +1886,17 @@ * window isn't visible. */ if (window->flags & SDL_WINDOW_OPENGL) { - data->frame_event_queue = WAYLAND_wl_display_create_queue(data->waylandData->display); - data->frame_surface_wrapper = WAYLAND_wl_proxy_create_wrapper(data->surface); - WAYLAND_wl_proxy_set_queue((struct wl_proxy *)data->frame_surface_wrapper, data->frame_event_queue); - data->frame_callback = wl_surface_frame(data->frame_surface_wrapper); - wl_callback_add_listener(data->frame_callback, &surface_frame_listener, data); + data->gles_swap_frame_event_queue = WAYLAND_wl_display_create_queue(data->waylandData->display); + data->gles_swap_frame_surface_wrapper = WAYLAND_wl_proxy_create_wrapper(data->surface); + WAYLAND_wl_proxy_set_queue((struct wl_proxy *)data->gles_swap_frame_surface_wrapper, data->gles_swap_frame_event_queue); + data->gles_swap_frame_callback = wl_surface_frame(data->gles_swap_frame_surface_wrapper); + wl_callback_add_listener(data->gles_swap_frame_callback, &gles_swap_frame_listener, data); } + /* Fire a callback when the compositor wants a new frame to set the surface damage region. */ + data->surface_damage_frame_callback = wl_surface_frame(data->surface); + wl_callback_add_listener(data->surface_damage_frame_callback, &surface_damage_frame_listener, data); + #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH if (c->surface_extension) { data->extended_surface = qt_surface_extension_get_extended_surface( @@ -1835,8 +1907,8 @@ } #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ - data->drawable_width = window->w * data->scale_factor; - data->drawable_height = window->h * data->scale_factor; + data->drawable_width = SDL_lroundf(window->w * data->scale_factor); + data->drawable_height = SDL_lroundf(window->h * data->scale_factor); if (window->flags & SDL_WINDOW_OPENGL) { data->egl_window = WAYLAND_wl_egl_window_create(data->surface, data->drawable_width, data->drawable_height); @@ -1859,10 +1931,12 @@ } #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ - region = wl_compositor_create_region(c->compositor); - wl_region_add(region, 0, 0, window->w, window->h); - wl_surface_set_opaque_region(data->surface, region); - wl_region_destroy(region); + if (!EGLTransparencyEnabled()) { + region = wl_compositor_create_region(c->compositor); + wl_region_add(region, 0, 0, window->w, window->h); + wl_surface_set_opaque_region(data->surface, region); + wl_region_destroy(region); + } if (c->relative_mouse_mode) { Wayland_input_lock_pointer(c->input); @@ -1874,6 +1948,22 @@ /* We may need to create an idle inhibitor for this new window */ Wayland_SuspendScreenSaver(_this); + #define IS_POPUP(window) \ + (window->flags & (SDL_WINDOW_TOOLTIP | SDL_WINDOW_POPUP_MENU)) +#ifdef HAVE_LIBDECOR_H + if (c->shell.libdecor && !IS_POPUP(window)) { + data->shell_surface_type = WAYLAND_SURFACE_LIBDECOR; + } else +#endif + if (c->shell.xdg) { + if (IS_POPUP(window)) { + data->shell_surface_type = WAYLAND_SURFACE_XDG_POPUP; + } else { + data->shell_surface_type = WAYLAND_SURFACE_XDG_TOPLEVEL; + } + } /* All other cases will be WAYLAND_SURFACE_UNKNOWN */ + #undef IS_POPUP + return 0; } @@ -1883,9 +1973,16 @@ { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; SDL_VideoData *viddata = data->waylandData; - struct wl_region *region; + int old_w = window->w, old_h = window->h; + float old_scale = scale; + + /* Update the window geometry. */ + window->w = width; + window->h = height; + data->scale_factor = scale; + ConfigureWindowGeometry(window); - if (data->needs_resize_event || window->w != width || window->h != height || data->scale_factor != scale) { + if (data->needs_resize_event || old_w != width || old_h != height || !FloatEqual(data->scale_factor, old_scale)) { /* We may have already updated window w/h (or only adjusted scale factor), * so we must override the deduplication logic in the video core */ window->w = 0; @@ -1896,21 +1993,6 @@ data->needs_resize_event = SDL_FALSE; } - /* Configure the backbuffer size and scale factors */ - SetDrawScale(window); - - if (data->egl_window) { - WAYLAND_wl_egl_window_resize(data->egl_window, - data->drawable_width, - data->drawable_height, - 0, 0); - } - - region = wl_compositor_create_region(data->waylandData->compositor); - wl_region_add(region, 0, 0, window->w, window->h); - wl_surface_set_opaque_region(data->surface, region); - wl_region_destroy(region); - /* XXX: This workarounds issues with commiting buffers with old size after * already acknowledging the new size, which can cause protocol violations. * It doesn't fix the first frames after resize being glitched visually, @@ -1925,9 +2007,6 @@ xdg_surface_set_window_geometry(data->shell_surface.xdg.surface, 0, 0, GetWindowWidth(window), GetWindowHeight(window)); } - - /* Update the viewport */ - ConfigureViewport(window); } void @@ -1946,7 +2025,6 @@ { SDL_VideoData *data = _this->driverdata; SDL_WindowData *wind = window->driverdata; - struct wl_region *region; #ifdef HAVE_LIBDECOR_H struct libdecor_state *state; #endif @@ -1962,14 +2040,8 @@ } #endif - SetDrawScale(window); - - if (wind->egl_window) { - WAYLAND_wl_egl_window_resize(wind->egl_window, - wind->drawable_width, - wind->drawable_height, - 0, 0); - } + /* Update the window geometry. */ + ConfigureWindowGeometry(window); #ifdef HAVE_LIBDECOR_H if (WINDOW_IS_LIBDECOR(data, window) && wind->shell_surface.libdecor.frame) { @@ -1983,11 +2055,6 @@ wind->floating_width = window->windowed.w; wind->floating_height = window->windowed.h; - region = wl_compositor_create_region(data->compositor); - wl_region_add(region, 0, 0, window->w, window->h); - wl_surface_set_opaque_region(wind->surface, region); - wl_region_destroy(region); - /* Update the geometry which may have been set by a hack in Wayland_HandleResize */ if ( #ifdef HAVE_LIBDECOR_H @@ -2004,26 +2071,25 @@ { SDL_WindowData *wind = window->driverdata; SDL_VideoData *viddata = _this->driverdata; + const char *title = window->title ? window->title : ""; if (WINDOW_IS_XDG_POPUP(window)) { return; } - if (window->title != NULL) { #ifdef HAVE_LIBDECOR_H - if (WINDOW_IS_LIBDECOR(viddata, window)) { - if (wind->shell_surface.libdecor.frame == NULL) { - return; /* Can't do anything yet, wait for ShowWindow */ - } - libdecor_frame_set_title(wind->shell_surface.libdecor.frame, window->title); - } else + if (WINDOW_IS_LIBDECOR(viddata, window)) { + if (wind->shell_surface.libdecor.frame == NULL) { + return; /* Can't do anything yet, wait for ShowWindow */ + } + libdecor_frame_set_title(wind->shell_surface.libdecor.frame, title); + } else #endif if (viddata->shell.xdg) { - if (wind->shell_surface.xdg.roleobj.toplevel == NULL) { - return; /* Can't do anything yet, wait for ShowWindow */ - } - xdg_toplevel_set_title(wind->shell_surface.xdg.roleobj.toplevel, window->title); + if (wind->shell_surface.xdg.roleobj.toplevel == NULL) { + return; /* Can't do anything yet, wait for ShowWindow */ } + xdg_toplevel_set_title(wind->shell_surface.xdg.roleobj.toplevel, title); } WAYLAND_wl_display_flush(viddata->display); @@ -2090,16 +2156,20 @@ xdg_activation_token_v1_destroy(wind->activation_token); } - if (wind->viewport) { - wp_viewport_destroy(wind->viewport); + if (wind->draw_viewport) { + wp_viewport_destroy(wind->draw_viewport); } SDL_free(wind->outputs); - if (wind->frame_callback) { - WAYLAND_wl_event_queue_destroy(wind->frame_event_queue); - WAYLAND_wl_proxy_wrapper_destroy(wind->frame_surface_wrapper); - wl_callback_destroy(wind->frame_callback); + if (wind->gles_swap_frame_callback) { + WAYLAND_wl_event_queue_destroy(wind->gles_swap_frame_event_queue); + WAYLAND_wl_proxy_wrapper_destroy(wind->gles_swap_frame_surface_wrapper); + wl_callback_destroy(wind->gles_swap_frame_callback); + } + + if (wind->surface_damage_frame_callback) { + wl_callback_destroy(wind->surface_damage_frame_callback); } #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH diff -Nru libsdl2-2.0.22+dfsg/src/video/wayland/SDL_waylandwindow.h libsdl2-2.24.0+dfsg/src/video/wayland/SDL_waylandwindow.h --- libsdl2-2.0.22+dfsg/src/video/wayland/SDL_waylandwindow.h 2022-04-21 17:37:37.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/wayland/SDL_waylandwindow.h 2022-08-19 15:46:21.000000000 +0000 @@ -32,46 +32,49 @@ struct SDL_WaylandInput; -typedef struct { - struct xdg_surface *surface; - union { - struct xdg_toplevel *toplevel; - struct { - struct xdg_popup *popup; - struct xdg_positioner *positioner; - Uint32 parentID; - SDL_Window *child; - } popup; - } roleobj; - SDL_bool initial_configure_seen; -} SDL_xdg_shell_surface; - +/* TODO: Remove these helpers, they're from before we had shell_surface_type */ #define WINDOW_IS_XDG_POPUP(window) \ - (window->flags & (SDL_WINDOW_TOOLTIP | SDL_WINDOW_POPUP_MENU)) - -#ifdef HAVE_LIBDECOR_H -typedef struct { - struct libdecor_frame *frame; - SDL_bool initial_configure_seen; -} SDL_libdecor_surface; - -#define WINDOW_IS_LIBDECOR(viddata, window) \ - (viddata->shell.libdecor && !WINDOW_IS_XDG_POPUP(window)) -#endif + (((SDL_WindowData*) window->driverdata)->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP) +#define WINDOW_IS_LIBDECOR(ignoreme, window) \ + (((SDL_WindowData*) window->driverdata)->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) typedef struct { SDL_Window *sdlwindow; SDL_VideoData *waylandData; struct wl_surface *surface; - struct wl_callback *frame_callback; - struct wl_event_queue *frame_event_queue; - struct wl_surface *frame_surface_wrapper; + struct wl_callback *gles_swap_frame_callback; + struct wl_event_queue *gles_swap_frame_event_queue; + struct wl_surface *gles_swap_frame_surface_wrapper; + struct wl_callback *surface_damage_frame_callback; + union { #ifdef HAVE_LIBDECOR_H - SDL_libdecor_surface libdecor; + struct { + struct libdecor_frame *frame; + SDL_bool initial_configure_seen; + } libdecor; #endif - SDL_xdg_shell_surface xdg; + struct { + struct xdg_surface *surface; + union { + struct xdg_toplevel *toplevel; + struct { + struct xdg_popup *popup; + struct xdg_positioner *positioner; + Uint32 parentID; + SDL_Window *child; + } popup; + } roleobj; + SDL_bool initial_configure_seen; + } xdg; } shell_surface; + enum { + WAYLAND_SURFACE_UNKNOWN = 0, + WAYLAND_SURFACE_XDG_TOPLEVEL, + WAYLAND_SURFACE_XDG_POPUP, + WAYLAND_SURFACE_LIBDECOR + } shell_surface_type; + struct wl_egl_window *egl_window; struct SDL_WaylandInput *keyboard_device; #if SDL_VIDEO_OPENGL_EGL @@ -83,7 +86,7 @@ struct zwp_keyboard_shortcuts_inhibitor_v1 *key_inhibitor; struct zwp_idle_inhibitor_v1 *idle_inhibitor; struct xdg_activation_token_v1 *activation_token; - struct wp_viewport *viewport; + struct wp_viewport *draw_viewport; /* floating dimensions for restoring from maximized and fullscreen */ int floating_width, floating_height; @@ -101,7 +104,7 @@ float pointer_scale_x; float pointer_scale_y; int drawable_width, drawable_height; - SDL_Rect damage_region; + SDL_Rect viewport_rect; SDL_bool needs_resize_event; SDL_bool floating_resize_pending; } SDL_WindowData; diff -Nru libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowsclipboard.c libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowsclipboard.c --- libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowsclipboard.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowsclipboard.c 2022-08-13 03:48:10.000000000 +0000 @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS +#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #include "SDL_windowsvideo.h" #include "SDL_windowswindow.h" diff -Nru libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowsevents.c libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowsevents.c --- libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowsevents.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowsevents.c 2022-08-13 03:48:10.000000000 +0000 @@ -29,10 +29,12 @@ #include "SDL_timer.h" #include "SDL_vkeys.h" #include "SDL_hints.h" +#include "SDL_main.h" #include "../../events/SDL_events_c.h" #include "../../events/SDL_touch_c.h" #include "../../events/scancodes_windows.h" #include "SDL_hints.h" +#include "SDL_log.h" /* Dropfile support */ #include @@ -51,6 +53,12 @@ #include "wmmsg.h" #endif +#ifdef __GDK__ +#include "../../core/gdk/SDL_gdk.h" +#endif + +/* #define HIGHDPI_DEBUG */ + /* Masks for processing the windows KEYDOWN and KEYUP messages */ #define REPEATED_KEYMASK (1<<30) #define EXTENDED_KEYMASK (1<<24) @@ -85,6 +93,12 @@ #ifndef WM_UNICHAR #define WM_UNICHAR 0x0109 #endif +#ifndef WM_DPICHANGED +#define WM_DPICHANGED 0x02E0 +#endif +#ifndef WM_GETDPISCALEDSIZE +#define WM_GETDPISCALEDSIZE 0x02E4 +#endif #ifndef IS_HIGH_SURROGATE #define IS_HIGH_SURROGATE(x) (((x) >= 0xd800) && ((x) <= 0xdbff)) @@ -251,6 +265,7 @@ return code; } +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) static SDL_bool WIN_ShouldIgnoreFocusClick() { @@ -436,6 +451,10 @@ data->in_window_deactivation = SDL_TRUE; SDL_SetKeyboardFocus(NULL); + /* In relative mode we are guaranteed to not have mouse focus if we don't have keyboard focus */ + if (SDL_GetMouse()->relative_mode) { + SDL_SetMouseFocus(NULL); + } WIN_ResetDeadKeys(); if (GetClipCursor(&rect) && SDL_memcmp(&rect, &data->cursor_clipped_rect, sizeof(rect)) == 0) { @@ -446,6 +465,7 @@ data->in_window_deactivation = SDL_FALSE; } } +#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ static BOOL WIN_ConvertUTF32toUTF8(UINT32 codepoint, char * text) @@ -488,6 +508,7 @@ return !SDL_GetHintBoolean(SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4, SDL_FALSE); } +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) /* We want to generate mouse events from mouse and pen, and touch events from touchscreens */ #define MI_WP_SIGNATURE 0xFF515700 #define MI_WP_SIGNATURE_MASK 0xFFFFFF00 @@ -518,6 +539,7 @@ } return SDL_MOUSE_EVENT_SOURCE_MOUSE; } +#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ static SDL_WindowData * WIN_GetWindowDataFromHWND(HWND hwnd) @@ -536,6 +558,7 @@ return NULL; } +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) LRESULT CALLBACK WIN_KeyboardHookProc(int nCode, WPARAM wParam, LPARAM lParam) { @@ -598,29 +621,7 @@ return 1; } -static void WIN_CheckICMProfileChanged(SDL_Window* window) -{ - SDL_VideoDisplay* display = SDL_GetDisplayForWindow(window); - SDL_DisplayData* data = (SDL_DisplayData*)display->driverdata; - static WCHAR currentIcmFileName[MAX_PATH] = { '\0' }; - WCHAR icmFileName[MAX_PATH]; - HDC hdc; - SDL_bool succeeded; - DWORD fileNameSize = MAX_PATH; - - hdc = CreateDCW(data->DeviceName, NULL, NULL, NULL); - if (hdc) { - succeeded = GetICMProfileW(hdc, &fileNameSize, icmFileName); - DeleteDC(hdc); - if (succeeded) { - - if (SDL_wcsncmp(currentIcmFileName, icmFileName, fileNameSize)) { - SDL_wcslcpy(currentIcmFileName, icmFileName, fileNameSize); - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_ICCPROF_CHANGED, 0, 0); - } - } - } -} +#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) @@ -643,10 +644,12 @@ /* Get the window data for the window */ data = WIN_GetWindowDataFromHWND(hwnd); +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) if (!data) { /* Fallback */ data = (SDL_WindowData *) GetProp(hwnd, TEXT("SDL_WindowData")); } +#endif if (!data) { return CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam); } @@ -655,16 +658,18 @@ { char message[1024]; if (msg > MAX_WMMSG) { - SDL_snprintf(message, sizeof(message), "Received windows message: %p UNKNOWN (%d) -- 0x%X, 0x%X\n", hwnd, msg, wParam, lParam); + SDL_snprintf(message, sizeof(message), "Received windows message: %p UNKNOWN (%d) -- 0x%p, 0x%p\n", hwnd, msg, wParam, lParam); } else { - SDL_snprintf(message, sizeof(message), "Received windows message: %p %s -- 0x%X, 0x%X\n", hwnd, wmtab[msg], wParam, lParam); + SDL_snprintf(message, sizeof(message), "Received windows message: %p %s -- 0x%p, 0x%p\n", hwnd, wmtab[msg], wParam, lParam); } OutputDebugStringA(message); } #endif /* WMMSG_DEBUG */ +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) if (IME_HandleMessage(hwnd, msg, wParam, &lParam, data->videodata)) return 0; +#endif switch (msg) { @@ -678,6 +683,7 @@ } break; +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) case WM_NCACTIVATE: { /* Don't immediately clip the cursor in case we're clicking minimize/maximize buttons */ @@ -687,7 +693,7 @@ actually being the foreground window, but this appears to get called in all cases where the global foreground window changes to and from this window. */ WIN_UpdateFocus(data->window, !!wParam); - WIN_CheckICMProfileChanged(data->window); + WIN_UpdateWindowICCProfile(data->window, SDL_TRUE); } break; @@ -739,7 +745,12 @@ /* Only generate mouse events for real mouse */ if (GetMouseMessageSource() != SDL_MOUSE_EVENT_SOURCE_TOUCH && lParam != data->last_pointer_update) { - SDL_SendMouseMotion(data->window, 0, 0, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); + int x = GET_X_LPARAM(lParam); + int y = GET_Y_LPARAM(lParam); + + WIN_ClientPointToSDL(data->window, &x, &y); + + SDL_SendMouseMotion(data->window, 0, 0, x, y); } } } @@ -913,8 +924,10 @@ } } - /* When WM_MOUSELEAVE is fired we can be assured that the cursor has left the window */ - SDL_SetMouseFocus(NULL); + if (!SDL_GetMouse()->relative_mode) { + /* When WM_MOUSELEAVE is fired we can be assured that the cursor has left the window */ + SDL_SetMouseFocus(NULL); + } } /* Once we get WM_MOUSELEAVE we're guaranteed that the window is no longer tracked */ @@ -922,6 +935,7 @@ returnCode = 0; break; +#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ case WM_KEYDOWN: case WM_SYSKEYDOWN: @@ -1003,11 +1017,11 @@ returnCode = 0; break; +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #ifdef WM_INPUTLANGCHANGE case WM_INPUTLANGCHANGE: { - WIN_UpdateKeymap(); - SDL_SendKeymapChangedEvent(); + WIN_UpdateKeymap(SDL_TRUE); } returnCode = 1; break; @@ -1058,6 +1072,12 @@ SDL_GetWindowMinimumSize(data->window, &min_w, &min_h); SDL_GetWindowMaximumSize(data->window, &max_w, &max_h); + /* Convert w, h, min_w, min_h, max_w, max_h from dpi-scaled points to pixels, + treating them as coordinates within the client area. */ + WIN_ClientPointFromSDL(data->window, &w, &h); + WIN_ClientPointFromSDL(data->window, &min_w, &min_h); + WIN_ClientPointFromSDL(data->window, &max_w, &max_h); + /* Store in min_w and min_h difference between current size and minimal size so we don't need to call AdjustWindowRectEx twice */ min_w -= w; @@ -1078,14 +1098,25 @@ inside their function, so I have to do it here. */ BOOL menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); + UINT dpi; + + dpi = 96; size.top = 0; size.left = 0; size.bottom = h; size.right = w; - AdjustWindowRectEx(&size, style, menu, 0); + if (WIN_IsPerMonitorV2DPIAware(SDL_GetVideoDevice())) { + dpi = data->videodata->GetDpiForWindow(hwnd); + data->videodata->AdjustWindowRectExForDpi(&size, style, menu, 0, dpi); + } else { + AdjustWindowRectEx(&size, style, menu, 0); + } w = size.right - size.left; h = size.bottom - size.top; +#ifdef HIGHDPI_DEBUG + SDL_Log("WM_GETMINMAXINFO: max window size: %dx%d using dpi: %u", w, h, dpi); +#endif } /* Fix our size to the current size */ @@ -1137,6 +1168,11 @@ break; } + /* When the window is minimized it's resized to the dock icon size, ignore this */ + if ((data->window->flags & SDL_WINDOW_MINIMIZED) != 0) { + break; + } + if (!GetClientRect(hwnd, &rect) || IsRectEmpty(&rect)) { break; } @@ -1147,16 +1183,27 @@ x = rect.left; y = rect.top; + WIN_ScreenPointToSDL(&x, &y); + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MOVED, x, y); + /* Convert client area width/height from pixels to dpi-scaled points */ w = rect.right - rect.left; h = rect.bottom - rect.top; + WIN_ClientPointToSDL(data->window, &w, &h); + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESIZED, w, h); +#ifdef HIGHDPI_DEBUG + SDL_Log("WM_WINDOWPOSCHANGED: Windows client rect (pixels): (%d, %d) (%d x %d)\tSDL client rect (points): (%d, %d) (%d x %d) cached dpi %d, windows reported dpi %d", + rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, + x, y, w, h, data->scaling_dpi, data->videodata->GetDpiForWindow ? data->videodata->GetDpiForWindow(data->hwnd) : 0); +#endif + /* Forces a WM_PAINT event */ InvalidateRect(hwnd, NULL, FALSE); - WIN_CheckICMProfileChanged(data->window); + WIN_UpdateWindowICCProfile(data->window, SDL_TRUE); } break; @@ -1358,6 +1405,7 @@ NCCALCSIZE_PARAMS *params = (NCCALCSIZE_PARAMS *)lParam; w = data->window->windowed.w; h = data->window->windowed.h; + WIN_ClientPointFromSDL(data->window, &w, &h); params->rgrc[0].right = params->rgrc[0].left + w; params->rgrc[0].bottom = params->rgrc[0].top + h; } @@ -1370,10 +1418,16 @@ { SDL_Window *window = data->window; if (window->hit_test) { - POINT winpoint = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; + POINT winpoint; + winpoint.x = GET_X_LPARAM(lParam); + winpoint.y = GET_Y_LPARAM(lParam); if (ScreenToClient(hwnd, &winpoint)) { - const SDL_Point point = { (int) winpoint.x, (int) winpoint.y }; - const SDL_HitTestResult rc = window->hit_test(window, &point, window->hit_test_data); + SDL_Point point; + SDL_HitTestResult rc; + point.x = winpoint.x; + point.y = winpoint.y; + WIN_ClientPointToSDL(data->window, &point.x, &point.y); + rc = window->hit_test(window, &point, window->hit_test_data); switch (rc) { #define POST_HIT_TEST(ret) { SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_HIT_TEST, 0, 0); return ret; } case SDL_HITTEST_DRAGGABLE: POST_HIT_TEST(HTCAPTION); @@ -1393,6 +1447,188 @@ } } break; + + case WM_GETDPISCALEDSIZE: + /* Windows 10 Creators Update+ */ + /* Documented as only being sent to windows that are per-monitor V2 DPI aware. + + Experimentation shows it's only sent during interactive dragging, not in response to + SetWindowPos. */ + if (data->videodata->GetDpiForWindow && data->videodata->AdjustWindowRectExForDpi) { + /* Windows expects applications to scale their window rects linearly + when dragging between monitors with different DPI's. + e.g. a 100x100 window dragged to a 200% scaled monitor + becomes 200x200. + + For SDL, we instead want the client size to scale linearly. + This is not the same as the window rect scaling linearly, + because Windows doesn't scale the non-client area (titlebar etc.) + linearly. So, we need to handle this message to request custom + scaling. */ + + const int nextDPI = (int)wParam; + const int prevDPI = (int)data->videodata->GetDpiForWindow(hwnd); + SIZE *sizeInOut = (SIZE *)lParam; + + int frame_w, frame_h; + int query_client_w_win, query_client_h_win; + + const DWORD style = GetWindowLong(hwnd, GWL_STYLE); + const BOOL menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); + +#ifdef HIGHDPI_DEBUG + SDL_Log("WM_GETDPISCALEDSIZE: current DPI: %d potential DPI: %d input size: (%dx%d)", + prevDPI, nextDPI, sizeInOut->cx, sizeInOut->cy); +#endif + + /* Subtract the window frame size that would have been used at prevDPI */ + { + RECT rect = {0}; + + if (!(data->window->flags & SDL_WINDOW_BORDERLESS)) { + data->videodata->AdjustWindowRectExForDpi(&rect, style, menu, 0, prevDPI); + } + + frame_w = -rect.left + rect.right; + frame_h = -rect.top + rect.bottom; + + query_client_w_win = sizeInOut->cx - frame_w; + query_client_h_win = sizeInOut->cy - frame_h; + } + + /* Convert to new dpi if we are using scaling. + * Otherwise leave as pixels. + */ + if (data->videodata->dpi_scaling_enabled) { + query_client_w_win = MulDiv(query_client_w_win, nextDPI, prevDPI); + query_client_h_win = MulDiv(query_client_h_win, nextDPI, prevDPI); + } + + /* Add the window frame size that would be used at nextDPI */ + { + RECT rect = {0}; + rect.right = query_client_w_win; + rect.bottom = query_client_h_win; + + if (!(data->window->flags & SDL_WINDOW_BORDERLESS)) { + data->videodata->AdjustWindowRectExForDpi(&rect, style, menu, 0, nextDPI); + } + + /* This is supposed to control the suggested rect param of WM_DPICHANGED */ + sizeInOut->cx = rect.right - rect.left; + sizeInOut->cy = rect.bottom - rect.top; + } + +#ifdef HIGHDPI_DEBUG + SDL_Log("WM_GETDPISCALEDSIZE: output size: (%dx%d)", sizeInOut->cx, sizeInOut->cy); +#endif + return TRUE; + } + break; + + case WM_DPICHANGED: + /* Windows 8.1+ */ + { + const int newDPI = HIWORD(wParam); + RECT* const suggestedRect = (RECT*)lParam; + int w, h; + +#ifdef HIGHDPI_DEBUG + SDL_Log("WM_DPICHANGED: to %d\tsuggested rect: (%d, %d), (%dx%d)\n", newDPI, + suggestedRect->left, suggestedRect->top, suggestedRect->right - suggestedRect->left, suggestedRect->bottom - suggestedRect->top); +#endif + + if (data->expected_resize) { + /* This DPI change is coming from an explicit SetWindowPos call within SDL. + Assume all call sites are calculating the DPI-aware frame correctly, so + we don't need to do any further adjustment. */ + + if (data->videodata->dpi_scaling_enabled) { + /* Update the cached DPI value for this window */ + data->scaling_dpi = newDPI; + + /* Send a SDL_WINDOWEVENT_SIZE_CHANGED saying that the client size (in dpi-scaled points) is unchanged. + Renderers need to get this to know that the framebuffer size changed. + + We clear the window size to force the event to be delivered, but what we really + want for SDL3 is a new event to notify that the DPI changed and then watch for + that in the renderer directly. + */ + data->window->w = 0; + data->window->h = 0; + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SIZE_CHANGED, data->window->w, data->window->h); + } + +#ifdef HIGHDPI_DEBUG + SDL_Log("WM_DPICHANGED: Doing nothing, assuming window is already sized correctly"); +#endif + return 0; + } + + /* Interactive user-initiated resizing/movement */ + + if (WIN_IsPerMonitorV2DPIAware(SDL_GetVideoDevice())) { + /* WM_GETDPISCALEDSIZE should have been called prior, so we can trust the given + suggestedRect. */ + w = suggestedRect->right - suggestedRect->left; + h = suggestedRect->bottom - suggestedRect->top; + +#ifdef HIGHDPI_DEBUG + SDL_Log("WM_DPICHANGED: using suggestedRect"); +#endif + } else { + /* permonitor and earlier DPI awareness: calculate the new frame w/h such that + the client area size is maintained. */ + const DWORD style = GetWindowLong(hwnd, GWL_STYLE); + const BOOL menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); + + RECT rect = {0}; + rect.right = data->window->w; + rect.bottom = data->window->h; + + if (data->videodata->dpi_scaling_enabled) { + /* scale client size to from points to the new DPI */ + rect.right = MulDiv(rect.right, newDPI, 96); + rect.bottom = MulDiv(rect.bottom, newDPI, 96); + } + + if (!(data->window->flags & SDL_WINDOW_BORDERLESS)) { + AdjustWindowRectEx(&rect, style, menu, 0); + } + + w = rect.right - rect.left; + h = rect.bottom - rect.top; + } + +#ifdef HIGHDPI_DEBUG + SDL_Log("WM_DPICHANGED: current SDL window size: (%dx%d)\tcalling SetWindowPos: (%d, %d), (%dx%d)\n", + data->window->w, data->window->h, + suggestedRect->left, suggestedRect->top, w, h); +#endif + + data->expected_resize = SDL_TRUE; + SetWindowPos(hwnd, + NULL, + suggestedRect->left, + suggestedRect->top, + w, + h, + SWP_NOZORDER | SWP_NOACTIVATE); + data->expected_resize = SDL_FALSE; + + if (data->videodata->dpi_scaling_enabled) { + /* Update the cached DPI value for this window */ + data->scaling_dpi = newDPI; + + /* Send a SDL_WINDOWEVENT_SIZE_CHANGED saying that the client size (in dpi-scaled points) is unchanged. + Renderers need to get this to know that the framebuffer size changed. */ + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SIZE_CHANGED, data->window->w, data->window->h); + } + + return 0; + } + break; +#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ } /* If there's a window proc, assume it's going to handle messages */ @@ -1405,6 +1641,7 @@ } } +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) static void WIN_UpdateClipCursorForWindows() { SDL_VideoDevice *_this = SDL_GetVideoDevice(); @@ -1451,6 +1688,7 @@ } } } +#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ /* A message hook called before TranslateMessage() */ static SDL_WindowsMessageHook g_WindowsMessageHook = NULL; @@ -1508,11 +1746,13 @@ void WIN_PumpEvents(_THIS) { - const Uint8 *keystate; MSG msg; DWORD end_ticks = GetTickCount() + 1; int new_messages = 0; +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) + const Uint8 *keystate; SDL_Window *focusWindow; +#endif if (g_WindowsEnableMessageLoop) { while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { @@ -1520,6 +1760,7 @@ g_WindowsMessageHook(g_WindowsMessageHookData, msg.hwnd, msg.message, msg.wParam, msg.lParam); } +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) /* Don't dispatch any mouse motion queued prior to or including the last mouse warp */ if (msg.message == WM_MOUSEMOVE && SDL_last_warp_time) { if (!SDL_TICKS_PASSED(msg.time, (SDL_last_warp_time + 1))) { @@ -1529,6 +1770,7 @@ /* This mouse message happened after the warp */ SDL_last_warp_time = 0; } +#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ /* Always translate the message in case it's a non-SDL window (e.g. with Qt integration) */ TranslateMessage(&msg); @@ -1549,6 +1791,7 @@ } } +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) /* Windows loses a shift KEYUP event when you have both pressed at once and let go of one. You won't get a KEYUP until both are released, and that keyup will only be for the second key you released. Take heroic measures and check the keystate as of the last handled event, @@ -1579,6 +1822,11 @@ /* Update mouse capture */ WIN_UpdateMouseCapture(); +#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ + +#ifdef __GDK__ + GDK_DispatchTaskQueue(); +#endif } @@ -1589,8 +1837,10 @@ static void WIN_CleanRegisterApp(WNDCLASSEX wcex) { +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) if (wcex.hIcon) DestroyIcon(wcex.hIcon); if (wcex.hIconSm) DestroyIcon(wcex.hIconSm); +#endif SDL_free(SDL_Appname); SDL_Appname = NULL; } @@ -1599,9 +1849,11 @@ int SDL_RegisterApp(const char *name, Uint32 style, void *hInst) { - const char *hint; WNDCLASSEX wcex; +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) + const char *hint; TCHAR path[MAX_PATH]; +#endif /* Only do this once... */ if (app_registered) { @@ -1633,6 +1885,7 @@ wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) hint = SDL_GetHint(SDL_HINT_WINDOWS_INTRESOURCE_ICON); if (hint && *hint) { wcex.hIcon = LoadIcon(SDL_Instance, MAKEINTRESOURCE(SDL_atoi(hint))); @@ -1646,6 +1899,7 @@ GetModuleFileName(SDL_Instance, path, MAX_PATH); ExtractIconEx(path, 0, &wcex.hIcon, &wcex.hIconSm, 1); } +#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ if (!RegisterClassEx(&wcex)) { WIN_CleanRegisterApp(wcex); @@ -1672,9 +1926,11 @@ wcex.hIcon = NULL; wcex.hIconSm = NULL; /* Check for any registered window classes. */ +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) if (GetClassInfoEx(SDL_Instance, SDL_Appname, &wcex)) { UnregisterClass(SDL_Appname, SDL_Instance); } +#endif WIN_CleanRegisterApp(wcex); } } diff -Nru libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowsframebuffer.c libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowsframebuffer.c --- libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowsframebuffer.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowsframebuffer.c 2022-08-13 03:48:10.000000000 +0000 @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS +#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #include "SDL_windowsvideo.h" diff -Nru libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowskeyboard.c libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowskeyboard.c --- libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowskeyboard.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowskeyboard.c 2022-08-13 03:48:10.000000000 +0000 @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS +#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #include "SDL_windowsvideo.h" #include "SDL_hints.h" @@ -65,7 +65,7 @@ data->ime_hwnd_current = 0; data->ime_himc = 0; data->ime_composition_length = 32 * sizeof(WCHAR); - data->ime_composition = (WCHAR*)SDL_malloc(data->ime_composition_length); + data->ime_composition = (WCHAR*)SDL_malloc(data->ime_composition_length + sizeof(WCHAR)); data->ime_composition[0] = 0; data->ime_readingstring[0] = 0; data->ime_cursor = 0; @@ -102,7 +102,7 @@ data->ime_uielemsink = 0; data->ime_ippasink = 0; - WIN_UpdateKeymap(); + WIN_UpdateKeymap(SDL_FALSE); SDL_SetScancodeName(SDL_SCANCODE_APPLICATION, "Menu"); SDL_SetScancodeName(SDL_SCANCODE_LGUI, "Left Windows"); @@ -115,7 +115,7 @@ } void -WIN_UpdateKeymap() +WIN_UpdateKeymap(SDL_bool send_event) { int i; SDL_Scancode scancode; @@ -152,15 +152,22 @@ } } - SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES); + SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES, send_event); } void WIN_QuitKeyboard(_THIS) { + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + #ifndef SDL_DISABLE_WINDOWS_IME - IME_Quit((SDL_VideoData *)_this->driverdata); + IME_Quit(data); #endif + + if (data->ime_composition) { + SDL_free(data->ime_composition); + data->ime_composition = NULL; + } } void @@ -235,7 +242,7 @@ } void -WIN_SetTextInputRect(_THIS, SDL_Rect *rect) +WIN_SetTextInputRect(_THIS, const SDL_Rect *rect) { SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata; HIMC himc = 0; @@ -623,7 +630,7 @@ dwRet[0] = dwRet[1] = 0; return dwRet[0]; } - if (ImmGetIMEFileNameA(hkl, szTemp, sizeof(szTemp) - 1) <= 0) { + if (!ImmGetIMEFileNameA(hkl, szTemp, sizeof(szTemp) - 1)) { dwRet[0] = dwRet[1] = 0; return dwRet[0]; } @@ -689,7 +696,7 @@ return; hkl = videodata->ime_hkl; - if (ImmGetIMEFileNameA(hkl, ime_file, sizeof(ime_file) - 1) <= 0) + if (!ImmGetIMEFileNameA(hkl, ime_file, sizeof(ime_file) - 1)) return; hime = SDL_LoadObject(ime_file); @@ -813,7 +820,7 @@ length = ImmGetCompositionStringW(himc, GCS_COMPATTR, NULL, 0); if (length > 0) { - Uint8* attributes = (Uint8*)SDL_malloc(length); + Uint8* attributes = (Uint8*)SDL_malloc(length + sizeof(WCHAR)); ImmGetCompositionString(himc, GCS_COMPATTR, attributes, length); for (start = 0; start < length; ++start) { @@ -863,7 +870,7 @@ size_t len = SDL_min(SDL_wcslen(videodata->ime_composition), (size_t)videodata->ime_cursor); size += sizeof(videodata->ime_readingstring); - buffer = (WCHAR*)SDL_malloc(size); + buffer = (WCHAR*)SDL_malloc(size + sizeof(WCHAR)); buffer[0] = 0; SDL_wcslcpy(buffer, videodata->ime_composition, len + 1); @@ -871,7 +878,7 @@ SDL_wcslcat(buffer, &videodata->ime_composition[len], size); } else { - buffer = (WCHAR*)SDL_malloc(size); + buffer = (WCHAR*)SDL_malloc(size + sizeof(WCHAR)); buffer[0] = 0; SDL_wcslcpy(buffer, videodata->ime_composition, size); } diff -Nru libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowskeyboard.h libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowskeyboard.h --- libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowskeyboard.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowskeyboard.h 2022-08-13 03:48:10.000000000 +0000 @@ -24,14 +24,14 @@ #define SDL_windowskeyboard_h_ extern void WIN_InitKeyboard(_THIS); -extern void WIN_UpdateKeymap(void); +extern void WIN_UpdateKeymap(SDL_bool send_event); extern void WIN_QuitKeyboard(_THIS); extern void WIN_ResetDeadKeys(void); extern void WIN_StartTextInput(_THIS); extern void WIN_StopTextInput(_THIS); -extern void WIN_SetTextInputRect(_THIS, SDL_Rect *rect); +extern void WIN_SetTextInputRect(_THIS, const SDL_Rect *rect); extern void WIN_ClearComposition(_THIS); extern SDL_bool WIN_IsTextInputShown(_THIS); diff -Nru libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowsmessagebox.c libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowsmessagebox.c --- libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowsmessagebox.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowsmessagebox.c 2022-08-13 03:48:10.000000000 +0000 @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS +#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #ifdef HAVE_LIMITS_H #include diff -Nru libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowsmodes.c libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowsmodes.c --- libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowsmodes.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowsmodes.c 2022-08-13 03:48:10.000000000 +0000 @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS +#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #include "SDL_windowsvideo.h" #include "../../events/SDL_displayevents_c.h" @@ -31,6 +31,7 @@ #endif /* #define DEBUG_MODES */ +/* #define HIGHDPI_DEBUG_VERBOSE */ static void WIN_UpdateDisplayMode(_THIS, LPCWSTR deviceName, DWORD index, SDL_DisplayMode * mode) @@ -50,6 +51,15 @@ int logical_width = GetDeviceCaps( hdc, HORZRES ); int logical_height = GetDeviceCaps( hdc, VERTRES ); + /* High-DPI notes: + + If DPI-unaware: + - GetDeviceCaps( hdc, HORZRES ) will return the monitor width in points. + - DeviceMode.dmPelsWidth is actual pixels (unlike almost all other Windows API's, + it's not virtualized when DPI unaware). + + If DPI-aware: + - GetDeviceCaps( hdc, HORZRES ) will return pixels, same as DeviceMode.dmPelsWidth */ mode->w = logical_width; mode->h = logical_height; @@ -186,6 +196,105 @@ return SDL_TRUE; } +/* The win32 API calls in this function require Windows Vista or later. */ +typedef LONG (WINAPI *SDL_WIN32PROC_GetDisplayConfigBufferSizes)(UINT32 flags, UINT32* numPathArrayElements, UINT32* numModeInfoArrayElements); +typedef LONG (WINAPI *SDL_WIN32PROC_QueryDisplayConfig)(UINT32 flags, UINT32* numPathArrayElements, DISPLAYCONFIG_PATH_INFO* pathArray, UINT32* numModeInfoArrayElements, DISPLAYCONFIG_MODE_INFO* modeInfoArray, DISPLAYCONFIG_TOPOLOGY_ID* currentTopologyId); +typedef LONG (WINAPI *SDL_WIN32PROC_DisplayConfigGetDeviceInfo)(DISPLAYCONFIG_DEVICE_INFO_HEADER* requestPacket); + +static char * +WIN_GetDisplayNameVista(const WCHAR *deviceName) +{ + void *dll; + SDL_WIN32PROC_GetDisplayConfigBufferSizes pGetDisplayConfigBufferSizes; + SDL_WIN32PROC_QueryDisplayConfig pQueryDisplayConfig; + SDL_WIN32PROC_DisplayConfigGetDeviceInfo pDisplayConfigGetDeviceInfo; + DISPLAYCONFIG_PATH_INFO *paths = NULL; + DISPLAYCONFIG_MODE_INFO *modes = NULL; + char *retval = NULL; + UINT32 pathCount = 0; + UINT32 modeCount = 0; + UINT32 i; + LONG rc; + + dll = SDL_LoadObject("USER32.DLL"); + if (!dll) { + return NULL; + } + + pGetDisplayConfigBufferSizes = (SDL_WIN32PROC_GetDisplayConfigBufferSizes) SDL_LoadFunction(dll, "GetDisplayConfigBufferSizes"); + pQueryDisplayConfig = (SDL_WIN32PROC_QueryDisplayConfig) SDL_LoadFunction(dll, "QueryDisplayConfig"); + pDisplayConfigGetDeviceInfo = (SDL_WIN32PROC_DisplayConfigGetDeviceInfo) SDL_LoadFunction(dll, "DisplayConfigGetDeviceInfo"); + + if (!pGetDisplayConfigBufferSizes || !pQueryDisplayConfig || !pDisplayConfigGetDeviceInfo) { + goto WIN_GetDisplayNameVista_failed; + } + + do { + rc = pGetDisplayConfigBufferSizes(QDC_ONLY_ACTIVE_PATHS, &pathCount, &modeCount); + if (rc != ERROR_SUCCESS) { + goto WIN_GetDisplayNameVista_failed; + } + + SDL_free(paths); + SDL_free(modes); + + paths = (DISPLAYCONFIG_PATH_INFO *) SDL_malloc(sizeof (DISPLAYCONFIG_PATH_INFO) * pathCount); + modes = (DISPLAYCONFIG_MODE_INFO *) SDL_malloc(sizeof (DISPLAYCONFIG_MODE_INFO) * modeCount); + if ((paths == NULL) || (modes == NULL)) { + goto WIN_GetDisplayNameVista_failed; + } + + rc = pQueryDisplayConfig(QDC_ONLY_ACTIVE_PATHS, &pathCount, paths, &modeCount, modes, 0); + } while (rc == ERROR_INSUFFICIENT_BUFFER); + + if (rc == ERROR_SUCCESS) { + for (i = 0; i < pathCount; i++) { + DISPLAYCONFIG_SOURCE_DEVICE_NAME sourceName; + DISPLAYCONFIG_TARGET_DEVICE_NAME targetName; + + SDL_zero(sourceName); + sourceName.header.adapterId = paths[i].targetInfo.adapterId; + sourceName.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME; + sourceName.header.size = sizeof (sourceName); + rc = pDisplayConfigGetDeviceInfo(&sourceName.header); + if (rc != ERROR_SUCCESS) { + break; + } else if (SDL_wcscmp(deviceName, sourceName.viewGdiDeviceName) != 0) { + continue; + } + + SDL_zero(targetName); + targetName.header.adapterId = paths[i].targetInfo.adapterId; + targetName.header.id = paths[i].targetInfo.id; + targetName.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME; + targetName.header.size = sizeof (targetName); + rc = pDisplayConfigGetDeviceInfo(&targetName.header); + if (rc == ERROR_SUCCESS) { + retval = WIN_StringToUTF8W(targetName.monitorFriendlyDeviceName); + /* if we got an empty string, treat it as failure so we'll fallback + to getting the generic name. */ + if (retval && (*retval == '\0')) { + SDL_free(retval); + retval = NULL; + } + } + break; + } + } + + SDL_free(paths); + SDL_free(modes); + SDL_UnloadObject(dll); + return retval; + +WIN_GetDisplayNameVista_failed: + SDL_free(retval); + SDL_free(paths); + SDL_free(modes); + SDL_UnloadObject(dll); + return NULL; +} + static SDL_bool WIN_AddDisplay(_THIS, HMONITOR hMonitor, const MONITORINFOEXW *info, SDL_bool send_event) { @@ -194,7 +303,6 @@ SDL_DisplayData *displaydata; SDL_DisplayMode mode; SDL_DisplayOrientation orientation; - DISPLAY_DEVICEW device; #ifdef DEBUG_MODES SDL_Log("Display: %s\n", WIN_StringToUTF8W(info->szDevice)); @@ -223,20 +331,25 @@ } } - displaydata = (SDL_DisplayData *) SDL_malloc(sizeof(*displaydata)); + displaydata = (SDL_DisplayData *) SDL_calloc(1, sizeof(*displaydata)); if (!displaydata) { return SDL_FALSE; } - SDL_memcpy(displaydata->DeviceName, info->szDevice, - sizeof(displaydata->DeviceName)); + SDL_memcpy(displaydata->DeviceName, info->szDevice, sizeof(displaydata->DeviceName)); displaydata->MonitorHandle = hMonitor; displaydata->IsValid = SDL_TRUE; SDL_zero(display); - device.cb = sizeof(device); - if (EnumDisplayDevicesW(info->szDevice, 0, &device, 0)) { - display.name = WIN_StringToUTF8W(device.DeviceString); + display.name = WIN_GetDisplayNameVista(info->szDevice); + if (display.name == NULL) { + DISPLAY_DEVICEW device; + SDL_zero(device); + device.cb = sizeof (device); + if (EnumDisplayDevicesW(info->szDevice, 0, &device, 0)) { + display.name = WIN_StringToUTF8W(device.DeviceString); + } } + display.desktop_mode = mode; display.current_mode = mode; display.orientation = orientation; @@ -301,10 +414,46 @@ return 0; } +/** + * Convert the monitor rect and work rect from pixels to the SDL coordinate system (monitor origins are in pixels, + * monitor size in DPI-scaled points). + * + * No-op if DPI scaling is not enabled. + */ +static void +WIN_MonitorInfoToSDL(const SDL_VideoData *videodata, HMONITOR monitor, MONITORINFO *info) +{ + UINT xdpi, ydpi; + + if (!videodata->dpi_scaling_enabled) { + return; + } + + /* Check for Windows < 8.1*/ + if (!videodata->GetDpiForMonitor) { + return; + } + if (videodata->GetDpiForMonitor(monitor, MDT_EFFECTIVE_DPI, &xdpi, &ydpi) != S_OK) { + /* Shouldn't happen? */ + return; + } + + /* Convert monitor size to points, leaving the monitor position in pixels */ + info->rcMonitor.right = info->rcMonitor.left + MulDiv(info->rcMonitor.right - info->rcMonitor.left, 96, xdpi); + info->rcMonitor.bottom = info->rcMonitor.top + MulDiv(info->rcMonitor.bottom - info->rcMonitor.top, 96, ydpi); + + /* Convert monitor work rect to points */ + info->rcWork.left = info->rcMonitor.left + MulDiv(info->rcWork.left - info->rcMonitor.left, 96, xdpi); + info->rcWork.right = info->rcMonitor.left + MulDiv(info->rcWork.right - info->rcMonitor.left, 96, xdpi); + info->rcWork.top = info->rcMonitor.top + MulDiv(info->rcWork.top - info->rcMonitor.top, 96, ydpi); + info->rcWork.bottom = info->rcMonitor.top + MulDiv(info->rcWork.bottom - info->rcMonitor.top, 96, ydpi); +} + int WIN_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) { const SDL_DisplayData *data = (const SDL_DisplayData *)display->driverdata; + const SDL_VideoData *videodata = (SDL_VideoData *)display->device->driverdata; MONITORINFO minfo; BOOL rc; @@ -316,6 +465,7 @@ return SDL_SetError("Couldn't find monitor data"); } + WIN_MonitorInfoToSDL(videodata, data->MonitorHandle, &minfo); rect->x = minfo.rcMonitor.left; rect->y = minfo.rcMonitor.top; rect->w = minfo.rcMonitor.right - minfo.rcMonitor.left; @@ -387,6 +537,7 @@ WIN_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) { const SDL_DisplayData *data = (const SDL_DisplayData *)display->driverdata; + const SDL_VideoData *videodata = (SDL_VideoData *)display->device->driverdata; MONITORINFO minfo; BOOL rc; @@ -398,6 +549,7 @@ return SDL_SetError("Couldn't find monitor data"); } + WIN_MonitorInfoToSDL(videodata, data->MonitorHandle, &minfo); rect->x = minfo.rcWork.left; rect->y = minfo.rcWork.top; rect->w = minfo.rcWork.right - minfo.rcWork.left; @@ -406,6 +558,127 @@ return 0; } +/** + * Convert a point from the SDL coordinate system (monitor origins are in pixels, + * offset within a monitor in DPI-scaled points) to Windows virtual screen coordinates (pixels). + * + * No-op if DPI scaling is not enabled (returns 96 dpi). + * + * Returns the DPI of the monitor that was closest to x, y and used for the conversion. + */ +void WIN_ScreenPointFromSDL(int *x, int *y, int *dpiOut) +{ + const SDL_VideoDevice *videodevice = SDL_GetVideoDevice(); + const SDL_VideoData *videodata; + int displayIndex; + SDL_Rect bounds; + float ddpi, hdpi, vdpi; + int x_sdl, y_sdl; + SDL_Point point; + point.x = *x; + point.y = *y; + + if (dpiOut) { + *dpiOut = 96; + } + + if (!videodevice || !videodevice->driverdata) { + return; + } + + videodata = (SDL_VideoData *)videodevice->driverdata; + if (!videodata->dpi_scaling_enabled) { + return; + } + + /* Can't use MonitorFromPoint for this because we currently have SDL coordinates, not pixels */ + displayIndex = SDL_GetPointDisplayIndex(&point); + + if (displayIndex < 0) { + return; + } + + if (SDL_GetDisplayBounds(displayIndex, &bounds) < 0 + || SDL_GetDisplayDPI(displayIndex, &ddpi, &hdpi, &vdpi) < 0) { + return; + } + + if (dpiOut) { + *dpiOut = (int) ddpi; + } + + /* Undo the DPI-scaling within the monitor bounds to convert back to pixels */ + x_sdl = *x; + y_sdl = *y; + *x = bounds.x + MulDiv(x_sdl - bounds.x, (int)ddpi, 96); + *y = bounds.y + MulDiv(y_sdl - bounds.y, (int)ddpi, 96); + +#ifdef HIGHDPI_DEBUG_VERBOSE + SDL_Log("WIN_ScreenPointFromSDL: (%d, %d) points -> (%d x %d) pixels, using %d DPI monitor", + x_sdl, y_sdl, *x, *y, (int)ddpi); +#endif +} + +/** + * Convert a point from Windows virtual screen coordinates (pixels) to the SDL + * coordinate system (monitor origins are in pixels, offset within a monitor in DPI-scaled points). + * + * No-op if DPI scaling is not enabled. + */ +void WIN_ScreenPointToSDL(int *x, int *y) +{ + const SDL_VideoDevice *videodevice = SDL_GetVideoDevice(); + const SDL_VideoData *videodata; + POINT point; + HMONITOR monitor; + int i, displayIndex; + SDL_Rect bounds; + float ddpi, hdpi, vdpi; + int x_pixels, y_pixels; + + if (!videodevice || !videodevice->driverdata) { + return; + } + + videodata = (SDL_VideoData *)videodevice->driverdata; + if (!videodata->dpi_scaling_enabled) { + return; + } + + point.x = *x; + point.y = *y; + monitor = MonitorFromPoint(point, MONITOR_DEFAULTTONEAREST); + + /* Search for the corresponding SDL monitor */ + displayIndex = -1; + for (i = 0; i < videodevice->num_displays; ++i) { + SDL_DisplayData *driverdata = (SDL_DisplayData *)videodevice->displays[i].driverdata; + if (driverdata->MonitorHandle == monitor) { + displayIndex = i; + } + } + if (displayIndex == -1) { + return; + } + + /* Get SDL display properties */ + if (SDL_GetDisplayBounds(displayIndex, &bounds) < 0 + || SDL_GetDisplayDPI(displayIndex, &ddpi, &hdpi, &vdpi) < 0) { + return; + } + + /* Convert the point's offset within the monitor from pixels to DPI-scaled points */ + x_pixels = *x; + y_pixels = *y; + *x = bounds.x + MulDiv(x_pixels - bounds.x, 96, (int)ddpi); + *y = bounds.y + MulDiv(y_pixels - bounds.y, 96, (int)ddpi); + +#ifdef HIGHDPI_DEBUG_VERBOSE + SDL_Log("WIN_ScreenPointToSDL: (%d, %d) pixels -> (%d x %d) points, using %d DPI monitor", + x_pixels, y_pixels, *x, *y, (int)ddpi); +#endif +} + void WIN_GetDisplayModes(_THIS, SDL_VideoDisplay * display) { @@ -432,6 +705,37 @@ } } +#ifdef DEBUG_MODES +static void +WIN_LogMonitor(_THIS, HMONITOR mon) +{ + const SDL_VideoData *vid_data = (const SDL_VideoData *)_this->driverdata; + MONITORINFOEX minfo; + UINT xdpi = 0, ydpi = 0; + char *name_utf8; + + if (vid_data->GetDpiForMonitor) { + vid_data->GetDpiForMonitor(mon, MDT_EFFECTIVE_DPI, &xdpi, &ydpi); + } + + SDL_zero(minfo); + minfo.cbSize = sizeof(minfo); + GetMonitorInfo(mon, (LPMONITORINFO)&minfo); + + name_utf8 = WIN_StringToUTF8(minfo.szDevice); + + SDL_Log("WIN_LogMonitor: monitor \"%s\": dpi: %d windows screen coordinates: %d, %d, %dx%d", + name_utf8, + xdpi, + minfo.rcMonitor.left, + minfo.rcMonitor.top, + minfo.rcMonitor.right - minfo.rcMonitor.left, + minfo.rcMonitor.bottom - minfo.rcMonitor.top); + + SDL_free(name_utf8); +} +#endif + int WIN_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) { @@ -439,9 +743,30 @@ SDL_DisplayModeData *data = (SDL_DisplayModeData *) mode->driverdata; LONG status; +#ifdef DEBUG_MODES + SDL_Log("WIN_SetDisplayMode: monitor state before mode change:"); + WIN_LogMonitor(_this, displaydata->MonitorHandle); +#endif + + /* High-DPI notes: + + - ChangeDisplaySettingsEx always takes pixels. + - e.g. if the display is set to 2880x1800 with 200% scaling in Display Settings + - calling ChangeDisplaySettingsEx with a dmPelsWidth/Height other than 2880x1800 will + change the monitor DPI to 96. (100% scaling) + - calling ChangeDisplaySettingsEx with a dmPelsWidth/Height of 2880x1800 (or a NULL DEVMODE*) will + reset the monitor DPI to 192. (200% scaling) + + NOTE: these are temporary changes in DPI, not modifications to the Control Panel setting. */ if (mode->driverdata == display->desktop_mode.driverdata) { +#ifdef DEBUG_MODES + SDL_Log("WIN_SetDisplayMode: resetting to original resolution"); +#endif status = ChangeDisplaySettingsExW(displaydata->DeviceName, NULL, NULL, CDS_FULLSCREEN, NULL); } else { +#ifdef DEBUG_MODES + SDL_Log("WIN_SetDisplayMode: changing to %dx%d pixels", data->DeviceMode.dmPelsWidth, data->DeviceMode.dmPelsHeight); +#endif status = ChangeDisplaySettingsExW(displaydata->DeviceName, &data->DeviceMode, NULL, CDS_FULLSCREEN, NULL); } if (status != DISP_CHANGE_SUCCESSFUL) { @@ -462,6 +787,12 @@ } return SDL_SetError("ChangeDisplaySettingsEx() failed: %s", reason); } + +#ifdef DEBUG_MODES + SDL_Log("WIN_SetDisplayMode: monitor state after mode change:"); + WIN_LogMonitor(_this, displaydata->MonitorHandle); +#endif + EnumDisplaySettingsW(displaydata->DeviceName, ENUM_CURRENT_SETTINGS, &data->DeviceMode); WIN_UpdateDisplayMode(_this, displaydata->DeviceName, ENUM_CURRENT_SETTINGS, mode); return 0; diff -Nru libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowsmodes.h libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowsmodes.h --- libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowsmodes.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowsmodes.h 2022-06-16 20:16:31.000000000 +0000 @@ -38,6 +38,8 @@ extern int WIN_InitModes(_THIS); extern int WIN_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect); extern int WIN_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect); +extern void WIN_ScreenPointFromSDL(int *x, int *y, int *dpiOut); +extern void WIN_ScreenPointToSDL(int *x, int *y); extern int WIN_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdpi, float * vdpi); extern void WIN_GetDisplayModes(_THIS, SDL_VideoDisplay * display); extern int WIN_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode); diff -Nru libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowsmouse.c libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowsmouse.c --- libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowsmouse.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowsmouse.c 2022-08-13 03:48:10.000000000 +0000 @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS +#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #include "SDL_windowsvideo.h" @@ -290,6 +290,7 @@ { POINT pt; + WIN_ScreenPointFromSDL(&x, &y, NULL); pt.x = x; pt.y = y; SetCursorPos(pt.x, pt.y); @@ -333,6 +334,7 @@ GetCursorPos(&pt); *x = (int) pt.x; *y = (int) pt.y; + WIN_ScreenPointToSDL(x, y); retval |= GetAsyncKeyState(!swapButtons ? VK_LBUTTON : VK_RBUTTON) & 0x8000 ? SDL_BUTTON_LMASK : 0; retval |= GetAsyncKeyState(!swapButtons ? VK_RBUTTON : VK_LBUTTON) & 0x8000 ? SDL_BUTTON_RMASK : 0; diff -Nru libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowsopengl.c libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowsopengl.c --- libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowsopengl.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowsopengl.c 2022-08-13 03:48:10.000000000 +0000 @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS +#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #include "SDL_loadso.h" #include "SDL_windowsvideo.h" @@ -74,6 +74,11 @@ #define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9 #endif +#ifndef WGL_ARB_pixel_format_float +#define WGL_ARB_pixel_format_float +#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0 +#endif + #ifndef WGL_ARB_context_flush_control #define WGL_ARB_context_flush_control #define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097 @@ -597,6 +602,10 @@ *iAttr++ = _this->gl_config.multisamplesamples; } + if (_this->gl_config.floatbuffers) { + *iAttr++ = WGL_TYPE_RGBA_FLOAT_ARB; + } + if (_this->gl_config.framebuffer_srgb_capable) { *iAttr++ = WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB; *iAttr++ = _this->gl_config.framebuffer_srgb_capable; @@ -676,6 +685,7 @@ _this->GL_UnloadLibrary = WIN_GLES_UnloadLibrary; _this->GL_CreateContext = WIN_GLES_CreateContext; _this->GL_MakeCurrent = WIN_GLES_MakeCurrent; + _this->GL_GetDrawableSize = WIN_GLES_GetDrawableSize; _this->GL_SetSwapInterval = WIN_GLES_SetSwapInterval; _this->GL_GetSwapInterval = WIN_GLES_GetSwapInterval; _this->GL_SwapWindow = WIN_GLES_SwapWindow; @@ -822,6 +832,12 @@ return 0; } +void +WIN_GL_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h) +{ + WIN_GetDrawableSize(window, w, h); +} + int WIN_GL_SetSwapInterval(_THIS, int interval) { diff -Nru libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowsopengles.c libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowsopengles.c --- libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowsopengles.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowsopengles.c 2022-08-13 03:48:10.000000000 +0000 @@ -20,11 +20,12 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS && SDL_VIDEO_OPENGL_EGL +#if SDL_VIDEO_DRIVER_WINDOWS && SDL_VIDEO_OPENGL_EGL && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #include "SDL_windowsvideo.h" #include "SDL_windowsopengles.h" #include "SDL_windowsopengl.h" +#include "SDL_windowswindow.h" /* EGL implementation of SDL OpenGL support */ @@ -40,6 +41,7 @@ _this->GL_UnloadLibrary = WIN_GL_UnloadLibrary; _this->GL_CreateContext = WIN_GL_CreateContext; _this->GL_MakeCurrent = WIN_GL_MakeCurrent; + _this->GL_GetDrawableSize = WIN_GL_GetDrawableSize; _this->GL_SetSwapInterval = WIN_GL_SetSwapInterval; _this->GL_GetSwapInterval = WIN_GL_GetSwapInterval; _this->GL_SwapWindow = WIN_GL_SwapWindow; @@ -72,6 +74,7 @@ _this->GL_UnloadLibrary = WIN_GL_UnloadLibrary; _this->GL_CreateContext = WIN_GL_CreateContext; _this->GL_MakeCurrent = WIN_GL_MakeCurrent; + _this->GL_GetDrawableSize = WIN_GL_GetDrawableSize; _this->GL_SetSwapInterval = WIN_GL_SetSwapInterval; _this->GL_GetSwapInterval = WIN_GL_GetSwapInterval; _this->GL_SwapWindow = WIN_GL_SwapWindow; @@ -99,6 +102,12 @@ SDL_EGL_SwapWindow_impl(WIN) SDL_EGL_MakeCurrent_impl(WIN) +void +WIN_GLES_GetDrawableSize(_THIS, SDL_Window* window, int* w, int* h) +{ + WIN_GetDrawableSize(window, w, h); +} + int WIN_GLES_SetupWindow(_THIS, SDL_Window * window) { diff -Nru libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowsopengles.h libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowsopengles.h --- libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowsopengles.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowsopengles.h 2022-06-16 20:16:31.000000000 +0000 @@ -39,6 +39,7 @@ extern SDL_GLContext WIN_GLES_CreateContext(_THIS, SDL_Window * window); extern int WIN_GLES_SwapWindow(_THIS, SDL_Window * window); extern int WIN_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); +extern void WIN_GLES_GetDrawableSize(_THIS, SDL_Window* window, int* w, int* h); extern void WIN_GLES_DeleteContext(_THIS, SDL_GLContext context); extern int WIN_GLES_SetupWindow(_THIS, SDL_Window * window); diff -Nru libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowsopengl.h libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowsopengl.h --- libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowsopengl.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowsopengl.h 2022-06-16 20:16:31.000000000 +0000 @@ -71,6 +71,7 @@ extern SDL_GLContext WIN_GL_CreateContext(_THIS, SDL_Window * window); extern int WIN_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); +extern void WIN_GL_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h); extern int WIN_GL_SetSwapInterval(_THIS, int interval); extern int WIN_GL_GetSwapInterval(_THIS); extern int WIN_GL_SwapWindow(_THIS, SDL_Window * window); diff -Nru libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowsshape.c libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowsshape.c --- libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowsshape.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowsshape.c 2022-08-13 03:48:10.000000000 +0000 @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS +#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #include "SDL_windowsshape.h" #include "SDL_windowsvideo.h" diff -Nru libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowsvideo.c libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowsvideo.c --- libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowsvideo.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowsvideo.c 2022-08-13 03:48:10.000000000 +0000 @@ -35,6 +35,8 @@ #include "SDL_windowsshape.h" #include "SDL_windowsvulkan.h" +/* #define HIGHDPI_DEBUG */ + /* Initialization/Query functions */ static int WIN_VideoInit(_THIS); static void WIN_VideoQuit(_THIS); @@ -63,6 +65,7 @@ } } +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) static void WIN_SuspendScreenSaver(_THIS) { if (_this->suspend_screensaver) { @@ -71,6 +74,11 @@ SetThreadExecutionState(ES_CONTINUOUS); } } +#endif + +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) +extern void D3D12_XBOX_GetResolution(Uint32 *width, Uint32 *height); +#endif /* Windows driver bootstrap functions */ @@ -81,12 +89,14 @@ SDL_VideoData *data = (SDL_VideoData *) device->driverdata; SDL_UnregisterApp(); +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) if (data->userDLL) { SDL_UnloadObject(data->userDLL); } if (data->shcoreDLL) { SDL_UnloadObject(data->shcoreDLL); } +#endif if (device->wakeup_lock) { SDL_DestroyMutex(device->wakeup_lock); } @@ -95,7 +105,7 @@ } static SDL_VideoDevice * -WIN_CreateDevice(int devindex) +WIN_CreateDevice(void) { SDL_VideoDevice *device; SDL_VideoData *data; @@ -117,11 +127,22 @@ device->driverdata = data; device->wakeup_lock = SDL_CreateMutex(); +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) data->userDLL = SDL_LoadObject("USER32.DLL"); if (data->userDLL) { data->CloseTouchInputHandle = (BOOL (WINAPI *)(HTOUCHINPUT)) SDL_LoadFunction(data->userDLL, "CloseTouchInputHandle"); data->GetTouchInputInfo = (BOOL (WINAPI *)(HTOUCHINPUT, UINT, PTOUCHINPUT, int)) SDL_LoadFunction(data->userDLL, "GetTouchInputInfo"); data->RegisterTouchWindow = (BOOL (WINAPI *)(HWND, ULONG)) SDL_LoadFunction(data->userDLL, "RegisterTouchWindow"); + data->SetProcessDPIAware = (BOOL (WINAPI *)(void)) SDL_LoadFunction(data->userDLL, "SetProcessDPIAware"); + data->SetProcessDpiAwarenessContext = (BOOL (WINAPI *)(DPI_AWARENESS_CONTEXT)) SDL_LoadFunction(data->userDLL, "SetProcessDpiAwarenessContext"); + data->SetThreadDpiAwarenessContext = (DPI_AWARENESS_CONTEXT (WINAPI *)(DPI_AWARENESS_CONTEXT)) SDL_LoadFunction(data->userDLL, "SetThreadDpiAwarenessContext"); + data->GetThreadDpiAwarenessContext = (DPI_AWARENESS_CONTEXT (WINAPI *)(void)) SDL_LoadFunction(data->userDLL, "GetThreadDpiAwarenessContext"); + data->GetAwarenessFromDpiAwarenessContext = (DPI_AWARENESS (WINAPI *)(DPI_AWARENESS_CONTEXT)) SDL_LoadFunction(data->userDLL, "GetAwarenessFromDpiAwarenessContext"); + data->EnableNonClientDpiScaling = (BOOL (WINAPI *)(HWND)) SDL_LoadFunction(data->userDLL, "EnableNonClientDpiScaling"); + data->AdjustWindowRectExForDpi = (BOOL (WINAPI *)(LPRECT, DWORD, BOOL, DWORD, UINT)) SDL_LoadFunction(data->userDLL, "AdjustWindowRectExForDpi"); + data->GetDpiForWindow = (UINT (WINAPI *)(HWND)) SDL_LoadFunction(data->userDLL, "GetDpiForWindow"); + data->AreDpiAwarenessContextsEqual = (BOOL (WINAPI *)(DPI_AWARENESS_CONTEXT, DPI_AWARENESS_CONTEXT)) SDL_LoadFunction(data->userDLL, "AreDpiAwarenessContextsEqual"); + data->IsValidDpiAwarenessContext = (BOOL (WINAPI *)(DPI_AWARENESS_CONTEXT)) SDL_LoadFunction(data->userDLL, "IsValidDpiAwarenessContext"); } else { SDL_ClearError(); } @@ -129,22 +150,28 @@ data->shcoreDLL = SDL_LoadObject("SHCORE.DLL"); if (data->shcoreDLL) { data->GetDpiForMonitor = (HRESULT (WINAPI *)(HMONITOR, MONITOR_DPI_TYPE, UINT *, UINT *)) SDL_LoadFunction(data->shcoreDLL, "GetDpiForMonitor"); + data->SetProcessDpiAwareness = (HRESULT (WINAPI *)(PROCESS_DPI_AWARENESS)) SDL_LoadFunction(data->shcoreDLL, "SetProcessDpiAwareness"); } else { SDL_ClearError(); } +#endif /* #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) */ /* Set the function pointers */ device->VideoInit = WIN_VideoInit; device->VideoQuit = WIN_VideoQuit; +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) device->GetDisplayBounds = WIN_GetDisplayBounds; device->GetDisplayUsableBounds = WIN_GetDisplayUsableBounds; device->GetDisplayDPI = WIN_GetDisplayDPI; device->GetDisplayModes = WIN_GetDisplayModes; device->SetDisplayMode = WIN_SetDisplayMode; +#endif device->PumpEvents = WIN_PumpEvents; device->WaitEventTimeout = WIN_WaitEventTimeout; +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) device->SendWakeupEvent = WIN_SendWakeupEvent; device->SuspendScreenSaver = WIN_SuspendScreenSaver; +#endif device->CreateSDLWindow = WIN_CreateWindow; device->CreateSDLWindowFrom = WIN_CreateWindowFrom; @@ -164,14 +191,17 @@ device->SetWindowResizable = WIN_SetWindowResizable; device->SetWindowAlwaysOnTop = WIN_SetWindowAlwaysOnTop; device->SetWindowFullscreen = WIN_SetWindowFullscreen; +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) device->SetWindowGammaRamp = WIN_SetWindowGammaRamp; device->GetWindowICCProfile = WIN_GetWindowICCProfile; device->GetWindowGammaRamp = WIN_GetWindowGammaRamp; device->SetWindowMouseRect = WIN_SetWindowMouseRect; device->SetWindowMouseGrab = WIN_SetWindowMouseGrab; device->SetWindowKeyboardGrab = WIN_SetWindowKeyboardGrab; +#endif device->DestroyWindow = WIN_DestroyWindow; device->GetWindowWMInfo = WIN_GetWindowWMInfo; +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) device->CreateWindowFramebuffer = WIN_CreateWindowFramebuffer; device->UpdateWindowFramebuffer = WIN_UpdateWindowFramebuffer; device->DestroyWindowFramebuffer = WIN_DestroyWindowFramebuffer; @@ -183,6 +213,7 @@ device->shape_driver.CreateShaper = Win32_CreateShaper; device->shape_driver.SetWindowShape = Win32_SetWindowShape; device->shape_driver.ResizeWindowShape = Win32_ResizeWindowShape; +#endif #if SDL_VIDEO_OPENGL_WGL device->GL_LoadLibrary = WIN_GL_LoadLibrary; @@ -190,6 +221,7 @@ device->GL_UnloadLibrary = WIN_GL_UnloadLibrary; device->GL_CreateContext = WIN_GL_CreateContext; device->GL_MakeCurrent = WIN_GL_MakeCurrent; + device->GL_GetDrawableSize = WIN_GL_GetDrawableSize; device->GL_SetSwapInterval = WIN_GL_SetSwapInterval; device->GL_GetSwapInterval = WIN_GL_GetSwapInterval; device->GL_SwapWindow = WIN_GL_SwapWindow; @@ -201,6 +233,7 @@ device->GL_UnloadLibrary = WIN_GLES_UnloadLibrary; device->GL_CreateContext = WIN_GLES_CreateContext; device->GL_MakeCurrent = WIN_GLES_MakeCurrent; + device->GL_GetDrawableSize = WIN_GLES_GetDrawableSize; device->GL_SetSwapInterval = WIN_GLES_SetSwapInterval; device->GL_GetSwapInterval = WIN_GLES_GetSwapInterval; device->GL_SwapWindow = WIN_GLES_SwapWindow; @@ -211,8 +244,10 @@ device->Vulkan_UnloadLibrary = WIN_Vulkan_UnloadLibrary; device->Vulkan_GetInstanceExtensions = WIN_Vulkan_GetInstanceExtensions; device->Vulkan_CreateSurface = WIN_Vulkan_CreateSurface; + device->Vulkan_GetDrawableSize = WIN_GL_GetDrawableSize; #endif +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) device->StartTextInput = WIN_StartTextInput; device->StopTextInput = WIN_StopTextInput; device->SetTextInputRect = WIN_SetTextInputRect; @@ -222,6 +257,7 @@ device->SetClipboardText = WIN_SetClipboardText; device->GetClipboardText = WIN_GetClipboardText; device->HasClipboardText = WIN_HasClipboardText; +#endif device->free = WIN_DeleteDevice; @@ -233,22 +269,201 @@ "windows", "SDL Windows video driver", WIN_CreateDevice }; +static BOOL +WIN_DeclareDPIAwareUnaware(_THIS) +{ +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) + SDL_VideoData* data = (SDL_VideoData*)_this->driverdata; + + if (data->SetProcessDpiAwarenessContext) { + return data->SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_UNAWARE); + } else if (data->SetProcessDpiAwareness) { + /* Windows 8.1 */ + return SUCCEEDED(data->SetProcessDpiAwareness(PROCESS_DPI_UNAWARE)); + } +#endif + return FALSE; +} + +static BOOL +WIN_DeclareDPIAwareSystem(_THIS) +{ +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) + SDL_VideoData* data = (SDL_VideoData*)_this->driverdata; + + if (data->SetProcessDpiAwarenessContext) { + /* Windows 10, version 1607 */ + return data->SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_SYSTEM_AWARE); + } else if (data->SetProcessDpiAwareness) { + /* Windows 8.1 */ + return SUCCEEDED(data->SetProcessDpiAwareness(PROCESS_SYSTEM_DPI_AWARE)); + } else if (data->SetProcessDPIAware) { + /* Windows Vista */ + return data->SetProcessDPIAware(); + } +#endif + return FALSE; +} + +static BOOL +WIN_DeclareDPIAwarePerMonitor(_THIS) +{ +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + + if (data->SetProcessDpiAwarenessContext) { + /* Windows 10, version 1607 */ + return data->SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE); + } else if (data->SetProcessDpiAwareness) { + /* Windows 8.1 */ + return SUCCEEDED(data->SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE)); + } else { + /* Older OS: fall back to system DPI aware */ + return WIN_DeclareDPIAwareSystem(_this); + } +#endif + return FALSE; +} + +static BOOL +WIN_DeclareDPIAwarePerMonitorV2(_THIS) +{ +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) + return FALSE; +#else + SDL_VideoData* data = (SDL_VideoData*)_this->driverdata; + + /* Declare DPI aware (may have been done in external code or a manifest, as well) */ + if (data->SetProcessDpiAwarenessContext) { + /* Windows 10, version 1607 */ + + /* NOTE: SetThreadDpiAwarenessContext doesn't work here with OpenGL - the OpenGL contents + end up still getting OS scaled. (tested on Windows 10 21H1 19043.1348, NVIDIA 496.49) + + NOTE: Enabling DPI awareness through Windows Explorer + (right click .exe -> Properties -> Compatibility -> High DPI Settings -> + check "Override high DPI Scaling behaviour", select Application) gives + a DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE context (at least on Windows 10 21H1), and + setting DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 will fail. + + NOTE: Entering exclusive fullscreen in a DPI_AWARENESS_CONTEXT_UNAWARE process + appears to cause Windows to change the .exe manifest to DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE + on future launches. This means attempting to use DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 + will fail in the future until you manually clear the "Override high DPI Scaling behaviour" + setting in Windows Explorer (tested on Windows 10 21H2). + */ + if (data->SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2)) { + return TRUE; + } else { + return WIN_DeclareDPIAwarePerMonitor(_this); + } + } else { + /* Older OS: fall back to per-monitor (or system) */ + return WIN_DeclareDPIAwarePerMonitor(_this); + } +#endif +} + +#ifdef HIGHDPI_DEBUG +static const char* +WIN_GetDPIAwareness(_THIS) +{ + SDL_VideoData* data = (SDL_VideoData*)_this->driverdata; + + if (data->GetThreadDpiAwarenessContext && data->AreDpiAwarenessContextsEqual) { + DPI_AWARENESS_CONTEXT context = data->GetThreadDpiAwarenessContext(); + + if (data->AreDpiAwarenessContextsEqual(context, DPI_AWARENESS_CONTEXT_UNAWARE)) { + return "unaware"; + } else if (data->AreDpiAwarenessContextsEqual(context, DPI_AWARENESS_CONTEXT_SYSTEM_AWARE)) { + return "system"; + } else if (data->AreDpiAwarenessContextsEqual(context, DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE)) { + return "permonitor"; + } else if (data->AreDpiAwarenessContextsEqual(context, DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2)) { + return "permonitorv2"; + } else if (data->AreDpiAwarenessContextsEqual(context, DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED)) { + return "unaware_gdiscaled"; + } + } + + return ""; +} +#endif + +static void +WIN_InitDPIAwareness(_THIS) +{ + const char* hint = SDL_GetHint(SDL_HINT_WINDOWS_DPI_AWARENESS); + + if (hint != NULL) { + if (SDL_strcmp(hint, "permonitorv2") == 0) { + WIN_DeclareDPIAwarePerMonitorV2(_this); + } else if (SDL_strcmp(hint, "permonitor") == 0) { + WIN_DeclareDPIAwarePerMonitor(_this); + } else if (SDL_strcmp(hint, "system") == 0) { + WIN_DeclareDPIAwareSystem(_this); + } else if (SDL_strcmp(hint, "unaware") == 0) { + WIN_DeclareDPIAwareUnaware(_this); + } + } +} + +static void +WIN_InitDPIScaling(_THIS) +{ + SDL_VideoData* data = (SDL_VideoData*)_this->driverdata; + + if (SDL_GetHintBoolean(SDL_HINT_WINDOWS_DPI_SCALING, SDL_FALSE)) { + WIN_DeclareDPIAwarePerMonitorV2(_this); + + data->dpi_scaling_enabled = SDL_TRUE; + } +} + int WIN_VideoInit(_THIS) { SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + WIN_InitDPIAwareness(_this); + WIN_InitDPIScaling(_this); + +#ifdef HIGHDPI_DEBUG + SDL_Log("DPI awareness: %s", WIN_GetDPIAwareness(_this)); +#endif + +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) + /* For Xbox, we just need to create the single display */ + { + SDL_VideoDisplay display; + SDL_DisplayMode current_mode; + + SDL_zero(current_mode); + D3D12_XBOX_GetResolution(¤t_mode.w, ¤t_mode.h); + current_mode.refresh_rate = 60; + current_mode.format = SDL_PIXELFORMAT_ARGB8888; + + SDL_zero(display); + display.desktop_mode = current_mode; + display.current_mode = current_mode; + + SDL_AddVideoDisplay(&display, SDL_FALSE); + } +#else /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ if (WIN_InitModes(_this) < 0) { return -1; } WIN_InitKeyboard(_this); WIN_InitMouse(_this); +#endif SDL_AddHintCallback(SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP, UpdateWindowsEnableMessageLoop, NULL); SDL_AddHintCallback(SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN, UpdateWindowFrameUsableWhileCursorHidden, NULL); +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) data->_SDL_WAKEUP = RegisterWindowMessageA("_SDL_WAKEUP"); +#endif return 0; } @@ -256,15 +471,34 @@ void WIN_VideoQuit(_THIS) { +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) WIN_QuitModes(_this); WIN_QuitKeyboard(_this); WIN_QuitMouse(_this); +#endif } +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #define D3D_DEBUG_INFO #include +#ifdef D3D_DEBUG_INFO +#ifndef D3D_SDK_VERSION +#define D3D_SDK_VERSION (32 | 0x80000000) +#endif +#ifndef D3D9b_SDK_VERSION +#define D3D9b_SDK_VERSION (31 | 0x80000000) +#endif +#else /**/ +#ifndef D3D_SDK_VERSION +#define D3D_SDK_VERSION 32 +#endif +#ifndef D3D9b_SDK_VERSION +#define D3D9b_SDK_VERSION 31 +#endif +#endif + SDL_bool D3D_LoadDLL(void **pD3DDLL, IDirect3D9 **pDirect3D9Interface) { @@ -346,6 +580,7 @@ return adapterIndex; } } +#endif /* !defined(__XBOXONE__) && !defined(__XBOXSERIES__) */ #if HAVE_DXGI_H #define CINTERFACE @@ -457,6 +692,21 @@ #endif } +SDL_bool +WIN_IsPerMonitorV2DPIAware(_THIS) +{ +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) + SDL_VideoData* data = (SDL_VideoData*) _this->driverdata; + + if (data->AreDpiAwarenessContextsEqual && data->GetThreadDpiAwarenessContext) { + /* Windows 10, version 1607 */ + return (SDL_bool)data->AreDpiAwarenessContextsEqual(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2, + data->GetThreadDpiAwarenessContext()); + } +#endif + return SDL_FALSE; +} + #endif /* SDL_VIDEO_DRIVER_WINDOWS */ /* vim: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowsvideo.h libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowsvideo.h --- libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowsvideo.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowsvideo.h 2022-08-13 03:48:10.000000000 +0000 @@ -27,7 +27,7 @@ #include "../SDL_sysvideo.h" -#if defined(_MSC_VER) && (_MSC_VER >= 1500) +#if defined(_MSC_VER) && (_MSC_VER >= 1500) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #include #else #include "SDL_msctf.h" @@ -41,11 +41,15 @@ #include "SDL_windowsclipboard.h" #include "SDL_windowsevents.h" + +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #include "SDL_windowskeyboard.h" #include "SDL_windowsmodes.h" #include "SDL_windowsmouse.h" #include "SDL_windowsopengl.h" #include "SDL_windowsopengles.h" +#endif + #include "SDL_windowswindow.h" #include "SDL_events.h" #include "SDL_loadso.h" @@ -75,9 +79,206 @@ DWORD cyContact; } TOUCHINPUT, *PTOUCHINPUT; + +/* More-robust display information in Vista... */ +/* This is a huge amount of data to be stuffing into three API calls. :( */ +typedef struct DISPLAYCONFIG_PATH_SOURCE_INFO +{ + LUID adapterId; + UINT32 id; + union + { + UINT32 modeInfoIdx; + struct + { + UINT32 cloneGroupId : 16; + UINT32 sourceModeInfoIdx : 16; + } DUMMYSTRUCTNAME; + } DUMMYUNIONNAME; + + UINT32 statusFlags; +} DISPLAYCONFIG_PATH_SOURCE_INFO; + +typedef struct DISPLAYCONFIG_RATIONAL +{ + UINT32 Numerator; + UINT32 Denominator; +} DISPLAYCONFIG_RATIONAL; + +typedef struct DISPLAYCONFIG_PATH_TARGET_INFO +{ + LUID adapterId; + UINT32 id; + union + { + UINT32 modeInfoIdx; + struct + { + UINT32 desktopModeInfoIdx : 16; + UINT32 targetModeInfoIdx : 16; + } DUMMYSTRUCTNAME; + } DUMMYUNIONNAME; + UINT32 /*DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY*/ outputTechnology; + UINT32 /*DISPLAYCONFIG_ROTATION*/ rotation; + UINT32 /*DISPLAYCONFIG_SCALING*/ scaling; + DISPLAYCONFIG_RATIONAL refreshRate; + UINT32 /*DISPLAYCONFIG_SCANLINE_ORDERING*/ scanLineOrdering; + BOOL targetAvailable; + UINT32 statusFlags; +} DISPLAYCONFIG_PATH_TARGET_INFO; + +typedef struct DISPLAYCONFIG_PATH_INFO +{ + DISPLAYCONFIG_PATH_SOURCE_INFO sourceInfo; + DISPLAYCONFIG_PATH_TARGET_INFO targetInfo; + UINT32 flags; +} DISPLAYCONFIG_PATH_INFO; + +typedef enum +{ + DISPLAYCONFIG_MODE_INFO_TYPE_SOURCE = 1, + DISPLAYCONFIG_MODE_INFO_TYPE_TARGET = 2, + DISPLAYCONFIG_MODE_INFO_TYPE_DESKTOP_IMAGE = 3, + DISPLAYCONFIG_MODE_INFO_TYPE_FORCE_UINT32 = 0xFFFFFFFF +} DISPLAYCONFIG_MODE_INFO_TYPE; + +typedef struct DISPLAYCONFIG_2DREGION +{ + UINT32 cx; + UINT32 cy; +} DISPLAYCONFIG_2DREGION; + +typedef struct DISPLAYCONFIG_VIDEO_SIGNAL_INFO +{ + UINT64 pixelRate; + DISPLAYCONFIG_RATIONAL hSyncFreq; + DISPLAYCONFIG_RATIONAL vSyncFreq; + DISPLAYCONFIG_2DREGION activeSize; + DISPLAYCONFIG_2DREGION totalSize; + + union + { + struct + { + UINT32 videoStandard : 16; + + // Vertical refresh frequency divider + UINT32 vSyncFreqDivider : 6; + + UINT32 reserved : 10; + } AdditionalSignalInfo; + + UINT32 videoStandard; + } DUMMYUNIONNAME; + + // Scan line ordering (e.g. progressive, interlaced). + UINT32 /*DISPLAYCONFIG_SCANLINE_ORDERING*/ scanLineOrdering; +} DISPLAYCONFIG_VIDEO_SIGNAL_INFO; + +typedef struct DISPLAYCONFIG_SOURCE_MODE +{ + UINT32 width; + UINT32 height; + UINT32 /*DISPLAYCONFIG_PIXELFORMAT*/ pixelFormat; + POINTL position; +} DISPLAYCONFIG_SOURCE_MODE; + +typedef struct DISPLAYCONFIG_TARGET_MODE +{ + DISPLAYCONFIG_VIDEO_SIGNAL_INFO targetVideoSignalInfo; +} DISPLAYCONFIG_TARGET_MODE; + +typedef struct DISPLAYCONFIG_DESKTOP_IMAGE_INFO +{ + POINTL PathSourceSize; + RECTL DesktopImageRegion; + RECTL DesktopImageClip; +} DISPLAYCONFIG_DESKTOP_IMAGE_INFO; + +typedef struct DISPLAYCONFIG_MODE_INFO +{ + DISPLAYCONFIG_MODE_INFO_TYPE infoType; + UINT32 id; + LUID adapterId; + union + { + DISPLAYCONFIG_TARGET_MODE targetMode; + DISPLAYCONFIG_SOURCE_MODE sourceMode; + DISPLAYCONFIG_DESKTOP_IMAGE_INFO desktopImageInfo; + } DUMMYUNIONNAME; +} DISPLAYCONFIG_MODE_INFO; + +typedef enum DISPLAYCONFIG_TOPOLOGY_ID +{ + DISPLAYCONFIG_TOPOLOGY_INTERNAL = 0x00000001, + DISPLAYCONFIG_TOPOLOGY_CLONE = 0x00000002, + DISPLAYCONFIG_TOPOLOGY_EXTEND = 0x00000004, + DISPLAYCONFIG_TOPOLOGY_EXTERNAL = 0x00000008, + DISPLAYCONFIG_TOPOLOGY_FORCE_UINT32 = 0xFFFFFFFF +} DISPLAYCONFIG_TOPOLOGY_ID; + +typedef enum +{ + DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME = 1, + DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME = 2, + DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_PREFERRED_MODE = 3, + DISPLAYCONFIG_DEVICE_INFO_GET_ADAPTER_NAME = 4, + DISPLAYCONFIG_DEVICE_INFO_SET_TARGET_PERSISTENCE = 5, + DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_BASE_TYPE = 6, + DISPLAYCONFIG_DEVICE_INFO_GET_SUPPORT_VIRTUAL_RESOLUTION = 7, + DISPLAYCONFIG_DEVICE_INFO_SET_SUPPORT_VIRTUAL_RESOLUTION = 8, + DISPLAYCONFIG_DEVICE_INFO_GET_ADVANCED_COLOR_INFO = 9, + DISPLAYCONFIG_DEVICE_INFO_SET_ADVANCED_COLOR_STATE = 10, + DISPLAYCONFIG_DEVICE_INFO_GET_SDR_WHITE_LEVEL = 11, + DISPLAYCONFIG_DEVICE_INFO_FORCE_UINT32 = 0xFFFFFFFF +} DISPLAYCONFIG_DEVICE_INFO_TYPE; + +typedef struct DISPLAYCONFIG_DEVICE_INFO_HEADER +{ + DISPLAYCONFIG_DEVICE_INFO_TYPE type; + UINT32 size; + LUID adapterId; + UINT32 id; +} DISPLAYCONFIG_DEVICE_INFO_HEADER; + +typedef struct DISPLAYCONFIG_SOURCE_DEVICE_NAME +{ + DISPLAYCONFIG_DEVICE_INFO_HEADER header; + WCHAR viewGdiDeviceName[CCHDEVICENAME]; +} DISPLAYCONFIG_SOURCE_DEVICE_NAME; + +typedef struct DISPLAYCONFIG_TARGET_DEVICE_NAME_FLAGS +{ + union + { + struct + { + UINT32 friendlyNameFromEdid : 1; + UINT32 friendlyNameForced : 1; + UINT32 edidIdsValid : 1; + UINT32 reserved : 29; + } DUMMYSTRUCTNAME; + UINT32 value; + } DUMMYUNIONNAME; +} DISPLAYCONFIG_TARGET_DEVICE_NAME_FLAGS; + +typedef struct DISPLAYCONFIG_TARGET_DEVICE_NAME +{ + DISPLAYCONFIG_DEVICE_INFO_HEADER header; + DISPLAYCONFIG_TARGET_DEVICE_NAME_FLAGS flags; + UINT32 /*DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY*/ outputTechnology; + UINT16 edidManufactureId; + UINT16 edidProductCodeId; + UINT32 connectorInstance; + WCHAR monitorFriendlyDeviceName[64]; + WCHAR monitorDevicePath[128]; +} DISPLAYCONFIG_TARGET_DEVICE_NAME; + +#define QDC_ONLY_ACTIVE_PATHS 0x00000002 + #endif /* WINVER < 0x0601 */ -#if WINVER < 0x0603 +#ifndef HAVE_SHELLSCALINGAPI_H typedef enum MONITOR_DPI_TYPE { MDT_EFFECTIVE_DPI = 0, @@ -86,9 +287,42 @@ MDT_DEFAULT = MDT_EFFECTIVE_DPI } MONITOR_DPI_TYPE; +typedef enum PROCESS_DPI_AWARENESS { + PROCESS_DPI_UNAWARE = 0, + PROCESS_SYSTEM_DPI_AWARE = 1, + PROCESS_PER_MONITOR_DPI_AWARE = 2 +} PROCESS_DPI_AWARENESS; + #else #include -#endif /* WINVER < 0x0603 */ +#endif + +#ifndef _DPI_AWARENESS_CONTEXTS_ + +typedef enum DPI_AWARENESS { + DPI_AWARENESS_INVALID = -1, + DPI_AWARENESS_UNAWARE = 0, + DPI_AWARENESS_SYSTEM_AWARE = 1, + DPI_AWARENESS_PER_MONITOR_AWARE = 2 +} DPI_AWARENESS; + +DECLARE_HANDLE(DPI_AWARENESS_CONTEXT); + +#define DPI_AWARENESS_CONTEXT_UNAWARE ((DPI_AWARENESS_CONTEXT)-1) +#define DPI_AWARENESS_CONTEXT_SYSTEM_AWARE ((DPI_AWARENESS_CONTEXT)-2) +#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE ((DPI_AWARENESS_CONTEXT)-3) + +#endif /* _DPI_AWARENESS_CONTEXTS_ */ + +/* Windows 10 Creators Update */ +#if NTDDI_VERSION < 0x0A000003 +#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((DPI_AWARENESS_CONTEXT)-4) +#endif /* NTDDI_VERSION < 0x0A000003 */ + +/* Windows 10 version 1809 */ +#if NTDDI_VERSION < 0x0A000006 +#define DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED ((DPI_AWARENESS_CONTEXT)-5) +#endif /* NTDDI_VERSION < 0x0A000006 */ typedef BOOL (*PFNSHFullScreen)(HWND, DWORD); typedef void (*PFCoordTransform)(SDL_Window*, POINT*); @@ -100,6 +334,7 @@ void *data; } TSFSink; +#ifndef SDL_DISABLE_WINDOWS_IME /* Definition from Win98DDK version of IMM.H */ typedef struct tagINPUTCONTEXT2 { HWND hWnd; @@ -123,6 +358,7 @@ DWORD fdwInit; DWORD dwReserve[3]; } INPUTCONTEXT2, *PINPUTCONTEXT2, NEAR *NPINPUTCONTEXT2, FAR *LPINPUTCONTEXT2; +#endif /* !SDL_DISABLE_WINDOWS_IME */ /* Private display data */ @@ -132,18 +368,34 @@ DWORD clipboard_count; +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) /* Xbox doesn't support user32/shcore*/ /* Touch input functions */ void* userDLL; BOOL (WINAPI *CloseTouchInputHandle)( HTOUCHINPUT ); BOOL (WINAPI *GetTouchInputInfo)( HTOUCHINPUT, UINT, PTOUCHINPUT, int ); BOOL (WINAPI *RegisterTouchWindow)( HWND, ULONG ); + BOOL (WINAPI *SetProcessDPIAware)( void ); + BOOL (WINAPI *SetProcessDpiAwarenessContext)( DPI_AWARENESS_CONTEXT ); + DPI_AWARENESS_CONTEXT (WINAPI *SetThreadDpiAwarenessContext)( DPI_AWARENESS_CONTEXT ); + DPI_AWARENESS_CONTEXT (WINAPI *GetThreadDpiAwarenessContext)( void ); + DPI_AWARENESS (WINAPI *GetAwarenessFromDpiAwarenessContext)( DPI_AWARENESS_CONTEXT ); + BOOL (WINAPI *EnableNonClientDpiScaling)( HWND ); + BOOL (WINAPI *AdjustWindowRectExForDpi)( LPRECT, DWORD, BOOL, DWORD, UINT ); + UINT (WINAPI *GetDpiForWindow)( HWND ); + BOOL (WINAPI *AreDpiAwarenessContextsEqual)(DPI_AWARENESS_CONTEXT, DPI_AWARENESS_CONTEXT); + BOOL (WINAPI *IsValidDpiAwarenessContext)(DPI_AWARENESS_CONTEXT); void* shcoreDLL; HRESULT (WINAPI *GetDpiForMonitor)( HMONITOR hmonitor, MONITOR_DPI_TYPE dpiType, UINT *dpiX, UINT *dpiY ); - + HRESULT (WINAPI *SetProcessDpiAwareness)(PROCESS_DPI_AWARENESS dpiAwareness); +#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ + + SDL_bool dpi_scaling_enabled; + + #ifndef SDL_DISABLE_WINDOWS_IME SDL_bool ime_com_initialized; struct ITfThreadMgr *ime_threadmgr; SDL_bool ime_initialized; @@ -192,6 +444,7 @@ TSFSink *ime_uielemsink; TSFSink *ime_ippasink; LONG ime_uicontext; +#endif /* !SDL_DISABLE_WINDOWS_IME */ BYTE pre_hook_key_state[256]; UINT _SDL_WAKEUP; @@ -203,6 +456,8 @@ typedef struct IDirect3D9 IDirect3D9; extern SDL_bool D3D_LoadDLL( void **pD3DDLL, IDirect3D9 **pDirect3D9Interface ); +extern SDL_bool WIN_IsPerMonitorV2DPIAware(_THIS); + #endif /* SDL_windowsvideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowswindow.c libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowswindow.c --- libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowswindow.c 2022-04-21 17:37:37.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowswindow.c 2022-08-13 03:48:10.000000000 +0000 @@ -24,10 +24,12 @@ #include "../../core/windows/SDL_windows.h" +#include "SDL_log.h" #include "../SDL_sysvideo.h" #include "../SDL_pixels_c.h" #include "../../events/SDL_keyboard_c.h" #include "../../events/SDL_mouse_c.h" +#include "../../events/SDL_windowevents_c.h" #include "../../SDL_hints_c.h" #include "SDL_windowsvideo.h" @@ -46,6 +48,8 @@ #define SWP_NOCOPYBITS 0 #endif +/* #define HIGHDPI_DEBUG */ + /* Fake window to help with DirectInput events. */ HWND SDL_HelperWindow = NULL; static const TCHAR *SDL_HelperWindowClassName = TEXT("SDLHelperWindowInputCatcher"); @@ -113,26 +117,95 @@ return style; } +/** + * Returns arguments to pass to SetWindowPos - the window rect, including frame, in Windows coordinates. + * Can be called before we have a HWND. + */ static void WIN_AdjustWindowRectWithStyle(SDL_Window *window, DWORD style, BOOL menu, int *x, int *y, int *width, int *height, SDL_bool use_current) { + SDL_VideoData* videodata = SDL_GetVideoDevice() ? SDL_GetVideoDevice()->driverdata : NULL; RECT rect; + int dpi = 96; +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) + UINT frame_dpi; +#endif + + /* Client rect, in SDL screen coordinates */ + *x = (use_current ? window->x : window->windowed.x); + *y = (use_current ? window->y : window->windowed.y); + *width = (use_current ? window->w : window->windowed.w); + *height = (use_current ? window->h : window->windowed.h); + + /* Convert client rect from SDL coordinates to pixels (no-op if DPI scaling not enabled) */ +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) + WIN_ScreenPointFromSDL(x, y, &dpi); +#endif + /* Note, use the guessed DPI returned from WIN_ScreenPointFromSDL rather than the cached one in + data->scaling_dpi. + + - This is called before the window is created, so we can't rely on data->scaling_dpi + - Bug workaround: when leaving exclusive fullscreen, the cached DPI and window DPI reported + by GetDpiForWindow will be wrong, and would cause windows shrinking slightly when + going from exclusive fullscreen to windowed on a HighDPI monitor with scaling if we used them. + */ + *width = MulDiv(*width, dpi, 96); + *height = MulDiv(*height, dpi, 96); + /* Copy the client size in pixels into this rect structure, + which we'll then adjust with AdjustWindowRectEx */ rect.left = 0; rect.top = 0; - rect.right = (use_current ? window->w : window->windowed.w); - rect.bottom = (use_current ? window->h : window->windowed.h); + rect.right = *width; + rect.bottom = *height; /* borderless windows will have WM_NCCALCSIZE return 0 for the non-client area. When this happens, it looks like windows will send a resize message expanding the window client area to the previous window + chrome size, so shouldn't need to adjust the window size for the set styles. */ - if (!(window->flags & SDL_WINDOW_BORDERLESS)) + if (!(window->flags & SDL_WINDOW_BORDERLESS)) { +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) AdjustWindowRectEx(&rect, style, menu, 0); +#else + if (WIN_IsPerMonitorV2DPIAware(SDL_GetVideoDevice())) { + /* With per-monitor v2, the window border/titlebar size depend on the DPI, so we need to call AdjustWindowRectExForDpi instead of + AdjustWindowRectEx. */ + UINT unused; + RECT screen_rect; + HMONITOR mon; + + screen_rect.left = *x; + screen_rect.top = *y; + screen_rect.right = *x + *width; + screen_rect.bottom = *y + *height; + + mon = MonitorFromRect(&screen_rect, MONITOR_DEFAULTTONEAREST); + + /* GetDpiForMonitor docs promise to return the same hdpi / vdpi */ + if (videodata->GetDpiForMonitor(mon, MDT_EFFECTIVE_DPI, &frame_dpi, &unused) != S_OK) { + frame_dpi = 96; + } - *x = (use_current ? window->x : window->windowed.x) + rect.left; - *y = (use_current ? window->y : window->windowed.y) + rect.top; + videodata->AdjustWindowRectExForDpi(&rect, style, menu, 0, frame_dpi); + } else { + AdjustWindowRectEx(&rect, style, menu, 0); + } +#endif + } + + /* Final rect in Windows screen space, including the frame */ + *x += rect.left; + *y += rect.top; *width = (rect.right - rect.left); *height = (rect.bottom - rect.top); + +#ifdef HIGHDPI_DEBUG + SDL_Log("WIN_AdjustWindowRectWithStyle: in: %d, %d, %dx%d, returning: %d, %d, %dx%d, used dpi %d for frame calculation", + (use_current ? window->x : window->windowed.x), + (use_current ? window->y : window->windowed.y), + (use_current ? window->w : window->windowed.w), + (use_current ? window->h : window->windowed.h), + *x, *y, *width, *height, frame_dpi); +#endif } static void @@ -144,7 +217,11 @@ BOOL menu; style = GetWindowLong(hwnd, GWL_STYLE); +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) + menu = FALSE; +#else menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); +#endif WIN_AdjustWindowRectWithStyle(window, style, menu, x, y, width, height, use_current); } @@ -179,6 +256,47 @@ } static int +WIN_GetScalingDPIForHWND(const SDL_VideoData *videodata, HWND hwnd) +{ +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) + return 96; +#else + /* DPI scaling not requested? */ + if (!videodata->dpi_scaling_enabled) { + return 96; + } + + /* Window 10+ */ + if (videodata->GetDpiForWindow) { + return videodata->GetDpiForWindow(hwnd); + } + + /* Window 8.1+ */ + if (videodata->GetDpiForMonitor) { + HMONITOR monitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST); + if (monitor) { + UINT dpi_uint, unused; + if (S_OK == videodata->GetDpiForMonitor(monitor, MDT_EFFECTIVE_DPI, &dpi_uint, &unused)) { + return (int)dpi_uint; + } + } + return 96; + } + + /* Windows Vista-8.0 */ + { + HDC hdc = GetDC(NULL); + if (hdc) { + int dpi = GetDeviceCaps(hdc, LOGPIXELSX); + ReleaseDC(NULL, hdc); + return dpi; + } + return 96; + } +#endif +} + +static int SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, HWND parent, SDL_bool created) { SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; @@ -192,7 +310,9 @@ data->window = window; data->hwnd = hwnd; data->parent = parent; +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) data->hdc = GetDC(hwnd); +#endif data->hinstance = (HINSTANCE) GetWindowLongPtr(hwnd, GWLP_HINSTANCE); data->created = created; data->high_surrogate = 0; @@ -200,17 +320,24 @@ data->last_pointer_update = (LPARAM)-1; data->videodata = videodata; data->initializing = SDL_TRUE; + data->scaling_dpi = WIN_GetScalingDPIForHWND(videodata, hwnd); + +#ifdef HIGHDPI_DEBUG + SDL_Log("SetupWindowData: initialized data->scaling_dpi to %d", data->scaling_dpi); +#endif SDL_AddHintCallback(SDL_HINT_MOUSE_RELATIVE_MODE_CENTER, WIN_MouseRelativeModeCenterChanged, data); window->driverdata = data; +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) /* Associate the data with the window */ if (!SetProp(hwnd, TEXT("SDL_WindowData"), data)) { ReleaseDC(hwnd, data->hdc); SDL_free(data); return WIN_SetError("SetProp() failed"); } +#endif /* Set up the window proc function */ #ifdef GWLP_WNDPROC @@ -235,27 +362,37 @@ if (GetClientRect(hwnd, &rect)) { int w = rect.right; int h = rect.bottom; + + WIN_ClientPointToSDL(window, &w, &h); if ((window->windowed.w && window->windowed.w != w) || (window->windowed.h && window->windowed.h != h)) { /* We tried to create a window larger than the desktop and Windows didn't allow it. Override! */ int x, y; /* Figure out what the window area will be */ WIN_AdjustWindowRect(window, &x, &y, &w, &h, SDL_FALSE); + data->expected_resize = SDL_TRUE; SetWindowPos(hwnd, HWND_NOTOPMOST, x, y, w, h, SWP_NOCOPYBITS | SWP_NOZORDER | SWP_NOACTIVATE); + data->expected_resize = SDL_FALSE; } else { window->w = w; window->h = h; } } } +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) { POINT point; point.x = 0; point.y = 0; if (ClientToScreen(hwnd, &point)) { - window->x = point.x; - window->y = point.y; + int x = point.x; + int y = point.y; + WIN_ScreenPointToSDL(&x, &y); + window->x = x; + window->y = y; } } + WIN_UpdateWindowICCProfile(window, SDL_FALSE); +#endif { DWORD style = GetWindowLong(hwnd, GWL_STYLE); if (style & WS_VISIBLE) { @@ -290,16 +427,27 @@ window->flags &= ~SDL_WINDOW_MINIMIZED; } } +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) + window->flags |= SDL_WINDOW_INPUT_FOCUS; +#else if (GetFocus() == hwnd) { window->flags |= SDL_WINDOW_INPUT_FOCUS; SDL_SetKeyboardFocus(window); WIN_UpdateClipCursor(window); } +#endif +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) /* Enable multi-touch */ if (videodata->RegisterTouchWindow) { videodata->RegisterTouchWindow(hwnd, (TWF_FINETOUCH|TWF_WANTPALM)); } +#endif + + /* Force the SDL_WINDOW_ALLOW_HIGHDPI window flag if we are doing DPI scaling */ + if (videodata->dpi_scaling_enabled) { + window->flags |= SDL_WINDOW_ALLOW_HIGHDPI; + } data->initializing = SDL_FALSE; @@ -314,11 +462,16 @@ if (data) { SDL_DelHintCallback(SDL_HINT_MOUSE_RELATIVE_MODE_CENTER, WIN_MouseRelativeModeCenterChanged, data); +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) + if (data->ICMFileName) { + SDL_free(data->ICMFileName); + } if (data->keyboard_hook) { UnhookWindowsHookEx(data->keyboard_hook); } ReleaseDC(data->hwnd, data->hdc); RemoveProp(data->hwnd, TEXT("SDL_WindowData")); +#endif if (data->created) { DestroyWindow(data->hwnd); if (data->parent) { @@ -420,6 +573,9 @@ int WIN_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) { +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) + return -1; +#else HWND hwnd = (HWND) data; LPTSTR title; int titleLen; @@ -471,20 +627,24 @@ } #endif return 0; +#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ } void WIN_SetWindowTitle(_THIS, SDL_Window * window) { +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; LPTSTR title = WIN_UTF8ToString(window->title); SetWindowText(hwnd, title); SDL_free(title); +#endif } void WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) { +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; HICON hicon = NULL; BYTE *icon_bmp; @@ -536,12 +696,16 @@ /* Set the icon in the task manager (should we do this?) */ SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM) hicon); +#endif } void WIN_SetWindowPosition(_THIS, SDL_Window * window) { - WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOSIZE | SWP_NOACTIVATE); + /* HighDPI support: removed SWP_NOSIZE. If the move results in a DPI change, we need to allow + * the window to resize (e.g. AdjustWindowRectExForDpi frame sizes are different). + */ + WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOACTIVATE); } void @@ -553,6 +717,21 @@ int WIN_GetWindowBordersSize(_THIS, SDL_Window * window, int *top, int *left, int *bottom, int *right) { +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) + HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; + RECT rcClient; + + /* rcClient stores the size of the inner window, while rcWindow stores the outer size relative to the top-left + * screen position; so the top/left values of rcClient are always {0,0} and bottom/right are {height,width} */ + GetClientRect(hwnd, &rcClient); + + *top = rcClient.top; + *left = rcClient.left; + *bottom = rcClient.bottom; + *right = rcClient.right; + + return 0; +#else /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; RECT rcClient, rcWindow; POINT ptDiff; @@ -591,6 +770,7 @@ *right = rcWindow.right - rcClient.right; return 0; +#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ } void @@ -619,6 +799,7 @@ void WIN_RaiseWindow(_THIS, SDL_Window * window) { +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) /* If desired, raise the window more forcefully. * Technique taken from http://stackoverflow.com/questions/916259/ . * Specifically, http://stackoverflow.com/a/34414846 . @@ -651,6 +832,7 @@ SetFocus(hwnd); SetActiveWindow(hwnd); } +#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ } void @@ -723,12 +905,17 @@ data->expected_resize = SDL_FALSE; } +/** + * Reconfigures the window to fill the given display, if fullscreen is true, otherwise restores the window. + */ void WIN_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen) { +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) + SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata; SDL_WindowData *data = (SDL_WindowData *) window->driverdata; HWND hwnd = data->hwnd; - SDL_Rect bounds; + MONITORINFO minfo; DWORD style; HWND top; int x, y; @@ -741,6 +928,10 @@ return; } +#ifdef HIGHDPI_DEBUG + SDL_Log("WIN_SetWindowFullscreen: %d", (int)fullscreen); +#endif + if (SDL_ShouldAllowTopmost() && (window->flags & SDL_WINDOW_ALWAYS_ON_TOP)) { top = HWND_TOPMOST; } else { @@ -751,13 +942,20 @@ style &= ~STYLE_MASK; style |= GetWindowStyle(window); - WIN_GetDisplayBounds(_this, display, &bounds); + /* Use GetMonitorInfo instead of WIN_GetDisplayBounds because we want the + monitor bounds in Windows coordinates (pixels) rather than SDL coordinates (points). */ + SDL_zero(minfo); + minfo.cbSize = sizeof(MONITORINFO); + if (!GetMonitorInfo(displaydata->MonitorHandle, &minfo)) { + SDL_SetError("GetMonitorInfo failed"); + return; + } if (fullscreen) { - x = bounds.x; - y = bounds.y; - w = bounds.w; - h = bounds.h; + x = minfo.rcMonitor.left; + y = minfo.rcMonitor.top; + w = minfo.rcMonitor.right - minfo.rcMonitor.left; + h = minfo.rcMonitor.bottom - minfo.rcMonitor.top; /* Unset the maximized flag. This fixes https://bugzilla.libsdl.org/show_bug.cgi?id=3215 @@ -787,8 +985,15 @@ data->expected_resize = SDL_TRUE; SetWindowPos(hwnd, top, x, y, w, h, SWP_NOCOPYBITS | SWP_NOACTIVATE); data->expected_resize = SDL_FALSE; + +#ifdef HIGHDPI_DEBUG + SDL_Log("WIN_SetWindowFullscreen: %d finished. Set window to %d,%d, %dx%d", (int)fullscreen, x, y, w, h); +#endif + +#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ } +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) int WIN_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp) { @@ -808,29 +1013,53 @@ return succeeded ? 0 : -1; } -void* -WIN_GetWindowICCProfile(_THIS, SDL_Window * window, size_t * size) +void +WIN_UpdateWindowICCProfile(SDL_Window * window, SDL_bool send_event) { - SDL_VideoDisplay* display = SDL_GetDisplayForWindow(window); - SDL_DisplayData* data = (SDL_DisplayData*)display->driverdata; - HDC hdc; - BOOL succeeded = FALSE; - WCHAR filename[MAX_PATH]; - DWORD fileNameSize = MAX_PATH; - void* iccProfileData = NULL; + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); + SDL_DisplayData *displaydata = display ? (SDL_DisplayData*)display->driverdata : NULL; - hdc = CreateDCW(data->DeviceName, NULL, NULL, NULL); - if (hdc) { - succeeded = GetICMProfileW(hdc, &fileNameSize, filename); - DeleteDC(hdc); + if (displaydata) { + HDC hdc = CreateDCW(displaydata->DeviceName, NULL, NULL, NULL); + if (hdc) { + WCHAR fileName[MAX_PATH]; + DWORD fileNameSize = SDL_arraysize(fileName); + if (GetICMProfileW(hdc, &fileNameSize, fileName)) { + /* fileNameSize includes '\0' on return */ + if (!data->ICMFileName || + SDL_wcscmp(data->ICMFileName, fileName) != 0) { + if (data->ICMFileName) { + SDL_free(data->ICMFileName); + } + data->ICMFileName = SDL_wcsdup(fileName); + if (send_event) { + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_ICCPROF_CHANGED, 0, 0); + } + } + } + DeleteDC(hdc); + } } +} - if (succeeded) { - iccProfileData = SDL_LoadFile(WIN_StringToUTF8(filename), size); - if (!iccProfileData) +void * +WIN_GetWindowICCProfile(_THIS, SDL_Window * window, size_t * size) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + char *filename_utf8; + void *iccProfileData = NULL; + + filename_utf8 = WIN_StringToUTF8(data->ICMFileName); + if (filename_utf8) { + iccProfileData = SDL_LoadFile(filename_utf8, size); + if (!iccProfileData) { SDL_SetError("Could not open ICC profile"); + } + SDL_free(filename_utf8); + } else { + SDL_OutOfMemory(); } - return iccProfileData; } @@ -918,6 +1147,7 @@ WIN_UngrabKeyboard(window); } } +#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ void WIN_DestroyWindow(_THIS, SDL_Window * window) @@ -945,8 +1175,8 @@ return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d", - SDL_MAJOR_VERSION, SDL_MINOR_VERSION); + SDL_SetError("Application not compiled with SDL %d", + SDL_MAJOR_VERSION); return SDL_FALSE; } } @@ -1020,6 +1250,7 @@ } } +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) void WIN_OnWindowEnter(_THIS, SDL_Window * window) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; @@ -1078,12 +1309,19 @@ ClientToScreen(data->hwnd, (LPPOINT) & rect); ClientToScreen(data->hwnd, (LPPOINT) & rect + 1); if (window->mouse_rect.w > 0 && window->mouse_rect.h > 0) { + SDL_Rect mouse_rect_win_client; RECT mouse_rect, intersection; - mouse_rect.left = rect.left + window->mouse_rect.x; - mouse_rect.top = rect.top + window->mouse_rect.y; - mouse_rect.right = mouse_rect.left + window->mouse_rect.w - 1; - mouse_rect.bottom = mouse_rect.top + window->mouse_rect.h - 1; + /* mouse_rect_win_client is the mouse rect in Windows client space */ + mouse_rect_win_client = window->mouse_rect; + WIN_ClientPointFromSDL(window, &mouse_rect_win_client.x, &mouse_rect_win_client.y); + WIN_ClientPointFromSDL(window, &mouse_rect_win_client.w, &mouse_rect_win_client.h); + + /* mouse_rect is the rect in Windows screen space */ + mouse_rect.left = rect.left + mouse_rect_win_client.x; + mouse_rect.top = rect.top + mouse_rect_win_client.y; + mouse_rect.right = mouse_rect.left + mouse_rect_win_client.w; + mouse_rect.bottom = mouse_rect.top + mouse_rect_win_client.h; if (IntersectRect(&intersection, &rect, &mouse_rect)) { SDL_memcpy(&rect, &intersection, sizeof(rect)); } else if ((window->flags & SDL_WINDOW_MOUSE_GRABBED) != 0) { @@ -1125,10 +1363,14 @@ { return 0; /* just succeed, the real work is done elsewhere. */ } +#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ int WIN_SetWindowOpacity(_THIS, SDL_Window * window, float opacity) { +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) + return -1; +#else const SDL_WindowData *data = (SDL_WindowData *) window->driverdata; const HWND hwnd = data->hwnd; const LONG style = GetWindowLong(hwnd, GWL_EXSTYLE); @@ -1157,8 +1399,65 @@ } return 0; +#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ +} + +/** + * Returns the drawable size in pixels (GetClientRect). + */ +void +WIN_GetDrawableSize(const SDL_Window *window, int *w, int *h) +{ + const SDL_WindowData *data = ((SDL_WindowData *)window->driverdata); + HWND hwnd = data->hwnd; + RECT rect; + + if (GetClientRect(hwnd, &rect)) { + *w = rect.right; + *h = rect.bottom; + } else { + *w = 0; + *h = 0; + } +} + +/** + * Convert a point in the client area from pixels to DPI-scaled points. + * + * No-op if DPI scaling is not enabled. + */ +void +WIN_ClientPointToSDL(const SDL_Window *window, int *x, int *y) +{ + const SDL_WindowData *data = ((SDL_WindowData *)window->driverdata); + const SDL_VideoData *videodata = data->videodata; + + if (!videodata->dpi_scaling_enabled) + return; + + *x = MulDiv(*x, 96, data->scaling_dpi); + *y = MulDiv(*y, 96, data->scaling_dpi); +} + +/** + * Convert a point in the client area from DPI-scaled points to pixels. + * + * No-op if DPI scaling is not enabled. + */ +void +WIN_ClientPointFromSDL(const SDL_Window *window, int *x, int *y) +{ + const SDL_WindowData *data = ((SDL_WindowData *)window->driverdata); + const SDL_VideoData *videodata = data->videodata; + + if (!videodata->dpi_scaling_enabled) + return; + + *x = MulDiv(*x, data->scaling_dpi, 96); + *y = MulDiv(*y, data->scaling_dpi, 96); } +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) void WIN_AcceptDragAndDrop(SDL_Window * window, SDL_bool accept) { @@ -1193,6 +1492,7 @@ return 0; } +#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ #endif /* SDL_VIDEO_DRIVER_WINDOWS */ diff -Nru libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowswindow.h libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowswindow.h --- libsdl2-2.0.22+dfsg/src/video/windows/SDL_windowswindow.h 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/windows/SDL_windowswindow.h 2022-08-13 03:48:10.000000000 +0000 @@ -25,6 +25,13 @@ #if SDL_VIDEO_OPENGL_EGL #include "../SDL_egl_c.h" +#else +#include "../SDL_sysvideo.h" +#endif + +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { #endif typedef struct @@ -55,10 +62,16 @@ RECT cursor_clipped_rect; SDL_Point last_raw_mouse_position; SDL_bool mouse_tracked; + WCHAR *ICMFileName; struct SDL_VideoData *videodata; #if SDL_VIDEO_OPENGL_EGL EGLSurface egl_surface; #endif + /** + * Cached value of GetDpiForWindow, for use for scaling points in the client area + * between dpi-scaled points and pixels. Only used if videodata->dpi_scaling_enabled. + */ + int scaling_dpi; } SDL_WindowData; extern int WIN_CreateWindow(_THIS, SDL_Window * window); @@ -80,6 +93,7 @@ extern void WIN_SetWindowAlwaysOnTop(_THIS, SDL_Window * window, SDL_bool on_top); extern void WIN_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen); extern int WIN_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp); +extern void WIN_UpdateWindowICCProfile(SDL_Window * window, SDL_bool send_event); extern void* WIN_GetWindowICCProfile(_THIS, SDL_Window * window, size_t * size); extern int WIN_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp); extern void WIN_SetWindowMouseRect(_THIS, SDL_Window * window); @@ -91,9 +105,17 @@ extern void WIN_OnWindowEnter(_THIS, SDL_Window * window); extern void WIN_UpdateClipCursor(SDL_Window *window); extern int WIN_SetWindowHitTest(SDL_Window *window, SDL_bool enabled); +extern void WIN_GetDrawableSize(const SDL_Window *window, int *w, int *h); +extern void WIN_ClientPointToSDL(const SDL_Window *window, int *w, int *h); +extern void WIN_ClientPointFromSDL(const SDL_Window *window, int *w, int *h); extern void WIN_AcceptDragAndDrop(SDL_Window * window, SDL_bool accept); extern int WIN_FlashWindow(_THIS, SDL_Window * window, SDL_FlashOperation operation); +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif + #endif /* SDL_windowswindow_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/video/windows/wmmsg.h libsdl2-2.24.0+dfsg/src/video/windows/wmmsg.h --- libsdl2-2.0.22+dfsg/src/video/windows/wmmsg.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/windows/wmmsg.h 2022-06-16 20:16:31.000000000 +0000 @@ -762,7 +762,7 @@ "UNKNOWN (737)", "UNKNOWN (738)", "UNKNOWN (739)", - "UNKNOWN (740)", + "WM_GETDPISCALEDSIZE", "UNKNOWN (741)", "UNKNOWN (742)", "UNKNOWN (743)", diff -Nru libsdl2-2.0.22+dfsg/src/video/winrt/SDL_winrtopengles.cpp libsdl2-2.24.0+dfsg/src/video/winrt/SDL_winrtopengles.cpp --- libsdl2-2.0.22+dfsg/src/video/winrt/SDL_winrtopengles.cpp 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/winrt/SDL_winrtopengles.cpp 2022-06-16 20:16:31.000000000 +0000 @@ -63,7 +63,7 @@ } /* Load ANGLE/WinRT-specific functions */ - CreateWinrtEglWindow_Old_Function CreateWinrtEglWindow = (CreateWinrtEglWindow_Old_Function) SDL_LoadFunction(_this->egl_data->egl_dll_handle, "CreateWinrtEglWindow"); + CreateWinrtEglWindow_Old_Function CreateWinrtEglWindow = (CreateWinrtEglWindow_Old_Function) SDL_LoadFunction(_this->egl_data->opengl_dll_handle, "CreateWinrtEglWindow"); if (CreateWinrtEglWindow) { /* 'CreateWinrtEglWindow' was found, which means that an an older * version of ANGLE/WinRT is being used. Continue setting up EGL, diff -Nru libsdl2-2.0.22+dfsg/src/video/winrt/SDL_winrtvideo.cpp libsdl2-2.24.0+dfsg/src/video/winrt/SDL_winrtvideo.cpp --- libsdl2-2.0.22+dfsg/src/video/winrt/SDL_winrtvideo.cpp 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/winrt/SDL_winrtvideo.cpp 2022-08-13 03:48:10.000000000 +0000 @@ -117,7 +117,7 @@ } static SDL_VideoDevice * -WINRT_CreateDevice(int devindex) +WINRT_CreateDevice(void) { SDL_VideoDevice *device; SDL_VideoData *data; @@ -834,8 +834,8 @@ info->info.winrt.window = reinterpret_cast(data->coreWindow.Get()); return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d", - SDL_MAJOR_VERSION, SDL_MINOR_VERSION); + SDL_SetError("Application not compiled with SDL %d", + SDL_MAJOR_VERSION); return SDL_FALSE; } return SDL_FALSE; diff -Nru libsdl2-2.0.22+dfsg/src/video/x11/SDL_x11dyn.c libsdl2-2.24.0+dfsg/src/video/x11/SDL_x11dyn.c --- libsdl2-2.0.22+dfsg/src/video/x11/SDL_x11dyn.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/x11/SDL_x11dyn.c 2022-06-02 02:01:57.000000000 +0000 @@ -47,9 +47,6 @@ #ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR NULL #endif -#ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA -#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA NULL -#endif #ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 NULL #endif @@ -62,20 +59,15 @@ #ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS NULL #endif -#ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE -#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE NULL -#endif static x11dynlib x11libs[] = { {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC}, {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT}, {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR}, - {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA}, {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2}, {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES}, {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR}, - {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS}, - {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE} + {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS} }; static void * diff -Nru libsdl2-2.0.22+dfsg/src/video/x11/SDL_x11dyn.h libsdl2-2.24.0+dfsg/src/video/x11/SDL_x11dyn.h --- libsdl2-2.0.22+dfsg/src/video/x11/SDL_x11dyn.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/x11/SDL_x11dyn.h 2022-06-02 02:01:57.000000000 +0000 @@ -52,9 +52,6 @@ #if SDL_VIDEO_DRIVER_X11_XDBE #include #endif -#if SDL_VIDEO_DRIVER_X11_XINERAMA -#include -#endif #if SDL_VIDEO_DRIVER_X11_XINPUT2 #include #endif @@ -70,9 +67,6 @@ #if SDL_VIDEO_DRIVER_X11_XSHAPE #include #endif -#if SDL_VIDEO_DRIVER_X11_XVIDMODE -#include -#endif #ifdef __cplusplus extern "C" diff -Nru libsdl2-2.0.22+dfsg/src/video/x11/SDL_x11events.c libsdl2-2.24.0+dfsg/src/video/x11/SDL_x11events.c --- libsdl2-2.0.22+dfsg/src/video/x11/SDL_x11events.c 2022-04-25 18:10:22.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/x11/SDL_x11events.c 2022-08-13 03:48:10.000000000 +0000 @@ -729,6 +729,23 @@ ev->xreparent.serial == unmap->serial; } +static int +XLookupStringAsUTF8(XKeyEvent *event_struct, char *buffer_return, int bytes_buffer, KeySym *keysym_return, XComposeStatus *status_in_out) +{ + int result = X11_XLookupString(event_struct, buffer_return, bytes_buffer, keysym_return, status_in_out); + if (result > 0) { + char *utf8_text = SDL_iconv_string("UTF-8", "ISO-8859-1", buffer_return, result); + if (utf8_text) { + SDL_strlcpy(buffer_return, utf8_text, bytes_buffer); + SDL_free(utf8_text); + return SDL_strlen(buffer_return); + } else { + return 0; + } + } + return result; +} + static void X11_DispatchEvent(_THIS, XEvent *xevent) { @@ -785,6 +802,12 @@ } #endif +#if SDL_VIDEO_DRIVER_X11_XRANDR + if (videodata->xrandr_event_base && (xevent->type == (videodata->xrandr_event_base + RRNotify))) { + X11_HandleXRandREvent(_this, xevent); + } +#endif + /* Send a SDL_SYSWMEVENT if the application wants them */ if (SDL_GetEventState(SDL_SYSWMEVENT) == SDL_ENABLE) { SDL_SysWMmsg wmmsg; @@ -836,8 +859,7 @@ X11_XRefreshKeyboardMapping(&xevent->xmapping); } - X11_UpdateKeymap(_this); - SDL_SendKeymapChangedEvent(); + X11_UpdateKeymap(_this, SDL_TRUE); } else if (xevent->type == PropertyNotify && videodata && videodata->windowlist) { char* name_of_atom = X11_XGetAtomName(display, xevent->xproperty.atom); @@ -1042,10 +1064,10 @@ X11_Xutf8LookupString(data->ic, &xevent->xkey, text, sizeof(text), &keysym, &status); } else { - X11_XLookupString(&xevent->xkey, text, sizeof(text), &keysym, NULL); + XLookupStringAsUTF8(&xevent->xkey, text, sizeof(text), &keysym, NULL); } #else - X11_XLookupString(&xevent->xkey, text, sizeof(text), &keysym, NULL); + XLookupStringAsUTF8(&xevent->xkey, text, sizeof(text), &keysym, NULL); #endif #ifdef SDL_USE_IME @@ -1059,7 +1081,7 @@ if (xevent->xkey.keycode != videodata->filter_code || xevent->xkey.time != videodata->filter_time) { SDL_SendKeyboardKey(SDL_PRESSED, videodata->key_layout[keycode]); } - if(*text) { + if (*text) { SDL_SendKeyboardText(text); } } else { @@ -1464,8 +1486,7 @@ icon). Since it changes the XKLAVIER_STATE property, we notice and reinit our keymap here. This might not be the right approach, but it seems to work. */ - X11_UpdateKeymap(_this); - SDL_SendKeymapChangedEvent(); + X11_UpdateKeymap(_this, SDL_TRUE); } else if (xevent->xproperty.atom == videodata->_NET_FRAME_EXTENTS) { Atom type; int format; diff -Nru libsdl2-2.0.22+dfsg/src/video/x11/SDL_x11keyboard.c libsdl2-2.24.0+dfsg/src/video/x11/SDL_x11keyboard.c --- libsdl2-2.0.22+dfsg/src/video/x11/SDL_x11keyboard.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/x11/SDL_x11keyboard.c 2022-08-13 03:48:10.000000000 +0000 @@ -37,7 +37,7 @@ #include #endif -/* *INDENT-OFF* */ +/* *INDENT-OFF* */ /* clang-format off */ static const struct { KeySym keysym; SDL_Scancode scancode; @@ -160,7 +160,7 @@ { xfree86_scancode_table2, SDL_arraysize(xfree86_scancode_table2) }, { xvnc_scancode_table, SDL_arraysize(xvnc_scancode_table) }, }; -/* *INDENT-OFF* */ +/* *INDENT-OFF* */ /* clang-format off */ /* This function only works for keyboards in US QWERTY layout */ static SDL_Scancode @@ -267,13 +267,6 @@ int best_index; int distance; Bool xkb_repeat = 0; - XKeyboardState values; - SDL_zero(values); - values.global_auto_repeat = AutoRepeatModeOff; - - X11_XGetKeyboardControl(data->display, &values); - if (values.global_auto_repeat != AutoRepeatModeOn) - X11_XAutoRepeatOn(data->display); #if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM { @@ -401,7 +394,7 @@ } } - X11_UpdateKeymap(_this); + X11_UpdateKeymap(_this, SDL_FALSE); SDL_SetScancodeName(SDL_SCANCODE_APPLICATION, "Menu"); @@ -415,7 +408,7 @@ } void -X11_UpdateKeymap(_THIS) +X11_UpdateKeymap(_THIS, SDL_bool send_event) { SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; int i; @@ -475,7 +468,7 @@ } } } - SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES); + SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES, send_event); } void @@ -533,7 +526,7 @@ } void -X11_SetTextInputRect(_THIS, SDL_Rect *rect) +X11_SetTextInputRect(_THIS, const SDL_Rect *rect) { if (!rect) { SDL_InvalidParamError("rect"); diff -Nru libsdl2-2.0.22+dfsg/src/video/x11/SDL_x11keyboard.h libsdl2-2.24.0+dfsg/src/video/x11/SDL_x11keyboard.h --- libsdl2-2.0.22+dfsg/src/video/x11/SDL_x11keyboard.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/x11/SDL_x11keyboard.h 2022-08-13 03:48:10.000000000 +0000 @@ -24,11 +24,11 @@ #define SDL_x11keyboard_h_ extern int X11_InitKeyboard(_THIS); -extern void X11_UpdateKeymap(_THIS); +extern void X11_UpdateKeymap(_THIS, SDL_bool send_event); extern void X11_QuitKeyboard(_THIS); extern void X11_StartTextInput(_THIS); extern void X11_StopTextInput(_THIS); -extern void X11_SetTextInputRect(_THIS, SDL_Rect *rect); +extern void X11_SetTextInputRect(_THIS, const SDL_Rect *rect); extern KeySym X11_KeyCodeToSym(_THIS, KeyCode, unsigned char group); #endif /* SDL_x11keyboard_h_ */ diff -Nru libsdl2-2.0.22+dfsg/src/video/x11/SDL_x11modes.c libsdl2-2.24.0+dfsg/src/video/x11/SDL_x11modes.c --- libsdl2-2.0.22+dfsg/src/video/x11/SDL_x11modes.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/x11/SDL_x11modes.c 2022-08-13 03:48:10.000000000 +0000 @@ -148,62 +148,6 @@ return SDL_PIXELFORMAT_UNKNOWN; } -#if SDL_VIDEO_DRIVER_X11_XINERAMA -static SDL_bool -CheckXinerama(Display * display, int *major, int *minor) -{ - int event_base = 0; - int error_base = 0; - - /* Default the extension not available */ - *major = *minor = 0; - - /* Allow environment override */ - if (!SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_XINERAMA, SDL_TRUE)) { -#ifdef X11MODES_DEBUG - printf("Xinerama disabled due to hint\n"); -#endif - return SDL_FALSE; - } - - if (!SDL_X11_HAVE_XINERAMA) { -#ifdef X11MODES_DEBUG - printf("Xinerama support not available\n"); -#endif - return SDL_FALSE; - } - - /* Query the extension version */ - if (!X11_XineramaQueryExtension(display, &event_base, &error_base) || - !X11_XineramaQueryVersion(display, major, minor) || - !X11_XineramaIsActive(display)) { -#ifdef X11MODES_DEBUG - printf("Xinerama not active on the display\n"); -#endif - return SDL_FALSE; - } -#ifdef X11MODES_DEBUG - printf("Xinerama available at version %d.%d!\n", *major, *minor); -#endif - return SDL_TRUE; -} - -/* !!! FIXME: remove this later. */ -/* we have a weird bug where XineramaQueryScreens() throws an X error, so this - is here to help track it down (and not crash, too!). */ -static SDL_bool xinerama_triggered_error = SDL_FALSE; -static int -X11_XineramaFailed(Display * d, XErrorEvent * e) -{ - xinerama_triggered_error = SDL_TRUE; - fprintf(stderr, "XINERAMA X ERROR: type=%d serial=%lu err=%u req=%u minor=%u\n", - e->type, e->serial, (unsigned int) e->error_code, - (unsigned int) e->request_code, (unsigned int) e->minor_code); - fflush(stderr); - return 0; -} -#endif /* SDL_VIDEO_DRIVER_X11_XINERAMA */ - #if SDL_VIDEO_DRIVER_X11_XRANDR static SDL_bool CheckXRandR(Display * display, int *major, int *minor) @@ -345,30 +289,185 @@ #endif } + static int -GetXftDPI(Display* dpy) +X11_AddXRandRDisplay(_THIS, Display *dpy, int screen, RROutput outputid, XRRScreenResources *res, SDL_bool send_event) { - char* xdefault_resource; - int xft_dpi, err; + Atom EDID = X11_XInternAtom(dpy, "EDID", False); + XRROutputInfo *output_info; + int display_x, display_y; + unsigned long display_mm_width, display_mm_height; + SDL_DisplayData *displaydata; + char display_name[128]; + SDL_DisplayMode mode; + SDL_DisplayModeData *modedata; + SDL_VideoDisplay display; + RRMode modeID; + RRCrtc output_crtc; + XRRCrtcInfo *crtc; + XVisualInfo vinfo; + Uint32 pixelformat; + XPixmapFormatValues *pixmapformats; + int scanline_pad; + int i, n; - xdefault_resource = X11_XGetDefault(dpy, "Xft", "dpi"); + if (get_visualinfo(dpy, screen, &vinfo) < 0) { + return 0; /* uh, skip this screen? */ + } - if(!xdefault_resource) { - return 0; + pixelformat = X11_GetPixelFormatFromVisualInfo(dpy, &vinfo); + if (SDL_ISPIXELFORMAT_INDEXED(pixelformat)) { + return 0; /* Palettized video modes are no longer supported, ignore this one. */ } - /* - * It's possible for SDL_atoi to call SDL_strtol, if it fails due to a - * overflow or an underflow, it will return LONG_MAX or LONG_MIN and set - * errno to ERANGE. So we need to check for this so we dont get crazy dpi - * values - */ - xft_dpi = SDL_atoi(xdefault_resource); - err = errno; + scanline_pad = SDL_BYTESPERPIXEL(pixelformat) * 8; + pixmapformats = X11_XListPixmapFormats(dpy, &n); + if (pixmapformats) { + for (i = 0; i < n; i++) { + if (pixmapformats[i].depth == vinfo.depth) { + scanline_pad = pixmapformats[i].scanline_pad; + break; + } + } + X11_XFree(pixmapformats); + } - return err == ERANGE ? 0 : xft_dpi; + output_info = X11_XRRGetOutputInfo(dpy, res, outputid); + if (!output_info || !output_info->crtc || output_info->connection == RR_Disconnected) { + X11_XRRFreeOutputInfo(output_info); + return 0; /* ignore this one. */ + } + + SDL_strlcpy(display_name, output_info->name, sizeof(display_name)); + display_mm_width = output_info->mm_width; + display_mm_height = output_info->mm_height; + output_crtc = output_info->crtc; + X11_XRRFreeOutputInfo(output_info); + + crtc = X11_XRRGetCrtcInfo(dpy, res, output_crtc); + if (!crtc) { + return 0; /* oh well, ignore it. */ + } + + SDL_zero(mode); + modeID = crtc->mode; + mode.w = crtc->width; + mode.h = crtc->height; + mode.format = pixelformat; + + display_x = crtc->x; + display_y = crtc->y; + + X11_XRRFreeCrtcInfo(crtc); + + displaydata = (SDL_DisplayData *) SDL_calloc(1, sizeof(*displaydata)); + if (!displaydata) { + return SDL_OutOfMemory(); + } + + modedata = (SDL_DisplayModeData *) SDL_calloc(1, sizeof(SDL_DisplayModeData)); + if (!modedata) { + SDL_free(displaydata); + return SDL_OutOfMemory(); + } + + modedata->xrandr_mode = modeID; + mode.driverdata = modedata; + + displaydata->screen = screen; + displaydata->visual = vinfo.visual; + displaydata->depth = vinfo.depth; + displaydata->hdpi = display_mm_width ? (((float) mode.w) * 25.4f / display_mm_width) : 0.0f; + displaydata->vdpi = display_mm_height ? (((float) mode.h) * 25.4f / display_mm_height) : 0.0f; + displaydata->ddpi = SDL_ComputeDiagonalDPI(mode.w, mode.h, ((float) display_mm_width) / 25.4f,((float) display_mm_height) / 25.4f); + displaydata->scanline_pad = scanline_pad; + displaydata->x = display_x; + displaydata->y = display_y; + displaydata->use_xrandr = SDL_TRUE; + displaydata->xrandr_output = outputid; + + SetXRandRModeInfo(dpy, res, output_crtc, modeID, &mode); + SetXRandRDisplayName(dpy, EDID, display_name, sizeof (display_name), outputid, display_mm_width, display_mm_height); + + SDL_zero(display); + if (*display_name) { + display.name = display_name; + } + display.desktop_mode = mode; + display.current_mode = mode; + display.driverdata = displaydata; + return SDL_AddVideoDisplay(&display, send_event); } +static void +X11_HandleXRandROutputChange(_THIS, const XRROutputChangeNotifyEvent *ev) +{ + const int num_displays = SDL_GetNumVideoDisplays(); + SDL_VideoDisplay *display = NULL; + int displayidx = -1; + int i; + + #if 0 + printf("XRROutputChangeNotifyEvent! [output=%u, crtc=%u, mode=%u, rotation=%u, connection=%u]", (unsigned int) ev->output, (unsigned int) ev->crtc, (unsigned int) ev->mode, (unsigned int) ev->rotation, (unsigned int) ev->connection); + #endif + + for (i = 0; i < num_displays; i++) { + SDL_VideoDisplay *thisdisplay = SDL_GetDisplay(i); + const SDL_DisplayData *displaydata = (const SDL_DisplayData *) thisdisplay->driverdata; + if (displaydata->xrandr_output == ev->output) { + display = thisdisplay; + displayidx = i; + break; + } + } + + SDL_assert((displayidx == -1) == (display == NULL)); + + if (ev->connection == RR_Disconnected) { /* output is going away */ + if (display != NULL) { + SDL_DelVideoDisplay(displayidx); + } + } else if (ev->connection == RR_Connected) { /* output is coming online */ + if (display != NULL) { + /* !!! FIXME: update rotation or current mode of existing display? */ + } else { + Display *dpy = ev->display; + const int screen = DefaultScreen(dpy); + XVisualInfo vinfo; + if (get_visualinfo(dpy, screen, &vinfo) == 0) { + XRRScreenResources *res = X11_XRRGetScreenResourcesCurrent(dpy, RootWindow(dpy, screen)); + if (!res || res->noutput == 0) { + if (res) { + X11_XRRFreeScreenResources(res); + } + res = X11_XRRGetScreenResources(dpy, RootWindow(dpy, screen)); + } + + if (res) { + X11_AddXRandRDisplay(_this, dpy, screen, ev->output, res, SDL_TRUE); + X11_XRRFreeScreenResources(res); + } + } + } + } +} + +void +X11_HandleXRandREvent(_THIS, const XEvent *xevent) +{ + SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; + SDL_assert(xevent->type == (videodata->xrandr_event_base + RRNotify)); + + switch (((const XRRNotifyEvent *) xevent)->subtype) { + case RRNotify_OutputChange: + X11_HandleXRandROutputChange(_this, (const XRROutputChangeNotifyEvent *) xevent); + break; + default: + break; + } +} + + static int X11_InitModes_XRandR(_THIS) { @@ -377,15 +476,15 @@ const int screencount = ScreenCount(dpy); const int default_screen = DefaultScreen(dpy); RROutput primary = X11_XRRGetOutputPrimary(dpy, RootWindow(dpy, default_screen)); - Atom EDID = X11_XInternAtom(dpy, "EDID", False); XRRScreenResources *res = NULL; - Uint32 pixelformat; - XVisualInfo vinfo; - XPixmapFormatValues *pixmapformats; + int xrandr_error_base = 0; int looking_for_primary; - int scanline_pad; int output; - int screen, i, n; + int screen; + + if (!X11_XRRQueryExtension(dpy, &data->xrandr_event_base, &xrandr_error_base)) { + return SDL_SetError("XRRQueryExtension failed"); + } for (looking_for_primary = 1; looking_for_primary >= 0; looking_for_primary--) { for (screen = 0; screen < screencount; screen++) { @@ -395,27 +494,6 @@ continue; } - if (get_visualinfo(dpy, screen, &vinfo) < 0) { - continue; /* uh, skip this screen? */ - } - - pixelformat = X11_GetPixelFormatFromVisualInfo(dpy, &vinfo); - if (SDL_ISPIXELFORMAT_INDEXED(pixelformat)) { - continue; /* Palettized video modes are no longer supported */ - } - - scanline_pad = SDL_BYTESPERPIXEL(pixelformat) * 8; - pixmapformats = X11_XListPixmapFormats(dpy, &n); - if (pixmapformats) { - for (i = 0; i < n; ++i) { - if (pixmapformats[i].depth == vinfo.depth) { - scanline_pad = pixmapformats[i].scanline_pad; - break; - } - } - X11_XFree(pixmapformats); - } - res = X11_XRRGetScreenResourcesCurrent(dpy, RootWindow(dpy, screen)); if (!res || res->noutput == 0) { if (res) { @@ -429,100 +507,20 @@ } for (output = 0; output < res->noutput; output++) { - XRROutputInfo *output_info; - int display_x, display_y; - unsigned long display_mm_width, display_mm_height; - SDL_DisplayData *displaydata; - char display_name[128]; - SDL_DisplayMode mode; - SDL_DisplayModeData *modedata; - SDL_VideoDisplay display; - RRMode modeID; - RRCrtc output_crtc; - XRRCrtcInfo *crtc; - int xft_dpi = 0; - /* The primary output _should_ always be sorted first, but just in case... */ if ((looking_for_primary && (res->outputs[output] != primary)) || (!looking_for_primary && (screen == default_screen) && (res->outputs[output] == primary))) { continue; } - - output_info = X11_XRRGetOutputInfo(dpy, res, res->outputs[output]); - if (!output_info || !output_info->crtc || output_info->connection == RR_Disconnected) { - X11_XRRFreeOutputInfo(output_info); - continue; - } - - SDL_strlcpy(display_name, output_info->name, sizeof(display_name)); - display_mm_width = output_info->mm_width; - display_mm_height = output_info->mm_height; - output_crtc = output_info->crtc; - X11_XRRFreeOutputInfo(output_info); - - crtc = X11_XRRGetCrtcInfo(dpy, res, output_crtc); - if (!crtc) { - continue; - } - - SDL_zero(mode); - modeID = crtc->mode; - mode.w = crtc->width; - mode.h = crtc->height; - mode.format = pixelformat; - - display_x = crtc->x; - display_y = crtc->y; - - X11_XRRFreeCrtcInfo(crtc); - - displaydata = (SDL_DisplayData *) SDL_calloc(1, sizeof(*displaydata)); - if (!displaydata) { - return SDL_OutOfMemory(); - } - - modedata = (SDL_DisplayModeData *) SDL_calloc(1, sizeof(SDL_DisplayModeData)); - if (!modedata) { - SDL_free(displaydata); - return SDL_OutOfMemory(); - } - modedata->xrandr_mode = modeID; - mode.driverdata = modedata; - - displaydata->screen = screen; - displaydata->visual = vinfo.visual; - displaydata->depth = vinfo.depth; - displaydata->hdpi = display_mm_width ? (((float) mode.w) * 25.4f / display_mm_width) : 0.0f; - displaydata->vdpi = display_mm_height ? (((float) mode.h) * 25.4f / display_mm_height) : 0.0f; - displaydata->ddpi = SDL_ComputeDiagonalDPI(mode.w, mode.h, ((float) display_mm_width) / 25.4f,((float) display_mm_height) / 25.4f); - - /* if xft dpi is available we will use this over xrandr */ - xft_dpi = GetXftDPI(dpy); - if(xft_dpi > 0) { - displaydata->hdpi = (float)xft_dpi; - displaydata->vdpi = (float)xft_dpi; - } - - displaydata->scanline_pad = scanline_pad; - displaydata->x = display_x; - displaydata->y = display_y; - displaydata->use_xrandr = 1; - displaydata->xrandr_output = res->outputs[output]; - - SetXRandRModeInfo(dpy, res, output_crtc, modeID, &mode); - SetXRandRDisplayName(dpy, EDID, display_name, sizeof (display_name), res->outputs[output], display_mm_width, display_mm_height); - - SDL_zero(display); - if (*display_name) { - display.name = display_name; + if (X11_AddXRandRDisplay(_this, dpy, screen, res->outputs[output], res, SDL_FALSE) == -1) { + break; } - display.desktop_mode = mode; - display.current_mode = mode; - display.driverdata = displaydata; - SDL_AddVideoDisplay(&display, SDL_FALSE); } X11_XRRFreeScreenResources(res); + + /* This will generate events for displays that come and go at runtime. */ + X11_XRRSelectInput(dpy, RootWindow(dpy, screen), RROutputChangeNotifyMask); } } @@ -534,343 +532,148 @@ } #endif /* SDL_VIDEO_DRIVER_X11_XRANDR */ -#if SDL_VIDEO_DRIVER_X11_XVIDMODE -static SDL_bool -CheckVidMode(Display * display, int *major, int *minor) +static int +GetXftDPI(Display* dpy) { - int vm_event, vm_error = -1; - /* Default the extension not available */ - *major = *minor = 0; + char* xdefault_resource; + int xft_dpi, err; - /* Allow environment override */ - if (!SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_XVIDMODE, SDL_TRUE)) { -#ifdef X11MODES_DEBUG - printf("XVidMode disabled due to hint\n"); -#endif - return SDL_FALSE; - } + xdefault_resource = X11_XGetDefault(dpy, "Xft", "dpi"); - if (!SDL_X11_HAVE_XVIDMODE) { -#ifdef X11MODES_DEBUG - printf("XVidMode support not available\n"); -#endif - return SDL_FALSE; + if(!xdefault_resource) { + return 0; } - /* Query the extension version */ - if (!X11_XF86VidModeQueryExtension(display, &vm_event, &vm_error) - || !X11_XF86VidModeQueryVersion(display, major, minor)) { -#ifdef X11MODES_DEBUG - printf("XVidMode not active on the display\n"); -#endif - return SDL_FALSE; - } -#ifdef X11MODES_DEBUG - printf("XVidMode available at version %d.%d!\n", *major, *minor); -#endif - return SDL_TRUE; -} + /* + * It's possible for SDL_atoi to call SDL_strtol, if it fails due to a + * overflow or an underflow, it will return LONG_MAX or LONG_MIN and set + * errno to ERANGE. So we need to check for this so we dont get crazy dpi + * values + */ + xft_dpi = SDL_atoi(xdefault_resource); + err = errno; -static -Bool XF86VidModeGetModeInfo(Display * dpy, int scr, - XF86VidModeModeInfo* info) -{ - Bool retval; - int dotclock; - XF86VidModeModeLine l; - SDL_zerop(info); - SDL_zero(l); - retval = X11_XF86VidModeGetModeLine(dpy, scr, &dotclock, &l); - info->dotclock = dotclock; - info->hdisplay = l.hdisplay; - info->hsyncstart = l.hsyncstart; - info->hsyncend = l.hsyncend; - info->htotal = l.htotal; - info->hskew = l.hskew; - info->vdisplay = l.vdisplay; - info->vsyncstart = l.vsyncstart; - info->vsyncend = l.vsyncend; - info->vtotal = l.vtotal; - info->flags = l.flags; - info->privsize = l.privsize; - info->private = l.private; - return retval; + return err == ERANGE ? 0 : xft_dpi; } -static int -CalculateXVidModeRefreshRate(const XF86VidModeModeInfo * info) +/* This is used if there's no better functionality--like XRandR--to use. + It won't attempt to supply different display modes at all, but it can + enumerate the current displays and their current sizes. */ +static int X11_InitModes_StdXlib(_THIS) { - return (info->htotal - && info->vtotal) ? (1000 * info->dotclock / (info->htotal * - info->vtotal)) : 0; -} + /* !!! FIXME: a lot of copy/paste from X11_InitModes_XRandR in this function. */ + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + Display *dpy = data->display; + const int default_screen = DefaultScreen(dpy); + Screen *screen = ScreenOfDisplay(dpy, default_screen); + int display_mm_width, display_mm_height, xft_dpi, scanline_pad, n, i; + SDL_DisplayModeData *modedata; + SDL_DisplayData *displaydata; + SDL_DisplayMode mode; + XPixmapFormatValues *pixmapformats; + Uint32 pixelformat; + XVisualInfo vinfo; + SDL_VideoDisplay display; -static SDL_bool -SetXVidModeModeInfo(const XF86VidModeModeInfo *info, SDL_DisplayMode *mode) -{ - mode->w = info->hdisplay; - mode->h = info->vdisplay; - mode->refresh_rate = CalculateXVidModeRefreshRate(info); - ((SDL_DisplayModeData*)mode->driverdata)->vm_mode = *info; - return SDL_TRUE; -} -#endif /* SDL_VIDEO_DRIVER_X11_XVIDMODE */ + /* note that generally even if you have a multiple physical monitors, ScreenCount(dpy) still only reports ONE screen. */ -int -X11_InitModes(_THIS) -{ - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; - int snum, screen, screencount = 0; -#if SDL_VIDEO_DRIVER_X11_XINERAMA - int xinerama_major, xinerama_minor; - int use_xinerama = 0; - XineramaScreenInfo *xinerama = NULL; -#endif -#if SDL_VIDEO_DRIVER_X11_XRANDR - int xrandr_major, xrandr_minor; -#endif -#if SDL_VIDEO_DRIVER_X11_XVIDMODE - int vm_major, vm_minor; - int use_vidmode = 0; -#endif + if (get_visualinfo(dpy, default_screen, &vinfo) < 0) { + return SDL_SetError("Failed to find an X11 visual for the primary display"); + } -/* XRandR is the One True Modern Way to do this on X11. If it's enabled and - available, don't even look at other ways of doing things. */ -#if SDL_VIDEO_DRIVER_X11_XRANDR - /* require at least XRandR v1.3 */ - if (CheckXRandR(data->display, &xrandr_major, &xrandr_minor) && - (xrandr_major >= 2 || (xrandr_major == 1 && xrandr_minor >= 3))) { - if (X11_InitModes_XRandR(_this) == 0) - return 0; + pixelformat = X11_GetPixelFormatFromVisualInfo(dpy, &vinfo); + if (SDL_ISPIXELFORMAT_INDEXED(pixelformat)) { + return SDL_SetError("Palettized video modes are no longer supported"); } -#endif /* SDL_VIDEO_DRIVER_X11_XRANDR */ -/* !!! FIXME: eventually remove support for Xinerama and XVidMode (everything below here). */ + SDL_zero(mode); + mode.w = WidthOfScreen(screen); + mode.h = HeightOfScreen(screen); + mode.format = pixelformat; + mode.refresh_rate = 0; /* don't know it, sorry. */ - /* This is a workaround for some apps (UnrealEngine4, for example) until - we sort out the ramifications of removing XVidMode support outright. - This block should be removed with the XVidMode support. */ - { - if (SDL_GetHintBoolean("SDL_VIDEO_X11_REQUIRE_XRANDR", SDL_FALSE)) { - #if SDL_VIDEO_DRIVER_X11_XRANDR - return SDL_SetError("XRandR support is required but not available"); - #else - return SDL_SetError("XRandR support is required but not built into SDL!"); - #endif - } + displaydata = (SDL_DisplayData *) SDL_calloc(1, sizeof(*displaydata)); + if (!displaydata) { + return SDL_OutOfMemory(); } -#if SDL_VIDEO_DRIVER_X11_XINERAMA - /* Query Xinerama extention - * NOTE: This works with Nvidia Twinview correctly, but you need version 302.17 (released on June 2012) - * or newer of the Nvidia binary drivers - */ - if (CheckXinerama(data->display, &xinerama_major, &xinerama_minor)) { - int (*handler) (Display *, XErrorEvent *); - X11_XSync(data->display, False); - handler = X11_XSetErrorHandler(X11_XineramaFailed); - xinerama = X11_XineramaQueryScreens(data->display, &screencount); - X11_XSync(data->display, False); - X11_XSetErrorHandler(handler); - if (xinerama_triggered_error) { - xinerama = 0; - } - if (xinerama) { - use_xinerama = xinerama_major * 100 + xinerama_minor; - } - } - if (!xinerama) { - screencount = ScreenCount(data->display); + modedata = (SDL_DisplayModeData *) SDL_calloc(1, sizeof(SDL_DisplayModeData)); + if (!modedata) { + SDL_free(displaydata); + return SDL_OutOfMemory(); } -#else - screencount = ScreenCount(data->display); -#endif /* SDL_VIDEO_DRIVER_X11_XINERAMA */ - -#if SDL_VIDEO_DRIVER_X11_XVIDMODE - if (CheckVidMode(data->display, &vm_major, &vm_minor)) { - use_vidmode = vm_major * 100 + vm_minor; - } -#endif /* SDL_VIDEO_DRIVER_X11_XVIDMODE */ - - for (snum = 0; snum < screencount; ++snum) { - XVisualInfo vinfo; - SDL_VideoDisplay display; - SDL_DisplayData *displaydata; - SDL_DisplayMode mode; - SDL_DisplayModeData *modedata; - XPixmapFormatValues *pixmapFormats; - char display_name[128]; - int i, n; - - /* Re-order screens to always put default screen first */ - if (snum == 0) { - screen = DefaultScreen(data->display); - } else if (snum == DefaultScreen(data->display)) { - screen = 0; - } else { - screen = snum; - } - -#if SDL_VIDEO_DRIVER_X11_XINERAMA - if (xinerama) { - if (get_visualinfo(data->display, 0, &vinfo) < 0) { - continue; - } - } else { - if (get_visualinfo(data->display, screen, &vinfo) < 0) { - continue; - } - } -#else - if (get_visualinfo(data->display, screen, &vinfo) < 0) { - continue; - } -#endif + mode.driverdata = modedata; - displaydata = (SDL_DisplayData *) SDL_calloc(1, sizeof(*displaydata)); - if (!displaydata) { - continue; - } - display_name[0] = '\0'; - - mode.format = X11_GetPixelFormatFromVisualInfo(data->display, &vinfo); - if (SDL_ISPIXELFORMAT_INDEXED(mode.format)) { - /* We don't support palettized modes now */ - SDL_free(displaydata); - continue; - } -#if SDL_VIDEO_DRIVER_X11_XINERAMA - if (xinerama) { - mode.w = xinerama[screen].width; - mode.h = xinerama[screen].height; - } else { - mode.w = DisplayWidth(data->display, screen); - mode.h = DisplayHeight(data->display, screen); - } -#else - mode.w = DisplayWidth(data->display, screen); - mode.h = DisplayHeight(data->display, screen); -#endif - mode.refresh_rate = 0; + display_mm_width = WidthMMOfScreen(screen); + display_mm_height = HeightMMOfScreen(screen); - modedata = (SDL_DisplayModeData *) SDL_calloc(1, sizeof(SDL_DisplayModeData)); - if (!modedata) { - SDL_free(displaydata); - continue; - } - mode.driverdata = modedata; + displaydata->screen = default_screen; + displaydata->visual = vinfo.visual; + displaydata->depth = vinfo.depth; + displaydata->hdpi = display_mm_width ? (((float) mode.w) * 25.4f / display_mm_width) : 0.0f; + displaydata->vdpi = display_mm_height ? (((float) mode.h) * 25.4f / display_mm_height) : 0.0f; + displaydata->ddpi = SDL_ComputeDiagonalDPI(mode.w, mode.h, ((float) display_mm_width) / 25.4f,((float) display_mm_height) / 25.4f); -#if SDL_VIDEO_DRIVER_X11_XINERAMA - /* Most of SDL's calls to X11 are unwaware of Xinerama, and to X11 standard calls, when Xinerama is active, - * there's only one screen available. So we force the screen number to zero and - * let Xinerama specific code handle specific functionality using displaydata->xinerama_info - */ - if (use_xinerama) { - displaydata->screen = 0; - displaydata->use_xinerama = use_xinerama; - displaydata->xinerama_info = xinerama[screen]; - displaydata->xinerama_screen = screen; - } - else displaydata->screen = screen; -#else - displaydata->screen = screen; -#endif - displaydata->visual = vinfo.visual; - displaydata->depth = vinfo.depth; + xft_dpi = GetXftDPI(dpy); + if(xft_dpi > 0) { + displaydata->hdpi = (float)xft_dpi; + displaydata->vdpi = (float)xft_dpi; + } - /* We use the displaydata screen index here so that this works - for both the Xinerama case, where we get the overall DPI, - and the regular X11 screen info case. */ - displaydata->hdpi = (float)DisplayWidth(data->display, displaydata->screen) * 25.4f / - DisplayWidthMM(data->display, displaydata->screen); - displaydata->vdpi = (float)DisplayHeight(data->display, displaydata->screen) * 25.4f / - DisplayHeightMM(data->display, displaydata->screen); - displaydata->ddpi = SDL_ComputeDiagonalDPI(DisplayWidth(data->display, displaydata->screen), - DisplayHeight(data->display, displaydata->screen), - (float)DisplayWidthMM(data->display, displaydata->screen) / 25.4f, - (float)DisplayHeightMM(data->display, displaydata->screen) / 25.4f); - - displaydata->scanline_pad = SDL_BYTESPERPIXEL(mode.format) * 8; - pixmapFormats = X11_XListPixmapFormats(data->display, &n); - if (pixmapFormats) { - for (i = 0; i < n; ++i) { - if (pixmapFormats[i].depth == displaydata->depth) { - displaydata->scanline_pad = pixmapFormats[i].scanline_pad; - break; - } + scanline_pad = SDL_BYTESPERPIXEL(pixelformat) * 8; + pixmapformats = X11_XListPixmapFormats(dpy, &n); + if (pixmapformats) { + for (i = 0; i < n; ++i) { + if (pixmapformats[i].depth == vinfo.depth) { + scanline_pad = pixmapformats[i].scanline_pad; + break; } - X11_XFree(pixmapFormats); } + X11_XFree(pixmapformats); + } -#if SDL_VIDEO_DRIVER_X11_XINERAMA - if (use_xinerama) { - displaydata->x = xinerama[screen].x_org; - displaydata->y = xinerama[screen].y_org; - } - else -#endif - { - displaydata->x = 0; - displaydata->y = 0; - } + displaydata->scanline_pad = scanline_pad; + displaydata->x = 0; + displaydata->y = 0; + displaydata->use_xrandr = SDL_FALSE; -#if SDL_VIDEO_DRIVER_X11_XVIDMODE - if (!displaydata->use_xrandr && -#if SDL_VIDEO_DRIVER_X11_XINERAMA - /* XVidMode only works on the screen at the origin */ - (!displaydata->use_xinerama || - (displaydata->x == 0 && displaydata->y == 0)) && -#endif - use_vidmode) { - displaydata->use_vidmode = use_vidmode; - if (displaydata->use_xinerama) { - displaydata->vidmode_screen = 0; - } else { - displaydata->vidmode_screen = screen; - } - XF86VidModeGetModeInfo(data->display, displaydata->vidmode_screen, &modedata->vm_mode); - } -#endif /* SDL_VIDEO_DRIVER_X11_XVIDMODE */ + SDL_zero(display); + display.name = (char *) "Generic X11 Display"; /* this is just copied and thrown away, it's safe to cast to char* here. */ + display.desktop_mode = mode; + display.current_mode = mode; + display.driverdata = displaydata; + SDL_AddVideoDisplay(&display, SDL_TRUE); - SDL_zero(display); - if (*display_name) { - display.name = display_name; - } - display.desktop_mode = mode; - display.current_mode = mode; - display.driverdata = displaydata; - SDL_AddVideoDisplay(&display, SDL_FALSE); - } - -#if SDL_VIDEO_DRIVER_X11_XINERAMA - if (xinerama) X11_XFree(xinerama); -#endif + return 0; +} - if (_this->num_displays == 0) { - return SDL_SetError("No available displays"); - } -#if SDL_VIDEO_DRIVER_X11_XVIDMODE - if (use_vidmode) { /* we intend to remove support for XVidMode soon. */ - SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "SDL is using XVidMode to manage your displays!"); - SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "This almost always means either SDL was misbuilt"); - SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "or your X server is insufficient. Please check your setup!"); - SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "Fullscreen and/or multiple displays will not work well."); +int +X11_InitModes(_THIS) +{ + /* XRandR is the One True Modern Way to do this on X11. If this + fails, we just won't report any display modes except the current + desktop size. */ +#if SDL_VIDEO_DRIVER_X11_XRANDR + { + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + int xrandr_major, xrandr_minor; + /* require at least XRandR v1.3 */ + if (CheckXRandR(data->display, &xrandr_major, &xrandr_minor) && + (xrandr_major >= 2 || (xrandr_major == 1 && xrandr_minor >= 3))) { + return X11_InitModes_XRandR(_this); + } } -#endif +#endif /* SDL_VIDEO_DRIVER_X11_XRANDR */ - return 0; + /* still here? Just set up an extremely basic display. */ + return X11_InitModes_StdXlib(_this); } void X11_GetDisplayModes(_THIS, SDL_VideoDisplay * sdl_display) { - Display *display = ((SDL_VideoData *) _this->driverdata)->display; SDL_DisplayData *data = (SDL_DisplayData *) sdl_display->driverdata; -#if SDL_VIDEO_DRIVER_X11_XVIDMODE - int nmodes; - XF86VidModeModeInfo ** modes; -#endif SDL_DisplayMode mode; /* Unfortunately X11 requires the window to be created with the correct @@ -882,54 +685,9 @@ mode.format = sdl_display->current_mode.format; mode.driverdata = NULL; -#if SDL_VIDEO_DRIVER_X11_XINERAMA - if (data->use_xinerama) { - int screen_w; - int screen_h; - - screen_w = DisplayWidth(display, data->screen); - screen_h = DisplayHeight(display, data->screen); - - if (data->use_vidmode && !data->xinerama_info.x_org && !data->xinerama_info.y_org && - (screen_w > data->xinerama_info.width || screen_h > data->xinerama_info.height)) { - SDL_DisplayModeData *modedata; - /* Add the full (both screens combined) xinerama mode only on the display that starts at 0,0 - * if we're using vidmode. - */ - mode.w = screen_w; - mode.h = screen_h; - mode.refresh_rate = 0; - modedata = (SDL_DisplayModeData *) SDL_calloc(1, sizeof(SDL_DisplayModeData)); - if (modedata) { - *modedata = *(SDL_DisplayModeData *)sdl_display->desktop_mode.driverdata; - } - mode.driverdata = modedata; - if (!SDL_AddDisplayMode(sdl_display, &mode)) { - SDL_free(modedata); - } - } - else if (!data->use_xrandr) - { - SDL_DisplayModeData *modedata; - /* Add the current mode of each monitor otherwise if we can't get them from xrandr */ - mode.w = data->xinerama_info.width; - mode.h = data->xinerama_info.height; - mode.refresh_rate = 0; - modedata = (SDL_DisplayModeData *) SDL_calloc(1, sizeof(SDL_DisplayModeData)); - if (modedata) { - *modedata = *(SDL_DisplayModeData *)sdl_display->desktop_mode.driverdata; - } - mode.driverdata = modedata; - if (!SDL_AddDisplayMode(sdl_display, &mode)) { - SDL_free(modedata); - } - } - - } -#endif /* SDL_VIDEO_DRIVER_X11_XINERAMA */ - #if SDL_VIDEO_DRIVER_X11_XRANDR if (data->use_xrandr) { + Display *display = ((SDL_VideoData *) _this->driverdata)->display; XRRScreenResources *res; res = X11_XRRGetScreenResources (display, RootWindow(display, data->screen)); @@ -960,37 +718,7 @@ } #endif /* SDL_VIDEO_DRIVER_X11_XRANDR */ -#if SDL_VIDEO_DRIVER_X11_XVIDMODE - if (data->use_vidmode && - X11_XF86VidModeGetAllModeLines(display, data->vidmode_screen, &nmodes, &modes)) { - int i; - SDL_DisplayModeData *modedata; - -#ifdef X11MODES_DEBUG - printf("VidMode modes: (unsorted)\n"); - for (i = 0; i < nmodes; ++i) { - printf("Mode %d: %d x %d @ %d, flags: 0x%x\n", i, - modes[i]->hdisplay, modes[i]->vdisplay, - CalculateXVidModeRefreshRate(modes[i]), modes[i]->flags); - } -#endif - for (i = 0; i < nmodes; ++i) { - modedata = (SDL_DisplayModeData *) SDL_calloc(1, sizeof(SDL_DisplayModeData)); - if (!modedata) { - continue; - } - mode.driverdata = modedata; - - if (!SetXVidModeModeInfo(modes[i], &mode) || !SDL_AddDisplayMode(sdl_display, &mode)) { - SDL_free(modedata); - } - } - X11_XFree(modes); - return; - } -#endif /* SDL_VIDEO_DRIVER_X11_XVIDMODE */ - - if (!data->use_xrandr && !data->use_vidmode) { + if (!data->use_xrandr) { SDL_DisplayModeData *modedata; /* Add the desktop mode */ mode = sdl_display->desktop_mode; @@ -1005,6 +733,7 @@ } } +#if SDL_VIDEO_DRIVER_X11_XRANDR /* This catches an error from XRRSetScreenSize, as a workaround for now. */ /* !!! FIXME: remove this later when we have a better solution. */ static int (*PreXRRSetScreenSizeErrorHandler)(Display *, XErrorEvent *) = NULL; @@ -1019,20 +748,21 @@ return PreXRRSetScreenSizeErrorHandler(d, e); } +#endif int X11_SetDisplayMode(_THIS, SDL_VideoDisplay * sdl_display, SDL_DisplayMode * mode) { SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata; - Display *display = viddata->display; SDL_DisplayData *data = (SDL_DisplayData *) sdl_display->driverdata; - SDL_DisplayModeData *modedata = (SDL_DisplayModeData *)mode->driverdata; - int mm_width, mm_height; viddata->last_mode_change_deadline = SDL_GetTicks() + (PENDING_FOCUS_TIME * 2); #if SDL_VIDEO_DRIVER_X11_XRANDR if (data->use_xrandr) { + Display *display = viddata->display; + SDL_DisplayModeData *modedata = (SDL_DisplayModeData *)mode->driverdata; + int mm_width, mm_height; XRRScreenResources *res; XRROutputInfo *output_info; XRRCrtcInfo *crtc; @@ -1105,12 +835,6 @@ } #endif /* SDL_VIDEO_DRIVER_X11_XRANDR */ -#if SDL_VIDEO_DRIVER_X11_XVIDMODE - if (data->use_vidmode) { - X11_XF86VidModeSwitchToMode(display, data->vidmode_screen, &modedata->vm_mode); - } -#endif /* SDL_VIDEO_DRIVER_X11_XVIDMODE */ - return 0; } @@ -1129,19 +853,6 @@ rect->w = sdl_display->current_mode.w; rect->h = sdl_display->current_mode.h; -#if SDL_VIDEO_DRIVER_X11_XINERAMA - /* Get the real current bounds of the display */ - if (data->use_xinerama) { - Display *display = ((SDL_VideoData *) _this->driverdata)->display; - int screencount; - XineramaScreenInfo *xinerama = X11_XineramaQueryScreens(display, &screencount); - if (xinerama) { - rect->x = xinerama[data->xinerama_screen].x_org; - rect->y = xinerama[data->xinerama_screen].y_org; - X11_XFree(xinerama); - } - } -#endif /* SDL_VIDEO_DRIVER_X11_XINERAMA */ return 0; } diff -Nru libsdl2-2.0.22+dfsg/src/video/x11/SDL_x11modes.h libsdl2-2.24.0+dfsg/src/video/x11/SDL_x11modes.h --- libsdl2-2.0.22+dfsg/src/video/x11/SDL_x11modes.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/x11/SDL_x11modes.h 2022-06-16 20:16:31.000000000 +0000 @@ -35,35 +35,20 @@ float hdpi; float vdpi; - int use_xinerama; - int use_xrandr; - int use_vidmode; - -#if SDL_VIDEO_DRIVER_X11_XINERAMA - XineramaScreenInfo xinerama_info; - int xinerama_screen; -#endif + SDL_bool use_xrandr; #if SDL_VIDEO_DRIVER_X11_XRANDR RROutput xrandr_output; #endif - -#if SDL_VIDEO_DRIVER_X11_XVIDMODE - int vidmode_screen; -#endif - } SDL_DisplayData; typedef struct { #if SDL_VIDEO_DRIVER_X11_XRANDR RRMode xrandr_mode; +#else + int unused; /* just so struct isn't empty. */ #endif - -#if SDL_VIDEO_DRIVER_X11_XVIDMODE - XF86VidModeModeInfo vm_mode; -#endif - } SDL_DisplayModeData; extern int X11_InitModes(_THIS); @@ -80,6 +65,10 @@ extern int X11_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * sdl_display, SDL_Rect * rect); extern int X11_GetDisplayDPI(_THIS, SDL_VideoDisplay * sdl_display, float * ddpi, float * hdpi, float * vdpi); +#if SDL_VIDEO_DRIVER_X11_XRANDR +extern void X11_HandleXRandREvent(_THIS, const XEvent *xevent); +#endif + #endif /* SDL_x11modes_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/video/x11/SDL_x11mouse.c libsdl2-2.24.0+dfsg/src/video/x11/SDL_x11mouse.c --- libsdl2-2.0.22+dfsg/src/video/x11/SDL_x11mouse.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/x11/SDL_x11mouse.c 2022-08-19 15:46:21.000000000 +0000 @@ -244,8 +244,8 @@ case SDL_SYSTEM_CURSOR_WAIT: shape = XC_watch; break; case SDL_SYSTEM_CURSOR_CROSSHAIR: shape = XC_tcross; break; case SDL_SYSTEM_CURSOR_WAITARROW: shape = XC_watch; break; - case SDL_SYSTEM_CURSOR_SIZENWSE: shape = XC_fleur; break; - case SDL_SYSTEM_CURSOR_SIZENESW: shape = XC_fleur; break; + case SDL_SYSTEM_CURSOR_SIZENWSE: shape = XC_top_left_corner; break; + case SDL_SYSTEM_CURSOR_SIZENESW: shape = XC_top_right_corner; break; case SDL_SYSTEM_CURSOR_SIZEWE: shape = XC_sb_h_double_arrow; break; case SDL_SYSTEM_CURSOR_SIZENS: shape = XC_sb_v_double_arrow; break; case SDL_SYSTEM_CURSOR_SIZEALL: shape = XC_fleur; break; @@ -358,16 +358,20 @@ X11_CaptureMouse(SDL_Window *window) { Display *display = GetDisplay(); + SDL_Window *mouse_focus = SDL_GetMouseFocus(); if (window) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; const unsigned int mask = ButtonPressMask | ButtonReleaseMask | PointerMotionMask | FocusChangeMask; + Window confined = (data->mouse_grabbed ? data->xwindow : None); const int rc = X11_XGrabPointer(display, data->xwindow, False, mask, GrabModeAsync, GrabModeAsync, - None, None, CurrentTime); + confined, None, CurrentTime); if (rc != GrabSuccess) { return SDL_SetError("X server refused mouse capture"); } + } else if (mouse_focus) { + SDL_UpdateWindowGrab(mouse_focus); } else { X11_XUngrabPointer(display, CurrentTime); } @@ -406,6 +410,8 @@ buttons |= (mask & Button1Mask) ? SDL_BUTTON_LMASK : 0; buttons |= (mask & Button2Mask) ? SDL_BUTTON_MMASK : 0; buttons |= (mask & Button3Mask) ? SDL_BUTTON_RMASK : 0; + /* Use the SDL state for the extended buttons - it's better than nothing */ + buttons |= (SDL_GetMouseState(NULL, NULL) & (SDL_BUTTON_X1MASK|SDL_BUTTON_X2MASK)); /* SDL_DisplayData->x,y point to screen origin, and adding them to mouse coordinates relative to root window doesn't do the right thing * (observed on dual monitor setup with primary display being the rightmost one - mouse was offset to the right). * @@ -450,6 +456,16 @@ void X11_QuitMouse(_THIS) { + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + SDL_XInput2DeviceInfo *i; + SDL_XInput2DeviceInfo *next; + + for (i = data->mouse_device_info; i != NULL; i = next) { + next = i->next; + SDL_free(i); + } + data->mouse_device_info = NULL; + X11_DestroyEmptyCursor(); } diff -Nru libsdl2-2.0.22+dfsg/src/video/x11/SDL_x11mouse.h libsdl2-2.24.0+dfsg/src/video/x11/SDL_x11mouse.h --- libsdl2-2.0.22+dfsg/src/video/x11/SDL_x11mouse.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/x11/SDL_x11mouse.h 2022-08-13 03:48:10.000000000 +0000 @@ -23,6 +23,17 @@ #ifndef SDL_x11mouse_h_ #define SDL_x11mouse_h_ +typedef struct SDL_XInput2DeviceInfo +{ + int device_id; + SDL_bool relative[2]; + double minval[2]; + double maxval[2]; + double prev_coords[2]; + Time prev_time; + struct SDL_XInput2DeviceInfo *next; +} SDL_XInput2DeviceInfo; + extern void X11_InitMouse(_THIS); extern void X11_QuitMouse(_THIS); diff -Nru libsdl2-2.0.22+dfsg/src/video/x11/SDL_x11opengl.c libsdl2-2.24.0+dfsg/src/video/x11/SDL_x11opengl.c --- libsdl2-2.0.22+dfsg/src/video/x11/SDL_x11opengl.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/x11/SDL_x11opengl.c 2022-08-13 03:48:10.000000000 +0000 @@ -118,6 +118,16 @@ #endif #endif +#ifndef GLX_ARB_fbconfig_float +#define GLX_ARB_fbconfig_float +#ifndef GLX_RGBA_FLOAT_TYPE_ARB +#define GLX_RGBA_FLOAT_TYPE_ARB 0x20B9 +#endif +#ifndef GLX_RGBA_FLOAT_BIT_ARB +#define GLX_RGBA_FLOAT_BIT_ARB 0x00000004 +#endif +#endif + #ifndef GLX_ARB_create_context_no_error #define GLX_ARB_create_context_no_error #ifndef GLX_CONTEXT_OPENGL_NO_ERROR_ARB @@ -492,7 +502,11 @@ /* Setup our GLX attributes according to the gl_config. */ if( for_FBConfig ) { attribs[i++] = GLX_RENDER_TYPE; - attribs[i++] = GLX_RGBA_BIT; + if (_this->gl_config.floatbuffers) { + attribs[i++] = GLX_RGBA_FLOAT_BIT_ARB; + } else { + attribs[i++] = GLX_RGBA_BIT; + } } else { attribs[i++] = GLX_RGBA; } @@ -560,6 +574,10 @@ attribs[i++] = _this->gl_config.multisamplesamples; } + if (_this->gl_config.floatbuffers) { + attribs[i++] = GLX_RGBA_FLOAT_TYPE_ARB; + } + if (_this->gl_config.framebuffer_srgb_capable) { attribs[i++] = GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB; attribs[i++] = True; /* always needed, for_FBConfig or not! */ diff -Nru libsdl2-2.0.22+dfsg/src/video/x11/SDL_x11sym.h libsdl2-2.24.0+dfsg/src/video/x11/SDL_x11sym.h --- libsdl2-2.0.22+dfsg/src/video/x11/SDL_x11sym.h 2022-04-21 17:37:37.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/x11/SDL_x11sym.h 2022-06-16 20:16:31.000000000 +0000 @@ -19,7 +19,7 @@ 3. This notice may not be removed or altered from any source distribution. */ -/* *INDENT-OFF* */ +/* *INDENT-OFF* */ /* clang-format off */ #ifndef SDL_X11_MODULE #define SDL_X11_MODULE(modname) @@ -33,8 +33,6 @@ SDL_X11_SYM(XSizeHints*,XAllocSizeHints,(void),(),return) SDL_X11_SYM(XWMHints*,XAllocWMHints,(void),(),return) SDL_X11_SYM(XClassHint*,XAllocClassHint,(void),(),return) -SDL_X11_SYM(int,XAutoRepeatOn,(Display* a),(a),return) -SDL_X11_SYM(int,XAutoRepeatOff,(Display* a),(a),return) SDL_X11_SYM(int,XChangePointerControl,(Display* a,Bool b,Bool c,int d,int e,int f),(a,b,c,d,e,f),return) SDL_X11_SYM(int,XChangeProperty,(Display* a,Window b,Atom c,Atom d,int e,int f,_Xconst unsigned char* g,int h),(a,b,c,d,e,f,g,h),return) SDL_X11_SYM(Bool,XCheckIfEvent,(Display* a,XEvent *b,Bool (*c)(Display*,XEvent*,XPointer),XPointer d),(a,b,c,d),return) @@ -72,7 +70,6 @@ SDL_X11_SYM(int,XGetInputFocus,(Display *a,Window *b,int *c),(a,b,c),return) SDL_X11_SYM(int,XGetErrorDatabaseText,(Display* a,_Xconst char* b,_Xconst char* c,_Xconst char* d,char* e,int f),(a,b,c,d,e,f),return) SDL_X11_SYM(XModifierKeymap*,XGetModifierMapping,(Display* a),(a),return) -SDL_X11_SYM(int,XGetKeyboardControl,(Display* a, XKeyboardState* b),(a,b),return) SDL_X11_SYM(int,XGetPointerControl,(Display* a,int* b,int* c,int* d),(a,b,c,d),return) SDL_X11_SYM(Window,XGetSelectionOwner,(Display* a,Atom b),(a,b),return) SDL_X11_SYM(XVisualInfo*,XGetVisualInfo,(Display* a,long b,XVisualInfo* c,int* d),(a,b,c,d),return) @@ -263,15 +260,6 @@ SDL_X11_SYM(XdbeBackBufferAttributes*,XdbeGetBackBufferAttributes,(Display *dpy,XdbeBackBuffer buffer),(dpy,buffer),return) #endif -/* Xinerama support */ -#if SDL_VIDEO_DRIVER_X11_XINERAMA -SDL_X11_MODULE(XINERAMA) -SDL_X11_SYM(Bool,XineramaIsActive,(Display *a),(a),return) -SDL_X11_SYM(Bool,XineramaQueryExtension,(Display *a,int *b,int *c),(a,b,c),return) -SDL_X11_SYM(Status,XineramaQueryVersion,(Display *a,int *b,int *c),(a,b,c),return) -SDL_X11_SYM(XineramaScreenInfo*,XineramaQueryScreens,(Display *a, int *b),(a,b),return) -#endif - /* XInput2 support for multiple mice, tablets, etc. */ #if SDL_VIDEO_DRIVER_X11_XINPUT2 SDL_X11_MODULE(XINPUT2) @@ -288,6 +276,7 @@ #if SDL_VIDEO_DRIVER_X11_XRANDR SDL_X11_MODULE(XRANDR) SDL_X11_SYM(Status,XRRQueryVersion,(Display *dpy,int *major_versionp,int *minor_versionp),(dpy,major_versionp,minor_versionp),return) +SDL_X11_SYM(Bool,XRRQueryExtension,(Display *dpy,int *event_base_return,int *error_base_return),(dpy,event_base_return,error_base_return),return); SDL_X11_SYM(XRRScreenConfiguration *,XRRGetScreenInfo,(Display *dpy,Drawable draw),(dpy,draw),return) SDL_X11_SYM(SizeID,XRRConfigCurrentConfiguration,(XRRScreenConfiguration *config,Rotation *rotation),(config,rotation),return) SDL_X11_SYM(short,XRRConfigCurrentRate,(XRRScreenConfiguration *config),(config),return) @@ -309,6 +298,7 @@ SDL_X11_SYM(XRRPropertyInfo*,XRRQueryOutputProperty,(Display *dpy,RROutput output, Atom property),(dpy,output,property),return) SDL_X11_SYM(int,XRRGetOutputProperty,(Display *dpy,RROutput output, Atom property, long offset, long length, Bool _delete, Bool pending, Atom req_type, Atom *actual_type, int *actual_format, unsigned long *nitems, unsigned long *bytes_after, unsigned char **prop),(dpy,output,property,offset,length, _delete, pending, req_type, actual_type, actual_format, nitems, bytes_after, prop),return) SDL_X11_SYM(RROutput,XRRGetOutputPrimary,(Display *dpy,Window window),(dpy,window),return) +SDL_X11_SYM(void,XRRSelectInput,(Display *dpy, Window window, int mask),(dpy,window,mask),) #endif /* MIT-SCREEN-SAVER support */ @@ -324,20 +314,9 @@ SDL_X11_SYM(void,XShapeCombineMask,(Display *dpy,Window dest,int dest_kind,int x_off,int y_off,Pixmap src,int op),(dpy,dest,dest_kind,x_off,y_off,src,op),) #endif -#if SDL_VIDEO_DRIVER_X11_XVIDMODE -SDL_X11_MODULE(XVIDMODE) -SDL_X11_SYM(Bool,XF86VidModeGetAllModeLines,(Display *a,int b,int *c,XF86VidModeModeInfo ***d),(a,b,c,d),return) -SDL_X11_SYM(Bool,XF86VidModeGetModeLine,(Display *a,int b,int *c,XF86VidModeModeLine *d),(a,b,c,d),return) -SDL_X11_SYM(Bool,XF86VidModeGetViewPort,(Display *a,int b,int *c,int *d),(a,b,c,d),return) -SDL_X11_SYM(Bool,XF86VidModeQueryExtension,(Display *a,int *b,int *c),(a,b,c),return) -SDL_X11_SYM(Bool,XF86VidModeQueryVersion,(Display *a,int *b,int *c),(a,b,c),return) -SDL_X11_SYM(Bool,XF86VidModeSwitchToMode,(Display *a,int b,XF86VidModeModeInfo *c),(a,b,c),return) -SDL_X11_SYM(Bool,XF86VidModeLockModeSwitch,(Display *a,int b,int c),(a,b,c),return) -#endif - #undef SDL_X11_MODULE #undef SDL_X11_SYM -/* *INDENT-ON* */ +/* *INDENT-ON* */ /* clang-format on */ /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/video/x11/SDL_x11touch.c libsdl2-2.24.0+dfsg/src/video/x11/SDL_x11touch.c --- libsdl2-2.0.22+dfsg/src/video/x11/SDL_x11touch.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/x11/SDL_x11touch.c 2022-08-13 03:48:10.000000000 +0000 @@ -31,9 +31,7 @@ void X11_InitTouch(_THIS) { - if (X11_Xinput2IsMultitouchSupported()) { - X11_InitXinput2Multitouch(_this); - } + X11_InitXinput2Multitouch(_this); } void diff -Nru libsdl2-2.0.22+dfsg/src/video/x11/SDL_x11video.c libsdl2-2.24.0+dfsg/src/video/x11/SDL_x11video.c --- libsdl2-2.0.22+dfsg/src/video/x11/SDL_x11video.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/x11/SDL_x11video.c 2022-08-13 03:48:10.000000000 +0000 @@ -149,7 +149,7 @@ } static SDL_VideoDevice * -X11_CreateDevice(int devindex) +X11_CreateDevice(void) { SDL_VideoDevice *device; SDL_VideoData *data; diff -Nru libsdl2-2.0.22+dfsg/src/video/x11/SDL_x11video.h libsdl2-2.24.0+dfsg/src/video/x11/SDL_x11video.h --- libsdl2-2.0.22+dfsg/src/video/x11/SDL_x11video.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/x11/SDL_x11video.h 2022-08-13 03:48:10.000000000 +0000 @@ -37,9 +37,6 @@ #if SDL_VIDEO_DRIVER_X11_XDBE #include #endif -#if SDL_VIDEO_DRIVER_X11_XINERAMA -#include -#endif #if SDL_VIDEO_DRIVER_X11_XINPUT2 #include #endif @@ -52,9 +49,6 @@ #if SDL_VIDEO_DRIVER_X11_XSHAPE #include #endif -#if SDL_VIDEO_DRIVER_X11_XVIDMODE -#include -#endif #include "../../core/linux/SDL_dbus.h" #include "../../core/linux/SDL_ime.h" @@ -140,6 +134,10 @@ SDL_Point global_mouse_position; Uint32 global_mouse_buttons; + SDL_XInput2DeviceInfo *mouse_device_info; + + int xrandr_event_base; + #if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM XkbDescPtr xkb; #endif diff -Nru libsdl2-2.0.22+dfsg/src/video/x11/SDL_x11window.c libsdl2-2.24.0+dfsg/src/video/x11/SDL_x11window.c --- libsdl2-2.0.22+dfsg/src/video/x11/SDL_x11window.c 2022-04-25 18:10:22.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/x11/SDL_x11window.c 2022-08-19 15:46:21.000000000 +0000 @@ -27,6 +27,7 @@ #include "../SDL_pixels_c.h" #include "../../events/SDL_keyboard_c.h" #include "../../events/SDL_mouse_c.h" +#include "../../events/SDL_events_c.h" #include "SDL_x11video.h" #include "SDL_x11mouse.h" @@ -73,13 +74,6 @@ */ static SDL_bool -X11_IsWindowLegacyFullscreen(_THIS, SDL_Window * window) -{ - SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - return (data->fswindow != 0); -} - -static SDL_bool X11_IsWindowMapped(_THIS, SDL_Window * window) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; @@ -1080,6 +1074,10 @@ X11_XSync(display, False); X11_XCheckIfEvent(display, &event, &isUnmapNotify, (XPointer)&data->xwindow); X11_XCheckIfEvent(display, &event, &isMapNotify, (XPointer)&data->xwindow); + + /* Make sure the window manager didn't resize our window for the difference. */ + X11_XResizeWindow(display, data->xwindow, window->w, window->h); + X11_XSync(display, False); } void @@ -1392,12 +1390,19 @@ attrs.x, attrs.y, &x, &y, &childReturn); if (!caught_x11_error) { - if ((x != orig_x) || (y != orig_y) || (attrs.width != orig_w) || (attrs.height != orig_h)) { - window->x = x; - window->y = y; - window->w = attrs.width; - window->h = attrs.height; - break; /* window moved, time to go. */ + SDL_bool window_changed = SDL_FALSE; + if ((x != orig_x) || (y != orig_y)) { + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MOVED, x, y); + window_changed = SDL_TRUE; + } + + if ((attrs.width != orig_w) || (attrs.height != orig_h)) { + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESIZED, attrs.width, attrs.height); + window_changed = SDL_TRUE; + } + + if (window_changed) { + break; /* window changed, time to go. */ } } @@ -1433,161 +1438,12 @@ X11_XFlush(display); } -/* This handles fullscreen itself, outside the Window Manager. */ -static void -X11_BeginWindowFullscreenLegacy(_THIS, SDL_Window * window, SDL_VideoDisplay * _display) -{ - SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - SDL_DisplayData *displaydata = (SDL_DisplayData *) _display->driverdata; - Visual *visual = data->visual; - Display *display = data->videodata->display; - const int screen = displaydata->screen; - Window root = RootWindow(display, screen); - const int def_vis = (visual == DefaultVisual(display, screen)); - unsigned long xattrmask = 0; - XSetWindowAttributes xattr; - XEvent ev; - SDL_Rect rect; - - if ( data->fswindow ) { - return; /* already fullscreen, I hope. */ - } - - X11_GetDisplayBounds(_this, _display, &rect); - - SDL_zero(xattr); - xattr.override_redirect = True; - xattrmask |= CWOverrideRedirect; - xattr.background_pixel = def_vis ? BlackPixel(display, screen) : 0; - xattrmask |= CWBackPixel; - xattr.border_pixel = 0; - xattrmask |= CWBorderPixel; - xattr.colormap = data->colormap; - xattrmask |= CWColormap; - - data->fswindow = X11_XCreateWindow(display, root, - rect.x, rect.y, rect.w, rect.h, 0, - displaydata->depth, InputOutput, - visual, xattrmask, &xattr); - - X11_XSelectInput(display, data->fswindow, StructureNotifyMask); - X11_XSetWindowBackground(display, data->fswindow, 0); - X11_XInstallColormap(display, data->colormap); - X11_XClearWindow(display, data->fswindow); - X11_XMapRaised(display, data->fswindow); - - /* Make sure the fswindow is in view by warping mouse to the corner */ - X11_XUngrabPointer(display, CurrentTime); - X11_XWarpPointer(display, None, root, 0, 0, 0, 0, rect.x, rect.y); - - /* Wait to be mapped, filter Unmap event out if it arrives. */ - X11_XIfEvent(display, &ev, &isMapNotify, (XPointer)&data->fswindow); - X11_XCheckIfEvent(display, &ev, &isUnmapNotify, (XPointer)&data->fswindow); - -#if SDL_VIDEO_DRIVER_X11_XVIDMODE - if ( displaydata->use_vidmode ) { - X11_XF86VidModeLockModeSwitch(display, screen, True); - } -#endif - - SetWindowBordered(display, displaydata->screen, data->xwindow, SDL_FALSE); - - /* Center actual window within our cover-the-screen window. */ - X11_XReparentWindow(display, data->xwindow, data->fswindow, - (rect.w - window->w) / 2, (rect.h - window->h) / 2); - - /* Move the mouse to the upper left to make sure it's on-screen */ - X11_XWarpPointer(display, None, root, 0, 0, 0, 0, rect.x, rect.y); - - /* Center mouse in the fullscreen window. */ - rect.x += (rect.w / 2); - rect.y += (rect.h / 2); - X11_XWarpPointer(display, None, root, 0, 0, 0, 0, rect.x, rect.y); - - /* Wait to be mapped, filter Unmap event out if it arrives. */ - X11_XIfEvent(display, &ev, &isMapNotify, (XPointer)&data->xwindow); - X11_XCheckIfEvent(display, &ev, &isUnmapNotify, (XPointer)&data->xwindow); - - SDL_UpdateWindowGrab(window); -} - -static void -X11_EndWindowFullscreenLegacy(_THIS, SDL_Window * window, SDL_VideoDisplay * _display) -{ - SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - SDL_DisplayData *displaydata = (SDL_DisplayData *) _display->driverdata; - Display *display = data->videodata->display; - const int screen = displaydata->screen; - Window root = RootWindow(display, screen); - Window fswindow = data->fswindow; - XEvent ev; - - if (!data->fswindow) { - return; /* already not fullscreen, I hope. */ - } - - data->fswindow = None; - -#if SDL_VIDEO_DRIVER_X11_VIDMODE - if ( displaydata->use_vidmode ) { - X11_XF86VidModeLockModeSwitch(display, screen, False); - } -#endif - - SDL_UpdateWindowGrab(window); - - X11_XReparentWindow(display, data->xwindow, root, window->x, window->y); - - /* flush these events so they don't confuse normal event handling */ - X11_XSync(display, False); - X11_XCheckIfEvent(display, &ev, &isMapNotify, (XPointer)&data->xwindow); - X11_XCheckIfEvent(display, &ev, &isUnmapNotify, (XPointer)&data->xwindow); - - SetWindowBordered(display, screen, data->xwindow, - (window->flags & SDL_WINDOW_BORDERLESS) == 0); - - X11_XWithdrawWindow(display, fswindow, screen); - - /* Wait to be unmapped. */ - X11_XIfEvent(display, &ev, &isUnmapNotify, (XPointer)&fswindow); - X11_XDestroyWindow(display, fswindow); -} - - void X11_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * _display, SDL_bool fullscreen) { - /* !!! FIXME: SDL_Hint? */ - SDL_bool legacy = SDL_FALSE; - const char *env = SDL_getenv("SDL_VIDEO_X11_LEGACY_FULLSCREEN"); - if (env) { - legacy = SDL_atoi(env); - } else { - SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; - SDL_DisplayData *displaydata = (SDL_DisplayData *) _display->driverdata; - if ( displaydata->use_vidmode ) { - legacy = SDL_TRUE; /* the new stuff only works with XRandR. */ - } else if ( !videodata->net_wm ) { - legacy = SDL_TRUE; /* The window manager doesn't support it */ - } else { - /* !!! FIXME: look at the window manager name, and blacklist certain ones? */ - /* http://stackoverflow.com/questions/758648/find-the-name-of-the-x-window-manager */ - legacy = SDL_FALSE; /* try the new way. */ - } - } - - if (legacy) { - if (fullscreen) { - X11_BeginWindowFullscreenLegacy(_this, window, _display); - } else { - X11_EndWindowFullscreenLegacy(_this, window, _display); - } - } else { - X11_SetWindowFullscreenViaWM(_this, window, _display, fullscreen); - } + X11_SetWindowFullscreenViaWM(_this, window, _display, fullscreen); } - int X11_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp) { @@ -1699,7 +1555,7 @@ unsigned long real_nitems; SDL_x11Prop atomProp; - X11_XGetWindowAttributes(display, X11_IsWindowLegacyFullscreen(_this, window) ? data->fswindow : data->xwindow, &attributes); + X11_XGetWindowAttributes(display, data->xwindow, &attributes); if (X11_XScreenNumberOfScreen(attributes.screen) > 0) { SDL_snprintf(icc_atom_string, sizeof("_ICC_PROFILE_") + 12, "%s%d", "_ICC_PROFILE_", X11_XScreenNumberOfScreen(attributes.screen)); } else { @@ -1740,21 +1596,15 @@ { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; Display *display; - SDL_bool oldstyle_fullscreen; if (data == NULL) { return; } + data->mouse_grabbed = SDL_FALSE; display = data->videodata->display; - /* ICCCM2.0-compliant window managers can handle fullscreen windows - If we're using XVidMode to change resolution we need to confine - the cursor so we don't pan around the virtual desktop. - */ - oldstyle_fullscreen = X11_IsWindowLegacyFullscreen(_this, window); - - if (oldstyle_fullscreen || grabbed) { + if (grabbed) { /* If the window is unmapped, XGrab calls return GrabNotViewable, so when we get a MapNotify later, we'll try to update the grab as appropriate. */ @@ -1773,6 +1623,7 @@ result = X11_XGrabPointer(display, data->xwindow, True, mask, GrabModeAsync, GrabModeAsync, data->xwindow, None, CurrentTime); if (result == GrabSuccess) { + data->mouse_grabbed = SDL_TRUE; break; } SDL_Delay(50); @@ -1788,11 +1639,6 @@ /* Raise the window if we grab the mouse */ X11_XRaiseWindow(display, data->xwindow); - - /* Now grab the keyboard on old-style fullscreen */ - if (oldstyle_fullscreen) { - X11_SetWindowKeyboardGrab(_this, window, SDL_TRUE); - } } else { X11_XUngrabPointer(display, CurrentTime); @@ -1886,15 +1732,14 @@ display = data->videodata->display; - if (info->version.major == SDL_MAJOR_VERSION && - info->version.minor == SDL_MINOR_VERSION) { + if (info->version.major == SDL_MAJOR_VERSION) { info->subsystem = SDL_SYSWM_X11; info->info.x11.display = display; info->info.x11.window = data->xwindow; return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d", - SDL_MAJOR_VERSION, SDL_MINOR_VERSION); + SDL_SetError("Application not compiled with SDL %d", + SDL_MAJOR_VERSION); return SDL_FALSE; } } @@ -1984,7 +1829,7 @@ } else if (conv < 0) { return SDL_OutOfMemory(); } else { /* conv > 0 */ - SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "%d characters were not convertable to the current locale!", conv); + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "%d characters were not convertible to the current locale!", conv); return 0; } diff -Nru libsdl2-2.0.22+dfsg/src/video/x11/SDL_x11window.h libsdl2-2.24.0+dfsg/src/video/x11/SDL_x11window.h --- libsdl2-2.0.22+dfsg/src/video/x11/SDL_x11window.h 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/x11/SDL_x11window.h 2022-08-19 15:46:21.000000000 +0000 @@ -44,7 +44,6 @@ { SDL_Window *window; Window xwindow; - Window fswindow; /* used if we can't have the WM handle fullscreen. */ Visual *visual; Colormap colormap; #ifndef NO_SHARED_MEMORY @@ -60,6 +59,7 @@ int border_right; int border_top; int border_bottom; + SDL_bool mouse_grabbed; Uint32 last_focus_event_time; PendingFocusEnum pending_focus; Uint32 pending_focus_time; diff -Nru libsdl2-2.0.22+dfsg/src/video/x11/SDL_x11xinput2.c libsdl2-2.24.0+dfsg/src/video/x11/SDL_x11xinput2.c --- libsdl2-2.0.22+dfsg/src/video/x11/SDL_x11xinput2.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/x11/SDL_x11xinput2.c 2022-08-13 03:48:10.000000000 +0000 @@ -120,7 +120,7 @@ int version = 0; XIEventMask eventmask; - unsigned char mask[3] = { 0,0,0 }; + unsigned char mask[4] = { 0, 0, 0, 0 }; int event, err; /* @@ -149,7 +149,7 @@ xinput2_multitouch_supported = xinput2_version_atleast(version, 2, 2); #endif - /* Enable Raw motion events for this display */ + /* Enable raw motion events for this display */ eventmask.deviceid = XIAllMasterDevices; eventmask.mask_len = sizeof(mask); eventmask.mask = mask; @@ -158,26 +158,132 @@ XISetMask(mask, XI_RawButtonPress); XISetMask(mask, XI_RawButtonRelease); - if (X11_XISelectEvents(data->display,DefaultRootWindow(data->display),&eventmask,1) != Success) { +#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH + /* Enable raw touch events if supported */ + if (X11_Xinput2IsMultitouchSupported()) { + XISetMask(mask, XI_RawTouchBegin); + XISetMask(mask, XI_RawTouchUpdate); + XISetMask(mask, XI_RawTouchEnd); + } +#endif + + if (X11_XISelectEvents(data->display, DefaultRootWindow(data->display), &eventmask, 1) != Success) { + return; + } + + SDL_zero(eventmask); + SDL_zeroa(mask); + eventmask.deviceid = XIAllDevices; + eventmask.mask_len = sizeof(mask); + eventmask.mask = mask; + + XISetMask(mask, XI_HierarchyChanged); + if (X11_XISelectEvents(data->display, DefaultRootWindow(data->display), &eventmask, 1) != Success) { return; } #endif } +/* xi2 device went away? take it out of the list. */ +static void +xinput2_remove_device_info(SDL_VideoData *videodata, const int device_id) +{ + SDL_XInput2DeviceInfo *prev = NULL; + SDL_XInput2DeviceInfo *devinfo; + + for (devinfo = videodata->mouse_device_info; devinfo != NULL; devinfo = devinfo->next) { + if (devinfo->device_id == device_id) { + SDL_assert((devinfo == videodata->mouse_device_info) == (prev == NULL)); + if (prev == NULL) { + videodata->mouse_device_info = devinfo->next; + } else { + prev->next = devinfo->next; + } + SDL_free(devinfo); + return; + } + prev = devinfo; + } +} + +#if SDL_VIDEO_DRIVER_X11_XINPUT2 +static SDL_XInput2DeviceInfo * +xinput2_get_device_info(SDL_VideoData *videodata, const int device_id) +{ + /* cache device info as we see new devices. */ + SDL_XInput2DeviceInfo *prev = NULL; + SDL_XInput2DeviceInfo *devinfo; + XIDeviceInfo *xidevinfo; + int axis = 0; + int i; + + for (devinfo = videodata->mouse_device_info; devinfo != NULL; devinfo = devinfo->next) { + if (devinfo->device_id == device_id) { + SDL_assert((devinfo == videodata->mouse_device_info) == (prev == NULL)); + if (prev != NULL) { /* move this to the front of the list, assuming we'll get more from this one. */ + prev->next = devinfo->next; + devinfo->next = videodata->mouse_device_info; + videodata->mouse_device_info = devinfo; + } + return devinfo; + } + prev = devinfo; + } + + /* don't know about this device yet, query and cache it. */ + devinfo = (SDL_XInput2DeviceInfo *) SDL_calloc(1, sizeof (SDL_XInput2DeviceInfo)); + if (!devinfo) { + SDL_OutOfMemory(); + return NULL; + } + + xidevinfo = X11_XIQueryDevice(videodata->display, device_id, &i); + if (!xidevinfo) { + SDL_free(devinfo); + return NULL; + } + + devinfo->device_id = device_id; + + /* !!! FIXME: this is sort of hacky because we only care about the first two axes we see, but any given + !!! FIXME: axis could be relative or absolute, and they might not even be the X and Y axes! + !!! FIXME: But we go on, for now. Maybe we need a more robust mouse API in SDL3... */ + for (i = 0; i < xidevinfo->num_classes; i++) { + const XIValuatorClassInfo *v = (const XIValuatorClassInfo *) xidevinfo->classes[i]; + if (v->type == XIValuatorClass) { + devinfo->relative[axis] = (v->mode == XIModeRelative) ? SDL_TRUE : SDL_FALSE; + devinfo->minval[axis] = v->min; + devinfo->maxval[axis] = v->max; + if (++axis >= 2) { + break; + } + } + } + + X11_XIFreeDeviceInfo(xidevinfo); + + devinfo->next = videodata->mouse_device_info; + videodata->mouse_device_info = devinfo; + + return devinfo; +} +#endif + int -X11_HandleXinput2Event(SDL_VideoData *videodata,XGenericEventCookie *cookie) +X11_HandleXinput2Event(SDL_VideoData *videodata, XGenericEventCookie *cookie) { #if SDL_VIDEO_DRIVER_X11_XINPUT2 - if(cookie->extension != xinput2_opcode) { + if (cookie->extension != xinput2_opcode) { return 0; } switch(cookie->evtype) { case XI_RawMotion: { const XIRawEvent *rawev = (const XIRawEvent*)cookie->data; SDL_Mouse *mouse = SDL_GetMouse(); - double relative_coords[2]; - static Time prev_time = 0; - static double prev_rel_coords[2]; + SDL_XInput2DeviceInfo *devinfo; + double coords[2]; + double processed_coords[2]; + int i; videodata->global_mouse_changed = SDL_TRUE; @@ -185,23 +291,52 @@ return 0; } + devinfo = xinput2_get_device_info(videodata, rawev->deviceid); + if (!devinfo) { + return 0; /* oh well. */ + } + parse_valuators(rawev->raw_values,rawev->valuators.mask, - rawev->valuators.mask_len,relative_coords,2); + rawev->valuators.mask_len,coords,2); - if ((rawev->time == prev_time) && (relative_coords[0] == prev_rel_coords[0]) && (relative_coords[1] == prev_rel_coords[1])) { + if ((rawev->time == devinfo->prev_time) && (coords[0] == devinfo->prev_coords[0]) && (coords[1] == devinfo->prev_coords[1])) { return 0; /* duplicate event, drop it. */ } - SDL_SendMouseMotion(mouse->focus,mouse->mouseID,1,(int)relative_coords[0],(int)relative_coords[1]); - prev_rel_coords[0] = relative_coords[0]; - prev_rel_coords[1] = relative_coords[1]; - prev_time = rawev->time; + for (i = 0; i < 2; i++) { + if (devinfo->relative[i]) { + processed_coords[i] = coords[i]; + } else { + processed_coords[i] = devinfo->prev_coords[i] - coords[i]; /* convert absolute to relative */ + } + } + + SDL_SendMouseMotion(mouse->focus, mouse->mouseID, 1, (int) processed_coords[0], (int) processed_coords[1]); + devinfo->prev_coords[0] = coords[0]; + devinfo->prev_coords[1] = coords[1]; + devinfo->prev_time = rawev->time; return 1; + } + break; + + case XI_HierarchyChanged: { + const XIHierarchyEvent *hierev = (const XIHierarchyEvent *) cookie->data; + int i; + for (i = 0; i < hierev->num_info; i++) { + if (hierev->info[i].flags & XISlaveRemoved) { + xinput2_remove_device_info(videodata, hierev->info[i].deviceid); + } } - break; + } + break; case XI_RawButtonPress: case XI_RawButtonRelease: +#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH + case XI_RawTouchBegin: + case XI_RawTouchUpdate: + case XI_RawTouchEnd: +#endif videodata->global_mouse_changed = SDL_TRUE; break; @@ -214,7 +349,7 @@ if (! pointer_emulated) { SDL_Mouse *mouse = SDL_GetMouse(); - if(!mouse->relative_mode || mouse->relative_mode_warp) { + if (!mouse->relative_mode || mouse->relative_mode_warp) { SDL_Window *window = xinput2_get_sdlwindow(videodata, xev->event); if (window) { SDL_SendMouseMotion(window, 0, 0, xev->event_x, xev->event_y); @@ -222,8 +357,8 @@ } } return 1; - } - break; + } + break; case XI_TouchBegin: { const XIDeviceEvent *xev = (const XIDeviceEvent *) cookie->data; @@ -232,8 +367,8 @@ xinput2_normalize_touch_coordinates(window, xev->event_x, xev->event_y, &x, &y); SDL_SendTouch(xev->sourceid, xev->detail, window, SDL_TRUE, x, y, 1.0); return 1; - } - break; + } + break; case XI_TouchEnd: { const XIDeviceEvent *xev = (const XIDeviceEvent *) cookie->data; float x, y; @@ -241,8 +376,8 @@ xinput2_normalize_touch_coordinates(window, xev->event_x, xev->event_y, &x, &y); SDL_SendTouch(xev->sourceid, xev->detail, window, SDL_FALSE, x, y, 1.0); return 1; - } - break; + } + break; case XI_TouchUpdate: { const XIDeviceEvent *xev = (const XIDeviceEvent *) cookie->data; float x, y; @@ -250,8 +385,9 @@ xinput2_normalize_touch_coordinates(window, xev->event_x, xev->event_y, &x, &y); SDL_SendTouchMotion(xev->sourceid, xev->detail, window, x, y, 1.0); return 1; - } - break; + } + break; + #endif } #endif @@ -265,6 +401,11 @@ SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; XIDeviceInfo *info; int ndevices,i,j; + + if (!X11_Xinput2IsMultitouchSupported()) { + return; + } + info = X11_XIQueryDevice(data->display, XIAllDevices, &ndevices); for (i = 0; i < ndevices; i++) { @@ -354,6 +495,10 @@ XIGrabModifiers mods; XIEventMask eventmask; + if (!X11_Xinput2IsMultitouchSupported()) { + return; + } + mods.modifiers = XIAnyModifier; mods.status = 0; @@ -379,6 +524,10 @@ XIGrabModifiers mods; + if (!X11_Xinput2IsMultitouchSupported()) { + return; + } + mods.modifiers = XIAnyModifier; mods.status = 0; @@ -386,7 +535,6 @@ #endif } - #endif /* SDL_VIDEO_DRIVER_X11 */ /* vi: set ts=4 sw=4 expandtab: */ diff -Nru libsdl2-2.0.22+dfsg/src/video/yuv2rgb/yuv_rgb.c libsdl2-2.24.0+dfsg/src/video/yuv2rgb/yuv_rgb.c --- libsdl2-2.0.22+dfsg/src/video/yuv2rgb/yuv_rgb.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/yuv2rgb/yuv_rgb.c 2022-06-16 20:16:31.000000000 +0000 @@ -687,4 +687,38 @@ #endif //__SSE2__ +#ifdef __loongarch_sx + +#define LSX_FUNCTION_NAME yuv420_rgb24_lsx +#define STD_FUNCTION_NAME yuv420_rgb24_std +#define YUV_FORMAT YUV_FORMAT_420 +#define RGB_FORMAT RGB_FORMAT_RGB24 +#include "yuv_rgb_lsx_func.h" + +#define LSX_FUNCTION_NAME yuv420_rgba_lsx +#define STD_FUNCTION_NAME yuv420_rgba_std +#define YUV_FORMAT YUV_FORMAT_420 +#define RGB_FORMAT RGB_FORMAT_RGBA +#include "yuv_rgb_lsx_func.h" + +#define LSX_FUNCTION_NAME yuv420_bgra_lsx +#define STD_FUNCTION_NAME yuv420_bgra_std +#define YUV_FORMAT YUV_FORMAT_420 +#define RGB_FORMAT RGB_FORMAT_BGRA +#include "yuv_rgb_lsx_func.h" + +#define LSX_FUNCTION_NAME yuv420_argb_lsx +#define STD_FUNCTION_NAME yuv420_argb_std +#define YUV_FORMAT YUV_FORMAT_420 +#define RGB_FORMAT RGB_FORMAT_ARGB +#include "yuv_rgb_lsx_func.h" + +#define LSX_FUNCTION_NAME yuv420_abgr_lsx +#define STD_FUNCTION_NAME yuv420_abgr_std +#define YUV_FORMAT YUV_FORMAT_420 +#define RGB_FORMAT RGB_FORMAT_ABGR +#include "yuv_rgb_lsx_func.h" + +#endif //__loongarch_sx + #endif /* SDL_HAVE_YUV */ diff -Nru libsdl2-2.0.22+dfsg/src/video/yuv2rgb/yuv_rgb.h libsdl2-2.24.0+dfsg/src/video/yuv2rgb/yuv_rgb.h --- libsdl2-2.0.22+dfsg/src/video/yuv2rgb/yuv_rgb.h 2021-07-27 14:52:29.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/yuv2rgb/yuv_rgb.h 2022-06-16 20:16:31.000000000 +0000 @@ -379,3 +379,34 @@ uint8_t *y, uint8_t *u, uint8_t *v, uint32_t y_stride, uint32_t uv_stride, YCbCrType yuv_type); + +//yuv420 to bgra, lsx implementation +void yuv420_rgb24_lsx( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_rgba_lsx( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *v, const uint8_t *u, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_bgra_lsx( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *v, const uint8_t *u, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_argb_lsx( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *v, const uint8_t *u, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_abgr_lsx( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *v, const uint8_t *u, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); diff -Nru libsdl2-2.0.22+dfsg/src/video/yuv2rgb/yuv_rgb_lsx_func.h libsdl2-2.24.0+dfsg/src/video/yuv2rgb/yuv_rgb_lsx_func.h --- libsdl2-2.0.22+dfsg/src/video/yuv2rgb/yuv_rgb_lsx_func.h 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/yuv2rgb/yuv_rgb_lsx_func.h 2022-06-16 20:16:31.000000000 +0000 @@ -0,0 +1,372 @@ +// Copyright 2016 Adrien Descamps +// // Distributed under BSD 3-Clause License + +#include + +#if YUV_FORMAT == YUV_FORMAT_420 + +#define READ_Y(y_ptr) \ + y = __lsx_vld(y_ptr, 0); \ + +#define READ_UV \ + u_temp = __lsx_vld(u_ptr, 0); \ + v_temp = __lsx_vld(v_ptr, 0); \ + +#else +#error READ_UV unimplemented +#endif + +#define PACK_RGBA_32(R1, R2, G1, G2, B1, B2, A1, A2, RGB1, RGB2, \ + RGB3, RGB4, RGB5, RGB6, RGB7, RGB8) \ +{ \ + __m128i ab_l, ab_h, gr_l, gr_h; \ + ab_l = __lsx_vilvl_b(B1, A1); \ + ab_h = __lsx_vilvh_b(B1, A1); \ + gr_l = __lsx_vilvl_b(R1, G1); \ + gr_h = __lsx_vilvh_b(R1, G1); \ + RGB1 = __lsx_vilvl_h(gr_l, ab_l); \ + RGB2 = __lsx_vilvh_h(gr_l, ab_l); \ + RGB3 = __lsx_vilvl_h(gr_h, ab_h); \ + RGB4 = __lsx_vilvh_h(gr_h, ab_h); \ + ab_l = __lsx_vilvl_b(B2, A2); \ + ab_h = __lsx_vilvh_b(B2, A2); \ + gr_l = __lsx_vilvl_b(R2, G2); \ + gr_h = __lsx_vilvh_b(R2, G2); \ + RGB5 = __lsx_vilvl_h(gr_l, ab_l); \ + RGB6 = __lsx_vilvh_h(gr_l, ab_l); \ + RGB7 = __lsx_vilvl_h(gr_h, ab_h); \ + RGB8 = __lsx_vilvh_h(gr_h, ab_h); \ +} + +#define PACK_RGB24_32_STEP(R, G, B, RGB1, RGB2, RGB3) \ + RGB1 = __lsx_vilvl_b(G, R); \ + RGB1 = __lsx_vshuf_b(B, RGB1, mask1); \ + RGB2 = __lsx_vshuf_b(B, G, mask2); \ + RGB2 = __lsx_vshuf_b(R, RGB2, mask3); \ + RGB3 = __lsx_vshuf_b(R, B, mask4); \ + RGB3 = __lsx_vshuf_b(G, RGB3, mask5); \ + +#define PACK_RGB24_32(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \ + PACK_RGB24_32_STEP(R1, G1, B1, RGB1, RGB2, RGB3); \ + PACK_RGB24_32_STEP(R2, G2, B2, RGB4, RGB5, RGB6); \ + +#if RGB_FORMAT == RGB_FORMAT_RGB24 + +#define PACK_PIXEL \ + __m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6; \ + __m128i rgb_7, rgb_8, rgb_9, rgb_10, rgb_11, rgb_12; \ + PACK_RGB24_32(r_8_11, r_8_12, g_8_11, g_8_12, b_8_11, b_8_12, \ + rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6) \ + PACK_RGB24_32(r_8_21, r_8_22, g_8_21, g_8_22, b_8_21, b_8_22, \ + rgb_7, rgb_8, rgb_9, rgb_10, rgb_11, rgb_12) \ + +#elif RGB_FORMAT == RGB_FORMAT_RGBA + +#define PACK_PIXEL \ + __m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \ + __m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \ + __m128i a = __lsx_vldi(0xFF); \ + PACK_RGBA_32(r_8_11, r_8_12, g_8_11, g_8_12, b_8_11, b_8_12, a, a, \ + rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \ + PACK_RGBA_32(r_8_21, r_8_22, g_8_21, g_8_22, b_8_21, b_8_22, a, a, \ + rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16) \ + +#elif RGB_FORMAT == RGB_FORMAT_BGRA + +#define PACK_PIXEL \ + __m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \ + __m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \ + __m128i a = __lsx_vldi(0xFF); \ + PACK_RGBA_32(b_8_11, b_8_12, g_8_11, g_8_12, r_8_11, r_8_12, a, a, \ + rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \ + PACK_RGBA_32(b_8_21, b_8_22, g_8_21, g_8_22, r_8_21, r_8_22, a, a, \ + rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16) \ + +#elif RGB_FORMAT == RGB_FORMAT_ARGB + +#define PACK_PIXEL \ + __m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \ + __m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \ + __m128i a = __lsx_vldi(0xFF); \ + PACK_RGBA_32(a, a, r_8_11, r_8_12, g_8_11, g_8_12, b_8_11, b_8_12, \ + rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \ + PACK_RGBA_32(a, a, r_8_21, r_8_22, g_8_21, g_8_22, b_8_21, b_8_22, \ + rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16) \ + +#elif RGB_FORMAT == RGB_FORMAT_ABGR + +#define PACK_PIXEL \ + __m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \ + __m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \ + __m128i a = __lsx_vldi(0xFF); \ + PACK_RGBA_32(a, a, b_8_11, b_8_12, g_8_11, g_8_12, r_8_11, r_8_12, \ + rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \ + PACK_RGBA_32(a, a, b_8_21, b_8_22, g_8_21, g_8_22, r_8_21, r_8_22, \ + rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16) \ + +#else +#error PACK_PIXEL unimplemented +#endif + +#define LSX_ST_UB2(in0, in1, pdst, stride) \ +{ \ + __lsx_vst(in0, pdst, 0); \ + __lsx_vst(in1, pdst + stride, 0); \ +} + +#if RGB_FORMAT == RGB_FORMAT_RGB24 \ + +#define SAVE_LINE1 \ + LSX_ST_UB2(rgb_1, rgb_2, rgb_ptr1, 16); \ + LSX_ST_UB2(rgb_3, rgb_4, rgb_ptr1 + 32, 16); \ + LSX_ST_UB2(rgb_5, rgb_6, rgb_ptr1 + 64, 16); \ + +#define SAVE_LINE2 \ + LSX_ST_UB2(rgb_7, rgb_8, rgb_ptr2, 16); \ + LSX_ST_UB2(rgb_9, rgb_10, rgb_ptr2 + 32, 16); \ + LSX_ST_UB2(rgb_11, rgb_12, rgb_ptr2 + 64, 16); \ + +#elif RGB_FORMAT == RGB_FORMAT_RGBA || RGB_FORMAT == RGB_FORMAT_BGRA || \ + RGB_FORMAT == RGB_FORMAT_ARGB || RGB_FORMAT == RGB_FORMAT_ABGR \ + +#define SAVE_LINE1 \ + LSX_ST_UB2(rgb_1, rgb_2, rgb_ptr1, 16); \ + LSX_ST_UB2(rgb_3, rgb_4, rgb_ptr1 + 32, 16); \ + LSX_ST_UB2(rgb_5, rgb_6, rgb_ptr1 + 64, 16); \ + LSX_ST_UB2(rgb_7, rgb_8, rgb_ptr1 + 96, 16); \ + +#define SAVE_LINE2 \ + LSX_ST_UB2(rgb_9, rgb_10, rgb_ptr2, 16); \ + LSX_ST_UB2(rgb_11, rgb_12, rgb_ptr2 + 32, 16); \ + LSX_ST_UB2(rgb_13, rgb_14, rgb_ptr2 + 64, 16); \ + LSX_ST_UB2(rgb_15, rgb_16, rgb_ptr2 + 96, 16); \ + +#else +#error SAVE_LINE unimplemented +#endif + +// = u*vr g=u*ug+v*vg b=u*ub +#define UV2RGB_16(U, V, R1, G1, B1, R2, G2, B2) \ + r_temp = __lsx_vmul_h(V, v2r); \ + g_temp = __lsx_vmul_h(U, u2g); \ + g_temp = __lsx_vmadd_h(g_temp, V, v2g); \ + b_temp = __lsx_vmul_h(U, u2b); \ + R1 = __lsx_vilvl_h(r_temp, r_temp); \ + G1 = __lsx_vilvl_h(g_temp, g_temp); \ + B1 = __lsx_vilvl_h(b_temp, b_temp); \ + R2 = __lsx_vilvh_h(r_temp, r_temp); \ + G2 = __lsx_vilvh_h(g_temp, g_temp); \ + B2 = __lsx_vilvh_h(b_temp, b_temp); \ + +// Y=(Y-shift)*shift R=(Y+R)>>6,G=(Y+G)>>6,B=(B+Y)>>6 +#define ADD_Y2RGB_16(Y1, Y2, R1, G1, B1, R2, G2, B2) \ + Y1 = __lsx_vsub_h(Y1, shift); \ + Y2 = __lsx_vsub_h(Y2, shift); \ + Y1 = __lsx_vmul_h(Y1, yf); \ + Y2 = __lsx_vmul_h(Y2, yf); \ + R1 = __lsx_vadd_h(R1, Y1); \ + G1 = __lsx_vadd_h(G1, Y1); \ + B1 = __lsx_vadd_h(B1, Y1); \ + R2 = __lsx_vadd_h(R2, Y2); \ + G2 = __lsx_vadd_h(G2, Y2); \ + B2 = __lsx_vadd_h(B2, Y2); \ + R1 = __lsx_vsrai_h(R1, PRECISION); \ + G1 = __lsx_vsrai_h(G1, PRECISION); \ + B1 = __lsx_vsrai_h(B1, PRECISION); \ + R2 = __lsx_vsrai_h(R2, PRECISION); \ + G2 = __lsx_vsrai_h(G2, PRECISION); \ + B2 = __lsx_vsrai_h(B2, PRECISION); \ + +#define CLIP(in0, in1, in2, in3, in4, in5) \ +{ \ + in0 = __lsx_vmaxi_h(in0, 0); \ + in1 = __lsx_vmaxi_h(in1, 0); \ + in2 = __lsx_vmaxi_h(in2, 0); \ + in3 = __lsx_vmaxi_h(in3, 0); \ + in4 = __lsx_vmaxi_h(in4, 0); \ + in5 = __lsx_vmaxi_h(in5, 0); \ + in0 = __lsx_vsat_hu(in0, 7); \ + in1 = __lsx_vsat_hu(in1, 7); \ + in2 = __lsx_vsat_hu(in2, 7); \ + in3 = __lsx_vsat_hu(in3, 7); \ + in4 = __lsx_vsat_hu(in4, 7); \ + in5 = __lsx_vsat_hu(in5, 7); \ +} + +#define YUV2RGB_32 \ + __m128i y, u_temp, v_temp; \ + __m128i r_8_11, g_8_11, b_8_11, r_8_21, g_8_21, b_8_21; \ + __m128i r_8_12, g_8_12, b_8_12, r_8_22, g_8_22, b_8_22; \ + __m128i u, v, r_temp, g_temp, b_temp; \ + __m128i r_1, g_1, b_1, r_2, g_2, b_2; \ + __m128i y_1, y_2; \ + __m128i r_uv_1, g_uv_1, b_uv_1, r_uv_2, g_uv_2, b_uv_2; \ + \ + READ_UV \ + \ + /* process first 16 pixels of first line */ \ + u = __lsx_vilvl_b(zero, u_temp); \ + v = __lsx_vilvl_b(zero, v_temp); \ + u = __lsx_vsub_h(u, bias); \ + v = __lsx_vsub_h(v, bias); \ + UV2RGB_16(u, v, r_1, g_1, b_1, r_2, g_2, b_2); \ + r_uv_1 = r_1; g_uv_1 = g_1; b_uv_1 = b_1; \ + r_uv_2 = r_2; g_uv_2 = g_2; b_uv_2 = b_2; \ + READ_Y(y_ptr1) \ + y_1 = __lsx_vilvl_b(zero, y); \ + y_2 = __lsx_vilvh_b(zero, y); \ + ADD_Y2RGB_16(y_1, y_2, r_1, g_1, b_1, r_2, g_2, b_2) \ + CLIP(r_1, g_1, b_1, r_2, g_2, b_2); \ + r_8_11 = __lsx_vpickev_b(r_2, r_1); \ + g_8_11 = __lsx_vpickev_b(g_2, g_1); \ + b_8_11 = __lsx_vpickev_b(b_2, b_1); \ + \ + /* process first 16 pixels of second line */ \ + r_1 = r_uv_1; g_1 = g_uv_1; b_1 = b_uv_1; \ + r_2 = r_uv_2; g_2 = g_uv_2; b_2 = b_uv_2; \ + \ + READ_Y(y_ptr2) \ + y_1 = __lsx_vilvl_b(zero, y); \ + y_2 = __lsx_vilvh_b(zero, y); \ + ADD_Y2RGB_16(y_1, y_2, r_1, g_1, b_1, r_2, g_2, b_2) \ + CLIP(r_1, g_1, b_1, r_2, g_2, b_2); \ + r_8_21 = __lsx_vpickev_b(r_2, r_1); \ + g_8_21 = __lsx_vpickev_b(g_2, g_1); \ + b_8_21 = __lsx_vpickev_b(b_2, b_1); \ + \ + /* process last 16 pixels of first line */ \ + u = __lsx_vilvh_b(zero, u_temp); \ + v = __lsx_vilvh_b(zero, v_temp); \ + u = __lsx_vsub_h(u, bias); \ + v = __lsx_vsub_h(v, bias); \ + UV2RGB_16(u, v, r_1, g_1, b_1, r_2, g_2, b_2); \ + r_uv_1 = r_1; g_uv_1 = g_1; b_uv_1 = b_1; \ + r_uv_2 = r_2; g_uv_2 = g_2; b_uv_2 = b_2; \ + READ_Y(y_ptr1 + 16 * y_pixel_stride) \ + y_1 = __lsx_vilvl_b(zero, y); \ + y_2 = __lsx_vilvh_b(zero, y); \ + ADD_Y2RGB_16(y_1, y_2, r_1, g_1, b_1, r_2, g_2, b_2) \ + CLIP(r_1, g_1, b_1, r_2, g_2, b_2); \ + r_8_12 = __lsx_vpickev_b(r_2, r_1); \ + g_8_12 = __lsx_vpickev_b(g_2, g_1); \ + b_8_12 = __lsx_vpickev_b(b_2, b_1); \ + \ + /* process last 16 pixels of second line */ \ + r_1 = r_uv_1; g_1 = g_uv_1; b_1 = b_uv_1; \ + r_2 = r_uv_2; g_2 = g_uv_2; b_2 = b_uv_2; \ + \ + READ_Y(y_ptr2 + 16 * y_pixel_stride) \ + y_1 = __lsx_vilvl_b(zero, y); \ + y_2 = __lsx_vilvh_b(zero, y); \ + ADD_Y2RGB_16(y_1, y_2, r_1, g_1, b_1, r_2, g_2, b_2) \ + CLIP(r_1, g_1, b_1, r_2, g_2, b_2); \ + r_8_22 = __lsx_vpickev_b(r_2, r_1); \ + g_8_22 = __lsx_vpickev_b(g_2, g_1); \ + b_8_22 = __lsx_vpickev_b(b_2, b_1); \ + \ + +void LSX_FUNCTION_NAME(uint32_t width, uint32_t height, const uint8_t *Y, + const uint8_t *U, const uint8_t *V, uint32_t Y_stride, + uint32_t UV_stride, uint8_t *RGB, uint32_t RGB_stride, + YCbCrType yuv_type) +{ + const YUV2RGBParam *const param = &(YUV2RGB[yuv_type]); +#if YUV_FORMAT == YUV_FORMAT_420 + const int y_pixel_stride = 1; + const int uv_pixel_stride = 1; + const int uv_x_sample_interval = 2; + const int uv_y_sample_interval = 2; +#endif + +#if RGB_FORMAT == RGB_FORMAT_RGB565 + const int rgb_pixel_stride = 2; +#elif RGB_FORMAT == RGB_FORMAT_RGB24 + const int rgb_pixel_stride = 3; + __m128i mask1 = {0x0504110302100100, 0x0A14090813070612}; + __m128i mask2 = {0x1808170716061505, 0x00000000000A1909}; + __m128i mask3 = {0x0504170302160100, 0x0A1A090819070618}; + __m128i mask4 = {0x1E0D1D0C1C0B1B0A, 0x00000000000F1F0E}; + __m128i mask5 = {0x05041C03021B0100, 0x0A1F09081E07061D}; +#elif RGB_FORMAT == RGB_FORMAT_RGBA || RGB_FORMAT_BGRA || \ + RGB_FORMAT == RGB_FORMAT_ARGB || RGB_FORMAT_ABGR + const int rgb_pixel_stride = 4; +#else +#error Unknown RGB pixel size +#endif + + uint32_t xpos, ypos; + __m128i v2r = __lsx_vreplgr2vr_h(param->v_r_factor); + __m128i v2g = __lsx_vreplgr2vr_h(param->v_g_factor); + __m128i u2g = __lsx_vreplgr2vr_h(param->u_g_factor); + __m128i u2b = __lsx_vreplgr2vr_h(param->u_b_factor); + __m128i bias = __lsx_vreplgr2vr_h(128); + __m128i shift = __lsx_vreplgr2vr_h(param->y_shift); + __m128i yf = __lsx_vreplgr2vr_h(param->y_factor); + __m128i zero = __lsx_vldi(0); + + if (width >= 32) { + for (ypos = 0; ypos < (height - (uv_y_sample_interval - 1)); ypos += uv_y_sample_interval) { + const uint8_t *y_ptr1 = Y + ypos * Y_stride, + *y_ptr2 = Y + (ypos + 1) * Y_stride, + *u_ptr = U + (ypos/uv_y_sample_interval) * UV_stride, + *v_ptr = V + (ypos/uv_y_sample_interval) * UV_stride; + uint8_t *rgb_ptr1 = RGB + ypos * RGB_stride, + *rgb_ptr2 = RGB + (ypos + 1) * RGB_stride; + + for (xpos = 0; xpos < (width - 31); xpos += 32){ + YUV2RGB_32 + { + PACK_PIXEL + SAVE_LINE1 + if (uv_y_sample_interval > 1) + { + SAVE_LINE2 + } + } + y_ptr1 += 32 * y_pixel_stride; + y_ptr2 += 32 * y_pixel_stride; + u_ptr += 32 * uv_pixel_stride/uv_x_sample_interval; + v_ptr += 32 * uv_pixel_stride/uv_x_sample_interval; + rgb_ptr1 += 32 * rgb_pixel_stride; + rgb_ptr2 += 32 * rgb_pixel_stride; + } + } + if (uv_y_sample_interval == 2 && ypos == (height - 1)) { + const uint8_t *y_ptr = Y + ypos * Y_stride, + *u_ptr = U + (ypos/uv_y_sample_interval) * UV_stride, + *v_ptr = V + (ypos/uv_y_sample_interval) * UV_stride; + uint8_t *rgb_ptr = RGB + ypos * RGB_stride; + STD_FUNCTION_NAME(width, 1, y_ptr, u_ptr, v_ptr, Y_stride, UV_stride, rgb_ptr, RGB_stride, yuv_type); + } + } + { + int converted = (width & ~31); + if (converted != width) + { + const uint8_t *y_ptr = Y + converted * y_pixel_stride, + *u_ptr = U + converted * uv_pixel_stride / uv_x_sample_interval, + *v_ptr = V + converted * uv_pixel_stride / uv_x_sample_interval; + uint8_t *rgb_ptr = RGB + converted * rgb_pixel_stride; + + STD_FUNCTION_NAME(width-converted, height, y_ptr, u_ptr, v_ptr, Y_stride, UV_stride, rgb_ptr, RGB_stride, yuv_type); + } + } +} + +#undef LSX_FUNCTION_NAME +#undef STD_FUNCTION_NAME +#undef YUV_FORMAT +#undef RGB_FORMAT +#undef LSX_ALIGNED +#undef LSX_ST_UB2 +#undef UV2RGB_16 +#undef ADD_Y2RGB_16 +#undef PACK_RGB24_32_STEP +#undef PACK_RGB24_32 +#undef PACK_PIXEL +#undef PACK_RGBA_32 +#undef SAVE_LINE1 +#undef SAVE_LINE2 +#undef READ_Y +#undef READ_UV +#undef YUV2RGB_32 diff -Nru libsdl2-2.0.22+dfsg/src/video/yuv2rgb/yuv_rgb_std_func.h libsdl2-2.24.0+dfsg/src/video/yuv2rgb/yuv_rgb_std_func.h --- libsdl2-2.0.22+dfsg/src/video/yuv2rgb/yuv_rgb_std_func.h 2021-07-27 14:52:29.000000000 +0000 +++ libsdl2-2.24.0+dfsg/src/video/yuv2rgb/yuv_rgb_std_func.h 2022-06-02 02:01:57.000000000 +0000 @@ -97,10 +97,13 @@ for(y=0; y<(height-(uv_y_sample_interval-1)); y+=uv_y_sample_interval) { const uint8_t *y_ptr1=Y+y*Y_stride, - *y_ptr2=Y+(y+1)*Y_stride, *u_ptr=U+(y/uv_y_sample_interval)*UV_stride, *v_ptr=V+(y/uv_y_sample_interval)*UV_stride; - + + #if uv_y_sample_interval > 1 + const uint8_t *y_ptr2=Y+(y+1)*Y_stride; + #endif + uint8_t *rgb_ptr1=RGB+y*RGB_stride; #if uv_y_sample_interval > 1 @@ -135,7 +138,9 @@ #endif y_ptr1+=2*y_pixel_stride; + #if uv_y_sample_interval > 1 y_ptr2+=2*y_pixel_stride; + #endif u_ptr+=2*uv_pixel_stride/uv_x_sample_interval; v_ptr+=2*uv_pixel_stride/uv_x_sample_interval; } diff -Nru libsdl2-2.0.22+dfsg/test/autogen.sh libsdl2-2.24.0+dfsg/test/autogen.sh --- libsdl2-2.0.22+dfsg/test/autogen.sh 2021-07-27 14:52:29.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/autogen.sh 2022-06-16 20:16:31.000000000 +0000 @@ -1,11 +1,9 @@ #!/bin/sh -cp acinclude.m4 aclocal.m4 +set -e -if test "$AUTOCONF"x = x; then - AUTOCONF=autoconf -fi +cp acinclude.m4 aclocal.m4 -$AUTOCONF || exit 1 +"${AUTOCONF:-autoconf}" rm aclocal.m4 rm -rf autom4te.cache diff -Nru libsdl2-2.0.22+dfsg/test/checkkeys.c libsdl2-2.24.0+dfsg/test/checkkeys.c --- libsdl2-2.0.22+dfsg/test/checkkeys.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/checkkeys.c 2022-08-13 03:48:10.000000000 +0000 @@ -24,8 +24,12 @@ #endif #include "SDL.h" +#include "SDL_test_font.h" -int done; +static SDL_Window *window; +static SDL_Renderer *renderer; +static SDLTest_TextWindow *textwin; +static int done; /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ static void @@ -163,12 +167,38 @@ case SDL_KEYDOWN: case SDL_KEYUP: PrintKey(&event.key.keysym, (event.key.state == SDL_PRESSED) ? SDL_TRUE : SDL_FALSE, (event.key.repeat) ? SDL_TRUE : SDL_FALSE); + if (event.type == SDL_KEYDOWN) { + switch (event.key.keysym.sym) { + case SDLK_BACKSPACE: + SDLTest_TextWindowAddText(textwin, "\b"); + break; + case SDLK_RETURN: + SDLTest_TextWindowAddText(textwin, "\n"); + break; + default: + break; + } + } break; case SDL_TEXTEDITING: - PrintText("EDIT", event.text.text); + PrintText("EDIT", event.edit.text); + break; + case SDL_TEXTEDITING_EXT: + PrintText("EDIT_EXT", event.editExt.text); + SDL_free(event.editExt.text); break; case SDL_TEXTINPUT: PrintText("INPUT", event.text.text); + SDLTest_TextWindowAddText(textwin, "%s", event.text.text); + break; + case SDL_FINGERDOWN: + if (SDL_IsTextInputActive()) { + SDL_Log("Stopping text input\n"); + SDL_StopTextInput(); + } else { + SDL_Log("Starting text input\n"); + SDL_StartTextInput(); + } break; case SDL_MOUSEBUTTONDOWN: /* Left button quits the app, other buttons toggles text input */ @@ -191,6 +221,16 @@ break; } } + + SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255); + SDL_RenderClear(renderer); + SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255); + SDLTest_TextWindowDisplay(textwin, renderer); + SDL_RenderPresent(renderer); + + /* Slow down framerate */ + SDL_Delay(100); + #ifdef __EMSCRIPTEN__ if (done) { emscripten_cancel_main_loop(); @@ -201,12 +241,15 @@ int main(int argc, char *argv[]) { - SDL_Window *window; - SDL_Renderer *renderer; - /* Enable standard application logging */ SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); + /* Disable mouse emulation */ + SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0"); + + /* Enable extended text editing events */ + SDL_SetHint(SDL_HINT_IME_SUPPORT_EXTENDED_TEXT, "1"); + /* Initialize SDL */ if (SDL_Init(SDL_INIT_VIDEO) < 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError()); @@ -223,11 +266,14 @@ quit(2); } - /* On wayland, no window will actually show until something has - actually been displayed. - */ renderer = SDL_CreateRenderer(window, -1, 0); - SDL_RenderPresent(renderer); + if (!renderer) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", + SDL_GetError()); + quit(2); + } + + textwin = SDLTest_TextWindowCreate(0, 0, 640, 480); #if __IPHONEOS__ /* Creating the context creates the view, which we need to show keyboard */ diff -Nru libsdl2-2.0.22+dfsg/test/CMakeLists.txt libsdl2-2.24.0+dfsg/test/CMakeLists.txt --- libsdl2-2.0.22+dfsg/test/CMakeLists.txt 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/CMakeLists.txt 2022-08-13 03:48:10.000000000 +0000 @@ -1,15 +1,21 @@ -cmake_minimum_required(VERSION 3.0.0) -project(SDL2 C) +cmake_minimum_required(VERSION 3.0) +project(SDL2_test) -# Global settings for all of the test targets -# FIXME: is this wrong? -remove_definitions(-DUSING_GENERATED_CONFIG_H) +if(NOT TARGET SDL2::SDL2-static) + find_package(SDL2 2.0.23 REQUIRED COMPONENTS SDL2-static SDL2test) +endif() + +enable_testing() + +if(SDL_INSTALL_TESTS) + include(GNUInstallDirs) +endif() if(PSP) link_libraries( - SDL2main - SDL2_test - SDL2-static + SDL2::SDL2main + SDL2::SDL2test + SDL2::SDL2-static GL pspvram pspvfpu @@ -21,8 +27,18 @@ psphprm psppower ) +elseif(PS2) +link_libraries( + SDL2main + SDL2_test + SDL2-static + patches + gskit + dmakit + ps2_drivers +) else() - link_libraries(SDL2_test SDL2-static) + link_libraries(SDL2::SDL2test SDL2::SDL2-static) endif() if(WINDOWS) @@ -39,6 +55,8 @@ # CMake incorrectly detects opengl32.lib being present on MSVC ARM64 if(NOT MSVC OR NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64") + # Prefer GLVND, if present + set(OpenGL_GL_PREFERENCE GLVND) find_package(OpenGL) endif() @@ -48,8 +66,8 @@ add_executable(checkkeys checkkeys.c) add_executable(checkkeysthreads checkkeysthreads.c) -add_executable(loopwave loopwave.c) -add_executable(loopwavequeue loopwavequeue.c) +add_executable(loopwave loopwave.c testutils.c) +add_executable(loopwavequeue loopwavequeue.c testutils.c) add_executable(testsurround testsurround.c) add_executable(testresample testresample.c) add_executable(testaudioinfo testaudioinfo.c) @@ -57,8 +75,8 @@ file(GLOB TESTAUTOMATION_SOURCE_FILES testautomation*.c) add_executable(testautomation ${TESTAUTOMATION_SOURCE_FILES}) -add_executable(testmultiaudio testmultiaudio.c) -add_executable(testaudiohotplug testaudiohotplug.c) +add_executable(testmultiaudio testmultiaudio.c testutils.c) +add_executable(testaudiohotplug testaudiohotplug.c testutils.c) add_executable(testaudiocapture testaudiocapture.c) add_executable(testatomic testatomic.c) add_executable(testintersections testintersections.c) @@ -68,9 +86,14 @@ add_executable(testdrawchessboard testdrawchessboard.c) add_executable(testdropfile testdropfile.c) add_executable(testerror testerror.c) + +if(LINUX) + add_executable(testevdev testevdev.c) +endif() + add_executable(testfile testfile.c) -add_executable(testgamecontroller testgamecontroller.c) -add_executable(testgeometry testgeometry.c) +add_executable(testgamecontroller testgamecontroller.c testutils.c) +add_executable(testgeometry testgeometry.c testutils.c) add_executable(testgesture testgesture.c) add_executable(testgl2 testgl2.c) add_executable(testgles testgles.c) @@ -79,62 +102,172 @@ add_executable(testhotplug testhotplug.c) add_executable(testrumble testrumble.c) add_executable(testthread testthread.c) -add_executable(testiconv testiconv.c) -add_executable(testime testime.c) +add_executable(testiconv testiconv.c testutils.c) +add_executable(testime testime.c testutils.c) add_executable(testjoystick testjoystick.c) add_executable(testkeys testkeys.c) add_executable(testloadso testloadso.c) +add_executable(testlocale testlocale.c) add_executable(testlock testlock.c) add_executable(testmouse testmouse.c) if(APPLE) add_executable(testnative testnative.c testnativecocoa.m - testnativex11.c) + testnativex11.c + testutils.c) elseif(WINDOWS) - add_executable(testnative testnative.c testnativew32.c) -elseif(UNIX) - add_executable(testnative testnative.c testnativex11.c) + add_executable(testnative testnative.c testnativew32.c testutils.c) +elseif(HAVE_X11) + add_executable(testnative testnative.c testnativex11.c testutils.c) + target_link_libraries(testnative X11) endif() -add_executable(testoverlay2 testoverlay2.c testyuv_cvt.c) +add_executable(testoverlay2 testoverlay2.c testyuv_cvt.c testutils.c) add_executable(testplatform testplatform.c) add_executable(testpower testpower.c) add_executable(testfilesystem testfilesystem.c) -add_executable(testrendertarget testrendertarget.c) -add_executable(testscale testscale.c) +add_executable(testrendertarget testrendertarget.c testutils.c) +add_executable(testscale testscale.c testutils.c) add_executable(testsem testsem.c) +add_executable(testsensor testsensor.c) add_executable(testshader testshader.c) add_executable(testshape testshape.c) -add_executable(testsprite2 testsprite2.c) -add_executable(testspriteminimal testspriteminimal.c) -add_executable(teststreaming teststreaming.c) +add_executable(testsprite2 testsprite2.c testutils.c) +add_executable(testspriteminimal testspriteminimal.c testutils.c) +add_executable(teststreaming teststreaming.c testutils.c) add_executable(testtimer testtimer.c) +add_executable(testurl testurl.c) add_executable(testver testver.c) -add_executable(testviewport testviewport.c) +add_executable(testviewport testviewport.c testutils.c) add_executable(testwm2 testwm2.c) add_executable(testyuv testyuv.c testyuv_cvt.c) add_executable(torturethread torturethread.c) -add_executable(testrendercopyex testrendercopyex.c) +add_executable(testrendercopyex testrendercopyex.c testutils.c) add_executable(testmessage testmessage.c) add_executable(testdisplayinfo testdisplayinfo.c) add_executable(testqsort testqsort.c) add_executable(testbounds testbounds.c) add_executable(testcustomcursor testcustomcursor.c) -add_executable(controllermap controllermap.c) +add_executable(controllermap controllermap.c testutils.c) add_executable(testvulkan testvulkan.c) add_executable(testoffscreen testoffscreen.c) +SET(ALL_TESTS + checkkeys + checkkeysthreads + controllermap + loopwave + loopwavequeue + testatomic + testaudiocapture + testaudiohotplug + testaudioinfo + testautomation + testbounds + testcustomcursor + testdisplayinfo + testdraw2 + testdrawchessboard + testdropfile + testerror + testfile + testfilesystem + testgamecontroller + testgeometry + testgesture + testgl2 + testgles + testgles2 + testhaptic + testhittesting + testhotplug + testiconv + testime + testintersections + testjoystick + testkeys + testloadso + testlocale + testlock + testmessage + testmouse + testmultiaudio + testoffscreen + testoverlay2 + testplatform + testpower + testqsort + testrelative + testrendercopyex + testrendertarget + testresample + testrumble + testscale + testsem + testsensor + testshader + testshape + testsprite2 + testspriteminimal + teststreaming + testsurround + testthread + testtimer + testurl + testver + testviewport + testvulkan + testwm2 + testyuv + torturethread +) + +set(NONINTERACTIVE + testatomic + testerror + testfilesystem + testlocale + testplatform + testpower + testqsort + testthread + testtimer + testver +) + +if(WINDOWS OR APPLE OR SDL_X11) + list(APPEND ALL_TESTS testnative) +endif() + +if(LINUX) + list(APPEND ALL_TESTS testevdev) + list(APPEND NONINTERACTIVE testevdev) +endif() + +if(SDL_DUMMYAUDIO) + set(NEEDS_AUDIO + testaudioinfo + testsurround + ) +endif() + +if(SDL_DUMMYVIDEO) + set(NEEDS_DISPLAY + testkeys + testbounds + testdisplayinfo + ) +endif() + if(OPENGL_FOUND) -add_dependencies(testshader OpenGL::GL) -add_dependencies(testgl2 OpenGL::GL) -target_link_libraries(testshader OpenGL::GL) -target_link_libraries(testgl2 OpenGL::GL) + target_link_libraries(testshader OpenGL::GL) + target_link_libraries(testgl2 OpenGL::GL) endif() file(GLOB RESOURCE_FILES *.bmp *.wav *.hex moose.dat utf8.txt) file(COPY ${RESOURCE_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) -if(PSP) +if(PSP OR PS2) set(NEEDS_RESOURCES testscale testrendercopyex @@ -177,47 +310,49 @@ testaudiohotplug testmultiaudio testime - testnative testiconv testoverlay2 teststreaming testviewport ) + if(WINDOWS OR APPLE OR HAVE_X11) + list(APPEND NEEDS_RESOURCES testnative) + endif() endif() if(PSP) # Build EBOOT files if building for PSP set(BUILD_EBOOT ${NEEDS_RESOURCES} + testatomic + testaudiocapture + testaudioinfo testbounds - testgl2 - testsem testdisplayinfo - teststreaming - testgeometry - testfile testdraw2 - testviewport - testhittesting - testoverlay2 - testver testdrawchessboard - testsurround - testintersections - testmessage - testaudiocapture testerror - testatomic - testjoystick - testiconv + testfile testfilesystem + testgeometry + testgl2 + testhittesting + testiconv + testintersections + testjoystick + testlock + testmessage + testoverlay2 testplatform - testthread + testpower testqsort - testaudioinfo - testlock + testsem + teststreaming + testsurround + testthread testtimer - testpower + testver + testviewport testwm2 torturethread ) @@ -262,9 +397,23 @@ endforeach() endif() +if(RISCOS) + set(ALL_TESTS_AIF "") + foreach(APP IN LISTS ALL_TESTS) + target_link_options(${APP} PRIVATE -static) + add_custom_command( + OUTPUT ${APP},ff8 + COMMAND elf2aif ${APP} ${APP},ff8 + DEPENDS ${APP} + ) + add_custom_target(${APP}-aif ALL DEPENDS ${APP},ff8) + list(APPEND ALL_TESTS_AIF ${CMAKE_CURRENT_BINARY_DIR}/${APP},ff8) + endforeach() +endif() + foreach(APP IN LISTS NEEDS_RESOURCES) foreach(RESOURCE_FILE ${RESOURCE_FILES}) - if(PSP) + if(PSP OR PS2) add_custom_command(TARGET ${APP} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${RESOURCE_FILE} $/sdl-${APP}) else() add_custom_command(TARGET ${APP} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${RESOURCE_FILE} $) @@ -298,3 +447,47 @@ endforeach() endif() endif() + +set(TESTS_ENVIRONMENT + SDL_AUDIODRIVER=dummy + SDL_VIDEODRIVER=dummy +) + +foreach(TESTCASE ${NONINTERACTIVE} ${NEEDS_AUDIO} ${NEEDS_DISPLAY}) + add_test( + NAME ${TESTCASE} + COMMAND ${TESTCASE} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + set_tests_properties( + ${TESTCASE} + PROPERTIES ENVIRONMENT "${TESTS_ENVIRONMENT}" + ) + if(SDL_INSTALL_TESTS) + set(exe ${TESTCASE}) + set(installedtestsdir "${CMAKE_INSTALL_FULL_LIBEXECDIR}/installed-tests/SDL2") + configure_file(template.test.in "${exe}.test" @ONLY) + install( + FILES "${CMAKE_CURRENT_BINARY_DIR}/${exe}.test" + DESTINATION ${CMAKE_INSTALL_DATADIR}/installed-tests/SDL2 + ) + endif() +endforeach() + +if(SDL_INSTALL_TESTS) + if(RISCOS) + install( + FILES ${ALL_TESTS_AIF} + DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/installed-tests/SDL2 + ) + else() + install( + TARGETS ${ALL_TESTS} + DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/installed-tests/SDL2 + ) + endif() + install( + FILES ${RESOURCE_FILES} + DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/installed-tests/SDL2 + ) +endif() diff -Nru libsdl2-2.0.22+dfsg/test/configure libsdl2-2.24.0+dfsg/test/configure --- libsdl2-2.0.22+dfsg/test/configure 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/configure 2022-06-16 20:16:31.000000000 +0000 @@ -1,9 +1,10 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69. +# Generated by GNU Autoconf 2.71. # # -# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, +# Inc. # # # This configure script is free software; the Free Software Foundation @@ -14,14 +15,16 @@ # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -31,46 +34,46 @@ fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -79,13 +82,6 @@ fi -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -94,8 +90,12 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS @@ -107,30 +107,10 @@ as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. @@ -152,20 +132,22 @@ exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + as_bourne_compatible="as_nop=: +if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST -else +else \$as_nop case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( @@ -185,41 +167,52 @@ as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : +if ( set x; as_fn_ret_success y && test x = \"\$1\" ) +then : -else +else \$as_nop exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 +blah=\$(echo \$(echo blah)) +test x\"\$blah\" = xblah || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1" - if (eval "$as_required") 2>/dev/null; then : + if (eval "$as_required") 2>/dev/null +then : as_have_required=yes -else +else $as_nop as_have_required=no fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null +then : -else +else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base + as_shell=$as_dir$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null +then : break 2 fi fi @@ -227,14 +220,21 @@ esac as_found=false done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi +fi - if test "x$CONFIG_SHELL" != x; then : + if test "x$CONFIG_SHELL" != x +then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also @@ -252,18 +252,19 @@ exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." + if test x$as_have_required = xno +then : + printf "%s\n" "$0: This script requires a shell more modern than all" + printf "%s\n" "$0: the shells that I found on your system." + if test ${ZSH_VERSION+y} ; then + printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" + printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." else - $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, + printf "%s\n" "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." @@ -290,6 +291,7 @@ } as_unset=as_fn_unset + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -307,6 +309,14 @@ as_fn_set_status $1 exit $1 } # as_fn_exit +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop # as_fn_mkdir_p # ------------- @@ -321,7 +331,7 @@ as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -330,7 +340,7 @@ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | +printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -369,12 +379,13 @@ # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : eval 'as_fn_append () { eval $1+=\$2 }' -else +else $as_nop as_fn_append () { eval $1=\$$1\$2 @@ -386,18 +397,27 @@ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else +else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- @@ -409,9 +429,9 @@ as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $2" >&2 + printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -438,7 +458,7 @@ $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -482,7 +502,7 @@ s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall @@ -496,6 +516,10 @@ exit } + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -509,6 +533,13 @@ ECHO_N='-n';; esac +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -574,12 +605,12 @@ MAKEFLAGS= # Identity of this package. -PACKAGE_NAME= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= -PACKAGE_URL= +PACKAGE_NAME='' +PACKAGE_TARNAME='' +PACKAGE_VERSION='' +PACKAGE_STRING='' +PACKAGE_BUGREPORT='' +PACKAGE_URL='' ac_unique_file="loopwave.c" ac_subst_vars='LTLIBOBJS @@ -643,6 +674,7 @@ docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -725,6 +757,7 @@ sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' @@ -754,8 +787,6 @@ *) ac_optarg=yes ;; esac - # Accept the important Cygnus configure options, so we can diagnose typos. - case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; @@ -796,9 +827,9 @@ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -822,9 +853,9 @@ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -977,6 +1008,15 @@ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1026,9 +1066,9 @@ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1042,9 +1082,9 @@ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1088,9 +1128,9 @@ *) # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; @@ -1106,7 +1146,7 @@ case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1114,7 +1154,7 @@ for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1170,7 +1210,7 @@ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | +printf "%s\n" X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -1267,6 +1307,7 @@ --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -1352,9 +1393,9 @@ case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -1382,7 +1423,8 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. + # Check for configure.gnu first; this name is used for a wrapper for + # Metaconfig's "Configure" on case-insensitive file systems. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive @@ -1390,7 +1432,7 @@ echo && $SHELL "$ac_srcdir/configure" --help=recursive else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done @@ -1400,9 +1442,9 @@ if $ac_init_version; then cat <<\_ACEOF configure -generated by GNU Autoconf 2.69 +generated by GNU Autoconf 2.71 -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1419,14 +1461,14 @@ ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext + rm -f conftest.$ac_objext conftest.beam if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1434,14 +1476,15 @@ cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then : + } && test -s conftest.$ac_objext +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1457,14 +1500,14 @@ ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1472,17 +1515,18 @@ cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext - }; then : + } +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1499,8 +1543,8 @@ # ac_fn_c_try_run LINENO # ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. +# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that +# executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack @@ -1510,25 +1554,26 @@ *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } +then : ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: program exited with status $ac_status" >&5 + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status @@ -1551,7 +1596,7 @@ *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1559,14 +1604,15 @@ cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err - }; then : + } +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1575,14 +1621,34 @@ as_fn_set_status $ac_retval } # ac_fn_c_try_cpp +ac_configure_args_raw= +for ac_arg +do + case $ac_arg in + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append ac_configure_args_raw " '$ac_arg'" +done + +case $ac_configure_args_raw in + *$as_nl*) + ac_safe_unquote= ;; + *) + ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. + ac_unsafe_a="$ac_unsafe_z#~" + ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" + ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; +esac + cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was -generated by GNU Autoconf 2.69. Invocation command line was +generated by GNU Autoconf 2.71. Invocation command line was - $ $0 $@ + $ $0$ac_configure_args_raw _ACEOF exec 5>>config.log @@ -1615,8 +1681,12 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + printf "%s\n" "PATH: $as_dir" done IFS=$as_save_IFS @@ -1651,7 +1721,7 @@ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; @@ -1686,11 +1756,13 @@ # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? + # Sanitize IFS. + IFS=" "" $as_nl" # Save into config.log some information that might help in debugging. { echo - $as_echo "## ---------------- ## + printf "%s\n" "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo @@ -1701,8 +1773,8 @@ case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -1726,7 +1798,7 @@ ) echo - $as_echo "## ----------------- ## + printf "%s\n" "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo @@ -1734,14 +1806,14 @@ do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - $as_echo "$ac_var='\''$ac_val'\''" + printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## + printf "%s\n" "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo @@ -1749,15 +1821,15 @@ do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - $as_echo "$ac_var='\''$ac_val'\''" + printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then - $as_echo "## ----------- ## + printf "%s\n" "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo @@ -1765,8 +1837,8 @@ echo fi test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" + printf "%s\n" "$as_me: caught signal $ac_signal" + printf "%s\n" "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && @@ -1780,63 +1852,48 @@ # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h -$as_echo "/* confdefs.h */" > confdefs.h +printf "%s\n" "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF +printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF +printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF +printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF +printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF +printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF +printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac + ac_site_files="$CONFIG_SITE" elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site + ac_site_files="$prefix/share/config.site $prefix/etc/config.site" else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site + ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" + +for ac_site_file in $ac_site_files do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} + case $ac_site_file in #( + */*) : + ;; #( + *) : + ac_site_file=./$ac_site_file ;; +esac + if test -f "$ac_site_file" && test -r "$ac_site_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi @@ -1846,19 +1903,425 @@ # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +printf "%s\n" "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +printf "%s\n" "$as_me: creating cache $cache_file" >&6;} >$cache_file fi +# Test code for whether the C compiler supports C89 (global declarations) +ac_c_conftest_c89_globals=' +/* Does the compiler advertise C89 conformance? + Do not test the value of __STDC__, because some compilers set it to 0 + while being otherwise adequately conformant. */ +#if !defined __STDC__ +# error "Compiler does not advertise C89 conformance" +#endif + +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ +struct buf { int x; }; +struct buf * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not \xHH hex character constants. + These do not provoke an error unfortunately, instead are silently treated + as an "x". The following induces an error, until -std is added to get + proper ANSI mode. Curiously \x00 != x always comes out true, for an + array size at least. It is necessary to write \x00 == 0 to get something + that is true only with -std. */ +int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) '\''x'\'' +int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), + int, int);' + +# Test code for whether the C compiler supports C89 (body of main). +ac_c_conftest_c89_main=' +ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); +' + +# Test code for whether the C compiler supports C99 (global declarations) +ac_c_conftest_c99_globals=' +// Does the compiler advertise C99 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L +# error "Compiler does not advertise C99 conformance" +#endif + +#include +extern int puts (const char *); +extern int printf (const char *, ...); +extern int dprintf (int, const char *, ...); +extern void *malloc (size_t); + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +// dprintf is used instead of fprintf to avoid needing to declare +// FILE and stderr. +#define debug(...) dprintf (2, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + #error "your preprocessor is broken" +#endif +#if BIG_OK +#else + #error "your preprocessor is broken" +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static bool +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str = ""; + int number = 0; + float fnumber = 0; + + while (*format) + { + switch (*format++) + { + case '\''s'\'': // string + str = va_arg (args_copy, const char *); + break; + case '\''d'\'': // int + number = va_arg (args_copy, int); + break; + case '\''f'\'': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); + + return *str && number && fnumber; +} +' + +# Test code for whether the C compiler supports C99 (body of main). +ac_c_conftest_c99_main=' + // Check bool. + _Bool success = false; + success |= (argc != 0); + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[0] = argv[0][0]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' + || dynamic_array[ni.number - 1] != 543); +' + +# Test code for whether the C compiler supports C11 (global declarations) +ac_c_conftest_c11_globals=' +// Does the compiler advertise C11 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L +# error "Compiler does not advertise C11 conformance" +#endif + +// Check _Alignas. +char _Alignas (double) aligned_as_double; +char _Alignas (0) no_special_alignment; +extern char aligned_as_int; +char _Alignas (0) _Alignas (int) aligned_as_int; + +// Check _Alignof. +enum +{ + int_alignment = _Alignof (int), + int_array_alignment = _Alignof (int[100]), + char_alignment = _Alignof (char) +}; +_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); + +// Check _Noreturn. +int _Noreturn does_not_return (void) { for (;;) continue; } + +// Check _Static_assert. +struct test_static_assert +{ + int x; + _Static_assert (sizeof (int) <= sizeof (long int), + "_Static_assert does not work in struct"); + long int y; +}; + +// Check UTF-8 literals. +#define u8 syntax error! +char const utf8_literal[] = u8"happens to be ASCII" "another string"; + +// Check duplicate typedefs. +typedef long *long_ptr; +typedef long int *long_ptr; +typedef long_ptr long_ptr; + +// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. +struct anonymous +{ + union { + struct { int i; int j; }; + struct { int k; long int l; } w; + }; + int m; +} v1; +' + +# Test code for whether the C compiler supports C11 (body of main). +ac_c_conftest_c11_main=' + _Static_assert ((offsetof (struct anonymous, i) + == offsetof (struct anonymous, w.k)), + "Anonymous union alignment botch"); + v1.i = 2; + v1.w.k = 5; + ok |= v1.i != 5; +' + +# Test code for whether the C compiler supports C11 (complete). +ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} +${ac_c_conftest_c11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + ${ac_c_conftest_c11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C99 (complete). +ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + return ok; +} +" + +# Test code for whether the C compiler supports C89 (complete). +ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + return ok; +} +" + + +# Auxiliary files required by this configure script. +ac_aux_files="config.guess config.sub" + +# Locations in which to look for auxiliary files. +ac_aux_dir_candidates="${srcdir}/../build-scripts" + +# Search for a directory containing all of the required auxiliary files, +# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. +# If we don't find one directory that contains all the files we need, +# we report the set of missing files from the *first* directory in +# $ac_aux_dir_candidates and give up. +ac_missing_aux_files="" +ac_first_candidate=: +printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in $ac_aux_dir_candidates +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + + printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 + ac_aux_dir_found=yes + ac_install_sh= + for ac_aux in $ac_aux_files + do + # As a special case, if "install-sh" is required, that requirement + # can be satisfied by any of "install-sh", "install.sh", or "shtool", + # and $ac_install_sh is set appropriately for whichever one is found. + if test x"$ac_aux" = x"install-sh" + then + if test -f "${as_dir}install-sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 + ac_install_sh="${as_dir}install-sh -c" + elif test -f "${as_dir}install.sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 + ac_install_sh="${as_dir}install.sh -c" + elif test -f "${as_dir}shtool"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 + ac_install_sh="${as_dir}shtool install -c" + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} install-sh" + else + break + fi + fi + else + if test -f "${as_dir}${ac_aux}"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" + else + break + fi + fi + fi + done + if test "$ac_aux_dir_found" = yes; then + ac_aux_dir="$as_dir" + break + fi + ac_first_candidate=false + + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 +fi + + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +if test -f "${ac_aux_dir}config.guess"; then + ac_config_guess="$SHELL ${ac_aux_dir}config.guess" +fi +if test -f "${ac_aux_dir}config.sub"; then + ac_config_sub="$SHELL ${ac_aux_dir}config.sub" +fi +if test -f "$ac_aux_dir/configure"; then + ac_configure="$SHELL ${ac_aux_dir}configure" +fi + # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false @@ -1869,12 +2332,12 @@ eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) @@ -1883,24 +2346,24 @@ ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in @@ -1910,11 +2373,12 @@ fi done if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' + and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## @@ -1929,55 +2393,31 @@ -ac_aux_dir= -for ac_dir in ../build-scripts "$srcdir"/../build-scripts; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in ../build-scripts \"$srcdir\"/../build-scripts" "$LINENO" 5 -fi -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. -# Make sure we can run config.sub. -$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 -$as_echo_n "checking build system type... " >&6; } -if ${ac_cv_build+:} false; then : - $as_echo_n "(cached) " >&6 -else + + # Make sure we can run config.sub. +$SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +printf %s "checking build system type... " >&6; } +if test ${ac_cv_build+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_build_alias=$build_alias test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` + ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 -ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 +ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 -$as_echo "$ac_cv_build" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +printf "%s\n" "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; @@ -1996,21 +2436,22 @@ case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 -$as_echo_n "checking host system type... " >&6; } -if ${ac_cv_host+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +printf %s "checking host system type... " >&6; } +if test ${ac_cv_host+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else - ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 + ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 -$as_echo "$ac_cv_host" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +printf "%s\n" "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; @@ -2030,6 +2471,15 @@ + + + + + + + + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -2038,11 +2488,12 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -2050,11 +2501,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2065,11 +2520,11 @@ fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2078,11 +2533,12 @@ ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -2090,11 +2546,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2105,11 +2565,11 @@ fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then @@ -2117,8 +2577,8 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -2131,11 +2591,12 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -2143,11 +2604,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2158,11 +2623,11 @@ fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2171,11 +2636,12 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -2184,15 +2650,19 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2208,18 +2678,18 @@ # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2230,11 +2700,12 @@ do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -2242,11 +2713,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2257,11 +2732,11 @@ fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2274,11 +2749,12 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -2286,11 +2762,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2301,11 +2781,11 @@ fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2317,34 +2797,138 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. +set dummy ${ac_tool_prefix}clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "clang", so it can be a program name with args. +set dummy clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi +else + CC="$ac_cv_prog_CC" fi fi -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 -for ac_option in --version -v -V -qversion; do +for ac_option in --version -v -V -qversion -version; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -2354,7 +2938,7 @@ cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done @@ -2362,7 +2946,7 @@ /* end confdefs.h. */ int -main () +main (void) { ; @@ -2374,9 +2958,9 @@ # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +printf %s "checking whether the C compiler works... " >&6; } +ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" @@ -2397,11 +2981,12 @@ *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, @@ -2418,7 +3003,7 @@ # certainly right. break;; *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi @@ -2434,44 +3019,46 @@ done test "$ac_cv_exeext" = no && ac_cv_exeext= -else +else $as_nop ac_file='' fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 +if test -z "$ac_file" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +printf %s "checking for C compiler default output file name... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +printf "%s\n" "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +printf %s "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with @@ -2485,15 +3072,15 @@ * ) break;; esac done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +printf "%s\n" "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext @@ -2502,7 +3089,7 @@ /* end confdefs.h. */ #include int -main () +main (void) { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; @@ -2514,8 +3101,8 @@ ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +printf %s "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in @@ -2523,10 +3110,10 @@ *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in @@ -2534,39 +3121,40 @@ *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C compiled programs. + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +printf "%s\n" "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +printf %s "checking for suffix of object files... " >&6; } +if test ${ac_cv_objext+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; @@ -2580,11 +3168,12 @@ *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in @@ -2593,31 +3182,32 @@ break;; esac done -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +printf "%s\n" "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 +printf %s "checking whether the compiler supports GNU C... " >&6; } +if test ${ac_cv_c_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { #ifndef __GNUC__ choke me @@ -2627,29 +3217,33 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_compiler_gnu=yes -else +else $as_nop ac_compiler_gnu=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_c_compiler_gnu + if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi -ac_test_CFLAGS=${CFLAGS+set} +ac_test_CFLAGS=${CFLAGS+y} ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +printf %s "checking whether $CC accepts -g... " >&6; } +if test ${ac_cv_prog_cc_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no @@ -2658,57 +3252,60 @@ /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_g=yes -else +else $as_nop CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : -else +else $as_nop ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_g=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +printf "%s\n" "$ac_cv_prog_cc_g" >&6; } +if test $ac_test_CFLAGS; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then @@ -2723,94 +3320,144 @@ CFLAGS= fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no +ac_prog_cc_stdc=no +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 +printf %s "checking for $CC option to enable C11 features... " >&6; } +if test ${ac_cv_prog_cc_c11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c11=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; +$ac_c_conftest_c11_program +_ACEOF +for ac_arg in '' -std=gnu11 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c11" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; +if test "x$ac_cv_prog_cc_c11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } + CC="$CC $ac_cv_prog_cc_c11" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 + ac_prog_cc_stdc=c11 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 +printf %s "checking for $CC option to enable C99 features... " >&6; } +if test ${ac_cv_prog_cc_c99+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c99_program +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} +if test "x$ac_cv_prog_cc_c99" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c99" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } + CC="$CC $ac_cv_prog_cc_c99" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 + ac_prog_cc_stdc=c99 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 +printf %s "checking for $CC option to enable C89 features... " >&6; } +if test ${ac_cv_prog_cc_c89+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c89_program _ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : + if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_c89=$ac_arg fi -rm -f core conftest.err conftest.$ac_objext +rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC - fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : +if test "x$ac_cv_prog_cc_c89" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c89" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } + CC="$CC $ac_cv_prog_cc_c89" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 + ac_prog_cc_stdc=c89 +fi fi ac_ext=c @@ -2821,16 +3468,17 @@ -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 -$as_echo_n "checking for an ANSI C-conforming const... " >&6; } -if ${ac_cv_c_const+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 +printf %s "checking for an ANSI C-conforming const... " >&6; } +if test ${ac_cv_c_const+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { #ifndef __cplusplus @@ -2843,7 +3491,7 @@ /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; - /* AIX XL C 1.02.0.0 rejects this. + /* IBM XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ @@ -2871,7 +3519,7 @@ iptr p = 0; ++p; } - { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying + { /* IBM XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; } bx; struct s *b = &bx; b->j = 5; @@ -2887,18 +3535,19 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_c_const=yes -else +else $as_nop ac_cv_c_const=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 -$as_echo "$ac_cv_c_const" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 +printf "%s\n" "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then -$as_echo "#define const /**/" >>confdefs.h +printf "%s\n" "#define const /**/" >>confdefs.h fi @@ -2939,11 +3588,12 @@ MATHLIB="" # Extract the first word of "osmesa-config", so it can be a program name with args. set dummy osmesa-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_OSMESA_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_OSMESA_CONFIG+y} +then : + printf %s "(cached) " >&6 +else $as_nop case $OSMESA_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_OSMESA_CONFIG="$OSMESA_CONFIG" # Let the user override the test with a path. @@ -2953,11 +3603,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_OSMESA_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_OSMESA_CONFIG="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2970,11 +3624,11 @@ fi OSMESA_CONFIG=$ac_cv_path_OSMESA_CONFIG if test -n "$OSMESA_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OSMESA_CONFIG" >&5 -$as_echo "$OSMESA_CONFIG" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OSMESA_CONFIG" >&5 +printf "%s\n" "$OSMESA_CONFIG" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3012,11 +3666,12 @@ ISUNIX="true" EXE="" MATHLIB="-lm" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for glBegin in -lOpenGL" >&5 -$as_echo_n "checking for glBegin in -lOpenGL... " >&6; } -if ${ac_cv_lib_OpenGL_glBegin+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for glBegin in -lOpenGL" >&5 +printf %s "checking for glBegin in -lOpenGL... " >&6; } +if test ${ac_cv_lib_OpenGL_glBegin+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lOpenGL $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3025,32 +3680,31 @@ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char glBegin (); int -main () +main (void) { return glBegin (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_OpenGL_glBegin=yes -else +else $as_nop ac_cv_lib_OpenGL_glBegin=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_OpenGL_glBegin" >&5 -$as_echo "$ac_cv_lib_OpenGL_glBegin" >&6; } -if test "x$ac_cv_lib_OpenGL_glBegin" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_OpenGL_glBegin" >&5 +printf "%s\n" "$ac_cv_lib_OpenGL_glBegin" >&6; } +if test "x$ac_cv_lib_OpenGL_glBegin" = xyes +then : SYS_GL_LIBS="-lOpenGL" -else +else $as_nop SYS_GL_LIBS="-lGL" fi @@ -3074,11 +3728,12 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_PKG_CONFIG+y} +then : + printf %s "(cached) " >&6 +else $as_nop case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. @@ -3088,11 +3743,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3104,11 +3763,11 @@ fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 -$as_echo "$PKG_CONFIG" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +printf "%s\n" "$PKG_CONFIG" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3117,11 +3776,12 @@ ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_ac_pt_PKG_CONFIG+y} +then : + printf %s "(cached) " >&6 +else $as_nop case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. @@ -3131,11 +3791,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3147,11 +3811,11 @@ fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 -$as_echo "$ac_pt_PKG_CONFIG" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +printf "%s\n" "$ac_pt_PKG_CONFIG" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then @@ -3159,8 +3823,8 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG @@ -3172,37 +3836,40 @@ fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 -$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +printf %s "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } PKG_CONFIG="" fi fi # Check whether --with-sdl-prefix was given. -if test "${with_sdl_prefix+set}" = set; then : +if test ${with_sdl_prefix+y} +then : withval=$with_sdl_prefix; sdl_prefix="$withval" -else +else $as_nop sdl_prefix="" fi # Check whether --with-sdl-exec-prefix was given. -if test "${with_sdl_exec_prefix+set}" = set; then : +if test ${with_sdl_exec_prefix+y} +then : withval=$with_sdl_exec_prefix; sdl_exec_prefix="$withval" -else +else $as_nop sdl_exec_prefix="" fi # Check whether --enable-sdltest was given. -if test "${enable_sdltest+set}" = set; then : +if test ${enable_sdltest+y} +then : enableval=$enable_sdltest; -else +else $as_nop enable_sdltest=yes fi @@ -3212,17 +3879,17 @@ if test "x$sdl_prefix$sdl_exec_prefix" = x ; then pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sdl2 >= $min_sdl_version" >&5 -$as_echo_n "checking for sdl2 >= $min_sdl_version... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sdl2 >= $min_sdl_version" >&5 +printf %s "checking for sdl2 >= $min_sdl_version... " >&6; } if test -n "$SDL_CFLAGS"; then pkg_cv_SDL_CFLAGS="$SDL_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl2 >= \$min_sdl_version\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl2 >= \$min_sdl_version\""; } >&5 ($PKG_CONFIG --exists --print-errors "sdl2 >= $min_sdl_version") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_SDL_CFLAGS=`$PKG_CONFIG --cflags "sdl2 >= $min_sdl_version" 2>/dev/null` else @@ -3235,10 +3902,10 @@ pkg_cv_SDL_LIBS="$SDL_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl2 >= \$min_sdl_version\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl2 >= \$min_sdl_version\""; } >&5 ($PKG_CONFIG --exists --print-errors "sdl2 >= $min_sdl_version") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_SDL_LIBS=`$PKG_CONFIG --libs "sdl2 >= $min_sdl_version" 2>/dev/null` else @@ -3251,8 +3918,8 @@ if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -3269,14 +3936,14 @@ sdl_pc=no elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } sdl_pc=no else SDL_CFLAGS=$pkg_cv_SDL_CFLAGS SDL_LIBS=$pkg_cv_SDL_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } sdl_pc=yes fi else @@ -3305,11 +3972,12 @@ fi # Extract the first word of "sdl2-config", so it can be a program name with args. set dummy sdl2-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_SDL2_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_SDL2_CONFIG+y} +then : + printf %s "(cached) " >&6 +else $as_nop case $SDL2_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_SDL2_CONFIG="$SDL2_CONFIG" # Let the user override the test with a path. @@ -3319,11 +3987,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_SDL2_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_SDL2_CONFIG="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3336,17 +4008,17 @@ fi SDL2_CONFIG=$ac_cv_path_SDL2_CONFIG if test -n "$SDL2_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SDL2_CONFIG" >&5 -$as_echo "$SDL2_CONFIG" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $SDL2_CONFIG" >&5 +printf "%s\n" "$SDL2_CONFIG" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi PATH="$as_save_PATH" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SDL - version >= $min_sdl_version" >&5 -$as_echo_n "checking for SDL - version >= $min_sdl_version... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SDL - version >= $min_sdl_version" >&5 +printf %s "checking for SDL - version >= $min_sdl_version... " >&6; } no_sdl="" if test "$SDL2_CONFIG" = "no" ; then @@ -3369,9 +4041,10 @@ CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" LIBS="$LIBS $SDL_LIBS" rm -f conf.sdltest - if test "$cross_compiling" = yes; then : + if test "$cross_compiling" = yes +then : echo $ac_n "cross compiling; assumed OK... $ac_c" -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -3411,9 +4084,10 @@ _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : -else +else $as_nop no_sdl=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -3426,11 +4100,11 @@ fi fi if test "x$no_sdl" = x ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi fi if test "x$no_sdl" = x ; then @@ -3461,14 +4135,15 @@ #define main K_and_R_C_main int -main () +main (void) { return 0; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding SDL or finding the wrong" echo "*** version of SDL. If it is not finding SDL, you'll need to set your" @@ -3478,13 +4153,13 @@ echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" -else +else $as_nop echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means SDL was incorrectly installed" echo "*** or that you have moved SDL since it was installed. In the latter case, you" echo "*** may want to edit the sdl2-config script: $SDL2_CONFIG" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$ac_save_CFLAGS" CXXFLAGS="$ac_save_CXXFLAGS" @@ -3508,40 +4183,36 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +printf %s "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + if test ${ac_cv_prog_CPP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # Double quotes because $CC needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif +#include Syntax error _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : +if ac_fn_c_try_cpp "$LINENO" +then : -else +else $as_nop # Broken: fails on valid input. continue fi @@ -3553,10 +4224,11 @@ /* end confdefs.h. */ #include _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : +if ac_fn_c_try_cpp "$LINENO" +then : # Broken: success on invalid input. continue -else +else $as_nop # Passes both tests. ac_preproc_ok=: break @@ -3566,7 +4238,8 @@ done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : +if $ac_preproc_ok +then : break fi @@ -3578,29 +4251,24 @@ else ac_cv_prog_CPP=$CPP fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +printf "%s\n" "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif +#include Syntax error _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : +if ac_fn_c_try_cpp "$LINENO" +then : -else +else $as_nop # Broken: fails on valid input. continue fi @@ -3612,10 +4280,11 @@ /* end confdefs.h. */ #include _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : +if ac_fn_c_try_cpp "$LINENO" +then : # Broken: success on invalid input. continue -else +else $as_nop # Passes both tests. ac_preproc_ok=: break @@ -3625,11 +4294,12 @@ done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : +if $ac_preproc_ok +then : -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi @@ -3641,12 +4311,13 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for X" >&5 -$as_echo_n "checking for X... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for X" >&5 +printf %s "checking for X... " >&6; } # Check whether --with-x was given. -if test "${with_x+set}" = set; then : +if test ${with_x+y} +then : withval=$with_x; fi @@ -3657,9 +4328,10 @@ else case $x_includes,$x_libraries in #( *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5;; #( - *,NONE | NONE,*) if ${ac_cv_have_x+:} false; then : - $as_echo_n "(cached) " >&6 -else + *,NONE | NONE,*) if test ${ac_cv_have_x+y} +then : + printf %s "(cached) " >&6 +else $as_nop # One or both of the vars are not set, and there is no cached value. ac_x_includes=no ac_x_libraries=no @@ -3670,24 +4342,26 @@ /* end confdefs.h. */ #include int -main () +main (void) { XrmInitialize () ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : # We can compile and link X programs with no special options. ac_x_includes= ac_x_libraries= fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS="$ac_save_LIBS" -# If that didn't work, only try xmkmf and filesystem searches +# If that didn't work, only try xmkmf and file system searches # for native compilation. -if test x"$ac_x_includes" = xno && test "$cross_compiling" = no; then : +if test x"$ac_x_includes" = xno && test "$cross_compiling" = no +then : rm -f -r conftest.dir if mkdir conftest.dir; then cd conftest.dir @@ -3777,10 +4451,11 @@ /* end confdefs.h. */ #include _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : +if ac_fn_c_try_cpp "$LINENO" +then : # We can compile using X headers with no special include directory. ac_x_includes= -else +else $as_nop for ac_dir in $ac_x_header_dirs; do if test -r "$ac_dir/X11/Xlib.h"; then ac_x_includes=$ac_dir @@ -3801,20 +4476,21 @@ /* end confdefs.h. */ #include int -main () +main (void) { XrmInitialize () ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : LIBS=$ac_save_LIBS # We can link X programs with no special library path. ac_x_libraries= -else +else $as_nop LIBS=$ac_save_LIBS -for ac_dir in `$as_echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` +for ac_dir in `printf "%s\n" "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` do # Don't even attempt the hair of trying to link an X program! for ac_extension in a so sl dylib la dll; do @@ -3825,7 +4501,7 @@ done done fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi # $ac_x_libraries = no @@ -3849,8 +4525,8 @@ fi # $with_x != no if test "$have_x" != yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_x" >&5 -$as_echo "$have_x" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_x" >&5 +printf "%s\n" "$have_x" >&6; } no_x=yes else # If each of the values was on the command line, it overrides each guess. @@ -3860,8 +4536,8 @@ ac_cv_have_x="have_x=yes\ ac_x_includes='$x_includes'\ ac_x_libraries='$x_libraries'" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: libraries $x_libraries, headers $x_includes" >&5 -$as_echo "libraries $x_libraries, headers $x_includes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: libraries $x_libraries, headers $x_includes" >&5 +printf "%s\n" "libraries $x_libraries, headers $x_includes" >&6; } fi if test x$have_x = xyes; then @@ -3883,8 +4559,8 @@ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenGL support" >&5 -$as_echo_n "checking for OpenGL support... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OpenGL support" >&5 +printf %s "checking for OpenGL support... " >&6; } have_opengl=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -3895,22 +4571,23 @@ #endif int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_opengl=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_opengl" >&5 -$as_echo "$have_opengl" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_opengl" >&5 +printf "%s\n" "$have_opengl" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenGL ES support" >&5 -$as_echo_n "checking for OpenGL ES support... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OpenGL ES support" >&5 +printf %s "checking for OpenGL ES support... " >&6; } have_opengles=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -3921,22 +4598,23 @@ #endif int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_opengles=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_opengles" >&5 -$as_echo "$have_opengles" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_opengles" >&5 +printf "%s\n" "$have_opengles" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenGL ES2 support" >&5 -$as_echo_n "checking for OpenGL ES2 support... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OpenGL ES2 support" >&5 +printf %s "checking for OpenGL ES2 support... " >&6; } have_opengles2=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -3947,19 +4625,20 @@ #endif int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : have_opengles2=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_opengles2" >&5 -$as_echo "$have_opengles2" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_opengles2" >&5 +printf "%s\n" "$have_opengles2" >&6; } GLLIB="" GLESLIB="" @@ -3991,11 +4670,12 @@ -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for TTF_Init in -lSDL2_ttf" >&5 -$as_echo_n "checking for TTF_Init in -lSDL2_ttf... " >&6; } -if ${ac_cv_lib_SDL2_ttf_TTF_Init+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for TTF_Init in -lSDL2_ttf" >&5 +printf %s "checking for TTF_Init in -lSDL2_ttf... " >&6; } +if test ${ac_cv_lib_SDL2_ttf_TTF_Init+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lSDL2_ttf $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4004,30 +4684,29 @@ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char TTF_Init (); int -main () +main (void) { return TTF_Init (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_SDL2_ttf_TTF_Init=yes -else +else $as_nop ac_cv_lib_SDL2_ttf_TTF_Init=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_SDL2_ttf_TTF_Init" >&5 -$as_echo "$ac_cv_lib_SDL2_ttf_TTF_Init" >&6; } -if test "x$ac_cv_lib_SDL2_ttf_TTF_Init" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_SDL2_ttf_TTF_Init" >&5 +printf "%s\n" "$ac_cv_lib_SDL2_ttf_TTF_Init" >&6; } +if test "x$ac_cv_lib_SDL2_ttf_TTF_Init" = xyes +then : have_SDL_ttf=yes fi @@ -4039,17 +4718,17 @@ pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libunwind" >&5 -$as_echo_n "checking for libunwind... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libunwind" >&5 +printf %s "checking for libunwind... " >&6; } if test -n "$LIBUNWIND_CFLAGS"; then pkg_cv_LIBUNWIND_CFLAGS="$LIBUNWIND_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libunwind\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libunwind\""; } >&5 ($PKG_CONFIG --exists --print-errors "libunwind") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBUNWIND_CFLAGS=`$PKG_CONFIG --cflags "libunwind" 2>/dev/null` else @@ -4062,10 +4741,10 @@ pkg_cv_LIBUNWIND_LIBS="$LIBUNWIND_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libunwind\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libunwind\""; } >&5 ($PKG_CONFIG --exists --print-errors "libunwind") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBUNWIND_LIBS=`$PKG_CONFIG --libs "libunwind" 2>/dev/null` else @@ -4078,8 +4757,8 @@ if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -4096,14 +4775,14 @@ have_libunwind=no elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } have_libunwind=no else LIBUNWIND_CFLAGS=$pkg_cv_LIBUNWIND_CFLAGS LIBUNWIND_LIBS=$pkg_cv_LIBUNWIND_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } have_libunwind=yes fi if test x$have_libunwind = xyes ; then @@ -4139,8 +4818,8 @@ case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -4170,15 +4849,15 @@ /^ac_cv_env_/b end t clear :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else @@ -4192,8 +4871,8 @@ fi fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -4246,7 +4925,7 @@ for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" @@ -4262,8 +4941,8 @@ ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL @@ -4286,14 +4965,16 @@ # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -4303,46 +4984,46 @@ fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -4351,13 +5032,6 @@ fi -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -4366,8 +5040,12 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS @@ -4379,30 +5057,10 @@ as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] @@ -4415,13 +5073,14 @@ as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $2" >&2 + printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -4448,18 +5107,20 @@ { eval $1=; unset $1;} } as_unset=as_fn_unset + # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : eval 'as_fn_append () { eval $1+=\$2 }' -else +else $as_nop as_fn_append () { eval $1=\$$1\$2 @@ -4471,12 +5132,13 @@ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else +else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` @@ -4507,7 +5169,7 @@ $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -4529,6 +5191,10 @@ as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -4542,6 +5208,12 @@ ECHO_N='-n';; esac +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -4583,7 +5255,7 @@ as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -4592,7 +5264,7 @@ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | +printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -4655,7 +5327,7 @@ # values after options handling. ac_log=" This file was extended by $as_me, which was -generated by GNU Autoconf 2.69. Invocation command line was +generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -4704,14 +5376,16 @@ Report bugs to the package provider." _ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ config.status -configured by $0, generated by GNU Autoconf 2.69, +configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -4748,21 +5422,21 @@ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; + printf "%s\n" "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; + printf "%s\n" "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; + printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; @@ -4790,7 +5464,7 @@ if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" @@ -4804,7 +5478,7 @@ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX - $as_echo "$ac_log" + printf "%s\n" "$ac_log" } >&5 _ACEOF @@ -4829,7 +5503,7 @@ # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files fi # Have a temporary directory for convenience. Make it in the build tree @@ -5057,7 +5731,7 @@ esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done @@ -5065,17 +5739,17 @@ # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | + ac_sed_conf_input=`printf "%s\n" "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac @@ -5092,7 +5766,7 @@ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | +printf "%s\n" X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -5116,9 +5790,9 @@ case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -5171,8 +5845,8 @@ case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' @@ -5214,9 +5888,9 @@ { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" @@ -5263,7 +5937,8 @@ $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi + diff -Nru libsdl2-2.0.22+dfsg/test/controllermap.c libsdl2-2.24.0+dfsg/test/controllermap.c --- libsdl2-2.0.22+dfsg/test/controllermap.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/controllermap.c 2022-06-02 02:01:57.000000000 +0000 @@ -18,6 +18,7 @@ #include #include "SDL.h" +#include "testutils.h" #ifndef SDL_JOYSTICK_DISABLED @@ -169,39 +170,6 @@ static SDL_bool done = SDL_FALSE; static SDL_bool bind_touchpad = SDL_FALSE; -SDL_Texture * -LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent) -{ - SDL_Surface *temp; - SDL_Texture *texture; - - /* Load the sprite image */ - temp = SDL_LoadBMP(file); - if (temp == NULL) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError()); - return NULL; - } - - /* Set transparent pixel as the pixel at (0,0) */ - if (transparent) { - if (temp->format->palette) { - SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *) temp->pixels); - } - } - - /* Create textures from the image */ - texture = SDL_CreateTextureFromSurface(renderer, temp); - if (!texture) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); - SDL_FreeSurface(temp); - return NULL; - } - SDL_FreeSurface(temp); - - /* We're ready to roll. :) */ - return texture; -} - static int StandardizeAxisValue(int nValue) { @@ -392,10 +360,10 @@ Uint32 alpha_ticks = 0; SDL_JoystickID nJoystickID; - background_front = LoadTexture(screen, "controllermap.bmp", SDL_FALSE); - background_back = LoadTexture(screen, "controllermap_back.bmp", SDL_FALSE); - button = LoadTexture(screen, "button.bmp", SDL_TRUE); - axis = LoadTexture(screen, "axis.bmp", SDL_TRUE); + background_front = LoadTexture(screen, "controllermap.bmp", SDL_FALSE, NULL, NULL); + background_back = LoadTexture(screen, "controllermap_back.bmp", SDL_FALSE, NULL, NULL); + button = LoadTexture(screen, "button.bmp", SDL_TRUE, NULL, NULL); + axis = LoadTexture(screen, "axis.bmp", SDL_TRUE, NULL, NULL); SDL_RaiseWindow(window); /* scale for platforms that don't give you the window size you asked for. */ diff -Nru libsdl2-2.0.22+dfsg/test/gcc-fat.sh libsdl2-2.24.0+dfsg/test/gcc-fat.sh --- libsdl2-2.0.22+dfsg/test/gcc-fat.sh 2021-07-27 14:52:29.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/gcc-fat.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,110 +0,0 @@ -#!/bin/sh -# -# Build Universal binaries on Mac OS X, thanks Ryan! -# -# Usage: ./configure CC="sh gcc-fat.sh" && make && rm -rf ppc x86 - -# PowerPC compiler flags (10.2 runtime compatibility) -GCC_COMPILE_PPC="gcc-3.3 -arch ppc \ --DMAC_OS_X_VERSION_MIN_REQUIRED=1020 \ --nostdinc \ --F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks \ --I/Developer/SDKs/MacOSX10.2.8.sdk/usr/include/gcc/darwin/3.3 \ --isystem /Developer/SDKs/MacOSX10.2.8.sdk/usr/include" - -GCC_LINK_PPC="\ --L/Developer/SDKs/MacOSX10.2.8.sdk/usr/lib/gcc/darwin/3.3 \ --F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks \ --Wl,-syslibroot,/Developer/SDKs/MacOSX10.2.8.sdk" - -# Intel compiler flags (10.4 runtime compatibility) -GCC_COMPILE_X86="gcc-4.0 -arch i386 -mmacosx-version-min=10.4 \ --DMAC_OS_X_VERSION_MIN_REQUIRED=1040 \ --nostdinc \ --F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks \ --I/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin8/4.0.1/include \ --isystem /Developer/SDKs/MacOSX10.4u.sdk/usr/include" - -GCC_LINK_X86="\ --L/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin8/4.0.0 \ --Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk" - -# Output both PowerPC and Intel object files -args="$*" -compile=yes -link=yes -while test x$1 != x; do - case $1 in - --version) exec gcc $1;; - -v) exec gcc $1;; - -V) exec gcc $1;; - -print-prog-name=*) exec gcc $1;; - -print-search-dirs) exec gcc $1;; - -E) GCC_COMPILE_PPC="$GCC_COMPILE_PPC -E" - GCC_COMPILE_X86="$GCC_COMPILE_X86 -E" - compile=no; link=no;; - -c) link=no;; - -o) output=$2;; - *.c|*.cc|*.cpp|*.S) source=$1;; - esac - shift -done -if test x$link = xyes; then - GCC_COMPILE_PPC="$GCC_COMPILE_PPC $GCC_LINK_PPC" - GCC_COMPILE_X86="$GCC_COMPILE_X86 $GCC_LINK_X86" -fi -if test x"$output" = x; then - if test x$link = xyes; then - output=a.out - elif test x$compile = xyes; then - output=`echo $source | sed -e 's|.*/||' -e 's|\(.*\)\.[^\.]*|\1|'`.o - fi -fi - -if test x"$output" != x; then - dir=ppc/`dirname $output` - if test -d $dir; then - : - else - mkdir -p $dir - fi -fi -set -- $args -while test x$1 != x; do - if test -f "ppc/$1" && test "$1" != "$output"; then - ppc_args="$ppc_args ppc/$1" - else - ppc_args="$ppc_args $1" - fi - shift -done -$GCC_COMPILE_PPC $ppc_args || exit $? -if test x"$output" != x; then - cp $output ppc/$output -fi - -if test x"$output" != x; then - dir=x86/`dirname $output` - if test -d $dir; then - : - else - mkdir -p $dir - fi -fi -set -- $args -while test x$1 != x; do - if test -f "x86/$1" && test "$1" != "$output"; then - x86_args="$x86_args x86/$1" - else - x86_args="$x86_args $1" - fi - shift -done -$GCC_COMPILE_X86 $x86_args || exit $? -if test x"$output" != x; then - cp $output x86/$output -fi - -if test x"$output" != x; then - lipo -create -o $output ppc/$output x86/$output -fi diff -Nru libsdl2-2.0.22+dfsg/test/loopwave.c libsdl2-2.24.0+dfsg/test/loopwave.c --- libsdl2-2.0.22+dfsg/test/loopwave.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/loopwave.c 2022-06-02 02:01:57.000000000 +0000 @@ -25,6 +25,7 @@ #endif #include "SDL.h" +#include "testutils.h" static struct { @@ -114,7 +115,7 @@ main(int argc, char *argv[]) { int i; - char filename[4096]; + char *filename = NULL; /* Enable standard application logging */ SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); @@ -125,11 +126,13 @@ return (1); } - if (argc > 1) { - SDL_strlcpy(filename, argv[1], sizeof(filename)); - } else { - SDL_strlcpy(filename, "sample.wav", sizeof(filename)); + filename = GetResourceFilename(argc > 1 ? argv[1] : NULL, "sample.wav"); + + if (filename == NULL) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError()); + quit(1); } + /* Load the wave file into memory */ if (SDL_LoadWAV(filename, &wave.spec, &wave.sound, &wave.soundlen) == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", filename, SDL_GetError()); @@ -172,6 +175,7 @@ /* Clean up on signal */ close_audio(); SDL_FreeWAV(wave.sound); + SDL_free(filename); SDL_Quit(); return (0); } diff -Nru libsdl2-2.0.22+dfsg/test/loopwavequeue.c libsdl2-2.24.0+dfsg/test/loopwavequeue.c --- libsdl2-2.0.22+dfsg/test/loopwavequeue.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/loopwavequeue.c 2022-06-02 02:01:57.000000000 +0000 @@ -25,6 +25,8 @@ #include #endif +#include "testutils.h" + static struct { SDL_AudioSpec spec; @@ -74,7 +76,7 @@ int main(int argc, char *argv[]) { - char filename[4096]; + char *filename = NULL; /* Enable standard application logging */ SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); @@ -85,11 +87,13 @@ return (1); } - if (argc > 1) { - SDL_strlcpy(filename, argv[1], sizeof(filename)); - } else { - SDL_strlcpy(filename, "sample.wav", sizeof(filename)); + filename = GetResourceFilename(argc > 1 ? argv[1] : NULL, "sample.wav"); + + if (filename == NULL) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError()); + quit(1); } + /* Load the wave file into memory */ if (SDL_LoadWAV(filename, &wave.spec, &wave.sound, &wave.soundlen) == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", filename, SDL_GetError()); @@ -142,6 +146,7 @@ /* Clean up on signal */ SDL_CloseAudio(); SDL_FreeWAV(wave.sound); + SDL_free(filename); SDL_Quit(); return 0; } diff -Nru libsdl2-2.0.22+dfsg/test/Makefile.in libsdl2-2.24.0+dfsg/test/Makefile.in --- libsdl2-2.0.22+dfsg/test/Makefile.in 2022-04-21 17:37:37.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/Makefile.in 2022-08-13 03:48:10.000000000 +0000 @@ -2,6 +2,15 @@ srcdir = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +libdir = @libdir@ +libexecdir = @libexecdir@ +includedir = @includedir@ +datarootdir = @datarootdir@ +datadir = @datadir@ + CC = @CC@ EXE = @EXE@ CFLAGS = @CFLAGS@ -g @@ -79,7 +88,26 @@ @OPENGLES2_TARGETS@ += testgles2$(EXE) -all: Makefile $(TARGETS) copydatafiles +all: Makefile $(TARGETS) copydatafiles generatetestmeta + +installedtestsdir = $(libexecdir)/installed-tests/SDL2 +installedtestsmetadir = $(datadir)/installed-tests/SDL2 + +generatetestmeta: + rm -f *.test + set -e; for exe in $(noninteractive) $(needs_audio) $(needs_display); do \ + sed \ + -e 's#@installedtestsdir@#$(installedtestsdir)#g' \ + -e "s#@exe@#$$exe#g" \ + < $(srcdir)/template.test.in > $$exe.test; \ + done + +install: all + install -d $(DESTDIR)$(installedtestsdir) + install $(TARGETS) $(DESTDIR)$(installedtestsdir) + install -m644 $(DATA) $(DESTDIR)$(installedtestsdir) + install -d $(DESTDIR)$(installedtestsmetadir) + install -m644 *.test $(DESTDIR)$(installedtestsmetadir) Makefile: $(srcdir)/Makefile.in $(SHELL) config.status $@ @@ -90,10 +118,10 @@ checkkeysthreads$(EXE): $(srcdir)/checkkeysthreads.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -loopwave$(EXE): $(srcdir)/loopwave.c +loopwave$(EXE): $(srcdir)/loopwave.c $(srcdir)/testutils.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -loopwavequeue$(EXE): $(srcdir)/loopwavequeue.c +loopwavequeue$(EXE): $(srcdir)/loopwavequeue.c $(srcdir)/testutils.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) testsurround$(EXE): $(srcdir)/testsurround.c @@ -109,8 +137,12 @@ $(srcdir)/testautomation_audio.c \ $(srcdir)/testautomation_clipboard.c \ $(srcdir)/testautomation_events.c \ + $(srcdir)/testautomation_guid.c \ + $(srcdir)/testautomation_hints.c \ + $(srcdir)/testautomation_joystick.c \ $(srcdir)/testautomation_keyboard.c \ $(srcdir)/testautomation_main.c \ + $(srcdir)/testautomation_math.c \ $(srcdir)/testautomation_mouse.c \ $(srcdir)/testautomation_pixels.c \ $(srcdir)/testautomation_platform.c \ @@ -122,14 +154,13 @@ $(srcdir)/testautomation_surface.c \ $(srcdir)/testautomation_syswm.c \ $(srcdir)/testautomation_timer.c \ - $(srcdir)/testautomation_video.c \ - $(srcdir)/testautomation_hints.c + $(srcdir)/testautomation_video.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -testmultiaudio$(EXE): $(srcdir)/testmultiaudio.c +testmultiaudio$(EXE): $(srcdir)/testmultiaudio.c $(srcdir)/testutils.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -testaudiohotplug$(EXE): $(srcdir)/testaudiohotplug.c +testaudiohotplug$(EXE): $(srcdir)/testaudiohotplug.c $(srcdir)/testutils.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) testaudiocapture$(EXE): $(srcdir)/testaudiocapture.c @@ -165,15 +196,15 @@ testfile$(EXE): $(srcdir)/testfile.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -testgamecontroller$(EXE): $(srcdir)/testgamecontroller.c +testgamecontroller$(EXE): $(srcdir)/testgamecontroller.c $(srcdir)/testutils.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -testgeometry$(EXE): $(srcdir)/testgeometry.c +testgeometry$(EXE): $(srcdir)/testgeometry.c $(srcdir)/testutils.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) testgesture$(EXE): $(srcdir)/testgesture.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@ - + testgl2$(EXE): $(srcdir)/testgl2.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@ @@ -183,7 +214,7 @@ testgles2$(EXE): $(srcdir)/testgles2.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@ -testgles2_sdf$(EXE): $(srcdir)/testgles2_sdf.c +testgles2_sdf$(EXE): $(srcdir)/testgles2_sdf.c $(srcdir)/testutils.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@ testhaptic$(EXE): $(srcdir)/testhaptic.c @@ -198,10 +229,10 @@ testthread$(EXE): $(srcdir)/testthread.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -testiconv$(EXE): $(srcdir)/testiconv.c +testiconv$(EXE): $(srcdir)/testiconv.c $(srcdir)/testutils.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -testime$(EXE): $(srcdir)/testime.c +testime$(EXE): $(srcdir)/testime.c $(srcdir)/testutils.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @SDL_TTF_LIB@ testjoystick$(EXE): $(srcdir)/testjoystick.c @@ -219,18 +250,21 @@ ifeq (@ISMACOSX@,true) testnative$(EXE): $(srcdir)/testnative.c \ $(srcdir)/testnativecocoa.m \ + $(srcdir)/testutils.c \ $(srcdir)/testnativex11.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -framework Cocoa @XLIB@ endif ifeq (@ISWINDOWS@,true) testnative$(EXE): $(srcdir)/testnative.c \ + $(srcdir)/testutils.c \ $(srcdir)/testnativew32.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) endif ifeq (@ISUNIX@,true) testnative$(EXE): $(srcdir)/testnative.c \ + $(srcdir)/testutils.c \ $(srcdir)/testnativex11.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @XLIB@ endif @@ -252,7 +286,7 @@ endif endif -testoverlay2$(EXE): $(srcdir)/testoverlay2.c $(srcdir)/testyuv_cvt.c +testoverlay2$(EXE): $(srcdir)/testoverlay2.c $(srcdir)/testyuv_cvt.c $(srcdir)/testutils.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) testplatform$(EXE): $(srcdir)/testplatform.c @@ -264,10 +298,10 @@ testfilesystem$(EXE): $(srcdir)/testfilesystem.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -testrendertarget$(EXE): $(srcdir)/testrendertarget.c +testrendertarget$(EXE): $(srcdir)/testrendertarget.c $(srcdir)/testutils.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -testscale$(EXE): $(srcdir)/testscale.c +testscale$(EXE): $(srcdir)/testscale.c $(srcdir)/testutils.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) testsem$(EXE): $(srcdir)/testsem.c @@ -282,13 +316,13 @@ testshape$(EXE): $(srcdir)/testshape.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -testsprite2$(EXE): $(srcdir)/testsprite2.c +testsprite2$(EXE): $(srcdir)/testsprite2.c $(srcdir)/testutils.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -testspriteminimal$(EXE): $(srcdir)/testspriteminimal.c +testspriteminimal$(EXE): $(srcdir)/testspriteminimal.c $(srcdir)/testutils.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@ -teststreaming$(EXE): $(srcdir)/teststreaming.c +teststreaming$(EXE): $(srcdir)/teststreaming.c $(srcdir)/testutils.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@ testtimer$(EXE): $(srcdir)/testtimer.c @@ -300,7 +334,7 @@ testver$(EXE): $(srcdir)/testver.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -testviewport$(EXE): $(srcdir)/testviewport.c +testviewport$(EXE): $(srcdir)/testviewport.c $(srcdir)/testutils.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) testwm2$(EXE): $(srcdir)/testwm2.c @@ -312,7 +346,7 @@ torturethread$(EXE): $(srcdir)/torturethread.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -testrendercopyex$(EXE): $(srcdir)/testrendercopyex.c +testrendercopyex$(EXE): $(srcdir)/testrendercopyex.c $(srcdir)/testutils.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@ testmessage$(EXE): $(srcdir)/testmessage.c @@ -330,7 +364,7 @@ testcustomcursor$(EXE): $(srcdir)/testcustomcursor.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -controllermap$(EXE): $(srcdir)/controllermap.c +controllermap$(EXE): $(srcdir)/controllermap.c $(srcdir)/testutils.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) testvulkan$(EXE): $(srcdir)/testvulkan.c @@ -344,13 +378,56 @@ clean: - rm -f $(TARGETS) + rm -f $(TARGETS) *.test distclean: clean rm -f Makefile rm -f config.status config.cache config.log rm -rf $(srcdir)/autom4te* +noninteractive = \ + testatomic$(EXE) \ + testerror$(EXE) \ + testevdev$(EXE) \ + testfilesystem$(EXE) \ + testkeys$(EXE) \ + testlocale$(EXE) \ + testplatform$(EXE) \ + testpower$(EXE) \ + testqsort$(EXE) \ + testthread$(EXE) \ + testtimer$(EXE) \ + testver$(EXE) \ + $(NULL) + +needs_audio = \ + testaudioinfo$(EXE) \ + testsurround$(EXE) \ + $(NULL) + +needs_display = \ + testbounds$(EXE) \ + testdisplayinfo$(EXE) \ + $(NULL) + +TESTS = $(noninteractive) $(needs_audio) $(needs_display) + +check: + @set -e; \ + status=0; \ + export SDL_AUDIODRIVER=dummy; \ + export SDL_VIDEODRIVER=dummy; \ + for exe in $(TESTS); do \ + echo "$$exe..."; \ + if ./"$$exe"; then \ + echo "$$exe: OK"; \ + else \ + echo "$$exe: FAILED: $$?"; \ + status=1; \ + fi; \ + done; \ + exit "$$status" + DATA = \ axis.bmp \ button.bmp \ diff -Nru libsdl2-2.0.22+dfsg/test/Makefile.os2 libsdl2-2.24.0+dfsg/test/Makefile.os2 --- libsdl2-2.0.22+dfsg/test/Makefile.os2 2022-01-08 21:13:56.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/Makefile.os2 2022-06-02 02:01:57.000000000 +0000 @@ -1,77 +1,13 @@ # Open Watcom makefile to build SDL2 tests for OS/2 # wmake -f Makefile.os2 -INCPATH = -I"$(%WATCOM)/h/os2" -I"$(%WATCOM)/h" -I"../include" +SYSTEM = os2v2 -CFLAGS = $(INCPATH) -bt=os2 -d0 -q -bm -5s -fp5 -fpi87 -sg -oteanbmier -ei -CFLAGS+= -wx -wcd=303 - -LIBPATH = .. -LIBS = SDL2.lib SDL2test.lib - -#CFLAGS+= -DHAVE_SDL_TTF -#TTFLIBS = SDL2ttf.lib - -TARGETS = testatomic.exe testdisplayinfo.exe testbounds.exe testdraw2.exe & - testdrawchessboard.exe testdropfile.exe testerror.exe testfile.exe & - testfilesystem.exe testgamecontroller.exe testgeometry.exe testgesture.exe & - testhittesting.exe testhotplug.exe testiconv.exe testime.exe testlocale.exe & - testintersections.exe testjoystick.exe testkeys.exe testloadso.exe & - testlock.exe testmessage.exe testoverlay2.exe testplatform.exe & - testpower.exe testsensor.exe testrelative.exe testrendercopyex.exe & - testrendertarget.exe testrumble.exe testscale.exe testsem.exe & - testshader.exe testshape.exe testsprite2.exe testspriteminimal.exe & - teststreaming.exe testthread.exe testtimer.exe testver.exe & - testviewport.exe testwm2.exe torturethread.exe checkkeys.exe & - checkkeysthreads.exe testmouse.exe & - controllermap.exe testhaptic.exe testqsort.exe testresample.exe & - testaudioinfo.exe testaudiocapture.exe loopwave.exe loopwavequeue.exe & - testsurround.exe testyuv.exe testgl2.exe testvulkan.exe testnative.exe & - testautomation.exe - -# testautomation sources -TASRCS = testautomation.c testautomation_audio.c testautomation_clipboard.c & - testautomation_events.c testautomation_hints.c & - testautomation_keyboard.c testautomation_main.c & - testautomation_mouse.c testautomation_pixels.c & - testautomation_platform.c testautomation_rect.c & - testautomation_render.c testautomation_rwops.c & - testautomation_sdltest.c testautomation_stdlib.c & - testautomation_surface.c testautomation_syswm.c & - testautomation_timer.c testautomation_video.c - -OBJS = $(TARGETS:.exe=.obj) -COBJS = $(CSRCS:.c=.obj) -TAOBJS = $(TASRCS:.c=.obj) - -all: $(TARGETS) +INCPATH = -I"$(%WATCOM)/h/os2" -I"$(%WATCOM)/h" -.c: ../src/test - -.obj.exe: - wlink SYS os2v2 libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@ - -.c.obj: - wcc386 $(CFLAGS) -fo=$^@ $< - -# specials -testautomation.exe: $(TAOBJS) - wlink SYS os2v2 libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@ - -testnative.exe: testnative.obj testnativeos2.obj - wlink SYS os2v2 libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@ - -testoverlay2.exe: testoverlay2.obj testyuv_cvt.obj - wlink SYS os2v2 libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@ - -testyuv.exe: testyuv.obj testyuv_cvt.obj - wlink SYS os2v2 libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@ +CFLAGS = -bt=os2 -d0 -q -bm -5s -fp5 -fpi87 -sg -oteanbmier -ei +CFLAGS+= -wx -wcd=303 -testime.exe: testime.obj - wlink SYS os2v2 libpath $(LIBPATH) lib {$(LIBS) $(TTFLIBS)} op q op el file {$<} name $@ +TNSRCS = testnative.c testnativeos2.c -clean: .SYMBOLIC - @if exist *.obj rm *.obj - @if exist *.err rm *.err -distclean: .SYMBOLIC clean - @if exist *.exe rm *.exe +!include watcom.mif diff -Nru libsdl2-2.0.22+dfsg/test/Makefile.w32 libsdl2-2.24.0+dfsg/test/Makefile.w32 --- libsdl2-2.0.22+dfsg/test/Makefile.w32 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/Makefile.w32 2022-06-02 02:01:57.000000000 +0000 @@ -0,0 +1,16 @@ +# Open Watcom makefile to build SDL2 tests for Win32 +# wmake -f Makefile.w32 + +SYSTEM = nt + +INCPATH = -I"$(%WATCOM)/h/nt" -I"$(%WATCOM)/h" -I"../src/video/khronos" + +CFLAGS = -bt=nt -d0 -q -bm -5s -fp5 -fpi87 -sg -oteanbmier -ei +CFLAGS+= -wx -wcd=303 +CFLAGS+= -DSDL_MAIN_HANDLED +CFLAGS+= -DHAVE_OPENGL +GLLIBS = opengl32.lib + +TNSRCS = testnative.c testnativew32.c + +!include watcom.mif diff -Nru libsdl2-2.0.22+dfsg/test/template.test.in libsdl2-2.24.0+dfsg/test/template.test.in --- libsdl2-2.0.22+dfsg/test/template.test.in 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/template.test.in 2022-06-02 02:01:57.000000000 +0000 @@ -0,0 +1,3 @@ +[Test] +Type=session +Exec=@installedtestsdir@/@exe@ diff -Nru libsdl2-2.0.22+dfsg/test/testatomic.c libsdl2-2.24.0+dfsg/test/testatomic.c --- libsdl2-2.0.22+dfsg/test/testatomic.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testatomic.c 2022-06-03 19:42:12.000000000 +0000 @@ -471,9 +471,6 @@ return status; } -static SDL_sem *writersDone; -static SDL_sem *readersDone; - typedef struct { SDL_EventQueue *queue; @@ -482,6 +479,7 @@ int waits; SDL_bool lock_free; char padding2[SDL_CACHELINE_SIZE-sizeof(int)-sizeof(SDL_bool)]; + SDL_Thread *thread; } WriterData; typedef struct @@ -491,6 +489,7 @@ int waits; SDL_bool lock_free; char padding[SDL_CACHELINE_SIZE-(sizeof(SDL_EventQueue*)+sizeof(int)*NUM_WRITERS+sizeof(int)+sizeof(SDL_bool))%SDL_CACHELINE_SIZE]; + SDL_Thread *thread; } ReaderData; static int SDLCALL FIFO_Writer(void* _data) @@ -523,7 +522,6 @@ } } } - SDL_SemPost(writersDone); return 0; } @@ -560,7 +558,6 @@ } } } - SDL_SemPost(readersDone); return 0; } @@ -590,6 +587,7 @@ static void RunFIFOTest(SDL_bool lock_free) { SDL_EventQueue queue; + SDL_Thread *fifo_thread = NULL; WriterData writerData[NUM_WRITERS]; ReaderData readerData[NUM_READERS]; Uint32 start, end; @@ -601,9 +599,6 @@ SDL_Log("\nFIFO test---------------------------------------\n\n"); SDL_Log("Mode: %s\n", lock_free ? "LockFree" : "Mutex"); - readersDone = SDL_CreateSemaphore(0); - writersDone = SDL_CreateSemaphore(0); - SDL_memset(&queue, 0xff, sizeof(queue)); InitEventQueue(&queue); @@ -616,7 +611,7 @@ #ifdef TEST_SPINLOCK_FIFO /* Start a monitoring thread */ if (lock_free) { - SDL_CreateThread(FIFO_Watcher, "FIFOWatcher", &queue); + fifo_thread = SDL_CreateThread(FIFO_Watcher, "FIFOWatcher", &queue); } #endif @@ -628,7 +623,7 @@ SDL_snprintf(name, sizeof (name), "FIFOReader%d", i); readerData[i].queue = &queue; readerData[i].lock_free = lock_free; - SDL_CreateThread(FIFO_Reader, name, &readerData[i]); + readerData[i].thread = SDL_CreateThread(FIFO_Reader, name, &readerData[i]); } /* Start up the writers */ @@ -640,12 +635,12 @@ writerData[i].queue = &queue; writerData[i].index = i; writerData[i].lock_free = lock_free; - SDL_CreateThread(FIFO_Writer, name, &writerData[i]); + writerData[i].thread = SDL_CreateThread(FIFO_Writer, name, &writerData[i]); } /* Wait for the writers */ for (i = 0; i < NUM_WRITERS; ++i) { - SDL_SemWait(writersDone); + SDL_WaitThread(writerData[i].thread, NULL); } /* Shut down the queue so readers exit */ @@ -653,13 +648,15 @@ /* Wait for the readers */ for (i = 0; i < NUM_READERS; ++i) { - SDL_SemWait(readersDone); + SDL_WaitThread(readerData[i].thread, NULL); } end = SDL_GetTicks(); - SDL_DestroySemaphore(readersDone); - SDL_DestroySemaphore(writersDone); + /* Wait for the FIFO thread */ + if (fifo_thread) { + SDL_WaitThread(fifo_thread, NULL); + } if (!lock_free) { SDL_DestroyMutex(queue.mutex); @@ -709,6 +706,12 @@ SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); RunBasicTest(); + + if (SDL_getenv("SDL_TESTS_QUICK") != NULL) { + SDL_Log("Not running slower tests"); + return 0; + } + RunEpicTest(); /* This test is really slow, so don't run it by default */ #if 0 diff -Nru libsdl2-2.0.22+dfsg/test/testaudiohotplug.c libsdl2-2.24.0+dfsg/test/testaudiohotplug.c --- libsdl2-2.0.22+dfsg/test/testaudiohotplug.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testaudiohotplug.c 2022-06-02 02:01:57.000000000 +0000 @@ -26,6 +26,7 @@ #endif #include "SDL.h" +#include "testutils.h" static SDL_AudioSpec spec; static Uint8 *sound = NULL; /* Pointer to wave data */ @@ -137,7 +138,7 @@ main(int argc, char *argv[]) { int i; - char filename[4096]; + char *filename = NULL; /* Enable standard application logging */ SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); @@ -151,11 +152,13 @@ /* Some targets (Mac CoreAudio) need an event queue for audio hotplug, so make and immediately hide a window. */ SDL_MinimizeWindow(SDL_CreateWindow("testaudiohotplug", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, 0)); - if (argc > 1) { - SDL_strlcpy(filename, argv[1], sizeof(filename)); - } else { - SDL_strlcpy(filename, "sample.wav", sizeof(filename)); + filename = GetResourceFilename(argc > 1 ? argv[1] : NULL, "sample.wav"); + + if (filename == NULL) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError()); + quit(1); } + /* Load the wave file into memory */ if (SDL_LoadWAV(filename, &spec, &sound, &soundlen) == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", filename, SDL_GetError()); @@ -196,6 +199,7 @@ /* Quit audio first, then free WAV. This prevents access violations in the audio threads. */ SDL_QuitSubSystem(SDL_INIT_AUDIO); SDL_FreeWAV(sound); + SDL_free(filename); SDL_Quit(); return (0); } diff -Nru libsdl2-2.0.22+dfsg/test/testautomation.c libsdl2-2.24.0+dfsg/test/testautomation.c --- libsdl2-2.0.22+dfsg/test/testautomation.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testautomation.c 2022-08-13 03:48:10.000000000 +0000 @@ -101,7 +101,7 @@ } /* Call Harness */ - result = SDLTest_RunSuites(testSuites, (const char *)userRunSeed, userExecKey, (const char *)filter, testIterations); + result = SDLTest_RunSuites(testSuites, userRunSeed, userExecKey, filter, testIterations); /* Empty event queue */ done = 0; diff -Nru libsdl2-2.0.22+dfsg/test/testautomation_guid.c libsdl2-2.24.0+dfsg/test/testautomation_guid.c --- libsdl2-2.0.22+dfsg/test/testautomation_guid.c 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testautomation_guid.c 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,150 @@ +/** + * GUID test suite + */ + +#include "SDL.h" +#include "SDL_test.h" + +/* ================= Test Case Implementation ================== */ + +/* Helper functions */ + +#define NUM_TEST_GUIDS 5 + +static struct { + char *str; + Uint64 upper, lower; +} test_guids[NUM_TEST_GUIDS] = { + { "0000000000000000" "ffffffffffffffff", + 0x0000000000000000, 0xfffffffffffffffflu }, + { "0011223344556677" "8091a2b3c4d5e6f0", + 0x0011223344556677lu, 0x8091a2b3c4d5e6f0lu }, + { "a011223344556677" "8091a2b3c4d5e6f0", + 0xa011223344556677lu, 0x8091a2b3c4d5e6f0lu }, + { "a011223344556677" "8091a2b3c4d5e6f1", + 0xa011223344556677lu, 0x8091a2b3c4d5e6f1lu }, + { "a011223344556677" "8191a2b3c4d5e6f0", + 0xa011223344556677lu, 0x8191a2b3c4d5e6f0lu }, +}; + +static void +upper_lower_to_bytestring(Uint8* out, Uint64 upper, Uint64 lower) +{ + Uint64 values[2]; + int i, k; + + values[0] = upper; + values [1] = lower; + + for (i = 0; i < 2; ++i) { + Uint64 v = values[i]; + + for (k = 0; k < 8; ++k) { + *out++ = v >> 56; + v <<= 8; + } + } +} + + +/* Test case functions */ + +/** + * @brief Check String-to-GUID conversion + * + * @sa SDL_GUIDFromString + */ +static int +TestGuidFromString(void *arg) +{ + int i; + + SDLTest_AssertPass("Call to SDL_GUIDFromString"); + for (i = 0; i < NUM_TEST_GUIDS; ++i) { + Uint8 expected[16]; + SDL_GUID guid; + + upper_lower_to_bytestring(expected, + test_guids[i].upper, test_guids[i].lower); + + guid = SDL_GUIDFromString(test_guids[i].str); + SDLTest_AssertCheck(SDL_memcmp(expected, guid.data, 16) == 0, "GUID from string, GUID was: '%s'", test_guids[i].str); + } + + return TEST_COMPLETED; +} + +/** + * @brief Check GUID-to-String conversion + * + * @sa SDL_GUIDToString + */ +static int +TestGuidToString(void *arg) +{ + int i; + + SDLTest_AssertPass("Call to SDL_GUIDToString"); + for (i = 0; i < NUM_TEST_GUIDS; ++i) { + const int guid_str_offset = 4; + char guid_str_buf[64]; + char *guid_str = guid_str_buf + guid_str_offset; + SDL_GUID guid; + int size; + + upper_lower_to_bytestring(guid.data, + test_guids[i].upper, test_guids[i].lower); + + /* Serialise to limited-length buffers */ + for (size = 0; size <= 36; ++size) { + const Uint8 fill_char = size + 0xa0; + Uint32 expected_prefix; + Uint32 actual_prefix; + int written_size; + + SDL_memset(guid_str_buf, fill_char, sizeof(guid_str_buf)); + SDL_GUIDToString(guid, guid_str, size); + + /* Check bytes before guid_str_buf */ + expected_prefix = fill_char | (fill_char << 8) | (fill_char << 16) | (fill_char << 24); + SDL_memcpy(&actual_prefix, guid_str_buf, 4); + SDLTest_AssertCheck(expected_prefix == actual_prefix, "String buffer memory before output untouched, expected: %i, got: %i, at size=%d", expected_prefix, actual_prefix, size); + + /* Check that we did not overwrite too much */ + written_size = 0; + while ((guid_str[written_size] & 0xff) != fill_char && written_size < 256) { + ++written_size; + } + SDLTest_AssertCheck(written_size <= size, "Output length is within expected bounds, with length %d: wrote %d of %d permitted bytes", size, written_size, size); + if (size >= 33) { + SDLTest_AssertCheck(SDL_strcmp(guid_str, test_guids[i].str) == 0, "GUID string equality, from string: %s", test_guids[i].str); + } + } + } + + return TEST_COMPLETED; +} + +/* ================= Test References ================== */ + +/* GUID routine test cases */ +static const SDLTest_TestCaseReference guidTest1 = + { (SDLTest_TestCaseFp)TestGuidFromString, "TestGuidFromString", "Call to SDL_GUIDFromString", TEST_ENABLED }; + +static const SDLTest_TestCaseReference guidTest2 = + { (SDLTest_TestCaseFp)TestGuidToString, "TestGuidToString", "Call to SDL_GUIDToString", TEST_ENABLED }; + +/* Sequence of GUID routine test cases */ +static const SDLTest_TestCaseReference *guidTests[] = { + &guidTest1, + &guidTest2, + NULL +}; + +/* GUID routine test suite (global) */ +SDLTest_TestSuiteReference guidTestSuite = { + "GUID", + NULL, + guidTests, + NULL +}; diff -Nru libsdl2-2.0.22+dfsg/test/testautomation_hints.c libsdl2-2.24.0+dfsg/test/testautomation_hints.c --- libsdl2-2.0.22+dfsg/test/testautomation_hints.c 2021-11-26 16:03:45.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testautomation_hints.c 2022-08-13 03:48:10.000000000 +0000 @@ -8,7 +8,6 @@ #include "SDL_test.h" -const int _numHintsEnum = 25; const char* _HintsEnum[] = { SDL_HINT_ACCELEROMETER_AS_JOYSTICK, @@ -32,9 +31,7 @@ SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT, SDL_HINT_VIDEO_WIN_D3DCOMPILER, - SDL_HINT_VIDEO_X11_XINERAMA, SDL_HINT_VIDEO_X11_XRANDR, - SDL_HINT_VIDEO_X11_XVIDMODE, SDL_HINT_XINPUT_ENABLED, }; const char* _HintsVerbose[] = @@ -60,12 +57,13 @@ "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS", "SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT", "SDL_VIDEO_WIN_D3DCOMPILER", - "SDL_VIDEO_X11_XINERAMA", "SDL_VIDEO_X11_XRANDR", - "SDL_VIDEO_X11_XVIDMODE", "SDL_XINPUT_ENABLED" }; +SDL_COMPILE_TIME_ASSERT(HintsEnum, SDL_arraysize(_HintsEnum) == SDL_arraysize(_HintsVerbose)); + +const int _numHintsEnum = SDL_arraysize(_HintsEnum); /* Test case functions */ @@ -100,8 +98,9 @@ int hints_setHint(void *arg) { + const char *testHint = "SDL_AUTOMATED_TEST_HINT"; const char *originalValue; - const char *value; + char *value; const char *testValue; SDL_bool result; int i, j; @@ -144,7 +143,54 @@ SDL_free((void *)originalValue); } - SDL_free((void *)value); + SDL_free(value); + + /* Set default value in environment */ + SDL_setenv(testHint, "original", 1); + + SDLTest_AssertPass("Call to SDL_GetHint() after saving and restoring hint"); + originalValue = SDL_GetHint(testHint); + value = (originalValue == NULL) ? NULL : SDL_strdup(originalValue); + SDL_SetHint(testHint, "temp"); + SDL_SetHint(testHint, value); + SDL_free(value); + testValue = SDL_GetHint(testHint); + SDLTest_AssertCheck( + testValue && SDL_strcmp(testValue, "original") == 0, + "testValue = %s, expected \"original\"", + testValue); + + SDLTest_AssertPass("Call to SDL_SetHintWithPriority(NULL, SDL_HINT_DEFAULT)"); + SDL_SetHintWithPriority(testHint, NULL, SDL_HINT_DEFAULT); + testValue = SDL_GetHint(testHint); + SDLTest_AssertCheck( + testValue && SDL_strcmp(testValue, "original") == 0, + "testValue = %s, expected \"original\"", + testValue); + + SDLTest_AssertPass("Call to SDL_SetHintWithPriority(\"temp\", SDL_HINT_OVERRIDE)"); + SDL_SetHintWithPriority(testHint, "temp", SDL_HINT_OVERRIDE); + testValue = SDL_GetHint(testHint); + SDLTest_AssertCheck( + testValue && SDL_strcmp(testValue, "temp") == 0, + "testValue = %s, expected \"temp\"", + testValue); + + SDLTest_AssertPass("Call to SDL_SetHintWithPriority(NULL, SDL_HINT_OVERRIDE)"); + SDL_SetHintWithPriority(testHint, NULL, SDL_HINT_OVERRIDE); + testValue = SDL_GetHint(testHint); + SDLTest_AssertCheck( + testValue == NULL, + "testValue = %s, expected NULL", + testValue); + + SDLTest_AssertPass("Call to SDL_ResetHint()"); + SDL_ResetHint(testHint); + testValue = SDL_GetHint(testHint); + SDLTest_AssertCheck( + testValue && SDL_strcmp(testValue, "original") == 0, + "testValue = %s, expected \"original\"", + testValue); return TEST_COMPLETED; } diff -Nru libsdl2-2.0.22+dfsg/test/testautomation_joystick.c libsdl2-2.24.0+dfsg/test/testautomation_joystick.c --- libsdl2-2.0.22+dfsg/test/testautomation_joystick.c 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testautomation_joystick.c 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,90 @@ +/** + * Joystick test suite + */ + +#include "SDL.h" +#include "SDL_test.h" +#include "../src/joystick/usb_ids.h" + +/* ================= Test Case Implementation ================== */ + +/* Test case functions */ + +/** + * @brief Check virtual joystick creation + * + * @sa SDL_JoystickAttachVirtualEx + */ +static int +TestVirtualJoystick(void *arg) +{ + SDL_VirtualJoystickDesc desc; + SDL_Joystick *joystick = NULL; + int device_index; + + SDLTest_AssertCheck(SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) == 0, "SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER)"); + + SDL_zero(desc); + desc.version = SDL_VIRTUAL_JOYSTICK_DESC_VERSION; + desc.type = SDL_JOYSTICK_TYPE_GAMECONTROLLER; + desc.naxes = SDL_CONTROLLER_AXIS_MAX; + desc.nbuttons = SDL_CONTROLLER_BUTTON_MAX; + desc.vendor_id = USB_VENDOR_NVIDIA; + desc.product_id = USB_PRODUCT_NVIDIA_SHIELD_CONTROLLER; + desc.name = "Virtual NVIDIA SHIELD Controller"; + device_index = SDL_JoystickAttachVirtualEx(&desc); + SDLTest_AssertCheck(device_index >= 0, "SDL_JoystickAttachVirtualEx()"); + SDLTest_AssertCheck(SDL_JoystickIsVirtual(device_index), "SDL_JoystickIsVirtual()"); + if (device_index >= 0) { + joystick = SDL_JoystickOpen(device_index); + SDLTest_AssertCheck(joystick != NULL, "SDL_JoystickOpen()"); + if (joystick) { + SDLTest_AssertCheck(SDL_strcmp(SDL_JoystickName(joystick), desc.name) == 0, "SDL_JoystickName()"); + SDLTest_AssertCheck(SDL_JoystickGetVendor(joystick) == desc.vendor_id, "SDL_JoystickGetVendor()"); + SDLTest_AssertCheck(SDL_JoystickGetProduct(joystick) == desc.product_id, "SDL_JoystickGetProduct()"); + SDLTest_AssertCheck(SDL_JoystickGetProductVersion(joystick) == 0, "SDL_JoystickGetProductVersion()"); + SDLTest_AssertCheck(SDL_JoystickGetFirmwareVersion(joystick) == 0, "SDL_JoystickGetFirmwareVersion()"); + SDLTest_AssertCheck(SDL_JoystickGetSerial(joystick) == NULL, "SDL_JoystickGetSerial()"); + SDLTest_AssertCheck(SDL_JoystickGetType(joystick) == desc.type, "SDL_JoystickGetType()"); + SDLTest_AssertCheck(SDL_JoystickNumAxes(joystick) == desc.naxes, "SDL_JoystickNumAxes()"); + SDLTest_AssertCheck(SDL_JoystickNumBalls(joystick) == 0, "SDL_JoystickNumBalls()"); + SDLTest_AssertCheck(SDL_JoystickNumHats(joystick) == desc.nhats, "SDL_JoystickNumHats()"); + SDLTest_AssertCheck(SDL_JoystickNumButtons(joystick) == desc.nbuttons, "SDL_JoystickNumButtons()"); + + SDLTest_AssertCheck(SDL_JoystickSetVirtualButton(joystick, SDL_CONTROLLER_BUTTON_A, SDL_PRESSED) == 0, "SDL_JoystickSetVirtualButton(SDL_CONTROLLER_BUTTON_A, SDL_PRESSED)"); + SDL_JoystickUpdate(); + SDLTest_AssertCheck(SDL_JoystickGetButton(joystick, SDL_CONTROLLER_BUTTON_A) == SDL_PRESSED, "SDL_JoystickGetButton(SDL_CONTROLLER_BUTTON_A) == SDL_PRESSED"); + SDLTest_AssertCheck(SDL_JoystickSetVirtualButton(joystick, SDL_CONTROLLER_BUTTON_A, SDL_RELEASED) == 0, "SDL_JoystickSetVirtualButton(SDL_CONTROLLER_BUTTON_A, SDL_RELEASED)"); + SDL_JoystickUpdate(); + SDLTest_AssertCheck(SDL_JoystickGetButton(joystick, SDL_CONTROLLER_BUTTON_A) == SDL_RELEASED, "SDL_JoystickGetButton(SDL_CONTROLLER_BUTTON_A) == SDL_RELEASED"); + + SDL_JoystickClose(joystick); + } + SDLTest_AssertCheck(SDL_JoystickDetachVirtual(device_index) == 0, "SDL_JoystickDetachVirtual()"); + } + SDLTest_AssertCheck(!SDL_JoystickIsVirtual(device_index), "!SDL_JoystickIsVirtual()"); + + SDL_QuitSubSystem(SDL_INIT_GAMECONTROLLER); + + return TEST_COMPLETED; +} + +/* ================= Test References ================== */ + +/* Joystick routine test cases */ +static const SDLTest_TestCaseReference joystickTest1 = + { (SDLTest_TestCaseFp)TestVirtualJoystick, "TestVirtualJoystick", "Test virtual joystick functionality", TEST_ENABLED }; + +/* Sequence of Joystick routine test cases */ +static const SDLTest_TestCaseReference *joystickTests[] = { + &joystickTest1, + NULL +}; + +/* Joystick routine test suite (global) */ +SDLTest_TestSuiteReference joystickTestSuite = { + "Joystick", + NULL, + joystickTests, + NULL +}; diff -Nru libsdl2-2.0.22+dfsg/test/testautomation_main.c libsdl2-2.24.0+dfsg/test/testautomation_main.c --- libsdl2-2.0.22+dfsg/test/testautomation_main.c 2021-07-27 14:52:29.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testautomation_main.c 2022-08-13 03:48:10.000000000 +0000 @@ -125,6 +125,26 @@ #endif } +static int +main_testSetError(void *arg) +{ + size_t i; + char error[1024]; + + error[0] = '\0'; + SDL_SetError(""); + SDLTest_AssertCheck(SDL_strcmp(error, SDL_GetError()) == 0, "SDL_SetError(\"\")"); + + for (i = 0; i < (sizeof(error)-1); ++i) { + error[i] = 'a' + (i % 26); + } + error[i] = '\0'; + SDL_SetError("%s", error); + SDLTest_AssertCheck(SDL_strcmp(error, SDL_GetError()) == 0, "SDL_SetError(\"abc...1023\")"); + + return TEST_COMPLETED; +} + static const SDLTest_TestCaseReference mainTest1 = { (SDLTest_TestCaseFp)main_testInitQuitJoystickHaptic, "main_testInitQuitJoystickHaptic", "Tests SDL_Init/Quit of Joystick and Haptic subsystem", TEST_ENABLED}; @@ -137,12 +157,16 @@ static const SDLTest_TestCaseReference mainTest4 = { (SDLTest_TestCaseFp)main_testImpliedJoystickQuit, "main_testImpliedJoystickQuit", "Tests that quit for gamecontroller doesn't quit joystick if you inited it explicitly", TEST_ENABLED}; +static const SDLTest_TestCaseReference mainTest5 = + { (SDLTest_TestCaseFp)main_testSetError, "main_testSetError", "Tests that SDL_SetError() handles arbitrarily large strings", TEST_ENABLED}; + /* Sequence of Main test cases */ static const SDLTest_TestCaseReference *mainTests[] = { &mainTest1, &mainTest2, &mainTest3, &mainTest4, + &mainTest5, NULL }; diff -Nru libsdl2-2.0.22+dfsg/test/testautomation_math.c libsdl2-2.24.0+dfsg/test/testautomation_math.c --- libsdl2-2.0.22+dfsg/test/testautomation_math.c 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testautomation_math.c 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,3352 @@ +/** + * Math test suite + */ + +#include +#include + +#include "SDL.h" +#include "SDL_test.h" + +/* ================= Test Constants ================== */ + +/* Range tests parameters */ +#define RANGE_TEST_ITERATIONS 10000000 +#define RANGE_TEST_STEP SDL_MAX_UINT32 / RANGE_TEST_ITERATIONS + +/* Margin of error for imprecise tests */ +#define EPSILON 1.0E-10 + +/* Euler constant (used in exp/log) */ +#ifndef M_E +#define EULER 2.7182818284590450907955982984276488423347473144531250 +#else +#define EULER M_E +#endif + +/* Square root of 3 (used in atan2) */ +#define SQRT3 1.7320508075688771931766041234368458390235900878906250 + +/* ================= Test Structs ================== */ + +/** + * Stores a single input and the expected result + */ +typedef struct +{ + double input; + double expected; +} d_to_d; + +/** + * Stores a pair of inputs and the expected result + */ +typedef struct +{ + double x_input, y_input; + double expected; +} dd_to_d; + +/* + NB: You cannot create an array of these structures containing INFINITY or NAN. + On platforms such as OS/2, they are defined as 'extern const double' making them + not compile-time constant. +*/ + +/* ================= Test Helpers ================== */ + +typedef double(SDLCALL *d_to_d_func)(double); +typedef double(SDLCALL *dd_to_d_func)(double, double); + +/** + * \brief Runs all the cases on a given function with a signature double -> double. + * The result is expected to be exact. + * + * \param func_name, a printable name for the tested function. + * \param func, the function to call. + * \param cases, an array of all the cases. + * \param cases_size, the size of the cases array. + */ +static int +helper_dtod(const char *func_name, d_to_d_func func, + const d_to_d *cases, const size_t cases_size) +{ + Uint32 i; + for (i = 0; i < cases_size; i++) { + const double result = func(cases[i].input); + SDLTest_AssertCheck(result == cases[i].expected, + "%s(%f), expected %f, got %f", + func_name, + cases[i].input, + cases[i].expected, result); + } + + return TEST_COMPLETED; +} + +/** + * \brief Runs all the cases on a given function with a signature double -> double. + * Checks if the result between expected +/- EPSILON. + * + * \param func_name, a printable name for the tested function. + * \param func, the function to call. + * \param cases, an array of all the cases. + * \param cases_size, the size of the cases array. + */ +static int +helper_dtod_inexact(const char *func_name, d_to_d_func func, + const d_to_d *cases, const size_t cases_size) +{ + Uint32 i; + for (i = 0; i < cases_size; i++) { + const double result = func(cases[i].input); + SDLTest_AssertCheck(result >= cases[i].expected - EPSILON && + result <= cases[i].expected + EPSILON, + "%s(%f), expected [%f,%f], got %f", + func_name, + cases[i].input, + cases[i].expected - EPSILON, + cases[i].expected + EPSILON, + result); + } + + return TEST_COMPLETED; +} + +/** + * \brief Runs all the cases on a given function with a signature + * (double, double) -> double. The result is expected to be exact. + * + * \param func_name, a printable name for the tested function. + * \param func, the function to call. + * \param cases, an array of all the cases. + * \param cases_size, the size of the cases array. + */ +static int +helper_ddtod(const char *func_name, dd_to_d_func func, + const dd_to_d *cases, const size_t cases_size) +{ + Uint32 i; + for (i = 0; i < cases_size; i++) { + const double result = func(cases[i].x_input, cases[i].y_input); + SDLTest_AssertCheck(result == cases[i].expected, + "%s(%f,%f), expected %f, got %f", + func_name, + cases[i].x_input, cases[i].y_input, + cases[i].expected, result); + } + + return TEST_COMPLETED; +} + +/** + * \brief Runs all the cases on a given function with a signature + * (double, double) -> double. Checks if the result between expected +/- EPSILON. + * + * \param func_name, a printable name for the tested function. + * \param func, the function to call. + * \param cases, an array of all the cases. + * \param cases_size, the size of the cases array. + */ +static int +helper_ddtod_inexact(const char *func_name, dd_to_d_func func, + const dd_to_d *cases, const size_t cases_size) +{ + Uint32 i; + for (i = 0; i < cases_size; i++) { + const double result = func(cases[i].x_input, cases[i].y_input); + SDLTest_AssertCheck(result >= cases[i].expected - EPSILON && + result <= cases[i].expected + EPSILON, + "%s(%f,%f), expected [%f,%f], got %f", + func_name, + cases[i].x_input, cases[i].y_input, + cases[i].expected - EPSILON, + cases[i].expected + EPSILON, + result); + } + + return TEST_COMPLETED; +} + +/** + * \brief Runs a range of values on a given function with a signature double -> double + * + * This function is only meant to test functions that returns the input value if it is + * integral: f(x) -> x for x in N. + * + * \param func_name, a printable name for the tested function. + * \param func, the function to call. + */ +static int +helper_range(const char *func_name, d_to_d_func func) +{ + Uint32 i; + double test_value = 0.0; + + SDLTest_AssertPass("%s: Testing a range of %u values with steps of %u", + func_name, + RANGE_TEST_ITERATIONS, + RANGE_TEST_STEP); + + for (i = 0; i < RANGE_TEST_ITERATIONS; i++, test_value += RANGE_TEST_STEP) { + double result; + /* These are tested elsewhere */ + if (isnan(test_value) || isinf(test_value)) { + continue; + } + + result = func(test_value); + if (result != test_value) { /* Only log failures to save performances */ + SDLTest_AssertCheck(SDL_FALSE, + "%s(%.1f), expected %.1f, got %.1f", + func_name, test_value, + test_value, result); + return TEST_ABORTED; + } + } + + return TEST_COMPLETED; +} + +/* ================= Test Case Implementation ================== */ + +/* SDL_floor tests functions */ + +/** + * Inputs: +/-Infinity. + * Expected: Infinity is returned as-is. + */ +static int +floor_infCases(void *args) +{ + double result; + + result = SDL_floor(INFINITY); + SDLTest_AssertCheck(INFINITY == result, + "Floor(%f), expected %f, got %f", + INFINITY, INFINITY, result); + + result = SDL_floor(-INFINITY); + SDLTest_AssertCheck(-INFINITY == result, + "Floor(%f), expected %f, got %f", + -INFINITY, -INFINITY, result); + + return TEST_COMPLETED; +} + +/** + * Inputs: +/-0.0. + * Expected: Zero is returned as-is. + */ +static int +floor_zeroCases(void *args) +{ + const d_to_d zero_cases[] = { + { 0.0, 0.0 }, + { -0.0, -0.0 } + }; + return helper_dtod("Floor", SDL_floor, zero_cases, SDL_arraysize(zero_cases)); +} + +/** + * Input: NAN. + * Expected: NAN is returned. + */ +static int +floor_nanCase(void *args) +{ + const double result = SDL_floor(NAN); + SDLTest_AssertCheck(isnan(result), + "Floor(nan), expected nan, got %f", + result); + return TEST_COMPLETED; +} + +/** + * Inputs: integral values. + * Expected: the input value is returned as-is. + */ +static int +floor_roundNumbersCases(void *args) +{ + const d_to_d round_cases[] = { + { 1.0, 1.0 }, + { -1.0, -1.0 }, + { 15.0, 15.0 }, + { -15.0, -15.0 }, + { 125.0, 125.0 }, + { -125.0, -125.0 }, + { 1024.0, 1024.0 }, + { -1024.0, -1024.0 } + }; + return helper_dtod("Floor", SDL_floor, round_cases, SDL_arraysize(round_cases)); +} + +/** + * Inputs: fractional values. + * Expected: the lower integral value is returned. + */ +static int +floor_fractionCases(void *args) +{ + const d_to_d frac_cases[] = { + { 1.0 / 2.0, 0.0 }, + { -1.0 / 2.0, -1.0 }, + { 4.0 / 3.0, 1.0 }, + { -4.0 / 3.0, -2.0 }, + { 76.0 / 7.0, 10.0 }, + { -76.0 / 7.0, -11.0 }, + { 535.0 / 8.0, 66.0 }, + { -535.0 / 8.0, -67.0 }, + { 19357.0 / 53.0, 365.0 }, + { -19357.0 / 53.0, -366.0 } + }; + return helper_dtod("Floor", SDL_floor, frac_cases, SDL_arraysize(frac_cases)); +} + +/** + * Inputs: values in the range [0, UINT32_MAX]. + * Expected: the input value is returned as-is. + */ +static int +floor_rangeTest(void *args) +{ + return helper_range("Floor", SDL_floor); +} + +/* SDL_ceil tests functions */ + +/** + * Inputs: +/-Infinity. + * Expected: Infinity is returned as-is. + */ +static int +ceil_infCases(void *args) +{ + double result; + + result = SDL_ceil(INFINITY); + SDLTest_AssertCheck(INFINITY == result, + "Ceil(%f), expected %f, got %f", + INFINITY, INFINITY, result); + + result = SDL_ceil(-INFINITY); + SDLTest_AssertCheck(-INFINITY == result, + "Ceil(%f), expected %f, got %f", + -INFINITY, -INFINITY, result); + + return TEST_COMPLETED; +} + +/** + * Inputs: +/-0.0. + * Expected: Zero is returned as-is. + */ +static int +ceil_zeroCases(void *args) +{ + const d_to_d zero_cases[] = { + { 0.0, 0.0 }, + { -0.0, -0.0 } + }; + return helper_dtod("Ceil", SDL_ceil, zero_cases, SDL_arraysize(zero_cases)); +} + +/** + * Input: NAN. + * Expected: NAN is returned. + */ +static int +ceil_nanCase(void *args) +{ + const double result = SDL_ceil(NAN); + SDLTest_AssertCheck(isnan(result), + "Ceil(nan), expected nan, got %f", + result); + return TEST_COMPLETED; +} + +/** + * Inputs: integral values. + * Expected: the input value is returned as-is. + */ +static int +ceil_roundNumbersCases(void *args) +{ + const d_to_d round_cases[] = { + { 1.0, 1.0 }, + { -1.0, -1.0 }, + { 15.0, 15.0 }, + { -15.0, -15.0 }, + { 125.0, 125.0 }, + { -125.0, -125.0 }, + { 1024.0, 1024.0 }, + { -1024.0, -1024.0 } + }; + return helper_dtod("Ceil", SDL_ceil, round_cases, SDL_arraysize(round_cases)); +} + +/** + * Inputs: fractional values. + * Expected: the higher integral value is returned. + */ +static int +ceil_fractionCases(void *args) +{ + const d_to_d frac_cases[] = { + { 1.0 / 2.0, 1.0 }, + { -1.0 / 2.0, -0.0 }, + { 4.0 / 3.0, 2.0 }, + { -4.0 / 3.0, -1.0 }, + { 76.0 / 7.0, 11.0 }, + { -76.0 / 7.0, -10.0 }, + { 535.0 / 8.0, 67.0 }, + { -535.0 / 8.0, -66.0 }, + { 19357.0 / 53.0, 366.0 }, + { -19357.0 / 53.0, -365.0 } + }; + return helper_dtod("Ceil", SDL_ceil, frac_cases, SDL_arraysize(frac_cases)); +} + +/** + * Inputs: values in the range [0, UINT32_MAX]. + * Expected: the input value is returned as-is. + */ +static int +ceil_rangeTest(void *args) +{ + return helper_range("Ceil", SDL_ceil); +} + +/* SDL_trunc tests functions */ + +/** + * Inputs: +/-Infinity. + * Expected: Infinity is returned as-is. + */ +static int +trunc_infCases(void *args) +{ + double result; + + result = SDL_trunc(INFINITY); + SDLTest_AssertCheck(INFINITY == result, + "Trunc(%f), expected %f, got %f", + INFINITY, INFINITY, result); + + result = SDL_trunc(-INFINITY); + SDLTest_AssertCheck(-INFINITY == result, + "Trunc(%f), expected %f, got %f", + -INFINITY, -INFINITY, result); + + return TEST_COMPLETED; +} + +/** + * Inputs: +/-0.0. + * Expected: Zero is returned as-is. + */ +static int +trunc_zeroCases(void *args) +{ + const d_to_d zero_cases[] = { + { 0.0, 0.0 }, + { -0.0, -0.0 } + }; + return helper_dtod("Trunc", SDL_trunc, zero_cases, SDL_arraysize(zero_cases)); +} + +/** + * Input: NAN. + * Expected: NAN is returned. + */ +static int +trunc_nanCase(void *args) +{ + const double result = SDL_trunc(NAN); + SDLTest_AssertCheck(isnan(result), + "Trunc(nan), expected nan, got %f", + result); + return TEST_COMPLETED; +} + +/** + * Inputs: integral values. + * Expected: the input value is returned as-is. + */ +static int +trunc_roundNumbersCases(void *args) +{ + const d_to_d round_cases[] = { + { 1.0, 1.0 }, + { -1.0, -1.0 }, + { 15.0, 15.0 }, + { -15.0, -15.0 }, + { 125.0, 125.0 }, + { -125.0, -125.0 }, + { 1024.0, 1024.0 }, + { -1024.0, -1024.0 } + }; + return helper_dtod("Trunc", SDL_trunc, round_cases, SDL_arraysize(round_cases)); +} + +/** + * Inputs: fractional values. + * Expected: the integral part is returned. + */ +static int +trunc_fractionCases(void *args) +{ + const d_to_d frac_cases[] = { + { 1.0 / 2.0, 0.0 }, + { -1.0 / 2.0, -0.0 }, + { 4.0 / 3.0, 1.0 }, + { -4.0 / 3.0, -1.0 }, + { 76.0 / 7.0, 10.0 }, + { -76.0 / 7.0, -10.0 }, + { 535.0 / 8.0, 66.0 }, + { -535.0 / 8.0, -66.0 }, + { 19357.0 / 53.0, 365.0 }, + { -19357.0 / 53.0, -365.0 } + }; + return helper_dtod("Trunc", SDL_trunc, frac_cases, SDL_arraysize(frac_cases)); +} + +/** + * Inputs: values in the range [0, UINT32_MAX]. + * Expected: the input value is returned as-is. + */ +static int +trunc_rangeTest(void *args) +{ + return helper_range("Trunc", SDL_trunc); +} + +/* SDL_round tests functions */ + +/** + * Inputs: +/-Infinity. + * Expected: Infinity is returned as-is. + */ +static int +round_infCases(void *args) +{ + double result; + + result = SDL_round(INFINITY); + SDLTest_AssertCheck(INFINITY == result, + "Round(%f), expected %f, got %f", + INFINITY, INFINITY, result); + + result = SDL_round(-INFINITY); + SDLTest_AssertCheck(-INFINITY == result, + "Round(%f), expected %f, got %f", + -INFINITY, -INFINITY, result); + + return TEST_COMPLETED; +} + +/** + * Inputs: +/-0.0. + * Expected: Zero is returned as-is. + */ +static int +round_zeroCases(void *args) +{ + const d_to_d zero_cases[] = { + { 0.0, 0.0 }, + { -0.0, -0.0 } + }; + return helper_dtod("Round", SDL_round, zero_cases, SDL_arraysize(zero_cases)); +} + +/** + * Input: NAN. + * Expected: NAN is returned. + */ +static int +round_nanCase(void *args) +{ + const double result = SDL_round(NAN); + SDLTest_AssertCheck(isnan(result), + "Round(nan), expected nan, got %f", + result); + return TEST_COMPLETED; +} + +/** + * Inputs: integral values. + * Expected: the input value is returned as-is. + */ +static int +round_roundNumbersCases(void *args) +{ + const d_to_d round_cases[] = { + { 1.0, 1.0 }, + { -1.0, -1.0 }, + { 15.0, 15.0 }, + { -15.0, -15.0 }, + { 125.0, 125.0 }, + { -125.0, -125.0 }, + { 1024.0, 1024.0 }, + { -1024.0, -1024.0 } + }; + return helper_dtod("Round", SDL_round, round_cases, SDL_arraysize(round_cases)); +} + +/** + * Inputs: fractional values. + * Expected: the nearest integral value is returned. + */ +static int +round_fractionCases(void *args) +{ + const d_to_d frac_cases[] = { + { 1.0 / 2.0, 1.0 }, + { -1.0 / 2.0, -1.0 }, + { 4.0 / 3.0, 1.0 }, + { -4.0 / 3.0, -1.0 }, + { 76.0 / 7.0, 11.0 }, + { -76.0 / 7.0, -11.0 }, + { 535.0 / 8.0, 67.0 }, + { -535.0 / 8.0, -67.0 }, + { 19357.0 / 53.0, 365.0 }, + { -19357.0 / 53.0, -365.0 } + }; + return helper_dtod("Round", SDL_round, frac_cases, SDL_arraysize(frac_cases)); +} + +/** + * Inputs: values in the range [0, UINT32_MAX]. + * Expected: the input value is returned as-is. + */ +static int +round_rangeTest(void *args) +{ + return helper_range("Round", SDL_round); +} + +/* SDL_fabs tests functions */ + +/** + * Inputs: +/-Infinity. + * Expected: Positive Infinity is returned. + */ +static int +fabs_infCases(void *args) +{ + double result; + + result = SDL_fabs(INFINITY); + SDLTest_AssertCheck(INFINITY == result, + "Fabs(%f), expected %f, got %f", + INFINITY, INFINITY, result); + + result = SDL_fabs(-INFINITY); + SDLTest_AssertCheck(INFINITY == result, + "Fabs(%f), expected %f, got %f", + -INFINITY, INFINITY, result); + + return TEST_COMPLETED; +} + +/** + * Inputs: +/-0.0. + * Expected: Positive zero is returned. + */ +static int +fabs_zeroCases(void *args) +{ + const d_to_d zero_cases[] = { + { 0.0, 0.0 }, + { -0.0, 0.0 } + }; + return helper_dtod("Fabs", SDL_fabs, zero_cases, SDL_arraysize(zero_cases)); +} + +/** + * Input: NAN. + * Expected: NAN is returned. + */ +static int +fabs_nanCase(void *args) +{ + const double result = SDL_fabs(NAN); + SDLTest_AssertCheck(isnan(result), + "Fabs(nan), expected nan, got %f", + result); + return TEST_COMPLETED; +} + +/** + * Inputs: values in the range [0, UINT32_MAX]. + * Expected: the input value is returned as-is. + */ +static int +fabs_rangeTest(void *args) +{ + return helper_range("Fabs", SDL_fabs); +} + +/* SDL_copysign tests functions */ + +/** + * Inputs: (+/-Infinity, +/-1.0). + * Expected: Infinity with the sign of 1.0 is returned. + */ +static int +copysign_infCases(void *args) +{ + double result; + + result = SDL_copysign(INFINITY, -1.0); + SDLTest_AssertCheck(-INFINITY == result, + "Copysign(%f,%.1f), expected %f, got %f", + INFINITY, -1.0, -INFINITY, result); + + result = SDL_copysign(INFINITY, 1.0); + SDLTest_AssertCheck(INFINITY == result, + "Copysign(%f,%.1f), expected %f, got %f", + INFINITY, 1.0, INFINITY, result); + + result = SDL_copysign(-INFINITY, -1.0); + SDLTest_AssertCheck(-INFINITY == result, + "Copysign(%f,%.1f), expected %f, got %f", + -INFINITY, -1.0, -INFINITY, result); + + result = SDL_copysign(-INFINITY, 1.0); + SDLTest_AssertCheck(INFINITY == result, + "Copysign(%f,%.1f), expected %f, got %f", + -INFINITY, 1.0, INFINITY, result); + + return TEST_COMPLETED; +} + +/** + * Inputs: (+/-0.0, +/-1.0). + * Expected: 0.0 with the sign of 1.0 is returned. + */ +static int +copysign_zeroCases(void *args) +{ + const dd_to_d zero_cases[] = { + { 0.0, 1.0, 0.0 }, + { 0.0, -1.0, -0.0 }, + { -0.0, 1.0, 0.0 }, + { -0.0, -1.0, -0.0 } + }; + return helper_ddtod("Copysign", SDL_copysign, zero_cases, SDL_arraysize(zero_cases)); +} + +/** + * Inputs: (NAN, +/-1.0). + * Expected: NAN with the sign of 1.0 is returned. + * NOTE: On some platforms signed NAN is not supported, so we only check if the result is still NAN. + */ +static int +copysign_nanCases(void *args) +{ + double result; + + result = SDL_copysign(NAN, 1.0); + SDLTest_AssertCheck(isnan(result), + "Copysign(nan,1.0), expected nan, got %f", + result); + + result = SDL_copysign(NAN, -1.0); + SDLTest_AssertCheck(isnan(result), + "Copysign(nan,-1.0), expected nan, got %f", + result); + return TEST_COMPLETED; +} + +/** + * Inputs: values in the range [0, UINT32_MAX], +/-1.0. + * Expected: the input value with the sign of 1.0 is returned. + */ +static int +copysign_rangeTest(void *args) +{ + Uint32 i; + double test_value = 0.0; + + SDLTest_AssertPass("Copysign: Testing a range of %u values with steps of %u", + RANGE_TEST_ITERATIONS, + RANGE_TEST_STEP); + + for (i = 0; i < RANGE_TEST_ITERATIONS; i++, test_value += RANGE_TEST_STEP) { + double result; + /* These are tested elsewhere */ + if (isnan(test_value) || isinf(test_value)) { + continue; + } + + /* Only log failures to save performances */ + result = SDL_copysign(test_value, 1.0); + if (result != test_value) { + SDLTest_AssertCheck(SDL_FALSE, + "Copysign(%.1f,%.1f), expected %.1f, got %.1f", + test_value, 1.0, test_value, result); + return TEST_ABORTED; + } + + result = SDL_copysign(test_value, -1.0); + if (result != -test_value) { + SDLTest_AssertCheck(SDL_FALSE, + "Copysign(%.1f,%.1f), expected %.1f, got %.1f", + test_value, -1.0, -test_value, result); + return TEST_ABORTED; + } + } + return TEST_COMPLETED; +} + +/* SDL_fmod tests functions */ + +/** + * Inputs: (+/-Infinity, +/-1.0). + * Expected: NAN is returned. + */ +static int +fmod_divOfInfCases(void *args) +{ + double result; + + result = SDL_fmod(INFINITY, -1.0); + SDLTest_AssertCheck(isnan(result), + "Fmod(%f,%.1f), expected %f, got %f", + INFINITY, -1.0, NAN, result); + + result = SDL_fmod(INFINITY, 1.0); + SDLTest_AssertCheck(isnan(result), + "Fmod(%f,%.1f), expected %f, got %f", + INFINITY, 1.0, NAN, result); + + result = SDL_fmod(-INFINITY, -1.0); + SDLTest_AssertCheck(isnan(result), + "Fmod(%f,%.1f), expected %f, got %f", + -INFINITY, -1.0, NAN, result); + + result = SDL_fmod(-INFINITY, 1.0); + SDLTest_AssertCheck(isnan(result), + "Fmod(%f,%.1f), expected %f, got %f", + -INFINITY, 1.0, NAN, result); + + return TEST_COMPLETED; +} + +/** + * Inputs: (+/-1.0, +/-Infinity). + * Expected: 1.0 is returned as-is. + */ +static int +fmod_divByInfCases(void *args) +{ + double result; + + result = SDL_fmod(1.0, INFINITY); + SDLTest_AssertCheck(1.0 == result, + "Fmod(%.1f,%f), expected %f, got %f", + 1.0, INFINITY, 1.0, result); + + result = SDL_fmod(-1.0, INFINITY); + SDLTest_AssertCheck(-1.0 == result, + "Fmod(%.1f,%f), expected %f, got %f", + -1.0, INFINITY, -1.0, result); + + result = SDL_fmod(1.0, -INFINITY); + SDLTest_AssertCheck(1.0 == result, + "Fmod(%.1f,%f), expected %f, got %f", + 1.0, -INFINITY, 1.0, result); + + result = SDL_fmod(-1.0, -INFINITY); + SDLTest_AssertCheck(-1.0 == result, + "Fmod(%.1f,%f), expected %f, got %f", + -1.0, -INFINITY, -1.0, result); + + return TEST_COMPLETED; +} + +/** + * Inputs: (+/-0.0, +/-1.0). + * Expected: Zero is returned as-is. + */ +static int +fmod_divOfZeroCases(void *args) +{ + const dd_to_d zero_cases[] = { + { 0.0, 1.0, 0.0 }, + { 0.0, -1.0, 0.0 }, + { -0.0, 1.0, -0.0 }, + { -0.0, -1.0, -0.0 } + }; + return helper_ddtod("Fmod", SDL_fmod, zero_cases, SDL_arraysize(zero_cases)); +} + +/** + * Inputs: (+/-1.0, +/-0.0). + * Expected: NAN is returned. + */ +static int +fmod_divByZeroCases(void *args) +{ + double result; + + result = SDL_fmod(1.0, 0.0); + SDLTest_AssertCheck(isnan(result), + "Fmod(1.0,0.0), expected nan, got %f", + result); + + result = SDL_fmod(-1.0, 0.0); + SDLTest_AssertCheck(isnan(result), + "Fmod(-1.0,0.0), expected nan, got %f", + result); + + result = SDL_fmod(1.0, -0.0); + SDLTest_AssertCheck(isnan(result), + "Fmod(1.0,-0.0), expected nan, got %f", + result); + + result = SDL_fmod(-1.0, -0.0); + SDLTest_AssertCheck(isnan(result), + "Fmod(-1.0,-0.0), expected nan, got %f", + result); + + return TEST_COMPLETED; +} + +/** + * Inputs: all permutation of NAN and +/-1.0. + * Expected: NAN is returned. + */ +static int +fmod_nanCases(void *args) +{ + double result; + + result = SDL_fmod(NAN, 1.0); + SDLTest_AssertCheck(isnan(result), + "Fmod(nan,1.0), expected nan, got %f", + result); + + result = SDL_fmod(NAN, -1.0); + SDLTest_AssertCheck(isnan(result), + "Fmod(nan,-1.0), expected nan, got %f", + result); + + result = SDL_fmod(1.0, NAN); + SDLTest_AssertCheck(isnan(result), + "Fmod(1.0,nan), expected nan, got %f", + result); + + result = SDL_fmod(-1.0, NAN); + SDLTest_AssertCheck(isnan(result), + "Fmod(-1.0,nan), expected nan, got %f", + result); + + return TEST_COMPLETED; +} + +/** + * Inputs: values within the domain of the function. + * Expected: the correct result is returned. + */ +static int +fmod_regularCases(void *args) +{ + const dd_to_d regular_cases[] = { + { 3.5, 2.0, 1.5 }, + { -6.25, 3.0, -0.25 }, + { 7.5, 2.5, 0.0 }, + { 2.0 / 3.0, -1.0 / 3.0, 0.0 } + }; + return helper_ddtod("Fmod", SDL_fmod, regular_cases, SDL_arraysize(regular_cases)); +} + +/** + * Inputs: values in the range [0, UINT32_MAX] divided by 1.0. + * Expected: Positive zero is always returned. + */ +static int +fmod_rangeTest(void *args) +{ + Uint32 i; + double test_value = 0.0; + + SDLTest_AssertPass("Fmod: Testing a range of %u values with steps of %u", + RANGE_TEST_ITERATIONS, + RANGE_TEST_STEP); + + for (i = 0; i < RANGE_TEST_ITERATIONS; i++, test_value += RANGE_TEST_STEP) { + double result; + /* These are tested elsewhere */ + if (isnan(test_value) || isinf(test_value)) { + continue; + } + + /* Only log failures to save performances */ + result = SDL_fmod(test_value, 1.0); + if (0.0 != result) { + SDLTest_AssertCheck(SDL_FALSE, + "Fmod(%.1f,%.1f), expected %.1f, got %.1f", + test_value, 1.0, 0.0, result); + return TEST_ABORTED; + } + } + return TEST_COMPLETED; +} + +/* SDL_exp tests functions */ + +/** + * Inputs: +/-Infinity. + * Expected: Infinity is returned as-is. + */ +static int +exp_infCases(void *args) +{ + double result; + + result = SDL_exp(INFINITY); + SDLTest_AssertCheck(INFINITY == result, + "Exp(%f), expected %f, got %f", + INFINITY, INFINITY, result); + + result = SDL_exp(-INFINITY); + SDLTest_AssertCheck(0.0 == result, + "Exp(%f), expected %f, got %f", + -INFINITY, 0.0, result); + + return TEST_COMPLETED; +} + +/** + * Inputs: +/-0.0. + * Expected: 1.0 is returned. + */ +static int +exp_zeroCases(void *args) +{ + const d_to_d zero_cases[] = { + { 0.0, 1.0 }, + { -0.0, 1.0 } + }; + return helper_dtod("Exp", SDL_exp, zero_cases, SDL_arraysize(zero_cases)); +} + +/** + * Input: 710.0 (overflows for 64bits double). + * Expected: Infinity is returned. + * NOTE: This test is skipped for double types larger than 64 bits. + */ +static int +exp_overflowCase(void *args) +{ + double result; + + if (sizeof(double) > 8) { + return TEST_SKIPPED; + } + + result = SDL_exp(710.0); + SDLTest_AssertCheck(isinf(result), + "Exp(%f), expected %f, got %f", + 710.0, INFINITY, result); + return TEST_COMPLETED; +} + +/** + * Input: 1.0 + * Expected: The euler constant. + */ +static int +exp_baseCase(void *args) +{ + const double result = SDL_exp(1.0); + SDLTest_AssertCheck(result >= EULER - EPSILON && + result <= EULER + EPSILON, + "Exp(%f), expected [%f,%f], got %f", + 1.0, EULER - EPSILON, EULER + EPSILON, result); + return TEST_COMPLETED; +} + +/** + * Inputs: values within the domain of the function. + * Expected: the correct result is returned. + */ +static int +exp_regularCases(void *args) +{ + /* Hexadecimal floating constants are not supported on C89 compilers */ + const d_to_d regular_cases[] = { + { -101.0, 1.36853947117385291381565719268793547578002532127613087E-44 }, + { -15.73, 0.00000014741707833928422931856502906683425990763681 }, + { -1.0, 0.36787944117144233402427744294982403516769409179688 }, + { -0.5, 0.60653065971263342426311737654032185673713684082031 }, + { 0.5, 1.64872127070012819416433558217249810695648193359375 }, + { 2.25, 9.48773583635852624240669683786109089851379394531250 }, + { 34.125, 661148770968660.375 }, + { 112.89, 10653788283588960962604279261058893737879589093376.0 }, + { 539.483, 1970107755334319939701129934673541628417235942656909222826926175622435588279443011110464355295725187195188154768877850257012251677751742837992843520967922303961718983154427294786640886286983037548604937796221048661733679844353544028160.0 }, + }; + return helper_dtod("Exp", SDL_exp, regular_cases, SDL_arraysize(regular_cases)); +} + +/* SDL_log tests functions */ + +/** + * Inputs: Positive Infinity and +/-0.0. + * Expected: Positive and negative Infinity respectively. + */ +static int +log_limitCases(void *args) +{ + double result; + + result = SDL_log(INFINITY); + SDLTest_AssertCheck(INFINITY == result, + "Log(%f), expected %f, got %f", + INFINITY, INFINITY, result); + + result = SDL_log(0.0); + SDLTest_AssertCheck(-INFINITY == result, + "Log(%f), expected %f, got %f", + 0.0, -INFINITY, result); + + result = SDL_log(-0.0); + SDLTest_AssertCheck(-INFINITY == result, + "Log(%f), expected %f, got %f", + -0.0, -INFINITY, result); + + return TEST_COMPLETED; +} + +/** + * Inputs: 1.0 and the Euler constant. + * Expected: 0.0 and 1.0 respectively. + */ +static int +log_baseCases(void *args) +{ + double result; + + result = SDL_log(1.0); + SDLTest_AssertCheck(0.0 == result, + "Log(%f), expected %f, got %f", + 1.0, 0.0, result); + + result = SDL_log(EULER); + SDLTest_AssertCheck(1.0 == result, + "Log(%f), expected %f, got %f", + EULER, 1.0, result); + + return TEST_COMPLETED; +} + +/** + * Inputs: NAN and a negative value. + * Expected: NAN is returned. + */ +static int +log_nanCases(void *args) +{ + double result; + + result = SDL_log(NAN); + SDLTest_AssertCheck(isnan(result), + "Log(%f), expected %f, got %f", + NAN, NAN, result); + + result = SDL_log(-1234.5678); + SDLTest_AssertCheck(isnan(result), + "Log(%f), expected %f, got %f", + -1234.5678, NAN, result); + + return TEST_COMPLETED; +} + +/** + * Inputs: values within the domain of the function. + * Expected: the correct result is returned. + */ +static int +log_regularCases(void *args) +{ + const d_to_d regular_cases[] = { + { 5.0, 1.60943791243410028179994242236716672778129577636718750 }, + { 10.0, 2.302585092994045901093613792909309267997741699218750 }, + { 56.32, 4.031049711849786554296315443934872746467590332031250 }, + { 789.123, 6.670922202231861497523368598194792866706848144531250 }, + { 2734.876324, 7.91384149408957959792587644187733530998229980468750 } + }; + return helper_dtod("Log", SDL_log, regular_cases, SDL_arraysize(regular_cases)); +} + +/* SDL_log10 tests functions */ + +/** + * Inputs: Positive Infinity and +/-0.0. + * Expected: Positive and negative Infinity respectively. + */ +static int +log10_limitCases(void *args) +{ + double result; + + result = SDL_log10(INFINITY); + SDLTest_AssertCheck(INFINITY == result, + "Log10(%f), expected %f, got %f", + INFINITY, INFINITY, result); + + result = SDL_log10(0.0); + SDLTest_AssertCheck(-INFINITY == result, + "Log10(%f), expected %f, got %f", + 0.0, -INFINITY, result); + + result = SDL_log10(-0.0); + SDLTest_AssertCheck(-INFINITY == result, + "Log10(%f), expected %f, got %f", + -0.0, -INFINITY, result); + + return TEST_COMPLETED; +} + +/** + * Inputs: Powers of ten from 0 to 9. + * Expected: the exact power of ten is returned. + */ +static int +log10_baseCases(void *args) +{ + const d_to_d base_cases[] = { + { 1.0, 0.0 }, + { 10.0, 1.0 }, + { 100.0, 2.0 }, + { 1000.0, 3.0 }, + { 10000.0, 4.0 }, + { 100000.0, 5.0 }, + { 1000000.0, 6.0 }, + { 10000000.0, 7.0 }, + { 100000000.0, 8.0 }, + { 1000000000.0, 9.0 }, + }; + return helper_dtod("Log10", SDL_log10, base_cases, SDL_arraysize(base_cases)); +} + +/** + * Inputs: NAN and a negative value. + * Expected: NAN is returned. + */ +static int +log10_nanCases(void *args) +{ + double result; + + result = SDL_log10(NAN); + SDLTest_AssertCheck(isnan(result), + "Log10(%f), expected %f, got %f", + NAN, NAN, result); + + result = SDL_log10(-1234.5678); + SDLTest_AssertCheck(isnan(result), + "Log10(%f), expected %f, got %f", + -1234.5678, NAN, result); + + return TEST_COMPLETED; +} + +/** + * Inputs: values within the domain of the function. + * Expected: the correct result is returned. + */ +static int +log10_regularCases(void *args) +{ + const d_to_d regular_cases[] = { + { 5.0, 0.698970004336018857493684208748163655400276184082031250 }, + { 12.5, 1.09691001300805646145875016372883692383766174316406250 }, + { 56.32, 1.750662646134055755453573510749265551567077636718750 }, + { 789.123, 2.8971447016351858927407647570362314581871032714843750 }, + { 2734.876324, 3.436937691540090433761633903486654162406921386718750 } + }; + return helper_dtod_inexact("Log10", SDL_log10, regular_cases, SDL_arraysize(regular_cases)); +} + +/* SDL_pow tests functions */ + +/* Tests with positive and negative infinities as exponents */ + +/** + * Inputs: (-1.0, +/-Infinity). + * Expected: 1.0 is returned. + */ +static int +pow_baseNOneExpInfCases(void *args) +{ + double result; + + result = SDL_pow(-1.0, INFINITY); + SDLTest_AssertCheck(1.0 == result, + "Pow(%f,%f), expected %f, got %f", + -1.0, INFINITY, 1.0, result); + + result = SDL_pow(-1.0, -INFINITY); + SDLTest_AssertCheck(1.0 == result, + "Pow(%f,%f), expected %f, got %f", + -1.0, -INFINITY, 1.0, result); + + return TEST_COMPLETED; +} +/** + * Inputs: (+/-0.0, -Infinity). + * Expected: Infinity is returned. + */ +static int +pow_baseZeroExpNInfCases(void *args) +{ + double result; + + result = SDL_pow(0.0, -INFINITY); + SDLTest_AssertCheck(INFINITY == result, + "Pow(%f,%f), expected %f, got %f", + 0.0, -INFINITY, INFINITY, result); + + result = SDL_pow(-0.0, -INFINITY); + SDLTest_AssertCheck(INFINITY == result, + "Pow(%f,%f), expected %f, got %f", + -0.0, -INFINITY, INFINITY, result); + + return TEST_COMPLETED; +} + +/** + * Inputs: (x, +/-Infinity) where x is not +/-0.0. + * Expected: 0.0 when x < 1, Infinity when x > 1. + */ +static int +pow_expInfCases(void *args) +{ + double result; + + result = SDL_pow(0.5, INFINITY); + SDLTest_AssertCheck(0.0 == result, + "Pow(%f,%f), expected %f, got %f", + 0.5, INFINITY, 0.0, result); + + result = SDL_pow(1.5, INFINITY); + SDLTest_AssertCheck(INFINITY == result, + "Pow(%f,%f), expected %f, got %f", + 1.5, INFINITY, INFINITY, result); + + result = SDL_pow(0.5, -INFINITY); + SDLTest_AssertCheck(INFINITY == result, + "Pow(%f,%f), expected %f, got %f", + 0.5, INFINITY, INFINITY, result); + + result = SDL_pow(1.5, -INFINITY); + SDLTest_AssertCheck(0.0 == result, + "Pow(%f,%f), expected %f, got %f", + 1.5, -INFINITY, 0.0, result); + + return TEST_COMPLETED; +} + +/* Tests with positive and negative infinities as base */ + +/** + * Inputs: (Positive Infinity, x) where x is not +/-0.0. + * Expected: 0.0 when x is < 0, positive Infinity when x > 0. + */ +static int +pow_basePInfCases(void *args) +{ + double result; + + result = SDL_pow(INFINITY, -3.0); + SDLTest_AssertCheck(0.0 == result, + "Pow(%f,%f), expected %f, got %f", + INFINITY, -3.0, 0.0, result); + + result = SDL_pow(INFINITY, 2.0); + SDLTest_AssertCheck(INFINITY == result, + "Pow(%f,%f), expected %f, got %f", + INFINITY, 2.0, INFINITY, result); + + result = SDL_pow(INFINITY, -2.12345); + SDLTest_AssertCheck(0.0 == result, + "Pow(%f,%f), expected %f, got %f", + INFINITY, -2.12345, 0.0, result); + + result = SDL_pow(INFINITY, 3.1345); + SDLTest_AssertCheck(INFINITY == result, + "Pow(%f,%f), expected %f, got %f", + INFINITY, 3.12345, INFINITY, result); + + return TEST_COMPLETED; +} + +/** + * Inputs: (Negative Infinity, x) where x is not +/-0.0. + * Expected: + * - -0.0 when x is a negative odd integer, + * - 0.0 when x is a negative even integer or negative non-integer, + * - Negative Infinity when x is a positive odd integer, + * - Positive Infinity when x is a positive even integer or positive non-integer. + */ +static int +pow_baseNInfCases(void *args) +{ + double result; + + result = SDL_pow(-INFINITY, -3.0); + SDLTest_AssertCheck(-0.0 == result, + "Pow(%f,%f), expected %f, got %f", + -INFINITY, -3.0, -0.0, result); + + result = SDL_pow(-INFINITY, -2.0); + SDLTest_AssertCheck(0.0 == result, + "Pow(%f,%f), expected %f, got %f", + -INFINITY, -2.0, 0.0, result); + + result = SDL_pow(-INFINITY, -5.5); + SDLTest_AssertCheck(0.0 == result, + "Pow(%f,%f), expected %f, got %f", + -INFINITY, -5.5, 0.0, result); + + result = SDL_pow(-INFINITY, 3.0); + SDLTest_AssertCheck(-INFINITY == result, + "Pow(%f,%f), expected %f, got %f", + -INFINITY, 3.0, -INFINITY, result); + + result = SDL_pow(-INFINITY, 2.0); + SDLTest_AssertCheck(INFINITY == result, + "Pow(%f,%f), expected %f, got %f", + -INFINITY, 2.0, INFINITY, result); + + result = SDL_pow(-INFINITY, 5.5); + SDLTest_AssertCheck(INFINITY == result, + "Pow(%f,%f), expected %f, got %f", + -INFINITY, 5.5, INFINITY, result); + + return TEST_COMPLETED; +} + +/* Tests related to NAN */ + +/** + * Inputs: + * - finite and negative base, + * - finite and non-integer exponent. + * Expected: NAN is returned. + */ +static int +pow_badOperationCase(void *args) +{ + const double result = SDL_pow(-2.0, 4.2); + SDLTest_AssertCheck(isnan(result), + "Pow(%f,%f), expected %f, got %f", + -2.0, 4.2, NAN, result); + return TEST_COMPLETED; +} + +/** + * Inputs: (1.0, NAN) + * Expected: 1.0 is returned. + */ +static int +pow_base1ExpNanCase(void *args) +{ + const double result = SDL_pow(1.0, NAN); + SDLTest_AssertCheck(1.0 == result, + "Pow(%f,%f), expected %f, got %f", + 1.0, NAN, 1.0, result); + return TEST_COMPLETED; +} + +/** + * Inputs: (NAN, +/-0.0) + * Expected: 1.0 is returned. + */ +static int +pow_baseNanExp0Cases(void *args) +{ + double result; + + result = SDL_pow(NAN, 0.0); + SDLTest_AssertCheck(1.0 == result, + "Pow(%f,%f), expected %f, got %f", + NAN, 0.0, 1.0, result); + + result = SDL_pow(NAN, -0.0); + SDLTest_AssertCheck(1.0 == result, + "Pow(%f,%f), expected %f, got %f", + NAN, -0.0, 1.0, result); + + return TEST_COMPLETED; +} + +/** + * Inputs: NAN as base, exponent or both. + * Expected: NAN is returned. + */ +static int +pow_nanArgsCases(void *args) +{ + double result; + + result = SDL_pow(7.8, NAN); + SDLTest_AssertCheck(isnan(result), + "Pow(%f,%f), expected %f, got %f", + 7.8, NAN, NAN, result); + + result = SDL_pow(NAN, 10.0); + SDLTest_AssertCheck(isnan(result), + "Pow(%f,%f), expected %f, got %f", + NAN, 10.0, NAN, result); + + result = SDL_pow(NAN, NAN); + SDLTest_AssertCheck(isnan(result), + "Pow(%f,%f), expected %f, got %f", + NAN, NAN, NAN, result); + + return TEST_COMPLETED; +} + +/* Tests with positive and negative zeros as base */ + +/** + * Inputs: (-0.0, x) where x is an odd integer. + * Expected: + * - Negative Infinity with a negative exponent, + * - -0.0 with a positive exponent. + */ +static int +pow_baseNZeroExpOddCases(void *args) +{ + double result; + + result = SDL_pow(-0.0, -3.0); + SDLTest_AssertCheck(-INFINITY == result, + "Pow(%f,%f), expected %f, got %f", + -0.0, -3.0, -INFINITY, result); + + result = SDL_pow(-0.0, 3.0); + SDLTest_AssertCheck(-0.0 == result, + "Pow(%f,%f), expected %f, got %f", + -0.0, 3.0, -0.0, result); + + return TEST_COMPLETED; +} + +/** + * Inputs: (0.0, x) where x is an odd integer. + * Expected: + * - 0.0 with a positive exponent, + * - Positive Infinity with a negative exponent. + */ +static int +pow_basePZeroExpOddCases(void *args) +{ + double result; + + result = SDL_pow(0.0, -5.0); + SDLTest_AssertCheck(INFINITY == result, + "Pow(%f,%f), expected %f, got %f", + 0.0, -5.0, INFINITY, result); + + result = SDL_pow(0.0, 5.0); + SDLTest_AssertCheck(0.0 == result, + "Pow(%f,%f), expected %f, got %f", + 0.0, 5.0, 0.0, result); + + return TEST_COMPLETED; +} + +/** + * Inputs: (-0.0, x), with x either: + * - finite and even, + * - finite and non-integer. + * Expected: + * - Positive Infinity if the exponent is negative, + * - 0.0 if the exponent is positive. + */ +static int +pow_baseNZeroCases(void *args) +{ + double result; + + result = SDL_pow(-0.0, -3.5); + SDLTest_AssertCheck(INFINITY == result, + "Pow(%f,%f), expected %f, got %f", + -0.0, -3.5, INFINITY, result); + + result = SDL_pow(-0.0, -4.0); + SDLTest_AssertCheck(INFINITY == result, + "Pow(%f,%f), expected %f, got %f", + -0.0, -4.0, INFINITY, result); + + result = SDL_pow(-0.0, 3.5); + SDLTest_AssertCheck(0.0 == result, + "Pow(%f,%f), expected %f, got %f", + -0.0, 3.5, 0.0, result); + + result = SDL_pow(-0.0, 4.0); + SDLTest_AssertCheck(0.0 == result, + "Pow(%f,%f), expected %f, got %f", + -0.0, 4.0, 0.0, result); + + return TEST_COMPLETED; +} + +/** + * Inputs: (0.0, x), with x either: + * - finite and even, + * - finite and non-integer. + * Expected: + * - Positive Infinity if the exponent is negative, + * - 0.0 if the exponent is positive. + */ +static int +pow_basePZeroCases(void *args) +{ + double result; + + result = SDL_pow(0.0, -3.5); + SDLTest_AssertCheck(INFINITY == result, + "Pow(%f,%f), expected %f, got %f", + 0.0, -3.5, INFINITY, result); + + result = SDL_pow(0.0, -4.0); + SDLTest_AssertCheck(INFINITY == result, + "Pow(%f,%f), expected %f, got %f", + 0.0, -4.0, INFINITY, result); + + result = SDL_pow(0.0, 3.5); + SDLTest_AssertCheck(0.0 == result, + "Pow(%f,%f), expected %f, got %f", + 0.0, 3.5, 0.0, result); + + result = SDL_pow(0.0, 4.0); + SDLTest_AssertCheck(0.0 == result, + "Pow(%f,%f), expected %f, got %f", + 0.0, 4.0, 0.0, result); + + return TEST_COMPLETED; +} + +/* Remaining tests */ + +/** + * Inputs: values within the domain of the function. + * Expected: the correct result is returned. + */ +static int +pow_regularCases(void *args) +{ + const dd_to_d regular_cases[] = { + { -391.25, -2.0, 0.00000653267870448815438463212659780943170062528224661946296691894531250 }, + { -72.3, 12.0, 20401381050275984310272.0 }, + { -5.0, 3.0, -125.0 }, + { 3.0, 2.5, 15.58845726811989607085706666111946105957031250 }, + { 39.23, -1.5, 0.0040697950366865498147972424192175822099670767784118652343750 }, + { 478.972, 12.125, 315326359630449587856007411793920.0 } + }; + return helper_ddtod("Pow", SDL_pow, regular_cases, SDL_arraysize(regular_cases)); +} + +/** + * Inputs: (2.0, x), with x in range [0, 8]. + * Expected: the correct result is returned. + */ +static int +pow_powerOfTwo(void *args) +{ + const dd_to_d power_of_two_cases[] = { + { 2.0, 1.0, 2.0 }, + { 2.0, 2.0, 4.0 }, + { 2.0, 3.0, 8.0 }, + { 2.0, 4.0, 16.0 }, + { 2.0, 5.0, 32.0 }, + { 2.0, 6.0, 64.0 }, + { 2.0, 7.0, 128.0 }, + { 2.0, 8.0, 256.0 }, + }; + return helper_ddtod("Pow", SDL_pow, power_of_two_cases, SDL_arraysize(power_of_two_cases)); +} + +/** + * Inputs: values in the range [0, UINT32_MAX] to the power of +/-0.0. + * Expected: 1.0 is always returned. + */ +static int +pow_rangeTest(void *args) +{ + Uint32 i; + double test_value = 0.0; + + SDLTest_AssertPass("Pow: Testing a range of %u values with steps of %u", + RANGE_TEST_ITERATIONS, + RANGE_TEST_STEP); + + for (i = 0; i < RANGE_TEST_ITERATIONS; i++, test_value += RANGE_TEST_STEP) { + double result; + /* These are tested elsewhere */ + if (isnan(test_value) || isinf(test_value)) { + continue; + } + + /* Only log failures to save performances */ + result = SDL_pow(test_value, 0.0); + if (result != 1.0) { + SDLTest_AssertCheck(SDL_FALSE, + "Pow(%.1f,%.1f), expected %.1f, got %.1f", + test_value, 1.0, 1.0, result); + return TEST_ABORTED; + } + + result = SDL_pow(test_value, -0.0); + if (result != 1.0) { + SDLTest_AssertCheck(SDL_FALSE, + "Pow(%.1f,%.1f), expected %.1f, got %.1f", + test_value, -0.0, 1.0, result); + return TEST_ABORTED; + } + } + return TEST_COMPLETED; +} + +/* SDL_sqrt tests functions */ + +/** + * Input: Positive Infinity. + * Expected: Positive Infinity is returned. + */ +static int +sqrt_infCase(void *args) +{ + const double result = SDL_sqrt(INFINITY); + SDLTest_AssertCheck(INFINITY == result, + "Sqrt(%f), expected %f, got %f", + INFINITY, INFINITY, result); + return TEST_COMPLETED; +} + +/** + * Input: NAN. + * Expected: NAN is returned. + */ +static int +sqrt_nanCase(void *args) +{ + const double result = SDL_sqrt(NAN); + SDLTest_AssertCheck(isnan(result), + "Sqrt(%f), expected %f, got %f", + NAN, NAN, result); + return TEST_COMPLETED; +} + +/** + * Inputs: values outside the domain of the function. + * Expected: NAN is returned. + */ +static int +sqrt_outOfDomainCases(void *args) +{ + double result; + + result = SDL_sqrt(-1.0); + SDLTest_AssertCheck(isnan(result), + "Sqrt(%f), expected %f, got %f", + -1.0, NAN, result); + + result = SDL_sqrt(-12345.6789); + SDLTest_AssertCheck(isnan(result), + "Sqrt(%f), expected %f, got %f", + -12345.6789, NAN, result); + + result = SDL_sqrt(-INFINITY); + SDLTest_AssertCheck(isnan(result), + "Sqrt(%f), expected %f, got %f", + -INFINITY, NAN, result); + + return TEST_COMPLETED; +} + +/** + * Inputs: +/-0.0 and 1.0. + * Expected: the input value is returned as-is. + */ +static int +sqrt_baseCases(void *args) +{ + const d_to_d base_cases[] = { + { -0.0, -0.0 }, + { 0.0, 0.0 }, + { 1.0, 1.0 } + }; + return helper_dtod("Sqrt", SDL_sqrt, base_cases, SDL_arraysize(base_cases)); +} + +/** + * Inputs: values within the domain of the function. + * Expected: the correct result is returned. + */ +static int +sqrt_regularCases(void *args) +{ + const d_to_d regular_cases[] = { + { 4.0, 2.0 }, + { 9.0, 3.0 }, + { 27.2, 5.21536192416211896727418206864967942237854003906250 }, + { 240.250, 15.5 }, + { 1337.0, 36.565010597564445049556525191292166709899902343750 }, + { 2887.12782400000014604302123188972473144531250, 53.732 }, + { 65600.0156250, 256.125 } + }; + return helper_dtod_inexact("Sqrt", SDL_sqrt, regular_cases, SDL_arraysize(regular_cases)); +} + +/* SDL_scalbn tests functions */ + +/** + * Input: (+/-Infinity, 1). + * Expected: Infinity is returned as-is. + */ +static int +scalbn_infCases(void *args) +{ + double result; + + result = SDL_scalbn(INFINITY, 1); + SDLTest_AssertCheck(INFINITY == result, + "Scalbn(%f,%d), expected %f, got %f", + INFINITY, 1, INFINITY, result); + + result = SDL_scalbn(-INFINITY, 1); + SDLTest_AssertCheck(-INFINITY == result, + "Scalbn(%f,%d), expected %f, got %f", + -INFINITY, 1, -INFINITY, result); + + return TEST_COMPLETED; +} + +/** + * Inputs: (+/-0.0, 1). + * Expected: Zero is returned as-is. + */ +static int +scalbn_baseZeroCases(void *args) +{ + double result; + + result = SDL_scalbn(0.0, 1); + SDLTest_AssertCheck(0.0 == result, + "Scalbn(%f,%d), expected %f, got %f", + 0.0, 1, 0.0, result); + + result = SDL_scalbn(-0.0, 1); + SDLTest_AssertCheck(-0.0 == result, + "Scalbn(%f,%d), expected %f, got %f", + -0.0, 1, -0.0, result); + + return TEST_COMPLETED; +} + +/** + * Input: (x, 0) + * Expected: x is returned as-is. + */ +static int +scalbn_expZeroCase(void *args) +{ + const double result = SDL_scalbn(42.0, 0); + SDLTest_AssertCheck(42.0 == result, + "Scalbn(%f,%d), expected %f, got %f", + 42.0, 0, 42.0, result); + return TEST_COMPLETED; +} + +/** + * Input: (NAN, x). + * Expected: NAN is returned. + */ +static int +scalbn_nanCase(void *args) +{ + const double result = SDL_scalbn(NAN, 2); + SDLTest_AssertCheck(isnan(result), + "Scalbn(%f,%d), expected %f, got %f", + NAN, 2, NAN, result); + return TEST_COMPLETED; +} + +/** + * Inputs: values inside the domain of the function. + * Expected: the correct result is returned. + * NOTE: This test depends on SDL_pow and FLT_RADIX. + */ +static int +scalbn_regularCases(void *args) +{ + double result, expected; + + result = SDL_scalbn(2.0, 2); + expected = 2.0 * SDL_pow(FLT_RADIX, 2); + SDLTest_AssertCheck(result == expected, + "Scalbn(%f,%d), expected %f, got %f", + 2.0, 2, expected, result); + + result = SDL_scalbn(1.0, 13); + expected = 1.0 * SDL_pow(FLT_RADIX, 13); + SDLTest_AssertCheck(result == expected, + "Scalbn(%f,%d), expected %f, got %f", + 1.0, 13, expected, result); + + result = SDL_scalbn(2.0, -5); + expected = 2.0 * SDL_pow(FLT_RADIX, -5); + SDLTest_AssertCheck(result == expected, + "Scalbn(%f,%d), expected %f, got %f", + 2.0, -5, expected, result); + + result = SDL_scalbn(-1.0, -13); + expected = -1.0 * SDL_pow(FLT_RADIX, -13); + SDLTest_AssertCheck(result == expected, + "Scalbn(%f,%d), expected %f, got %f", + -1.0, -13, expected, result); + + return TEST_COMPLETED; +} + +/* SDL_cos tests functions */ + +/** + * Inputs: +/-Infinity. + * Expected: NAN is returned. + */ +static int +cos_infCases(void *args) +{ + double result; + + result = SDL_cos(INFINITY); + SDLTest_AssertCheck(isnan(result), + "Cos(%f), expected %f, got %f", + INFINITY, NAN, result); + + result = SDL_cos(-INFINITY); + SDLTest_AssertCheck(isnan(result), + "Cos(%f), expected %f, got %f", + -INFINITY, NAN, result); + + return TEST_COMPLETED; +} + +/** + * Input: NAN. + * Expected: NAN is returned. + */ +static int +cos_nanCase(void *args) +{ + const double result = SDL_cos(NAN); + SDLTest_AssertCheck(isnan(result), + "Cos(%f), expected %f, got %f", + NAN, NAN, result); + return TEST_COMPLETED; +} + +/** + * Inputs: +/-0.0 and +/-Pi. + * Expected: +1.0 and -1.0 respectively. + */ +static int +cos_regularCases(void *args) +{ + const d_to_d regular_cases[] = { + { -M_PI, -1.0 }, + { -0.0, 1.0 }, + { 0.0, 1.0 }, + { M_PI, -1.0 } + }; + return helper_dtod("Cos", SDL_cos, regular_cases, SDL_arraysize(regular_cases)); +} + +/** + * Inputs: Angles between 1/10 and 9/10 of Pi (positive and negative). + * Expected: The correct result is returned (+/-EPSILON). + */ +static int +cos_precisionTest(void *args) +{ + const d_to_d precision_cases[] = { + { M_PI * 1.0 / 10.0, 0.9510565162 }, + { M_PI * 2.0 / 10.0, 0.8090169943 }, + { M_PI * 3.0 / 10.0, 0.5877852522 }, + { M_PI * 4.0 / 10.0, 0.3090169943 }, + { M_PI * 5.0 / 10.0, 0.0 }, + { M_PI * 6.0 / 10.0, -0.3090169943 }, + { M_PI * 7.0 / 10.0, -0.5877852522 }, + { M_PI * 8.0 / 10.0, -0.8090169943 }, + { M_PI * 9.0 / 10.0, -0.9510565162 }, + { M_PI * -1.0 / 10.0, 0.9510565162 }, + { M_PI * -2.0 / 10.0, 0.8090169943 }, + { M_PI * -3.0 / 10.0, 0.5877852522 }, + { M_PI * -4.0 / 10.0, 0.3090169943 }, + { M_PI * -5.0 / 10.0, 0.0 }, + { M_PI * -6.0 / 10.0, -0.3090169943 }, + { M_PI * -7.0 / 10.0, -0.5877852522 }, + { M_PI * -8.0 / 10.0, -0.8090169943 }, + { M_PI * -9.0 / 10.0, -0.9510565162 } + }; + return helper_dtod_inexact("Cos", SDL_cos, precision_cases, SDL_arraysize(precision_cases)); +} + +/** + * Inputs: Values in the range [0, UINT32_MAX]. + * Expected: A value between 0 and 1 is returned. + */ +static int +cos_rangeTest(void *args) +{ + Uint32 i; + double test_value = 0.0; + + SDLTest_AssertPass("Cos: Testing a range of %u values with steps of %u", + RANGE_TEST_ITERATIONS, + RANGE_TEST_STEP); + + for (i = 0; i < RANGE_TEST_ITERATIONS; i++, test_value += RANGE_TEST_STEP) { + double result; + /* These are tested elsewhere */ + if (isnan(test_value) || isinf(test_value)) { + continue; + } + + /* Only log failures to save performances */ + result = SDL_cos(test_value); + if (result < -1.0 || result > 1.0) { + SDLTest_AssertCheck(SDL_FALSE, + "Cos(%.1f), expected [%.1f,%.1f], got %.1f", + test_value, -1.0, 1.0, result); + return TEST_ABORTED; + } + } + return TEST_COMPLETED; +} + +/* SDL_sin tests functions */ + +/** + * Inputs: +/-Infinity. + * Expected: NAN is returned. + */ +static int +sin_infCases(void *args) +{ + double result; + + result = SDL_sin(INFINITY); + SDLTest_AssertCheck(isnan(result), + "Sin(%f), expected %f, got %f", + INFINITY, NAN, result); + + result = SDL_sin(-INFINITY); + SDLTest_AssertCheck(isnan(result), + "Sin(%f), expected %f, got %f", + -INFINITY, NAN, result); + + return TEST_COMPLETED; +} + +/** + * Input: NAN. + * Expected: NAN is returned. + */ +static int +sin_nanCase(void *args) +{ + const double result = SDL_sin(NAN); + SDLTest_AssertCheck(isnan(result), + "Sin(%f), expected %f, got %f", + NAN, NAN, result); + return TEST_COMPLETED; +} + +/** + * Inputs: +/-0.0 and +/-Pi/2. + * Expected: +/-0.0 and +/-1.0 respectively. + */ +static int +sin_regularCases(void *args) +{ + const d_to_d regular_cases[] = { + { -M_PI / 2, -1.0 }, + { -0.0, -0.0 }, + { 0.0, 0.0 }, + { M_PI / 2, 1.0 } + }; + return helper_dtod("Sin", SDL_sin, regular_cases, SDL_arraysize(regular_cases)); +} + +/** + * Inputs: Angles between 1/10 and 10/10 of Pi (positive and negative). + * Expected: The correct result is returned (+/-EPSILON). + * NOTE: +/-Pi/2 is tested in the regular cases. + */ +static int +sin_precisionTest(void *args) +{ + const d_to_d precision_cases[] = { + { M_PI * 1.0 / 10.0, 0.3090169943 }, + { M_PI * 2.0 / 10.0, 0.5877852522 }, + { M_PI * 3.0 / 10.0, 0.8090169943 }, + { M_PI * 4.0 / 10.0, 0.9510565162 }, + { M_PI * 6.0 / 10.0, 0.9510565162 }, + { M_PI * 7.0 / 10.0, 0.8090169943 }, + { M_PI * 8.0 / 10.0, 0.5877852522 }, + { M_PI * 9.0 / 10.0, 0.3090169943 }, + { M_PI, 0.0 }, + { M_PI * -1.0 / 10.0, -0.3090169943 }, + { M_PI * -2.0 / 10.0, -0.5877852522 }, + { M_PI * -3.0 / 10.0, -0.8090169943 }, + { M_PI * -4.0 / 10.0, -0.9510565162 }, + { M_PI * -6.0 / 10.0, -0.9510565162 }, + { M_PI * -7.0 / 10.0, -0.8090169943 }, + { M_PI * -8.0 / 10.0, -0.5877852522 }, + { M_PI * -9.0 / 10.0, -0.3090169943 }, + { -M_PI, 0.0 }, + }; + return helper_dtod_inexact("Sin", SDL_sin, precision_cases, SDL_arraysize(precision_cases)); +} + +/** + * Inputs: Values in the range [0, UINT32_MAX]. + * Expected: A value between 0 and 1 is returned. + */ +static int +sin_rangeTest(void *args) +{ + Uint32 i; + double test_value = 0.0; + + SDLTest_AssertPass("Sin: Testing a range of %u values with steps of %u", + RANGE_TEST_ITERATIONS, + RANGE_TEST_STEP); + + for (i = 0; i < RANGE_TEST_ITERATIONS; i++, test_value += RANGE_TEST_STEP) { + double result; + /* These are tested elsewhere */ + if (isnan(test_value) || isinf(test_value)) { + continue; + } + + /* Only log failures to save performances */ + result = SDL_sin(test_value); + if (result < -1.0 || result > 1.0) { + SDLTest_AssertCheck(SDL_FALSE, + "Sin(%.1f), expected [%.1f,%.1f], got %.1f", + test_value, -1.0, 1.0, result); + return TEST_ABORTED; + } + } + return TEST_COMPLETED; +} + +/* SDL_tan tests functions */ + +/** + * Inputs: +/-Infinity. + * Expected: NAN is returned. + */ +static int +tan_infCases(void *args) +{ + double result; + + result = SDL_tan(INFINITY); + SDLTest_AssertCheck(isnan(result), + "Tan(%f), expected %f, got %f", + INFINITY, NAN, result); + + result = SDL_tan(-INFINITY); + SDLTest_AssertCheck(isnan(result), + "Tan(%f), expected %f, got %f", + -INFINITY, NAN, result); + + return TEST_COMPLETED; +} + +/** + * Input: NAN. + * Expected: NAN is returned. + */ +static int +tan_nanCase(void *args) +{ + const double result = SDL_tan(NAN); + SDLTest_AssertCheck(isnan(result), + "Tan(%f), expected %f, got %f", + NAN, NAN, result); + return TEST_COMPLETED; +} + +/** + * Inputs: +/-0.0. + * Expected: Zero is returned as-is. + */ +static int +tan_zeroCases(void *args) +{ + const d_to_d regular_cases[] = { + { -0.0, -0.0 }, + { 0.0, 0.0 } + }; + return helper_dtod("Tan", SDL_tan, regular_cases, SDL_arraysize(regular_cases)); +} + +/** + * Inputs: Angles between 1/11 and 10/11 of Pi (positive and negative). + * Expected: The correct result is returned (+/-EPSILON). + * NOTE: +/-Pi/2 is intentionally avoided as it returns garbage values. + */ +static int +tan_precisionTest(void *args) +{ + const d_to_d precision_cases[] = { + { M_PI * 1.0 / 11.0, 0.2936264929 }, + { M_PI * 2.0 / 11.0, 0.6426609771 }, + { M_PI * 3.0 / 11.0, 1.1540615205 }, + { M_PI * 4.0 / 11.0, 2.1896945629 }, + { M_PI * 5.0 / 11.0, 6.9551527717 }, + { M_PI * 6.0 / 11.0, -6.9551527717 }, + { M_PI * 7.0 / 11.0, -2.1896945629 }, + { M_PI * 8.0 / 11.0, -1.1540615205 }, + { M_PI * 9.0 / 11.0, -0.6426609771 }, + { M_PI * 10.0 / 11.0, -0.2936264929 }, + { M_PI * -1.0 / 11.0, -0.2936264929 }, + { M_PI * -2.0 / 11.0, -0.6426609771 }, + { M_PI * -3.0 / 11.0, -1.1540615205 }, + { M_PI * -4.0 / 11.0, -2.1896945629 }, + { M_PI * -5.0 / 11.0, -6.9551527717 }, + { M_PI * -6.0 / 11.0, 6.9551527717 }, + { M_PI * -7.0 / 11.0, 2.1896945629 }, + { M_PI * -8.0 / 11.0, 1.1540615205 }, + { M_PI * -9.0 / 11.0, 0.6426609771 }, + { M_PI * -10.0 / 11.0, 0.2936264929 } + }; + return helper_dtod_inexact("Tan", SDL_tan, precision_cases, SDL_arraysize(precision_cases)); +} + +/* SDL_acos tests functions */ + +/** + * Inputs: +/-1.0. + * Expected: 0.0 and Pi respectively. + */ +static int +acos_limitCases(void *args) +{ + double result; + + result = SDL_acos(1.0); + SDLTest_AssertCheck(0.0 == result, + "Acos(%f), expected %f, got %f", + 1.0, 0.0, result); + + result = SDL_acos(-1.0); + SDLTest_AssertCheck(M_PI == result, + "Acos(%f), expected %f, got %f", + -1.0, M_PI, result); + + return TEST_COMPLETED; +} + +/** + * Inputs: Values outside the domain of [-1, 1]. + * Expected: NAN is returned. + */ +static int +acos_outOfDomainCases(void *args) +{ + double result; + + result = SDL_acos(1.1); + SDLTest_AssertCheck(isnan(result), + "Acos(%f), expected %f, got %f", + 1.1, NAN, result); + + result = SDL_acos(-1.1); + SDLTest_AssertCheck(isnan(result), + "Acos(%f), expected %f, got %f", + -1.1, NAN, result); + + return TEST_COMPLETED; +} + +/** + * Input: NAN. + * Expected: NAN is returned. + */ +static int +acos_nanCase(void *args) +{ + const double result = SDL_acos(NAN); + SDLTest_AssertCheck(isnan(result), + "Acos(%f), expected %f, got %f", + NAN, NAN, result); + return TEST_COMPLETED; +} + +/** + * Inputs: Values between -0.9 and 0.9 with steps of 0.1. + * Expected: The correct result is returned (+/-EPSILON). + */ +static int +acos_precisionTest(void *args) +{ + const d_to_d precision_cases[] = { + { 0.9, 0.4510268117 }, + { 0.8, 0.6435011087 }, + { 0.7, 0.7953988301 }, + { 0.6, 0.9272952180 }, + { 0.5, 1.0471975511 }, + { 0.4, 1.1592794807 }, + { 0.3, 1.2661036727 }, + { 0.2, 1.3694384060 }, + { 0.1, 1.4706289056 }, + { 0.0, 1.5707963267 }, + { -0.0, 1.5707963267 }, + { -0.1, 1.6709637479 }, + { -0.2, 1.7721542475 }, + { -0.3, 1.8754889808 }, + { -0.4, 1.9823131728 }, + { -0.5, 2.0943951023 }, + { -0.6, 2.2142974355 }, + { -0.7, 2.3461938234 }, + { -0.8, 2.4980915447 }, + { -0.9, 2.6905658417 }, + }; + return helper_dtod_inexact("Acos", SDL_acos, precision_cases, SDL_arraysize(precision_cases)); +} + +/* SDL_asin tests functions */ + +/** + * Inputs: +/-1.0. + * Expected: +/-Pi/2 is returned. + */ +static int +asin_limitCases(void *args) +{ + double result; + + result = SDL_asin(1.0); + SDLTest_AssertCheck(M_PI / 2.0 == result, + "Asin(%f), expected %f, got %f", + 1.0, M_PI / 2.0, result); + + result = SDL_asin(-1.0); + SDLTest_AssertCheck(-M_PI / 2.0 == result, + "Asin(%f), expected %f, got %f", + -1.0, -M_PI / 2.0, result); + + return TEST_COMPLETED; +} + +/** + * Inputs: Values outside the domain of [-1, 1]. + * Expected: NAN is returned. + */ +static int +asin_outOfDomainCases(void *args) +{ + double result; + + result = SDL_asin(1.1); + SDLTest_AssertCheck(isnan(result), + "Asin(%f), expected %f, got %f", + 1.1, NAN, result); + + result = SDL_asin(-1.1); + SDLTest_AssertCheck(isnan(result), + "Asin(%f), expected %f, got %f", + -1.1, NAN, result); + + return TEST_COMPLETED; +} + +/** + * Input: NAN. + * Expected: NAN is returned. + */ +static int +asin_nanCase(void *args) +{ + const double result = SDL_asin(NAN); + SDLTest_AssertCheck(isnan(result), + "Asin(%f), expected %f, got %f", + NAN, NAN, result); + return TEST_COMPLETED; +} + +/** + * Inputs: Values between -0.9 and 0.9 with steps of 0.1. + * Expected: The correct result is returned (+/-EPSILON). + */ +static int +asin_precisionTest(void *args) +{ + const d_to_d precision_cases[] = { + { 0.9, 1.1197695149 }, + { 0.8, 0.9272952180 }, + { 0.7, 0.7753974966 }, + { 0.6, 0.6435011087 }, + { 0.5, 0.5235987755 }, + { 0.4, 0.4115168460 }, + { 0.3, 0.3046926540 }, + { 0.2, 0.2013579207 }, + { 0.1, 0.1001674211 }, + { 0.0, 0.0 }, + { -0.0, -0.0 }, + { -0.1, -0.1001674211 }, + { -0.2, -0.2013579207 }, + { -0.3, -0.3046926540 }, + { -0.4, -0.4115168460 }, + { -0.5, -0.5235987755 }, + { -0.6, -0.6435011087 }, + { -0.7, -0.7753974966 }, + { -0.8, -0.9272952180 }, + { -0.9, -1.1197695149 } + }; + return helper_dtod_inexact("Asin", SDL_asin, precision_cases, SDL_arraysize(precision_cases)); +} + +/* SDL_atan tests functions */ + +/** + * Inputs: +/-Infinity. + * Expected: +/-Pi/2 is returned. + */ +static int +atan_limitCases(void *args) +{ + double result; + + result = SDL_atan(INFINITY); + SDLTest_AssertCheck((M_PI / 2.0) - EPSILON <= result && + result <= (M_PI / 2.0) + EPSILON, + "Atan(%f), expected %f, got %f", + INFINITY, M_PI / 2.0, result); + + result = SDL_atan(-INFINITY); + SDLTest_AssertCheck((-M_PI / 2.0) - EPSILON <= result && + result <= (-M_PI / 2.0) + EPSILON, + "Atan(%f), expected %f, got %f", + -INFINITY, -M_PI / 2.0, result); + + return TEST_COMPLETED; +} + +/** + * Inputs: +/-0.0. + * Expected: Zero is returned as-is. + */ +static int +atan_zeroCases(void *args) +{ + double result; + + result = SDL_atan(0.0); + SDLTest_AssertCheck(0.0 == result, + "Atan(%f), expected %f, got %f", + 0.0, 0.0, result); + + result = SDL_atan(-0.0); + SDLTest_AssertCheck(-0.0 == result, + "Atan(%f), expected %f, got %f", + -0.0, -0.0, result); + + return TEST_COMPLETED; +} + +/** + * Input: NAN. + * Expected: NAN is returned. + */ +static int +atan_nanCase(void *args) +{ + const double result = SDL_atan(NAN); + SDLTest_AssertCheck(isnan(result), + "Atan(%f), expected %f, got %f", + NAN, NAN, result); + return TEST_COMPLETED; +} + +/** + * Inputs: Values corresponding to angles between 9Pi/20 and -9Pi/20 with steps of Pi/20. + * Expected: The correct result is returned (+/-EPSILON). + */ +static int +atan_precisionTest(void *args) +{ + const d_to_d precision_cases[] = { + { 6.313751514675041, 1.4137166941 }, + { 3.0776835371752527, 1.2566370614 }, + { 1.9626105055051504, 1.0995574287 }, + { 1.3763819204711734, 0.9424777960 }, + { 1.0, 0.7853981633 }, + { 0.7265425280053609, 0.6283185307 }, + { 0.5095254494944288, 0.4712388980 }, + { 0.3249196962329063, 0.3141592653 }, + { 0.15838444032453627, 0.1570796326 }, + { -0.15838444032453627, -0.1570796326 }, + { -0.3249196962329063, -0.3141592653 }, + { -0.5095254494944288, -0.4712388980 }, + { -0.7265425280053609, -0.6283185307 }, + { -1.0, -0.7853981633 }, + { -1.3763819204711734, -0.9424777960 }, + { -1.9626105055051504, -1.0995574287 }, + { -3.0776835371752527, -1.2566370614 }, + { -6.313751514675041, -1.4137166941 }, + }; + return helper_dtod_inexact("Atan", SDL_atan, precision_cases, SDL_arraysize(precision_cases)); +} + +/* SDL_atan2 tests functions */ + +/* Zero cases */ + +/** + * Inputs: (+/-0.0, +/-0.0). + * Expected: + * - Zero if the second argument is positive zero. + * - Pi if the second argument is negative zero. + * - The sign is inherited from the first argument. + */ +static int +atan2_bothZeroCases(void *args) +{ + const dd_to_d cases[] = { + { 0.0, 0.0, 0.0 }, + { -0.0, 0.0, -0.0 }, + { 0.0, -0.0, M_PI }, + { -0.0, -0.0, -M_PI }, + }; + return helper_ddtod("SDL_atan2", SDL_atan2, cases, SDL_arraysize(cases)); +} + +/** + * Inputs: (+/-0.0, +/-1.0). + * Expected: + * - Zero if the second argument is positive. + * - Pi if the second argument is negative. + * - The sign is inherited from the first argument. + */ +static int +atan2_yZeroCases(void *args) +{ + const dd_to_d cases[] = { + { 0.0, 1.0, 0.0 }, + { 0.0, -1.0, M_PI }, + { -0.0, 1.0, -0.0 }, + { -0.0, -1.0, -M_PI } + }; + return helper_ddtod("SDL_atan2", SDL_atan2, cases, SDL_arraysize(cases)); +} + +/** + * Inputs: (+/-1.0, +/-0.0). + * Expected: Pi/2 with the sign of the first argument. + */ +static int +atan2_xZeroCases(void *args) +{ + const dd_to_d cases[] = { + { 1.0, 0.0, M_PI / 2.0 }, + { -1.0, 0.0, -M_PI / 2.0 }, + { 1.0, -0.0, M_PI / 2.0 }, + { -1.0, -0.0, -M_PI / 2.0 } + }; + return helper_ddtod("SDL_atan2", SDL_atan2, cases, SDL_arraysize(cases)); +} + +/* Infinity cases */ + +/** + * Inputs: (+/-Infinity, +/-Infinity). + * Expected: + * - (+int, +inf) -> Pi/4, + * - (+int, -inf) -> 3Pi/4, + * - (-int, +inf) -> -Pi/4, + * - (-int, -inf) -> Pi. + */ +static int +atan2_bothInfCases(void *args) +{ + double result; + + result = SDL_atan2(INFINITY, INFINITY); + SDLTest_AssertCheck(M_PI / 4.0 == result, + "Atan2(%f,%f), expected %f, got %f", + INFINITY, INFINITY, M_PI / 4.0, result); + + result = SDL_atan2(INFINITY, -INFINITY); + SDLTest_AssertCheck(3.0 * M_PI / 4.0 == result, + "Atan2(%f,%f), expected %f, got %f", + INFINITY, -INFINITY, 3.0 * M_PI / 4.0, result); + + result = SDL_atan2(-INFINITY, INFINITY); + SDLTest_AssertCheck(-M_PI / 4.0 == result, + "Atan2(%f,%f), expected %f, got %f", + -INFINITY, INFINITY, -M_PI / 4.0, result); + + result = SDL_atan2(-INFINITY, -INFINITY); + SDLTest_AssertCheck(-3.0 * M_PI / 4.0 == result, + "Atan2(%f,%f), expected %f, got %f", + -INFINITY, -INFINITY, -3.0 * M_PI / 4.0, result); + + return TEST_COMPLETED; +} + +/** + * Inputs: (+/-Infinity, +/-1.0). + * Expected: Pi/2 with the sign of the first argument. + */ +static int +atan2_yInfCases(void *args) +{ + double result; + + result = SDL_atan2(INFINITY, 1.0); + SDLTest_AssertCheck(M_PI / 2.0 == result, + "Atan2(%f,%f), expected %f, got %f", + INFINITY, 1.0, M_PI / 2.0, result); + + result = SDL_atan2(INFINITY, -1.0); + SDLTest_AssertCheck(M_PI / 2.0 == result, + "Atan2(%f,%f), expected %f, got %f", + INFINITY, -1.0, M_PI / 2.0, result); + + result = SDL_atan2(-INFINITY, 1.0); + SDLTest_AssertCheck(-M_PI / 2.0 == result, + "Atan2(%f,%f), expected %f, got %f", + -INFINITY, 1.0, -M_PI / 2.0, result); + + result = SDL_atan2(-INFINITY, -1.0); + SDLTest_AssertCheck(-M_PI / 2.0 == result, + "Atan2(%f,%f), expected %f, got %f", + -INFINITY, -1.0, -M_PI / 2.0, result); + + return TEST_COMPLETED; +} + +/** + * Inputs: (+/-1.0, +/-Infinity). + * Expected: + * - (+/-1.0, +inf) -> +/-0.0 + * - (+/-1.0, -inf) -> +/-Pi. + */ +static int +atan2_xInfCases(void *args) +{ + double result; + + result = SDL_atan2(1.0, INFINITY); + SDLTest_AssertCheck(0.0 == result, + "Atan2(%f,%f), expected %f, got %f", + 1.0, INFINITY, 0.0, result); + + result = SDL_atan2(-1.0, INFINITY); + SDLTest_AssertCheck(-0.0 == result, + "Atan2(%f,%f), expected %f, got %f", + -1.0, INFINITY, -0.0, result); + + result = SDL_atan2(1.0, -INFINITY); + SDLTest_AssertCheck(M_PI == result, + "Atan2(%f,%f), expected %f, got %f", + 1.0, -INFINITY, M_PI, result); + + result = SDL_atan2(-1.0, -INFINITY); + SDLTest_AssertCheck(-M_PI == result, + "Atan2(%f,%f), expected %f, got %f", + -1.0, -INFINITY, -M_PI, result); + + return TEST_COMPLETED; +} + +/* Miscelanious cases */ + +/** + * Inputs: NAN as either or both of the arguments. + * Expected: NAN is returned. + */ +static int +atan2_nanCases(void *args) +{ + double result; + + result = SDL_atan2(NAN, NAN); + SDLTest_AssertCheck(isnan(result), + "Atan2(%f,%f), expected %f, got %f", + NAN, NAN, NAN, result); + + result = SDL_atan2(NAN, 1.0); + SDLTest_AssertCheck(isnan(result), + "Atan2(%f,%f), expected %f, got %f", + NAN, 1.0, NAN, result); + + result = SDL_atan2(1.0, NAN); + SDLTest_AssertCheck(isnan(result), + "Atan2(%f,%f), expected %f, got %f", + 1.0, NAN, NAN, result); + + return TEST_COMPLETED; +} + +/** + * Inputs: (y, x) with x and y positive. + * Expected: Angle in the top right quadrant. + */ +static int +atan2_topRightQuadrantTest(void *args) +{ + const dd_to_d top_right_cases[] = { + { 1.0, 1.0, M_PI / 4.0 }, + { SQRT3, 3.0, M_PI / 6.0 }, + { SQRT3, 1.0, M_PI / 3.0 } + }; + return helper_ddtod_inexact("SDL_atan2", SDL_atan2, top_right_cases, SDL_arraysize(top_right_cases)); +} + +/** + * Inputs: (y, x) with x negative and y positive. + * Expected: Angle in the top left quadrant. + */ +static int +atan2_topLeftQuadrantTest(void *args) +{ + const dd_to_d top_left_cases[] = { + { 1.0, -1.0, 3.0 * M_PI / 4.0 }, + { SQRT3, -3.0, 5.0 * M_PI / 6.0 }, + { SQRT3, -1.0, 2.0 * M_PI / 3.0 } + }; + return helper_ddtod_inexact("SDL_atan2", SDL_atan2, top_left_cases, SDL_arraysize(top_left_cases)); +} + +/** + * Inputs: (y, x) with x positive and y negative. + * Expected: Angle in the bottom right quadrant. + */ +static int +atan2_bottomRightQuadrantTest(void *args) +{ + const dd_to_d bottom_right_cases[] = { + { -1.0, 1.0, -M_PI / 4 }, + { -SQRT3, 3.0, -M_PI / 6.0 }, + { -SQRT3, 1.0, -M_PI / 3.0 } + }; + return helper_ddtod_inexact("SDL_atan2", SDL_atan2, bottom_right_cases, SDL_arraysize(bottom_right_cases)); +} + +/** + * Inputs: (y, x) with x and y negative. + * Expected: Angle in the bottom left quadrant. + */ +static int +atan2_bottomLeftQuadrantTest(void *args) +{ + const dd_to_d bottom_left_cases[] = { + { -1.0, -1.0, -3.0 * M_PI / 4.0 }, + { -SQRT3, -3.0, -5.0 * M_PI / 6.0 }, + { -SQRT3, -1.0, -4.0 * M_PI / 6.0 } + }; + return helper_ddtod_inexact("SDL_atan2", SDL_atan2, bottom_left_cases, SDL_arraysize(bottom_left_cases)); +} + +/* ================= Test References ================== */ + +/* SDL_floor test cases */ + +static const SDLTest_TestCaseReference floorTestInf = { + (SDLTest_TestCaseFp) floor_infCases, "floor_infCases", + "Checks positive and negative infinity", TEST_ENABLED +}; +static const SDLTest_TestCaseReference floorTestZero = { + (SDLTest_TestCaseFp) floor_zeroCases, "floor_zeroCases", + "Checks positive and negative zero", TEST_ENABLED +}; +static const SDLTest_TestCaseReference floorTestNan = { + (SDLTest_TestCaseFp) floor_nanCase, "floor_nanCase", + "Checks NAN", TEST_ENABLED +}; +static const SDLTest_TestCaseReference floorTestRound = { + (SDLTest_TestCaseFp) floor_roundNumbersCases, "floor_roundNumberCases", + "Checks a set of integral values", TEST_ENABLED +}; +static const SDLTest_TestCaseReference floorTestFraction = { + (SDLTest_TestCaseFp) floor_fractionCases, "floor_fractionCases", + "Checks a set of fractions", TEST_ENABLED +}; +static const SDLTest_TestCaseReference floorTestRange = { + (SDLTest_TestCaseFp) floor_rangeTest, "floor_rangeTest", + "Checks a range of positive integer", TEST_ENABLED +}; + +/* SDL_ceil test cases */ + +static const SDLTest_TestCaseReference ceilTestInf = { + (SDLTest_TestCaseFp) ceil_infCases, "ceil_infCases", + "Checks positive and negative infinity", TEST_ENABLED +}; +static const SDLTest_TestCaseReference ceilTestZero = { + (SDLTest_TestCaseFp) ceil_zeroCases, "ceil_zeroCases", + "Checks positive and negative zero", TEST_ENABLED +}; +static const SDLTest_TestCaseReference ceilTestNan = { + (SDLTest_TestCaseFp) ceil_nanCase, "ceil_nanCase", + "Checks NAN", TEST_ENABLED +}; +static const SDLTest_TestCaseReference ceilTestRound = { + (SDLTest_TestCaseFp) ceil_roundNumbersCases, "ceil_roundNumberCases", + "Checks a set of integral values", TEST_ENABLED +}; +static const SDLTest_TestCaseReference ceilTestFraction = { + (SDLTest_TestCaseFp) ceil_fractionCases, "ceil_fractionCases", + "Checks a set of fractions", TEST_ENABLED +}; +static const SDLTest_TestCaseReference ceilTestRange = { + (SDLTest_TestCaseFp) ceil_rangeTest, "ceil_rangeTest", + "Checks a range of positive integer", TEST_ENABLED +}; + +/* SDL_trunc test cases */ + +static const SDLTest_TestCaseReference truncTestInf = { + (SDLTest_TestCaseFp) trunc_infCases, "trunc_infCases", + "Checks positive and negative infinity", TEST_ENABLED +}; +static const SDLTest_TestCaseReference truncTestZero = { + (SDLTest_TestCaseFp) trunc_zeroCases, "trunc_zeroCases", + "Checks positive and negative zero", TEST_ENABLED +}; +static const SDLTest_TestCaseReference truncTestNan = { + (SDLTest_TestCaseFp) trunc_nanCase, "trunc_nanCase", + "Checks NAN", TEST_ENABLED +}; +static const SDLTest_TestCaseReference truncTestRound = { + (SDLTest_TestCaseFp) trunc_roundNumbersCases, "trunc_roundNumberCases", + "Checks a set of integral values", TEST_ENABLED +}; +static const SDLTest_TestCaseReference truncTestFraction = { + (SDLTest_TestCaseFp) trunc_fractionCases, "trunc_fractionCases", + "Checks a set of fractions", TEST_ENABLED +}; +static const SDLTest_TestCaseReference truncTestRange = { + (SDLTest_TestCaseFp) trunc_rangeTest, "trunc_rangeTest", + "Checks a range of positive integer", TEST_ENABLED +}; + +/* SDL_round test cases */ + +static const SDLTest_TestCaseReference roundTestInf = { + (SDLTest_TestCaseFp) round_infCases, "round_infCases", + "Checks positive and negative infinity", TEST_ENABLED +}; +static const SDLTest_TestCaseReference roundTestZero = { + (SDLTest_TestCaseFp) round_zeroCases, "round_zeroCases", + "Checks positive and negative zero", TEST_ENABLED +}; +static const SDLTest_TestCaseReference roundTestNan = { + (SDLTest_TestCaseFp) round_nanCase, "round_nanCase", + "Checks NAN", TEST_ENABLED +}; +static const SDLTest_TestCaseReference roundTestRound = { + (SDLTest_TestCaseFp) round_roundNumbersCases, "round_roundNumberCases", + "Checks a set of integral values", TEST_ENABLED +}; +static const SDLTest_TestCaseReference roundTestFraction = { + (SDLTest_TestCaseFp) round_fractionCases, "round_fractionCases", + "Checks a set of fractions", TEST_ENABLED +}; +static const SDLTest_TestCaseReference roundTestRange = { + (SDLTest_TestCaseFp) round_rangeTest, "round_rangeTest", + "Checks a range of positive integer", TEST_ENABLED +}; + +/* SDL_fabs test cases */ + +static const SDLTest_TestCaseReference fabsTestInf = { + (SDLTest_TestCaseFp) fabs_infCases, "fabs_infCases", + "Checks positive and negative infinity", TEST_ENABLED +}; +static const SDLTest_TestCaseReference fabsTestZero = { + (SDLTest_TestCaseFp) fabs_zeroCases, "fabs_zeroCases", + "Checks positive and negative zero", TEST_ENABLED +}; +static const SDLTest_TestCaseReference fabsTestNan = { + (SDLTest_TestCaseFp) fabs_nanCase, "fabs_nanCase", + "Checks NAN", TEST_ENABLED +}; +static const SDLTest_TestCaseReference fabsTestRange = { + (SDLTest_TestCaseFp) fabs_rangeTest, "fabs_rangeTest", + "Checks a range of positive integer", TEST_ENABLED +}; + +/* SDL_copysign test cases */ + +static const SDLTest_TestCaseReference copysignTestInf = { + (SDLTest_TestCaseFp) copysign_infCases, "copysign_infCases", + "Checks positive and negative infinity", TEST_ENABLED +}; +static const SDLTest_TestCaseReference copysignTestZero = { + (SDLTest_TestCaseFp) copysign_zeroCases, "copysign_zeroCases", + "Checks positive and negative zero", TEST_ENABLED +}; +static const SDLTest_TestCaseReference copysignTestNan = { + (SDLTest_TestCaseFp) copysign_nanCases, "copysign_nanCases", + "Checks NANs", TEST_ENABLED +}; +static const SDLTest_TestCaseReference copysignTestRange = { + (SDLTest_TestCaseFp) copysign_rangeTest, "copysign_rangeTest", + "Checks a range of positive integer", TEST_ENABLED +}; + +/* SDL_fmod test cases */ + +static const SDLTest_TestCaseReference fmodTestDivOfInf = { + (SDLTest_TestCaseFp) fmod_divOfInfCases, "fmod_divOfInfCases", + "Checks division of positive and negative infinity", TEST_ENABLED +}; +static const SDLTest_TestCaseReference fmodTestDivByInf = { + (SDLTest_TestCaseFp) fmod_divByInfCases, "fmod_divByInfCases", + "Checks division by positive and negative infinity", TEST_ENABLED +}; +static const SDLTest_TestCaseReference fmodTestDivOfZero = { + (SDLTest_TestCaseFp) fmod_divOfZeroCases, "fmod_divOfZeroCases", + "Checks division of positive and negative zero", TEST_ENABLED +}; +static const SDLTest_TestCaseReference fmodTestDivByZero = { + (SDLTest_TestCaseFp) fmod_divByZeroCases, "fmod_divByZeroCases", + "Checks division by positive and negative zero", TEST_ENABLED +}; +static const SDLTest_TestCaseReference fmodTestNan = { + (SDLTest_TestCaseFp) fmod_nanCases, "fmod_nanCases", + "Checks NANs", TEST_ENABLED +}; +static const SDLTest_TestCaseReference fmodTestRegular = { + (SDLTest_TestCaseFp) fmod_regularCases, "fmod_regularCases", + "Checks a set of regular values", TEST_ENABLED +}; +static const SDLTest_TestCaseReference fmodTestRange = { + (SDLTest_TestCaseFp) fmod_rangeTest, "fmod_rangeTest", + "Checks a range of positive integer", TEST_ENABLED +}; + +/* SDL_exp test cases */ + +static const SDLTest_TestCaseReference expTestInf = { + (SDLTest_TestCaseFp) exp_infCases, "exp_infCases", + "Checks positive and negative infinity", TEST_ENABLED +}; +static const SDLTest_TestCaseReference expTestZero = { + (SDLTest_TestCaseFp) exp_zeroCases, "exp_zeroCases", + "Checks for positive and negative zero", TEST_ENABLED +}; +static const SDLTest_TestCaseReference expTestOverflow = { + (SDLTest_TestCaseFp) exp_overflowCase, "exp_overflowCase", + "Checks for overflow", TEST_ENABLED +}; +static const SDLTest_TestCaseReference expTestBase = { + (SDLTest_TestCaseFp) exp_baseCase, "exp_baseCase", + "Checks the base case", TEST_ENABLED +}; +static const SDLTest_TestCaseReference expTestRegular = { + (SDLTest_TestCaseFp) exp_regularCases, "exp_regularCases", + "Checks a set of regular values", TEST_ENABLED +}; + +/* SDL_log test cases */ + +static const SDLTest_TestCaseReference logTestLimit = { + (SDLTest_TestCaseFp) log_limitCases, "log_limitCases", + "Checks the domain limits", TEST_ENABLED +}; +static const SDLTest_TestCaseReference logTestNan = { + (SDLTest_TestCaseFp) log_nanCases, "log_nanCases", + "Checks NAN and negative values", TEST_ENABLED +}; +static const SDLTest_TestCaseReference logTestBase = { + (SDLTest_TestCaseFp) log_baseCases, "log_baseCases", + "Checks the base cases", TEST_ENABLED +}; +static const SDLTest_TestCaseReference logTestRegular = { + (SDLTest_TestCaseFp) log_regularCases, "log_regularCases", + "Checks a set of regular values", TEST_ENABLED +}; + +/* SDL_log10 test cases */ + +static const SDLTest_TestCaseReference log10TestLimit = { + (SDLTest_TestCaseFp) log10_limitCases, "log10_limitCases", + "Checks the domain limits", TEST_ENABLED +}; +static const SDLTest_TestCaseReference log10TestNan = { + (SDLTest_TestCaseFp) log10_nanCases, "log10_nanCases", + "Checks NAN and negative values", TEST_ENABLED +}; +static const SDLTest_TestCaseReference log10TestBase = { + (SDLTest_TestCaseFp) log10_baseCases, "log10_baseCases", + "Checks the base cases", TEST_ENABLED +}; +static const SDLTest_TestCaseReference log10TestRegular = { + (SDLTest_TestCaseFp) log10_regularCases, "log10_regularCases", + "Checks a set of regular values", TEST_ENABLED +}; + +/* SDL_pow test cases */ + +static const SDLTest_TestCaseReference powTestExpInf1 = { + (SDLTest_TestCaseFp) pow_baseNOneExpInfCases, "pow_baseNOneExpInfCases", + "Checks for pow(-1, +/-inf)", TEST_ENABLED +}; +static const SDLTest_TestCaseReference powTestExpInf2 = { + (SDLTest_TestCaseFp) pow_baseZeroExpNInfCases, "pow_baseZeroExpNInfCases", + "Checks for pow(+/-0, -inf)", TEST_ENABLED +}; +static const SDLTest_TestCaseReference powTestExpInf3 = { + (SDLTest_TestCaseFp) pow_expInfCases, "pow_expInfCases", + "Checks for pow(x, +/-inf)", TEST_ENABLED +}; +static const SDLTest_TestCaseReference powTestBaseInf1 = { + (SDLTest_TestCaseFp) pow_basePInfCases, "pow_basePInfCases", + "Checks for pow(inf, x)", TEST_ENABLED +}; +static const SDLTest_TestCaseReference powTestBaseInf2 = { + (SDLTest_TestCaseFp) pow_baseNInfCases, "pow_baseNInfCases", + "Checks for pow(-inf, x)", TEST_ENABLED +}; +static const SDLTest_TestCaseReference powTestNan1 = { + (SDLTest_TestCaseFp) pow_badOperationCase, "pow_badOperationCase", + "Checks for negative finite base and non-integer finite exponent", TEST_ENABLED +}; +static const SDLTest_TestCaseReference powTestNan2 = { + (SDLTest_TestCaseFp) pow_base1ExpNanCase, "pow_base1ExpNanCase", + "Checks for pow(1.0, NAN)", TEST_ENABLED +}; +static const SDLTest_TestCaseReference powTestNan3 = { + (SDLTest_TestCaseFp) pow_baseNanExp0Cases, "pow_baseNanExp0Cases", + "Checks for pow(NAN, +/-0)", TEST_ENABLED +}; +static const SDLTest_TestCaseReference powTestNan4 = { + (SDLTest_TestCaseFp) pow_nanArgsCases, "pow_nanArgsCases", + "Checks for pow(x, y) with either x or y being NAN", TEST_ENABLED +}; +static const SDLTest_TestCaseReference powTestZero1 = { + (SDLTest_TestCaseFp) pow_baseNZeroExpOddCases, "pow_baseNZeroExpOddCases", + "Checks for pow(-0.0, y), with y an odd integer.", TEST_ENABLED +}; +static const SDLTest_TestCaseReference powTestZero2 = { + (SDLTest_TestCaseFp) pow_basePZeroExpOddCases, "pow_basePZeroExpOddCases", + "Checks for pow(0.0, y), with y an odd integer.", TEST_ENABLED +}; +static const SDLTest_TestCaseReference powTestZero3 = { + (SDLTest_TestCaseFp) pow_baseNZeroCases, "pow_baseNZeroCases", + "Checks for pow(-0.0, y), with y finite and even or non-integer number", TEST_ENABLED +}; +static const SDLTest_TestCaseReference powTestZero4 = { + (SDLTest_TestCaseFp) pow_basePZeroCases, "pow_basePZeroCases", + "Checks for pow(0.0, y), with y finite and even or non-integer number", TEST_ENABLED +}; +static const SDLTest_TestCaseReference powTestRegular = { + (SDLTest_TestCaseFp) pow_regularCases, "pow_regularCases", + "Checks a set of regular values", TEST_ENABLED +}; +static const SDLTest_TestCaseReference powTestPowOf2 = { + (SDLTest_TestCaseFp) pow_powerOfTwo, "pow_powerOfTwo", + "Checks the powers of two from 1 to 8", TEST_ENABLED +}; +static const SDLTest_TestCaseReference powTestRange = { + (SDLTest_TestCaseFp) pow_rangeTest, "pow_rangeTest", + "Checks a range of positive integer to the power of 0", TEST_ENABLED +}; + +/* SDL_sqrt test cases */ + +static const SDLTest_TestCaseReference sqrtTestInf = { + (SDLTest_TestCaseFp) sqrt_infCase, "sqrt_infCase", + "Checks positive infinity", TEST_ENABLED +}; +static const SDLTest_TestCaseReference sqrtTestNan = { + (SDLTest_TestCaseFp) sqrt_nanCase, "sqrt_nanCase", + "Checks NAN", TEST_ENABLED +}; +static const SDLTest_TestCaseReference sqrtTestDomain = { + (SDLTest_TestCaseFp) sqrt_outOfDomainCases, "sqrt_outOfDomainCases", + "Checks for values out of the domain", TEST_ENABLED +}; +static const SDLTest_TestCaseReference sqrtTestBase = { + (SDLTest_TestCaseFp) sqrt_baseCases, "sqrt_baseCases", + "Checks the base cases", TEST_ENABLED +}; +static const SDLTest_TestCaseReference sqrtTestRegular = { + (SDLTest_TestCaseFp) sqrt_regularCases, "sqrt_regularCases", + "Checks a set of regular values", TEST_ENABLED +}; + +/* SDL_scalbn test cases */ + +static const SDLTest_TestCaseReference scalbnTestInf = { + (SDLTest_TestCaseFp) scalbn_infCases, "scalbn_infCases", + "Checks positive and negative infinity arg", TEST_ENABLED +}; +static const SDLTest_TestCaseReference scalbnTestBaseZero = { + (SDLTest_TestCaseFp) scalbn_baseZeroCases, "scalbn_baseZeroCases", + "Checks for positive and negative zero arg", TEST_ENABLED +}; +static const SDLTest_TestCaseReference scalbnTestExpZero = { + (SDLTest_TestCaseFp) scalbn_expZeroCase, "scalbn_expZeroCase", + "Checks for zero exp", TEST_ENABLED +}; +static const SDLTest_TestCaseReference scalbnTestNan = { + (SDLTest_TestCaseFp) scalbn_nanCase, "scalbn_nanCase", + "Checks NAN", TEST_ENABLED +}; +static const SDLTest_TestCaseReference scalbnTestRegular = { + (SDLTest_TestCaseFp) scalbn_regularCases, "scalbn_regularCases", + "Checks a set of regular cases", TEST_ENABLED +}; + +/* SDL_cos test cases */ + +static const SDLTest_TestCaseReference cosTestInf = { + (SDLTest_TestCaseFp) cos_infCases, "cos_infCases", + "Checks for positive and negative infinity", TEST_ENABLED +}; +static const SDLTest_TestCaseReference cosTestNan = { + (SDLTest_TestCaseFp) cos_nanCase, "cos_nanCase", + "Checks NAN", TEST_ENABLED +}; +static const SDLTest_TestCaseReference cosTestRegular = { + (SDLTest_TestCaseFp) cos_regularCases, "cos_regularCases", + "Checks a set of regular cases", TEST_ENABLED +}; +static const SDLTest_TestCaseReference cosTestPrecision = { + (SDLTest_TestCaseFp) cos_precisionTest, "cos_precisionTest", + "Checks cosine precision", TEST_ENABLED +}; +static const SDLTest_TestCaseReference cosTestRange = { + (SDLTest_TestCaseFp) cos_rangeTest, "cos_rangeTest", + "Checks a range of positive integer", TEST_ENABLED +}; + +/* SDL_sin test cases */ + +static const SDLTest_TestCaseReference sinTestInf = { + (SDLTest_TestCaseFp) sin_infCases, "sin_infCases", + "Checks for positive and negative infinity", TEST_ENABLED +}; +static const SDLTest_TestCaseReference sinTestNan = { + (SDLTest_TestCaseFp) sin_nanCase, "sin_nanCase", + "Checks NAN", TEST_ENABLED +}; +static const SDLTest_TestCaseReference sinTestRegular = { + (SDLTest_TestCaseFp) sin_regularCases, "sin_regularCases", + "Checks a set of regular cases", TEST_ENABLED +}; +static const SDLTest_TestCaseReference sinTestPrecision = { + (SDLTest_TestCaseFp) sin_precisionTest, "sin_precisionTest", + "Checks sine precision", TEST_ENABLED +}; +static const SDLTest_TestCaseReference sinTestRange = { + (SDLTest_TestCaseFp) sin_rangeTest, "sin_rangeTest", + "Checks a range of positive integer", TEST_ENABLED +}; + +/* SDL_tan test cases */ + +static const SDLTest_TestCaseReference tanTestInf = { + (SDLTest_TestCaseFp) tan_infCases, "tan_infCases", + "Checks for positive and negative infinity", TEST_ENABLED +}; +static const SDLTest_TestCaseReference tanTestNan = { + (SDLTest_TestCaseFp) tan_nanCase, "tan_nanCase", + "Checks NAN", TEST_ENABLED +}; +static const SDLTest_TestCaseReference tanTestZero = { + (SDLTest_TestCaseFp) tan_zeroCases, "tan_zeroCases", + "Checks a set of regular cases", TEST_ENABLED +}; +static const SDLTest_TestCaseReference tanTestPrecision = { + (SDLTest_TestCaseFp) tan_precisionTest, "tan_precisionTest", + "Checks tangent precision", TEST_ENABLED +}; + +/* SDL_acos test cases */ + +static const SDLTest_TestCaseReference acosTestLimit = { + (SDLTest_TestCaseFp) acos_limitCases, "acos_limitCases", + "Checks the edge of the domain (+/-1)", TEST_ENABLED +}; +static const SDLTest_TestCaseReference acosTestOutOfDomain = { + (SDLTest_TestCaseFp) acos_outOfDomainCases, "acos_outOfDomainCases", + "Checks values outside the domain", TEST_ENABLED +}; +static const SDLTest_TestCaseReference acosTestNan = { + (SDLTest_TestCaseFp) acos_nanCase, "acos_nanCase", + "Checks NAN", TEST_ENABLED +}; +static const SDLTest_TestCaseReference acosTestPrecision = { + (SDLTest_TestCaseFp) acos_precisionTest, "acos_precisionTest", + "Checks acos precision", TEST_ENABLED +}; + +/* SDL_asin test cases */ + +static const SDLTest_TestCaseReference asinTestLimit = { + (SDLTest_TestCaseFp) asin_limitCases, "asin_limitCases", + "Checks the edge of the domain (+/-1)", TEST_ENABLED +}; +static const SDLTest_TestCaseReference asinTestOutOfDomain = { + (SDLTest_TestCaseFp) asin_outOfDomainCases, "asin_outOfDomainCases", + "Checks values outside the domain", TEST_ENABLED +}; +static const SDLTest_TestCaseReference asinTestNan = { + (SDLTest_TestCaseFp) asin_nanCase, "asin_nanCase", + "Checks NAN", TEST_ENABLED +}; +static const SDLTest_TestCaseReference asinTestPrecision = { + (SDLTest_TestCaseFp) asin_precisionTest, "asin_precisionTest", + "Checks asin precision", TEST_ENABLED +}; + +/* SDL_atan test cases */ + +static const SDLTest_TestCaseReference atanTestLimit = { + (SDLTest_TestCaseFp) atan_limitCases, "atan_limitCases", + "Checks the edge of the domain (+/-Infinity)", TEST_ENABLED +}; +static const SDLTest_TestCaseReference atanTestZero = { + (SDLTest_TestCaseFp) atan_zeroCases, "atan_zeroCases", + "Checks for positive and negative zero", TEST_ENABLED +}; +static const SDLTest_TestCaseReference atanTestNan = { + (SDLTest_TestCaseFp) atan_nanCase, "atan_nanCase", + "Checks NAN", TEST_ENABLED +}; +static const SDLTest_TestCaseReference atanTestPrecision = { + (SDLTest_TestCaseFp) atan_precisionTest, "atan_precisionTest", + "Checks atan precision", TEST_ENABLED +}; + +/* SDL_atan2 test cases */ + +static const SDLTest_TestCaseReference atan2TestZero1 = { + (SDLTest_TestCaseFp) atan2_bothZeroCases, "atan2_bothZeroCases", + "Checks for both arguments being zero", TEST_ENABLED +}; +static const SDLTest_TestCaseReference atan2TestZero2 = { + (SDLTest_TestCaseFp) atan2_yZeroCases, "atan2_yZeroCases", + "Checks for y=0", TEST_ENABLED +}; +static const SDLTest_TestCaseReference atan2TestZero3 = { + (SDLTest_TestCaseFp) atan2_xZeroCases, "atan2_xZeroCases", + "Checks for x=0", TEST_ENABLED +}; +static const SDLTest_TestCaseReference atan2TestInf1 = { + (SDLTest_TestCaseFp) atan2_bothInfCases, "atan2_bothInfCases", + "Checks for both arguments being infinity", TEST_ENABLED +}; +static const SDLTest_TestCaseReference atan2TestInf2 = { + (SDLTest_TestCaseFp) atan2_yInfCases, "atan2_yInfCases", + "Checks for y=0", TEST_ENABLED +}; +static const SDLTest_TestCaseReference atan2TestInf3 = { + (SDLTest_TestCaseFp) atan2_xInfCases, "atan2_xInfCases", + "Checks for x=0", TEST_ENABLED +}; +static const SDLTest_TestCaseReference atan2TestNan = { + (SDLTest_TestCaseFp) atan2_nanCases, "atan2_nanCases", + "Checks NANs", TEST_ENABLED +}; +static const SDLTest_TestCaseReference atan2TestQuadrantTopRight = { + (SDLTest_TestCaseFp) atan2_topRightQuadrantTest, "atan2_topRightQuadrantTest", + "Checks values in the top right quadrant", TEST_ENABLED +}; +static const SDLTest_TestCaseReference atan2TestQuadrantTopLeft = { + (SDLTest_TestCaseFp) atan2_topLeftQuadrantTest, "atan2_topLeftQuadrantTest", + "Checks values in the top left quadrant", TEST_ENABLED +}; +static const SDLTest_TestCaseReference atan2TestQuadrantBottomRight = { + (SDLTest_TestCaseFp) atan2_bottomRightQuadrantTest, "atan2_bottomRightQuadrantTest", + "Checks values in the bottom right quadrant", TEST_ENABLED +}; +static const SDLTest_TestCaseReference atan2TestQuadrantBottomLeft = { + (SDLTest_TestCaseFp) atan2_bottomLeftQuadrantTest, "atan2_bottomLeftQuadrantTest", + "Checks values in the bottom left quadrant", TEST_ENABLED +}; + +static const SDLTest_TestCaseReference *mathTests[] = { + &floorTestInf, &floorTestZero, &floorTestNan, + &floorTestRound, &floorTestFraction, &floorTestRange, + + &ceilTestInf, &ceilTestZero, &ceilTestNan, + &ceilTestRound, &ceilTestFraction, &ceilTestRange, + + &truncTestInf, &truncTestZero, &truncTestNan, + &truncTestRound, &truncTestFraction, &truncTestRange, + + &roundTestInf, &roundTestZero, &roundTestNan, + &roundTestRound, &roundTestFraction, &roundTestRange, + + &fabsTestInf, &fabsTestZero, &fabsTestNan, &fabsTestRange, + + ©signTestInf, ©signTestZero, ©signTestNan, ©signTestRange, + + &fmodTestDivOfInf, &fmodTestDivByInf, &fmodTestDivOfZero, &fmodTestDivByZero, + &fmodTestNan, &fmodTestRegular, &fmodTestRange, + + &expTestInf, &expTestZero, &expTestOverflow, + &expTestBase, &expTestRegular, + + &logTestLimit, &logTestNan, + &logTestBase, &logTestRegular, + + &log10TestLimit, &log10TestNan, + &log10TestBase, &log10TestRegular, + + &powTestExpInf1, &powTestExpInf2, &powTestExpInf3, + &powTestBaseInf1, &powTestBaseInf2, + &powTestNan1, &powTestNan2, &powTestNan3, &powTestNan4, + &powTestZero1, &powTestZero2, &powTestZero3, &powTestZero4, + &powTestRegular, &powTestPowOf2, &powTestRange, + + &sqrtTestInf, &sqrtTestNan, &sqrtTestDomain, + &sqrtTestBase, &sqrtTestRegular, + + &scalbnTestInf, &scalbnTestBaseZero, &scalbnTestExpZero, + &scalbnTestNan, &scalbnTestRegular, + + &cosTestInf, &cosTestNan, &cosTestRegular, + &cosTestPrecision, &cosTestRange, + + &sinTestInf, &sinTestNan, &sinTestRegular, + &sinTestPrecision, &sinTestRange, + + &tanTestInf, &tanTestNan, &tanTestZero, &tanTestPrecision, + + &acosTestLimit, &acosTestOutOfDomain, &acosTestNan, &acosTestPrecision, + + &asinTestLimit, &asinTestOutOfDomain, &asinTestNan, &asinTestPrecision, + + &atanTestLimit, &atanTestZero, &atanTestNan, &atanTestPrecision, + + &atan2TestZero1, &atan2TestZero2, &atan2TestZero3, + &atan2TestInf1, &atan2TestInf2, &atan2TestInf3, + &atan2TestNan, &atan2TestQuadrantTopRight, &atan2TestQuadrantTopLeft, + &atan2TestQuadrantBottomRight, &atan2TestQuadrantBottomLeft, + + NULL +}; + +SDLTest_TestSuiteReference mathTestSuite = { "Math", NULL, mathTests, NULL }; diff -Nru libsdl2-2.0.22+dfsg/test/testautomation_platform.c libsdl2-2.24.0+dfsg/test/testautomation_platform.c --- libsdl2-2.0.22+dfsg/test/testautomation_platform.c 2021-11-26 16:03:45.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testautomation_platform.c 2022-06-16 20:16:31.000000000 +0000 @@ -54,12 +54,18 @@ int platform_testEndianessAndSwap(void *arg) { int real_byteorder; + int real_floatwordorder = 0; Uint16 value = 0x1234; Uint16 value16 = 0xCDAB; Uint16 swapped16 = 0xABCD; Uint32 value32 = 0xEFBEADDE; Uint32 swapped32 = 0xDEADBEEF; + union { + double d; + Uint32 ui32[2]; + } value_double; + Uint64 value64, swapped64; value64 = 0xEFBEADDE; value64 <<= 32; @@ -67,6 +73,7 @@ swapped64 = 0x1234ABCD; swapped64 <<= 32; swapped64 |= 0xDEADBEEF; + value_double.d = 3.141593; if ((*((char *) &value) >> 4) == 0x1) { real_byteorder = SDL_BIG_ENDIAN; @@ -80,6 +87,18 @@ (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? "little" : "big", (real_byteorder == SDL_LIL_ENDIAN) ? "little" : "big" ); + if (value_double.ui32[0] == 0x82c2bd7f && value_double.ui32[1] == 0x400921fb) { + real_floatwordorder = SDL_LIL_ENDIAN; + } else if (value_double.ui32[0] == 0x400921fb && value_double.ui32[1] == 0x82c2bd7f) { + real_floatwordorder = SDL_BIG_ENDIAN; + } + + /* Test endianness. */ + SDLTest_AssertCheck( real_floatwordorder == SDL_FLOATWORDORDER, + "Machine detected as having %s endian float word order, appears to be %s endian.", + (SDL_FLOATWORDORDER == SDL_LIL_ENDIAN) ? "little" : "big", + (real_floatwordorder == SDL_LIL_ENDIAN) ? "little" : (real_floatwordorder == SDL_BIG_ENDIAN) ? "big" : "unknown" ); + /* Test 16 swap. */ SDLTest_AssertCheck( SDL_Swap16(value16) == swapped16, "SDL_Swap16(): 16 bit swapped: 0x%X => 0x%X", @@ -525,7 +544,7 @@ { (SDLTest_TestCaseFp)platform_testTypes, "platform_testTypes", "Tests predefined types", TEST_ENABLED}; static const SDLTest_TestCaseReference platformTest2 = - { (SDLTest_TestCaseFp)platform_testEndianessAndSwap, "platform_testEndianessAndSwap", "Tests endianess and swap functions", TEST_ENABLED}; + { (SDLTest_TestCaseFp)platform_testEndianessAndSwap, "platform_testEndianessAndSwap", "Tests endianness and swap functions", TEST_ENABLED}; static const SDLTest_TestCaseReference platformTest3 = { (SDLTest_TestCaseFp)platform_testGetFunctions, "platform_testGetFunctions", "Tests various SDL_GetXYZ functions", TEST_ENABLED}; diff -Nru libsdl2-2.0.22+dfsg/test/testautomation_rect.c libsdl2-2.24.0+dfsg/test/testautomation_rect.c --- libsdl2-2.0.22+dfsg/test/testautomation_rect.c 2022-04-21 17:37:37.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testautomation_rect.c 2022-06-16 20:16:31.000000000 +0000 @@ -707,7 +707,7 @@ int rect_testIntersectRectParam(void *arg) { SDL_Rect rectA; - SDL_Rect rectB; + SDL_Rect rectB = {0}; SDL_Rect result; SDL_bool intersection; @@ -962,7 +962,7 @@ int rect_testHasIntersectionParam(void *arg) { SDL_Rect rectA; - SDL_Rect rectB; + SDL_Rect rectB = {0}; SDL_bool intersection; /* invalid parameter combinations */ @@ -1231,7 +1231,7 @@ { SDL_Point points[1]; int count; - SDL_Rect clip; + SDL_Rect clip = { 0 }; SDL_Rect result; SDL_bool anyEnclosed; @@ -1457,7 +1457,7 @@ */ int rect_testUnionRectParam(void *arg) { - SDL_Rect rectA, rectB; + SDL_Rect rectA, rectB = { 0 }; SDL_Rect result; /* invalid parameter combinations */ diff -Nru libsdl2-2.0.22+dfsg/test/testautomation_rwops.c libsdl2-2.24.0+dfsg/test/testautomation_rwops.c --- libsdl2-2.0.22+dfsg/test/testautomation_rwops.c 2021-07-27 14:52:29.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testautomation_rwops.c 2022-08-13 03:48:10.000000000 +0000 @@ -393,6 +393,7 @@ int rwops_testFPRead(void) { +#ifdef HAVE_LIBC FILE *fp; SDL_RWops *rw; int result; @@ -428,6 +429,8 @@ SDLTest_AssertPass("Call to SDL_RWclose() succeeded"); SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result); +#endif /* HAVE_LIBC */ + return TEST_COMPLETED; } @@ -443,6 +446,7 @@ int rwops_testFPWrite(void) { +#ifdef HAVE_LIBC FILE *fp; SDL_RWops *rw; int result; @@ -478,6 +482,8 @@ SDLTest_AssertPass("Call to SDL_RWclose() succeeded"); SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result); +#endif /* HAVE_LIBC */ + return TEST_COMPLETED; } diff -Nru libsdl2-2.0.22+dfsg/test/testautomation_stdlib.c libsdl2-2.24.0+dfsg/test/testautomation_stdlib.c --- libsdl2-2.0.22+dfsg/test/testautomation_stdlib.c 2021-11-26 16:03:45.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testautomation_stdlib.c 2022-08-13 03:48:10.000000000 +0000 @@ -319,6 +319,176 @@ SDLTest_AssertCheck(expected_output == output, "Check output, expected: %i, got: %i", expected_output, output); SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result); + output = 123; + expected_output = 0xa; + expected_result = 1; + result = SDL_sscanf("aa", "%1x", &output); + SDLTest_AssertPass("Call to SDL_sscanf(\"aa\", \"%%1x\", &output)"); + SDLTest_AssertCheck(expected_output == output, "Check output, expected: %i, got: %i", expected_output, output); + SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result); + + return TEST_COMPLETED; +} + +#if defined(_WIN64) +# define SIZE_FORMAT "I64u" +#elif defined(__WIN32__) +# define SIZE_FORMAT "I32u" +#else +# define SIZE_FORMAT "zu" +#endif + +typedef struct +{ + size_t a; + size_t b; + size_t result; + int status; +} overflow_test; + +static const overflow_test multiplications[] = +{ + { 1, 1, 1, 0 }, + { 0, 0, 0, 0 }, + { SDL_SIZE_MAX, 0, 0, 0 }, + { SDL_SIZE_MAX, 1, SDL_SIZE_MAX, 0 }, + { SDL_SIZE_MAX / 2, 2, SDL_SIZE_MAX - (SDL_SIZE_MAX % 2), 0 }, + { SDL_SIZE_MAX / 23, 23, SDL_SIZE_MAX - (SDL_SIZE_MAX % 23), 0 }, + + { (SDL_SIZE_MAX / 2) + 1, 2, 0, -1 }, + { (SDL_SIZE_MAX / 23) + 42, 23, 0, -1 }, + { SDL_SIZE_MAX, SDL_SIZE_MAX, 0, -1 }, +}; + +static const overflow_test additions[] = +{ + { 1, 1, 2, 0 }, + { 0, 0, 0, 0 }, + { SDL_SIZE_MAX, 0, SDL_SIZE_MAX, 0 }, + { SDL_SIZE_MAX - 1, 1, SDL_SIZE_MAX, 0 }, + { SDL_SIZE_MAX - 42, 23, SDL_SIZE_MAX - (42 - 23), 0 }, + + { SDL_SIZE_MAX, 1, 0, -1 }, + { SDL_SIZE_MAX, 23, 0, -1 }, + { SDL_SIZE_MAX, SDL_SIZE_MAX, 0, -1 }, +}; + +static int +stdlib_overflow(void *arg) +{ + size_t i; + size_t useBuiltin; + + for (useBuiltin = 0; useBuiltin < 2; useBuiltin++) { + if (useBuiltin) { + SDLTest_Log("Using gcc/clang builtins if possible"); + } else { + SDLTest_Log("Not using gcc/clang builtins"); + } + + for (i = 0; i < SDL_arraysize(multiplications); i++) { + const overflow_test *t = &multiplications[i]; + int status; + size_t result = ~t->result; + + if (useBuiltin) { + status = SDL_size_mul_overflow(t->a, t->b, &result); + } else { + /* This disables the macro that tries to use a gcc/clang + * builtin, so we test the fallback implementation instead. */ + status = (SDL_size_mul_overflow)(t->a, t->b, &result); + } + + if (t->status == 0) { + SDLTest_AssertCheck(status == 0, + "(%" SIZE_FORMAT " * %" SIZE_FORMAT ") should succeed", + t->a, t->b); + SDLTest_AssertCheck(result == t->result, + "(%" SIZE_FORMAT " * %" SIZE_FORMAT "): expected %" SIZE_FORMAT ", got %" SIZE_FORMAT, + t->a, t->b, t->result, result); + } else { + SDLTest_AssertCheck(status == -1, + "(%" SIZE_FORMAT " * %" SIZE_FORMAT ") should fail", + t->a, t->b); + } + + if (t->a == t->b) { + continue; + } + + result = ~t->result; + + if (useBuiltin) { + status = SDL_size_mul_overflow(t->b, t->a, &result); + } else { + status = (SDL_size_mul_overflow)(t->b, t->a, &result); + } + + if (t->status == 0) { + SDLTest_AssertCheck(status == 0, + "(%" SIZE_FORMAT " * %" SIZE_FORMAT ") should succeed", + t->b, t->a); + SDLTest_AssertCheck(result == t->result, + "(%" SIZE_FORMAT " * %" SIZE_FORMAT "): expected %" SIZE_FORMAT ", got %" SIZE_FORMAT, + t->b, t->a, t->result, result); + } else { + SDLTest_AssertCheck(status == -1, + "(%" SIZE_FORMAT " * %" SIZE_FORMAT ") should fail", + t->b, t->a); + } + } + + for (i = 0; i < SDL_arraysize(additions); i++) { + const overflow_test *t = &additions[i]; + int status; + size_t result = ~t->result; + + if (useBuiltin) { + status = SDL_size_add_overflow(t->a, t->b, &result); + } else { + status = (SDL_size_add_overflow)(t->a, t->b, &result); + } + + if (t->status == 0) { + SDLTest_AssertCheck(status == 0, + "(%" SIZE_FORMAT " + %" SIZE_FORMAT ") should succeed", + t->a, t->b); + SDLTest_AssertCheck(result == t->result, + "(%" SIZE_FORMAT " + %" SIZE_FORMAT "): expected %" SIZE_FORMAT ", got %" SIZE_FORMAT, + t->a, t->b, t->result, result); + } else { + SDLTest_AssertCheck(status == -1, + "(%" SIZE_FORMAT " + %" SIZE_FORMAT ") should fail", + t->a, t->b); + } + + if (t->a == t->b) { + continue; + } + + result = ~t->result; + + if (useBuiltin) { + status = SDL_size_add_overflow(t->b, t->a, &result); + } else { + status = (SDL_size_add_overflow)(t->b, t->a, &result); + } + + if (t->status == 0) { + SDLTest_AssertCheck(status == 0, + "(%" SIZE_FORMAT " + %" SIZE_FORMAT ") should succeed", + t->b, t->a); + SDLTest_AssertCheck(result == t->result, + "(%" SIZE_FORMAT " + %" SIZE_FORMAT "): expected %" SIZE_FORMAT ", got %" SIZE_FORMAT, + t->b, t->a, t->result, result); + } else { + SDLTest_AssertCheck(status == -1, + "(%" SIZE_FORMAT " + %" SIZE_FORMAT ") should fail", + t->b, t->a); + } + } + } + return TEST_COMPLETED; } @@ -337,9 +507,17 @@ static const SDLTest_TestCaseReference stdlibTest4 = { (SDLTest_TestCaseFp)stdlib_sscanf, "stdlib_sscanf", "Call to SDL_sscanf", TEST_ENABLED }; +static const SDLTest_TestCaseReference stdlibTestOverflow = + { stdlib_overflow, "stdlib_overflow", "Overflow detection", TEST_ENABLED }; + /* Sequence of Standard C routine test cases */ static const SDLTest_TestCaseReference *stdlibTests[] = { - &stdlibTest1, &stdlibTest2, &stdlibTest3, &stdlibTest4, NULL + &stdlibTest1, + &stdlibTest2, + &stdlibTest3, + &stdlibTest4, + &stdlibTestOverflow, + NULL }; /* Standard C routine test suite (global) */ diff -Nru libsdl2-2.0.22+dfsg/test/testautomation_suites.h libsdl2-2.24.0+dfsg/test/testautomation_suites.h --- libsdl2-2.0.22+dfsg/test/testautomation_suites.h 2021-07-27 14:52:29.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testautomation_suites.h 2022-08-13 03:48:10.000000000 +0000 @@ -12,8 +12,12 @@ extern SDLTest_TestSuiteReference audioTestSuite; extern SDLTest_TestSuiteReference clipboardTestSuite; extern SDLTest_TestSuiteReference eventsTestSuite; +extern SDLTest_TestSuiteReference guidTestSuite; +extern SDLTest_TestSuiteReference hintsTestSuite; +extern SDLTest_TestSuiteReference joystickTestSuite; extern SDLTest_TestSuiteReference keyboardTestSuite; extern SDLTest_TestSuiteReference mainTestSuite; +extern SDLTest_TestSuiteReference mathTestSuite; extern SDLTest_TestSuiteReference mouseTestSuite; extern SDLTest_TestSuiteReference pixelsTestSuite; extern SDLTest_TestSuiteReference platformTestSuite; @@ -26,15 +30,18 @@ extern SDLTest_TestSuiteReference syswmTestSuite; extern SDLTest_TestSuiteReference timerTestSuite; extern SDLTest_TestSuiteReference videoTestSuite; -extern SDLTest_TestSuiteReference hintsTestSuite; /* All test suites */ SDLTest_TestSuiteReference *testSuites[] = { &audioTestSuite, &clipboardTestSuite, &eventsTestSuite, + &guidTestSuite, + &hintsTestSuite, + &joystickTestSuite, &keyboardTestSuite, &mainTestSuite, + &mathTestSuite, &mouseTestSuite, &pixelsTestSuite, &platformTestSuite, @@ -47,7 +54,6 @@ &syswmTestSuite, &timerTestSuite, &videoTestSuite, - &hintsTestSuite, NULL }; diff -Nru libsdl2-2.0.22+dfsg/test/testautomation_surface.c libsdl2-2.24.0+dfsg/test/testautomation_surface.c --- libsdl2-2.0.22+dfsg/test/testautomation_surface.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testautomation_surface.c 2022-06-16 20:16:31.000000000 +0000 @@ -178,6 +178,10 @@ bmode = SDL_BLENDMODE_ADD; } else if (nmode==3) { bmode = SDL_BLENDMODE_MOD; + } else { + /* Should be impossible, but some static checkers are too imprecise and will complain */ + SDLTest_LogError("Invalid: nmode=%d", nmode); + return; } ret = SDL_SetSurfaceBlendMode( face, bmode ); if (ret != 0) checkFailCount4++; @@ -589,6 +593,177 @@ } +int +surface_testOverflow(void *arg) +{ + char buf[1024]; + const char *expectedError; + SDL_Surface *surface; + + SDL_memset(buf, '\0', sizeof(buf)); + + expectedError = "Parameter 'width' is invalid"; + surface = SDL_CreateRGBSurfaceWithFormat(0, -3, 100, 8, SDL_PIXELFORMAT_INDEX8); + SDLTest_AssertCheck(surface == NULL, "Should detect negative width"); + SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, + "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); + surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, -1, 1, 8, 4, SDL_PIXELFORMAT_INDEX8); + SDLTest_AssertCheck(surface == NULL, "Should detect negative width"); + SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, + "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); + surface = SDL_CreateRGBSurfaceFrom(buf, -1, 1, 32, 4, 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF); + SDLTest_AssertCheck(surface == NULL, "Should detect negative width"); + SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, + "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); + + expectedError = "Parameter 'height' is invalid"; + surface = SDL_CreateRGBSurfaceWithFormat(0, 100, -3, 8, SDL_PIXELFORMAT_INDEX8); + SDLTest_AssertCheck(surface == NULL, "Should detect negative height"); + SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, + "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); + surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 1, -1, 8, 4, SDL_PIXELFORMAT_INDEX8); + SDLTest_AssertCheck(surface == NULL, "Should detect negative height"); + SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, + "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); + surface = SDL_CreateRGBSurfaceFrom(buf, 1, -1, 32, 4, 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF); + SDLTest_AssertCheck(surface == NULL, "Should detect negative height"); + SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, + "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); + + expectedError = "Parameter 'pitch' is invalid"; + surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 4, 1, 8, -1, SDL_PIXELFORMAT_INDEX8); + SDLTest_AssertCheck(surface == NULL, "Should detect negative pitch"); + SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, + "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); + surface = SDL_CreateRGBSurfaceFrom(buf, 1, 1, 32, -1, 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF); + SDLTest_AssertCheck(surface == NULL, "Should detect negative pitch"); + SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, + "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); + + /* Less than 1 byte per pixel: the pitch can legitimately be less than + * the width, but it must be enough to hold the appropriate number of + * bits per pixel. SDL_PIXELFORMAT_INDEX4* needs 1 byte per 2 pixels. */ + surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 6, 1, 4, 3, SDL_PIXELFORMAT_INDEX4LSB); + SDLTest_AssertCheck(surface != NULL, "6px * 4 bits per px fits in 3 bytes: %s", + surface != NULL ? "(success)" : SDL_GetError()); + SDL_FreeSurface(surface); + surface = SDL_CreateRGBSurfaceFrom(buf, 6, 1, 4, 3, 0, 0, 0, 0); + SDLTest_AssertCheck(surface != NULL, "6px * 4 bits per px fits in 3 bytes: %s", + surface != NULL ? "(success)" : SDL_GetError()); + SDL_FreeSurface(surface); + + surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 7, 1, 4, 3, SDL_PIXELFORMAT_INDEX4LSB); + SDLTest_AssertCheck(surface == NULL, "Should detect pitch < width * bpp"); + SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, + "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); + surface = SDL_CreateRGBSurfaceFrom(buf, 7, 1, 4, 3, 0, 0, 0, 0); + SDLTest_AssertCheck(surface == NULL, "Should detect pitch < width * bpp"); + SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, + "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); + + surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 7, 1, 4, 4, SDL_PIXELFORMAT_INDEX4LSB); + SDLTest_AssertCheck(surface != NULL, "7px * 4 bits per px fits in 4 bytes: %s", + surface != NULL ? "(success)" : SDL_GetError()); + SDL_FreeSurface(surface); + surface = SDL_CreateRGBSurfaceFrom(buf, 7, 1, 4, 4, 0, 0, 0, 0); + SDLTest_AssertCheck(surface != NULL, "7px * 4 bits per px fits in 4 bytes: %s", + surface != NULL ? "(success)" : SDL_GetError()); + SDL_FreeSurface(surface); + + /* SDL_PIXELFORMAT_INDEX1* needs 1 byte per 8 pixels. */ + surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 16, 1, 1, 2, SDL_PIXELFORMAT_INDEX1LSB); + SDLTest_AssertCheck(surface != NULL, "16px * 1 bit per px fits in 2 bytes: %s", + surface != NULL ? "(success)" : SDL_GetError()); + SDL_FreeSurface(surface); + surface = SDL_CreateRGBSurfaceFrom(buf, 16, 1, 1, 2, 0, 0, 0, 0); + SDLTest_AssertCheck(surface != NULL, "16px * 1 bit per px fits in 2 bytes: %s", + surface != NULL ? "(success)" : SDL_GetError()); + SDL_FreeSurface(surface); + + surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 17, 1, 1, 2, SDL_PIXELFORMAT_INDEX1LSB); + SDLTest_AssertCheck(surface == NULL, "Should detect pitch < width * bpp"); + SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, + "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); + surface = SDL_CreateRGBSurfaceFrom(buf, 17, 1, 1, 2, 0, 0, 0, 0); + SDLTest_AssertCheck(surface == NULL, "Should detect pitch < width * bpp"); + SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, + "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); + + surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 17, 1, 1, 3, SDL_PIXELFORMAT_INDEX1LSB); + SDLTest_AssertCheck(surface != NULL, "17px * 1 bit per px fits in 3 bytes: %s", + surface != NULL ? "(success)" : SDL_GetError()); + SDL_FreeSurface(surface); + surface = SDL_CreateRGBSurfaceFrom(buf, 7, 1, 1, 3, 0, 0, 0, 0); + SDLTest_AssertCheck(surface != NULL, "17px * 1 bit per px fits in 3 bytes: %s", + surface != NULL ? "(success)" : SDL_GetError()); + SDL_FreeSurface(surface); + + /* SDL_PIXELFORMAT_INDEX8 and SDL_PIXELFORMAT_RGB332 require 1 byte per pixel. */ + surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 5, 1, 8, 5, SDL_PIXELFORMAT_RGB332); + SDLTest_AssertCheck(surface != NULL, "5px * 8 bits per px fits in 5 bytes: %s", + surface != NULL ? "(success)" : SDL_GetError()); + SDL_FreeSurface(surface); + surface = SDL_CreateRGBSurfaceFrom(buf, 5, 1, 8, 5, 0, 0, 0, 0); + SDLTest_AssertCheck(surface != NULL, "5px * 8 bits per px fits in 5 bytes: %s", + surface != NULL ? "(success)" : SDL_GetError()); + SDL_FreeSurface(surface); + + surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 6, 1, 8, 5, SDL_PIXELFORMAT_RGB332); + SDLTest_AssertCheck(surface == NULL, "Should detect pitch < width * bpp"); + SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, + "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); + surface = SDL_CreateRGBSurfaceFrom(buf, 6, 1, 8, 5, 0, 0, 0, 0); + SDLTest_AssertCheck(surface == NULL, "Should detect pitch < width * bpp"); + SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, + "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); + + /* Everything else requires more than 1 byte per pixel, and rounds up + * each pixel to an integer number of bytes (e.g. RGB555 is really + * XRGB1555, with 1 bit per pixel wasted). */ + surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 3, 1, 15, 6, SDL_PIXELFORMAT_RGB555); + SDLTest_AssertCheck(surface != NULL, "3px * 15 (really 16) bits per px fits in 6 bytes: %s", + surface != NULL ? "(success)" : SDL_GetError()); + SDL_FreeSurface(surface); + surface = SDL_CreateRGBSurfaceFrom(buf, 3, 1, 15, 6, 0, 0, 0, 0); + SDLTest_AssertCheck(surface != NULL, "5px * 15 (really 16) bits per px fits in 6 bytes: %s", + surface != NULL ? "(success)" : SDL_GetError()); + SDL_FreeSurface(surface); + + surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 4, 1, 15, 6, SDL_PIXELFORMAT_RGB555); + SDLTest_AssertCheck(surface == NULL, "4px * 15 (really 16) bits per px doesn't fit in 6 bytes"); + SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, + "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); + surface = SDL_CreateRGBSurfaceFrom(buf, 4, 1, 15, 6, 0, 0, 0, 0); + SDLTest_AssertCheck(surface == NULL, "4px * 15 (really 16) bits per px doesn't fit in 6 bytes"); + SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, + "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); + + if (sizeof (size_t) == 4 && sizeof (int) >= 4) { + expectedError = "Out of memory"; + surface = SDL_CreateRGBSurfaceWithFormat(0, SDL_MAX_SINT32, 1, 8, SDL_PIXELFORMAT_INDEX8); + SDLTest_AssertCheck(surface == NULL, "Should detect overflow in width + alignment"); + SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, + "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); + surface = SDL_CreateRGBSurfaceWithFormat(0, SDL_MAX_SINT32 / 2, 1, 32, SDL_PIXELFORMAT_ARGB8888); + SDLTest_AssertCheck(surface == NULL, "Should detect overflow in width * bytes per pixel"); + SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, + "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); + surface = SDL_CreateRGBSurfaceWithFormat(0, (1 << 29) - 1, (1 << 29) - 1, 8, SDL_PIXELFORMAT_INDEX8); + SDLTest_AssertCheck(surface == NULL, "Should detect overflow in width * height"); + SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, + "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); + surface = SDL_CreateRGBSurfaceWithFormat(0, (1 << 15) + 1, (1 << 15) + 1, 32, SDL_PIXELFORMAT_ARGB8888); + SDLTest_AssertCheck(surface == NULL, "Should detect overflow in width * height * bytes per pixel"); + SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, + "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); + } + else { + SDLTest_Log("Can't easily overflow size_t on this platform"); + } + + return TEST_COMPLETED; +} + /* ================= Test References ================== */ /* Surface test cases */ @@ -631,11 +806,14 @@ static const SDLTest_TestCaseReference surfaceTest12 = { (SDLTest_TestCaseFp)surface_testBlitBlendMod, "surface_testBlitBlendMod", "Tests blitting routines with mod blending mode.", TEST_ENABLED}; +static const SDLTest_TestCaseReference surfaceTestOverflow = + { surface_testOverflow, "surface_testOverflow", "Test overflow detection.", TEST_ENABLED}; + /* Sequence of Surface test cases */ static const SDLTest_TestCaseReference *surfaceTests[] = { &surfaceTest1, &surfaceTest2, &surfaceTest3, &surfaceTest4, &surfaceTest5, &surfaceTest6, &surfaceTest7, &surfaceTest8, &surfaceTest9, &surfaceTest10, - &surfaceTest11, &surfaceTest12, NULL + &surfaceTest11, &surfaceTest12, &surfaceTestOverflow, NULL }; /* Surface test suite (global) */ diff -Nru libsdl2-2.0.22+dfsg/test/testautomation_video.c libsdl2-2.24.0+dfsg/test/testautomation_video.c --- libsdl2-2.0.22+dfsg/test/testautomation_video.c 2021-07-27 14:52:29.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testautomation_video.c 2022-06-16 20:16:31.000000000 +0000 @@ -1372,7 +1372,8 @@ int wVariation, hVariation; int referenceW, referenceH; int currentW, currentH; - int desiredW, desiredH; + int desiredW = 1; + int desiredH = 1; /* Get display bounds for size range */ result = SDL_GetDisplayBounds(0, &display); @@ -1848,6 +1849,129 @@ return returnValue; } +/** +* @brief Tests the functionality of the SDL_WINDOWPOS_CENTERED_DISPLAY along with SDL_WINDOW_FULLSCREEN_DESKTOP. +* +* Espeically useful when run on a multi-monitor system with different DPI scales per monitor, +* to test that the window size is maintained when moving between monitors. +*/ +int +video_setWindowCenteredOnDisplay(void *arg) +{ + SDL_Window *window; + const char *title = "video_setWindowCenteredOnDisplay Test Window"; + int x, y, w, h; + int xVariation, yVariation; + int displayNum; + int result; + SDL_Rect display0, display1; + + displayNum = SDL_GetNumVideoDisplays(); + + /* Get display bounds */ + result = SDL_GetDisplayBounds(0 % displayNum, &display0); + SDLTest_AssertPass("SDL_GetDisplayBounds()"); + SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result); + if (result != 0) + return TEST_ABORTED; + + result = SDL_GetDisplayBounds(1 % displayNum, &display1); + SDLTest_AssertPass("SDL_GetDisplayBounds()"); + SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result); + if (result != 0) + return TEST_ABORTED; + + for (xVariation = 0; xVariation < 2; xVariation++) { + for (yVariation = 0; yVariation < 2; yVariation++) { + int currentX = 0, currentY = 0; + int currentW = 0, currentH = 0; + int expectedX = 0, expectedY = 0; + int currentDisplay; + int expectedDisplay; + SDL_Rect expectedDisplayRect; + + /* xVariation is the display we start on */ + expectedDisplay = xVariation % displayNum; + x = SDL_WINDOWPOS_CENTERED_DISPLAY(expectedDisplay); + y = SDL_WINDOWPOS_CENTERED_DISPLAY(expectedDisplay); + w = SDLTest_RandomIntegerInRange(640, 800); + h = SDLTest_RandomIntegerInRange(400, 600); + expectedDisplayRect = (xVariation == 0) ? display0 : display1; + expectedX = (expectedDisplayRect.x + ((expectedDisplayRect.w - w) / 2)); + expectedY = (expectedDisplayRect.y + ((expectedDisplayRect.h - h) / 2)); + + window = SDL_CreateWindow(title, x, y, w, h, SDL_WINDOW_SHOWN | SDL_WINDOW_ALLOW_HIGHDPI); + SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%d,%d,SHOWN)", x, y, w, h); + SDLTest_AssertCheck(window != NULL, "Validate that returned window struct is not NULL"); + + /* Check the window is centered on the requested display */ + currentDisplay = SDL_GetWindowDisplayIndex(window); + SDL_GetWindowSize(window, ¤tW, ¤tH); + SDL_GetWindowPosition(window, ¤tX, ¤tY); + + SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display index (current: %d, expected: %d)", currentDisplay, expectedDisplay); + SDLTest_AssertCheck(currentW == w, "Validate width (current: %d, expected: %d)", currentW, w); + SDLTest_AssertCheck(currentH == h, "Validate height (current: %d, expected: %d)", currentH, h); + SDLTest_AssertCheck(currentX == expectedX, "Validate x (current: %d, expected: %d)", currentX, expectedX); + SDLTest_AssertCheck(currentY == expectedY, "Validate y (current: %d, expected: %d)", currentY, expectedY); + + /* Enter fullscreen desktop */ + result = SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP); + SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result); + + /* Check we are filling the full display */ + currentDisplay = SDL_GetWindowDisplayIndex(window); + SDL_GetWindowSize(window, ¤tW, ¤tH); + SDL_GetWindowPosition(window, ¤tX, ¤tY); + + SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display index (current: %d, expected: %d)", currentDisplay, expectedDisplay); + SDLTest_AssertCheck(currentW == expectedDisplayRect.w, "Validate width (current: %d, expected: %d)", currentW, expectedDisplayRect.w); + SDLTest_AssertCheck(currentH == expectedDisplayRect.h, "Validate height (current: %d, expected: %d)", currentH, expectedDisplayRect.h); + SDLTest_AssertCheck(currentX == expectedDisplayRect.x, "Validate x (current: %d, expected: %d)", currentX, expectedDisplayRect.x); + SDLTest_AssertCheck(currentY == expectedDisplayRect.y, "Validate y (current: %d, expected: %d)", currentY, expectedDisplayRect.y); + + /* Leave fullscreen desktop */ + result = SDL_SetWindowFullscreen(window, 0); + SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result); + + /* Check window was restored correctly */ + currentDisplay = SDL_GetWindowDisplayIndex(window); + SDL_GetWindowSize(window, ¤tW, ¤tH); + SDL_GetWindowPosition(window, ¤tX, ¤tY); + + SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display index (current: %d, expected: %d)", currentDisplay, expectedDisplay); + SDLTest_AssertCheck(currentW == w, "Validate width (current: %d, expected: %d)", currentW, w); + SDLTest_AssertCheck(currentH == h, "Validate height (current: %d, expected: %d)", currentH, h); + SDLTest_AssertCheck(currentX == expectedX, "Validate x (current: %d, expected: %d)", currentX, expectedX); + SDLTest_AssertCheck(currentY == expectedY, "Validate y (current: %d, expected: %d)", currentY, expectedY); + + /* Center on display yVariation, and check window properties */ + + expectedDisplay = yVariation % displayNum; + x = SDL_WINDOWPOS_CENTERED_DISPLAY(expectedDisplay); + y = SDL_WINDOWPOS_CENTERED_DISPLAY(expectedDisplay); + expectedDisplayRect = (expectedDisplay == 0) ? display0 : display1; + expectedX = (expectedDisplayRect.x + ((expectedDisplayRect.w - w) / 2)); + expectedY = (expectedDisplayRect.y + ((expectedDisplayRect.h - h) / 2)); + SDL_SetWindowPosition(window, x, y); + + currentDisplay = SDL_GetWindowDisplayIndex(window); + SDL_GetWindowSize(window, ¤tW, ¤tH); + SDL_GetWindowPosition(window, ¤tX, ¤tY); + + SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display index (current: %d, expected: %d)", currentDisplay, expectedDisplay); + SDLTest_AssertCheck(currentW == w, "Validate width (current: %d, expected: %d)", currentW, w); + SDLTest_AssertCheck(currentH == h, "Validate height (current: %d, expected: %d)", currentH, h); + SDLTest_AssertCheck(currentX == expectedX, "Validate x (current: %d, expected: %d)", currentX, expectedX); + SDLTest_AssertCheck(currentY == expectedY, "Validate y (current: %d, expected: %d)", currentY, expectedY); + + /* Clean up */ + _destroyVideoSuiteTestWindow(window); + } + } + + return TEST_COMPLETED; +} /* ================= Test References ================== */ @@ -1921,13 +2045,16 @@ static const SDLTest_TestCaseReference videoTest23 = { (SDLTest_TestCaseFp)video_getSetWindowData, "video_getSetWindowData", "Checks SDL_SetWindowData and SDL_GetWindowData positive and negative cases", TEST_ENABLED }; +static const SDLTest_TestCaseReference videoTest24 = + { (SDLTest_TestCaseFp) video_setWindowCenteredOnDisplay, "video_setWindowCenteredOnDisplay", "Checks using SDL_WINDOWPOS_CENTERED_DISPLAY centers the window on a display", TEST_ENABLED }; + /* Sequence of Video test cases */ static const SDLTest_TestCaseReference *videoTests[] = { &videoTest1, &videoTest2, &videoTest3, &videoTest4, &videoTest5, &videoTest6, &videoTest7, &videoTest8, &videoTest9, &videoTest10, &videoTest11, &videoTest12, &videoTest13, &videoTest14, &videoTest15, &videoTest16, &videoTest17, &videoTest18, &videoTest19, &videoTest20, &videoTest21, &videoTest22, - &videoTest23, NULL + &videoTest23, &videoTest24, NULL }; /* Video test suite (global) */ diff -Nru libsdl2-2.0.22+dfsg/test/testcustomcursor.c libsdl2-2.24.0+dfsg/test/testcustomcursor.c --- libsdl2-2.0.22+dfsg/test/testcustomcursor.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testcustomcursor.c 2022-06-02 02:01:57.000000000 +0000 @@ -135,6 +135,8 @@ static SDLTest_CommonState *state; int done; static SDL_Cursor *cursors[1+SDL_NUM_SYSTEM_CURSORS]; +static SDL_SystemCursor cursor_types[1+SDL_NUM_SYSTEM_CURSORS]; +static int num_cursors; static int current_cursor; static int show_cursor; @@ -156,11 +158,34 @@ SDLTest_CommonEvent(state, &event, &done); if (event.type == SDL_MOUSEBUTTONDOWN) { if (event.button.button == SDL_BUTTON_LEFT) { + if (num_cursors == 0) { + continue; + } + ++current_cursor; - if (current_cursor == SDL_arraysize(cursors)) { + if (current_cursor == num_cursors) { current_cursor = 0; } + SDL_SetCursor(cursors[current_cursor]); + + switch (cursor_types[current_cursor]) { + case (SDL_SystemCursor)-1: SDL_Log("Custom cursor"); break; + case SDL_SYSTEM_CURSOR_ARROW: SDL_Log("Arrow"); break; + case SDL_SYSTEM_CURSOR_IBEAM: SDL_Log("I-beam"); break; + case SDL_SYSTEM_CURSOR_WAIT: SDL_Log("Wait"); break; + case SDL_SYSTEM_CURSOR_CROSSHAIR: SDL_Log("Crosshair"); break; + case SDL_SYSTEM_CURSOR_WAITARROW: SDL_Log("Small wait cursor (or Wait if not available)"); break; + case SDL_SYSTEM_CURSOR_SIZENWSE: SDL_Log("Double arrow pointing northwest and southeast"); break; + case SDL_SYSTEM_CURSOR_SIZENESW: SDL_Log("Double arrow pointing northeast and southwest"); break; + case SDL_SYSTEM_CURSOR_SIZEWE: SDL_Log("Double arrow pointing west and east"); break; + case SDL_SYSTEM_CURSOR_SIZENS: SDL_Log("Double arrow pointing north and south"); break; + case SDL_SYSTEM_CURSOR_SIZEALL: SDL_Log("Four pointed arrow pointing north, south, east, and west"); break; + case SDL_SYSTEM_CURSOR_NO: SDL_Log("Slashed circle or crossbones"); break; + case SDL_SYSTEM_CURSOR_HAND: SDL_Log("Hand"); break; + default: SDL_Log("UNKNOWN CURSOR TYPE, FIX THIS PROGRAM."); break; + } + } else { show_cursor = !show_cursor; SDL_ShowCursor(show_cursor); @@ -219,23 +244,38 @@ SDL_RenderClear(renderer); } + num_cursors = 0; + if (color_cursor) { - cursors[0] = init_color_cursor(color_cursor); + SDL_Cursor *cursor = init_color_cursor(color_cursor); + if (cursor) { + cursors[num_cursors] = cursor; + cursor_types[num_cursors] = (SDL_SystemCursor)-1; + num_cursors++; + } } else { - cursors[0] = init_system_cursor(arrow); - } - if (!cursors[0]) { - SDL_Log("Error, couldn't create cursor\n"); - quit(2); + SDL_Cursor *cursor = init_system_cursor(arrow); + if (cursor) { + cursors[num_cursors] = cursor; + cursor_types[num_cursors] = (SDL_SystemCursor)-1; + num_cursors++; + } } + for (i = 0; i < SDL_NUM_SYSTEM_CURSORS; ++i) { - cursors[1+i] = SDL_CreateSystemCursor((SDL_SystemCursor)i); - if (!cursors[1+i]) { - SDL_Log("Error, couldn't create system cursor %d\n", i); - quit(2); + SDL_Cursor *cursor = SDL_CreateSystemCursor((SDL_SystemCursor)i); + if (cursor) { + cursors[num_cursors] = cursor; + cursor_types[num_cursors] = i; + num_cursors++; } } - SDL_SetCursor(cursors[0]); + + if (num_cursors > 0) { + SDL_SetCursor(cursors[0]); + } + + show_cursor = SDL_ShowCursor(SDL_QUERY); /* Main render loop */ done = 0; @@ -247,7 +287,7 @@ } #endif - for (i = 0; i < SDL_arraysize(cursors); ++i) { + for (i = 0; i < num_cursors; ++i) { SDL_FreeCursor(cursors[i]); } quit(0); diff -Nru libsdl2-2.0.22+dfsg/test/testerror.c libsdl2-2.24.0+dfsg/test/testerror.c --- libsdl2-2.0.22+dfsg/test/testerror.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testerror.c 2022-06-02 02:01:57.000000000 +0000 @@ -58,6 +58,12 @@ /* Set the error value for the main thread */ SDL_SetError("No worries"); + if (SDL_getenv("SDL_TESTS_QUICK") != NULL) { + SDL_Log("Not running slower tests"); + SDL_Quit(); + return 0; + } + alive = 1; thread = SDL_CreateThread(ThreadFunc, NULL, "#1"); if (thread == NULL) { diff -Nru libsdl2-2.0.22+dfsg/test/testevdev.c libsdl2-2.24.0+dfsg/test/testevdev.c --- libsdl2-2.0.22+dfsg/test/testevdev.c 2022-04-21 17:37:37.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testevdev.c 2022-06-02 02:01:57.000000000 +0000 @@ -1019,7 +1019,7 @@ run_test(void) { printf("SDL compiled without evdev capability check.\n"); - return 0; + return 1; } #endif diff -Nru libsdl2-2.0.22+dfsg/test/testfilesystem.c libsdl2-2.24.0+dfsg/test/testfilesystem.c --- libsdl2-2.0.22+dfsg/test/testfilesystem.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testfilesystem.c 2022-08-13 03:48:10.000000000 +0000 @@ -37,7 +37,7 @@ SDL_free(base_path); } - pref_path = SDL_GetPrefPath("libsdl", "testfilesystem"); + pref_path = SDL_GetPrefPath("libsdl", "test_filesystem"); if(pref_path == NULL){ SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find pref path: %s\n", SDL_GetError()); @@ -46,7 +46,7 @@ SDL_free(pref_path); } - pref_path = SDL_GetPrefPath(NULL, "testfilesystem"); + pref_path = SDL_GetPrefPath(NULL, "test_filesystem"); if(pref_path == NULL){ SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find pref path without organization: %s\n", SDL_GetError()); diff -Nru libsdl2-2.0.22+dfsg/test/testgamecontroller.c libsdl2-2.24.0+dfsg/test/testgamecontroller.c --- libsdl2-2.0.22+dfsg/test/testgamecontroller.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testgamecontroller.c 2022-08-13 03:48:10.000000000 +0000 @@ -17,6 +17,7 @@ #include #include "SDL.h" +#include "testutils.h" #ifdef __EMSCRIPTEN__ #include @@ -27,6 +28,10 @@ #define SCREEN_WIDTH 512 #define SCREEN_HEIGHT 320 +#define BUTTON_SIZE 50 +#define AXIS_SIZE 50 + + /* This is indexed by SDL_GameControllerButton. */ static const struct { int x; int y; } button_positions[] = { {387, 167}, /* SDL_CONTROLLER_BUTTON_A */ @@ -49,7 +54,9 @@ {330, 135}, /* SDL_CONTROLLER_BUTTON_PADDLE2 */ {132, 175}, /* SDL_CONTROLLER_BUTTON_PADDLE3 */ {330, 175}, /* SDL_CONTROLLER_BUTTON_PADDLE4 */ + {0, 0}, /* SDL_CONTROLLER_BUTTON_TOUCHPAD */ }; +SDL_COMPILE_TIME_ASSERT(button_positions, SDL_arraysize(button_positions) == SDL_CONTROLLER_BUTTON_MAX); /* This is indexed by SDL_GameControllerAxis. */ static const struct { int x; int y; double angle; } axis_positions[] = { @@ -60,6 +67,18 @@ {91, -20, 0.0}, /* TRIGGERLEFT */ {375, -20, 0.0}, /* TRIGGERRIGHT */ }; +SDL_COMPILE_TIME_ASSERT(axis_positions, SDL_arraysize(axis_positions) == SDL_CONTROLLER_AXIS_MAX); + +/* This is indexed by SDL_JoystickPowerLevel + 1. */ +static const char* power_level_strings[] = { + "unknown", /* SDL_JOYSTICK_POWER_UNKNOWN */ + "empty", /* SDL_JOYSTICK_POWER_EMPTY */ + "low", /* SDL_JOYSTICK_POWER_LOW */ + "medium", /* SDL_JOYSTICK_POWER_MEDIUM */ + "full", /* SDL_JOYSTICK_POWER_FULL */ + "wired", /* SDL_JOYSTICK_POWER_WIRED */ +}; +SDL_COMPILE_TIME_ASSERT(power_level_strings, SDL_arraysize(power_level_strings) == SDL_JOYSTICK_POWER_MAX + 1); static SDL_Window *window = NULL; static SDL_Renderer *screen = NULL; @@ -71,6 +90,11 @@ static SDL_GameController *gamecontroller; static SDL_GameController **gamecontrollers; static int num_controllers = 0; +static SDL_Joystick *virtual_joystick = NULL; +static SDL_GameControllerAxis virtual_axis_active = SDL_CONTROLLER_AXIS_INVALID; +static int virtual_axis_start_x; +static int virtual_axis_start_y; +static SDL_GameControllerButton virtual_button_active = SDL_CONTROLLER_BUTTON_INVALID; static void UpdateWindowTitle() { @@ -120,6 +144,7 @@ SDL_JoystickID controller_id = SDL_JoystickGetDeviceInstanceID(device_index); SDL_GameController *controller; SDL_GameController **controllers; + Uint16 firmware_version; controller_id = SDL_JoystickGetDeviceInstanceID(device_index); if (controller_id < 0) { @@ -151,7 +176,15 @@ if (verbose) { const char *name = SDL_GameControllerName(gamecontroller); - SDL_Log("Opened game controller %s\n", name); + const char *path = SDL_GameControllerPath(gamecontroller); + SDL_Log("Opened game controller %s%s%s\n", name, path ? ", " : "", path ? path : ""); + } + + firmware_version = SDL_GameControllerGetFirmwareVersion(gamecontroller); + if (firmware_version) { + if (verbose) { + SDL_Log("Firmware version: 0x%x (%d)\n", firmware_version, firmware_version); + } } if (SDL_GameControllerHasSensor(gamecontroller, SDL_SENSOR_ACCEL)) { @@ -216,34 +249,6 @@ UpdateWindowTitle(); } -static SDL_Texture * -LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent) -{ - SDL_Surface *temp = NULL; - SDL_Texture *texture = NULL; - - temp = SDL_LoadBMP(file); - if (temp == NULL) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError()); - } else { - /* Set transparent pixel as the pixel at (0,0) */ - if (transparent) { - if (temp->format->BytesPerPixel == 1) { - SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *)temp->pixels); - } - } - - texture = SDL_CreateTextureFromSurface(renderer, temp); - if (!texture) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); - } - } - if (temp) { - SDL_FreeSurface(temp); - } - return texture; -} - static Uint16 ConvertAxisToRumble(Sint16 axisval) { /* Only start rumbling if the axis is past the halfway point */ @@ -306,12 +311,223 @@ SDL_GameControllerSendEffect(gamecontroller, &state, sizeof(state)); } +static SDL_bool ShowingFront() +{ + SDL_bool showing_front = SDL_TRUE; + int i; + + if (gamecontroller) { + /* Show the back of the controller if the paddles are being held */ + for (i = SDL_CONTROLLER_BUTTON_PADDLE1; i <= SDL_CONTROLLER_BUTTON_PADDLE4; ++i) { + if (SDL_GameControllerGetButton(gamecontroller, (SDL_GameControllerButton)i) == SDL_PRESSED) { + showing_front = SDL_FALSE; + break; + } + } + } + if ((SDL_GetModState() & KMOD_SHIFT) != 0) { + showing_front = SDL_FALSE; + } + return showing_front; +} + +static void SDLCALL VirtualControllerSetPlayerIndex(void *userdata, int player_index) +{ + SDL_Log("Virtual Controller: player index set to %d\n", player_index); +} + +static int SDLCALL VirtualControllerRumble(void *userdata, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble) +{ + SDL_Log("Virtual Controller: rumble set to %d/%d\n", low_frequency_rumble, high_frequency_rumble); + return 0; +} + +static int SDLCALL VirtualControllerRumbleTriggers(void *userdata, Uint16 left_rumble, Uint16 right_rumble) +{ + SDL_Log("Virtual Controller: trigger rumble set to %d/%d\n", left_rumble, right_rumble); + return 0; +} + +static int SDLCALL VirtualControllerSetLED(void *userdata, Uint8 red, Uint8 green, Uint8 blue) +{ + SDL_Log("Virtual Controller: LED set to RGB %d,%d,%d\n", red, green, blue); + return 0; +} + +static void OpenVirtualController() +{ + SDL_VirtualJoystickDesc desc; + int virtual_index; + + SDL_zero(desc); + desc.version = SDL_VIRTUAL_JOYSTICK_DESC_VERSION; + desc.type = SDL_JOYSTICK_TYPE_GAMECONTROLLER; + desc.naxes = SDL_CONTROLLER_AXIS_MAX; + desc.nbuttons = SDL_CONTROLLER_BUTTON_MAX; + desc.SetPlayerIndex = VirtualControllerSetPlayerIndex; + desc.Rumble = VirtualControllerRumble; + desc.RumbleTriggers = VirtualControllerRumbleTriggers; + desc.SetLED = VirtualControllerSetLED; + + virtual_index = SDL_JoystickAttachVirtualEx(&desc); + if (virtual_index < 0) { + SDL_Log("Couldn't open virtual device: %s\n", SDL_GetError()); + } else { + virtual_joystick = SDL_JoystickOpen(virtual_index); + if (!virtual_joystick) { + SDL_Log("Couldn't open virtual device: %s\n", SDL_GetError()); + } + } +} + +static void CloseVirtualController() +{ + int i; + + for (i = SDL_NumJoysticks(); i--; ) { + if (SDL_JoystickIsVirtual(i)) { + SDL_JoystickDetachVirtual(i); + } + } + + if (virtual_joystick) { + SDL_JoystickClose(virtual_joystick); + virtual_joystick = NULL; + } +} + +static SDL_GameControllerButton FindButtonAtPosition(int x, int y) +{ + SDL_Point point; + int i; + SDL_bool showing_front = ShowingFront(); + + point.x = x; + point.y = y; + for (i = 0; i < SDL_CONTROLLER_BUTTON_TOUCHPAD; ++i) { + SDL_bool on_front = (i < SDL_CONTROLLER_BUTTON_PADDLE1 || i > SDL_CONTROLLER_BUTTON_PADDLE4); + if (on_front == showing_front) { + SDL_Rect rect; + rect.x = button_positions[i].x; + rect.y = button_positions[i].y; + rect.w = BUTTON_SIZE; + rect.h = BUTTON_SIZE; + if (SDL_PointInRect(&point, &rect)) { + return (SDL_GameControllerButton)i; + } + } + } + return SDL_CONTROLLER_BUTTON_INVALID; +} + +static SDL_GameControllerAxis FindAxisAtPosition(int x, int y) +{ + SDL_Point point; + int i; + SDL_bool showing_front = ShowingFront(); + + point.x = x; + point.y = y; + for (i = 0; i < SDL_CONTROLLER_AXIS_MAX; ++i) { + if (showing_front) { + SDL_Rect rect; + rect.x = axis_positions[i].x; + rect.y = axis_positions[i].y; + rect.w = AXIS_SIZE; + rect.h = AXIS_SIZE; + if (SDL_PointInRect(&point, &rect)) { + return (SDL_GameControllerAxis)i; + } + } + } + return SDL_CONTROLLER_AXIS_INVALID; +} + +static void VirtualControllerMouseMotion(int x, int y) +{ + if (virtual_button_active != SDL_CONTROLLER_BUTTON_INVALID) { + if (virtual_axis_active != SDL_CONTROLLER_AXIS_INVALID) { + const int MOVING_DISTANCE = 2; + if (SDL_abs(x - virtual_axis_start_x) >= MOVING_DISTANCE || + SDL_abs(y - virtual_axis_start_y) >= MOVING_DISTANCE) { + SDL_JoystickSetVirtualButton(virtual_joystick, virtual_button_active, SDL_RELEASED); + virtual_button_active = SDL_CONTROLLER_BUTTON_INVALID; + } + } + } + + if (virtual_axis_active != SDL_CONTROLLER_AXIS_INVALID) { + if (virtual_axis_active == SDL_CONTROLLER_AXIS_TRIGGERLEFT || + virtual_axis_active == SDL_CONTROLLER_AXIS_TRIGGERRIGHT) { + int range = (SDL_JOYSTICK_AXIS_MAX - SDL_JOYSTICK_AXIS_MIN); + float distance = SDL_clamp(((float)y - virtual_axis_start_y) / AXIS_SIZE, 0.0f, 1.0f); + Sint16 value = (Sint16)(SDL_JOYSTICK_AXIS_MIN + (distance * range)); + SDL_JoystickSetVirtualAxis(virtual_joystick, virtual_axis_active, value); + } else { + float distanceX = SDL_clamp(((float)x - virtual_axis_start_x) / AXIS_SIZE, -1.0f, 1.0f); + float distanceY = SDL_clamp(((float)y - virtual_axis_start_y) / AXIS_SIZE, -1.0f, 1.0f); + Sint16 valueX, valueY; + + if (distanceX >= 0) { + valueX = (Sint16)(distanceX * SDL_JOYSTICK_AXIS_MAX); + } else { + valueX = (Sint16)(distanceX * -SDL_JOYSTICK_AXIS_MIN); + } + if (distanceY >= 0) { + valueY = (Sint16)(distanceY * SDL_JOYSTICK_AXIS_MAX); + } else { + valueY = (Sint16)(distanceY * -SDL_JOYSTICK_AXIS_MIN); + } + SDL_JoystickSetVirtualAxis(virtual_joystick, virtual_axis_active, valueX); + SDL_JoystickSetVirtualAxis(virtual_joystick, virtual_axis_active+1, valueY); + } + } +} + +static void VirtualControllerMouseDown(int x, int y) +{ + SDL_GameControllerButton button; + SDL_GameControllerAxis axis; + + button = FindButtonAtPosition(x, y); + if (button != SDL_CONTROLLER_BUTTON_INVALID) { + virtual_button_active = button; + SDL_JoystickSetVirtualButton(virtual_joystick, virtual_button_active, SDL_PRESSED); + } + + axis = FindAxisAtPosition(x, y); + if (axis != SDL_CONTROLLER_AXIS_INVALID) { + virtual_axis_active = axis; + virtual_axis_start_x = x; + virtual_axis_start_y = y; + } +} + +static void VirtualControllerMouseUp(int x, int y) +{ + if (virtual_button_active != SDL_CONTROLLER_BUTTON_INVALID) { + SDL_JoystickSetVirtualButton(virtual_joystick, virtual_button_active, SDL_RELEASED); + virtual_button_active = SDL_CONTROLLER_BUTTON_INVALID; + } + + if (virtual_axis_active != SDL_CONTROLLER_AXIS_INVALID) { + if (virtual_axis_active == SDL_CONTROLLER_AXIS_TRIGGERLEFT || + virtual_axis_active == SDL_CONTROLLER_AXIS_TRIGGERRIGHT) { + SDL_JoystickSetVirtualAxis(virtual_joystick, virtual_axis_active, SDL_JOYSTICK_AXIS_MIN); + } else { + SDL_JoystickSetVirtualAxis(virtual_joystick, virtual_axis_active, 0); + SDL_JoystickSetVirtualAxis(virtual_joystick, virtual_axis_active+1, 0); + } + virtual_axis_active = SDL_CONTROLLER_AXIS_INVALID; + } +} + void loop(void *arg) { SDL_Event event; int i; - SDL_bool showing_front = SDL_TRUE; + SDL_bool showing_front; /* Update to get the current event state */ SDL_PumpEvents(); @@ -382,6 +598,28 @@ } break; + case SDL_JOYBATTERYUPDATED: + SDL_Log("Controller %d battery state changed to %s\n", event.jbattery.which, power_level_strings[event.jbattery.level + 1]); + break; + + case SDL_MOUSEBUTTONDOWN: + if (virtual_joystick) { + VirtualControllerMouseDown(event.button.x, event.button.y); + } + break; + + case SDL_MOUSEBUTTONUP: + if (virtual_joystick) { + VirtualControllerMouseUp(event.button.x, event.button.y); + } + break; + + case SDL_MOUSEMOTION: + if (virtual_joystick) { + VirtualControllerMouseMotion(event.motion.x, event.motion.y); + } + break; + case SDL_KEYDOWN: if (event.key.keysym.sym >= SDLK_0 && event.key.keysym.sym <= SDLK_9) { if (gamecontroller) { @@ -391,6 +629,14 @@ } break; } + if (event.key.keysym.sym == SDLK_a) { + OpenVirtualController(); + break; + } + if (event.key.keysym.sym == SDLK_d) { + CloseVirtualController(); + break; + } if (event.key.keysym.sym != SDLK_ESCAPE) { break; } @@ -403,15 +649,7 @@ } } - if (gamecontroller) { - /* Show the back of the controller if the paddles are being held */ - for (i = SDL_CONTROLLER_BUTTON_PADDLE1; i <= SDL_CONTROLLER_BUTTON_PADDLE4; ++i) { - if (SDL_GameControllerGetButton(gamecontroller, (SDL_GameControllerButton)i) == SDL_PRESSED) { - showing_front = SDL_FALSE; - break; - } - } - } + showing_front = ShowingFront(); /* blank screen, set up for drawing this frame. */ SDL_SetRenderDrawColor(screen, 0xFF, 0xFF, 0xFF, SDL_ALPHA_OPAQUE); @@ -427,8 +665,8 @@ SDL_Rect dst; dst.x = button_positions[i].x; dst.y = button_positions[i].y; - dst.w = 50; - dst.h = 50; + dst.w = BUTTON_SIZE; + dst.h = BUTTON_SIZE; SDL_RenderCopyEx(screen, button, NULL, &dst, 0, NULL, SDL_FLIP_NONE); } } @@ -443,16 +681,16 @@ SDL_Rect dst; dst.x = axis_positions[i].x; dst.y = axis_positions[i].y; - dst.w = 50; - dst.h = 50; + dst.w = AXIS_SIZE; + dst.h = AXIS_SIZE; SDL_RenderCopyEx(screen, axis, NULL, &dst, angle, NULL, SDL_FLIP_NONE); } else if (value > deadzone) { const double angle = axis_positions[i].angle + 180.0; SDL_Rect dst; dst.x = axis_positions[i].x; dst.y = axis_positions[i].y; - dst.w = 50; - dst.h = 50; + dst.w = AXIS_SIZE; + dst.h = AXIS_SIZE; SDL_RenderCopyEx(screen, axis, NULL, &dst, angle, NULL, SDL_FLIP_NONE); } } @@ -507,7 +745,7 @@ } } } - + SDL_Delay(16); SDL_RenderPresent(screen); #ifdef __EMSCRIPTEN__ @@ -526,7 +764,6 @@ char guid[64]; SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "0"); - SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, "1"); SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE, "1"); SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE, "1"); SDL_SetHint(SDL_HINT_JOYSTICK_ROG_CHAKRAM, "1"); @@ -560,6 +797,7 @@ /* Print information about the controller */ for (i = 0; i < SDL_NumJoysticks(); ++i) { const char *name; + const char *path; const char *description; SDL_JoystickGetGUIDString(SDL_JoystickGetDeviceGUID(i), @@ -568,6 +806,7 @@ if (SDL_IsGameController(i)) { controller_count++; name = SDL_GameControllerNameForIndex(i); + path = SDL_GameControllerPathForIndex(i); switch (SDL_GameControllerTypeForIndex(i)) { case SDL_CONTROLLER_TYPE_AMAZON_LUNA: description = "Amazon Luna Controller"; @@ -575,6 +814,11 @@ case SDL_CONTROLLER_TYPE_GOOGLE_STADIA: description = "Google Stadia Controller"; break; + case SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_LEFT: + case SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT: + case SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR: + description = "Nintendo Switch Joy-Con"; + break; case SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO: description = "Nintendo Switch Pro Controller"; break; @@ -603,10 +847,11 @@ AddController(i, SDL_FALSE); } else { name = SDL_JoystickNameForIndex(i); + path = SDL_JoystickPathForIndex(i); description = "Joystick"; } - SDL_Log("%s %d: %s (guid %s, VID 0x%.4x, PID 0x%.4x, player index = %d)\n", - description, i, name ? name : "Unknown", guid, + SDL_Log("%s %d: %s%s%s (guid %s, VID 0x%.4x, PID 0x%.4x, player index = %d)\n", + description, i, name ? name : "Unknown", path ? ", " : "", path ? path : "", guid, SDL_JoystickGetDeviceVendor(i), SDL_JoystickGetDeviceProduct(i), SDL_JoystickGetDevicePlayerIndex(i)); } SDL_Log("There are %d game controller(s) attached (%d joystick(s))\n", controller_count, SDL_NumJoysticks()); @@ -634,10 +879,10 @@ /* scale for platforms that don't give you the window size you asked for. */ SDL_RenderSetLogicalSize(screen, SCREEN_WIDTH, SCREEN_HEIGHT); - background_front = LoadTexture(screen, "controllermap.bmp", SDL_FALSE); - background_back = LoadTexture(screen, "controllermap_back.bmp", SDL_FALSE); - button = LoadTexture(screen, "button.bmp", SDL_TRUE); - axis = LoadTexture(screen, "axis.bmp", SDL_TRUE); + background_front = LoadTexture(screen, "controllermap.bmp", SDL_FALSE, NULL, NULL); + background_back = LoadTexture(screen, "controllermap_back.bmp", SDL_FALSE, NULL, NULL); + button = LoadTexture(screen, "button.bmp", SDL_TRUE, NULL, NULL); + axis = LoadTexture(screen, "axis.bmp", SDL_TRUE, NULL, NULL); if (!background_front || !background_back || !button || !axis) { SDL_DestroyRenderer(screen); @@ -650,8 +895,14 @@ /* !!! FIXME: */ /*SDL_RenderSetLogicalSize(screen, background->w, background->h);*/ - if (argv[1] && *argv[1] != '-') { - controller_index = SDL_atoi(argv[1]); + for (i = 1; i < argc; ++i) { + if (SDL_strcmp(argv[i], "--virtual") == 0) { + OpenVirtualController(); + } + if (argv[i] && *argv[i] != '-') { + controller_index = SDL_atoi(argv[i]); + break; + } } if (controller_index < num_controllers) { gamecontroller = gamecontrollers[controller_index]; @@ -675,6 +926,7 @@ CyclePS5TriggerEffect(); } + CloseVirtualController(); SDL_DestroyRenderer(screen); SDL_DestroyWindow(window); SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER); diff -Nru libsdl2-2.0.22+dfsg/test/testgeometry.c libsdl2-2.24.0+dfsg/test/testgeometry.c --- libsdl2-2.0.22+dfsg/test/testgeometry.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testgeometry.c 2022-06-02 02:01:57.000000000 +0000 @@ -21,6 +21,7 @@ #endif #include "SDL_test_common.h" +#include "testutils.h" static SDLTest_CommonState *state; static SDL_bool use_texture = SDL_FALSE; @@ -44,54 +45,19 @@ LoadSprite(const char *file) { int i; - SDL_Surface *temp; - /* Load the sprite image */ - temp = SDL_LoadBMP(file); - if (temp == NULL) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError()); - return (-1); - } - sprite_w = temp->w; - sprite_h = temp->h; - - /* Set transparent pixel as the pixel at (0,0) */ - if (temp->format->palette) { - SDL_SetColorKey(temp, 1, *(Uint8 *) temp->pixels); - } else { - switch (temp->format->BitsPerPixel) { - case 15: - SDL_SetColorKey(temp, 1, (*(Uint16 *) temp->pixels) & 0x00007FFF); - break; - case 16: - SDL_SetColorKey(temp, 1, *(Uint16 *) temp->pixels); - break; - case 24: - SDL_SetColorKey(temp, 1, (*(Uint32 *) temp->pixels) & 0x00FFFFFF); - break; - case 32: - SDL_SetColorKey(temp, 1, *(Uint32 *) temp->pixels); - break; - } - } - - /* Create textures from the image */ for (i = 0; i < state->num_windows; ++i) { - SDL_Renderer *renderer = state->renderers[i]; - sprites[i] = SDL_CreateTextureFromSurface(renderer, temp); + /* This does the SDL_LoadBMP step repeatedly, but that's OK for test code. */ + sprites[i] = LoadTexture(state->renderers[i], file, SDL_TRUE, &sprite_w, &sprite_h); if (!sprites[i]) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); - SDL_FreeSurface(temp); return (-1); } if (SDL_SetTextureBlendMode(sprites[i], blendMode) < 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set blend mode: %s\n", SDL_GetError()); - SDL_FreeSurface(temp); SDL_DestroyTexture(sprites[i]); return (-1); } } - SDL_FreeSurface(temp); /* We're ready to roll. :) */ return (0); diff -Nru libsdl2-2.0.22+dfsg/test/testgles2.c libsdl2-2.24.0+dfsg/test/testgles2.c --- libsdl2-2.0.22+dfsg/test/testgles2.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testgles2.c 2022-08-19 15:46:21.000000000 +0000 @@ -51,6 +51,13 @@ GLuint color_buffer; } shader_data; +typedef struct thread_data +{ + SDL_Thread *thread; + int done; + int index; +} thread_data; + static SDLTest_CommonState *state; static SDL_GLContext *context = NULL; static int depth = 16; @@ -434,6 +441,7 @@ if(data->angle_z >= 360) data->angle_z -= 360; if(data->angle_z < 0) data->angle_z += 360; + GL_CHECK(ctx.glViewport(0, 0, width, height)); GL_CHECK(ctx.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)); GL_CHECK(ctx.glDrawArrays(GL_TRIANGLES, 0, 36)); } @@ -441,56 +449,84 @@ int done; Uint32 frames; shader_data *datas; +thread_data *threads; + +static void +render_window(int index) +{ + int w, h, status; + + if (!state->windows[index]) { + return; + } + + status = SDL_GL_MakeCurrent(state->windows[index], context[index]); + if (status) { + SDL_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError()); + return; + } + + SDL_GL_GetDrawableSize(state->windows[index], &w, &h); + Render(w, h, &datas[index]); + SDL_GL_SwapWindow(state->windows[index]); + ++frames; +} -void loop() +static int SDLCALL +render_thread_fn(void* render_ctx) +{ + thread_data *thread = render_ctx; + + while (!done && !thread->done && state->windows[thread->index]) { + render_window(thread->index); + } + + SDL_GL_MakeCurrent(state->windows[thread->index], NULL); + return 0; +} + +static void +loop_threaded() { SDL_Event event; int i; - int status; - /* Check for events */ - ++frames; - while (SDL_PollEvent(&event) && !done) { - switch (event.type) { - case SDL_WINDOWEVENT: - switch (event.window.event) { - case SDL_WINDOWEVENT_RESIZED: - for (i = 0; i < state->num_windows; ++i) { - if (event.window.windowID == SDL_GetWindowID(state->windows[i])) { - int w, h; - status = SDL_GL_MakeCurrent(state->windows[i], context[i]); - if (status) { - SDL_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError()); - break; - } - /* Change view port to the new window dimensions */ - SDL_GL_GetDrawableSize(state->windows[i], &w, &h); - ctx.glViewport(0, 0, w, h); - state->window_w = event.window.data1; - state->window_h = event.window.data2; - /* Update window content */ - Render(event.window.data1, event.window.data2, &datas[i]); - SDL_GL_SwapWindow(state->windows[i]); - break; + /* Wait for events */ + while (SDL_WaitEvent(&event) && !done) { + if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_CLOSE) { + SDL_Window *window = SDL_GetWindowFromID(event.window.windowID); + if (window) { + for (i = 0; i < state->num_windows; ++i) { + if (window == state->windows[i]) { + /* Stop the render thread when the window is closed */ + threads[i].done = 1; + if (threads[i].thread) { + SDL_WaitThread(threads[i].thread, NULL); + threads[i].thread = NULL; } + break; } - break; + } } } SDLTest_CommonEvent(state, &event, &done); } +} + +static void +loop() +{ + SDL_Event event; + int i; + + /* Check for events */ + while (SDL_PollEvent(&event) && !done) { + SDLTest_CommonEvent(state, &event, &done); + } if (!done) { - for (i = 0; i < state->num_windows; ++i) { - status = SDL_GL_MakeCurrent(state->windows[i], context[i]); - if (status) { - SDL_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError()); - - /* Continue for next window */ - continue; - } - Render(state->window_w, state->window_h, &datas[i]); - SDL_GL_SwapWindow(state->windows[i]); - } + for (i = 0; i < state->num_windows; ++i) { + render_window(i); + } } #ifdef __EMSCRIPTEN__ else { @@ -502,7 +538,7 @@ int main(int argc, char *argv[]) { - int fsaa, accel; + int fsaa, accel, threaded; int value; int i; SDL_DisplayMode mode; @@ -513,6 +549,7 @@ /* Initialize parameters */ fsaa = 0; accel = 0; + threaded = 0; /* Initialize test framework */ state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); @@ -530,6 +567,9 @@ } else if (SDL_strcasecmp(argv[i], "--accel") == 0) { ++accel; consumed = 1; + } else if (SDL_strcasecmp(argv[i], "--threaded") == 0) { + ++threaded; + consumed = 1; } else if (SDL_strcasecmp(argv[i], "--zdepth") == 0) { i++; if (!argv[i]) { @@ -543,7 +583,7 @@ } } if (consumed < 0) { - static const char *options[] = { "[--fsaa]", "[--accel]", "[--zdepth %d]", NULL }; + static const char *options[] = { "[--fsaa]", "[--accel]", "[--zdepth %d]", "[--threaded]", NULL }; SDLTest_CommonLogUsage(state, argv[0], options); quit(1); } @@ -551,7 +591,7 @@ } /* Set OpenGL parameters */ - state->window_flags |= SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_BORDERLESS; + state->window_flags |= SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE; state->gl_red_size = 5; state->gl_green_size = 5; state->gl_blue_size = 5; @@ -603,6 +643,7 @@ } SDL_GetCurrentDisplayMode(0, &mode); + SDL_Log("Threaded : %s\n", threaded ? "yes" : "no"); SDL_Log("Screen bpp: %d\n", SDL_BITSPERPIXEL(mode.format)); SDL_Log("\n"); SDL_Log("Vendor : %s\n", ctx.glGetString(GL_VENDOR)); @@ -724,6 +765,8 @@ GL_CHECK(ctx.glEnable(GL_CULL_FACE)); GL_CHECK(ctx.glEnable(GL_DEPTH_TEST)); + + SDL_GL_MakeCurrent(state->windows[i], NULL); } /* Main render loop */ @@ -734,8 +777,30 @@ #ifdef __EMSCRIPTEN__ emscripten_set_main_loop(loop, 0, 1); #else - while (!done) { - loop(); + if (threaded) { + threads = (thread_data*)SDL_calloc(state->num_windows, sizeof(thread_data)); + + /* Start a render thread for each window */ + for (i = 0; i < state->num_windows; ++i) { + threads[i].index = i; + threads[i].thread = SDL_CreateThread(render_thread_fn, "RenderThread", &threads[i]); + } + + while (!done) { + loop_threaded(); + } + + /* Join the remaining render threads (if any) */ + for (i = 0; i < state->num_windows; ++i) { + threads[i].done = 1; + if (threads[i].thread) { + SDL_WaitThread(threads[i].thread, NULL); + } + } + } else { + while (!done) { + loop(); + } } #endif diff -Nru libsdl2-2.0.22+dfsg/test/testgles2_sdf.c libsdl2-2.24.0+dfsg/test/testgles2_sdf.c --- libsdl2-2.0.22+dfsg/test/testgles2_sdf.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testgles2_sdf.c 2022-06-02 02:01:57.000000000 +0000 @@ -458,6 +458,7 @@ Uint32 then, now; int status; shader_data *data; + char *path = NULL; /* Initialize parameters */ fsaa = 0; @@ -561,14 +562,25 @@ /* Load SDF BMP image */ #if 1 - tmp = SDL_LoadBMP(f); + path = GetNearbyFilename(f); + + if (path == NULL) + path = SDL_strdup(f); + + if (path == NULL) { + SDL_Log("out of memory\n"); + exit(-1); + } + + tmp = SDL_LoadBMP(path); if (tmp == NULL) { - SDL_Log("missing image file: %s", f); + SDL_Log("missing image file: %s", path); exit(-1); } else { - SDL_Log("Load image file: %s", f); + SDL_Log("Load image file: %s", path); } + SDL_free(path); #else /* Generate SDF image using SDL_ttf */ diff -Nru libsdl2-2.0.22+dfsg/test/testiconv.c libsdl2-2.24.0+dfsg/test/testiconv.c --- libsdl2-2.0.22+dfsg/test/testiconv.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testiconv.c 2022-06-02 02:01:57.000000000 +0000 @@ -13,6 +13,7 @@ #include #include "SDL.h" +#include "testutils.h" static size_t widelen(char *data) @@ -43,7 +44,7 @@ "UCS-4", }; - const char * fname; + char * fname; char buffer[BUFSIZ]; char *ucs4; char *test[2]; @@ -54,12 +55,13 @@ /* Enable standard application logging */ SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); - fname = (argc < 2) ? "utf8.txt" : argv[1]; + fname = GetResourceFilename(argc > 1 ? argv[1] : NULL, "utf8.txt"); file = fopen(fname, "rb"); if (!file) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to open %s\n", fname); return (1); } + SDL_free(fname); while (fgets(buffer, sizeof(buffer), file)) { /* Convert to UCS-4 */ diff -Nru libsdl2-2.0.22+dfsg/test/testime.c libsdl2-2.24.0+dfsg/test/testime.c --- libsdl2-2.0.22+dfsg/test/testime.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testime.c 2022-06-02 02:01:57.000000000 +0000 @@ -23,6 +23,7 @@ #endif #include "SDL_test_common.h" +#include "testutils.h" #define DEFAULT_PTSIZE 30 #ifdef HAVE_SDL_TTF @@ -108,6 +109,7 @@ SDL_RWops *hexFile; const size_t unifontGlyphSize = UNIFONT_NUM_GLYPHS * sizeof(struct UnifontGlyph); const size_t unifontTextureSize = UNIFONT_NUM_TEXTURES * state->num_windows * sizeof(void *); + char *filename; /* Allocate memory for the glyph data so the file can be closed after initialization. */ unifontGlyph = (struct UnifontGlyph *)SDL_malloc(unifontGlyphSize); @@ -127,7 +129,13 @@ } SDL_memset(unifontTexture, 0, unifontTextureSize); - hexFile = SDL_RWFromFile(fontname, "rb"); + filename = GetResourceFilename(NULL, fontname); + if (filename == NULL) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory\n"); + return -1; + } + hexFile = SDL_RWFromFile(filename, "rb"); + SDL_free(filename); if (hexFile == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to open font file: %s\n", fontname); diff -Nru libsdl2-2.0.22+dfsg/test/testmultiaudio.c libsdl2-2.24.0+dfsg/test/testmultiaudio.c --- libsdl2-2.0.22+dfsg/test/testmultiaudio.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testmultiaudio.c 2022-06-02 02:01:57.000000000 +0000 @@ -17,6 +17,8 @@ #include #endif +#include "testutils.h" + static SDL_AudioSpec spec; static Uint8 *sound = NULL; /* Pointer to wave data */ static Uint32 soundlen = 0; /* Length of wave data */ @@ -180,7 +182,7 @@ if (devcount < 1) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Don't see any specific audio devices!\n"); } else { - const char *file = (argc < 2) ? "sample.wav" : argv[1]; + char *file = GetResourceFilename(argc > 1 ? argv[1] : NULL, "sample.wav"); /* Load the wave file into memory */ if (SDL_LoadWAV(file, &spec, &sound, &soundlen) == NULL) { @@ -190,6 +192,8 @@ test_multi_audio(devcount); SDL_FreeWAV(sound); } + + SDL_free(file); } SDL_Quit(); diff -Nru libsdl2-2.0.22+dfsg/test/testnative.c libsdl2-2.24.0+dfsg/test/testnative.c --- libsdl2-2.0.22+dfsg/test/testnative.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testnative.c 2022-06-02 02:01:57.000000000 +0000 @@ -16,6 +16,7 @@ #include /* for time() */ #include "testnative.h" +#include "testutils.h" #define WINDOW_W 640 #define WINDOW_H 480 @@ -52,37 +53,6 @@ exit(rc); } -SDL_Texture * -LoadSprite(SDL_Renderer *renderer, const char *file) -{ - SDL_Surface *temp; - SDL_Texture *sprite; - - /* Load the sprite image */ - temp = SDL_LoadBMP(file); - if (temp == NULL) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError()); - return 0; - } - - /* Set transparent pixel as the pixel at (0,0) */ - if (temp->format->palette) { - SDL_SetColorKey(temp, 1, *(Uint8 *) temp->pixels); - } - - /* Create textures from the image */ - sprite = SDL_CreateTextureFromSurface(renderer, temp); - if (!sprite) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); - SDL_FreeSurface(temp); - return 0; - } - SDL_FreeSurface(temp); - - /* We're ready to roll. :) */ - return sprite; -} - void MoveSprites(SDL_Renderer * renderer, SDL_Texture * sprite) { @@ -180,7 +150,7 @@ SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF); SDL_RenderClear(renderer); - sprite = LoadSprite(renderer, "icon.bmp"); + sprite = LoadTexture(renderer, "icon.bmp", SDL_TRUE, NULL, NULL); if (!sprite) { quit(6); } diff -Nru libsdl2-2.0.22+dfsg/test/testoverlay2.c libsdl2-2.24.0+dfsg/test/testoverlay2.c --- libsdl2-2.0.22+dfsg/test/testoverlay2.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testoverlay2.c 2022-06-02 02:01:57.000000000 +0000 @@ -25,6 +25,7 @@ #include "SDL.h" #include "testyuv_cvt.h" +#include "testutils.h" #define MOOSEPIC_W 64 #define MOOSEPIC_H 88 @@ -243,6 +244,7 @@ int fps = 12; int nodelay = 0; int scale = 5; + char *filename = NULL; /* Enable standard application logging */ SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); @@ -315,7 +317,13 @@ } /* load the trojan moose images */ - handle = SDL_RWFromFile("moose.dat", "rb"); + filename = GetResourceFilename(NULL, "moose.dat"); + if (filename == NULL) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory\n"); + return -1; + } + handle = SDL_RWFromFile(filename, "rb"); + SDL_free(filename); if (handle == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't find the file moose.dat !\n"); SDL_free(RawMooseData); diff -Nru libsdl2-2.0.22+dfsg/test/testplatform.c libsdl2-2.24.0+dfsg/test/testplatform.c --- libsdl2-2.0.22+dfsg/test/testplatform.c 2022-04-09 01:19:19.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testplatform.c 2022-06-02 02:01:57.000000000 +0000 @@ -86,18 +86,25 @@ int error = 0; Uint16 value = 0x1234; int real_byteorder; + int real_floatwordorder = 0; Uint16 value16 = 0xCDAB; Uint16 swapped16 = 0xABCD; Uint32 value32 = 0xEFBEADDE; Uint32 swapped32 = 0xDEADBEEF; Uint64 value64, swapped64; + union { + double d; + Uint32 ui32[2]; + } value_double; + value64 = 0xEFBEADDE; value64 <<= 32; value64 |= 0xCDAB3412; swapped64 = 0x1234ABCD; swapped64 <<= 32; swapped64 |= 0xDEADBEEF; + value_double.d = 3.141593; if (verbose) { SDL_Log("Detected a %s endian machine.\n", @@ -115,6 +122,22 @@ } ++error; } + if (verbose) { + SDL_Log("Detected a %s endian float word order machine.\n", + (SDL_FLOATWORDORDER == SDL_LIL_ENDIAN) ? "little" : "big"); + } + if (value_double.ui32[0] == 0x82c2bd7f && value_double.ui32[1] == 0x400921fb) { + real_floatwordorder = SDL_LIL_ENDIAN; + } else if (value_double.ui32[0] == 0x400921fb && value_double.ui32[1] == 0x82c2bd7f) { + real_floatwordorder = SDL_BIG_ENDIAN; + } + if (real_floatwordorder != SDL_FLOATWORDORDER) { + if (verbose) { + SDL_Log("Actually a %s endian float word order machine!\n", + (real_floatwordorder == SDL_LIL_ENDIAN) ? "little" : (real_floatwordorder == SDL_BIG_ENDIAN) ? "big" : "unknown" ); + } + ++error; + } if (verbose) { SDL_Log("Value 16 = 0x%X, swapped = 0x%X\n", value16, SDL_Swap16(value16)); diff -Nru libsdl2-2.0.22+dfsg/test/testqsort.c libsdl2-2.24.0+dfsg/test/testqsort.c --- libsdl2-2.0.22+dfsg/test/testqsort.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testqsort.c 2022-06-02 02:01:57.000000000 +0000 @@ -12,7 +12,7 @@ #include "SDL_test.h" -static int +static int SDLCALL num_compare(const void *_a, const void *_b) { const int a = *((const int *) _a); diff -Nru libsdl2-2.0.22+dfsg/test/testrendercopyex.c libsdl2-2.24.0+dfsg/test/testrendercopyex.c --- libsdl2-2.0.22+dfsg/test/testrendercopyex.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testrendercopyex.c 2022-06-02 02:01:57.000000000 +0000 @@ -20,7 +20,7 @@ #endif #include "SDL_test_common.h" - +#include "testutils.h" static SDLTest_CommonState *state; @@ -44,56 +44,6 @@ exit(rc); } -SDL_Texture * -LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent) -{ - SDL_Surface *temp; - SDL_Texture *texture; - - /* Load the sprite image */ - temp = SDL_LoadBMP(file); - if (temp == NULL) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError()); - return NULL; - } - - /* Set transparent pixel as the pixel at (0,0) */ - if (transparent) { - if (temp->format->palette) { - SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *) temp->pixels); - } else { - switch (temp->format->BitsPerPixel) { - case 15: - SDL_SetColorKey(temp, SDL_TRUE, - (*(Uint16 *) temp->pixels) & 0x00007FFF); - break; - case 16: - SDL_SetColorKey(temp, SDL_TRUE, *(Uint16 *) temp->pixels); - break; - case 24: - SDL_SetColorKey(temp, SDL_TRUE, - (*(Uint32 *) temp->pixels) & 0x00FFFFFF); - break; - case 32: - SDL_SetColorKey(temp, SDL_TRUE, *(Uint32 *) temp->pixels); - break; - } - } - } - - /* Create textures from the image */ - texture = SDL_CreateTextureFromSurface(renderer, temp); - if (!texture) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); - SDL_FreeSurface(temp); - return NULL; - } - SDL_FreeSurface(temp); - - /* We're ready to roll. :) */ - return texture; -} - void Draw(DrawState *s) { @@ -186,8 +136,8 @@ drawstate->window = state->windows[i]; drawstate->renderer = state->renderers[i]; - drawstate->sprite = LoadTexture(drawstate->renderer, "icon.bmp", SDL_TRUE); - drawstate->background = LoadTexture(drawstate->renderer, "sample.bmp", SDL_FALSE); + drawstate->sprite = LoadTexture(drawstate->renderer, "icon.bmp", SDL_TRUE, NULL, NULL); + drawstate->background = LoadTexture(drawstate->renderer, "sample.bmp", SDL_FALSE, NULL, NULL); if (!drawstate->sprite || !drawstate->background) { quit(2); } diff -Nru libsdl2-2.0.22+dfsg/test/testrendertarget.c libsdl2-2.24.0+dfsg/test/testrendertarget.c --- libsdl2-2.0.22+dfsg/test/testrendertarget.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testrendertarget.c 2022-06-02 02:01:57.000000000 +0000 @@ -20,7 +20,7 @@ #endif #include "SDL_test_common.h" - +#include "testutils.h" static SDLTest_CommonState *state; @@ -45,56 +45,6 @@ exit(rc); } -SDL_Texture * -LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent) -{ - SDL_Surface *temp; - SDL_Texture *texture; - - /* Load the sprite image */ - temp = SDL_LoadBMP(file); - if (temp == NULL) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError()); - return NULL; - } - - /* Set transparent pixel as the pixel at (0,0) */ - if (transparent) { - if (temp->format->palette) { - SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *) temp->pixels); - } else { - switch (temp->format->BitsPerPixel) { - case 15: - SDL_SetColorKey(temp, SDL_TRUE, - (*(Uint16 *) temp->pixels) & 0x00007FFF); - break; - case 16: - SDL_SetColorKey(temp, SDL_TRUE, *(Uint16 *) temp->pixels); - break; - case 24: - SDL_SetColorKey(temp, SDL_TRUE, - (*(Uint32 *) temp->pixels) & 0x00FFFFFF); - break; - case 32: - SDL_SetColorKey(temp, SDL_TRUE, *(Uint32 *) temp->pixels); - break; - } - } - } - - /* Create textures from the image */ - texture = SDL_CreateTextureFromSurface(renderer, temp); - if (!texture) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); - SDL_FreeSurface(temp); - return NULL; - } - SDL_FreeSurface(temp); - - /* We're ready to roll. :) */ - return texture; -} - SDL_bool DrawComposite(DrawState *s) { @@ -292,11 +242,11 @@ drawstate->window = state->windows[i]; drawstate->renderer = state->renderers[i]; if (test_composite) { - drawstate->sprite = LoadTexture(drawstate->renderer, "icon-alpha.bmp", SDL_TRUE); + drawstate->sprite = LoadTexture(drawstate->renderer, "icon-alpha.bmp", SDL_TRUE, NULL, NULL); } else { - drawstate->sprite = LoadTexture(drawstate->renderer, "icon.bmp", SDL_TRUE); + drawstate->sprite = LoadTexture(drawstate->renderer, "icon.bmp", SDL_TRUE, NULL, NULL); } - drawstate->background = LoadTexture(drawstate->renderer, "sample.bmp", SDL_FALSE); + drawstate->background = LoadTexture(drawstate->renderer, "sample.bmp", SDL_FALSE, NULL, NULL); if (!drawstate->sprite || !drawstate->background) { quit(2); } diff -Nru libsdl2-2.0.22+dfsg/test/testscale.c libsdl2-2.24.0+dfsg/test/testscale.c --- libsdl2-2.0.22+dfsg/test/testscale.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testscale.c 2022-06-02 02:01:57.000000000 +0000 @@ -20,6 +20,7 @@ #endif #include "SDL_test_common.h" +#include "testutils.h" #define WINDOW_WIDTH 640 #define WINDOW_HEIGHT 480 @@ -46,56 +47,6 @@ exit(rc); } -SDL_Texture * -LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent) -{ - SDL_Surface *temp; - SDL_Texture *texture; - - /* Load the sprite image */ - temp = SDL_LoadBMP(file); - if (temp == NULL) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError()); - return NULL; - } - - /* Set transparent pixel as the pixel at (0,0) */ - if (transparent) { - if (temp->format->palette) { - SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *) temp->pixels); - } else { - switch (temp->format->BitsPerPixel) { - case 15: - SDL_SetColorKey(temp, SDL_TRUE, - (*(Uint16 *) temp->pixels) & 0x00007FFF); - break; - case 16: - SDL_SetColorKey(temp, SDL_TRUE, *(Uint16 *) temp->pixels); - break; - case 24: - SDL_SetColorKey(temp, SDL_TRUE, - (*(Uint32 *) temp->pixels) & 0x00FFFFFF); - break; - case 32: - SDL_SetColorKey(temp, SDL_TRUE, *(Uint32 *) temp->pixels); - break; - } - } - } - - /* Create textures from the image */ - texture = SDL_CreateTextureFromSurface(renderer, temp); - if (!texture) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); - SDL_FreeSurface(temp); - return NULL; - } - SDL_FreeSurface(temp); - - /* We're ready to roll. :) */ - return texture; -} - void Draw(DrawState *s) { @@ -176,8 +127,8 @@ drawstate->window = state->windows[i]; drawstate->renderer = state->renderers[i]; - drawstate->sprite = LoadTexture(drawstate->renderer, "icon.bmp", SDL_TRUE); - drawstate->background = LoadTexture(drawstate->renderer, "sample.bmp", SDL_FALSE); + drawstate->sprite = LoadTexture(drawstate->renderer, "icon.bmp", SDL_TRUE, NULL, NULL); + drawstate->background = LoadTexture(drawstate->renderer, "sample.bmp", SDL_FALSE, NULL, NULL); if (!drawstate->sprite || !drawstate->background) { quit(2); } diff -Nru libsdl2-2.0.22+dfsg/test/testsprite2.c libsdl2-2.24.0+dfsg/test/testsprite2.c --- libsdl2-2.0.22+dfsg/test/testsprite2.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testsprite2.c 2022-08-13 03:48:10.000000000 +0000 @@ -21,6 +21,7 @@ #include "SDL_test.h" #include "SDL_test_common.h" +#include "testutils.h" #define NUM_SPRITES 100 #define MAX_SPEED 1 @@ -55,61 +56,31 @@ SDL_free(positions); SDL_free(velocities); SDLTest_CommonQuit(state); - exit(rc); + /* If rc is 0, just let main return normally rather than calling exit. + * This allows testing of platforms where SDL_main is required and does meaningful cleanup. + */ + if (rc != 0) { + exit(rc); + } } int LoadSprite(const char *file) { int i; - SDL_Surface *temp; - - /* Load the sprite image */ - temp = SDL_LoadBMP(file); - if (temp == NULL) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError()); - return (-1); - } - sprite_w = temp->w; - sprite_h = temp->h; - - /* Set transparent pixel as the pixel at (0,0) */ - if (temp->format->palette) { - SDL_SetColorKey(temp, 1, *(Uint8 *) temp->pixels); - } else { - switch (temp->format->BitsPerPixel) { - case 15: - SDL_SetColorKey(temp, 1, (*(Uint16 *) temp->pixels) & 0x00007FFF); - break; - case 16: - SDL_SetColorKey(temp, 1, *(Uint16 *) temp->pixels); - break; - case 24: - SDL_SetColorKey(temp, 1, (*(Uint32 *) temp->pixels) & 0x00FFFFFF); - break; - case 32: - SDL_SetColorKey(temp, 1, *(Uint32 *) temp->pixels); - break; - } - } - /* Create textures from the image */ for (i = 0; i < state->num_windows; ++i) { - SDL_Renderer *renderer = state->renderers[i]; - sprites[i] = SDL_CreateTextureFromSurface(renderer, temp); + /* This does the SDL_LoadBMP step repeatedly, but that's OK for test code. */ + sprites[i] = LoadTexture(state->renderers[i], file, SDL_TRUE, &sprite_w, &sprite_h); if (!sprites[i]) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); - SDL_FreeSurface(temp); return (-1); } if (SDL_SetTextureBlendMode(sprites[i], blendMode) < 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set blend mode: %s\n", SDL_GetError()); - SDL_FreeSurface(temp); SDL_DestroyTexture(sprites[i]); return (-1); } } - SDL_FreeSurface(temp); /* We're ready to roll. :) */ return (0); diff -Nru libsdl2-2.0.22+dfsg/test/testspriteminimal.c libsdl2-2.24.0+dfsg/test/testspriteminimal.c --- libsdl2-2.0.22+dfsg/test/testspriteminimal.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testspriteminimal.c 2022-06-02 02:01:57.000000000 +0000 @@ -20,6 +20,7 @@ #endif #include "SDL.h" +#include "testutils.h" #define WINDOW_WIDTH 640 #define WINDOW_HEIGHT 480 @@ -42,55 +43,6 @@ exit(rc); } -int -LoadSprite(const char *file) -{ - SDL_Surface *temp; - - /* Load the sprite image */ - temp = SDL_LoadBMP(file); - if (temp == NULL) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", file, SDL_GetError()); - return (-1); - } - sprite_w = temp->w; - sprite_h = temp->h; - - /* Set transparent pixel as the pixel at (0,0) */ - if (temp->format->palette) { - SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *) temp->pixels); - } else { - switch (temp->format->BitsPerPixel) { - case 15: - SDL_SetColorKey(temp, SDL_TRUE, - (*(Uint16 *) temp->pixels) & 0x00007FFF); - break; - case 16: - SDL_SetColorKey(temp, SDL_TRUE, *(Uint16 *) temp->pixels); - break; - case 24: - SDL_SetColorKey(temp, SDL_TRUE, - (*(Uint32 *) temp->pixels) & 0x00FFFFFF); - break; - case 32: - SDL_SetColorKey(temp, SDL_TRUE, *(Uint32 *) temp->pixels); - break; - } - } - - /* Create textures from the image */ - sprite = SDL_CreateTextureFromSurface(renderer, temp); - if (!sprite) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); - SDL_FreeSurface(temp); - return (-1); - } - SDL_FreeSurface(temp); - - /* We're ready to roll. :) */ - return (0); -} - void MoveSprites() { @@ -158,7 +110,9 @@ quit(2); } - if (LoadSprite("icon.bmp") < 0) { + sprite = LoadTexture(renderer, "icon.bmp", SDL_TRUE, &sprite_w, &sprite_h); + + if (sprite == NULL) { quit(2); } diff -Nru libsdl2-2.0.22+dfsg/test/teststreaming.c libsdl2-2.24.0+dfsg/test/teststreaming.c --- libsdl2-2.0.22+dfsg/test/teststreaming.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/teststreaming.c 2022-06-02 02:01:57.000000000 +0000 @@ -23,6 +23,7 @@ #endif #include "SDL.h" +#include "testutils.h" #define MOOSEPIC_W 64 #define MOOSEPIC_H 88 @@ -128,6 +129,7 @@ { SDL_Window *window; SDL_RWops *handle; + char *filename = NULL; /* Enable standard application logging */ SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); @@ -138,7 +140,13 @@ } /* load the moose images */ - handle = SDL_RWFromFile("moose.dat", "rb"); + filename = GetResourceFilename(NULL, "moose.dat"); + if (filename == NULL) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory\n"); + return -1; + } + handle = SDL_RWFromFile(filename, "rb"); + SDL_free(filename); if (handle == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't find the file moose.dat !\n"); quit(2); diff -Nru libsdl2-2.0.22+dfsg/test/testsurround.c libsdl2-2.24.0+dfsg/test/testsurround.c --- libsdl2-2.0.22+dfsg/test/testsurround.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testsurround.c 2022-06-02 02:01:57.000000000 +0000 @@ -19,6 +19,7 @@ static int active_channel; #define SAMPLE_RATE_HZ 48000 +#define QUICK_TEST_TIME_MSEC 100 #define CHANNEL_TEST_TIME_SEC 5 #define MAX_AMPLITUDE SDL_MAX_SINT16 @@ -188,7 +189,11 @@ SDL_Log("Playing %d Hz test tone on channel: %s\n", sine_freq, get_channel_name(j, total_channels)); /* fill_buffer() will increment the active channel */ - SDL_Delay(CHANNEL_TEST_TIME_SEC * 1000); + if (SDL_getenv("SDL_TESTS_QUICK") != NULL) { + SDL_Delay(QUICK_TEST_TIME_MSEC); + } else { + SDL_Delay(CHANNEL_TEST_TIME_SEC * 1000); + } } SDL_CloseAudioDevice(dev); diff -Nru libsdl2-2.0.22+dfsg/test/testthread.c libsdl2-2.24.0+dfsg/test/testthread.c --- libsdl2-2.0.22+dfsg/test/testthread.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testthread.c 2022-06-02 02:01:57.000000000 +0000 @@ -91,6 +91,12 @@ return (1); } + if (SDL_getenv("SDL_TESTS_QUICK") != NULL) { + SDL_Log("Not running slower tests"); + SDL_Quit(); + return 0; + } + while (argv[arg] && *argv[arg] == '-') { if (SDL_strcmp(argv[arg], "--prio") == 0) { testprio = 1; diff -Nru libsdl2-2.0.22+dfsg/test/testtimer.c libsdl2-2.24.0+dfsg/test/testtimer.c --- libsdl2-2.0.22+dfsg/test/testtimer.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testtimer.c 2022-06-02 02:01:57.000000000 +0000 @@ -54,6 +54,12 @@ return (1); } + if (SDL_getenv("SDL_TESTS_QUICK") != NULL) { + SDL_Log("Not running slower tests"); + SDL_Quit(); + return 0; + } + /* Verify SDL_GetTicks* acts monotonically increasing, and not erratic. */ SDL_Log("Sanity-checking GetTicks\n"); for (i = 0; i < 1000; ++i) { diff -Nru libsdl2-2.0.22+dfsg/test/testurl.c libsdl2-2.24.0+dfsg/test/testurl.c --- libsdl2-2.0.22+dfsg/test/testurl.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testurl.c 2022-08-13 03:48:10.000000000 +0000 @@ -11,6 +11,16 @@ */ #include "SDL.h" +static void tryOpenURL(const char *url) +{ + SDL_Log("Opening '%s' ...", url); + if (SDL_OpenURL(url) == 0) { + SDL_Log(" success!"); + } else { + SDL_Log(" failed! %s", SDL_GetError()); + } +} + int main(int argc, char **argv) { int i; @@ -19,14 +29,12 @@ return 1; } - for (i = 1; i < argc; i++) { - const char *url = argv[i]; - SDL_Log("Opening '%s' ...", url); - if (SDL_OpenURL(url) == 0) { - SDL_Log(" success!"); - } else { - SDL_Log(" failed! %s", SDL_GetError()); + if (argc > 1) { + for (i = 1; i < argc; i++) { + tryOpenURL(argv[i]); } + } else { + tryOpenURL("https://libsdl.org/"); } SDL_Quit(); diff -Nru libsdl2-2.0.22+dfsg/test/testutils.c libsdl2-2.24.0+dfsg/test/testutils.c --- libsdl2-2.0.22+dfsg/test/testutils.c 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testutils.c 2022-06-02 02:01:57.000000000 +0000 @@ -0,0 +1,153 @@ +/* +Copyright 1997-2022 Sam Lantinga +Copyright 2022 Collabora Ltd. +SPDX-License-Identifier: Zlib +*/ + +#include "testutils.h" + +/* + * Return the absolute path to def in the SDL_GetBasePath() if possible, or + * the relative path to def on platforms that don't have a working + * SDL_GetBasePath(). Free the result with SDL_free. + * + * Fails and returns NULL if out of memory. + */ +char * +GetNearbyFilename(const char *file) +{ + char *base; + char *path; + + base = SDL_GetBasePath(); + + if (base != NULL) { + SDL_RWops *rw; + size_t len = SDL_strlen(base) + SDL_strlen(file) + 1; + + path = SDL_malloc(len); + + if (path == NULL) { + SDL_free(base); + SDL_OutOfMemory(); + return NULL; + } + + SDL_snprintf(path, len, "%s%s", base, file); + SDL_free(base); + + rw = SDL_RWFromFile(path, "rb"); + if (rw) { + SDL_RWclose(rw); + return path; + } + + /* Couldn't find the file in the base path */ + SDL_free(path); + } + + path = SDL_strdup(file); + if (path == NULL) { + SDL_OutOfMemory(); + } + return path; +} + +/* + * If user_specified is non-NULL, return a copy of it. Free with SDL_free. + * + * Otherwise, return the absolute path to def in the SDL_GetBasePath() if + * possible, or the relative path to def on platforms that don't have a + * working SDL_GetBasePath(). Free the result with SDL_free. + * + * Fails and returns NULL if out of memory. + */ +char * +GetResourceFilename(const char *user_specified, const char *def) +{ + if (user_specified != NULL) { + char *ret = SDL_strdup(user_specified); + + if (ret == NULL) { + SDL_OutOfMemory(); + } + + return ret; + } else { + return GetNearbyFilename(def); + } +} + +/* + * Load the .bmp file whose name is file, from the SDL_GetBasePath() if + * possible or the current working directory if not. + * + * If transparent is true, set the transparent colour from the top left pixel. + * + * If width_out is non-NULL, set it to the texture width. + * + * If height_out is non-NULL, set it to the texture height. + */ +SDL_Texture * +LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent, + int *width_out, int *height_out) +{ + SDL_Surface *temp = NULL; + SDL_Texture *texture = NULL; + char *path; + + path = GetNearbyFilename(file); + + if (path != NULL) { + file = path; + } + + temp = SDL_LoadBMP(file); + if (temp == NULL) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError()); + } else { + /* Set transparent pixel as the pixel at (0,0) */ + if (transparent) { + if (temp->format->palette) { + SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *)temp->pixels); + } else { + switch (temp->format->BitsPerPixel) { + case 15: + SDL_SetColorKey(temp, SDL_TRUE, + (*(Uint16 *) temp->pixels) & 0x00007FFF); + break; + case 16: + SDL_SetColorKey(temp, SDL_TRUE, *(Uint16 *) temp->pixels); + break; + case 24: + SDL_SetColorKey(temp, SDL_TRUE, + (*(Uint32 *) temp->pixels) & 0x00FFFFFF); + break; + case 32: + SDL_SetColorKey(temp, SDL_TRUE, *(Uint32 *) temp->pixels); + break; + } + } + } + + if (width_out != NULL) { + *width_out = temp->w; + } + + if (height_out != NULL) { + *height_out = temp->h; + } + + texture = SDL_CreateTextureFromSurface(renderer, temp); + if (!texture) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); + } + } + if (temp) { + SDL_FreeSurface(temp); + } + if (path) { + SDL_free(path); + } + return texture; +} diff -Nru libsdl2-2.0.22+dfsg/test/testutils.h libsdl2-2.24.0+dfsg/test/testutils.h --- libsdl2-2.0.22+dfsg/test/testutils.h 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testutils.h 2022-06-02 02:01:57.000000000 +0000 @@ -0,0 +1,17 @@ +/* +Copyright 1997-2022 Sam Lantinga +Copyright 2022 Collabora Ltd. +SPDX-License-Identifier: Zlib +*/ + +#ifndef TESTUTILS_H +#define TESTUTILS_H + +#include "SDL.h" + +SDL_Texture *LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent, + int *width_out, int *height_out); +char *GetNearbyFilename(const char *file); +char *GetResourceFilename(const char *user_specified, const char *def); + +#endif diff -Nru libsdl2-2.0.22+dfsg/test/testviewport.c libsdl2-2.24.0+dfsg/test/testviewport.c --- libsdl2-2.0.22+dfsg/test/testviewport.c 2022-01-08 02:29:52.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/testviewport.c 2022-06-02 02:01:57.000000000 +0000 @@ -21,7 +21,7 @@ #include "SDL_test.h" #include "SDL_test_common.h" - +#include "testutils.h" static SDLTest_CommonState *state; @@ -42,55 +42,6 @@ exit(rc); } -int -LoadSprite(const char *file, SDL_Renderer *renderer) -{ - SDL_Surface *temp; - - /* Load the sprite image */ - temp = SDL_LoadBMP(file); - if (temp == NULL) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", file, SDL_GetError()); - return (-1); - } - sprite_w = temp->w; - sprite_h = temp->h; - - /* Set transparent pixel as the pixel at (0,0) */ - if (temp->format->palette) { - SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *) temp->pixels); - } else { - switch (temp->format->BitsPerPixel) { - case 15: - SDL_SetColorKey(temp, SDL_TRUE, - (*(Uint16 *) temp->pixels) & 0x00007FFF); - break; - case 16: - SDL_SetColorKey(temp, SDL_TRUE, *(Uint16 *) temp->pixels); - break; - case 24: - SDL_SetColorKey(temp, SDL_TRUE, - (*(Uint32 *) temp->pixels) & 0x00FFFFFF); - break; - case 32: - SDL_SetColorKey(temp, SDL_TRUE, *(Uint32 *) temp->pixels); - break; - } - } - - /* Create textures from the image */ - sprite = SDL_CreateTextureFromSurface(renderer, temp); - if (!sprite) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); - SDL_FreeSurface(temp); - return (-1); - } - SDL_FreeSurface(temp); - - /* We're ready to roll. :) */ - return (0); -} - void DrawOnViewport(SDL_Renderer * renderer) { @@ -229,7 +180,9 @@ quit(2); } - if (LoadSprite("icon.bmp", state->renderers[0]) < 0) { + sprite = LoadTexture(state->renderers[0], "icon.bmp", SDL_TRUE, &sprite_w, &sprite_h); + + if (sprite == NULL) { quit(2); } diff -Nru libsdl2-2.0.22+dfsg/test/versioning.sh libsdl2-2.24.0+dfsg/test/versioning.sh --- libsdl2-2.0.22+dfsg/test/versioning.sh 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/versioning.sh 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,154 @@ +#!/bin/sh +# Copyright 2022 Collabora Ltd. +# SPDX-License-Identifier: Zlib + +set -eu + +ref_major=$(sed -ne 's/^#define SDL_MAJOR_VERSION *//p' include/SDL_version.h) +ref_minor=$(sed -ne 's/^#define SDL_MINOR_VERSION *//p' include/SDL_version.h) +ref_micro=$(sed -ne 's/^#define SDL_PATCHLEVEL *//p' include/SDL_version.h) +ref_version="${ref_major}.${ref_minor}.${ref_micro}" + +tests=0 +failed=0 + +ok () { + tests=$(( tests + 1 )) + echo "ok - $*" +} + +not_ok () { + tests=$(( tests + 1 )) + echo "not ok - $*" + failed=1 +} + +major=$(sed -ne 's/^SDL_MAJOR_VERSION=//p' configure.ac) +minor=$(sed -ne 's/^SDL_MINOR_VERSION=//p' configure.ac) +micro=$(sed -ne 's/^SDL_MICRO_VERSION=//p' configure.ac) +version="${major}.${minor}.${micro}" + +if [ "$ref_version" = "$version" ]; then + ok "configure.ac $version" +else + not_ok "configure.ac $version disagrees with SDL_version.h $ref_version" +fi + +major=$(sed -ne 's/^set(SDL_MAJOR_VERSION \([0-9]*\))$/\1/p' CMakeLists.txt) +minor=$(sed -ne 's/^set(SDL_MINOR_VERSION \([0-9]*\))$/\1/p' CMakeLists.txt) +micro=$(sed -ne 's/^set(SDL_MICRO_VERSION \([0-9]*\))$/\1/p' CMakeLists.txt) +version="${major}.${minor}.${micro}" + +if [ "$ref_version" = "$version" ]; then + ok "CMakeLists.txt $version" +else + not_ok "CMakeLists.txt $version disagrees with SDL_version.h $ref_version" +fi + +major=$(sed -ne 's/^MAJOR_VERSION *= *//p' Makefile.os2) +minor=$(sed -ne 's/^MINOR_VERSION *= *//p' Makefile.os2) +micro=$(sed -ne 's/^MICRO_VERSION *= *//p' Makefile.os2) +version="${major}.${minor}.${micro}" + +if [ "$ref_version" = "$version" ]; then + ok "Makefile.os2 $version" +else + not_ok "Makefile.os2 $version disagrees with SDL_version.h $ref_version" +fi + +major=$(sed -ne 's/^MAJOR_VERSION *= *//p' Makefile.w32) +minor=$(sed -ne 's/^MINOR_VERSION *= *//p' Makefile.w32) +micro=$(sed -ne 's/^MICRO_VERSION *= *//p' Makefile.w32) +version="${major}.${minor}.${micro}" + +if [ "$ref_version" = "$version" ]; then + ok "Makefile.w32 $version" +else + not_ok "Makefile.w32 $version disagrees with SDL_version.h $ref_version" +fi + +tuple=$(sed -ne 's/^ *FILEVERSION *//p' src/main/windows/version.rc | tr -d '\r') +ref_tuple="${ref_major},${ref_minor},${ref_micro},0" + +if [ "$ref_tuple" = "$tuple" ]; then + ok "version.rc FILEVERSION $tuple" +else + not_ok "version.rc FILEVERSION $tuple disagrees with SDL_version.h $ref_tuple" +fi + +tuple=$(sed -ne 's/^ *PRODUCTVERSION *//p' src/main/windows/version.rc | tr -d '\r') + +if [ "$ref_tuple" = "$tuple" ]; then + ok "version.rc PRODUCTVERSION $tuple" +else + not_ok "version.rc PRODUCTVERSION $tuple disagrees with SDL_version.h $ref_tuple" +fi + +tuple=$(sed -Ene 's/^ *VALUE "FileVersion", "([0-9, ]*)\\0"\r?$/\1/p' src/main/windows/version.rc | tr -d '\r') +ref_tuple="${ref_major}, ${ref_minor}, ${ref_micro}, 0" + +if [ "$ref_tuple" = "$tuple" ]; then + ok "version.rc FileVersion $tuple" +else + not_ok "version.rc FileVersion $tuple disagrees with SDL_version.h $ref_tuple" +fi + +tuple=$(sed -Ene 's/^ *VALUE "ProductVersion", "([0-9, ]*)\\0"\r?$/\1/p' src/main/windows/version.rc | tr -d '\r') + +if [ "$ref_tuple" = "$tuple" ]; then + ok "version.rc ProductVersion $tuple" +else + not_ok "version.rc ProductVersion $tuple disagrees with SDL_version.h $ref_tuple" +fi + +version=$(sed -Ene '/CFBundleShortVersionString/,+1 s/.*(.*)<\/string>.*/\1/p' Xcode/SDL/Info-Framework.plist) + +if [ "$ref_version" = "$version" ]; then + ok "Info-Framework.plist CFBundleShortVersionString $version" +else + not_ok "Info-Framework.plist CFBundleShortVersionString $version disagrees with SDL_version.h $ref_version" +fi + +version=$(sed -Ene '/CFBundleVersion/,+1 s/.*(.*)<\/string>.*/\1/p' Xcode/SDL/Info-Framework.plist) + +if [ "$ref_version" = "$version" ]; then + ok "Info-Framework.plist CFBundleVersion $version" +else + not_ok "Info-Framework.plist CFBundleVersion $version disagrees with SDL_version.h $ref_version" +fi + +# For simplicity this assumes we'll never break ABI before SDL 3. +dylib_compat=$(sed -Ene 's/.*DYLIB_COMPATIBILITY_VERSION = (.*);$/\1/p' Xcode/SDL/SDL.xcodeproj/project.pbxproj) +ref='1.0.0 +1.0.0' + +if [ "$ref" = "$dylib_compat" ]; then + ok "project.pbxproj DYLIB_COMPATIBILITY_VERSION is consistent" +else + not_ok "project.pbxproj DYLIB_COMPATIBILITY_VERSION is inconsistent" +fi + +dylib_cur=$(sed -Ene 's/.*DYLIB_CURRENT_VERSION = (.*);$/\1/p' Xcode/SDL/SDL.xcodeproj/project.pbxproj) + +case "$ref_minor" in + (*[02468]) + major="$(( ref_minor * 100 + 1 ))" + minor="$ref_micro" + ;; + (*) + major="$(( ref_minor * 100 + ref_micro + 1 ))" + minor="0" + ;; +esac + +ref="${major}.${minor}.0 +${major}.${minor}.0" + +if [ "$ref" = "$dylib_cur" ]; then + ok "project.pbxproj DYLIB_CURRENT_VERSION is consistent" +else + not_ok "project.pbxproj DYLIB_CURRENT_VERSION is inconsistent" +fi + +echo "1..$tests" +exit "$failed" diff -Nru libsdl2-2.0.22+dfsg/test/watcom.mif libsdl2-2.24.0+dfsg/test/watcom.mif --- libsdl2-2.0.22+dfsg/test/watcom.mif 1970-01-01 00:00:00.000000000 +0000 +++ libsdl2-2.24.0+dfsg/test/watcom.mif 2022-08-13 03:48:10.000000000 +0000 @@ -0,0 +1,118 @@ +INCPATH+= -I"../include" +LIBPATH = .. +LIBS = SDL2.lib SDL2test.lib testutils.lib + +#CFLAGS+= -DHAVE_SDL_TTF +#TTFLIBS = SDL2ttf.lib + +CFLAGS+= $(INCPATH) + +TARGETS = testatomic.exe testdisplayinfo.exe testbounds.exe testdraw2.exe & + testdrawchessboard.exe testdropfile.exe testerror.exe testfile.exe & + testfilesystem.exe testgamecontroller.exe testgeometry.exe testgesture.exe & + testhittesting.exe testhotplug.exe testiconv.exe testime.exe testlocale.exe & + testintersections.exe testjoystick.exe testkeys.exe testloadso.exe & + testlock.exe testmessage.exe testoverlay2.exe testplatform.exe & + testpower.exe testsensor.exe testrelative.exe testrendercopyex.exe & + testrendertarget.exe testrumble.exe testscale.exe testsem.exe & + testshader.exe testshape.exe testsprite2.exe testspriteminimal.exe & + teststreaming.exe testthread.exe testtimer.exe testver.exe & + testviewport.exe testwm2.exe torturethread.exe checkkeys.exe & + checkkeysthreads.exe testmouse.exe testgles.exe testgles2.exe & + controllermap.exe testhaptic.exe testqsort.exe testresample.exe & + testaudioinfo.exe testaudiocapture.exe loopwave.exe loopwavequeue.exe & + testsurround.exe testyuv.exe testgl2.exe testvulkan.exe testnative.exe & + testautomation.exe testaudiohotplug.exe testcustomcursor.exe testmultiaudio.exe & + testoffscreen.exe testurl.exe + +noninteractive = & + testatomic.exe & + testerror.exe & + testfilesystem.exe & + testkeys.exe & + testlocale.exe & + testplatform.exe & + testpower.exe & + testqsort.exe & + testthread.exe & + testtimer.exe & + testver.exe + +needs_audio = & + testaudioinfo.exe & + testsurround.exe + +needs_display = & + testbounds.exe & + testdisplayinfo.exe + +TESTS = $(noninteractive) $(needs_audio) $(needs_display) + +# testautomation sources +TASRCS = testautomation.c & + testautomation_audio.c testautomation_clipboard.c & + testautomation_events.c testautomation_guid.c & + testautomation_hints.c testautomation_joystick.c & + testautomation_keyboard.c testautomation_main.c & + testautomation_math.c testautomation_mouse.c & + testautomation_pixels.c testautomation_platform.c & + testautomation_rect.c testautomation_render.c & + testautomation_rwops.c testautomation_sdltest.c & + testautomation_stdlib.c testautomation_surface.c & + testautomation_syswm.c testautomation_timer.c & + testautomation_video.c + +OBJS = $(TARGETS:.exe=.obj) +COBJS = $(CSRCS:.c=.obj) +TAOBJS = $(TASRCS:.c=.obj) +TNOBJS = $(TNSRCS:.c=.obj) + +all: testutils.lib $(TARGETS) + +.c: ../src/test + +.obj.exe: + wlink SYS $(SYSTEM) libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@ + +.c.obj: + wcc386 $(CFLAGS) -fo=$^@ $< + +# specials +testautomation.exe: $(TAOBJS) + wlink SYS $(SYSTEM) libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@ + +testnative.exe: $(TNOBJS) + wlink SYS $(SYSTEM) libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@ + +testoverlay2.exe: testoverlay2.obj testyuv_cvt.obj + wlink SYS $(SYSTEM) libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@ + +testyuv.exe: testyuv.obj testyuv_cvt.obj + wlink SYS $(SYSTEM) libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@ + +testshader.exe: testshader.obj + wlink SYS $(SYSTEM) libpath $(LIBPATH) lib {$(LIBS) $(GLLIBS)} op q op el file {$<} name $@ + +testime.exe: testime.obj + wlink SYS $(SYSTEM) libpath $(LIBPATH) lib {$(LIBS) $(TTFLIBS)} op q op el file {$<} name $@ + +testutils.lib: testutils.obj + wlib -q -b -n -c -pa -s -t -zld -ii -io $@ $< + +check: .SYMBOLIC $(TESTS) + @set SDL_AUDIODRIVER=dummy + @set SDL_VIDEODRIVER=dummy + @copy "../SDL2.dll" . + @for %exe in ($(TESTS)) do %exe + +check-quick: .SYMBOLIC $(TESTS) + @set SDL_TESTS_QUICK=1 + @set SDL_AUDIODRIVER=dummy + @set SDL_VIDEODRIVER=dummy + @copy "../SDL2.dll" . + @for %exe in ($(TESTS)) do %exe + +clean: .SYMBOLIC + rm -f *.obj *.err +distclean: .SYMBOLIC clean + rm -f *.exe *.lib diff -Nru libsdl2-2.0.22+dfsg/WhatsNew.txt libsdl2-2.24.0+dfsg/WhatsNew.txt --- libsdl2-2.0.22+dfsg/WhatsNew.txt 2022-04-21 17:37:37.000000000 +0000 +++ libsdl2-2.24.0+dfsg/WhatsNew.txt 2022-08-19 15:46:21.000000000 +0000 @@ -2,6 +2,73 @@ This is a list of major changes in SDL's version history. --------------------------------------------------------------------------- +2.24.0: +--------------------------------------------------------------------------- + +General: +* New version numbering scheme, similar to GLib and Flatpak. + * An even number in the minor version (second component) indicates a production-ready stable release such as 2.24.0, which would have been 2.0.24 under the old system. + * The patchlevel (micro version, third component) indicates a bugfix-only update: for example, 2.24.1 would be a bugfix-only release to fix bugs in 2.24.0, without adding new features. + * An odd number in the minor version indicates a prerelease such as 2.23.0. Stable distributions should not use these prereleases. + * The patchlevel indicates successive prereleases, for example 2.23.1 and 2.23.2 would be prereleases during development of the SDL 2.24.0 stable release. +* Added SDL_GetPointDisplayIndex() and SDL_GetRectDisplayIndex() to get the display associated with a point and rectangle in screen space +* Added SDL_bsearch(), SDL_crc16(), and SDL_utf8strnlen() to the stdlib routines +* Added SDL_CPUPauseInstruction() as a macro in SDL_atomic.h +* Added SDL_size_mul_overflow() and SDL_size_add_overflow() for better size overflow protection +* Added SDL_ResetHint() to reset a hint to the default value +* Added SDL_ResetKeyboard() to reset SDL's internal keyboard state, generating key up events for all currently pressed keys +* Added the hint SDL_HINT_MOUSE_RELATIVE_WARP_MOTION to control whether mouse warping generates motion events in relative mode. This hint defaults off. +* Added the hint SDL_HINT_TRACKPAD_IS_TOUCH_ONLY to control whether trackpads are treated as touch devices or mice. By default touchpads are treated as mouse input. +* The hint SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS now defaults on +* Added support for mini-gamepad mode for Nintendo Joy-Con controllers using the HIDAPI driver +* Added the hint SDL_HINT_JOYSTICK_HIDAPI_COMBINE_JOY_CONS to control whether Joy-Con controllers are automatically merged into a unified gamepad when using the HIDAPI driver. This hint defaults on. +* The hint SDL_HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED can be set to a floating point value to set the brightness of the Home LED on Nintendo Switch controllers +* Added the hint SDL_HINT_JOYSTICK_HIDAPI_JOYCON_HOME_LED to set the Home LED brightness for the Nintendo Joy-Con controllers. By default the Home LED is not modified. +* Added the hint SDL_HINT_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED to control whether the player LED should be lit on the Nintendo Joy-Con controllers +* Added support for Nintendo Online classic controllers using the HIDAPI driver +* Added the hint SDL_HINT_JOYSTICK_HIDAPI_NINTENDO_CLASSIC to control whether the HIDAPI driver for Nintendo Online classic controllers should be used +* Added support for the NVIDIA Shield Controller to the HIDAPI driver, supporting rumble and battery status +* Added support for NVIDIA SHIELD controller to the HIDAPI driver, and a hint SDL_HINT_JOYSTICK_HIDAPI_SHIELD to control whether this is used +* Added functions to get the platform dependent name for a joystick or game controller: + * SDL_JoystickPathForIndex() + * SDL_JoystickPath() + * SDL_GameControllerPathForIndex() + * SDL_GameControllerPath() +* Added SDL_GameControllerGetFirmwareVersion() and SDL_JoystickGetFirmwareVersion(), currently implemented for DualSense(tm) Wireless Controllers using HIDAPI +* Added SDL_JoystickAttachVirtualEx() for extended virtual controller support +* Added joystick event SDL_JOYBATTERYUPDATED for when battery status changes +* Added SDL_GUIDToString() and SDL_GUIDFromString() to convert between SDL GUID and string +* Added SDL_HasLSX() and SDL_HasLASX() to detect LoongArch SIMD support +* Added SDL_GetOriginalMemoryFunctions() +* Added SDL_GetDefaultAudioInfo() to get the name and format of the default audio device, currently implemented for PipeWire, PulseAudio, WASAPI, and DirectSound +* Added HIDAPI driver for the NVIDIA SHIELD controller (2017 model) to enable support for battery status and rumble +* Added support for opening audio devices with 3 or 5 channels (2.1, 4.1). All channel counts from Mono to 7.1 are now supported. +* Rewrote audio channel converters used by SDL_AudioCVT, based on the channel matrix coefficients used as the default for FAudio voices +* SDL log messages are no longer limited to 4K and can be any length +* Fixed a long-standing calling convention issue with dynapi affecting OpenWatcom or OS/2 builds + +Windows: +* Added initial support for building for Windows and Xbox with Microsoft's Game Development Kit (GDK), see docs/README-gdk.md for details +* Added a D3D12 renderer implementation and SDL_RenderGetD3D12Device() to retrieve the D3D12 device associated with it +* Added the hint SDL_HINT_WINDOWS_DPI_AWARENESS to set whether the application is DPI-aware. This hint must be set before initializing the video subsystem +* Added the hint SDL_HINT_WINDOWS_DPI_SCALING to control whether the SDL coordinates are in DPI-scaled points or pixels +* Added the hint SDL_HINT_DIRECTINPUT_ENABLED to control whether the DirectInput driver should be used +* Added support for SDL_GetAudioDeviceSpec to the DirectSound backend + +Linux: +* Support for XVidMode has been removed, mode changes are only supported using the XRandR extension +* Added the hint SDL_HINT_VIDEO_WAYLAND_MODE_EMULATION to control whether to expose a set of emulated modes in addition to the native resolution modes available on Wayland +* Added the hint SDL_HINT_KMSDRM_DEVICE_INDEX to specify which KMSDRM device to use if the default is not desired +* Added the hint SDL_HINT_LINUX_DIGITAL_HATS to control whether to treat hats as digital rather than checking to see if they may be analog +* Added the hint SDL_HINT_LINUX_HAT_DEADZONES to control whether to use deadzones on analog hats + +macOS: +* Bumped minimum OS deployment version to macOS 10.9 +* Added SDL_GL_FLOATBUFFERS to allow Cocoa GL contexts to use EDR +* Added the hint SDL_HINT_MAC_OPENGL_ASYNC_DISPATCH to control whether dispatching OpenGL context updates should block the dispatching thread until the main thread finishes processing. This hint defaults to blocking, which is the safer option on modern macOS. + + +--------------------------------------------------------------------------- 2.0.22: ---------------------------------------------------------------------------