diff --git a/CMakeLists.txt b/CMakeLists.txt index 6dddb9bc..a8767e14 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -203,7 +203,7 @@ set(MEGA_LIBOGG_VER "1.3.2") set(MEGA_LIBVORBIS_VER "1.3.5") set(MEGA_LIBTHEORA_VER "1.1.1") set(MEGA_FREETYPE_VER "2.12.0") -set(MEGA_SDL2_VER "2.0.20") +set(MEGA_SDL2_VER "2.23.1-85bbf8e") set(MEGA_OPENAL_VER "1.22.0") set(MEGA_MODPLUG_VER "0.8.8.4") diff --git a/libs/SDL2/.clang-format b/libs/SDL2/.clang-format new file mode 100644 index 00000000..f4d9bcfd --- /dev/null +++ b/libs/SDL2/.clang-format @@ -0,0 +1,89 @@ +--- +AlignConsecutiveMacros: Consecutive +AlignConsecutiveAssignments: None +AlignConsecutiveBitFields: None +AlignConsecutiveDeclarations: None +AlignEscapedNewlines: Right +AlignOperands: Align +AlignTrailingComments: true + +AllowAllArgumentsOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortEnumsOnASingleLine: true +AllowShortBlocksOnASingleLine: Never +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: All +AllowShortIfStatementsOnASingleLine: Never +AllowShortLoopsOnASingleLine: false + +AlwaysBreakAfterDefinitionReturnType: All +AlwaysBreakAfterReturnType: AllDefinitions +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: MultiLine + +# Custom brace breaking +BreakBeforeBraces: Custom +BraceWrapping: + AfterCaseLabel: true + AfterClass: true + AfterControlStatement: Never + AfterEnum: true + AfterFunction: true + AfterNamespace: true + AfterObjCDeclaration: true + AfterStruct: true + AfterUnion: true + AfterExternBlock: false + BeforeElse: false + BeforeWhile: true + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + +# Make the closing brace of container literals go to a new line +Cpp11BracedListStyle: false + +# Never format includes +IncludeBlocks: Preserve +# clang-format version 4.0 through 12.0: +#SortIncludes: false +# clang-format version 13.0+: +#SortIncludes: Never + +# No length limit, in case it breaks macros, you can +# disable it with /* clang-format off/on */ comments +ColumnLimit: 0 + +IndentWidth: 4 +ContinuationIndentWidth: 4 +IndentCaseLabels: false +IndentCaseBlocks: false +IndentGotoLabels: true +IndentPPDirectives: None +IndentExternBlock: NoIndent + +SpaceAfterCStyleCast: true +SpacesInCStyleCastParentheses: false +SpacesInConditionalStatement: false +SpacesInContainerLiterals: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false +SpaceBeforeParens: ControlStatements +SpaceAroundPointerQualifiers: Default +SpaceInEmptyBlock: false +SpaceInEmptyParentheses: false + +UseCRLF: false +UseTab: Never + +ForEachMacros: + [ + "spa_list_for_each", + "spa_list_for_each_safe", + "wl_list_for_each", + "wl_array_for_each", + "udev_list_entry_foreach", + ] + +--- + diff --git a/libs/SDL2/.editorconfig b/libs/SDL2/.editorconfig new file mode 100644 index 00000000..2bdfe9ea --- /dev/null +++ b/libs/SDL2/.editorconfig @@ -0,0 +1,77 @@ +# For format see editorconfig.org +# Copyright 2022 Collabora Ltd. +# SPDX-License-Identifier: Zlib + +root = true + +[*.{c,cg,cpp,gradle,h,java,m,metal,pl,py,S,sh,txt}] +indent_size = 4 +indent_style = space + +[*.{html,js,json,m4,yml,yaml,vcxproj,vcxproj.filters}] +indent_size = 2 +indent_style = space + +[*.xml] +indent_size = 4 +indent_style = space + +[{CMakeLists.txt,sdl2-config*.cmake.in,cmake/*.cmake}] +indent_size = 2 +indent_style = space + +[{cmake_uninstall.cmake.in,test/CMakeLists.txt}] +indent_size = 4 +indent_style = space + +[configure.ac] +# Inconsistently 2-, 4- or occasionally 3-space indented, but mostly 4, +# so let's use 4 for new code +indent_size = 4 +indent_style = space + +[{Makefile.*,*.mk,*.sln,*.pbxproj,*.plist}] +indent_size = 8 +indent_style = tab +tab_width = 8 + +[Makefile.os2] +indent_size = 4 +indent_style = space + +[test/Makefile.os2] +indent_size = 2 +indent_style = space + +[{src/core/os2/geniconv/makefile,src/core/os2/geniconv/os2cp.c}] +indent_size = 2 +indent_style = space + +[src/joystick/controller_type.*] +indent_style = tab + +[src/joystick/hidapi/steam/*.h] +indent_style = tab + +[src/libm/*.c] +indent_style = tab + +[src/test/SDL_test_{crc32,md5,random}.c] +indent_size = 2 +indent_style = space + +[src/video/yuv2rgb/*.{c,h}] +indent_style = tab + +[src/wayland-protocols/*.xml] +indent_size = 2 +indent_style = space + +[*.{markdown,md}] +indent_size = 4 +indent_style = space +# Markdown syntax treats tabs as 4 spaces +tab_width = 4 + +[{*.bat,*.rc}] +end_of_line = crlf diff --git a/libs/SDL2/.github/workflows/android.yml b/libs/SDL2/.github/workflows/android.yml index 7b2bd344..6c417da0 100644 --- a/libs/SDL2/.github/workflows/android.yml +++ b/libs/SDL2/.github/workflows/android.yml @@ -4,11 +4,76 @@ on: [push, pull_request] jobs: android: + name: ${{ matrix.platform.name }} runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + platform: + - { name: Android.mk } + - { name: CMake, cmake: 1, android_abi: "arm64-v8a", android_platform: 23, arch: "aarch64" } + steps: - uses: actions/checkout@v2 - uses: nttld/setup-ndk@v1 + id: setup_ndk with: ndk-version: r21e - - name: Build - run: ./build-scripts/androidbuildlibs.sh + - name: Build (Android.mk) + if: ${{ matrix.platform.name == 'Android.mk' }} + run: | + ./build-scripts/androidbuildlibs.sh + - name: Setup (CMake) + if: ${{ matrix.platform.name == 'CMake' }} + run: | + sudo apt-get update + sudo apt-get install ninja-build pkg-config + - name: Configure (CMake) + if: ${{ matrix.platform.name == 'CMake' }} + run: | + cmake -B build \ + -DCMAKE_TOOLCHAIN_FILE=${{ steps.setup_ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \ + -DANDROID_PLATFORM=${{ matrix.platform.android_platform }} \ + -DANDROID_ABI=${{ matrix.platform.android_abi }} \ + -DSDL_STATIC_PIC=ON \ + -DCMAKE_INSTALL_PREFIX=prefix \ + -DCMAKE_BUILD_TYPE=Release \ + -GNinja + - name: Build (CMake) + if: ${{ matrix.platform.name == 'CMake' }} + run: | + cmake --build build --config Release --parallel --verbose + - name: Install (CMake) + if: ${{ matrix.platform.name == 'CMake' }} + run: | + cmake --install build --config Release + echo "SDL2_DIR=$(pwd)/prefix" >> $GITHUB_ENV + ( cd prefix; find ) | LC_ALL=C sort -u + - name: Verify CMake configuration files + if: ${{ matrix.platform.name == 'CMake' }} + run: | + cmake -S cmake/test -B cmake_config_build -G Ninja \ + -DCMAKE_TOOLCHAIN_FILE=${{ steps.setup_ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \ + -DANDROID_PLATFORM=${{ matrix.platform.android_platform }} \ + -DANDROID_ABI=${{ matrix.platform.android_abi }} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} + cmake --build cmake_config_build --verbose + - name: Verify sdl2-config + if: ${{ matrix.platform.name == 'CMake' }} + run: | + export CC="$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=${{ matrix.platform.arch }}-none-linux-androideabi${{ matrix.platform.android_platform }}" + export PATH=${{ env.SDL2_DIR }}/bin:$PATH + cmake/test/test_sdlconfig.sh + - name: Verify sdl2.pc + if: ${{ matrix.platform.name == 'CMake' }} + run: | + export CC="$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=${{ matrix.platform.arch }}-none-linux-androideabi${{ matrix.platform.android_platform }}" + export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig + cmake/test/test_pkgconfig.sh + - name: Verify Android.mk + if: ${{ matrix.platform.name == 'CMake' }} + run: | + export NDK_MODULE_PATH=${{ env.SDL2_DIR }}/share/ndk-modules + ndk-build -C ${{ github.workspace }}/cmake/test APP_PLATFORM=android-${{ matrix.platform.android_platform }} APP_ABI=${{ matrix.platform.android_abi }} NDK_OUT=$PWD NDK_LIBS_OUT=$PWD V=1 diff --git a/libs/SDL2/.github/workflows/emscripten.yml b/libs/SDL2/.github/workflows/emscripten.yml index 633c3912..16f0fc72 100644 --- a/libs/SDL2/.github/workflows/emscripten.yml +++ b/libs/SDL2/.github/workflows/emscripten.yml @@ -11,6 +11,27 @@ jobs: with: version: 2.0.27 - name: Configure CMake - run: emcmake cmake -B build + run: | + emcmake cmake -S . -B build \ + -DSDL_TESTS=ON \ + -DSDL_INSTALL_TESTS=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=prefix - name: Build - run: cmake --build build/ + run: cmake --build build/ --verbose + - name: Run build-time tests + run: | + set -eu + export SDL_TESTS_QUICK=1 + ctest -VV --test-dir build/ + - name: Install + run: | + echo "SDL2_DIR=$(pwd)/prefix" >> $GITHUB_ENV + cmake --install build/ + - name: Verify CMake configuration files + run: | + emcmake cmake -S cmake/test -B cmake_config_build \ + -DCMAKE_BUILD_TYPE=Release \ + -DTEST_SHARED=FALSE \ + -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} + cmake --build cmake_config_build --verbose diff --git a/libs/SDL2/.github/workflows/main.yml b/libs/SDL2/.github/workflows/main.yml index 4c1850fc..7cfc3f20 100644 --- a/libs/SDL2/.github/workflows/main.yml +++ b/libs/SDL2/.github/workflows/main.yml @@ -15,15 +15,12 @@ jobs: fail-fast: false matrix: platform: - - { name: Windows (x64), os: windows-latest, shell: pwsh, flags: -A x64 } - - { name: Windows (x86), os: windows-latest, shell: pwsh, flags: -A Win32 } - - { name: Windows (clang-cl x64), os: windows-latest, shell: pwsh, flags: -T ClangCL -A x64 } - - { name: Windows (clang-cl x86), os: windows-latest, shell: pwsh, flags: -T ClangCL -A Win32 } - - { name: Windows (ARM64), os: windows-latest, shell: pwsh, flags: -A ARM64 } - - { name: Windows (mingw32), os: windows-latest, shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686 } - - { name: Windows (mingw64), os: windows-latest, shell: 'msys2 {0}', msystem: mingw64, msys-env: mingw-w64-x86_64 } - - { name: Linux, os: ubuntu-20.04, shell: sh, flags: -GNinja } - - { name: MacOS, os: macos-latest, shell: sh } + - { name: Windows (mingw32), os: windows-latest, shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686, cc: gcc } + - { name: Windows (mingw64+clang), os: windows-latest, shell: 'msys2 {0}', msystem: mingw64, msys-env: mingw-w64-x86_64, cc: clang } + - { name: Linux (CMake), os: ubuntu-20.04, shell: sh, flags: true } + - { name: Linux (autotools), os: ubuntu-20.04, shell: sh, autotools: true } + - { name: MacOS (CMake), os: macos-latest, shell: sh } + - { name: MacOS (autotools), os: macos-latest, shell: sh, autotools: true } steps: - name: Set up MSYS2 @@ -32,16 +29,30 @@ jobs: with: msystem: ${{ matrix.platform.msystem }} install: >- - ${{ matrix.platform.msys-env }}-gcc + ${{ matrix.platform.msys-env }}-${{ matrix.platform.cc }} ${{ matrix.platform.msys-env }}-cmake ${{ matrix.platform.msys-env }}-ninja ${{ matrix.platform.msys-env }}-pkg-config + - name: Configure MSYS2 compiler + if: matrix.platform.shell == 'msys2 {0}' + run: | + if test x${{ matrix.platform.cc}} == xgcc; then + echo "CC=gcc" >> $GITHUB_ENV + echo "CXX=g++" >> $GITHUB_ENV + fi + if test x${{ matrix.platform.cc}} == xclang; then + echo "CC=clang" >> $GITHUB_ENV + echo "CXX=clang++" >> $GITHUB_ENV + fi - name: Setup Linux dependencies if: runner.os == 'Linux' run: | sudo apt-get update - sudo apt-get install wayland-protocols \ + sudo apt-get install \ + autoconf \ + gnome-desktop-testing \ + wayland-protocols \ pkg-config \ ninja-build \ libasound2-dev \ @@ -78,11 +89,142 @@ jobs: git clone --depth 1 https://gitlab.gnome.org/jadahl/libdecor.git --branch 0.1.0 cd libdecor meson build --buildtype release -Ddemo=false -Ddbus=disabled - ninja -C build + ninja -v -C build sudo meson install -C build + - name: Setup Macos dependencies + if: runner.os == 'macOS' + run: | + brew install \ + ninja - uses: actions/checkout@v2 - - name: Configure CMake - run: cmake -B build -DSDL_TEST=ON ${{ matrix.platform.flags }} - - name: Build - run: cmake --build build/ - + - name: Check that versioning is consistent + # We only need to run this once: arbitrarily use the Linux/CMake build + if: "runner.os == 'Linux' && ! matrix.platform.autotools" + run: ./test/versioning.sh + - name: Configure (CMake) + if: "! matrix.platform.autotools" + run: | + cmake -S . -B build -G Ninja \ + -DSDL_TESTS=ON \ + -DSDL_INSTALL_TESTS=ON \ + -DCMAKE_INSTALL_PREFIX=cmake_prefix \ + -DCMAKE_BUILD_TYPE=Release + - name: Build (CMake) + if: "! matrix.platform.autotools" + run: | + cmake --build build/ --config Release --verbose --parallel + - name: Run build-time tests (CMake) + if: "! matrix.platform.autotools" + run: | + set -eu + export SDL_TESTS_QUICK=1 + ctest -VV --test-dir build/ + - name: Install (CMake) + if: "! matrix.platform.autotools" + run: | + set -eu + cmake --install build/ --config Release + echo "SDL2_DIR=$(pwd)/cmake_prefix" >> $GITHUB_ENV + ( cd cmake_prefix; find ) | LC_ALL=C sort -u + - name: Configure (Autotools) + if: matrix.platform.autotools + run: | + set -eu + rm -fr build-autotools + mkdir build-autotools + ./autogen.sh + ( + cd build-autotools + ${{ github.workspace }}/configure \ + --prefix=${{ github.workspace }}/autotools_prefix \ + ) + if test "${{ runner.os }}" != "macOS" ; then + curdir="$(pwd)" + multiarch="$(dpkg-architecture -qDEB_HOST_MULTIARCH)" + ( + mkdir -p build-autotools/test + cd build-autotools/test + ${{ github.workspace }}/test/configure \ + --x-includes=/usr/include \ + --x-libraries="/usr/lib/${multiarch}" \ + --prefix=${{ github.workspace }}/autotools_prefix \ + SDL_CFLAGS="-I${curdir}/include" \ + SDL_LIBS="-L${curdir}/build-autotools/build/.libs -lSDL2" \ + ac_cv_lib_SDL2_ttf_TTF_Init=no \ + ${NULL+} + ) + fi + - name: Build (Autotools) + if: matrix.platform.autotools + run: | + set -eu + parallel="$(getconf _NPROCESSORS_ONLN)" + make -j"${parallel}" -C build-autotools V=1 + if test "${{ runner.os }}" != "macOS" ; then + make -j"${parallel}" -C build-autotools/test V=1 + fi + - name: Run build-time tests (Autotools) + if: ${{ matrix.platform.autotools && (runner.os != 'macOS') }} + run: | + set -eu + curdir="$(pwd)" + parallel="$(getconf _NPROCESSORS_ONLN)" + export SDL_TESTS_QUICK=1 + make -j"${parallel}" -C build-autotools/test check LD_LIBRARY_PATH="${curdir}/build-autotools/build/.libs" + - name: Install (Autotools) + if: matrix.platform.autotools + run: | + set -eu + curdir="$(pwd)" + parallel="$(getconf _NPROCESSORS_ONLN)" + make -j"${parallel}" -C build-autotools install V=1 + if test "${{ runner.os }}" != "macOS" ; then + make -j"${parallel}" -C build-autotools/test install V=1 + fi + ( cd autotools_prefix; find . ) | LC_ALL=C sort -u + echo "SDL2_DIR=$(pwd)/autotools_prefix" >> $GITHUB_ENV + - name: Verify CMake configuration files + run: | + cmake -S cmake/test -B cmake_config_build -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} + cmake --build cmake_config_build --verbose + - name: Verify sdl2-config + run: | + export CC=${{ matrix.platform.cc || 'gcc' }} + export PATH=${{ env.SDL2_DIR }}/bin:$PATH + cmake/test/test_sdlconfig.sh + - name: Verify sdl2.pc + run: | + export CC=${{ matrix.platform.cc || 'gcc' }} + export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig + cmake/test/test_pkgconfig.sh + - name: Distcheck (Autotools) + if: matrix.platform.autotools + run: | + set -eu + parallel="$(getconf _NPROCESSORS_ONLN)" + make -j"${parallel}" -C build-autotools dist V=1 + # Similar to Automake `make distcheck`: check that the tarball + # release is sufficient to do a new build + mkdir distcheck + tar -C distcheck -zxf build-autotools/SDL2-*.tar.gz + ( cd distcheck/SDL2-* && ./configure ) + make -j"${parallel}" -C distcheck/SDL2-* + - name: Run installed-tests (Autotools) + if: "runner.os == 'Linux' && matrix.platform.autotools" + run: | + set -eu + parallel="$(getconf _NPROCESSORS_ONLN)" + sudo make -j"${parallel}" -C build-autotools install + sudo make -j"${parallel}" -C build-autotools/test install + export SDL_TESTS_QUICK=1 + # We need to set LD_LIBRARY_PATH because it isn't in the default + # linker search path. We don't need to set XDG_DATA_DIRS for + # ginsttest-runner, because /usr/local/share *is* in the default + # search path for that. + env --chdir=/ \ + LD_LIBRARY_PATH=/usr/local/lib \ + SDL_AUDIODRIVER=dummy \ + SDL_VIDEODRIVER=dummy \ + ginsttest-runner --tap SDL2 diff --git a/libs/SDL2/.github/workflows/msvc.yml b/libs/SDL2/.github/workflows/msvc.yml new file mode 100644 index 00000000..5cc1ff17 --- /dev/null +++ b/libs/SDL2/.github/workflows/msvc.yml @@ -0,0 +1,71 @@ +name: Build (MSVC) + +on: [push, pull_request] + +jobs: + Build: + name: ${{ matrix.platform.name }} + runs-on: windows-latest + + strategy: + fail-fast: false + matrix: + platform: + - { name: Windows (x64), flags: -A x64, project: VisualC/SDL.sln, projectflags: '/p:Platform=x64' } + - { name: Windows (x86), flags: -A Win32, project: VisualC/SDL.sln, projectflags: '/p:Platform=Win32' } + - { name: Windows static VCRT (x64), flags: -A x64 -DSDL_FORCE_STATIC_VCRT=ON } + - { name: Windows static VCRT (x86), flags: -A Win32 -DSDL_FORCE_STATIC_VCRT=ON } + - { name: Windows (clang-cl x64), flags: -T ClangCL -A x64 } + - { name: Windows (clang-cl x86), flags: -T ClangCL -A Win32 } + - { name: Windows (ARM), flags: -A ARM } + - { name: Windows (ARM64), flags: -A ARM64 } + - { name: UWP (x64), flags: -A x64 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0" -DSDL_TESTS=OFF, + project: VisualC-WinRT/SDL-UWP.sln, projectflags: '/p:Platform=x64 /p:WindowsTargetPlatformVersion=10.0.17763.0' } + + steps: + - uses: actions/checkout@v2 + - name: Create CMake project using SDL as a subproject + shell: python + run: | + import os + import textwrap + srcdir = r"${{ github.workspace }}".replace("\\", "/") + builddir = f"{ srcdir }/build" + os.makedirs(builddir) + with open(f"{ builddir }/CMakeLists.txt", "w") as f: + f.write(textwrap.dedent(f"""\ + cmake_minimum_required(VERSION 3.0) + project(sdl_user) + add_subdirectory("{ srcdir }" SDL) + """)) + - name: Configure (CMake) + run: cmake -S build -B build ` + -DSDL_TESTS=ON ` + -DSDL_INSTALL_TESTS=ON ` + ${{ matrix.platform.flags }} ` + -DCMAKE_INSTALL_PREFIX=prefix + - name: Build (CMake) + run: cmake --build build/ --config Release --parallel + - name: Run build-time tests + if: "! contains(matrix.platform.name, 'ARM')" + run: | + $env:SDL_TESTS_QUICK=1 + ctest -VV --test-dir build/ -C Release + - name: Install (CMake) + run: | + echo "SDL2_DIR=$Env:GITHUB_WORKSPACE/prefix" >> $Env:GITHUB_ENV + cmake --install build/ + - name: Verify CMake configuration files + if: ${{ !contains(matrix.platform.name, 'UWP') }} # FIXME: cmake/test/CMakeLists.txt should support UWP + run: | + cmake -S cmake/test -B cmake_config_build ` + -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} ` + ${{ matrix.platform.flags }} + cmake --build cmake_config_build --config Release + + - name: Add msbuild to PATH + if: ${{ matrix.platform.project != '' }} + uses: microsoft/setup-msbuild@v1.0.2 + - name: Build msbuild + if: ${{ matrix.platform.project != '' }} + run: msbuild ${{ matrix.platform.project }} /m /p:BuildInParallel=true /p:Configuration=Release ${{ matrix.platform.projectflags }} diff --git a/libs/SDL2/.github/workflows/os2.yml b/libs/SDL2/.github/workflows/os2.yml deleted file mode 100644 index c6f11e02..00000000 --- a/libs/SDL2/.github/workflows/os2.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Build (OS/2) - -on: [push, pull_request] - -jobs: - os2: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Cache OpenWatcom - uses: actions/cache@v2 - env: - cache-name: cache-openwatcom - with: - path: ~/openwatcom - key: ${{ runner.os }}-build-${{ env.cache-name }} - - - name: Download OpenWatcom if not cached - run: if [ ! -d ~/openwatcom/binl64 ]; then wget --no-verbose 'https://github.com/open-watcom/open-watcom-v2/releases/download/Current-build/open-watcom-2_0-c-linux-x64' -O ~/ow.zip && mkdir -p ~/openwatcom && cd ~/openwatcom && unzip ~/ow.zip && chmod -R a+rx ~/openwatcom ; fi - shell: bash - - - name: Build - run: WATCOM="$HOME/openwatcom" build-scripts/os2-buildbot.sh - shell: bash - diff --git a/libs/SDL2/.github/workflows/ps2.yaml b/libs/SDL2/.github/workflows/ps2.yaml new file mode 100644 index 00000000..4140b092 --- /dev/null +++ b/libs/SDL2/.github/workflows/ps2.yaml @@ -0,0 +1,72 @@ +name: Build (Sony Playstation 2) + +on: [push, pull_request] + +jobs: + ps2: + runs-on: ubuntu-latest + container: ps2dev/ps2dev:latest + steps: + - uses: actions/checkout@v2 + - name: Setup dependencies + run: | + apk update + apk add cmake gmp mpc1 mpfr4 ninja pkgconf make git + + # To be removed once ps2_drivers is part of PS2DEV + - name: Install ps2_drivers lib + run: | + git clone https://github.com/fjtrujy/ps2_drivers.git + cd ps2_drivers + make -j $(getconf _NPROCESSORS_ONLN) clean + make -j $(getconf _NPROCESSORS_ONLN) + make -j $(getconf _NPROCESSORS_ONLN) install + + - name: Configure (CMake) + run: | + cmake -S . -B build -G Ninja\ + -DCMAKE_TOOLCHAIN_FILE=$PS2DEV/ps2sdk/ps2dev.cmake \ + -DSDL_TESTS=ON \ + -DCMAKE_INSTALL_PREFIX=cmake_prefix \ + -DCMAKE_BUILD_TYPE=Release + - name: Build + run: cmake --build build --config Release --verbose --parallel + - name: Install (CMake) + run: | + set -eu + cmake --install build/ --config Release + echo "SDL2_DIR=$(pwd)/cmake_prefix" >> $GITHUB_ENV + ( cd cmake_prefix; find ) | LC_ALL=C sort -u + + - name: Verify CMake configuration files + run: | + cmake -S cmake/test -B cmake_config_build -G Ninja \ + -DCMAKE_TOOLCHAIN_FILE=$PS2DEV/ps2sdk/ps2dev.cmake \ + -DTEST_SHARED=FALSE \ + -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} \ + -DCMAKE_BUILD_TYPE=Release + cmake --build cmake_config_build --verbose + - name: Verify sdl2-config + run: | + export CC=mips64r5900el-ps2-elf-gcc + export PATH=${{ env.SDL2_DIR }}/bin:$PATH + export EXTRA_LDFLAGS="-L$PS2DEV/ps2sdk/ee/lib -L$PS2DEV/ps2sdk/ports/lib" + cmake/test/test_sdlconfig.sh + - name: Verify sdl2.pc + run: | + export CC=mips64r5900el-ps2-elf-gcc + export EXTRA_LDFLAGS="-L$PS2DEV/ps2sdk/ee/lib -L$PS2DEV/ps2sdk/ports/lib" + export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig + cmake/test/test_pkgconfig.sh + + - name: Get short SHA + id: slug + run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)" + + - name: Upload artifacts + if: ${{ success() }} + uses: actions/upload-artifact@v3 + with: + name: tests-${{ steps.slug.outputs.sha8 }} + path: | + build/test diff --git a/libs/SDL2/.github/workflows/psp.yaml b/libs/SDL2/.github/workflows/psp.yaml index b1b470e8..9a926773 100644 --- a/libs/SDL2/.github/workflows/psp.yaml +++ b/libs/SDL2/.github/workflows/psp.yaml @@ -11,8 +11,39 @@ jobs: - name: Setup dependencies run: | apk update - apk add cmake gmp mpc1 mpfr4 make + apk add cmake gmp mpc1 mpfr4 make pkgconf - name: Configure CMake - run: cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$PSPDEV/psp/share/pspdev.cmake -DSDL_TEST=ON + run: | + cmake -S . -B build \ + -DCMAKE_TOOLCHAIN_FILE=$PSPDEV/psp/share/pspdev.cmake \ + -DSDL_TESTS=ON \ + -DSDL_INSTALL_TESTS=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=prefix - name: Build - run: cmake --build build + run: cmake --build build --config Release + - name: Install + run: | + echo "SDL2_DIR=$(pwd)/prefix" >> $GITHUB_ENV + cmake --install build --config Release + ( cd prefix; find ) | LC_ALL=C sort -u + - name: Verify CMake configuration files + run: | + cmake -S cmake/test -B cmake_config_build \ + -DCMAKE_TOOLCHAIN_FILE=$PSPDEV/psp/share/pspdev.cmake \ + -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} \ + -DTEST_SHARED=FALSE \ + -DCMAKE_BUILD_TYPE=Release + cmake --build cmake_config_build --verbose + - name: Verify sdl2-config + run: | + export CC=psp-gcc + export PATH=${{ env.SDL2_DIR }}/bin:$PATH + export EXTRA_LDFLAGS="-L$PSPDEV/lib -L$PSPDEV/psp/lib -L$PSPDEV/psp/sdk/lib" + cmake/test/test_sdlconfig.sh + - name: Verify sdl2.pc + run: | + export CC=psp-gcc + export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig + export EXTRA_LDFLAGS="-L$PSPDEV/lib -L$PSPDEV/psp/lib -L$PSPDEV/psp/sdk/lib" + cmake/test/test_pkgconfig.sh diff --git a/libs/SDL2/.github/workflows/riscos.yml b/libs/SDL2/.github/workflows/riscos.yml index 3f46668b..1791c950 100644 --- a/libs/SDL2/.github/workflows/riscos.yml +++ b/libs/SDL2/.github/workflows/riscos.yml @@ -3,26 +3,65 @@ name: Build (RISC OS) on: [push, pull_request] jobs: - autotools: - name: autotools + Build: + name: ${{ matrix.platform.name }} runs-on: ubuntu-latest container: riscosdotinfo/riscos-gccsdk-4.7:latest - steps: - - uses: actions/checkout@v2 - - name: Configure - run: ./configure --host=arm-unknown-riscos --disable-gcc-atomics - - name: Build - run: make -j`nproc` - cmake: - name: CMake - runs-on: ubuntu-latest - container: riscosdotinfo/riscos-gccsdk-4.7:latest + strategy: + fail-fast: false + matrix: + platform: + - { name: autotools, test_args: '-DTEST_SHARED=FALSE' } # FIXME: autotools should build and install shared libraries + - { name: CMake } + steps: - name: Setup dependencies run: apt-get update && apt-get install -y cmake ninja-build - uses: actions/checkout@v2 - - name: Configure CMake - run: cmake -S. -Bbuild -G Ninja -DCMAKE_TOOLCHAIN_FILE=/home/riscos/env/toolchain-riscos.cmake -DRISCOS=ON -DSDL_GCC_ATOMICS=OFF -DCMAKE_BUILD_TYPE=Release - - name: Build - run: cmake --build build + - name: Configure (autotools) + if: ${{ contains(matrix.platform.name, 'autotools') }} + run: | + mkdir build_autotools + cd build_autotools + ../configure \ + --host=arm-unknown-riscos \ + --disable-gcc-atomics \ + --prefix=${{ github.workspace }}/prefix_autotools + - name: Build (autotools) + if: ${{ contains(matrix.platform.name, 'autotools') }} + run: make -C build_autotools -j`nproc` V=1 + - name: Install (autotools) + if: ${{ contains(matrix.platform.name, 'autotools') }} + run: | + echo "SDL2_DIR=${{ github.workspace }}/prefix_autotools" >> $GITHUB_ENV + make -C build_autotools install + ( cd ${{ github.workspace }}/prefix_autotools; find ) | LC_ALL=C sort -u + - name: Configure (CMake) + if: ${{ contains(matrix.platform.name, 'CMake') }} + run: | + cmake -S . -B build -G Ninja \ + -DCMAKE_TOOLCHAIN_FILE=/home/riscos/env/toolchain-riscos.cmake \ + -DRISCOS=ON \ + -DSDL_GCC_ATOMICS=OFF \ + -DSDL_TESTS=ON \ + -DSDL_INSTALL_TESTS=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/prefix_cmake + - name: Build (CMake) + if: ${{ contains(matrix.platform.name, 'CMake') }} + run: cmake --build build --verbose + - name: Install (CMake) + if: ${{ contains(matrix.platform.name, 'CMake') }} + run: | + echo "SDL2_DIR=${{ github.workspace }}/prefix_cmake" >> $GITHUB_ENV + cmake --install build/ + ( cd ${{ github.workspace }}/prefix_cmake; find ) | LC_ALL=C sort -u + - name: Verify CMake configuration files + run: | + cmake -S cmake/test -B cmake_config_build -G Ninja \ + -DCMAKE_TOOLCHAIN_FILE=/home/riscos/env/toolchain-riscos.cmake \ + -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} \ + -DCMAKE_BUILD_TYPE=Release \ + ${{ matrix.platform.test_args }} + cmake --build cmake_config_build --verbose diff --git a/libs/SDL2/.github/workflows/vita.yaml b/libs/SDL2/.github/workflows/vita.yaml index 49d1a2bf..9b27370b 100644 --- a/libs/SDL2/.github/workflows/vita.yaml +++ b/libs/SDL2/.github/workflows/vita.yaml @@ -13,11 +13,40 @@ jobs: image: vitasdk/vitasdk:latest steps: - uses: actions/checkout@v2 - - name: Install CMake and GNU Make + - name: Install build requirements run: | apk update - apk add cmake make + apk add cmake ninja pkgconf - name: Configure CMake - run: cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake -DCMAKE_BUILD_TYPE=Release + run: | + cmake -S . -B build -G Ninja \ + -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake \ + -DSDL_TESTS=ON \ + -DSDL_INSTALL_TESTS=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=prefix - name: Build - run: cmake --build build + run: cmake --build build --verbose + - name: Install CMake + run: | + echo "SDL2_DIR=$(pwd)/prefix" >> $GITHUB_ENV + cmake --install build/ + ( cd prefix; find ) | LC_ALL=C sort -u + - name: Verify CMake configuration files + run: | + cmake -S cmake/test -B cmake_config_build -G Ninja \ + -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake \ + -DTEST_SHARED=FALSE \ + -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} \ + -DCMAKE_BUILD_TYPE=Release + cmake --build cmake_config_build --verbose + - name: Verify sdl2-config + run: | + export CC=arm-vita-eabi-gcc + export PATH=${{ env.SDL2_DIR }}/bin:$PATH + cmake/test/test_sdlconfig.sh + - name: Verify sdl2.pc + run: | + export CC=arm-vita-eabi-gcc + export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig + cmake/test/test_pkgconfig.sh diff --git a/libs/SDL2/.github/workflows/watcom.yml b/libs/SDL2/.github/workflows/watcom.yml new file mode 100644 index 00000000..ead7c472 --- /dev/null +++ b/libs/SDL2/.github/workflows/watcom.yml @@ -0,0 +1,35 @@ +name: Build (OpenWatcom) + +on: [push, pull_request] + +jobs: + os2: + name: ${{ matrix.platform.name }} + runs-on: windows-latest + + strategy: + matrix: + platform: + - { name: Windows, makefile: Makefile.w32 } + - { name: OS/2, makefile: Makefile.os2 } + + steps: + - uses: actions/checkout@v2 + - uses: open-watcom/setup-watcom@v0 + - name: Build SDL2 + run: | + wmake -f ${{ matrix.platform.makefile }} + - name: Build tests + run: | + cd test && wmake -f ${{ matrix.platform.makefile }} + cd .. + - name: Run tests + if: "matrix.platform.makefile == 'Makefile.w32'" + run: | + cd test && wmake -f ${{ matrix.platform.makefile }} check-quick + cd .. + - name: distclean + run: | + wmake -f ${{ matrix.platform.makefile }} distclean + cd test && wmake -f ${{ matrix.platform.makefile }} distclean + cd .. diff --git a/libs/SDL2/.gitignore b/libs/SDL2/.gitignore index fd27cb76..3683beeb 100644 --- a/libs/SDL2/.gitignore +++ b/libs/SDL2/.gitignore @@ -22,6 +22,7 @@ buildbot *.exe *.o *.obj +*.res *.lib *.a *.la @@ -95,6 +96,7 @@ VisualC/visualtest/testsprite2.exe VisualC/visualtest/testsprite2_sample.actions VisualC/visualtest/testsprite2_sample.config VisualC/visualtest/testsprite2_sample.parameters +VisualC-GDK/**/Layout # for Android android-project/local.properties diff --git a/libs/SDL2/.wikiheaders-options b/libs/SDL2/.wikiheaders-options new file mode 100644 index 00000000..31ccd433 --- /dev/null +++ b/libs/SDL2/.wikiheaders-options @@ -0,0 +1,15 @@ +projectfullname = SDL_mixer +projectshortname = SDL_mixer +incsubdir = include +wikisubdir = +apiprefixregex = (SDL_|SDLK_|KMOD_|AUDIO_) +mainincludefname = SDL.h +versionfname = include/SDL_version.h +versionmajorregex = \A\#define\s+SDL_MAJOR_VERSION\s+(\d+)\Z +versionminorregex = \A\#define\s+SDL_MINOR_VERSION\s+(\d+)\Z +versionpatchregex = \A\#define\s+SDL_PATCHLEVEL\s+(\d+)\Z +selectheaderregex = \ASDL.*?\.h\Z +projecturl = https://libsdl.org/ +wikiurl = https://wiki.libsdl.org +bugreporturl = https://github.com/libsdl-org/sdlwiki/issues/new +warn_about_missing = 0 diff --git a/libs/SDL2/CMakeLists.txt b/libs/SDL2/CMakeLists.txt index cdc84e0b..12d6eced 100644 --- a/libs/SDL2/CMakeLists.txt +++ b/libs/SDL2/CMakeLists.txt @@ -47,7 +47,6 @@ include(CheckCSourceCompiles) include(CheckCSourceRuns) include(CheckCCompilerFlag) include(CheckCXXCompilerFlag) -include(CheckTypeSize) include(CheckStructHasMember) include(CMakeDependentOption) include(FindPkgConfig) @@ -56,23 +55,18 @@ set(CMAKE_MODULE_PATH "${SDL2_SOURCE_DIR}/cmake") 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 20) -set(SDL_INTERFACE_AGE 2) -set(SDL_BINARY_AGE 20) +set(SDL_MINOR_VERSION 23) +set(SDL_MICRO_VERSION 1) 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 19.2.0) -set(DYLIB_COMPATIBILITY_VERSION 1.0.0) # Set defaults preventing destination file conflicts set(SDL_CMAKE_DEBUG_POSTFIX "d" @@ -81,13 +75,44 @@ set(SDL_CMAKE_DEBUG_POSTFIX "d" 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 +182,7 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Haiku.*") 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 +207,12 @@ else() 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 +260,7 @@ if(APPLE OR ARCH_64 OR MSVC_CLANG) 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 +303,10 @@ if(MSVC) 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 @@ -293,20 +324,19 @@ if(CYGWIN) # We build SDL on cygwin without the UNIX emulation layer target_include_directories(sdl-build-options INTERFACE "/usr/include/mingw") set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -mno-cygwin") - check_c_source_compiles("int main(int argc, char **argv) {}" + check_c_source_compiles("int main(int argc, char **argv) { return 0; }" 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,15 +361,14 @@ if(EMSCRIPTEN) 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() -set(BUILD_SHARED_LIBS ON) - # When defined, respect CMake's BUILD_SHARED_LIBS setting: set(SDL_STATIC_ENABLED_BY_DEFAULT ON) if (NOT DEFINED SDL_SHARED_ENABLED_BY_DEFAULT) @@ -359,11 +388,15 @@ if (NOT DEFINED SDL_SHARED_ENABLED_BY_DEFAULT) 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 Atomic Audio Video Render Events Joystick Haptic Hidapi Power Threads Timers - File Loadso CPUinfo Filesystem Dlopen Sensor Locale) + File Loadso CPUinfo Filesystem Sensor Locale Misc) foreach(_SUB ${SDL_SUBSYSTEMS}) string(TOUPPER ${_SUB} _OPT) if (NOT DEFINED SDL_${_OPT}_ENABLED_BY_DEFAULT) @@ -374,6 +407,7 @@ endforeach() # 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_UNINSTALL "Disable uninstallation of SDL2" OFF) option_string(SDL_ASSERTIONS "Enable internal sanity checks (auto/disabled/release/enabled/paranoid)" "auto") @@ -415,23 +449,23 @@ dep_option(SDL_ARTS_SHARED "Dynamically load aRts audio support" ON "SDL 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) endforeach() set_option(SDL_WAYLAND "Use Wayland video driver" ${UNIX_SYS}) dep_option(SDL_WAYLAND_SHARED "Dynamically load Wayland support" ON "SDL_WAYLAND" OFF) -dep_option(SDL_WAYLAND_LIBDECOR "Use client-side window decorations on Wayland" ON "SDL_WAYLAND" ON) +dep_option(SDL_WAYLAND_LIBDECOR "Use client-side window decorations on Wayland" ON "SDL_WAYLAND" OFF) dep_option(SDL_WAYLAND_LIBDECOR_SHARED "Dynamically load libdecor support" ON "SDL_WAYLAND_LIBDECOR" OFF) dep_option(SDL_WAYLAND_QT_TOUCH "QtWayland server support for Wayland video driver" ON "SDL_WAYLAND" OFF) set_option(SDL_RPI "Use Raspberry Pi video driver" ${UNIX_SYS}) @@ -455,13 +489,17 @@ set_option(SDL_ASAN "Use AddressSanitizer to detect memory errors 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(VITA) - set_option(VIDEO_VITA_PIB "Build with PSVita piglet gles2 support" OFF) - set_option(VIDEO_VITA_PVR "Build with PSVita PVR gles/gles2 support" OFF) + set_option(VIDEO_VITA_PIB "Build with PSVita piglet gles2 support" OFF) + set_option(VIDEO_VITA_PVR "Build with PSVita PVR gles/gles2 support" OFF) endif() # General source files @@ -473,6 +511,7 @@ file(GLOB SOURCE_FILES ${SDL2_SOURCE_DIR}/src/dynapi/*.c ${SDL2_SOURCE_DIR}/src/events/*.c ${SDL2_SOURCE_DIR}/src/file/*.c + ${SDL2_SOURCE_DIR}/src/joystick/*.c ${SDL2_SOURCE_DIR}/src/haptic/*.c ${SDL2_SOURCE_DIR}/src/hidapi/*.c ${SDL2_SOURCE_DIR}/src/libm/*.c @@ -489,15 +528,18 @@ file(GLOB SOURCE_FILES ${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") @@ -546,7 +588,7 @@ if(USE_GCC OR USE_CLANG) #if !defined(__GNUC__) || __GNUC__ < 3 #error Dependency tracking requires GCC 3.0 or newer #endif - int main(int argc, char **argv) { }" HAVE_DEPENDENCY_TRACKING) + int main(int argc, char **argv) { return 0; }" HAVE_DEPENDENCY_TRACKING) endif() if(SDL_GCC_ATOMICS) @@ -557,17 +599,19 @@ if(USE_GCC OR USE_CLANG) __sync_lock_test_and_set(&x, y); __sync_fetch_and_add(&a, 1); __sync_bool_compare_and_swap(&a, 5, 10); - __sync_bool_compare_and_swap(&x, y, z); }" HAVE_GCC_ATOMICS) + __sync_bool_compare_and_swap(&x, y, z); + return 0; }" HAVE_GCC_ATOMICS) if(NOT HAVE_GCC_ATOMICS) check_c_source_compiles("int main(int argc, char **argv) { int a; __sync_lock_test_and_set(&a, 1); - __sync_lock_release(&a); }" HAVE_GCC_SYNC_LOCK_TEST_AND_SET) + __sync_lock_release(&a); + return 0; }" HAVE_GCC_SYNC_LOCK_TEST_AND_SET) endif() endif() set(CMAKE_REQUIRED_FLAGS "-mpreferred-stack-boundary=2") - check_c_source_compiles("int x = 0; int main(int argc, char **argv) {}" + check_c_source_compiles("int x = 0; int main(int argc, char **argv) { return 0; }" HAVE_GCC_PREFERRED_STACK_BOUNDARY) set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) @@ -576,7 +620,7 @@ if(USE_GCC OR USE_CLANG) #if !defined(__GNUC__) || __GNUC__ < 4 #error SDL only uses visibility attributes in GCC 4 or newer #endif - int main(int argc, char **argv) {}" HAVE_GCC_FVISIBILITY) + int main(int argc, char **argv) { return 0; }" HAVE_GCC_FVISIBILITY) if(HAVE_GCC_FVISIBILITY) list(APPEND EXTRA_CFLAGS "-fvisibility=hidden") endif() @@ -588,15 +632,16 @@ if(USE_GCC OR USE_CLANG) 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() @@ -609,10 +654,19 @@ if(USE_GCC OR USE_CLANG) 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. + set_property(SOURCE src/stdlib/SDL_memcpy.c src/stdlib/SDL_memset.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) @@ -632,7 +686,7 @@ if(SDL_ASSEMBLY) #ifndef __MMX__ #error Assembler CPP flag not enabled #endif - int main(int argc, char **argv) { }" HAVE_MMX) + int main(int argc, char **argv) { return 0; }" HAVE_MMX) if(HAVE_MMX) list(APPEND EXTRA_CFLAGS "-mmmx") endif() @@ -649,6 +703,7 @@ if(SDL_ASSEMBLY) int main(int argc, char **argv) { void *p = 0; _m_prefetch(p); + return 0; }" HAVE_3DNOW) if(HAVE_3DNOW) list(APPEND EXTRA_CFLAGS "-m3dnow") @@ -672,7 +727,7 @@ if(SDL_ASSEMBLY) #ifndef __SSE__ #error Assembler CPP flag not enabled #endif - int main(int argc, char **argv) { }" HAVE_SSE) + int main(int argc, char **argv) { return 0; }" HAVE_SSE) if(HAVE_SSE) list(APPEND EXTRA_CFLAGS "-msse") endif() @@ -695,7 +750,7 @@ if(SDL_ASSEMBLY) #ifndef __SSE2__ #error Assembler CPP flag not enabled #endif - int main(int argc, char **argv) { }" HAVE_SSE2) + int main(int argc, char **argv) { return 0; }" HAVE_SSE2) if(HAVE_SSE2) list(APPEND EXTRA_CFLAGS "-msse2") endif() @@ -718,7 +773,7 @@ if(SDL_ASSEMBLY) #ifndef __SSE3__ #error Assembler CPP flag not enabled #endif - int main(int argc, char **argv) { }" HAVE_SSE3) + int main(int argc, char **argv) { return 0; }" HAVE_SSE3) if(HAVE_SSE3) list(APPEND EXTRA_CFLAGS "-msse3") endif() @@ -747,12 +802,12 @@ if(SDL_ASSEMBLY) vector unsigned int vzero() { return vec_splat_u32(0); } - int main(int argc, char **argv) { }" HAVE_ALTIVEC_H_HDR) + int main(int argc, char **argv) { return 0; }" HAVE_ALTIVEC_H_HDR) check_c_source_compiles(" vector unsigned int vzero() { return vec_splat_u32(0); } - int main(int argc, char **argv) { }" HAVE_ALTIVEC) + int main(int argc, char **argv) { return 0; }" HAVE_ALTIVEC) set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) if(HAVE_ALTIVEC OR HAVE_ALTIVEC_H_HDR) set(HAVE_ALTIVEC TRUE) # if only HAVE_ALTIVEC_H_HDR is set @@ -785,7 +840,7 @@ if(SDL_ASSEMBLY) 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() @@ -813,7 +868,7 @@ if(SDL_ASSEMBLY) 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() @@ -829,7 +884,6 @@ if(SDL_ASSEMBLY) set(HAVE_SSE2 TRUE) set(HAVE_SSE3 TRUE) check_include_file("immintrin.h" HAVE_IMMINTRIN_H) - set(SDL_ASSEMBLY_ROUTINES 1) endif() endif() @@ -845,7 +899,7 @@ if(SDL_LIBC) 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 @@ -857,9 +911,7 @@ if(SDL_LIBC) string(TOUPPER ${_FN} _UPPER) set(HAVE_${_UPPER} 1) endforeach() - if(NOT CYGWIN AND NOT MINGW) - set(HAVE_ALLOCA 1) - endif() + set(HAVE_ALLOCA 1) set(HAVE_M_PI 1) target_compile_definitions(sdl-build-options INTERFACE "-D_USE_MATH_DEFINES") # needed for M_PI set(STDC_HEADERS 1) @@ -876,15 +928,14 @@ if(SDL_LIBC) 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 #include - int main() { }" HAVE_MPROTECT) + 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 @@ -965,10 +1016,6 @@ foreach(_SUB ${SDL_SUBSYSTEMS}) set(SDL_${_OPT}_DISABLED 1) endif() endforeach() -if(SDL_JOYSTICK) - file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES}) -endif() if(SDL_HAPTIC) if(NOT SDL_JOYSTICK) # Haptic requires some private functions from the joystick subsystem. @@ -983,14 +1030,16 @@ if(SDL_AUDIO) 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() endif() @@ -1001,7 +1050,7 @@ if(UNIX OR APPLE) 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() @@ -1015,7 +1064,7 @@ if(SDL_JOYSTICK) 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() @@ -1023,14 +1072,14 @@ if(SDL_VIDEO) 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() @@ -1039,11 +1088,13 @@ endif() # 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) - file(GLOB ANDROID_MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/android/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_MISC_SOURCES}) - set(HAVE_SDL_MISC TRUE) + if(SDL_MISC) + file(GLOB ANDROID_MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/android/*.c) + list(APPEND SOURCE_FILES ${ANDROID_MISC_SOURCES}) + set(HAVE_SDL_MISC TRUE) + endif() # SDL_spinlock.c Needs to be compiled in ARM mode. # There seems to be no better way currently to set the ARM mode. @@ -1055,36 +1106,36 @@ if(ANDROID) 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}) 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) @@ -1093,42 +1144,42 @@ if(ANDROID) 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 @@ -1154,59 +1205,68 @@ if(ANDROID) list(APPEND EXTRA_LIBS ${OpenGLES1_LIBRARY} ${OpenGLES2_LIBRARY}) endif() - CHECK_C_SOURCE_COMPILES(" - #if defined(__ARM_ARCH) && __ARM_ARCH < 7 - #error Vulkan doesn't work on this configuration - #endif - int main(void) { - return 0; - } - " VULKAN_PASSED_ANDROID_CHECKS) - if(NOT VULKAN_PASSED_ANDROID_CHECKS) - set(SDL_VULKAN OFF) - message(STATUS "Vulkan doesn't work on this configuration") + if(SDL_VULKAN) + CHECK_C_SOURCE_COMPILES(" + #if defined(__ARM_ARCH) && __ARM_ARCH < 7 + #error Vulkan doesn't work on this configuration + #endif + int main(int argc, char **argv) { return 0; } + " VULKAN_PASSED_ANDROID_CHECKS) + if(VULKAN_PASSED_ANDROID_CHECKS) + set(SDL_VIDEO_VULKAN 1) + set(HAVE_VULKAN TRUE) + endif() endif() 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 # project. Uncomment at will for verbose cross-compiling -I/../ path info. target_compile_options(sdl-build-options INTERFACE "-Wno-warn-absolute-paths") + + if(SDL_MISC) + file(GLOB EMSRIPTEN_MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/emscripten/*.c) + 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) @@ -1216,7 +1276,7 @@ elseif(EMSCRIPTEN) 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 @@ -1230,22 +1290,22 @@ elseif(EMSCRIPTEN) 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() @@ -1258,7 +1318,6 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS AND NOT HAIKU) CheckNAS() CheckSNDIO() CheckFusionSound() - CheckLibSampleRate() endif() if(SDL_VIDEO) @@ -1274,39 +1333,42 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS AND NOT HAIKU) CheckOpenGLES() CheckWayland() CheckVivante() + # FIXME: implement CheckVulkan() + if(SDL_VULKAN) + set(SDL_VIDEO_VULKAN 1) + set(HAVE_VULKAN TRUE) + endif() endif() 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 #ifndef EVIOCGNAME #error EVIOCGNAME() ioctl not available #endif - int main(int argc, char** argv) {}" HAVE_INPUT_EVENTS) + int main(int argc, char** argv) { return 0; }" HAVE_INPUT_EVENTS) if(LINUX) check_c_source_compiles(" #include #include - - int main(int argc, char **argv) - { + int main(int argc, char **argv) { struct kbentry kbe; kbe.kb_table = KG_CTRL; ioctl(0, KDGKBENT, &kbe); + return 0; }" HAVE_INPUT_KD) elseif(FREEBSD) check_c_source_compiles(" #include #include - - int main(int argc, char **argv) - { + int main(int argc, char **argv) { accentmap_t accTable; ioctl(0, KDENABIO, 1); + return 0; }" HAVE_INPUT_KBIO) endif() @@ -1317,7 +1379,7 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS AND NOT HAIKU) 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() @@ -1343,7 +1405,6 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS AND NOT HAIKU) 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() @@ -1352,7 +1413,6 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS AND NOT HAIKU) 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) @@ -1369,45 +1429,47 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS AND NOT HAIKU) 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() @@ -1423,7 +1485,7 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS AND NOT HAIKU) 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() @@ -1448,36 +1510,38 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS AND NOT HAIKU) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_LINUX_VERSION_H") endif() - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/unix/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${MISC_SOURCES}) - set(HAVE_SDL_MISC TRUE) + if(SDL_MISC) + file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/unix/*.c) + list(APPEND SOURCE_FILES ${MISC_SOURCES}) + set(HAVE_SDL_MISC TRUE) + endif() if(SDL_POWER) 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() @@ -1504,10 +1568,10 @@ elseif(WINDOWS) check_c_source_compiles(" #include - int main(int argc, char **argv) { }" HAVE_WIN32_CC) + 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) @@ -1517,21 +1581,20 @@ elseif(WINDOWS) 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() - if(WINDOWS_STORE) - file(GLOB WINRT_MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/winrt/*.cpp) - set(SOURCE_FILES ${SOURCE_FILES} ${WINRT_MISC_SOURCES}) - else() - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/windows/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${MISC_SOURCES}) + if(SDL_MISC) + if(WINDOWS_STORE) + file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/winrt/*.cpp) + else() + file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/windows/*.c) + endif() + list(APPEND SOURCE_FILES ${MISC_SOURCES}) + set(HAVE_SDL_MISC TRUE) endif() - set(HAVE_SDL_MISC TRUE) - - set(SDL_LINK_DIR ${PARENT_SCOPE}) # Check for DirectX if(SDL_DIRECTX) @@ -1547,14 +1610,22 @@ elseif(WINDOWS) 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 @@ -1565,49 +1636,50 @@ elseif(WINDOWS) set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) endif() - link_directories(${SDL_LINK_DIR}) - if(SDL_XINPUT) # xinput.h may need windows.h, but does not include it itself. check_c_source_compiles(" #include #include - int main(int argc, char **argv) { }" HAVE_XINPUT_H) + int main(int argc, char **argv) { return 0; }" HAVE_XINPUT_H) check_c_source_compiles(" #include #include XINPUT_GAMEPAD_EX x1; - int main(int argc, char **argv) { }" HAVE_XINPUT_GAMEPAD_EX) + int main(int argc, char **argv) { return 0; }" HAVE_XINPUT_GAMEPAD_EX) check_c_source_compiles(" #include #include XINPUT_STATE_EX s1; - int main(int argc, char **argv) { }" HAVE_XINPUT_STATE_EX) + int main(int argc, char **argv) { return 0; }" HAVE_XINPUT_STATE_EX) check_c_source_compiles(" #define COBJMACROS #include __x_ABI_CWindows_CGaming_CInput_CIGamepadStatics2 *s2; - int main(int argc, char **argv) { }" HAVE_WINDOWS_GAMING_INPUT_H) + int main(int argc, char **argv) { return 0; }" HAVE_WINDOWS_GAMING_INPUT_H) endif() # headers needed elsewhere check_include_file(tpcshrd.h HAVE_TPCSHRD_H) + check_include_file(roapi.h HAVE_ROAPI_H) 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}) + set(SDL_AUDIO_DRIVER_WINMM 1) + file(GLOB WINMM_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/winmm/*.c) + list(APPEND SOURCE_FILES ${WINMM_AUDIO_SOURCES}) + set(HAVE_SDL_AUDIO TRUE) endif() - set(HAVE_SDL_AUDIO TRUE) 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() if(SDL_WASAPI AND HAVE_AUDIOCLIENT_H AND HAVE_MMDEVICEAPI_H) @@ -1617,7 +1689,8 @@ elseif(WINDOWS) 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() @@ -1634,10 +1707,10 @@ elseif(WINDOWS) ${SDL2_SOURCE_DIR}/src/render/direct3d11/*.cpp ) else() - set(SDL_VIDEO_DRIVER_WINDOWS 1) - file(GLOB WIN_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/windows/*.c) + 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) @@ -1647,13 +1720,17 @@ elseif(WINDOWS) 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 @@ -1667,16 +1744,16 @@ elseif(WINDOWS) 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() @@ -1687,7 +1764,7 @@ elseif(WINDOWS) 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() @@ -1698,7 +1775,7 @@ elseif(WINDOWS) 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() @@ -1719,19 +1796,19 @@ elseif(WINDOWS) 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) @@ -1747,6 +1824,11 @@ elseif(WINDOWS) set(SDL_VIDEO_RENDER_OGL_ES2 1) set(HAVE_OPENGLES TRUE) endif() + + if(SDL_VULKAN) + set(SDL_VIDEO_VULKAN 1) + set(HAVE_VULKAN TRUE) + endif() endif() if(SDL_HIDAPI) @@ -1755,7 +1837,7 @@ elseif(WINDOWS) 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) @@ -1765,8 +1847,10 @@ elseif(WINDOWS) list(APPEND EXTRA_LIBS dinput8) endif() if(HAVE_XINPUT_H) - set(SDL_JOYSTICK_XINPUT 1) - set(HAVE_XINPUT TRUE) + if(NOT WINDOWS_STORE) + set(SDL_JOYSTICK_XINPUT 1) + set(HAVE_XINPUT TRUE) + endif() if(HAVE_WINDOWS_GAMING_INPUT_H) set(SDL_JOYSTICK_WGI 1) endif() @@ -1774,7 +1858,7 @@ elseif(WINDOWS) set(HAVE_SDL_JOYSTICK TRUE) if(SDL_HAPTIC) - if(HAVE_DINPUT_H OR HAVE_XINPUT_H) + if((HAVE_DINPUT_H OR HAVE_XINPUT_H) AND NOT WINDOWS_STORE) file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/windows/*.c) if(HAVE_DINPUT_H) set(SDL_HAPTIC_DINPUT 1) @@ -1786,7 +1870,7 @@ elseif(WINDOWS) 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() @@ -1794,13 +1878,11 @@ elseif(WINDOWS) 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) @@ -1820,29 +1902,28 @@ elseif(APPLE) # 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}) - # !!! FIXME: modern CMake doesn't need "LANGUAGE C" for Objective-C. - set_source_files_properties(${EXTRA_SOURCES} PROPERTIES LANGUAGE C) + list(APPEND SOURCE_FILES ${EXTRA_SOURCES}) set(HAVE_SDL_FILE TRUE) - else() - message_error("SDL_FILE must be enabled to build on MacOS X") endif() if(IOS OR TVOS) - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/ios/*.m) file(GLOB SDLMAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/uikit/*.c) - else() - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/macosx/*.m) endif() - set(SOURCE_FILES ${SOURCE_FILES} ${MISC_SOURCES}) - set(HAVE_SDL_MISC TRUE) + + if(SDL_MISC) + if(IOS OR TVOS) + file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/ios/*.m) + else() + file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/macosx/*.m) + endif() + 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) - # !!! FIXME: modern CMake doesn't need "LANGUAGE C" for Objective-C. - set_source_files_properties(${AUDIO_SOURCES} PROPERTIES LANGUAGE C) - 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) @@ -1863,7 +1944,6 @@ elseif(APPLE) endif() set(SDL_FRAMEWORK_GAMECONTROLLER 1) set(SDL_FRAMEWORK_COREHAPTICS 1) - set(HAVE_SDL_SENSORS 1) else() file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/darwin/*.c) set_source_files_properties(${MFI_JOYSTICK_SOURCES} PROPERTIES COMPILE_FLAGS -fobjc-weak) @@ -1878,13 +1958,13 @@ elseif(APPLE) #if TARGET_CPU_X86 #error GameController framework doesn't work on this configuration #endif - int main() {}" HAVE_FRAMEWORK_GAMECONTROLLER) + int main() { return 0; }" HAVE_FRAMEWORK_GAMECONTROLLER) check_objc_source_compiles(" #include #include #import #import - int main() {}" HAVE_FRAMEWORK_COREHAPTICS) + int main() { return 0; }" HAVE_FRAMEWORK_COREHAPTICS) if(HAVE_FRAMEWORK_GAMECONTROLLER AND HAVE_FRAMEWORK_COREHAPTICS) # Only enable MFI if we also have CoreHaptics to ensure rumble works set(SDL_JOYSTICK_MFI 1) @@ -1895,7 +1975,7 @@ elseif(APPLE) 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() @@ -1909,11 +1989,8 @@ elseif(APPLE) 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) - if(NOT SDL_JOYSTICK) - message(FATAL_ERROR "SDL_HAPTIC requires SDL_JOYSTICK to be enabled") - endif() endif() if(SDL_POWER) @@ -1925,29 +2002,27 @@ elseif(APPLE) 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) - # !!! FIXME: modern CMake doesn't need "LANGUAGE C" for Objective-C. - set_source_files_properties(${FILESYSTEM_SOURCES} PROPERTIES LANGUAGE C) - set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES}) + list(APPEND SOURCE_FILES ${FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() @@ -1956,7 +2031,7 @@ elseif(APPLE) 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() @@ -1970,7 +2045,8 @@ elseif(APPLE) 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() if(SDL_OPENGL) @@ -1995,9 +2071,7 @@ elseif(APPLE) endif() if(SDL_VULKAN OR SDL_METAL OR SDL_RENDER_METAL) - set(ORIG_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -ObjC") - check_c_source_compiles(" + check_objc_source_compiles(" #include #import #import @@ -2005,32 +2079,26 @@ elseif(APPLE) #if (!TARGET_CPU_X86_64 && !TARGET_CPU_ARM64) #error Metal doesn't work on this configuration #endif - int main(void) { - return 0; - } - " HAVE_FRAMEWORK_METAL) - set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) + int main(int argc, char **argv) { return 0; }" HAVE_FRAMEWORK_METAL) if(HAVE_FRAMEWORK_METAL) set(SDL_FRAMEWORK_METAL 1) set(SDL_FRAMEWORK_QUARTZCORE 1) - else() - set(SDL_VULKAN 0) - set(SDL_METAL 0) - set(SDL_RENDER_METAL 0) + if(SDL_VULKAN) + set(SDL_VIDEO_VULKAN 1) + set(HAVE_VULKAN TRUE) + endif() + if(SDL_METAL) + set(SDL_VIDEO_METAL 1) + set(HAVE_METAL TRUE) + endif() + if(SDL_RENDER_METAL) + file(GLOB RENDER_METAL_SOURCES ${SDL2_SOURCE_DIR}/src/render/metal/*.m) + list(APPEND SOURCE_FILES ${RENDER_METAL_SOURCES}) + set(SDL_VIDEO_RENDER_METAL 1) + set(HAVE_RENDER_METAL TRUE) + endif() endif() endif() - - if(SDL_METAL) - set(SDL_VIDEO_METAL 1) - set(HAVE_METAL TRUE) - 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}) - set(SDL_VIDEO_RENDER_METAL 1) - set(HAVE_RENDER_METAL TRUE) - endif() endif() # Actually load the frameworks at the end so we don't duplicate include. @@ -2125,25 +2193,27 @@ elseif(HAIKU) 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() - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/haiku/*.cc) - set(SOURCE_FILES ${SOURCE_FILES} ${MISC_SOURCES}) - set(HAVE_SDL_MISC TRUE) + if(SDL_MISC) + file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/haiku/*.cc) + 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) @@ -2159,59 +2229,61 @@ elseif(HAIKU) 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) elseif(RISCOS) - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/riscos/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${MISC_SOURCES}) - set(HAVE_SDL_MISC TRUE) + if(SDL_MISC) + file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/riscos/*.c) + 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) @@ -2232,37 +2304,39 @@ elseif(VITA) set_source_files_properties(${SDL2_SOURCE_DIR}/src/atomic/SDL_spinlock.c PROPERTIES COMPILE_FLAGS -marm) endif() - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/vita/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${MISC_SOURCES}) - set(HAVE_SDL_MISC TRUE) + if(SDL_MISC) + file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/vita/*.c) + 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 @@ -2270,22 +2344,27 @@ elseif(VITA) ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_systls.c) set(HAVE_SDL_THREADS TRUE) endif() + if(SDL_LOCALE) + file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/vita/*.c) + 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) @@ -2296,10 +2375,10 @@ elseif(VITA) list(APPEND EXTRA_LIBS pib ) - set(HAVE_VITA_PIB ON) + set(HAVE_VIDEO_VITA_PIB ON) set(SDL_VIDEO_VITA_PIB 1) else() - set(HAVE_VITA_PIB OFF) + set(HAVE_VIDEO_VITA_PIB OFF) endif() endif() @@ -2307,6 +2386,7 @@ elseif(VITA) check_include_file(gpu_es4/psp2_pvr_hint.h HAVE_PVR_H) if(HAVE_PVR_H) target_compile_definitions(sdl-build-options INTERFACE "-D__psp2__") + check_include_file(gl4esinit.h HAVE_GL4ES_H) set(SDL_VIDEO_OPENGL_EGL 1) set(HAVE_OPENGLES TRUE) set(SDL_VIDEO_OPENGL_ES 1) @@ -2318,10 +2398,20 @@ elseif(VITA) libgpu_es4_ext_stub_weak libIMGEGL_stub_weak ) - set(HAVE_VITA_PVR ON) + + set(HAVE_VIDEO_VITA_PVR ON) set(SDL_VIDEO_VITA_PVR 1) + + if(HAVE_GL4ES_H) + set(HAVE_OPENGL TRUE) + set(SDL_VIDEO_OPENGL 1) + set(SDL_VIDEO_RENDER_OGL 1) + list(APPEND EXTRA_LIBS libGL_stub) + set(SDL_VIDEO_VITA_PVR_OGL 1) + endif() + else() - set(HAVE_VITA_PVR OFF) + set(HAVE_VIDEO_VITA_PVR OFF) endif() endif() @@ -2332,7 +2422,9 @@ elseif(VITA) SceDisplay_stub SceCtrl_stub SceAppMgr_stub + SceAppUtil_stub SceAudio_stub + SceAudioIn_stub SceSysmodule_stub SceDisplay_stub SceCtrl_stub @@ -2363,12 +2455,12 @@ elseif(VITA) # 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(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) @@ -2383,49 +2475,49 @@ elseif(VITA) 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() @@ -2441,63 +2533,108 @@ elseif(PSP) 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") + + 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() + + list(APPEND EXTRA_LIBS + patches + 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() @@ -2505,7 +2642,7 @@ elseif(OS2) 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() @@ -2514,15 +2651,14 @@ elseif(OS2) endif() endif() -if(SDL_VULKAN AND NOT SDL_LOADSO) +if(HAVE_VULKAN AND NOT SDL_LOADSO) message(STATUS "Vulkan support is available, but disabled because there's no loadso.") - set(SDL_VULKAN OFF) + set(HAVE_VULKAN FALSE) + set(SDL_VIDEO_VULKAN 0) endif() -if(SDL_VULKAN) - set(SDL_VIDEO_VULKAN 1) - set(HAVE_VULKAN TRUE) -endif() +# Platform-independent options +CheckLibSampleRate() # Dummies # configure.ac does it differently: @@ -2532,54 +2668,62 @@ endif() # so it always adds a dummy, without checking, if it was actually requested. # This leads to missing internal references on building, since the # src/X/*.c does not get included. +if(NOT HAVE_SDL_AUDIO) + set(SDL_AUDIO_DRIVER_DUMMY 1) + file(GLOB AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/dummy/*.c) + 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) + list(APPEND SOURCE_FILES ${VIDEO_SOURCES}) +endif() if(NOT HAVE_SDL_JOYSTICK) set(SDL_JOYSTICK_DUMMY 1) - if(SDL_JOYSTICK AND NOT APPLE) # results in unresolved symbols on OSX - file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/dummy/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES}) - endif() + file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/dummy/*.c) + 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_DISABLED 1) + 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_DISABLED 1) + 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_DISABLED 1) + 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_DISABLED 1) - file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/misc/dummy/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${LOCALE_SOURCES}) + set(SDL_MISC_DUMMY 1) + file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/dummy/*.c) + 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}) + list(APPEND SOURCE_FILES ${THREADS_SOURCES}) endif() if(NOT HAVE_SDL_TIMERS) - set(SDL_TIMERS_DISABLED 1) + 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) @@ -2593,8 +2737,17 @@ endif() # 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) @@ -2638,14 +2791,33 @@ endif() 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 "#") @@ -2665,23 +2837,15 @@ Libs.private:") 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}") @@ -2761,6 +2925,10 @@ if (SDL_ASAN) 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:") @@ -2793,7 +2961,7 @@ endif() 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}") @@ -2828,15 +2996,27 @@ if(WARN_ABOUT_ARM_NEON_ASM_MIT) 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() @@ -2846,14 +3026,16 @@ if(ANDROID) 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(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 @@ -2877,7 +3059,7 @@ if(SDL_SHARED) 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") @@ -2885,31 +3067,42 @@ if(SDL_SHARED) 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}) + 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) + if(MSVC AND NOT SDL_LIBC AND NOT MSVC_CLANG AND NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM") 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") @@ -2917,149 +3110,210 @@ if(SDL_STATIC) # 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() -if(MEGA) - if(SDL_SHARED) - install(TARGETS SDL2 RUNTIME DESTINATION . LIBRARY DESTINATION .) - endif() - return() -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 ##### -if(SDL_SHARED) - install(TARGETS SDL2 EXPORT SDL2Targets - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" - ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") -endif() - -if(NOT WINDOWS_STORE AND NOT SDL2_DISABLE_SDL2MAIN) - install(TARGETS SDL2main EXPORT SDL2mainTargets - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" - ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") -endif() - -if(SDL_STATIC) - install(TARGETS SDL2-static EXPORT SDL2staticTargets - 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") -else () - set(PKG_PREFIX "${CMAKE_INSTALL_LIBDIR}/cmake/SDL2") -endif () - -include(CMakePackageConfigHelpers) -write_basic_package_version_file("${CMAKE_BINARY_DIR}/SDL2ConfigVersion.cmake" - VERSION ${SDL_VERSION} - COMPATIBILITY AnyNewerVersion -) - -if(SDL_SHARED) - install(EXPORT SDL2Targets - FILE SDL2Targets.cmake - NAMESPACE SDL2:: - DESTINATION ${PKG_PREFIX} - ) -endif() - -if(NOT WINDOWS_STORE AND NOT SDL2_DISABLE_SDL2MAIN) - install(EXPORT SDL2mainTargets - FILE SDL2mainTargets.cmake - NAMESPACE SDL2:: - DESTINATION ${PKG_PREFIX} - ) -endif() - -if(SDL_STATIC) - install(EXPORT SDL2staticTargets - FILE SDL2staticTargets.cmake - NAMESPACE SDL2:: - DESTINATION ${PKG_PREFIX} - ) -endif() - -install( - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/SDL2Config.cmake - ${CMAKE_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) - -string(TOUPPER "${CMAKE_BUILD_TYPE}" UPPER_BUILD_TYPE) -if (UPPER_BUILD_TYPE MATCHES DEBUG) - set(SOPOSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}") -else() - set(SOPOSTFIX "") -endif() - -if(NOT (WINDOWS OR CYGWIN) OR MINGW) +if(NOT SDL2_DISABLE_INSTALL) if(SDL_SHARED) - set(SOEXT ${CMAKE_SHARED_LIBRARY_SUFFIX}) # ".so", ".dylib", etc. - get_target_property(SONAME SDL2 OUTPUT_NAME) - if(NOT ANDROID AND NOT MINGW AND NOT OS2) - install(CODE " - execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink - \"lib${SONAME}${SOPOSTFIX}${SOEXT}\" \"libSDL2${SOPOSTFIX}${SOEXT}\" - WORKING_DIRECTORY \"${SDL2_BINARY_DIR}\")") - install(FILES ${SDL2_BINARY_DIR}/libSDL2${SOPOSTFIX}${SOEXT} DESTINATION "${CMAKE_INSTALL_LIBDIR}") + install(TARGETS SDL2 EXPORT SDL2Targets + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") + endif() + + if(NOT WINDOWS_STORE AND NOT SDL2_DISABLE_SDL2MAIN) + install(TARGETS SDL2main EXPORT SDL2mainTargets + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") + endif() + + if(SDL_STATIC) + install(TARGETS SDL2-static EXPORT SDL2staticTargets + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + 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") + else () + set(PKG_PREFIX "${CMAKE_INSTALL_LIBDIR}/cmake/SDL2") + endif () + + include(CMakePackageConfigHelpers) + 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 + ) + + if(SDL_SHARED) + install(EXPORT SDL2Targets + FILE SDL2Targets.cmake + 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(FREEBSD) - # FreeBSD uses ${PREFIX}/libdata/pkgconfig - install(FILES ${SDL2_BINARY_DIR}/sdl2.pc DESTINATION "libdata/pkgconfig") - else() - install(FILES ${SDL2_BINARY_DIR}/sdl2.pc - DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") + + if(NOT WINDOWS_STORE AND NOT SDL2_DISABLE_SDL2MAIN) + install(EXPORT SDL2mainTargets + FILE SDL2mainTargets.cmake + 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) + install(EXPORT SDL2staticTargets + FILE SDL2staticTargets.cmake + 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_BINARY_DIR}/SDL2Config.cmake + ${CMAKE_CURRENT_BINARY_DIR}/SDL2ConfigVersion.cmake + DESTINATION ${PKG_PREFIX} + COMPONENT Devel + ) + + 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) + set(SOPOSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}") + else() + set(SOPOSTFIX "") + endif() + + if(NOT (WINDOWS OR CYGWIN) OR MINGW) + if(SDL_SHARED) + set(SOEXT ${CMAKE_SHARED_LIBRARY_SUFFIX}) # ".so", ".dylib", etc. + get_target_property(SONAME SDL2 OUTPUT_NAME) + if(NOT ANDROID AND NOT MINGW AND NOT OS2) + install(CODE " + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink + \"lib${SONAME}${SOPOSTFIX}${SOEXT}\" \"libSDL2${SOPOSTFIX}${SOEXT}\" + WORKING_DIRECTORY \"${SDL2_BINARY_DIR}\")") + install(FILES ${SDL2_BINARY_DIR}/libSDL2${SOPOSTFIX}${SOEXT} DESTINATION "${CMAKE_INSTALL_LIBDIR}") + endif() + endif() + if(FREEBSD) + # FreeBSD uses ${PREFIX}/libdata/pkgconfig + install(FILES ${SDL2_BINARY_DIR}/sdl2.pc DESTINATION "libdata/pkgconfig") + else() + install(FILES ${SDL2_BINARY_DIR}/sdl2.pc + DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") + endif() + 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() - 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") endif() ##### Uninstall target ##### if(NOT SDL2_DISABLE_UNINSTALL) -if(NOT TARGET uninstall) - configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" - IMMEDIATE @ONLY) + if(NOT TARGET uninstall) + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" + IMMEDIATE @ONLY) - add_custom_target(uninstall - COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) + add_custom_target(uninstall + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) + 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() -endif(NOT SDL2_DISABLE_UNINSTALL) diff --git a/libs/SDL2/INSTALL.txt b/libs/SDL2/INSTALL.txt index efb01d26..f570cb33 100644 --- a/libs/SDL2/INSTALL.txt +++ b/libs/SDL2/INSTALL.txt @@ -8,10 +8,10 @@ To compile and install SDL: * Read the FAQ at https://wiki.libsdl.org/FAQWindows * Run './configure; make; make install' - Mac OS X with Xcode: + macOS with Xcode: * Read docs/README-macosx.md - Mac OS X from the command line: + macOS from the command line: * Run './configure; make; make install' Linux and other UNIX systems: diff --git a/libs/SDL2/Makefile.in b/libs/SDL2/Makefile.in index 81c56fd3..5b063568 100644 --- a/libs/SDL2/Makefile.in +++ b/libs/SDL2/Makefile.in @@ -19,6 +19,7 @@ distfile = $(distdir).tar.gz @SET_MAKE@ SHELL = @SHELL@ CC = @CC@ +CXX = @CXX@ INCLUDE = @INCLUDE@ CFLAGS = @BUILD_CFLAGS@ EXTRA_CFLAGS = @EXTRA_CFLAGS@ @@ -49,7 +50,7 @@ WAYLAND_SCANNER_CODE_MODE = @WAYLAND_SCANNER_CODE_MODE@ 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 src test VisualC VisualC-WinRT Xcode Xcode-iOS wayland-protocols GEN_DIST = SDL2.spec ifneq ($V,1) @@ -79,6 +80,7 @@ HDRS = \ SDL_filesystem.h \ SDL_gamecontroller.h \ SDL_gesture.h \ + SDL_guid.h \ SDL_haptic.h \ SDL_hidapi.h \ SDL_hints.h \ diff --git a/libs/SDL2/Makefile.os2 b/libs/SDL2/Makefile.os2 index 6af282d5..31cd03a7 100644 --- a/libs/SDL2/Makefile.os2 +++ b/libs/SDL2/Makefile.os2 @@ -11,7 +11,10 @@ # wmake -f Makefile.os2 HIDAPI=1 LIBNAME = SDL2 -VERSION = 2.0.20 +MAJOR_VERSION = 2 +MINOR_VERSION = 23 +MICRO_VERSION = 1 +VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION) DESCRIPTION = Simple DirectMedia Layer 2 LIBICONV=0 @@ -28,7 +31,13 @@ INCPATH+= -Iinclude LIBM = SDL2libm.lib TLIB = SDL2test.lib LIBS = mmpm2.lib $(LIBM) -CFLAGS = -bt=os2 -d0 -q -bm -5s -fp5 -fpi87 -sg -oteanbmier -ei +CFLAGS = -bt=os2 -d0 -q -bm -5s -fp5 -fpi87 -sg -oeatxhn -ei +# Debug options: +# - debug messages from OS/2 related code to stdout: +#CFLAGS+= -DOS2DEBUG +# - debug messages from OS/2 code via SDL_LogDebug(): +#CFLAGS+= -DOS2DEBUG=2 + # max warnings: CFLAGS+= -wx # newer OpenWatcom versions enable W303 by default @@ -54,21 +63,19 @@ CFLAGS_DLL+= -DHAVE_LIBUSB_H=1 # building SDL itself (for DECLSPEC): CFLAGS_DLL+= -DBUILD_SDL -# Debug options: -# - debug messages from OS/2 related code to stdout: -#CFLAGS+= -DOS2DEBUG -# - debug messages from OS/2 code via SDL_LogDebug(): -#CFLAGS+= -DOS2DEBUG=2 +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_log.c SDL_dataqueue.c SDL_hints.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 +SRCS = SDL.c SDL_assert.c SDL_error.c SDL_guid.c SDL_log.c SDL_dataqueue.c SDL_hints.c SDL_list.c +SRCS+= SDL_getenv.c SDL_iconv.c SDL_malloc.c SDL_memcpy.c SDL_memset.c SDL_qsort.c SDL_stdlib.c SDL_string.c SDL_strtokr.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 @@ -140,9 +147,11 @@ SDL_blendpoint.obj: SDL_blendpoint.c wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< SDL_RLEaccel.obj: SDL_RLEaccel.c wcc386 $(CFLAGS_DLL) -wcd=201 -fo=$^@ $< +!ifeq HIDAPI 1 # c99 mode needed because of structs with flexible array members in libusb.h SDL_hidapi.obj: SDL_hidapi.c wcc386 $(CFLAGS_DLL) -za99 -fo=$^@ $< +!endif $(LIBICONV_LIB): "src/core/os2/iconv2.lbc" @echo * Creating: $@ diff --git a/libs/SDL2/Makefile.psp b/libs/SDL2/Makefile.psp deleted file mode 100644 index 8e826dce..00000000 --- a/libs/SDL2/Makefile.psp +++ /dev/null @@ -1,117 +0,0 @@ -# The threads code require a rather new PSP SDK with SceLwMutexWorkarea: -# https://github.com/pspdev/pspsdk/commit/276d9e3ca6fb26479ad050c21431b2a40f518365 -# -TARGET_LIB = libSDL2.a -EXTRA_TARGETS = libSDL2main.a -OBJS= src/SDL.o \ - src/SDL_assert.o \ - src/SDL_dataqueue.o \ - src/SDL_error.o \ - src/SDL_hints.o \ - src/SDL_log.o \ - src/atomic/SDL_atomic.o \ - src/atomic/SDL_spinlock.o \ - src/audio/SDL_audio.o \ - src/audio/SDL_audiocvt.o \ - src/audio/SDL_audiodev.o \ - src/audio/SDL_audiotypecvt.o \ - src/audio/SDL_mixer.o \ - src/audio/SDL_wave.o \ - src/audio/psp/SDL_pspaudio.o \ - src/cpuinfo/SDL_cpuinfo.o \ - src/events/SDL_clipboardevents.o \ - src/events/SDL_displayevents.o \ - src/events/SDL_dropevents.o \ - src/events/SDL_events.o \ - src/events/SDL_gesture.o \ - src/events/SDL_keyboard.o \ - src/events/SDL_mouse.o \ - src/events/SDL_quit.o \ - src/events/SDL_touch.o \ - src/events/SDL_windowevents.o \ - src/file/SDL_rwops.o \ - src/haptic/SDL_haptic.o \ - src/haptic/dummy/SDL_syshaptic.o \ - src/hidapi/SDL_hidapi.o \ - src/joystick/SDL_joystick.o \ - src/joystick/SDL_gamecontroller.o \ - src/joystick/psp/SDL_sysjoystick.o \ - src/joystick/virtual/SDL_virtualjoystick.o \ - src/power/SDL_power.o \ - src/power/psp/SDL_syspower.o \ - src/filesystem/psp/SDL_sysfilesystem.o \ - src/locale/SDL_locale.o \ - src/locale/dummy/SDL_syslocale.o \ - src/misc/SDL_url.o \ - src/misc/dummy/SDL_sysurl.o \ - src/render/SDL_render.o \ - src/render/SDL_yuv_sw.o \ - src/render/psp/SDL_render_psp.o \ - src/render/software/SDL_blendfillrect.o \ - src/render/software/SDL_blendline.o \ - src/render/software/SDL_blendpoint.o \ - src/render/software/SDL_drawline.o \ - src/render/software/SDL_drawpoint.o \ - src/render/software/SDL_render_sw.o \ - src/render/software/SDL_rotate.o \ - src/render/software/SDL_triangle.o \ - src/sensor/SDL_sensor.o \ - src/sensor/dummy/SDL_dummysensor.o \ - src/stdlib/SDL_getenv.o \ - src/stdlib/SDL_iconv.o \ - src/stdlib/SDL_malloc.o \ - src/stdlib/SDL_qsort.o \ - src/stdlib/SDL_stdlib.o \ - src/stdlib/SDL_string.o \ - src/stdlib/SDL_strtokr.o \ - src/thread/SDL_thread.o \ - src/thread/generic/SDL_systls.o \ - src/thread/psp/SDL_syssem.o \ - src/thread/psp/SDL_systhread.o \ - src/thread/psp/SDL_sysmutex.o \ - src/thread/psp/SDL_syscond.o \ - src/timer/SDL_timer.o \ - src/timer/psp/SDL_systimer.o \ - src/video/SDL_RLEaccel.o \ - src/video/SDL_blit.o \ - src/video/SDL_blit_0.o \ - src/video/SDL_blit_1.o \ - src/video/SDL_blit_A.o \ - src/video/SDL_blit_N.o \ - src/video/SDL_blit_auto.o \ - src/video/SDL_blit_copy.o \ - src/video/SDL_blit_slow.o \ - src/video/SDL_bmp.o \ - src/video/SDL_clipboard.o \ - src/video/SDL_fillrect.o \ - src/video/SDL_pixels.o \ - src/video/SDL_rect.o \ - src/video/SDL_stretch.o \ - src/video/SDL_surface.o \ - src/video/SDL_video.o \ - src/video/SDL_yuv.o \ - src/video/psp/SDL_pspevents.o \ - src/video/psp/SDL_pspvideo.o \ - src/video/psp/SDL_pspgl.o \ - src/video/psp/SDL_pspmouse.o \ - src/video/yuv2rgb/yuv_rgb.o - -SDLMAIN_OBJ = src/main/psp/SDL_psp_main.o -EXTRA_CLEAN = $(SDLMAIN_OBJ) - -INCDIR = ./include -CFLAGS = -g -O2 -G0 -Wall -D__PSP__ -DHAVE_OPENGL -CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti -ASFLAGS = $(CFLAGS) - -LIBDIR = -LIBS = -lGL -lGLU -lglut -lz \ - -lpspvfpu -lpsphprm -lpspsdk -lpspctrl -lpspumd -lpsprtc -lpsppower -lpspgum -lpspgu -lpspaudiolib -lpspaudio -lpsphttp -lpspssl -lpspwlan \ - -lpspnet_adhocmatching -lpspnet_adhoc -lpspnet_adhocctl -lm -lpspvram - -PSPSDK=$(shell psp-config --pspsdk-path) -include $(PSPSDK)/lib/build.mak - -libSDL2main.a: $(SDLMAIN_OBJ) - $(AR) cru $@ $^ - $(RANLIB) $@ diff --git a/libs/SDL2/Makefile.w32 b/libs/SDL2/Makefile.w32 new file mode 100644 index 00000000..8c9c22e6 --- /dev/null +++ b/libs/SDL2/Makefile.w32 @@ -0,0 +1,273 @@ +# Open Watcom makefile to build SDL2.dll for Win32 +# wmake -f Makefile.w32 + +LIBNAME = SDL2 +MAJOR_VERSION = 2 +MINOR_VERSION = 23 +MICRO_VERSION = 1 +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 +SRCS+= SDL_getenv.c SDL_iconv.c SDL_malloc.c SDL_memcpy.c SDL_memset.c SDL_qsort.c SDL_stdlib.c SDL_string.c SDL_strtokr.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_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_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_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 --git a/libs/SDL2/Makefile.wiz b/libs/SDL2/Makefile.wiz deleted file mode 100644 index 34776dac..00000000 --- a/libs/SDL2/Makefile.wiz +++ /dev/null @@ -1,88 +0,0 @@ -# Makefile to build the pandora SDL library -WIZSDK = /mythtv/media/devel/toolchains/openwiz/arm-openwiz-linux-gnu - -AR = $(WIZSDK)/bin/arm-openwiz-linux-gnu-ar -RANLIB = $(WIZSDK)/bin/arm-openwiz-linux-gnu-ranlib -CC = $(WIZSDK)/bin/arm-openwiz-linux-gnu-gcc -CXX = $(WIZSDK)/bin/arm-openwiz-linux-gnu-g++ -STRIP = $(WIZSDK)/bin/arm-openwiz-linux-gnu-strip - -CFLAGS = -Wall -fPIC -I./include -I$(WIZSDK)/include -DWIZ_GLES_LITE - -TARGET_STATIC = libSDL2.a -TARGET_SHARED = libSDL2.so - -SOURCES = \ - ./src/*.c \ - ./src/atomic/*.c \ - ./src/audio/*.c \ - ./src/audio/disk/*.c \ - ./src/audio/dsp/*.c \ - ./src/audio/dummy/*.c \ - ./src/cpuinfo/*.c \ - ./src/events/*.c \ - ./src/file/*.c \ - ./src/filesystem/unix/*.c \ - ./src/haptic/*.c \ - ./src/haptic/linux/*.c \ - ./src/hidapi/*.c \ - ./src/joystick/*.c \ - ./src/joystick/linux/*.c \ - ./src/loadso/dlopen/*.c \ - ./src/locale/*.c \ - ./src/locale/unix/*.c \ - ./src/misc/*.c \ - ./src/misc/unix/*.c \ - ./src/power/*.c \ - ./src/sensor/*.c \ - ./src/sensor/dummy/*.c \ - ./src/stdlib/*.c \ - ./src/thread/*.c \ - ./src/thread/pthread/SDL_syscond.c \ - ./src/thread/pthread/SDL_sysmutex.c \ - ./src/thread/pthread/SDL_syssem.c \ - ./src/thread/pthread/SDL_systhread.c \ - ./src/timer/*.c \ - ./src/timer/unix/*.c \ - ./src/video/*.c \ - ./src/video/yuv2rgb/*.c \ - ./src/video/dummy/*.c \ - ./src/video/pandora/*.c - -OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g') - -all: config_copy $(TARGET_STATIC) $(TARGET_SHARED) - -$(TARGET_STATIC): $(OBJECTS) - $(AR) crv $@ $^ - $(RANLIB) $@ - -$(TARGET_SHARED): - $(CC) -shared -Wl,-soname,$(TARGET_SHARED).0 -o $(TARGET_SHARED).0.0.1 $(OBJECTS) - ln -s $(TARGET_SHARED).0.0.1 $(TARGET_SHARED).0 - ln -s $(TARGET_SHARED).0 $(TARGET_SHARED) - -config_copy: - cp include/SDL_config_wiz.h include/SDL_config.h - -clean: - rm -f $(TARGET_STATIC) $(TARGET_SHARED)* $(OBJECTS) - -install: - mkdir -p $(WIZSDK)/lib - mkdir -p $(WIZSDK)/include/SDL2 - cp -f $(TARGET_STATIC) $(WIZSDK)/lib - cp -f $(TARGET_SHARED).0.0.1 $(WIZSDK)/lib - rm -f $(WIZSDK)/lib/$(TARGET_SHARED).0 $(WIZSDK)/lib/$(TARGET_SHARED) - ln -s $(WIZSDK)/lib/$(TARGET_SHARED).0.0.1 $(WIZSDK)/lib/$(TARGET_SHARED).0 - ln -s $(WIZSDK)/lib/$(TARGET_SHARED).0 $(WIZSDK)/lib/$(TARGET_SHARED) - - cp $(TARGET_STATIC) ../../toolchain/libs - cp $(TARGET_SHARED).0.0.1 ../../toolchain/libs - rm -f ../../toolchain/libs/$(TARGET_SHARED).0 ../../toolchain/libs/$(TARGET_SHARED) - ln -s ../../toolchain/libs/$(TARGET_SHARED).0.0.1 ../../toolchain/libs/$(TARGET_SHARED).0 - ln -s ../../toolchain/libs/$(TARGET_SHARED).0 ../../toolchain/libs/$(TARGET_SHARED) - - cp $(TARGET_SHARED).0.0.1 ../nehe_demos/build/$(TARGET_SHARED).0 - cp -f include/*.h $(WIZSDK)/include/SDL2/ - cp -f include/*.h ../../toolchain/include/SDL2/ diff --git a/libs/SDL2/SDL2Config.cmake b/libs/SDL2/SDL2Config.cmake deleted file mode 100644 index 3e4ebe1e..00000000 --- a/libs/SDL2/SDL2Config.cmake +++ /dev/null @@ -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 --git a/libs/SDL2/SDL2Config.cmake.in b/libs/SDL2/SDL2Config.cmake.in new file mode 100644 index 00000000..8c18aa5d --- /dev/null +++ b/libs/SDL2/SDL2Config.cmake.in @@ -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 --git a/libs/SDL2/VisualC-GDK/SDL.sln b/libs/SDL2/VisualC-GDK/SDL.sln new file mode 100644 index 00000000..25842195 --- /dev/null +++ b/libs/SDL2/VisualC-GDK/SDL.sln @@ -0,0 +1,131 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32414.318 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{D69D5741-611F-4E14-8541-1FEE94F50B5A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2", "SDL\SDL.vcxproj", "{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2main", "SDLmain\SDLmain.vcxproj", "{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testsprite2", "tests\testsprite2\testsprite2.vcxproj", "{40FB7794-D3C3-4CFE-BCF4-A80C96635682}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2test", "SDLtest\SDLtest.vcxproj", "{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testgamecontroller", "tests\testgamecontroller\testgamecontroller.vcxproj", "{55812185-D13C-4022-9C81-32E0F4A08305}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testgdk", "tests\testgdk\testgdk.vcxproj", "{1C9A3F71-35A5-4C56-B292-F4375B3C3649}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Gaming.Desktop.x64 = Debug|Gaming.Desktop.x64 + Debug|Gaming.Xbox.Scarlett.x64 = Debug|Gaming.Xbox.Scarlett.x64 + Debug|Gaming.Xbox.XboxOne.x64 = Debug|Gaming.Xbox.XboxOne.x64 + Release|Gaming.Desktop.x64 = Release|Gaming.Desktop.x64 + Release|Gaming.Xbox.Scarlett.x64 = Release|Gaming.Xbox.Scarlett.x64 + Release|Gaming.Xbox.XboxOne.x64 = Release|Gaming.Xbox.XboxOne.x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|Gaming.Desktop.x64.ActiveCfg = Debug|Gaming.Desktop.x64 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|Gaming.Desktop.x64.Build.0 = Debug|Gaming.Desktop.x64 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|Gaming.Xbox.Scarlett.x64.ActiveCfg = Debug|Gaming.Xbox.Scarlett.x64 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|Gaming.Xbox.Scarlett.x64.Build.0 = Debug|Gaming.Xbox.Scarlett.x64 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|Gaming.Xbox.XboxOne.x64.ActiveCfg = Debug|Gaming.Xbox.XboxOne.x64 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|Gaming.Xbox.XboxOne.x64.Build.0 = Debug|Gaming.Xbox.XboxOne.x64 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|Gaming.Desktop.x64.ActiveCfg = Release|Gaming.Desktop.x64 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|Gaming.Desktop.x64.Build.0 = Release|Gaming.Desktop.x64 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|Gaming.Xbox.Scarlett.x64.ActiveCfg = Release|Gaming.Xbox.Scarlett.x64 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|Gaming.Xbox.Scarlett.x64.Build.0 = Release|Gaming.Xbox.Scarlett.x64 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|Gaming.Xbox.XboxOne.x64.ActiveCfg = Release|Gaming.Xbox.XboxOne.x64 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|Gaming.Xbox.XboxOne.x64.Build.0 = Release|Gaming.Xbox.XboxOne.x64 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|Gaming.Desktop.x64.ActiveCfg = Debug|Gaming.Desktop.x64 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|Gaming.Desktop.x64.Build.0 = Debug|Gaming.Desktop.x64 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|Gaming.Xbox.Scarlett.x64.ActiveCfg = Debug|Gaming.Xbox.Scarlett.x64 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|Gaming.Xbox.Scarlett.x64.Build.0 = Debug|Gaming.Xbox.Scarlett.x64 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|Gaming.Xbox.XboxOne.x64.ActiveCfg = Debug|Gaming.Xbox.XboxOne.x64 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Debug|Gaming.Xbox.XboxOne.x64.Build.0 = Debug|Gaming.Xbox.XboxOne.x64 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|Gaming.Desktop.x64.ActiveCfg = Release|Gaming.Desktop.x64 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|Gaming.Desktop.x64.Build.0 = Release|Gaming.Desktop.x64 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|Gaming.Xbox.Scarlett.x64.ActiveCfg = Release|Gaming.Xbox.Scarlett.x64 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|Gaming.Xbox.Scarlett.x64.Build.0 = Release|Gaming.Xbox.Scarlett.x64 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|Gaming.Xbox.XboxOne.x64.ActiveCfg = Release|Gaming.Xbox.XboxOne.x64 + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}.Release|Gaming.Xbox.XboxOne.x64.Build.0 = Release|Gaming.Xbox.XboxOne.x64 + {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Debug|Gaming.Desktop.x64.ActiveCfg = Debug|Gaming.Desktop.x64 + {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Debug|Gaming.Desktop.x64.Build.0 = Debug|Gaming.Desktop.x64 + {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Debug|Gaming.Desktop.x64.Deploy.0 = Debug|Gaming.Desktop.x64 + {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Debug|Gaming.Xbox.Scarlett.x64.ActiveCfg = Debug|Gaming.Xbox.Scarlett.x64 + {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Debug|Gaming.Xbox.Scarlett.x64.Build.0 = Debug|Gaming.Xbox.Scarlett.x64 + {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Debug|Gaming.Xbox.Scarlett.x64.Deploy.0 = Debug|Gaming.Xbox.Scarlett.x64 + {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Debug|Gaming.Xbox.XboxOne.x64.ActiveCfg = Debug|Gaming.Xbox.XboxOne.x64 + {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Debug|Gaming.Xbox.XboxOne.x64.Build.0 = Debug|Gaming.Xbox.XboxOne.x64 + {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Debug|Gaming.Xbox.XboxOne.x64.Deploy.0 = Debug|Gaming.Xbox.XboxOne.x64 + {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release|Gaming.Desktop.x64.ActiveCfg = Release|Gaming.Desktop.x64 + {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release|Gaming.Desktop.x64.Build.0 = Release|Gaming.Desktop.x64 + {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release|Gaming.Desktop.x64.Deploy.0 = Release|Gaming.Desktop.x64 + {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release|Gaming.Xbox.Scarlett.x64.ActiveCfg = Release|Gaming.Xbox.Scarlett.x64 + {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release|Gaming.Xbox.Scarlett.x64.Build.0 = Release|Gaming.Xbox.Scarlett.x64 + {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release|Gaming.Xbox.Scarlett.x64.Deploy.0 = Release|Gaming.Xbox.Scarlett.x64 + {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release|Gaming.Xbox.XboxOne.x64.ActiveCfg = Release|Gaming.Xbox.XboxOne.x64 + {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release|Gaming.Xbox.XboxOne.x64.Build.0 = Release|Gaming.Xbox.XboxOne.x64 + {40FB7794-D3C3-4CFE-BCF4-A80C96635682}.Release|Gaming.Xbox.XboxOne.x64.Deploy.0 = Release|Gaming.Xbox.XboxOne.x64 + {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Debug|Gaming.Desktop.x64.ActiveCfg = Debug|Gaming.Desktop.x64 + {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Debug|Gaming.Desktop.x64.Build.0 = Debug|Gaming.Desktop.x64 + {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Debug|Gaming.Xbox.Scarlett.x64.ActiveCfg = Debug|Gaming.Xbox.Scarlett.x64 + {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Debug|Gaming.Xbox.Scarlett.x64.Build.0 = Debug|Gaming.Xbox.Scarlett.x64 + {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Debug|Gaming.Xbox.XboxOne.x64.ActiveCfg = Debug|Gaming.Xbox.XboxOne.x64 + {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Debug|Gaming.Xbox.XboxOne.x64.Build.0 = Debug|Gaming.Xbox.XboxOne.x64 + {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Release|Gaming.Desktop.x64.ActiveCfg = Release|Gaming.Desktop.x64 + {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Release|Gaming.Desktop.x64.Build.0 = Release|Gaming.Desktop.x64 + {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Release|Gaming.Xbox.Scarlett.x64.ActiveCfg = Release|Gaming.Xbox.Scarlett.x64 + {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Release|Gaming.Xbox.Scarlett.x64.Build.0 = Release|Gaming.Xbox.Scarlett.x64 + {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Release|Gaming.Xbox.XboxOne.x64.ActiveCfg = Release|Gaming.Xbox.XboxOne.x64 + {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}.Release|Gaming.Xbox.XboxOne.x64.Build.0 = Release|Gaming.Xbox.XboxOne.x64 + {55812185-D13C-4022-9C81-32E0F4A08305}.Debug|Gaming.Desktop.x64.ActiveCfg = Debug|Gaming.Desktop.x64 + {55812185-D13C-4022-9C81-32E0F4A08305}.Debug|Gaming.Desktop.x64.Build.0 = Debug|Gaming.Desktop.x64 + {55812185-D13C-4022-9C81-32E0F4A08305}.Debug|Gaming.Desktop.x64.Deploy.0 = Debug|Gaming.Desktop.x64 + {55812185-D13C-4022-9C81-32E0F4A08305}.Debug|Gaming.Xbox.Scarlett.x64.ActiveCfg = Debug|Gaming.Xbox.Scarlett.x64 + {55812185-D13C-4022-9C81-32E0F4A08305}.Debug|Gaming.Xbox.Scarlett.x64.Build.0 = Debug|Gaming.Xbox.Scarlett.x64 + {55812185-D13C-4022-9C81-32E0F4A08305}.Debug|Gaming.Xbox.Scarlett.x64.Deploy.0 = Debug|Gaming.Xbox.Scarlett.x64 + {55812185-D13C-4022-9C81-32E0F4A08305}.Debug|Gaming.Xbox.XboxOne.x64.ActiveCfg = Debug|Gaming.Xbox.XboxOne.x64 + {55812185-D13C-4022-9C81-32E0F4A08305}.Debug|Gaming.Xbox.XboxOne.x64.Build.0 = Debug|Gaming.Xbox.XboxOne.x64 + {55812185-D13C-4022-9C81-32E0F4A08305}.Debug|Gaming.Xbox.XboxOne.x64.Deploy.0 = Debug|Gaming.Xbox.XboxOne.x64 + {55812185-D13C-4022-9C81-32E0F4A08305}.Release|Gaming.Desktop.x64.ActiveCfg = Release|Gaming.Desktop.x64 + {55812185-D13C-4022-9C81-32E0F4A08305}.Release|Gaming.Desktop.x64.Build.0 = Release|Gaming.Desktop.x64 + {55812185-D13C-4022-9C81-32E0F4A08305}.Release|Gaming.Desktop.x64.Deploy.0 = Release|Gaming.Desktop.x64 + {55812185-D13C-4022-9C81-32E0F4A08305}.Release|Gaming.Xbox.Scarlett.x64.ActiveCfg = Release|Gaming.Xbox.Scarlett.x64 + {55812185-D13C-4022-9C81-32E0F4A08305}.Release|Gaming.Xbox.Scarlett.x64.Build.0 = Release|Gaming.Xbox.Scarlett.x64 + {55812185-D13C-4022-9C81-32E0F4A08305}.Release|Gaming.Xbox.Scarlett.x64.Deploy.0 = Release|Gaming.Xbox.Scarlett.x64 + {55812185-D13C-4022-9C81-32E0F4A08305}.Release|Gaming.Xbox.XboxOne.x64.ActiveCfg = Release|Gaming.Xbox.XboxOne.x64 + {55812185-D13C-4022-9C81-32E0F4A08305}.Release|Gaming.Xbox.XboxOne.x64.Build.0 = Release|Gaming.Xbox.XboxOne.x64 + {55812185-D13C-4022-9C81-32E0F4A08305}.Release|Gaming.Xbox.XboxOne.x64.Deploy.0 = Release|Gaming.Xbox.XboxOne.x64 + {1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Debug|Gaming.Desktop.x64.ActiveCfg = Debug|Gaming.Desktop.x64 + {1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Debug|Gaming.Desktop.x64.Build.0 = Debug|Gaming.Desktop.x64 + {1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Debug|Gaming.Desktop.x64.Deploy.0 = Debug|Gaming.Desktop.x64 + {1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Debug|Gaming.Xbox.Scarlett.x64.ActiveCfg = Debug|Gaming.Xbox.Scarlett.x64 + {1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Debug|Gaming.Xbox.Scarlett.x64.Build.0 = Debug|Gaming.Xbox.Scarlett.x64 + {1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Debug|Gaming.Xbox.Scarlett.x64.Deploy.0 = Debug|Gaming.Xbox.Scarlett.x64 + {1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Debug|Gaming.Xbox.XboxOne.x64.ActiveCfg = Debug|Gaming.Xbox.XboxOne.x64 + {1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Debug|Gaming.Xbox.XboxOne.x64.Build.0 = Debug|Gaming.Xbox.XboxOne.x64 + {1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Debug|Gaming.Xbox.XboxOne.x64.Deploy.0 = Debug|Gaming.Xbox.XboxOne.x64 + {1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Release|Gaming.Desktop.x64.ActiveCfg = Release|Gaming.Desktop.x64 + {1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Release|Gaming.Desktop.x64.Build.0 = Release|Gaming.Desktop.x64 + {1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Release|Gaming.Desktop.x64.Deploy.0 = Release|Gaming.Desktop.x64 + {1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Release|Gaming.Xbox.Scarlett.x64.ActiveCfg = Release|Gaming.Xbox.Scarlett.x64 + {1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Release|Gaming.Xbox.Scarlett.x64.Build.0 = Release|Gaming.Xbox.Scarlett.x64 + {1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Release|Gaming.Xbox.Scarlett.x64.Deploy.0 = Release|Gaming.Xbox.Scarlett.x64 + {1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Release|Gaming.Xbox.XboxOne.x64.ActiveCfg = Release|Gaming.Xbox.XboxOne.x64 + {1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Release|Gaming.Xbox.XboxOne.x64.Build.0 = Release|Gaming.Xbox.XboxOne.x64 + {1C9A3F71-35A5-4C56-B292-F4375B3C3649}.Release|Gaming.Xbox.XboxOne.x64.Deploy.0 = Release|Gaming.Xbox.XboxOne.x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {40FB7794-D3C3-4CFE-BCF4-A80C96635682} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} + {55812185-D13C-4022-9C81-32E0F4A08305} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} + {1C9A3F71-35A5-4C56-B292-F4375B3C3649} = {D69D5741-611F-4E14-8541-1FEE94F50B5A} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C320C9F2-1A8F-41D7-B02B-6338F872BCAD} + EndGlobalSection +EndGlobal diff --git a/libs/SDL2/VisualC-GDK/SDL/SDL.vcxproj b/libs/SDL2/VisualC-GDK/SDL/SDL.vcxproj new file mode 100644 index 00000000..c143597a --- /dev/null +++ b/libs/SDL2/VisualC-GDK/SDL/SDL.vcxproj @@ -0,0 +1,756 @@ + + + + + Debug + Gaming.Desktop.x64 + + + Debug + Gaming.Xbox.Scarlett.x64 + + + Debug + Gaming.Xbox.XboxOne.x64 + + + Release + Gaming.Desktop.x64 + + + Release + Gaming.Xbox.Scarlett.x64 + + + Release + Gaming.Xbox.XboxOne.x64 + + + + SDL2 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} + SDL + 10.0 + + + + DynamicLibrary + $(DefaultPlatformToolset) + + + DynamicLibrary + $(DefaultPlatformToolset) + + + DynamicLibrary + $(DefaultPlatformToolset) + + + DynamicLibrary + $(DefaultPlatformToolset) + + + DynamicLibrary + $(DefaultPlatformToolset) + + + DynamicLibrary + $(DefaultPlatformToolset) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + $(SolutionDir)$(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + .\Debug/SDL.tlb + + + Disabled + $(ProjectDir)/../../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + DLL_EXPORT;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + false + Level3 + OldStyle + OnlyExplicitInline + true + + + _DEBUG;%(PreprocessorDefinitions) + + + setupapi.lib;winmm.lib;imm32.lib;version.lib;xgameruntime.lib;vcruntimed.lib;msvcrtd.lib;ucrtd.lib;msvcprtd.lib;%(AdditionalDependencies) + true + Windows + true + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + .\Debug/SDL.tlb + + + Disabled + $(ProjectDir)/../../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + DLL_EXPORT;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + false + Level3 + OldStyle + OnlyExplicitInline + true + + + _DEBUG;%(PreprocessorDefinitions) + + + setupapi.lib;winmm.lib;imm32.lib;version.lib;xgameruntime.lib;d3d12_xs.lib;uuid.lib;vcruntimed.lib;msvcrtd.lib;ucrtd.lib;msvcprtd.lib;%(AdditionalDependencies) + true + Windows + true + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + .\Debug/SDL.tlb + + + Disabled + $(ProjectDir)/../../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + DLL_EXPORT;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + false + Level3 + OldStyle + OnlyExplicitInline + true + + + _DEBUG;%(PreprocessorDefinitions) + + + setupapi.lib;winmm.lib;imm32.lib;version.lib;xgameruntime.lib;d3d12_x.lib;uuid.lib;vcruntimed.lib;msvcrtd.lib;ucrtd.lib;msvcprtd.lib;%(AdditionalDependencies) + true + Windows + true + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + .\Release/SDL.tlb + + + $(ProjectDir)/../../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + DLL_EXPORT;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + false + Level3 + ProgramDatabase + OnlyExplicitInline + true + + + NDEBUG;%(PreprocessorDefinitions) + + + setupapi.lib;winmm.lib;imm32.lib;version.lib;xgameruntime.lib;vcruntime.lib;msvcrt.lib;ucrt.lib;msvcprt.lib;%(AdditionalDependencies) + true + Windows + true + true + true + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + .\Release/SDL.tlb + + + $(ProjectDir)/../../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + DLL_EXPORT;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + false + Level3 + ProgramDatabase + OnlyExplicitInline + true + + + NDEBUG;%(PreprocessorDefinitions) + + + setupapi.lib;winmm.lib;imm32.lib;version.lib;xgameruntime.lib;d3d12_xs.lib;uuid.lib;vcruntime.lib;msvcrt.lib;ucrt.lib;msvcprt.lib;%(AdditionalDependencies) + true + Windows + true + true + true + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + .\Release/SDL.tlb + + + $(ProjectDir)/../../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + DLL_EXPORT;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + false + Level3 + ProgramDatabase + OnlyExplicitInline + true + + + NDEBUG;%(PreprocessorDefinitions) + + + setupapi.lib;winmm.lib;imm32.lib;version.lib;xgameruntime.lib;d3d12_x.lib;uuid.lib;vcruntime.lib;msvcrt.lib;ucrt.lib;msvcprt.lib;%(AdditionalDependencies) + true + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CompileAsCpp + CompileAsCpp + CompileAsCpp + CompileAsCpp + stdcpp17 + stdcpp17 + stdcpp17 + stdcpp17 + + + + + + + + + + + + + + + + + + + + CompileAsCpp + CompileAsCpp + CompileAsCpp + CompileAsCpp + stdcpp17 + stdcpp17 + stdcpp17 + stdcpp17 + + + stdcpp17 + stdcpp17 + stdcpp17 + stdcpp17 + CompileAsCpp + CompileAsCpp + CompileAsCpp + CompileAsCpp + + + + + + + + + + + + + + + + + + + + + + CompileAsCpp + CompileAsCpp + CompileAsCpp + CompileAsCpp + stdcpp17 + stdcpp17 + stdcpp17 + stdcpp17 + + + + stdcpp17 + stdcpp17 + stdcpp17 + stdcpp17 + CompileAsCpp + CompileAsCpp + CompileAsCpp + CompileAsCpp + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CompileAsCpp + CompileAsCpp + CompileAsCpp + CompileAsCpp + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libs/SDL2/VisualC-GDK/SDL/SDL.vcxproj.filters b/libs/SDL2/VisualC-GDK/SDL/SDL.vcxproj.filters new file mode 100644 index 00000000..d005dead --- /dev/null +++ b/libs/SDL2/VisualC-GDK/SDL/SDL.vcxproj.filters @@ -0,0 +1,1367 @@ + + + + + {395b3af0-33d0-411b-b153-de1676bf1ef8} + + + {5a3e3167-75be-414f-8947-a5306df372b2} + + + {546d9ed1-988e-49d3-b1a5-e5b3d19de6c1} + + + {a56247ff-5108-4960-ba6a-6814fd1554ec} + + + {8880dfad-2a06-4e84-ab6e-6583641ad2d1} + + + {2b996a7f-f3e9-4300-a97f-2c907bcd89a9} + + + {5713d682-2bc7-4da4-bcf0-262a98f142eb} + + + {5e27e19f-b3f8-4e2d-b323-b00b2040ec86} + + + {a3ab9cff-8495-4a5c-8af6-27e43199a712} + + + {377061e4-3856-4f05-b916-0d3b360df0f6} + + + {226a6643-1c65-4c7f-92aa-861313d974bb} + + + {ef859522-a7fe-4a00-a511-d6a9896adf5b} + + + {01fd2642-4493-4316-b548-fb829f4c9125} + + + {cce7558f-590a-4f0a-ac0d-e579f76e588e} + + + {7a53c9e4-d4bd-40ed-9265-1625df685121} + + + {4c7a051c-ce7c-426c-bf8c-9187827f9052} + + + {97e2f79f-311b-42ea-81b2-e801649fdd93} + + + {baf97c8c-7e90-41e5-bff8-14051b8d3956} + + + {45e50d3a-56c9-4352-b811-0c60c49a2431} + + + {9d86e0ef-d6f6-4db2-bfc5-b3529406fa8d} + + + {b35fa13c-6ed2-4680-8c56-c7d71b76ceab} + + + {61b61b31-9e26-4171-a3bb-b969f1889726} + + + {f63aa216-6ee7-4143-90d3-32be3787f276} + + + {90bee923-89df-417f-a6c3-3e260a7dd54d} + + + {4c8ad943-c2fb-4014-9ca3-041e0ad08426} + + + {e90fa293-2828-4927-8113-35bf561024a9} + + + {3d68ae70-a9ff-46cf-be69-069f0b02aca0} + + + {ebc2fca3-3c26-45e3-815e-3e0581d5e226} + + + {47c445a2-7014-4e15-9660-7c89a27dddcf} + + + {d008487d-6ed0-4251-848b-79a68e3c1459} + + + {c9e8273e-13ae-47dc-bef8-8ad8e64c9a3d} + + + {0b8e136d-56ae-47e7-9981-e863a57ac616} + + + {bf3febd3-9328-43e8-b196-0fd3be8177dd} + + + {1a62dc68-52d2-4c07-9d81-d94dfe1d0d12} + + + {e9f01b22-34b3-4380-ade6-0e96c74e9c90} + + + {f674f22f-7841-4f3a-974e-c36b2d4823fc} + + + {d7ad92de-4e55-4202-9b2b-1bd9a35fe4dc} + + + {8311d79d-9ad5-4369-99fe-b2fb2659d402} + + + {6c4dfb80-fdf9-497c-a6ff-3cd8f22efde9} + + + {4810e35c-33cb-4da2-bfaf-452da20d3c9a} + + + {2cf93f1d-81fd-4bdc-998c-5e2fa43988bc} + + + {5752b7ab-2344-4f38-95ab-b5d3bc150315} + + + {7a0eae3d-f113-4914-b926-6816d1929250} + + + {ee602cbf-96a2-4b0b-92a9-51d38a727411} + + + {a812185b-9060-4a1c-8431-be4f66894626} + + + {31c16cdf-adc4-4950-8293-28ba530f3882} + + + {add61b53-8144-47d6-bd67-3420a87c4905} + + + {e7cdcf36-b462-49c7-98b7-07ea7b3687f4} + + + {82588eef-dcaa-4f69-b2a9-e675940ce54c} + + + {560239c3-8fa1-4d23-a81a-b8408b2f7d3f} + + + {81711059-7575-4ece-9e68-333b63e992c4} + + + {1e44970f-7535-4bfb-b8a5-ea0cea0349e0} + + + {1dd91224-1176-492b-a2cb-e26153394db0} + + + {e3ecfe50-cf22-41d3-8983-2fead5164b47} + + + {5521d22f-1e52-47a6-8c52-06a3b6bdefd7} + + + {4755f3a6-49ac-46d6-86be-21f5c21f2197} + + + {f48c2b17-1bee-4fec-a7c8-24cf619abe08} + + + {3ab60a46-e18e-450a-a916-328fb8547e59} + + + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + API Headers + + + + + + API Headers + + + API Headers + + + API Headers + + + audio + + + audio + + + audio + + + audio + + + core\windows + + + core\windows + + + core\windows + + + core\windows + + + dynapi + + + dynapi + + + dynapi + + + events + + + events + + + events + + + events + + + events + + + events + + + events + + + events + + + events + + + events + + + events + + + events + + + haptic + + + haptic + + + joystick + + + joystick + + + joystick + + + joystick + + + joystick + + + libm + + + libm + + + hidapi\hidapi + + + locale + + + misc + + + audio\directsound + + + audio\disk + + + audio\dummy + + + audio\winmm + + + audio\wasapi + + + haptic\windows + + + haptic\windows + + + haptic\windows + + + joystick\hidapi + + + joystick\hidapi + + + joystick\windows + + + joystick\windows + + + joystick\windows + + + joystick\windows + + + joystick\virtual + + + video + + + video + + + video + + + video + + + video + + + video + + + video + + + video + + + video + + + video + + + video + + + video + + + video\dummy + + + video\dummy + + + video\dummy + + + video\yuv2rgb + + + video\yuv2rgb + + + video\yuv2rgb + + + video\windows + + + video\windows + + + video\windows + + + video\windows + + + video\windows + + + video\windows + + + video\windows + + + video\windows + + + video\windows + + + video\windows + + + video\windows + + + video\windows + + + video\windows + + + video\windows + + + video\windows + + + video\windows + + + video\windows + + + timer + + + thread + + + thread + + + thread\windows + + + thread\windows + + + thread\generic + + + sensor + + + sensor + + + sensor\dummy + + + sensor\windows + + + render + + + render + + + render + + + render\direct3d + + + render\direct3d11 + + + render\opengl + + + render\opengl + + + render\opengles2 + + + render\opengles2 + + + render\software + + + render\software + + + render\software + + + render\software + + + render\software + + + render\software + + + render\software + + + render\software + + + render\software + + + power + + + video\khronos\vulkan + + + video\khronos\vulkan + + + video\khronos\vulkan + + + video\khronos\vulkan + + + video\khronos\vulkan + + + video\khronos\vulkan + + + video\khronos\vulkan + + + video\khronos\vulkan + + + video\khronos\vulkan + + + video\khronos\vulkan + + + video\khronos\vulkan + + + video\khronos\vulkan + + + video\khronos\vulkan + + + video\khronos\vulkan + + + video\khronos\vulkan + + + video\khronos\vulkan + + + video\khronos\vulkan + + + video\khronos\vulkan + + + video\khronos\vulkan + + + video\khronos\vulkan + + + video\khronos\vulkan + + + + + + + render\direct3d12 + + + + API Headers + + + core\gdk + + + render\direct3d12 + + + + + + + + + + + + + audio + + + audio + + + audio + + + audio + + + audio + + + audio + + + atomic + + + atomic + + + core\windows + + + core\windows + + + core\windows + + + cpuinfo + + + dynapi + + + events + + + events + + + events + + + events + + + events + + + events + + + events + + + events + + + events + + + events + + + file + + + filesystem\windows + + + haptic + + + hidapi + + + joystick + + + joystick + + + joystick + + + libm + + + libm + + + libm + + + libm + + + libm + + + libm + + + libm + + + libm + + + libm + + + libm + + + libm + + + libm + + + libm + + + libm + + + libm + + + libm + + + libm + + + libm + + + libm + + + libm + + + loadso\windows + + + misc + + + misc\windows + + + locale\windows + + + locale + + + audio\directsound + + + audio\disk + + + audio\dummy + + + audio\winmm + + + audio\wasapi + + + audio\wasapi + + + haptic\windows + + + haptic\windows + + + haptic\windows + + + haptic\dummy + + + joystick\dummy + + + joystick\hidapi + + + joystick\hidapi + + + joystick\hidapi + + + joystick\hidapi + + + joystick\hidapi + + + joystick\hidapi + + + joystick\hidapi + + + joystick\hidapi + + + joystick\hidapi + + + joystick\hidapi + + + joystick\hidapi + + + joystick\windows + + + joystick\windows + + + joystick\windows + + + joystick\windows + + + joystick\windows + + + joystick\virtual + + + video + + + video + + + video + + + video + + + video + + + video + + + video + + + video + + + video + + + video + + + video + + + video + + + video + + + video + + + video + + + video + + + video + + + video + + + video + + + video + + + video + + + video\dummy + + + video\dummy + + + video\dummy + + + video\yuv2rgb + + + video\windows + + + video\windows + + + video\windows + + + video\windows + + + video\windows + + + video\windows + + + video\windows + + + video\windows + + + video\windows + + + video\windows + + + video\windows + + + video\windows + + + video\windows + + + timer + + + timer\windows + + + thread + + + thread\windows + + + thread\windows + + + thread\windows + + + thread\windows + + + thread\windows + + + thread\generic + + + stdlib + + + stdlib + + + stdlib + + + stdlib + + + stdlib + + + stdlib + + + stdlib + + + stdlib + + + sensor + + + sensor\dummy + + + sensor\windows + + + render + + + render + + + render + + + render\direct3d + + + render\direct3d + + + render\direct3d11 + + + render\direct3d11 + + + render\opengl + + + render\opengl + + + render\opengles2 + + + render\opengles2 + + + render\software + + + render\software + + + render\software + + + render\software + + + render\software + + + render\software + + + render\software + + + render\software + + + power + + + + power\windows + + + render\direct3d12 + + + render\direct3d12 + + + stdlib + + + stdlib + + + core\gdk + + + render\direct3d12 + + + render\direct3d12 + + + render\direct3d12 + + + + + + \ No newline at end of file diff --git a/libs/SDL2/VisualC-GDK/SDLmain/SDLmain.vcxproj b/libs/SDL2/VisualC-GDK/SDLmain/SDLmain.vcxproj new file mode 100644 index 00000000..a2c05b1c --- /dev/null +++ b/libs/SDL2/VisualC-GDK/SDLmain/SDLmain.vcxproj @@ -0,0 +1,211 @@ + + + + + Debug + Gaming.Desktop.x64 + + + Debug + Gaming.Xbox.Scarlett.x64 + + + Debug + Gaming.Xbox.XboxOne.x64 + + + Release + Gaming.Desktop.x64 + + + Release + Gaming.Xbox.Scarlett.x64 + + + Release + Gaming.Xbox.XboxOne.x64 + + + + + + + SDL2main + {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} + SDLmain + 10.0 + + + + StaticLibrary + $(DefaultPlatformToolset) + + + StaticLibrary + $(DefaultPlatformToolset) + + + StaticLibrary + $(DefaultPlatformToolset) + + + StaticLibrary + $(DefaultPlatformToolset) + + + StaticLibrary + $(DefaultPlatformToolset) + + + StaticLibrary + $(DefaultPlatformToolset) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + $(SolutionDir)$(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + + + + + $(ProjectDir)/../../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + Level3 + OldStyle + true + + + + + + $(ProjectDir)/../../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + Level3 + OldStyle + true + + + + + + $(ProjectDir)/../../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + Level3 + OldStyle + true + + + + + + Disabled + $(ProjectDir)/../../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDLL + false + Level3 + OldStyle + true + + + + + + Disabled + $(ProjectDir)/../../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDLL + false + Level3 + OldStyle + true + + + + + + Disabled + $(ProjectDir)/../../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDLL + false + Level3 + OldStyle + true + + + + + + \ No newline at end of file diff --git a/libs/SDL2/VisualC-GDK/SDLtest/SDLtest.vcxproj b/libs/SDL2/VisualC-GDK/SDLtest/SDLtest.vcxproj new file mode 100644 index 00000000..c2e9348c --- /dev/null +++ b/libs/SDL2/VisualC-GDK/SDLtest/SDLtest.vcxproj @@ -0,0 +1,226 @@ + + + + + Debug + Gaming.Desktop.x64 + + + Debug + Gaming.Xbox.Scarlett.x64 + + + Debug + Gaming.Xbox.XboxOne.x64 + + + Release + Gaming.Desktop.x64 + + + Release + Gaming.Xbox.Scarlett.x64 + + + Release + Gaming.Xbox.XboxOne.x64 + + + + SDL2test + {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A} + SDLtest + 10.0 + + + + StaticLibrary + $(DefaultPlatformToolset) + + + StaticLibrary + $(DefaultPlatformToolset) + + + StaticLibrary + $(DefaultPlatformToolset) + + + StaticLibrary + $(DefaultPlatformToolset) + + + StaticLibrary + $(DefaultPlatformToolset) + + + StaticLibrary + $(DefaultPlatformToolset) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + $(SolutionDir)$(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + + + + + $(ProjectDir)/../../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + Level3 + OldStyle + true + + + + + + $(ProjectDir)/../../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + Level3 + OldStyle + true + + + + + + $(ProjectDir)/../../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + Level3 + OldStyle + true + + + + + + Disabled + $(ProjectDir)/../../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDLL + false + Level3 + OldStyle + true + + + + + + Disabled + $(ProjectDir)/../../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDLL + false + Level3 + OldStyle + true + + + + + + Disabled + $(ProjectDir)/../../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDLL + false + Level3 + OldStyle + true + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libs/SDL2/VisualC-GDK/clean.sh b/libs/SDL2/VisualC-GDK/clean.sh new file mode 100644 index 00000000..a026b71a --- /dev/null +++ b/libs/SDL2/VisualC-GDK/clean.sh @@ -0,0 +1,6 @@ +#!/bin/sh +find . -type f \( -name '*.user' -o -name '*.sdf' -o -name '*.ncb' -o -name '*.suo' \) -print -delete +find . -type f \( -name '*.bmp' -o -name '*.wav' -o -name '*.dat' \) -print -delete +find . -depth -type d \( -name Gaming.Desktop.x64 \) -exec rm -rv {} \; +find . -depth -type d \( -name Gaming.Xbox.Scarlett.x64 \) -exec rm -rv {} \; +find . -depth -type d \( -name Gaming.Xbox.XboxOne.x64 \) -exec rm -rv {} \; diff --git a/libs/SDL2/VisualC-GDK/logos/Logo100x100.png b/libs/SDL2/VisualC-GDK/logos/Logo100x100.png new file mode 100644 index 00000000..2d0333db Binary files /dev/null and b/libs/SDL2/VisualC-GDK/logos/Logo100x100.png differ diff --git a/libs/SDL2/VisualC-GDK/logos/Logo150x150.png b/libs/SDL2/VisualC-GDK/logos/Logo150x150.png new file mode 100644 index 00000000..046a8fb1 Binary files /dev/null and b/libs/SDL2/VisualC-GDK/logos/Logo150x150.png differ diff --git a/libs/SDL2/VisualC-GDK/logos/Logo44x44.png b/libs/SDL2/VisualC-GDK/logos/Logo44x44.png new file mode 100644 index 00000000..3ca25b56 Binary files /dev/null and b/libs/SDL2/VisualC-GDK/logos/Logo44x44.png differ diff --git a/libs/SDL2/VisualC-GDK/logos/Logo480x480.png b/libs/SDL2/VisualC-GDK/logos/Logo480x480.png new file mode 100644 index 00000000..11231500 Binary files /dev/null and b/libs/SDL2/VisualC-GDK/logos/Logo480x480.png differ diff --git a/libs/SDL2/VisualC-GDK/logos/SplashScreenImage.png b/libs/SDL2/VisualC-GDK/logos/SplashScreenImage.png new file mode 100644 index 00000000..def578f6 Binary files /dev/null and b/libs/SDL2/VisualC-GDK/logos/SplashScreenImage.png differ diff --git a/libs/SDL2/VisualC-GDK/tests/testgamecontroller/PackageLayout.xml b/libs/SDL2/VisualC-GDK/tests/testgamecontroller/PackageLayout.xml new file mode 100644 index 00000000..cda188c7 --- /dev/null +++ b/libs/SDL2/VisualC-GDK/tests/testgamecontroller/PackageLayout.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/libs/SDL2/VisualC-GDK/tests/testgamecontroller/testgamecontroller.vcxproj b/libs/SDL2/VisualC-GDK/tests/testgamecontroller/testgamecontroller.vcxproj new file mode 100644 index 00000000..ca6473c8 --- /dev/null +++ b/libs/SDL2/VisualC-GDK/tests/testgamecontroller/testgamecontroller.vcxproj @@ -0,0 +1,444 @@ + + + + + Debug + Gaming.Desktop.x64 + + + Debug + Gaming.Xbox.Scarlett.x64 + + + Debug + Gaming.Xbox.XboxOne.x64 + + + Release + Gaming.Desktop.x64 + + + Release + Gaming.Xbox.Scarlett.x64 + + + Release + Gaming.Xbox.XboxOne.x64 + + + + {55812185-D13C-4022-9C81-32E0F4A08305} + testgamecontroller + 10.0 + + + + Application + $(DefaultPlatformToolset) + + + Application + $(DefaultPlatformToolset) + true + + + Application + $(DefaultPlatformToolset) + true + + + Application + $(DefaultPlatformToolset) + + + Application + $(DefaultPlatformToolset) + + + Application + $(DefaultPlatformToolset) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + $(SolutionDir)$(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + .\Release/testgamecontroller.tlb + + + $(SolutionDir)/../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDLL + Level3 + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + Windows + xgameruntime.lib;../Microsoft.Xbox.Services.141.GDK.C.Thunks.lib;%(AdditionalDependencies) + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + .\Release/testgamecontroller.tlb + + + $(SolutionDir)/../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDLL + Level3 + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + Windows + xgameruntime.lib;%(AdditionalDependencies) + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + .\Release/testgamecontroller.tlb + + + $(SolutionDir)/../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDLL + Level3 + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + Windows + xgameruntime.lib;%(AdditionalDependencies) + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + .\Debug/testgamecontroller.tlb + + + Disabled + $(SolutionDir)/../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + Level3 + OldStyle + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + true + Windows + xgameruntime.lib;../Microsoft.Xbox.Services.141.GDK.C.Thunks.lib;%(AdditionalDependencies) + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + .\Debug/testgamecontroller.tlb + + + Disabled + $(SolutionDir)/../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + Level3 + OldStyle + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + true + Windows + xgameruntime.lib;%(AdditionalDependencies) + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + .\Debug/testgamecontroller.tlb + + + Disabled + $(SolutionDir)/../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + Level3 + OldStyle + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + true + Windows + xgameruntime.lib;%(AdditionalDependencies) + + + + + {81ce8daf-ebb2-4761-8e45-b71abcca8c68} + false + false + true + + + {da956fd3-e142-46f2-9dd5-c78bebb56b7a} + false + false + true + + + + + Copying %(Filename)%(Extension) + Copying %(Filename)%(Extension) + Copying %(Filename)%(Extension) + copy "%(FullPath)" "$(ProjectDir)\" + + copy "%(FullPath)" "$(ProjectDir)\" + + copy "%(FullPath)" "$(ProjectDir)\" + + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + Copying %(Filename)%(Extension) + Copying %(Filename)%(Extension) + Copying %(Filename)%(Extension) + copy "%(FullPath)" "$(ProjectDir)\" + + copy "%(FullPath)" "$(ProjectDir)\" + + copy "%(FullPath)" "$(ProjectDir)\" + + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + + + Copying %(Filename)%(Extension) + Copying %(Filename)%(Extension) + Copying %(Filename)%(Extension) + copy "%(FullPath)" "$(ProjectDir)\" + + copy "%(FullPath)" "$(ProjectDir)\" + + copy "%(FullPath)" "$(ProjectDir)\" + + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + Copying %(Filename)%(Extension) + Copying %(Filename)%(Extension) + Copying %(Filename)%(Extension) + copy "%(FullPath)" "$(ProjectDir)\" + + copy "%(FullPath)" "$(ProjectDir)\" + + copy "%(FullPath)" "$(ProjectDir)\" + + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + + + Copying %(Filename)%(Extension) + Copying %(Filename)%(Extension) + Copying %(Filename)%(Extension) + copy "%(FullPath)" "$(ProjectDir)\" + + copy "%(FullPath)" "$(ProjectDir)\" + + copy "%(FullPath)" "$(ProjectDir)\" + + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + Copying %(Filename)%(Extension) + Copying %(Filename)%(Extension) + Copying %(Filename)%(Extension) + copy "%(FullPath)" "$(ProjectDir)\" + + copy "%(FullPath)" "$(ProjectDir)\" + + copy "%(FullPath)" "$(ProjectDir)\" + + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + + + Copying %(Filename)%(Extension) + Copying %(Filename)%(Extension) + Copying %(Filename)%(Extension) + copy "%(FullPath)" "$(ProjectDir)\" + + copy "%(FullPath)" "$(ProjectDir)\" + + copy "%(FullPath)" "$(ProjectDir)\" + + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + Copying %(Filename)%(Extension) + Copying %(Filename)%(Extension) + Copying %(Filename)%(Extension) + copy "%(FullPath)" "$(ProjectDir)\" + + copy "%(FullPath)" "$(ProjectDir)\" + + copy "%(FullPath)" "$(ProjectDir)\" + + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + + + + + + + + + Document + true + true + true + true + + + + + + + + + + + + + + Document + true + true + true + true + + + + + Document + true + true + true + true + + + + + Document + true + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/libs/SDL2/VisualC-GDK/tests/testgamecontroller/testgamecontroller.vcxproj.filters b/libs/SDL2/VisualC-GDK/tests/testgamecontroller/testgamecontroller.vcxproj.filters new file mode 100644 index 00000000..1124f2c6 --- /dev/null +++ b/libs/SDL2/VisualC-GDK/tests/testgamecontroller/testgamecontroller.vcxproj.filters @@ -0,0 +1,55 @@ + + + + + + + + + + + + + logos + + + logos + + + logos + + + logos + + + wingdk + + + wingdk + + + xboxseries + + + xboxone + + + logos + + + + + + {5e858cf0-6fba-498d-b33d-11c8ecbb79c7} + + + {5790a250-283e-4f51-8f28-6a977d3c7a6c} + + + {a4d235e4-4017-4193-af62-ecb2ac249be4} + + + {e704dcb9-c83c-4c94-a139-b0f3e3f428f2} + + + \ No newline at end of file diff --git a/libs/SDL2/VisualC-GDK/tests/testgamecontroller/wingdk/MicrosoftGame.config b/libs/SDL2/VisualC-GDK/tests/testgamecontroller/wingdk/MicrosoftGame.config new file mode 100644 index 00000000..6a9ea2bf --- /dev/null +++ b/libs/SDL2/VisualC-GDK/tests/testgamecontroller/wingdk/MicrosoftGame.config @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + 7325F784 + 0000000000000000 + + + \ No newline at end of file diff --git a/libs/SDL2/VisualC-GDK/tests/testgamecontroller/xboxone/MicrosoftGame.config b/libs/SDL2/VisualC-GDK/tests/testgamecontroller/xboxone/MicrosoftGame.config new file mode 100644 index 00000000..53695042 --- /dev/null +++ b/libs/SDL2/VisualC-GDK/tests/testgamecontroller/xboxone/MicrosoftGame.config @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + 7325F784 + 0000000000000000 + + + \ No newline at end of file diff --git a/libs/SDL2/VisualC-GDK/tests/testgamecontroller/xboxseries/MicrosoftGame.config b/libs/SDL2/VisualC-GDK/tests/testgamecontroller/xboxseries/MicrosoftGame.config new file mode 100644 index 00000000..648fed1c --- /dev/null +++ b/libs/SDL2/VisualC-GDK/tests/testgamecontroller/xboxseries/MicrosoftGame.config @@ -0,0 +1,29 @@ + + + + + + + + + + + + 7325F784 + 0000000000000000 + + + \ No newline at end of file diff --git a/libs/SDL2/VisualC-GDK/tests/testgdk/PackageLayout.xml b/libs/SDL2/VisualC-GDK/tests/testgdk/PackageLayout.xml new file mode 100644 index 00000000..abee981b --- /dev/null +++ b/libs/SDL2/VisualC-GDK/tests/testgdk/PackageLayout.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/libs/SDL2/VisualC-GDK/tests/testgdk/src/testgdk.cpp b/libs/SDL2/VisualC-GDK/tests/testgdk/src/testgdk.cpp new file mode 100644 index 00000000..ed69ecbe --- /dev/null +++ b/libs/SDL2/VisualC-GDK/tests/testgdk/src/testgdk.cpp @@ -0,0 +1,502 @@ +/* + 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. +*/ +/* testgdk: Basic tests of using task queue/xbl (with simple drawing) in GDK. + * NOTE: As of June 2022 GDK, login will only work if MicrosoftGame.config is + * configured properly. See README-gdk.md. + */ + +#include +#include +#include + +#include "SDL_test.h" +#include "SDL_test_common.h" +#include "../src/core/windows/SDL_windows.h" + +extern "C" { +#include "../test/testutils.h" +} + +#include + +#define NUM_SPRITES 100 +#define MAX_SPEED 1 + +static SDLTest_CommonState *state; +static int num_sprites; +static SDL_Texture **sprites; +static SDL_bool cycle_color; +static SDL_bool cycle_alpha; +static int cycle_direction = 1; +static int current_alpha = 0; +static int current_color = 0; +static int sprite_w, sprite_h; +static SDL_BlendMode blendMode = SDL_BLENDMODE_BLEND; + +int done; + +static struct +{ + SDL_AudioSpec spec; + Uint8 *sound; /* Pointer to wave data */ + Uint32 soundlen; /* Length of wave data */ + int soundpos; /* Current play position */ +} wave; + +static SDL_AudioDeviceID device; + +static void +close_audio() +{ + if (device != 0) { + SDL_CloseAudioDevice(device); + device = 0; + } +} + +/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ +static void +quit(int rc) +{ + SDL_free(sprites); + close_audio(); + SDL_FreeWAV(wave.sound); + SDLTest_CommonQuit(state); + /* 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); + } +} + +static void +open_audio() +{ + /* Initialize fillerup() variables */ + device = SDL_OpenAudioDevice(NULL, SDL_FALSE, &wave.spec, NULL, 0); + if (!device) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open audio: %s\n", SDL_GetError()); + SDL_FreeWAV(wave.sound); + quit(2); + } + + /* Let the audio run */ + SDL_PauseAudioDevice(device, SDL_FALSE); +} + +static void +reopen_audio() +{ + close_audio(); + open_audio(); +} + +void SDLCALL +fillerup(void *unused, Uint8 *stream, int len) +{ + Uint8 *waveptr; + int waveleft; + + /* Set up the pointers */ + waveptr = wave.sound + wave.soundpos; + waveleft = wave.soundlen - wave.soundpos; + + /* Go! */ + while (waveleft <= len) { + SDL_memcpy(stream, waveptr, waveleft); + stream += waveleft; + len -= waveleft; + waveptr = wave.sound; + waveleft = wave.soundlen; + wave.soundpos = 0; + } + SDL_memcpy(stream, waveptr, len); + wave.soundpos += len; +} + +void +UserLoggedIn(XUserHandle user) +{ + HRESULT hr; + char gamertag[128]; + hr = XUserGetGamertag(user, XUserGamertagComponent::UniqueModern, sizeof(gamertag), gamertag, NULL); + + if (SUCCEEDED(hr)) { + SDL_Log("User logged in: %s", gamertag); + } else { + SDL_Log("[GDK] UserLoggedIn -- XUserGetGamertag failed: 0x%08x.", hr); + } + + XUserCloseHandle(user); +} + +void +AddUserUICallback(XAsyncBlock *asyncBlock) +{ + HRESULT hr; + XUserHandle user = NULL; + + hr = XUserAddResult(asyncBlock, &user); + if (SUCCEEDED(hr)) { + uint64_t userId; + + hr = XUserGetId(user, &userId); + if (FAILED(hr)) { + /* If unable to get the user ID, it means the account is banned, etc. */ + SDL_Log("[GDK] AddUserSilentCallback -- XUserGetId failed: 0x%08x.", hr); + XUserCloseHandle(user); + + /* Per the docs, likely should call XUserResolveIssueWithUiAsync here. */ + } else { + UserLoggedIn(user); + } + } else { + SDL_Log("[GDK] AddUserUICallback -- XUserAddAsync failed: 0x%08x.", hr); + } + + delete asyncBlock; +} + +void +AddUserUI() +{ + HRESULT hr; + XAsyncBlock *asyncBlock = new XAsyncBlock; + + asyncBlock->context = NULL; + asyncBlock->queue = NULL; /* A null queue will use the global process task queue */ + asyncBlock->callback = &AddUserUICallback; + + hr = XUserAddAsync(XUserAddOptions::None, asyncBlock); + + if (FAILED(hr)) { + delete asyncBlock; + SDL_Log("[GDK] AddUserSilent -- failed: 0x%08x", hr); + } +} + +void +AddUserSilentCallback(XAsyncBlock *asyncBlock) +{ + HRESULT hr; + XUserHandle user = NULL; + + hr = XUserAddResult(asyncBlock, &user); + if (SUCCEEDED(hr)) { + uint64_t userId; + + hr = XUserGetId(user, &userId); + if (FAILED(hr)) { + /* If unable to get the user ID, it means the account is banned, etc. */ + SDL_Log("[GDK] AddUserSilentCallback -- XUserGetId failed: 0x%08x. Trying with UI.", hr); + XUserCloseHandle(user); + AddUserUI(); + } else { + UserLoggedIn(user); + } + } else { + SDL_Log("[GDK] AddUserSilentCallback -- XUserAddAsync failed: 0x%08x. Trying with UI.", hr); + AddUserUI(); + } + + delete asyncBlock; +} + +void +AddUserSilent() +{ + HRESULT hr; + XAsyncBlock *asyncBlock = new XAsyncBlock; + + asyncBlock->context = NULL; + asyncBlock->queue = NULL; /* A null queue will use the global process task queue */ + asyncBlock->callback = &AddUserSilentCallback; + + hr = XUserAddAsync(XUserAddOptions::AddDefaultUserSilently, asyncBlock); + + if (FAILED(hr)) { + delete asyncBlock; + SDL_Log("[GDK] AddUserSilent -- failed: 0x%08x", hr); + } +} + +int +LoadSprite(const char *file) +{ + int i; + + for (i = 0; i < state->num_windows; ++i) { + /* 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]) { + 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_DestroyTexture(sprites[i]); + return (-1); + } + } + + /* We're ready to roll. :) */ + return (0); +} + +void +DrawSprites(SDL_Renderer * renderer, SDL_Texture * sprite) +{ + SDL_Rect viewport, temp; + + /* Query the sizes */ + SDL_RenderGetViewport(renderer, &viewport); + + /* Cycle the color and alpha, if desired */ + if (cycle_color) { + current_color += cycle_direction; + if (current_color < 0) { + current_color = 0; + cycle_direction = -cycle_direction; + } + if (current_color > 255) { + current_color = 255; + cycle_direction = -cycle_direction; + } + SDL_SetTextureColorMod(sprite, 255, (Uint8) current_color, + (Uint8) current_color); + } + if (cycle_alpha) { + current_alpha += cycle_direction; + if (current_alpha < 0) { + current_alpha = 0; + cycle_direction = -cycle_direction; + } + if (current_alpha > 255) { + current_alpha = 255; + cycle_direction = -cycle_direction; + } + SDL_SetTextureAlphaMod(sprite, (Uint8) current_alpha); + } + + /* Draw a gray background */ + SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF); + SDL_RenderClear(renderer); + + /* Test points */ + SDL_SetRenderDrawColor(renderer, 0xFF, 0x00, 0x00, 0xFF); + SDL_RenderDrawPoint(renderer, 0, 0); + SDL_RenderDrawPoint(renderer, viewport.w-1, 0); + SDL_RenderDrawPoint(renderer, 0, viewport.h-1); + SDL_RenderDrawPoint(renderer, viewport.w-1, viewport.h-1); + + /* Test horizontal and vertical lines */ + SDL_SetRenderDrawColor(renderer, 0x00, 0xFF, 0x00, 0xFF); + SDL_RenderDrawLine(renderer, 1, 0, viewport.w-2, 0); + SDL_RenderDrawLine(renderer, 1, viewport.h-1, viewport.w-2, viewport.h-1); + SDL_RenderDrawLine(renderer, 0, 1, 0, viewport.h-2); + SDL_RenderDrawLine(renderer, viewport.w-1, 1, viewport.w-1, viewport.h-2); + + /* Test fill and copy */ + SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF); + temp.x = 1; + temp.y = 1; + temp.w = sprite_w; + temp.h = sprite_h; + SDL_RenderFillRect(renderer, &temp); + SDL_RenderCopy(renderer, sprite, NULL, &temp); + temp.x = viewport.w-sprite_w-1; + temp.y = 1; + temp.w = sprite_w; + temp.h = sprite_h; + SDL_RenderFillRect(renderer, &temp); + SDL_RenderCopy(renderer, sprite, NULL, &temp); + temp.x = 1; + temp.y = viewport.h-sprite_h-1; + temp.w = sprite_w; + temp.h = sprite_h; + SDL_RenderFillRect(renderer, &temp); + SDL_RenderCopy(renderer, sprite, NULL, &temp); + temp.x = viewport.w-sprite_w-1; + temp.y = viewport.h-sprite_h-1; + temp.w = sprite_w; + temp.h = sprite_h; + SDL_RenderFillRect(renderer, &temp); + SDL_RenderCopy(renderer, sprite, NULL, &temp); + + /* Test diagonal lines */ + SDL_SetRenderDrawColor(renderer, 0x00, 0xFF, 0x00, 0xFF); + SDL_RenderDrawLine(renderer, sprite_w, sprite_h, + viewport.w-sprite_w-2, viewport.h-sprite_h-2); + SDL_RenderDrawLine(renderer, viewport.w-sprite_w-2, sprite_h, + sprite_w, viewport.h-sprite_h-2); + + /* Update the screen! */ + SDL_RenderPresent(renderer); +} + +void +loop() +{ + int i; + SDL_Event event; + + /* Check for events */ + while (SDL_PollEvent(&event)) { + if (event.type == SDL_KEYDOWN && !event.key.repeat) { + SDL_Log("Initial SDL_KEYDOWN: %s", SDL_GetScancodeName(event.key.keysym.scancode)); + } +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) + /* On Xbox, ignore the keydown event because the features aren't supported */ + if (event.type != SDL_KEYDOWN) { + SDLTest_CommonEvent(state, &event, &done); + } +#else + SDLTest_CommonEvent(state, &event, &done); +#endif + } + for (i = 0; i < state->num_windows; ++i) { + if (state->windows[i] == NULL) + continue; + DrawSprites(state->renderers[i], sprites[i]); + } +} + +int +main(int argc, char *argv[]) +{ + int i; + const char *icon = "icon.bmp"; + char *soundname = NULL; + + /* Initialize parameters */ + num_sprites = NUM_SPRITES; + + /* Initialize test framework */ + state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO | SDL_INIT_AUDIO); + if (!state) { + return 1; + } + + for (i = 1; i < argc;) { + int consumed; + + consumed = SDLTest_CommonArg(state, i); + if (consumed == 0) { + consumed = -1; + if (SDL_strcasecmp(argv[i], "--blend") == 0) { + if (argv[i + 1]) { + if (SDL_strcasecmp(argv[i + 1], "none") == 0) { + blendMode = SDL_BLENDMODE_NONE; + consumed = 2; + } else if (SDL_strcasecmp(argv[i + 1], "blend") == 0) { + blendMode = SDL_BLENDMODE_BLEND; + consumed = 2; + } else if (SDL_strcasecmp(argv[i + 1], "add") == 0) { + blendMode = SDL_BLENDMODE_ADD; + consumed = 2; + } else if (SDL_strcasecmp(argv[i + 1], "mod") == 0) { + blendMode = SDL_BLENDMODE_MOD; + consumed = 2; + } else if (SDL_strcasecmp(argv[i + 1], "sub") == 0) { + blendMode = SDL_ComposeCustomBlendMode(SDL_BLENDFACTOR_SRC_ALPHA, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_SUBTRACT, SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_SUBTRACT); + consumed = 2; + } + } + } else if (SDL_strcasecmp(argv[i], "--cyclecolor") == 0) { + cycle_color = SDL_TRUE; + consumed = 1; + } else if (SDL_strcasecmp(argv[i], "--cyclealpha") == 0) { + cycle_alpha = SDL_TRUE; + consumed = 1; + } else if (SDL_isdigit(*argv[i])) { + num_sprites = SDL_atoi(argv[i]); + consumed = 1; + } else if (argv[i][0] != '-') { + icon = argv[i]; + consumed = 1; + } + } + if (consumed < 0) { + static const char *options[] = { + "[--blend none|blend|add|mod]", + "[--cyclecolor]", + "[--cyclealpha]", + "[num_sprites]", + "[icon.bmp]", + NULL }; + SDLTest_CommonLogUsage(state, argv[0], options); + quit(1); + } + i += consumed; + } + if (!SDLTest_CommonInit(state)) { + quit(2); + } + + /* Create the windows, initialize the renderers, and load the textures */ + sprites = + (SDL_Texture **) SDL_malloc(state->num_windows * sizeof(*sprites)); + if (!sprites) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n"); + quit(2); + } + for (i = 0; i < state->num_windows; ++i) { + SDL_Renderer *renderer = state->renderers[i]; + SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF); + SDL_RenderClear(renderer); + } + if (LoadSprite(icon) < 0) { + quit(2); + } + + soundname = GetResourceFilename(argc > 1 ? argv[1] : NULL, "sample.wav"); + + if (soundname == NULL) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError()); + quit(1); + } + + /* Load the wave file into memory */ + if (SDL_LoadWAV(soundname, &wave.spec, &wave.sound, &wave.soundlen) == NULL) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", soundname, SDL_GetError()); + quit(1); + } + + wave.spec.callback = fillerup; + + /* Show the list of available drivers */ + SDL_Log("Available audio drivers:"); + for (i = 0; i < SDL_GetNumAudioDrivers(); ++i) { + SDL_Log("%i: %s", i, SDL_GetAudioDriver(i)); + } + + SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver()); + + open_audio(); + + /* Main render loop */ + done = 0; + + /* Try to add the default user silently */ + AddUserSilent(); + + while (!done) { + loop(); + } + + quit(0); + + SDL_free(soundname); + return 0; +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/VisualC-GDK/tests/testgdk/testgdk.vcxproj b/libs/SDL2/VisualC-GDK/tests/testgdk/testgdk.vcxproj new file mode 100644 index 00000000..f024a89a --- /dev/null +++ b/libs/SDL2/VisualC-GDK/tests/testgdk/testgdk.vcxproj @@ -0,0 +1,401 @@ + + + + + Debug + Gaming.Desktop.x64 + + + Debug + Gaming.Xbox.Scarlett.x64 + + + Debug + Gaming.Xbox.XboxOne.x64 + + + Release + Gaming.Desktop.x64 + + + Release + Gaming.Xbox.Scarlett.x64 + + + Release + Gaming.Xbox.XboxOne.x64 + + + + {1C9A3F71-35A5-4C56-B292-F4375B3C3649} + testsprite2 + 10.0 + + + + Application + $(DefaultPlatformToolset) + + + Application + $(DefaultPlatformToolset) + true + + + Application + $(DefaultPlatformToolset) + true + + + Application + $(DefaultPlatformToolset) + + + Application + $(DefaultPlatformToolset) + + + Application + $(DefaultPlatformToolset) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + $(SolutionDir)$(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + .\Release/testsprite2.tlb + + + $(SolutionDir)/../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDLL + Level3 + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + Windows + xgameruntime.lib;../Microsoft.Xbox.Services.141.GDK.C.Thunks.lib;%(AdditionalDependencies) + + + + + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + .\Release/testsprite2.tlb + + + $(SolutionDir)/../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDLL + Level3 + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + Windows + xgameruntime.lib;%(AdditionalDependencies) + + + + + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + .\Release/testsprite2.tlb + + + $(SolutionDir)/../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDLL + Level3 + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + Windows + xgameruntime.lib;%(AdditionalDependencies) + + + + + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + .\Debug/testsprite2.tlb + + + Disabled + $(SolutionDir)/../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + Level3 + OldStyle + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + true + Windows + xgameruntime.lib;../Microsoft.Xbox.Services.141.GDK.C.Thunks.lib;%(AdditionalDependencies) + + + + + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + .\Debug/testsprite2.tlb + + + Disabled + $(SolutionDir)/../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + Level3 + OldStyle + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + true + Windows + xgameruntime.lib;%(AdditionalDependencies) + + + + + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + .\Debug/testsprite2.tlb + + + Disabled + $(SolutionDir)/../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + Level3 + OldStyle + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + true + Windows + xgameruntime.lib;%(AdditionalDependencies) + + + + + + + + + {81ce8daf-ebb2-4761-8e45-b71abcca8c68} + false + false + true + + + {da956fd3-e142-46f2-9dd5-c78bebb56b7a} + false + false + true + + + {da956fd3-e143-46f2-9fe5-c77bebc56b1a} + false + false + true + + + + + Copying %(Filename)%(Extension) + Copying %(Filename)%(Extension) + Copying %(Filename)%(Extension) + copy "%(FullPath)" "$(ProjectDir)\" +copy "%(FullPath)" "$(OutDir)\" + copy "%(FullPath)" "$(ProjectDir)\" +copy "%(FullPath)" "$(OutDir)\" + copy "%(FullPath)" "$(ProjectDir)\" +copy "%(FullPath)" "$(OutDir)\" + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + Copying %(Filename)%(Extension) + Copying %(Filename)%(Extension) + Copying %(Filename)%(Extension) + copy "%(FullPath)" "$(ProjectDir)\" +copy "%(FullPath)" "$(OutDir)\" + copy "%(FullPath)" "$(ProjectDir)\" +copy "%(FullPath)" "$(OutDir)\" + copy "%(FullPath)" "$(ProjectDir)\" +copy "%(FullPath)" "$(OutDir)\" + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + + + + + + + + + Document + true + true + true + true + + + + + Document + true + true + true + true + + + + + + + + + + + + + + Document + true + true + true + true + + + + + Document + + + + + Document + true + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/libs/SDL2/VisualC-GDK/tests/testgdk/testgdk.vcxproj.filters b/libs/SDL2/VisualC-GDK/tests/testgdk/testgdk.vcxproj.filters new file mode 100644 index 00000000..b82a9898 --- /dev/null +++ b/libs/SDL2/VisualC-GDK/tests/testgdk/testgdk.vcxproj.filters @@ -0,0 +1,53 @@ + + + + + + + + + + logos + + + logos + + + logos + + + logos + + + wingdk + + + wingdk + + + xboxseries + + + + xboxone + + + logos + + + + + + {c3c871f2-c7b7-4025-8ba4-037dde717fe1} + + + {1678a80d-0ee8-4f48-bf89-9462d82dd98a} + + + {1b47b96b-507e-40ec-9c25-99b1a4d5b575} + + + {ac7aa2d5-f0f7-46eb-a548-5b6316f3b63b} + + + \ No newline at end of file diff --git a/libs/SDL2/VisualC-GDK/tests/testgdk/wingdk/MicrosoftGame.config b/libs/SDL2/VisualC-GDK/tests/testgdk/wingdk/MicrosoftGame.config new file mode 100644 index 00000000..f1ab0338 --- /dev/null +++ b/libs/SDL2/VisualC-GDK/tests/testgdk/wingdk/MicrosoftGame.config @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + 7325F784 + 0000000000000000 + + + \ No newline at end of file diff --git a/libs/SDL2/VisualC-GDK/tests/testgdk/xboxone/MicrosoftGame.config b/libs/SDL2/VisualC-GDK/tests/testgdk/xboxone/MicrosoftGame.config new file mode 100644 index 00000000..a0583bde --- /dev/null +++ b/libs/SDL2/VisualC-GDK/tests/testgdk/xboxone/MicrosoftGame.config @@ -0,0 +1,29 @@ + + + + + + + + + + + + 7325F784 + 0000000000000000 + + + \ No newline at end of file diff --git a/libs/SDL2/VisualC-GDK/tests/testgdk/xboxseries/MicrosoftGame.config b/libs/SDL2/VisualC-GDK/tests/testgdk/xboxseries/MicrosoftGame.config new file mode 100644 index 00000000..96449018 --- /dev/null +++ b/libs/SDL2/VisualC-GDK/tests/testgdk/xboxseries/MicrosoftGame.config @@ -0,0 +1,29 @@ + + + + + + + + + + + + 7325F784 + 0000000000000000 + + + \ No newline at end of file diff --git a/libs/SDL2/VisualC-GDK/tests/testsprite2/PackageLayout.xml b/libs/SDL2/VisualC-GDK/tests/testsprite2/PackageLayout.xml new file mode 100644 index 00000000..62ca97bb --- /dev/null +++ b/libs/SDL2/VisualC-GDK/tests/testsprite2/PackageLayout.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/libs/SDL2/VisualC-GDK/tests/testsprite2/testsprite2.vcxproj b/libs/SDL2/VisualC-GDK/tests/testsprite2/testsprite2.vcxproj new file mode 100644 index 00000000..651a346e --- /dev/null +++ b/libs/SDL2/VisualC-GDK/tests/testsprite2/testsprite2.vcxproj @@ -0,0 +1,395 @@ + + + + + Debug + Gaming.Desktop.x64 + + + Debug + Gaming.Xbox.Scarlett.x64 + + + Debug + Gaming.Xbox.XboxOne.x64 + + + Release + Gaming.Desktop.x64 + + + Release + Gaming.Xbox.Scarlett.x64 + + + Release + Gaming.Xbox.XboxOne.x64 + + + + {40FB7794-D3C3-4CFE-BCF4-A80C96635682} + testsprite2 + 10.0 + + + + Application + $(DefaultPlatformToolset) + + + Application + $(DefaultPlatformToolset) + true + + + Application + $(DefaultPlatformToolset) + true + + + Application + $(DefaultPlatformToolset) + + + Application + $(DefaultPlatformToolset) + + + Application + $(DefaultPlatformToolset) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + $(SolutionDir)$(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + .\Release/testsprite2.tlb + + + $(SolutionDir)/../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDLL + Level3 + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + Windows + xgameruntime.lib;../Microsoft.Xbox.Services.141.GDK.C.Thunks.lib;%(AdditionalDependencies) + + + + + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + .\Release/testsprite2.tlb + + + $(SolutionDir)/../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDLL + Level3 + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + Windows + xgameruntime.lib;%(AdditionalDependencies) + + + + + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + .\Release/testsprite2.tlb + + + $(SolutionDir)/../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDLL + Level3 + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + Windows + xgameruntime.lib;%(AdditionalDependencies) + + + + + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + .\Debug/testsprite2.tlb + + + Disabled + $(SolutionDir)/../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + Level3 + OldStyle + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + true + Windows + xgameruntime.lib;../Microsoft.Xbox.Services.141.GDK.C.Thunks.lib;%(AdditionalDependencies) + + + + + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + .\Debug/testsprite2.tlb + + + Disabled + $(SolutionDir)/../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + Level3 + OldStyle + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + true + Windows + xgameruntime.lib;%(AdditionalDependencies) + + + + + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + .\Debug/testsprite2.tlb + + + Disabled + $(SolutionDir)/../include;%(AdditionalIncludeDirectories) + %(AdditionalUsingDirectories) + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + Level3 + OldStyle + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + true + Windows + xgameruntime.lib;%(AdditionalDependencies) + + + + + + + + + {81ce8daf-ebb2-4761-8e45-b71abcca8c68} + false + false + true + + + {da956fd3-e142-46f2-9dd5-c78bebb56b7a} + false + false + true + + + {da956fd3-e143-46f2-9fe5-c77bebc56b1a} + false + false + true + + + + + Copying %(Filename)%(Extension) + Copying %(Filename)%(Extension) + Copying %(Filename)%(Extension) + copy "%(FullPath)" "$(ProjectDir)\" +copy "%(FullPath)" "$(OutDir)\" + copy "%(FullPath)" "$(ProjectDir)\" +copy "%(FullPath)" "$(OutDir)\" + copy "%(FullPath)" "$(ProjectDir)\" +copy "%(FullPath)" "$(OutDir)\" + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + Copying %(Filename)%(Extension) + Copying %(Filename)%(Extension) + Copying %(Filename)%(Extension) + copy "%(FullPath)" "$(ProjectDir)\" +copy "%(FullPath)" "$(OutDir)\" + copy "%(FullPath)" "$(ProjectDir)\" +copy "%(FullPath)" "$(OutDir)\" + copy "%(FullPath)" "$(ProjectDir)\" +copy "%(FullPath)" "$(OutDir)\" + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + $(ProjectDir)\%(Filename)%(Extension);%(Outputs) + + + + + + + + + Document + true + true + true + true + + + + + Document + true + true + true + true + + + + + + + + + + + + + + Document + true + true + true + true + + + + + true + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/libs/SDL2/VisualC-GDK/tests/testsprite2/testsprite2.vcxproj.filters b/libs/SDL2/VisualC-GDK/tests/testsprite2/testsprite2.vcxproj.filters new file mode 100644 index 00000000..e945fe54 --- /dev/null +++ b/libs/SDL2/VisualC-GDK/tests/testsprite2/testsprite2.vcxproj.filters @@ -0,0 +1,52 @@ + + + + + + + + + + logos + + + logos + + + logos + + + logos + + + wingdk + + + xboxseries + + + xboxone + + + wingdk + + + logos + + + + + + {c3c871f2-c7b7-4025-8ba4-037dde717fe1} + + + {c862dfc3-7803-4359-a31e-9dcda37e641a} + + + {1671e83d-25b3-4eb5-bed0-5c52c80f4e49} + + + {9bf62acf-6661-43f9-bde3-0de9e1db4290} + + + \ No newline at end of file diff --git a/libs/SDL2/VisualC-GDK/tests/testsprite2/wingdk/MicrosoftGame.config b/libs/SDL2/VisualC-GDK/tests/testsprite2/wingdk/MicrosoftGame.config new file mode 100644 index 00000000..6b76188a --- /dev/null +++ b/libs/SDL2/VisualC-GDK/tests/testsprite2/wingdk/MicrosoftGame.config @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + 7325F784 + 0000000000000000 + + + \ No newline at end of file diff --git a/libs/SDL2/VisualC-GDK/tests/testsprite2/xboxone/MicrosoftGame.config b/libs/SDL2/VisualC-GDK/tests/testsprite2/xboxone/MicrosoftGame.config new file mode 100644 index 00000000..4e8810bb --- /dev/null +++ b/libs/SDL2/VisualC-GDK/tests/testsprite2/xboxone/MicrosoftGame.config @@ -0,0 +1,29 @@ + + + + + + + + + + + + 7325F784 + 0000000000000000 + + + \ No newline at end of file diff --git a/libs/SDL2/VisualC-GDK/tests/testsprite2/xboxseries/MicrosoftGame.config b/libs/SDL2/VisualC-GDK/tests/testsprite2/xboxseries/MicrosoftGame.config new file mode 100644 index 00000000..8e4431fd --- /dev/null +++ b/libs/SDL2/VisualC-GDK/tests/testsprite2/xboxseries/MicrosoftGame.config @@ -0,0 +1,29 @@ + + + + + + + + + + + + 7325F784 + 0000000000000000 + + + \ No newline at end of file diff --git a/libs/SDL2/VisualC-WinRT/SDL-UWP.vcxproj b/libs/SDL2/VisualC-WinRT/SDL-UWP.vcxproj index 675ecb1d..3fab8c1b 100644 --- a/libs/SDL2/VisualC-WinRT/SDL-UWP.vcxproj +++ b/libs/SDL2/VisualC-WinRT/SDL-UWP.vcxproj @@ -45,6 +45,7 @@ + @@ -106,7 +107,6 @@ - @@ -114,6 +114,7 @@ + @@ -144,6 +145,8 @@ + + @@ -248,6 +251,7 @@ + @@ -295,7 +299,9 @@ + + @@ -304,6 +310,8 @@ + + @@ -414,10 +422,9 @@ true Windows Store 8.2 - 10.0.10069.0 - 10.0.10069.0 - 10.0.10240.0 - 10.0.10240.0 + 10.0.16299.0 + 10.0.16299.0 + 10.0 diff --git a/libs/SDL2/VisualC-WinRT/SDL-UWP.vcxproj.filters b/libs/SDL2/VisualC-WinRT/SDL-UWP.vcxproj.filters index eb999957..0a715fd7 100644 --- a/libs/SDL2/VisualC-WinRT/SDL-UWP.vcxproj.filters +++ b/libs/SDL2/VisualC-WinRT/SDL-UWP.vcxproj.filters @@ -63,6 +63,9 @@ Header Files + + Header Files + Header Files @@ -237,9 +240,6 @@ Source Files - - Source Files - Source Files @@ -330,6 +330,9 @@ Source Files + + Source Files + Source Files @@ -411,6 +414,9 @@ Source Files + + Source Files + Source Files @@ -627,6 +633,9 @@ Source Files + + Source Files + Source Files @@ -780,6 +789,9 @@ Source Files + + Source Files + Source Files @@ -813,10 +825,16 @@ Source Files + + Source Files + Source Files + + Source Files + \ No newline at end of file diff --git a/libs/SDL2/VisualC/SDL/SDL.vcxproj b/libs/SDL2/VisualC/SDL/SDL.vcxproj index 0e9062b5..8102c7fb 100644 --- a/libs/SDL2/VisualC/SDL/SDL.vcxproj +++ b/libs/SDL2/VisualC/SDL/SDL.vcxproj @@ -234,6 +234,7 @@ + @@ -319,7 +320,6 @@ - @@ -347,6 +347,7 @@ + @@ -367,8 +368,11 @@ + + + @@ -474,6 +478,7 @@ + @@ -522,6 +527,8 @@ + + @@ -543,6 +550,7 @@ + @@ -553,6 +561,8 @@ + + @@ -611,4 +621,4 @@ - + \ No newline at end of file diff --git a/libs/SDL2/VisualC/SDL/SDL.vcxproj.filters b/libs/SDL2/VisualC/SDL/SDL.vcxproj.filters index da002cd3..16b71715 100644 --- a/libs/SDL2/VisualC/SDL/SDL.vcxproj.filters +++ b/libs/SDL2/VisualC/SDL/SDL.vcxproj.filters @@ -169,6 +169,9 @@ {4755f3a6-49ac-46d6-86be-21f5c21f2197} + + {f48c2b17-1bee-4fec-a7c8-24cf619abe08} + @@ -231,6 +234,9 @@ API Headers + + API Headers + API Headers @@ -401,6 +407,7 @@ + API Headers @@ -464,9 +471,6 @@ events - - events - events @@ -824,6 +828,10 @@ + + + render\direct3d12 + @@ -831,7 +839,9 @@ + + audio @@ -913,6 +923,9 @@ hidapi + + joystick + joystick @@ -1201,7 +1214,7 @@ thread - + thread\windows @@ -1316,8 +1329,14 @@ power\windows + + render\direct3d12 + + + render\direct3d12 + - + \ No newline at end of file diff --git a/libs/SDL2/VisualC/tests/checkkeys/checkkeys.vcxproj b/libs/SDL2/VisualC/tests/checkkeys/checkkeys.vcxproj index b9d4f9b2..3f068377 100644 --- a/libs/SDL2/VisualC/tests/checkkeys/checkkeys.vcxproj +++ b/libs/SDL2/VisualC/tests/checkkeys/checkkeys.vcxproj @@ -200,6 +200,12 @@ false true + + {da956fd3-e143-46f2-9fe5-c77bebc56b1a} + false + false + true + @@ -216,4 +222,4 @@ - \ No newline at end of file + diff --git a/libs/SDL2/VisualC/tests/controllermap/controllermap.vcxproj b/libs/SDL2/VisualC/tests/controllermap/controllermap.vcxproj index 20cf8dc1..66d8ef1f 100644 --- a/libs/SDL2/VisualC/tests/controllermap/controllermap.vcxproj +++ b/libs/SDL2/VisualC/tests/controllermap/controllermap.vcxproj @@ -271,6 +271,7 @@ + diff --git a/libs/SDL2/VisualC/tests/loopwave/loopwave.vcxproj b/libs/SDL2/VisualC/tests/loopwave/loopwave.vcxproj index ccc7c3b5..c3fbf1c5 100644 --- a/libs/SDL2/VisualC/tests/loopwave/loopwave.vcxproj +++ b/libs/SDL2/VisualC/tests/loopwave/loopwave.vcxproj @@ -203,6 +203,7 @@ + @@ -227,4 +228,4 @@ - \ No newline at end of file + diff --git a/libs/SDL2/VisualC/tests/testautomation/testautomation.vcxproj b/libs/SDL2/VisualC/tests/testautomation/testautomation.vcxproj index 166b2da0..0acc54af 100644 --- a/libs/SDL2/VisualC/tests/testautomation/testautomation.vcxproj +++ b/libs/SDL2/VisualC/tests/testautomation/testautomation.vcxproj @@ -206,9 +206,11 @@ + + diff --git a/libs/SDL2/VisualC/tests/testgamecontroller/testgamecontroller.vcxproj b/libs/SDL2/VisualC/tests/testgamecontroller/testgamecontroller.vcxproj index 649aad91..d3710e29 100644 --- a/libs/SDL2/VisualC/tests/testgamecontroller/testgamecontroller.vcxproj +++ b/libs/SDL2/VisualC/tests/testgamecontroller/testgamecontroller.vcxproj @@ -271,6 +271,7 @@ + diff --git a/libs/SDL2/VisualC/tests/testoverlay2/testoverlay2.vcxproj b/libs/SDL2/VisualC/tests/testoverlay2/testoverlay2.vcxproj index 10e74b27..e412a1dc 100644 --- a/libs/SDL2/VisualC/tests/testoverlay2/testoverlay2.vcxproj +++ b/libs/SDL2/VisualC/tests/testoverlay2/testoverlay2.vcxproj @@ -217,6 +217,7 @@ + diff --git a/libs/SDL2/VisualC/tests/testrendertarget/testrendertarget.vcxproj b/libs/SDL2/VisualC/tests/testrendertarget/testrendertarget.vcxproj index 2d2d57bf..e9ed5def 100644 --- a/libs/SDL2/VisualC/tests/testrendertarget/testrendertarget.vcxproj +++ b/libs/SDL2/VisualC/tests/testrendertarget/testrendertarget.vcxproj @@ -241,8 +241,9 @@ + - \ No newline at end of file + diff --git a/libs/SDL2/VisualC/tests/testscale/testscale.vcxproj b/libs/SDL2/VisualC/tests/testscale/testscale.vcxproj index bd2ef383..a42738bd 100644 --- a/libs/SDL2/VisualC/tests/testscale/testscale.vcxproj +++ b/libs/SDL2/VisualC/tests/testscale/testscale.vcxproj @@ -241,8 +241,9 @@ + - \ No newline at end of file + diff --git a/libs/SDL2/VisualC/tests/testsprite2/testsprite2.vcxproj b/libs/SDL2/VisualC/tests/testsprite2/testsprite2.vcxproj index 13a3245f..5ef2e117 100644 --- a/libs/SDL2/VisualC/tests/testsprite2/testsprite2.vcxproj +++ b/libs/SDL2/VisualC/tests/testsprite2/testsprite2.vcxproj @@ -223,8 +223,9 @@ + - \ No newline at end of file + diff --git a/libs/SDL2/WhatsNew.txt b/libs/SDL2/WhatsNew.txt index 92225431..517f0a76 100644 --- a/libs/SDL2/WhatsNew.txt +++ b/libs/SDL2/WhatsNew.txt @@ -1,6 +1,85 @@ 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_bsearch() and SDL_utf8strnlen() to the stdlib routines +* Added SDL_size_mul_overflow() and SDL_size_add_overflow() for better size overflow protection +* 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() + +Windows: +* 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. + +Linux: +* 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_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 + +--------------------------------------------------------------------------- +2.0.22: +--------------------------------------------------------------------------- + +General: +* Added SDL_RenderGetWindow() to get the window associated with a renderer +* Added floating point rectangle functions: + * SDL_PointInFRect() + * SDL_FRectEmpty() + * SDL_FRectEquals() + * SDL_FRectEqualsEpsilon() + * SDL_HasIntersectionF() + * SDL_IntersectFRect() + * SDL_UnionFRect() + * SDL_EncloseFPoints() + * SDL_IntersectFRectAndLine() +* Added SDL_IsTextInputShown() which returns whether the IME window is currently shown +* Added SDL_ClearComposition() to dismiss the composition window without disabling IME input +* Added SDL_TEXTEDITING_EXT event for handling long composition text, and a hint SDL_HINT_IME_SUPPORT_EXTENDED_TEXT to enable it +* Added the hint SDL_HINT_MOUSE_RELATIVE_MODE_CENTER to control whether the mouse should be constrained to the whole window or the center of the window when relative mode is enabled +* The mouse is now automatically captured when mouse buttons are pressed, and the hint SDL_HINT_MOUSE_AUTO_CAPTURE allows you to control this behavior +* Added the hint SDL_HINT_VIDEO_FOREIGN_WINDOW_OPENGL to let SDL know that a foreign window will be used with OpenGL +* Added the hint SDL_HINT_VIDEO_FOREIGN_WINDOW_VULKAN to let SDL know that a foreign window will be used with Vulkan +* Added the hint SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE to specify whether an SDL_QUIT event will be delivered when the last application window is closed +* Added the hint SDL_HINT_JOYSTICK_ROG_CHAKRAM to control whether ROG Chakram mice show up as joysticks + +Windows: +* Added support for SDL_BLENDOPERATION_MINIMUM and SDL_BLENDOPERATION_MAXIMUM to the D3D9 renderer + +Linux: +* Compiling with Wayland support requires libwayland-client version 1.18.0 or later +* Added the hint SDL_HINT_X11_WINDOW_TYPE to specify the _NET_WM_WINDOW_TYPE of SDL windows +* Added the hint SDL_HINT_VIDEO_WAYLAND_PREFER_LIBDECOR to allow using libdecor with compositors that support xdg-decoration + +Android: +* Added SDL_AndroidSendMessage() to send a custom command to the SDL java activity + + --------------------------------------------------------------------------- 2.0.20: --------------------------------------------------------------------------- diff --git a/libs/SDL2/Xcode/SDL/Info-Framework.plist b/libs/SDL2/Xcode/SDL/Info-Framework.plist index 5f9ace08..9a7cfd36 100644 --- a/libs/SDL2/Xcode/SDL/Info-Framework.plist +++ b/libs/SDL2/Xcode/SDL/Info-Framework.plist @@ -19,10 +19,10 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 2.0.20 + 2.23.1 CFBundleSignature SDLX CFBundleVersion - 2.0.20 + 2.23.1 diff --git a/libs/SDL2/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/libs/SDL2/Xcode/SDL/SDL.xcodeproj/project.pbxproj index b23a394b..1c293410 100755 --- a/libs/SDL2/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ b/libs/SDL2/Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -111,6 +111,24 @@ A1626A582617008D003F1973 /* SDL_triangle.h in Headers */ = {isa = PBXBuildFile; fileRef = A1626A512617008C003F1973 /* SDL_triangle.h */; }; A1626A592617008D003F1973 /* SDL_triangle.h in Headers */ = {isa = PBXBuildFile; fileRef = A1626A512617008C003F1973 /* SDL_triangle.h */; }; A1626A5A2617008D003F1973 /* SDL_triangle.h in Headers */ = {isa = PBXBuildFile; fileRef = A1626A512617008C003F1973 /* SDL_triangle.h */; }; + A1BB8B6327F6CF330057CFA8 /* SDL_list.c in Sources */ = {isa = PBXBuildFile; fileRef = A1BB8B6127F6CF320057CFA8 /* SDL_list.c */; }; + A1BB8B6427F6CF330057CFA8 /* SDL_list.c in Sources */ = {isa = PBXBuildFile; fileRef = A1BB8B6127F6CF320057CFA8 /* SDL_list.c */; }; + A1BB8B6527F6CF330057CFA8 /* SDL_list.c in Sources */ = {isa = PBXBuildFile; fileRef = A1BB8B6127F6CF320057CFA8 /* SDL_list.c */; }; + A1BB8B6627F6CF330057CFA8 /* SDL_list.c in Sources */ = {isa = PBXBuildFile; fileRef = A1BB8B6127F6CF320057CFA8 /* SDL_list.c */; }; + A1BB8B6727F6CF330057CFA8 /* SDL_list.c in Sources */ = {isa = PBXBuildFile; fileRef = A1BB8B6127F6CF320057CFA8 /* SDL_list.c */; }; + A1BB8B6827F6CF330057CFA8 /* SDL_list.c in Sources */ = {isa = PBXBuildFile; fileRef = A1BB8B6127F6CF320057CFA8 /* SDL_list.c */; }; + A1BB8B6927F6CF330057CFA8 /* SDL_list.c in Sources */ = {isa = PBXBuildFile; fileRef = A1BB8B6127F6CF320057CFA8 /* SDL_list.c */; }; + A1BB8B6A27F6CF330057CFA8 /* SDL_list.c in Sources */ = {isa = PBXBuildFile; fileRef = A1BB8B6127F6CF320057CFA8 /* SDL_list.c */; }; + A1BB8B6B27F6CF330057CFA8 /* SDL_list.c in Sources */ = {isa = PBXBuildFile; fileRef = A1BB8B6127F6CF320057CFA8 /* SDL_list.c */; }; + A1BB8B6C27F6CF330057CFA8 /* SDL_list.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB8B6227F6CF330057CFA8 /* SDL_list.h */; }; + A1BB8B6D27F6CF330057CFA8 /* SDL_list.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB8B6227F6CF330057CFA8 /* SDL_list.h */; }; + A1BB8B6E27F6CF330057CFA8 /* SDL_list.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB8B6227F6CF330057CFA8 /* SDL_list.h */; }; + A1BB8B6F27F6CF330057CFA8 /* SDL_list.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB8B6227F6CF330057CFA8 /* SDL_list.h */; }; + A1BB8B7027F6CF330057CFA8 /* SDL_list.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB8B6227F6CF330057CFA8 /* SDL_list.h */; }; + A1BB8B7127F6CF330057CFA8 /* SDL_list.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB8B6227F6CF330057CFA8 /* SDL_list.h */; }; + A1BB8B7227F6CF330057CFA8 /* SDL_list.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB8B6227F6CF330057CFA8 /* SDL_list.h */; }; + A1BB8B7327F6CF330057CFA8 /* SDL_list.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB8B6227F6CF330057CFA8 /* SDL_list.h */; }; + A1BB8B7427F6CF330057CFA8 /* SDL_list.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB8B6227F6CF330057CFA8 /* SDL_list.h */; }; A7381E961D8B69D600B177DD /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E951D8B69D600B177DD /* CoreAudio.framework */; }; A7381E971D8B6A0300B177DD /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E931D8B69C300B177DD /* AudioToolbox.framework */; }; A75FCCFD23E25AB700529352 /* SDL_shaders_metal_tvos.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A8E323E2514000DCD162 /* SDL_shaders_metal_tvos.h */; }; @@ -163,7 +181,6 @@ A75FCD3523E25AB700529352 /* SDL_gesture.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D51595D4D800BBD41B /* SDL_gesture.h */; settings = {ATTRIBUTES = (Public, ); }; }; A75FCD3623E25AB700529352 /* SDL_sysaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A89F23E2513F00DCD162 /* SDL_sysaudio.h */; }; A75FCD3723E25AB700529352 /* SDL_haptic.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D61595D4D800BBD41B /* SDL_haptic.h */; settings = {ATTRIBUTES = (Public, ); }; }; - A75FCD3823E25AB700529352 /* SDL_sysevents.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A93F23E2514000DCD162 /* SDL_sysevents.h */; }; A75FCD3923E25AB700529352 /* math_libm.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A92623E2514000DCD162 /* math_libm.h */; }; A75FCD3A23E25AB700529352 /* SDL_uikitvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A62223E2513D00DCD162 /* SDL_uikitvideo.h */; }; A75FCD3B23E25AB700529352 /* SDL_cocoamouse.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A69823E2513E00DCD162 /* SDL_cocoamouse.h */; }; @@ -542,7 +559,6 @@ A75FCEEE23E25AC700529352 /* SDL_gesture.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D51595D4D800BBD41B /* SDL_gesture.h */; settings = {ATTRIBUTES = (Public, ); }; }; A75FCEEF23E25AC700529352 /* SDL_sysaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A89F23E2513F00DCD162 /* SDL_sysaudio.h */; }; A75FCEF023E25AC700529352 /* SDL_haptic.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D61595D4D800BBD41B /* SDL_haptic.h */; settings = {ATTRIBUTES = (Public, ); }; }; - A75FCEF123E25AC700529352 /* SDL_sysevents.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A93F23E2514000DCD162 /* SDL_sysevents.h */; }; A75FCEF223E25AC700529352 /* math_libm.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A92623E2514000DCD162 /* math_libm.h */; }; A75FCEF323E25AC700529352 /* SDL_uikitvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A62223E2513D00DCD162 /* SDL_uikitvideo.h */; }; A75FCEF423E25AC700529352 /* SDL_cocoamouse.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A69823E2513E00DCD162 /* SDL_cocoamouse.h */; }; @@ -945,7 +961,6 @@ A769B0B923E259AE00872273 /* vk_sdk_platform.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A73D23E2513E00DCD162 /* vk_sdk_platform.h */; }; A769B0BA23E259AE00872273 /* blank_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A93223E2514000DCD162 /* blank_cursor.h */; }; A769B0BC23E259AE00872273 /* SDL_sysaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A89F23E2513F00DCD162 /* SDL_sysaudio.h */; }; - A769B0BE23E259AE00872273 /* SDL_sysevents.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A93F23E2514000DCD162 /* SDL_sysevents.h */; }; A769B0BF23E259AE00872273 /* math_libm.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A92623E2514000DCD162 /* math_libm.h */; }; A769B0C023E259AE00872273 /* SDL_uikitvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A62223E2513D00DCD162 /* SDL_uikitvideo.h */; }; A769B0C123E259AE00872273 /* SDL_cocoamouse.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A69823E2513E00DCD162 /* SDL_cocoamouse.h */; }; @@ -3146,12 +3161,6 @@ A7D8BB9023E2514500DCD162 /* SDL_touch.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A93E23E2514000DCD162 /* SDL_touch.c */; }; A7D8BB9123E2514500DCD162 /* SDL_touch.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A93E23E2514000DCD162 /* SDL_touch.c */; }; A7D8BB9223E2514500DCD162 /* SDL_touch.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A93E23E2514000DCD162 /* SDL_touch.c */; }; - A7D8BB9323E2514500DCD162 /* SDL_sysevents.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A93F23E2514000DCD162 /* SDL_sysevents.h */; }; - A7D8BB9423E2514500DCD162 /* SDL_sysevents.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A93F23E2514000DCD162 /* SDL_sysevents.h */; }; - A7D8BB9523E2514500DCD162 /* SDL_sysevents.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A93F23E2514000DCD162 /* SDL_sysevents.h */; }; - A7D8BB9623E2514500DCD162 /* SDL_sysevents.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A93F23E2514000DCD162 /* SDL_sysevents.h */; }; - A7D8BB9723E2514500DCD162 /* SDL_sysevents.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A93F23E2514000DCD162 /* SDL_sysevents.h */; }; - A7D8BB9823E2514500DCD162 /* SDL_sysevents.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A93F23E2514000DCD162 /* SDL_sysevents.h */; }; A7D8BB9923E2514500DCD162 /* SDL_gesture.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A94023E2514000DCD162 /* SDL_gesture.c */; }; A7D8BB9A23E2514500DCD162 /* SDL_gesture.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A94023E2514000DCD162 /* SDL_gesture.c */; }; A7D8BB9B23E2514500DCD162 /* SDL_gesture.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A94023E2514000DCD162 /* SDL_gesture.c */; }; @@ -3364,6 +3373,24 @@ DB31407017554B71006C0E22 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179F0858DECD00B2BC32 /* IOKit.framework */; }; DB31407217554B71006C0E22 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 007317C10858E15000B2BC32 /* Carbon.framework */; }; DB31408D17554D3C006C0E22 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00CFA89C106B4BA100758660 /* ForceFeedback.framework */; }; + F3249B1E285A85FF00DB9B5C /* SDL_memset.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1C285A85FF00DB9B5C /* SDL_memset.c */; }; + F3249B1F285A85FF00DB9B5C /* SDL_memset.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1C285A85FF00DB9B5C /* SDL_memset.c */; }; + F3249B20285A85FF00DB9B5C /* SDL_memset.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1C285A85FF00DB9B5C /* SDL_memset.c */; }; + F3249B21285A85FF00DB9B5C /* SDL_memset.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1C285A85FF00DB9B5C /* SDL_memset.c */; }; + F3249B22285A85FF00DB9B5C /* SDL_memset.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1C285A85FF00DB9B5C /* SDL_memset.c */; }; + F3249B23285A85FF00DB9B5C /* SDL_memset.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1C285A85FF00DB9B5C /* SDL_memset.c */; }; + F3249B24285A85FF00DB9B5C /* SDL_memset.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1C285A85FF00DB9B5C /* SDL_memset.c */; }; + F3249B25285A85FF00DB9B5C /* SDL_memset.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1C285A85FF00DB9B5C /* SDL_memset.c */; }; + F3249B26285A85FF00DB9B5C /* SDL_memset.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1C285A85FF00DB9B5C /* SDL_memset.c */; }; + F3249B27285A85FF00DB9B5C /* SDL_memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1D285A85FF00DB9B5C /* SDL_memcpy.c */; }; + F3249B28285A85FF00DB9B5C /* SDL_memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1D285A85FF00DB9B5C /* SDL_memcpy.c */; }; + F3249B29285A85FF00DB9B5C /* SDL_memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1D285A85FF00DB9B5C /* SDL_memcpy.c */; }; + F3249B2A285A85FF00DB9B5C /* SDL_memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1D285A85FF00DB9B5C /* SDL_memcpy.c */; }; + F3249B2B285A85FF00DB9B5C /* SDL_memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1D285A85FF00DB9B5C /* SDL_memcpy.c */; }; + F3249B2C285A85FF00DB9B5C /* SDL_memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1D285A85FF00DB9B5C /* SDL_memcpy.c */; }; + F3249B2D285A85FF00DB9B5C /* SDL_memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1D285A85FF00DB9B5C /* SDL_memcpy.c */; }; + F3249B2E285A85FF00DB9B5C /* SDL_memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1D285A85FF00DB9B5C /* SDL_memcpy.c */; }; + F3249B2F285A85FF00DB9B5C /* SDL_memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1D285A85FF00DB9B5C /* SDL_memcpy.c */; }; F3631C6424884ACF004F28EA /* SDL_locale.h in Headers */ = {isa = PBXBuildFile; fileRef = 566E26792462701100718109 /* SDL_locale.h */; settings = {ATTRIBUTES = (Public, ); }; }; F3631C652488534E004F28EA /* SDL_locale.h in Headers */ = {isa = PBXBuildFile; fileRef = 566E26792462701100718109 /* SDL_locale.h */; settings = {ATTRIBUTES = (Public, ); }; }; F376F6192559B29300CFC0BC /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F376F6182559B29300CFC0BC /* OpenGLES.framework */; platformFilter = ios; }; @@ -3395,8 +3422,38 @@ F376F7262559B76800CFC0BC /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F376F7252559B76800CFC0BC /* CoreFoundation.framework */; }; F376F7282559B77100CFC0BC /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F376F7272559B77100CFC0BC /* CoreAudio.framework */; }; F376F7332559B79B00CFC0BC /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F376F6DE2559B5BA00CFC0BC /* GameController.framework */; }; + F37A8E1A28405AA100C38E95 /* CMake in Resources */ = {isa = PBXBuildFile; fileRef = F37A8E1928405AA100C38E95 /* CMake */; }; + F37A8E1B28405AA100C38E95 /* CMake in Resources */ = {isa = PBXBuildFile; fileRef = F37A8E1928405AA100C38E95 /* CMake */; }; + F37A8E1C28405AA100C38E95 /* CMake in Resources */ = {isa = PBXBuildFile; fileRef = F37A8E1928405AA100C38E95 /* CMake */; }; F37DC5F325350EBC0002E6F7 /* CoreHaptics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F37DC5F225350EBC0002E6F7 /* CoreHaptics.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; F37DC5F525350ECC0002E6F7 /* CoreHaptics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F37DC5F425350ECC0002E6F7 /* CoreHaptics.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + F3820713284F3609004DD584 /* controller_type.c in Sources */ = {isa = PBXBuildFile; fileRef = F3820712284F3609004DD584 /* controller_type.c */; }; + F3820714284F3609004DD584 /* controller_type.c in Sources */ = {isa = PBXBuildFile; fileRef = F3820712284F3609004DD584 /* controller_type.c */; }; + F3820715284F3609004DD584 /* controller_type.c in Sources */ = {isa = PBXBuildFile; fileRef = F3820712284F3609004DD584 /* controller_type.c */; }; + F3820716284F3609004DD584 /* controller_type.c in Sources */ = {isa = PBXBuildFile; fileRef = F3820712284F3609004DD584 /* controller_type.c */; }; + F3820717284F3609004DD584 /* controller_type.c in Sources */ = {isa = PBXBuildFile; fileRef = F3820712284F3609004DD584 /* controller_type.c */; }; + F3820718284F3609004DD584 /* controller_type.c in Sources */ = {isa = PBXBuildFile; fileRef = F3820712284F3609004DD584 /* controller_type.c */; }; + F3820719284F3609004DD584 /* controller_type.c in Sources */ = {isa = PBXBuildFile; fileRef = F3820712284F3609004DD584 /* controller_type.c */; }; + F382071A284F3609004DD584 /* controller_type.c in Sources */ = {isa = PBXBuildFile; fileRef = F3820712284F3609004DD584 /* controller_type.c */; }; + F382071B284F3609004DD584 /* controller_type.c in Sources */ = {isa = PBXBuildFile; fileRef = F3820712284F3609004DD584 /* controller_type.c */; }; + F382071D284F362F004DD584 /* SDL_guid.c in Sources */ = {isa = PBXBuildFile; fileRef = F382071C284F362F004DD584 /* SDL_guid.c */; }; + F382071E284F362F004DD584 /* SDL_guid.c in Sources */ = {isa = PBXBuildFile; fileRef = F382071C284F362F004DD584 /* SDL_guid.c */; }; + F382071F284F362F004DD584 /* SDL_guid.c in Sources */ = {isa = PBXBuildFile; fileRef = F382071C284F362F004DD584 /* SDL_guid.c */; }; + F3820720284F362F004DD584 /* SDL_guid.c in Sources */ = {isa = PBXBuildFile; fileRef = F382071C284F362F004DD584 /* SDL_guid.c */; }; + F3820721284F362F004DD584 /* SDL_guid.c in Sources */ = {isa = PBXBuildFile; fileRef = F382071C284F362F004DD584 /* SDL_guid.c */; }; + F3820722284F362F004DD584 /* SDL_guid.c in Sources */ = {isa = PBXBuildFile; fileRef = F382071C284F362F004DD584 /* SDL_guid.c */; }; + F3820723284F362F004DD584 /* SDL_guid.c in Sources */ = {isa = PBXBuildFile; fileRef = F382071C284F362F004DD584 /* SDL_guid.c */; }; + F3820724284F362F004DD584 /* SDL_guid.c in Sources */ = {isa = PBXBuildFile; fileRef = F382071C284F362F004DD584 /* SDL_guid.c */; }; + F3820725284F362F004DD584 /* SDL_guid.c in Sources */ = {isa = PBXBuildFile; fileRef = F382071C284F362F004DD584 /* SDL_guid.c */; }; + F3820727284F3643004DD584 /* SDL_guid.h in Headers */ = {isa = PBXBuildFile; fileRef = F3820726284F3643004DD584 /* SDL_guid.h */; settings = {ATTRIBUTES = (Public, ); }; }; + F3820728284F3643004DD584 /* SDL_guid.h in Headers */ = {isa = PBXBuildFile; fileRef = F3820726284F3643004DD584 /* SDL_guid.h */; settings = {ATTRIBUTES = (Public, ); }; }; + F3820729284F3643004DD584 /* SDL_guid.h in Headers */ = {isa = PBXBuildFile; fileRef = F3820726284F3643004DD584 /* SDL_guid.h */; settings = {ATTRIBUTES = (Public, ); }; }; + F382072A284F3643004DD584 /* SDL_guid.h in Headers */ = {isa = PBXBuildFile; fileRef = F3820726284F3643004DD584 /* SDL_guid.h */; }; + F382072B284F3643004DD584 /* SDL_guid.h in Headers */ = {isa = PBXBuildFile; fileRef = F3820726284F3643004DD584 /* SDL_guid.h */; }; + F382072C284F3643004DD584 /* SDL_guid.h in Headers */ = {isa = PBXBuildFile; fileRef = F3820726284F3643004DD584 /* SDL_guid.h */; }; + F382072D284F3643004DD584 /* SDL_guid.h in Headers */ = {isa = PBXBuildFile; fileRef = F3820726284F3643004DD584 /* SDL_guid.h */; settings = {ATTRIBUTES = (Public, ); }; }; + F382072E284F3643004DD584 /* SDL_guid.h in Headers */ = {isa = PBXBuildFile; fileRef = F3820726284F3643004DD584 /* SDL_guid.h */; settings = {ATTRIBUTES = (Public, ); }; }; + F382072F284F3643004DD584 /* SDL_guid.h in Headers */ = {isa = PBXBuildFile; fileRef = F3820726284F3643004DD584 /* SDL_guid.h */; settings = {ATTRIBUTES = (Public, ); }; }; F38233852738EB8600F7F527 /* SDL_hidapi.h in Headers */ = {isa = PBXBuildFile; fileRef = F38233842738EB8600F7F527 /* SDL_hidapi.h */; settings = {ATTRIBUTES = (Public, ); }; }; F38233862738EB8600F7F527 /* SDL_hidapi.h in Headers */ = {isa = PBXBuildFile; fileRef = F38233842738EB8600F7F527 /* SDL_hidapi.h */; settings = {ATTRIBUTES = (Public, ); }; }; F38233872738EB8600F7F527 /* SDL_hidapi.h in Headers */ = {isa = PBXBuildFile; fileRef = F38233842738EB8600F7F527 /* SDL_hidapi.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -3451,13 +3508,13 @@ F395C1A22569C68F00942BFF /* SDL_iokitjoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = F395C1922569C68E00942BFF /* SDL_iokitjoystick.c */; }; F395C1A32569C68F00942BFF /* SDL_iokitjoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = F395C1922569C68E00942BFF /* SDL_iokitjoystick.c */; }; F395C1A42569C68F00942BFF /* SDL_iokitjoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = F395C1922569C68E00942BFF /* SDL_iokitjoystick.c */; }; - F395C1B12569C6A000942BFF /* SDL_mfijoystick.m in Sources */ = {isa = PBXBuildFile; fileRef = F395C1AF2569C6A000942BFF /* SDL_mfijoystick.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; }; + F395C1B12569C6A000942BFF /* SDL_mfijoystick.m in Sources */ = {isa = PBXBuildFile; fileRef = F395C1AF2569C6A000942BFF /* SDL_mfijoystick.m */; }; F395C1B22569C6A000942BFF /* SDL_mfijoystick.m in Sources */ = {isa = PBXBuildFile; fileRef = F395C1AF2569C6A000942BFF /* SDL_mfijoystick.m */; }; F395C1B32569C6A000942BFF /* SDL_mfijoystick.m in Sources */ = {isa = PBXBuildFile; fileRef = F395C1AF2569C6A000942BFF /* SDL_mfijoystick.m */; }; - F395C1B42569C6A000942BFF /* SDL_mfijoystick.m in Sources */ = {isa = PBXBuildFile; fileRef = F395C1AF2569C6A000942BFF /* SDL_mfijoystick.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; }; + F395C1B42569C6A000942BFF /* SDL_mfijoystick.m in Sources */ = {isa = PBXBuildFile; fileRef = F395C1AF2569C6A000942BFF /* SDL_mfijoystick.m */; }; F395C1B52569C6A000942BFF /* SDL_mfijoystick.m in Sources */ = {isa = PBXBuildFile; fileRef = F395C1AF2569C6A000942BFF /* SDL_mfijoystick.m */; }; F395C1B62569C6A000942BFF /* SDL_mfijoystick.m in Sources */ = {isa = PBXBuildFile; fileRef = F395C1AF2569C6A000942BFF /* SDL_mfijoystick.m */; }; - F395C1B72569C6A000942BFF /* SDL_mfijoystick.m in Sources */ = {isa = PBXBuildFile; fileRef = F395C1AF2569C6A000942BFF /* SDL_mfijoystick.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; }; + F395C1B72569C6A000942BFF /* SDL_mfijoystick.m in Sources */ = {isa = PBXBuildFile; fileRef = F395C1AF2569C6A000942BFF /* SDL_mfijoystick.m */; }; F395C1B82569C6A000942BFF /* SDL_mfijoystick.m in Sources */ = {isa = PBXBuildFile; fileRef = F395C1AF2569C6A000942BFF /* SDL_mfijoystick.m */; }; F395C1B92569C6A000942BFF /* SDL_mfijoystick.m in Sources */ = {isa = PBXBuildFile; fileRef = F395C1AF2569C6A000942BFF /* SDL_mfijoystick.m */; }; F395C1BA2569C6A000942BFF /* SDL_mfijoystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = F395C1B02569C6A000942BFF /* SDL_mfijoystick_c.h */; }; @@ -3574,6 +3631,8 @@ 75E09159241EA924004729E1 /* SDL_virtualjoystick_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_virtualjoystick_c.h; sourceTree = ""; }; A1626A3D2617006A003F1973 /* SDL_triangle.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_triangle.c; sourceTree = ""; }; A1626A512617008C003F1973 /* SDL_triangle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_triangle.h; sourceTree = ""; }; + A1BB8B6127F6CF320057CFA8 /* SDL_list.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_list.c; sourceTree = ""; }; + A1BB8B6227F6CF330057CFA8 /* SDL_list.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_list.h; sourceTree = ""; }; A7381E931D8B69C300B177DD /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; A7381E951D8B69D600B177DD /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; }; A75FCEB323E25AB700529352 /* libSDL2.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libSDL2.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -3909,7 +3968,6 @@ A7D8A93C23E2514000DCD162 /* SDL_quit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_quit.c; sourceTree = ""; }; A7D8A93D23E2514000DCD162 /* SDL_keyboard_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_keyboard_c.h; sourceTree = ""; }; A7D8A93E23E2514000DCD162 /* SDL_touch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_touch.c; sourceTree = ""; }; - A7D8A93F23E2514000DCD162 /* SDL_sysevents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysevents.h; sourceTree = ""; }; A7D8A94023E2514000DCD162 /* SDL_gesture.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_gesture.c; sourceTree = ""; }; A7D8A94123E2514000DCD162 /* scancodes_xfree86.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scancodes_xfree86.h; sourceTree = ""; }; A7D8A94223E2514000DCD162 /* SDL_events_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_events_c.h; sourceTree = ""; }; @@ -3977,6 +4035,8 @@ BECDF6B30761BA81005FE872 /* libSDL2.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL2.a; sourceTree = BUILT_PRODUCTS_DIR; }; BECDF6BE0761BA81005FE872 /* SDL2 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = SDL2; sourceTree = BUILT_PRODUCTS_DIR; }; DB31407717554B71006C0E22 /* libSDL2.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libSDL2.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + F3249B1C285A85FF00DB9B5C /* SDL_memset.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_memset.c; sourceTree = ""; }; + F3249B1D285A85FF00DB9B5C /* SDL_memcpy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_memcpy.c; sourceTree = ""; }; F376F6182559B29300CFC0BC /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.1.sdk/System/Library/Frameworks/OpenGLES.framework; sourceTree = DEVELOPER_DIR; }; F376F61A2559B2AF00CFC0BC /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/iOSSupport/System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; F376F6312559B31D00CFC0BC /* GameController.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameController.framework; path = System/iOSSupport/System/Library/Frameworks/GameController.framework; sourceTree = SDKROOT; }; @@ -3991,8 +4051,12 @@ F376F7212559B74900CFC0BC /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS14.0.sdk/System/Library/Frameworks/Metal.framework; sourceTree = DEVELOPER_DIR; }; F376F7252559B76800CFC0BC /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS14.0.sdk/System/Library/Frameworks/CoreFoundation.framework; sourceTree = DEVELOPER_DIR; }; F376F7272559B77100CFC0BC /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS14.0.sdk/System/Library/Frameworks/CoreAudio.framework; sourceTree = DEVELOPER_DIR; }; + F37A8E1928405AA100C38E95 /* CMake */ = {isa = PBXFileReference; lastKnownFileType = folder; path = CMake; sourceTree = ""; }; F37DC5F225350EBC0002E6F7 /* CoreHaptics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreHaptics.framework; path = System/Library/Frameworks/CoreHaptics.framework; sourceTree = SDKROOT; }; F37DC5F425350ECC0002E6F7 /* CoreHaptics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreHaptics.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS14.0.sdk/System/Library/Frameworks/CoreHaptics.framework; sourceTree = DEVELOPER_DIR; }; + F3820712284F3609004DD584 /* controller_type.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = controller_type.c; sourceTree = ""; }; + F382071C284F362F004DD584 /* SDL_guid.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_guid.c; sourceTree = ""; }; + F3820726284F3643004DD584 /* SDL_guid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_guid.h; sourceTree = ""; }; F38233842738EB8600F7F527 /* SDL_hidapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_hidapi.h; sourceTree = ""; }; F382339B2738ED6600F7F527 /* CoreBluetooth.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreBluetooth.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS15.0.sdk/System/Library/Frameworks/CoreBluetooth.framework; sourceTree = DEVELOPER_DIR; }; F3950CD7212BC88D00F51292 /* SDL_sensor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sensor.h; sourceTree = ""; }; @@ -4182,6 +4246,7 @@ 567E2F2017C44C35005F1892 /* SDL_filesystem.h */, A77E6EB3167AB0A90010E40B /* SDL_gamecontroller.h */, AA7557D51595D4D800BBD41B /* SDL_gesture.h */, + F3820726284F3643004DD584 /* SDL_guid.h */, AA7557D61595D4D800BBD41B /* SDL_haptic.h */, F38233842738EB8600F7F527 /* SDL_hidapi.h */, AA7557D71595D4D800BBD41B /* SDL_hints.h */, @@ -4300,10 +4365,13 @@ A7D8A57023E2513D00DCD162 /* SDL_dataqueue.h */, A7D8A57523E2513D00DCD162 /* SDL_error_c.h */, A7D8A8BF23E2513F00DCD162 /* SDL_error.c */, + F382071C284F362F004DD584 /* SDL_guid.c */, A7D8A8D123E2514000DCD162 /* SDL_hints_c.h */, A7D8A5AB23E2513D00DCD162 /* SDL_hints.c */, A7D8A58323E2513D00DCD162 /* SDL_internal.h */, A7D8A5DD23E2513D00DCD162 /* SDL_log.c */, + A1BB8B6127F6CF320057CFA8 /* SDL_list.c */, + A1BB8B6227F6CF330057CFA8 /* SDL_list.h */, A7D8A57123E2513D00DCD162 /* SDL.c */, ); name = "Library Source"; @@ -4795,6 +4863,7 @@ 75E09157241EA924004729E1 /* virtual */, A7D8A7AD23E2513E00DCD162 /* SDL_gamecontroller.c */, A7D8A7A923E2513E00DCD162 /* SDL_joystick.c */, + F3820712284F3609004DD584 /* controller_type.c */, A7D8A7D923E2513E00DCD162 /* controller_type.h */, A7D8A79E23E2513E00DCD162 /* SDL_gamecontrollerdb.h */, A7D8A7D023E2513E00DCD162 /* SDL_joystick_c.h */, @@ -5026,6 +5095,8 @@ A7D8A8D423E2514000DCD162 /* SDL_getenv.c */, A7D8A8D323E2514000DCD162 /* SDL_iconv.c */, A7D8A8D923E2514000DCD162 /* SDL_malloc.c */, + F3249B1D285A85FF00DB9B5C /* SDL_memcpy.c */, + F3249B1C285A85FF00DB9B5C /* SDL_memset.c */, A7D8A8D723E2514000DCD162 /* SDL_qsort.c */, A7D8A8D823E2514000DCD162 /* SDL_stdlib.c */, A7D8A8D523E2514000DCD162 /* SDL_string.c */, @@ -5172,7 +5243,6 @@ A7D8A92B23E2514000DCD162 /* SDL_mouse_c.h */, A7D8A92A23E2514000DCD162 /* SDL_mouse.c */, A7D8A93C23E2514000DCD162 /* SDL_quit.c */, - A7D8A93F23E2514000DCD162 /* SDL_sysevents.h */, A7D8A93723E2514000DCD162 /* SDL_touch_c.h */, A7D8A93E23E2514000DCD162 /* SDL_touch.c */, A7D8A94323E2514000DCD162 /* SDL_windowevents_c.h */, @@ -5201,6 +5271,7 @@ F59C710100D5CB5801000001 /* resources */ = { isa = PBXGroup; children = ( + F37A8E1928405AA100C38E95 /* CMake */, 00794D3F09D0C461003FC8A1 /* License.txt */, F59C710300D5CB5801000001 /* ReadMe.txt */, ); @@ -5227,6 +5298,7 @@ A75FCD0823E25AB700529352 /* SDL_atomic.h in Headers */, A75FCD0923E25AB700529352 /* SDL_rect_c.h in Headers */, A75FCD0B23E25AB700529352 /* SDL_shaders_metal_osx.h in Headers */, + F382072E284F3643004DD584 /* SDL_guid.h in Headers */, A75FCD0C23E25AB700529352 /* SDL_shaders_metal_ios.h in Headers */, A75FCD0D23E25AB700529352 /* SDL_offscreenwindow.h in Headers */, A75FCD0E23E25AB700529352 /* SDL_audio.h in Headers */, @@ -5268,7 +5340,6 @@ A75FDBCC23EA380300529352 /* SDL_hidapi_rumble.h in Headers */, A75FCD3623E25AB700529352 /* SDL_sysaudio.h in Headers */, A75FCD3723E25AB700529352 /* SDL_haptic.h in Headers */, - A75FCD3823E25AB700529352 /* SDL_sysevents.h in Headers */, A75FCD3923E25AB700529352 /* math_libm.h in Headers */, A75FCD3A23E25AB700529352 /* SDL_uikitvideo.h in Headers */, A75FCD3B23E25AB700529352 /* SDL_cocoamouse.h in Headers */, @@ -5284,6 +5355,7 @@ A75FCD4523E25AB700529352 /* SDL_gesture_c.h in Headers */, A75FCD4623E25AB700529352 /* SDL_shaders_gl.h in Headers */, A75FCD4723E25AB700529352 /* SDL_systhread_c.h in Headers */, + A1BB8B7327F6CF330057CFA8 /* SDL_list.h in Headers */, A75FCD4823E25AB700529352 /* SDL_keycode.h in Headers */, 5616CA63252BB35F005D5928 /* SDL_sysurl.h in Headers */, A75FCD4A23E25AB700529352 /* SDL_cocoakeyboard.h in Headers */, @@ -5455,6 +5527,7 @@ A75FCEC523E25AC700529352 /* SDL_shaders_metal_ios.h in Headers */, A75FCEC623E25AC700529352 /* SDL_offscreenwindow.h in Headers */, A75FCEC723E25AC700529352 /* SDL_audio.h in Headers */, + F382072F284F3643004DD584 /* SDL_guid.h in Headers */, A75FCEC823E25AC700529352 /* SDL_coremotionsensor.h in Headers */, A75FCEC923E25AC700529352 /* SDL_uikitview.h in Headers */, A75FCECA23E25AC700529352 /* SDL_bits.h in Headers */, @@ -5493,7 +5566,6 @@ A75FDBCD23EA380300529352 /* SDL_hidapi_rumble.h in Headers */, A75FCEEF23E25AC700529352 /* SDL_sysaudio.h in Headers */, A75FCEF023E25AC700529352 /* SDL_haptic.h in Headers */, - A75FCEF123E25AC700529352 /* SDL_sysevents.h in Headers */, A75FCEF223E25AC700529352 /* math_libm.h in Headers */, A75FCEF323E25AC700529352 /* SDL_uikitvideo.h in Headers */, A75FCEF423E25AC700529352 /* SDL_cocoamouse.h in Headers */, @@ -5509,6 +5581,7 @@ A75FCEFE23E25AC700529352 /* SDL_gesture_c.h in Headers */, A75FCEFF23E25AC700529352 /* SDL_shaders_gl.h in Headers */, A75FCF0023E25AC700529352 /* SDL_systhread_c.h in Headers */, + A1BB8B7427F6CF330057CFA8 /* SDL_list.h in Headers */, A75FCF0123E25AC700529352 /* SDL_keycode.h in Headers */, 5616CA66252BB361005D5928 /* SDL_sysurl.h in Headers */, A75FCF0323E25AC700529352 /* SDL_cocoakeyboard.h in Headers */, @@ -5698,7 +5771,6 @@ A75FDB5D23E39E6100529352 /* hidapi.h in Headers */, A75FDBCA23EA380300529352 /* SDL_hidapi_rumble.h in Headers */, A769B0BC23E259AE00872273 /* SDL_sysaudio.h in Headers */, - A769B0BE23E259AE00872273 /* SDL_sysevents.h in Headers */, A769B0BF23E259AE00872273 /* math_libm.h in Headers */, A769B0C023E259AE00872273 /* SDL_uikitvideo.h in Headers */, A769B0C123E259AE00872273 /* SDL_cocoamouse.h in Headers */, @@ -5707,6 +5779,7 @@ A769B0C623E259AE00872273 /* SDL_windowevents_c.h in Headers */, A769B0C823E259AE00872273 /* SDL_cocoavideo.h in Headers */, 5605721C2473688D00B46B66 /* SDL_syslocale.h in Headers */, + A1BB8B7127F6CF330057CFA8 /* SDL_list.h in Headers */, A769B0CA23E259AE00872273 /* SDL_uikitevents.h in Headers */, A769B0CB23E259AE00872273 /* SDL_gesture_c.h in Headers */, A769B0CC23E259AE00872273 /* SDL_shaders_gl.h in Headers */, @@ -5802,6 +5875,7 @@ A769B14623E259AE00872273 /* SDL_syspower.h in Headers */, A769B14723E259AE00872273 /* vulkan_macos.h in Headers */, A769B14823E259AE00872273 /* vulkan_xcb.h in Headers */, + F382072C284F3643004DD584 /* SDL_guid.h in Headers */, A769B14923E259AE00872273 /* vulkan_ios.h in Headers */, A769B14A23E259AE00872273 /* SDL_internal.h in Headers */, A769B14E23E259AE00872273 /* vulkan.h in Headers */, @@ -5844,6 +5918,7 @@ A7D8BA0E23E2514400DCD162 /* SDL_blendpoint.h in Headers */, A7D8B3B723E2514200DCD162 /* SDL_blit.h in Headers */, A7D8B2BB23E2514200DCD162 /* SDL_blit_auto.h in Headers */, + F3820728284F3643004DD584 /* SDL_guid.h in Headers */, A7D8B39923E2514200DCD162 /* SDL_blit_copy.h in Headers */, A7D8ADED23E2514100DCD162 /* SDL_blit_slow.h in Headers */, A7D88A2123E2437C00DCD162 /* SDL_clipboard.h in Headers */, @@ -5955,6 +6030,7 @@ A7D8A98E23E2514000DCD162 /* SDL_sensor_c.h in Headers */, A7D8BA7423E2514400DCD162 /* SDL_shaders_gl.h in Headers */, A7D8BA5023E2514400DCD162 /* SDL_shaders_gles2.h in Headers */, + A1BB8B6D27F6CF330057CFA8 /* SDL_list.h in Headers */, A7D8B98D23E2514400DCD162 /* SDL_shaders_metal_ios.h in Headers */, A7D8B99C23E2514400DCD162 /* SDL_shaders_metal_osx.h in Headers */, A7D8B9A223E2514400DCD162 /* SDL_shaders_metal_tvos.h in Headers */, @@ -5964,7 +6040,6 @@ A7D8B4C523E2514300DCD162 /* SDL_steamcontroller.h in Headers */, A7D88A5223E2437C00DCD162 /* SDL_surface.h in Headers */, A7D8B85B23E2514400DCD162 /* SDL_sysaudio.h in Headers */, - A7D8BB9423E2514500DCD162 /* SDL_sysevents.h in Headers */, A7D8AAD523E2514100DCD162 /* SDL_syshaptic.h in Headers */, A7D8AAE123E2514100DCD162 /* SDL_syshaptic_c.h in Headers */, A7D8B58223E2514300DCD162 /* SDL_sysjoystick.h in Headers */, @@ -6075,6 +6150,7 @@ A7D8B3B823E2514200DCD162 /* SDL_blit.h in Headers */, A7D8B2BC23E2514200DCD162 /* SDL_blit_auto.h in Headers */, A7D8B39A23E2514200DCD162 /* SDL_blit_copy.h in Headers */, + F3820729284F3643004DD584 /* SDL_guid.h in Headers */, A7D8ADEE23E2514100DCD162 /* SDL_blit_slow.h in Headers */, A7D88BD823E24BED00DCD162 /* SDL_clipboard.h in Headers */, A7D8BB7123E2514500DCD162 /* SDL_clipboardevents_c.h in Headers */, @@ -6185,6 +6261,7 @@ A7D8A98F23E2514000DCD162 /* SDL_sensor_c.h in Headers */, A7D8BA7523E2514400DCD162 /* SDL_shaders_gl.h in Headers */, A7D8BA5123E2514400DCD162 /* SDL_shaders_gles2.h in Headers */, + A1BB8B6E27F6CF330057CFA8 /* SDL_list.h in Headers */, A7D8B98E23E2514400DCD162 /* SDL_shaders_metal_ios.h in Headers */, A7D8B99D23E2514400DCD162 /* SDL_shaders_metal_osx.h in Headers */, A7D8B9A323E2514400DCD162 /* SDL_shaders_metal_tvos.h in Headers */, @@ -6194,7 +6271,6 @@ A7D8B4C623E2514300DCD162 /* SDL_steamcontroller.h in Headers */, A7D88C0D23E24BED00DCD162 /* SDL_surface.h in Headers */, A7D8B85C23E2514400DCD162 /* SDL_sysaudio.h in Headers */, - A7D8BB9523E2514500DCD162 /* SDL_sysevents.h in Headers */, A7D8AAD623E2514100DCD162 /* SDL_syshaptic.h in Headers */, A7D8AAE223E2514100DCD162 /* SDL_syshaptic_c.h in Headers */, A7D8B58323E2514300DCD162 /* SDL_sysjoystick.h in Headers */, @@ -6323,7 +6399,6 @@ A75FDB5C23E39E6100529352 /* hidapi.h in Headers */, A75FDBC923EA380300529352 /* SDL_hidapi_rumble.h in Headers */, A7D8B85E23E2514400DCD162 /* SDL_sysaudio.h in Headers */, - A7D8BB9723E2514500DCD162 /* SDL_sysevents.h in Headers */, A7D8BB0723E2514500DCD162 /* math_libm.h in Headers */, A7D8AC7F23E2514100DCD162 /* SDL_uikitvideo.h in Headers */, A7D8AF2223E2514100DCD162 /* SDL_cocoamouse.h in Headers */, @@ -6332,6 +6407,7 @@ A7D8BBAF23E2514500DCD162 /* SDL_windowevents_c.h in Headers */, A7D8AF0423E2514100DCD162 /* SDL_cocoavideo.h in Headers */, 5605721A2473688C00B46B66 /* SDL_syslocale.h in Headers */, + A1BB8B7027F6CF330057CFA8 /* SDL_list.h in Headers */, A7D8ACC123E2514100DCD162 /* SDL_uikitevents.h in Headers */, A7D8BB3D23E2514500DCD162 /* SDL_gesture_c.h in Headers */, A7D8BA7723E2514400DCD162 /* SDL_shaders_gl.h in Headers */, @@ -6427,6 +6503,7 @@ A7D8B61523E2514300DCD162 /* SDL_syspower.h in Headers */, A7D8B28823E2514200DCD162 /* vulkan_macos.h in Headers */, A7D8B29423E2514200DCD162 /* vulkan_xcb.h in Headers */, + F382072B284F3643004DD584 /* SDL_guid.h in Headers */, A7D8B2A623E2514200DCD162 /* vulkan_ios.h in Headers */, A7D8A99D23E2514000DCD162 /* SDL_internal.h in Headers */, A7D8B26423E2514200DCD162 /* vulkan.h in Headers */, @@ -6471,6 +6548,7 @@ A7D8B2BA23E2514200DCD162 /* SDL_blit_auto.h in Headers */, A7D8B39823E2514200DCD162 /* SDL_blit_copy.h in Headers */, A7D8ADEC23E2514100DCD162 /* SDL_blit_slow.h in Headers */, + F3820727284F3643004DD584 /* SDL_guid.h in Headers */, AA7558061595D4D800BBD41B /* SDL_clipboard.h in Headers */, A7D8BB6F23E2514500DCD162 /* SDL_clipboardevents_c.h in Headers */, A7D8AECA23E2514100DCD162 /* SDL_cocoaclipboard.h in Headers */, @@ -6580,6 +6658,7 @@ A7D8A98D23E2514000DCD162 /* SDL_sensor_c.h in Headers */, A7D8BA7323E2514400DCD162 /* SDL_shaders_gl.h in Headers */, A7D8BA4F23E2514400DCD162 /* SDL_shaders_gles2.h in Headers */, + A1BB8B6C27F6CF330057CFA8 /* SDL_list.h in Headers */, A7D8B98C23E2514400DCD162 /* SDL_shaders_metal_ios.h in Headers */, A7D8B99B23E2514400DCD162 /* SDL_shaders_metal_osx.h in Headers */, A7D8B9A123E2514400DCD162 /* SDL_shaders_metal_tvos.h in Headers */, @@ -6589,7 +6668,6 @@ A7D8BBC723E2561500DCD162 /* SDL_steamcontroller.h in Headers */, AA75584C1595D4D800BBD41B /* SDL_surface.h in Headers */, A7D8B85A23E2514400DCD162 /* SDL_sysaudio.h in Headers */, - A7D8BB9323E2514500DCD162 /* SDL_sysevents.h in Headers */, A7D8AAD423E2514100DCD162 /* SDL_syshaptic.h in Headers */, A7D8AAE023E2514100DCD162 /* SDL_syshaptic_c.h in Headers */, A7D8B58123E2514300DCD162 /* SDL_sysjoystick.h in Headers */, @@ -6712,7 +6790,6 @@ A7D8BB4823E2514500DCD162 /* blank_cursor.h in Headers */, F395C1962569C68F00942BFF /* SDL_iokitjoystick_c.h in Headers */, A7D8B85D23E2514400DCD162 /* SDL_sysaudio.h in Headers */, - A7D8BB9623E2514500DCD162 /* SDL_sysevents.h in Headers */, A7D8BB0623E2514500DCD162 /* math_libm.h in Headers */, A7D8AF2123E2514100DCD162 /* SDL_cocoamouse.h in Headers */, A7D8ADEF23E2514100DCD162 /* SDL_blit_slow.h in Headers */, @@ -6796,6 +6873,7 @@ A7D8B29F23E2514200DCD162 /* vulkan_xlib.h in Headers */, A7D8B25D23E2514200DCD162 /* vulkan_vi.h in Headers */, A7D8B29923E2514200DCD162 /* vulkan_mir.h in Headers */, + A1BB8B6F27F6CF330057CFA8 /* SDL_list.h in Headers */, A7D8BB4E23E2514500DCD162 /* default_cursor.h in Headers */, A7D8B9FE23E2514400DCD162 /* SDL_render_sw_c.h in Headers */, A7D8BBED23E2574800DCD162 /* SDL_uikitappdelegate.h in Headers */, @@ -6832,6 +6910,7 @@ A7D8AF1523E2514100DCD162 /* SDL_cocoaevents.h in Headers */, A7D8B25723E2514200DCD162 /* vk_icd.h in Headers */, A7D8ABE823E2514100DCD162 /* SDL_nullframebuffer_c.h in Headers */, + F382072A284F3643004DD584 /* SDL_guid.h in Headers */, A7D8AB1F23E2514100DCD162 /* SDL_dynapi_procs.h in Headers */, A7D8B27523E2514200DCD162 /* vulkan_fuchsia.h in Headers */, 5616CA57252BB35C005D5928 /* SDL_sysurl.h in Headers */, @@ -6863,6 +6942,7 @@ A7D8AC0823E2514100DCD162 /* SDL_rect_c.h in Headers */, A7D8B9A023E2514400DCD162 /* SDL_shaders_metal_osx.h in Headers */, A7D8B99123E2514400DCD162 /* SDL_shaders_metal_ios.h in Headers */, + F382072D284F3643004DD584 /* SDL_guid.h in Headers */, A7D8AB8A23E2514100DCD162 /* SDL_offscreenwindow.h in Headers */, DB313FCC17554B71006C0E22 /* SDL_audio.h in Headers */, A7D8A97423E2514000DCD162 /* SDL_coremotionsensor.h in Headers */, @@ -6903,7 +6983,6 @@ DB313FD617554B71006C0E22 /* SDL_gesture.h in Headers */, A7D8B85F23E2514400DCD162 /* SDL_sysaudio.h in Headers */, DB313FD717554B71006C0E22 /* SDL_haptic.h in Headers */, - A7D8BB9823E2514500DCD162 /* SDL_sysevents.h in Headers */, A7D8BB0823E2514500DCD162 /* math_libm.h in Headers */, A7D8AC8023E2514100DCD162 /* SDL_uikitvideo.h in Headers */, A7D8AF2323E2514100DCD162 /* SDL_cocoamouse.h in Headers */, @@ -6918,6 +6997,7 @@ A7D8BB3E23E2514500DCD162 /* SDL_gesture_c.h in Headers */, A7D8BA7823E2514400DCD162 /* SDL_shaders_gl.h in Headers */, A7D8B42D23E2514300DCD162 /* SDL_systhread_c.h in Headers */, + A1BB8B7227F6CF330057CFA8 /* SDL_list.h in Headers */, DB313FDB17554B71006C0E22 /* SDL_keycode.h in Headers */, A7D8AE9323E2514100DCD162 /* SDL_cocoakeyboard.h in Headers */, A7D8ACE623E2514100DCD162 /* SDL_uikitvulkan.h in Headers */, @@ -7141,6 +7221,7 @@ A7D88ABF23E2437C00DCD162 /* Sources */, A7D88B4623E2437C00DCD162 /* Frameworks */, A75FDB9F23E4CAFA00529352 /* Embed Frameworks */, + F3ED8107281DB8E600C33C5B /* Convert SDL includes to SDL Framework includes */, ); buildRules = ( ); @@ -7162,6 +7243,7 @@ A7D88C7823E24BED00DCD162 /* Sources */, A7D88D0423E24BED00DCD162 /* Frameworks */, A75FDBA223E4CAFF00529352 /* Embed Frameworks */, + F3ED8108281DB8F200C33C5B /* Convert SDL includes to SDL Framework includes */, ); buildRules = ( ); @@ -7203,6 +7285,7 @@ BECDF62C0761BA81005FE872 /* Sources */, BECDF6680761BA81005FE872 /* Frameworks */, A75FDB9C23E4CAEF00529352 /* Embed Frameworks */, + F3ED8106281DB8A500C33C5B /* Convert SDL includes to SDL Framework includes */, ); buildRules = ( ); @@ -7313,6 +7396,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + F37A8E1B28405AA100C38E95 /* CMake in Resources */, A75FDBBA23E4CBC700529352 /* ReadMe.txt in Resources */, A75FDBB923E4CBC700529352 /* License.txt in Resources */, ); @@ -7322,6 +7406,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + F37A8E1C28405AA100C38E95 /* CMake in Resources */, A75FDBBC23E4CBC800529352 /* ReadMe.txt in Resources */, A75FDBBB23E4CBC800529352 /* License.txt in Resources */, ); @@ -7331,6 +7416,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + F37A8E1A28405AA100C38E95 /* CMake in Resources */, A75FDBB823E4CBC700529352 /* ReadMe.txt in Resources */, A75FDBB723E4CBC700529352 /* License.txt in Resources */, ); @@ -7393,6 +7479,60 @@ shellPath = /bin/sh; shellScript = "# Sign framework\nif [ \"$SDL_CODESIGN_IDENTITY\" != \"\" ]; then\n codesign --force --deep --sign \"$SDL_CODESIGN_IDENTITY\" $TARGET_BUILD_DIR/SDL2.framework/Versions/A || exit $?\nfi\n\n# clean up the framework, remove headers, extra files\nmkdir -p build/dmg-tmp\ncp -a $TARGET_BUILD_DIR/SDL2.framework build/dmg-tmp/\n\ncp pkg-support/resources/License.txt build/dmg-tmp\ncp pkg-support/resources/ReadMe.txt build/dmg-tmp\n\n# remove the .DS_Store files if any (we may want to provide one in the future for fancy .dmgs)\nfind build/dmg-tmp -name .DS_Store -exec rm -f \"{}\" \\;\n\n# for fancy .dmg\nmkdir -p build/dmg-tmp/.logo\ncp pkg-support/resources/SDL_DS_Store build/dmg-tmp/.DS_Store\ncp pkg-support/sdl_logo.pdf build/dmg-tmp/.logo\n\n# create the dmg\nhdiutil create -ov -fs HFS+ -volname SDL2 -srcfolder build/dmg-tmp build/SDL2.dmg\n\n# clean up\nrm -rf build/dmg-tmp\n"; }; + F3ED8106281DB8A500C33C5B /* Convert SDL includes to SDL Framework includes */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "Convert SDL includes to SDL Framework includes"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "cd \"$BUILT_PRODUCTS_DIR/$PUBLIC_HEADERS_FOLDER_PATH\"\nsed -i '' -e 's,#include \"\\(.*\\)\",#include ,' *.h\n"; + }; + F3ED8107281DB8E600C33C5B /* Convert SDL includes to SDL Framework includes */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "Convert SDL includes to SDL Framework includes"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "cd \"$BUILT_PRODUCTS_DIR/$PUBLIC_HEADERS_FOLDER_PATH\"\nsed -i '' -e 's,#include \"\\(.*\\)\",#include ,' *.h\n"; + }; + F3ED8108281DB8F200C33C5B /* Convert SDL includes to SDL Framework includes */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "Convert SDL includes to SDL Framework includes"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "cd \"$BUILT_PRODUCTS_DIR/$PUBLIC_HEADERS_FOLDER_PATH\"\nsed -i '' -e 's,#include \"\\(.*\\)\",#include ,' *.h\n"; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -7459,10 +7599,12 @@ A75FCE2023E25AB700529352 /* SDL_haptic.c in Sources */, A75FCE2123E25AB700529352 /* SDL_uikitvulkan.m in Sources */, F3984CD725BCC92900374F43 /* SDL_hidapi_stadia.c in Sources */, + F382071A284F3609004DD584 /* controller_type.c in Sources */, 75E09161241EA924004729E1 /* SDL_virtualjoystick.c in Sources */, A75FCE2323E25AB700529352 /* SDL_cocoametalview.m in Sources */, A75FCE2423E25AB700529352 /* SDL_audiotypecvt.c in Sources */, A75FCE2523E25AB700529352 /* SDL_uikitevents.m in Sources */, + F3820724284F362F004DD584 /* SDL_guid.c in Sources */, A75FCE2623E25AB700529352 /* SDL_uikitmodes.m in Sources */, A75FCE2723E25AB700529352 /* SDL_blit_N.c in Sources */, A75FCE2823E25AB700529352 /* SDL_dropevents.c in Sources */, @@ -7506,6 +7648,7 @@ A75FCE5023E25AB700529352 /* SDL_syspower.m in Sources */, A75FCE5123E25AB700529352 /* e_log10.c in Sources */, A75FCE5223E25AB700529352 /* SDL_uikitopenglview.m in Sources */, + F3249B2E285A85FF00DB9B5C /* SDL_memcpy.c in Sources */, A75FCE5323E25AB700529352 /* SDL_mixer.c in Sources */, 5616CA64252BB35F005D5928 /* SDL_url.c in Sources */, A75FCE5423E25AB700529352 /* SDL_events.c in Sources */, @@ -7554,11 +7697,13 @@ A75FCE8423E25AB700529352 /* e_exp.c in Sources */, A75FCE8523E25AB700529352 /* SDL_quit.c in Sources */, A75FCE8623E25AB700529352 /* SDL_cocoawindow.m in Sources */, + A1BB8B6A27F6CF330057CFA8 /* SDL_list.c in Sources */, A75FCE8723E25AB700529352 /* SDL_sysmutex.c in Sources */, A75FCE8823E25AB700529352 /* SDL_syshaptic.c in Sources */, F3F07D61269640160074468B /* SDL_hidapi_luna.c in Sources */, A75FCE8923E25AB700529352 /* SDL_rwopsbundlesupport.m in Sources */, A75FCE8A23E25AB700529352 /* SDL_video.c in Sources */, + F3249B25285A85FF00DB9B5C /* SDL_memset.c in Sources */, A75FCE8B23E25AB700529352 /* SDL_offscreenopengl.c in Sources */, A75FCE8C23E25AB700529352 /* SDL_uikitmetalview.m in Sources */, A75FCE8D23E25AB700529352 /* SDL_steamcontroller.c in Sources */, @@ -7646,10 +7791,12 @@ A75FCFD923E25AC700529352 /* SDL_haptic.c in Sources */, A75FCFDA23E25AC700529352 /* SDL_uikitvulkan.m in Sources */, F3984CD825BCC92900374F43 /* SDL_hidapi_stadia.c in Sources */, + F382071B284F3609004DD584 /* controller_type.c in Sources */, 75E09162241EA924004729E1 /* SDL_virtualjoystick.c in Sources */, A75FCFDC23E25AC700529352 /* SDL_cocoametalview.m in Sources */, A75FCFDD23E25AC700529352 /* SDL_audiotypecvt.c in Sources */, A75FCFDE23E25AC700529352 /* SDL_uikitevents.m in Sources */, + F3820725284F362F004DD584 /* SDL_guid.c in Sources */, A75FCFDF23E25AC700529352 /* SDL_uikitmodes.m in Sources */, A75FCFE023E25AC700529352 /* SDL_blit_N.c in Sources */, A75FCFE123E25AC700529352 /* SDL_dropevents.c in Sources */, @@ -7693,6 +7840,7 @@ A75FD00923E25AC700529352 /* SDL_syspower.m in Sources */, A75FD00A23E25AC700529352 /* e_log10.c in Sources */, A75FD00B23E25AC700529352 /* SDL_uikitopenglview.m in Sources */, + F3249B2F285A85FF00DB9B5C /* SDL_memcpy.c in Sources */, A75FD00C23E25AC700529352 /* SDL_mixer.c in Sources */, 5616CA67252BB361005D5928 /* SDL_url.c in Sources */, A75FD00D23E25AC700529352 /* SDL_events.c in Sources */, @@ -7741,11 +7889,13 @@ A75FD03D23E25AC700529352 /* e_exp.c in Sources */, A75FD03E23E25AC700529352 /* SDL_quit.c in Sources */, A75FD03F23E25AC700529352 /* SDL_cocoawindow.m in Sources */, + A1BB8B6B27F6CF330057CFA8 /* SDL_list.c in Sources */, A75FD04023E25AC700529352 /* SDL_sysmutex.c in Sources */, A75FD04123E25AC700529352 /* SDL_syshaptic.c in Sources */, F3F07D62269640160074468B /* SDL_hidapi_luna.c in Sources */, A75FD04223E25AC700529352 /* SDL_rwopsbundlesupport.m in Sources */, A75FD04323E25AC700529352 /* SDL_video.c in Sources */, + F3249B26285A85FF00DB9B5C /* SDL_memset.c in Sources */, A75FD04423E25AC700529352 /* SDL_offscreenopengl.c in Sources */, A75FD04523E25AC700529352 /* SDL_uikitmetalview.m in Sources */, A75FD04623E25AC700529352 /* SDL_steamcontroller.c in Sources */, @@ -7844,6 +7994,7 @@ A769B1B823E259AE00872273 /* e_log.c in Sources */, A769B1B923E259AE00872273 /* SDL_cocoamessagebox.m in Sources */, A769B1BA23E259AE00872273 /* SDL_blendfillrect.c in Sources */, + F3820722284F362F004DD584 /* SDL_guid.c in Sources */, A769B1BB23E259AE00872273 /* SDL_uikitvideo.m in Sources */, A769B1BC23E259AE00872273 /* SDL_cocoashape.m in Sources */, A769B1BD23E259AE00872273 /* SDL_cocoamouse.m in Sources */, @@ -7870,6 +8021,7 @@ A769B1D523E259AE00872273 /* SDL_render.c in Sources */, A769B1D623E259AE00872273 /* SDL_stretch.c in Sources */, A769B1D723E259AE00872273 /* s_floor.c in Sources */, + F3249B23285A85FF00DB9B5C /* SDL_memset.c in Sources */, A769B1D823E259AE00872273 /* SDL_blit_copy.c in Sources */, A769B1D923E259AE00872273 /* e_fmod.c in Sources */, A769B1DA23E259AE00872273 /* SDL_syspower.m in Sources */, @@ -7915,6 +8067,7 @@ F3984CD525BCC92900374F43 /* SDL_hidapi_stadia.c in Sources */, A769B20523E259AE00872273 /* SDL_strtokr.c in Sources */, 5605720B2473687A00B46B66 /* SDL_syslocale.m in Sources */, + F3820718284F3609004DD584 /* controller_type.c in Sources */, A769B20623E259AE00872273 /* SDL_clipboardevents.c in Sources */, A769B20823E259AE00872273 /* k_cos.c in Sources */, A769B20923E259AE00872273 /* SDL_hidapijoystick.c in Sources */, @@ -7927,9 +8080,11 @@ A769B20F23E259AE00872273 /* SDL_syshaptic.c in Sources */, A769B21023E259AE00872273 /* e_exp.c in Sources */, F395C1A12569C68F00942BFF /* SDL_iokitjoystick.c in Sources */, + A1BB8B6827F6CF330057CFA8 /* SDL_list.c in Sources */, A769B21123E259AE00872273 /* SDL_quit.c in Sources */, A769B21223E259AE00872273 /* SDL_cocoawindow.m in Sources */, A769B21323E259AE00872273 /* SDL_sysmutex.c in Sources */, + F3249B2C285A85FF00DB9B5C /* SDL_memcpy.c in Sources */, A769B21423E259AE00872273 /* SDL_syshaptic.c in Sources */, A769B21523E259AE00872273 /* SDL_rwopsbundlesupport.m in Sources */, A769B21623E259AE00872273 /* SDL_video.c in Sources */, @@ -8021,10 +8176,12 @@ A7D8AF2523E2514100DCD162 /* SDL_cocoametalview.m in Sources */, A7D8B86123E2514400DCD162 /* SDL_audiotypecvt.c in Sources */, F3984CD125BCC92900374F43 /* SDL_hidapi_stadia.c in Sources */, + F3820714284F3609004DD584 /* controller_type.c in Sources */, A7D8AC5823E2514100DCD162 /* SDL_uikitevents.m in Sources */, A7D8ACB823E2514100DCD162 /* SDL_uikitmodes.m in Sources */, A7D8AD3323E2514100DCD162 /* SDL_blit_N.c in Sources */, A7D8BB7C23E2514500DCD162 /* SDL_dropevents.c in Sources */, + F382071E284F362F004DD584 /* SDL_guid.c in Sources */, A7D8BACE23E2514500DCD162 /* e_atan2.c in Sources */, A7D8BA8C23E2514400DCD162 /* s_sin.c in Sources */, A7D8B5E823E2514300DCD162 /* SDL_power.c in Sources */, @@ -8068,6 +8225,7 @@ A7D8AC7023E2514100DCD162 /* SDL_uikitopenglview.m in Sources */, A7D8B76523E2514300DCD162 /* SDL_mixer.c in Sources */, A7D8BB5823E2514500DCD162 /* SDL_events.c in Sources */, + F3249B28285A85FF00DB9B5C /* SDL_memcpy.c in Sources */, A7D8ADE723E2514100DCD162 /* SDL_blit_0.c in Sources */, A7D8BB0A23E2514500DCD162 /* k_tan.c in Sources */, A75FDBCF23EA380300529352 /* SDL_hidapi_rumble.c in Sources */, @@ -8116,11 +8274,13 @@ A7D8B43B23E2514300DCD162 /* SDL_sysmutex.c in Sources */, A7D8AAB123E2514100DCD162 /* SDL_syshaptic.c in Sources */, A7D8B5CA23E2514300DCD162 /* SDL_rwopsbundlesupport.m in Sources */, + A1BB8B6427F6CF330057CFA8 /* SDL_list.c in Sources */, A7D8AC1023E2514100DCD162 /* SDL_video.c in Sources */, 560572062473687700B46B66 /* SDL_syslocale.m in Sources */, F3F07D5B269640160074468B /* SDL_hidapi_luna.c in Sources */, A7D8AB5623E2514100DCD162 /* SDL_offscreenopengl.c in Sources */, A7D8ACC423E2514100DCD162 /* SDL_uikitmetalview.m in Sources */, + F3249B1F285A85FF00DB9B5C /* SDL_memset.c in Sources */, A7D8BA5C23E2514400DCD162 /* SDL_shaders_gles2.c in Sources */, A7D8B14123E2514200DCD162 /* SDL_blit_1.c in Sources */, 5605720F2473688000B46B66 /* SDL_locale.c in Sources */, @@ -8208,10 +8368,12 @@ A7D8AF2623E2514100DCD162 /* SDL_cocoametalview.m in Sources */, A7D8B86223E2514400DCD162 /* SDL_audiotypecvt.c in Sources */, F3984CD225BCC92900374F43 /* SDL_hidapi_stadia.c in Sources */, + F3820715284F3609004DD584 /* controller_type.c in Sources */, A7D8AC5923E2514100DCD162 /* SDL_uikitevents.m in Sources */, A7D8ACB923E2514100DCD162 /* SDL_uikitmodes.m in Sources */, A7D8AD3423E2514100DCD162 /* SDL_blit_N.c in Sources */, A7D8BB7D23E2514500DCD162 /* SDL_dropevents.c in Sources */, + F382071F284F362F004DD584 /* SDL_guid.c in Sources */, A7D8BACF23E2514500DCD162 /* e_atan2.c in Sources */, A7D8BA8D23E2514400DCD162 /* s_sin.c in Sources */, A7D8B5E923E2514300DCD162 /* SDL_power.c in Sources */, @@ -8255,6 +8417,7 @@ A7D8AC7123E2514100DCD162 /* SDL_uikitopenglview.m in Sources */, A7D8B76623E2514300DCD162 /* SDL_mixer.c in Sources */, A7D8BB5923E2514500DCD162 /* SDL_events.c in Sources */, + F3249B29285A85FF00DB9B5C /* SDL_memcpy.c in Sources */, A7D8ADE823E2514100DCD162 /* SDL_blit_0.c in Sources */, A7D8BB0B23E2514500DCD162 /* k_tan.c in Sources */, A75FDBD023EA380300529352 /* SDL_hidapi_rumble.c in Sources */, @@ -8303,11 +8466,13 @@ A7D8B43C23E2514300DCD162 /* SDL_sysmutex.c in Sources */, A7D8AAB223E2514100DCD162 /* SDL_syshaptic.c in Sources */, A7D8B5CB23E2514300DCD162 /* SDL_rwopsbundlesupport.m in Sources */, + A1BB8B6527F6CF330057CFA8 /* SDL_list.c in Sources */, A7D8AC1123E2514100DCD162 /* SDL_video.c in Sources */, 560572072473687800B46B66 /* SDL_syslocale.m in Sources */, F3F07D5C269640160074468B /* SDL_hidapi_luna.c in Sources */, A7D8AB5723E2514100DCD162 /* SDL_offscreenopengl.c in Sources */, A7D8ACC523E2514100DCD162 /* SDL_uikitmetalview.m in Sources */, + F3249B20285A85FF00DB9B5C /* SDL_memset.c in Sources */, A7D8BA5D23E2514400DCD162 /* SDL_shaders_gles2.c in Sources */, A7D8B14223E2514200DCD162 /* SDL_blit_1.c in Sources */, 560572102473688000B46B66 /* SDL_locale.c in Sources */, @@ -8406,6 +8571,7 @@ A7D8BAF523E2514500DCD162 /* e_log.c in Sources */, A7D8AED423E2514100DCD162 /* SDL_cocoamessagebox.m in Sources */, A7D8BA2F23E2514400DCD162 /* SDL_blendfillrect.c in Sources */, + F3820721284F362F004DD584 /* SDL_guid.c in Sources */, A7D8ACDF23E2514100DCD162 /* SDL_uikitvideo.m in Sources */, A7D8AEE623E2514100DCD162 /* SDL_cocoashape.m in Sources */, A7D8AEBC23E2514100DCD162 /* SDL_cocoamouse.m in Sources */, @@ -8432,6 +8598,7 @@ A7D8B97E23E2514400DCD162 /* SDL_render.c in Sources */, A7D8ABD723E2514100DCD162 /* SDL_stretch.c in Sources */, A7D8BB0123E2514500DCD162 /* s_floor.c in Sources */, + F3249B22285A85FF00DB9B5C /* SDL_memset.c in Sources */, A7D8AC3D23E2514100DCD162 /* SDL_blit_copy.c in Sources */, A7D8BAE323E2514500DCD162 /* e_fmod.c in Sources */, A7D8B5D323E2514300DCD162 /* SDL_syspower.m in Sources */, @@ -8477,6 +8644,7 @@ F3984CD425BCC92900374F43 /* SDL_hidapi_stadia.c in Sources */, A7D8B96623E2514400DCD162 /* SDL_strtokr.c in Sources */, 560572092473687900B46B66 /* SDL_syslocale.m in Sources */, + F3820717284F3609004DD584 /* controller_type.c in Sources */, A7D8BB7923E2514500DCD162 /* SDL_clipboardevents.c in Sources */, A7D8BAB923E2514400DCD162 /* k_cos.c in Sources */, A7D8B54923E2514300DCD162 /* SDL_hidapijoystick.c in Sources */, @@ -8489,9 +8657,11 @@ A7D8AADE23E2514100DCD162 /* SDL_syshaptic.c in Sources */, A7D8BAE923E2514500DCD162 /* e_exp.c in Sources */, F395C1A02569C68F00942BFF /* SDL_iokitjoystick.c in Sources */, + A1BB8B6727F6CF330057CFA8 /* SDL_list.c in Sources */, A7D8BB8523E2514500DCD162 /* SDL_quit.c in Sources */, A7D8AEAA23E2514100DCD162 /* SDL_cocoawindow.m in Sources */, A7D8B43E23E2514300DCD162 /* SDL_sysmutex.c in Sources */, + F3249B2B285A85FF00DB9B5C /* SDL_memcpy.c in Sources */, A7D8AAB423E2514100DCD162 /* SDL_syshaptic.c in Sources */, A7D8B5CD23E2514300DCD162 /* SDL_rwopsbundlesupport.m in Sources */, A7D8AC1323E2514100DCD162 /* SDL_video.c in Sources */, @@ -8544,6 +8714,7 @@ A7D8BBE323E2574800DCD162 /* SDL_uikitvideo.m in Sources */, 5616CA4E252BB2A6005D5928 /* SDL_sysurl.m in Sources */, A7D8A97523E2514000DCD162 /* SDL_coremotionsensor.m in Sources */, + F382071D284F362F004DD584 /* SDL_guid.c in Sources */, A7D8BB8D23E2514500DCD162 /* SDL_touch.c in Sources */, A1626A3E2617006A003F1973 /* SDL_triangle.c in Sources */, A7D8B3F223E2514300DCD162 /* SDL_thread.c in Sources */, @@ -8585,6 +8756,7 @@ F3984CD025BCC92900374F43 /* SDL_hidapi_stadia.c in Sources */, A7D8AAB623E2514100DCD162 /* SDL_haptic.c in Sources */, A7D8AF2423E2514100DCD162 /* SDL_cocoametalview.m in Sources */, + F3249B1E285A85FF00DB9B5C /* SDL_memset.c in Sources */, A7D8B86023E2514400DCD162 /* SDL_audiotypecvt.c in Sources */, A7D8BBC523E2561500DCD162 /* SDL_steamcontroller.c in Sources */, A7D8AD3223E2514100DCD162 /* SDL_blit_N.c in Sources */, @@ -8655,6 +8827,7 @@ A7D8B4DC23E2514300DCD162 /* SDL_joystick.c in Sources */, A7D8BA4923E2514400DCD162 /* SDL_render_gles2.c in Sources */, A7D8AC2D23E2514100DCD162 /* SDL_surface.c in Sources */, + F3249B27285A85FF00DB9B5C /* SDL_memcpy.c in Sources */, A7D8B54B23E2514300DCD162 /* SDL_hidapi_xboxone.c in Sources */, A7D8AD2323E2514100DCD162 /* SDL_blit_auto.c in Sources */, F3A4909E2554D38600E92A8B /* SDL_hidapi_ps5.c in Sources */, @@ -8665,11 +8838,13 @@ A7D8B55123E2514300DCD162 /* SDL_hidapi_switch.c in Sources */, A7D8B96223E2514400DCD162 /* SDL_strtokr.c in Sources */, A7D8BB7523E2514500DCD162 /* SDL_clipboardevents.c in Sources */, + A1BB8B6327F6CF330057CFA8 /* SDL_list.c in Sources */, A7D8BAB523E2514400DCD162 /* k_cos.c in Sources */, A7D8B54523E2514300DCD162 /* SDL_hidapijoystick.c in Sources */, A7D8B97423E2514400DCD162 /* SDL_malloc.c in Sources */, A7D8B8C623E2514400DCD162 /* SDL_audio.c in Sources */, A7D8B61D23E2514300DCD162 /* SDL_sysfilesystem.c in Sources */, + F3820713284F3609004DD584 /* controller_type.c in Sources */, A7D8AB8B23E2514100DCD162 /* SDL_offscreenvideo.c in Sources */, A7D8B42E23E2514300DCD162 /* SDL_syscond.c in Sources */, A7D8AADA23E2514100DCD162 /* SDL_syshaptic.c in Sources */, @@ -8729,6 +8904,7 @@ A7D8A97823E2514000DCD162 /* SDL_coremotionsensor.m in Sources */, A7D8BB9023E2514500DCD162 /* SDL_touch.c in Sources */, A7D8B3F523E2514300DCD162 /* SDL_thread.c in Sources */, + F3820720284F362F004DD584 /* SDL_guid.c in Sources */, A7D8B56023E2514300DCD162 /* SDL_hidapi_xbox360w.c in Sources */, A1626A412617006A003F1973 /* SDL_triangle.c in Sources */, 5616CA59252BB35C005D5928 /* SDL_sysurl.m in Sources */, @@ -8770,6 +8946,7 @@ A7D8AF2723E2514100DCD162 /* SDL_cocoametalview.m in Sources */, A7D8B86323E2514400DCD162 /* SDL_audiotypecvt.c in Sources */, A7D8AD3523E2514100DCD162 /* SDL_blit_N.c in Sources */, + F3249B21285A85FF00DB9B5C /* SDL_memset.c in Sources */, A7D8BB7E23E2514500DCD162 /* SDL_dropevents.c in Sources */, A7D8BBFA23E2574800DCD162 /* SDL_uikitopengles.m in Sources */, A7D8BAD023E2514500DCD162 /* e_atan2.c in Sources */, @@ -8840,6 +9017,7 @@ A7D8BA4C23E2514400DCD162 /* SDL_render_gles2.c in Sources */, A7D8AC3023E2514100DCD162 /* SDL_surface.c in Sources */, A7D8B54E23E2514300DCD162 /* SDL_hidapi_xboxone.c in Sources */, + F3249B2A285A85FF00DB9B5C /* SDL_memcpy.c in Sources */, A7D8AD2623E2514100DCD162 /* SDL_blit_auto.c in Sources */, A7D8BB6C23E2514500DCD162 /* SDL_keyboard.c in Sources */, A7D8ACEA23E2514100DCD162 /* SDL_rect.c in Sources */, @@ -8850,11 +9028,13 @@ A7D8B96523E2514400DCD162 /* SDL_strtokr.c in Sources */, A7D8BB7823E2514500DCD162 /* SDL_clipboardevents.c in Sources */, A7D8BAB823E2514400DCD162 /* k_cos.c in Sources */, + A1BB8B6627F6CF330057CFA8 /* SDL_list.c in Sources */, A7D8B54823E2514300DCD162 /* SDL_hidapijoystick.c in Sources */, A7D8B97723E2514400DCD162 /* SDL_malloc.c in Sources */, A7D8BBF023E2574800DCD162 /* SDL_uikitclipboard.m in Sources */, A7D8B8C923E2514400DCD162 /* SDL_audio.c in Sources */, A7D8B62023E2514300DCD162 /* SDL_sysfilesystem.c in Sources */, + F3820716284F3609004DD584 /* controller_type.c in Sources */, A7D8AB8E23E2514100DCD162 /* SDL_offscreenvideo.c in Sources */, A7D8B43123E2514300DCD162 /* SDL_syscond.c in Sources */, A7D8AADD23E2514100DCD162 /* SDL_syshaptic.c in Sources */, @@ -8914,6 +9094,7 @@ A7D8BB9223E2514500DCD162 /* SDL_touch.c in Sources */, A7D8AC5623E2514100DCD162 /* SDL_uikitmessagebox.m in Sources */, A7D8B3F723E2514300DCD162 /* SDL_thread.c in Sources */, + F3820723284F362F004DD584 /* SDL_guid.c in Sources */, A7D8B56223E2514300DCD162 /* SDL_hidapi_xbox360w.c in Sources */, A1626A442617006A003F1973 /* SDL_triangle.c in Sources */, 5616CA62252BB35E005D5928 /* SDL_sysurl.m in Sources */, @@ -8955,6 +9136,7 @@ A7D8AF2923E2514100DCD162 /* SDL_cocoametalview.m in Sources */, A7D8B86523E2514400DCD162 /* SDL_audiotypecvt.c in Sources */, A7D8AC5C23E2514100DCD162 /* SDL_uikitevents.m in Sources */, + F3249B24285A85FF00DB9B5C /* SDL_memset.c in Sources */, A7D8ACBC23E2514100DCD162 /* SDL_uikitmodes.m in Sources */, A7D8AD3723E2514100DCD162 /* SDL_blit_N.c in Sources */, A7D8BB8023E2514500DCD162 /* SDL_dropevents.c in Sources */, @@ -9025,6 +9207,7 @@ A7D8B4E123E2514300DCD162 /* SDL_joystick.c in Sources */, A7D8BA4E23E2514400DCD162 /* SDL_render_gles2.c in Sources */, A7D8AC3223E2514100DCD162 /* SDL_surface.c in Sources */, + F3249B2D285A85FF00DB9B5C /* SDL_memcpy.c in Sources */, A7D8B55023E2514300DCD162 /* SDL_hidapi_xboxone.c in Sources */, A7D8AD2823E2514100DCD162 /* SDL_blit_auto.c in Sources */, A7D8BB6E23E2514500DCD162 /* SDL_keyboard.c in Sources */, @@ -9035,11 +9218,13 @@ A7D8B96723E2514400DCD162 /* SDL_strtokr.c in Sources */, A7D8BB7A23E2514500DCD162 /* SDL_clipboardevents.c in Sources */, A7D8BABA23E2514400DCD162 /* k_cos.c in Sources */, + A1BB8B6927F6CF330057CFA8 /* SDL_list.c in Sources */, A7D8B54A23E2514300DCD162 /* SDL_hidapijoystick.c in Sources */, A7D8B97923E2514400DCD162 /* SDL_malloc.c in Sources */, A7D8B8CB23E2514400DCD162 /* SDL_audio.c in Sources */, A7D8B62223E2514300DCD162 /* SDL_sysfilesystem.c in Sources */, A7D8AB9023E2514100DCD162 /* SDL_offscreenvideo.c in Sources */, + F3820719284F3609004DD584 /* controller_type.c in Sources */, A7D8B43323E2514300DCD162 /* SDL_syscond.c in Sources */, A7D8AADF23E2514100DCD162 /* SDL_syshaptic.c in Sources */, A7D8BAEA23E2514500DCD162 /* e_exp.c in Sources */, @@ -9091,6 +9276,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; @@ -9111,7 +9297,7 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEPLOYMENT_POSTPROCESSING = YES; DYLIB_COMPATIBILITY_VERSION = 1.0.0; - DYLIB_CURRENT_VERSION = 19.2.0; + DYLIB_CURRENT_VERSION = 2302.0.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_ALTIVEC_EXTENSIONS = YES; @@ -9140,7 +9326,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 10.6; + MACOSX_DEPLOYMENT_TARGET = 10.7; PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL2; PRODUCT_NAME = SDL2; STRIP_STYLE = "non-global"; @@ -9176,6 +9362,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; @@ -9195,7 +9382,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; DEBUG_INFORMATION_FORMAT = dwarf; DYLIB_COMPATIBILITY_VERSION = 1.0.0; - DYLIB_CURRENT_VERSION = 19.2.0; + DYLIB_CURRENT_VERSION = 2302.0.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -9224,7 +9411,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 10.6; + MACOSX_DEPLOYMENT_TARGET = 10.7; ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL2; PRODUCT_NAME = SDL2; @@ -9387,6 +9574,7 @@ buildSettings = { CLANG_ENABLE_OBJC_ARC = YES; CLANG_LINK_OBJC_RUNTIME = NO; + GCC_PREPROCESSOR_DEFINITIONS = GLES_SILENCE_DEPRECATION; GCC_SYMBOLS_PRIVATE_EXTERN = YES; SKIP_INSTALL = YES; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; @@ -9398,6 +9586,7 @@ buildSettings = { CLANG_ENABLE_OBJC_ARC = YES; CLANG_LINK_OBJC_RUNTIME = NO; + GCC_PREPROCESSOR_DEFINITIONS = GLES_SILENCE_DEPRECATION; GCC_SYMBOLS_PRIVATE_EXTERN = YES; SKIP_INSTALL = YES; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; diff --git a/libs/SDL2/Xcode/SDL/pkg-support/resources/ReadMe.txt b/libs/SDL2/Xcode/SDL/pkg-support/resources/ReadMe.txt index 40ac3a14..9f495913 100755 --- a/libs/SDL2/Xcode/SDL/pkg-support/resources/ReadMe.txt +++ b/libs/SDL2/Xcode/SDL/pkg-support/resources/ReadMe.txt @@ -18,7 +18,19 @@ To Install: Copy the SDL2.framework to /Library/Frameworks You may alternatively install it in /Library/Frameworks -if your access privileges are not high enough. +if your access privileges are not high enough. + + +Use in CMake projects: +SDL2.framework can be used in CMake projects using the following pattern: +``` +find_package(SDL2 REQUIRED COMPONENTS SDL2) +add_executable(my_game ${MY_SOURCES}) +target_link_libraries(my_game PRIVATE SDL2::SDL2) +``` +If SDL2.framework is installed in a non-standard location, +please refer to the following link for ways to configure CMake: +https://cmake.org/cmake/help/latest/command/find_package.html#config-mode-search-procedure Additional References: diff --git a/libs/SDL2/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj b/libs/SDL2/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj index 8c524cc5..e7e1d23b 100755 --- a/libs/SDL2/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj +++ b/libs/SDL2/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj @@ -4041,6 +4041,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_ARC = YES; FRAMEWORK_SEARCH_PATHS = ( "$(SRCROOT)/../SDL/build/$(CONFIGURATION)", "$(HOME)/Library/Frameworks", @@ -4048,7 +4049,7 @@ ); GCC_OPTIMIZATION_LEVEL = 0; HEADER_SEARCH_PATHS = ../../include; - MACOSX_DEPLOYMENT_TARGET = 10.6; + MACOSX_DEPLOYMENT_TARGET = 10.7; }; name = Debug; }; @@ -4168,6 +4169,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_ARC = YES; FRAMEWORK_SEARCH_PATHS = ( "$(SRCROOT)/../SDL/build/$(CONFIGURATION)", "$(HOME)/Library/Frameworks", @@ -4175,7 +4177,7 @@ ); GCC_GENERATE_DEBUGGING_SYMBOLS = NO; HEADER_SEARCH_PATHS = ../../include; - MACOSX_DEPLOYMENT_TARGET = 10.6; + MACOSX_DEPLOYMENT_TARGET = 10.7; }; name = Release; }; diff --git a/libs/SDL2/Xcode/SDLTest/TestDropFile-Info.plist b/libs/SDL2/Xcode/SDLTest/TestDropFile-Info.plist index 03e46b33..c9f6cb83 100644 --- a/libs/SDL2/Xcode/SDLTest/TestDropFile-Info.plist +++ b/libs/SDL2/Xcode/SDLTest/TestDropFile-Info.plist @@ -30,6 +30,6 @@ CFBundleVersion 1.0 LSMinimumSystemVersion - 10.6 + 10.7 diff --git a/libs/SDL2/acinclude/libtool.m4 b/libs/SDL2/acinclude/libtool.m4 index df6496ee..3236ddab 100644 --- a/libs/SDL2/acinclude/libtool.m4 +++ b/libs/SDL2/acinclude/libtool.m4 @@ -1068,7 +1068,7 @@ _LT_EOF darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; darwin*) - case ${MACOSX_DEPLOYMENT_TARGET},$host in + case $MACOSX_DEPLOYMENT_TARGET,$host in 10.[[012]],*|,*powerpc*-darwin[[5-8]]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; *) diff --git a/libs/SDL2/android-project/app/build.gradle b/libs/SDL2/android-project/app/build.gradle index 8e59d9eb..baa0edc8 100644 --- a/libs/SDL2/android-project/app/build.gradle +++ b/libs/SDL2/android-project/app/build.gradle @@ -35,6 +35,10 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } + applicationVariants.all { variant -> + tasks["merge${variant.name.capitalize()}Assets"] + .dependsOn("externalNativeBuild${variant.name.capitalize()}") + } if (!project.hasProperty('EXCLUDE_NATIVE_LIBS')) { sourceSets.main { jniLibs.srcDir 'libs' diff --git a/libs/SDL2/android-project/app/jni/src/Android.mk b/libs/SDL2/android-project/app/jni/src/Android.mk index 1adcb6e9..04e006ae 100644 --- a/libs/SDL2/android-project/app/jni/src/Android.mk +++ b/libs/SDL2/android-project/app/jni/src/Android.mk @@ -13,6 +13,6 @@ LOCAL_SRC_FILES := YourSourceHere.c LOCAL_SHARED_LIBRARIES := SDL2 -LOCAL_LDLIBS := -lGLESv1_CM -lGLESv2 -llog +LOCAL_LDLIBS := -lGLESv1_CM -lGLESv2 -lOpenSLES -llog -landroid include $(BUILD_SHARED_LIBRARY) diff --git a/libs/SDL2/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/libs/SDL2/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index 8641ccf8..3f0752f1 100644 --- a/libs/SDL2/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/libs/SDL2/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -63,6 +63,112 @@ import java.util.Locale; */ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityChangeListener { private static final String TAG = "SDL"; +/* + // Display InputType.SOURCE/CLASS of events and devices + // + // SDLActivity.debugSource(device.getSources(), "device[" + device.getName() + "]"); + // SDLActivity.debugSource(event.getSource(), "event"); + public static void debugSource(int sources, String prefix) { + int s = sources; + int s_copy = sources; + String cls = ""; + String src = ""; + int tst = 0; + int FLAG_TAINTED = 0x80000000; + + if ((s & InputDevice.SOURCE_CLASS_BUTTON) != 0) cls += " BUTTON"; + if ((s & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) cls += " JOYSTICK"; + if ((s & InputDevice.SOURCE_CLASS_POINTER) != 0) cls += " POINTER"; + if ((s & InputDevice.SOURCE_CLASS_POSITION) != 0) cls += " POSITION"; + if ((s & InputDevice.SOURCE_CLASS_TRACKBALL) != 0) cls += " TRACKBALL"; + + + int s2 = s_copy & ~InputDevice.SOURCE_ANY; // keep class bits + s2 &= ~( InputDevice.SOURCE_CLASS_BUTTON + | InputDevice.SOURCE_CLASS_JOYSTICK + | InputDevice.SOURCE_CLASS_POINTER + | InputDevice.SOURCE_CLASS_POSITION + | InputDevice.SOURCE_CLASS_TRACKBALL); + + if (s2 != 0) cls += "Some_Unkown"; + + s2 = s_copy & InputDevice.SOURCE_ANY; // keep source only, no class; + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + tst = InputDevice.SOURCE_BLUETOOTH_STYLUS; + if ((s & tst) == tst) src += " BLUETOOTH_STYLUS"; + s2 &= ~tst; + } + + tst = InputDevice.SOURCE_DPAD; + if ((s & tst) == tst) src += " DPAD"; + s2 &= ~tst; + + tst = InputDevice.SOURCE_GAMEPAD; + if ((s & tst) == tst) src += " GAMEPAD"; + s2 &= ~tst; + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + tst = InputDevice.SOURCE_HDMI; + if ((s & tst) == tst) src += " HDMI"; + s2 &= ~tst; + } + + tst = InputDevice.SOURCE_JOYSTICK; + if ((s & tst) == tst) src += " JOYSTICK"; + s2 &= ~tst; + + tst = InputDevice.SOURCE_KEYBOARD; + if ((s & tst) == tst) src += " KEYBOARD"; + s2 &= ~tst; + + tst = InputDevice.SOURCE_MOUSE; + if ((s & tst) == tst) src += " MOUSE"; + s2 &= ~tst; + + if (Build.VERSION.SDK_INT >= 26) { + tst = InputDevice.SOURCE_MOUSE_RELATIVE; + if ((s & tst) == tst) src += " MOUSE_RELATIVE"; + s2 &= ~tst; + + tst = InputDevice.SOURCE_ROTARY_ENCODER; + if ((s & tst) == tst) src += " ROTARY_ENCODER"; + s2 &= ~tst; + } + tst = InputDevice.SOURCE_STYLUS; + if ((s & tst) == tst) src += " STYLUS"; + s2 &= ~tst; + + tst = InputDevice.SOURCE_TOUCHPAD; + if ((s & tst) == tst) src += " TOUCHPAD"; + s2 &= ~tst; + + tst = InputDevice.SOURCE_TOUCHSCREEN; + if ((s & tst) == tst) src += " TOUCHSCREEN"; + s2 &= ~tst; + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { + tst = InputDevice.SOURCE_TOUCH_NAVIGATION; + if ((s & tst) == tst) src += " TOUCH_NAVIGATION"; + s2 &= ~tst; + } + + tst = InputDevice.SOURCE_TRACKBALL; + if ((s & tst) == tst) src += " TRACKBALL"; + s2 &= ~tst; + + tst = InputDevice.SOURCE_ANY; + if ((s & tst) == tst) src += " ANY"; + s2 &= ~tst; + + if (s == FLAG_TAINTED) src += " FLAG_TAINTED"; + s2 &= ~FLAG_TAINTED; + + if (s2 != 0) src += " Some_Unkown"; + + Log.v(TAG, prefix + "int=" + s_copy + " CLASS={" + cls + " } source(s):" + src); + } +*/ public static boolean mIsResumedCalled, mHasFocus; public static final boolean mHasMultiWindow = (Build.VERSION.SDK_INT >= 24); @@ -1204,8 +1310,21 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh for (int id : ids) { InputDevice device = InputDevice.getDevice(id); - if (device != null && (device.getSources() & InputDevice.SOURCE_TOUCHSCREEN) != 0) { - nativeAddTouch(device.getId(), device.getName()); + /* Allow SOURCE_TOUCHSCREEN and also Virtual InputDevices because they can send TOUCHSCREEN events */ + if (device != null && ((device.getSources() & InputDevice.SOURCE_TOUCHSCREEN) == InputDevice.SOURCE_TOUCHSCREEN + || device.isVirtual())) { + + int touchDevId = device.getId(); + /* + * Prevent id to be -1, since it's used in SDL internal for synthetic events + * Appears when using Android emulator, eg: + * adb shell input mouse tap 100 100 + * adb shell input touchscreen tap 100 100 + */ + if (touchDevId < 0) { + touchDevId -= 1; + } + nativeAddTouch(touchDevId, device.getName()); } } } @@ -1895,7 +2014,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, } } - if ((source & InputDevice.SOURCE_KEYBOARD) != 0) { + if ((source & InputDevice.SOURCE_KEYBOARD) == InputDevice.SOURCE_KEYBOARD) { if (event.getAction() == KeyEvent.ACTION_DOWN) { if (SDLActivity.isTextInputEvent(event)) { SDLInputConnection.nativeCommitText(String.valueOf((char) event.getUnicodeChar()), 1); @@ -1908,7 +2027,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, } } - if ((source & InputDevice.SOURCE_MOUSE) != 0) { + if ((source & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE) { // on some devices key events are sent for mouse BUTTON_BACK/FORWARD presses // they are ignored here because sending them as mouse input to SDL is messy if ((keyCode == KeyEvent.KEYCODE_BACK) || (keyCode == KeyEvent.KEYCODE_FORWARD)) { @@ -2195,7 +2314,7 @@ class DummyEdit extends View implements View.OnKeyListener { public InputConnection onCreateInputConnection(EditorInfo outAttrs) { ic = new SDLInputConnection(this, true); - outAttrs.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD; + outAttrs.inputType = InputType.TYPE_CLASS_TEXT; outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI | EditorInfo.IME_FLAG_NO_FULLSCREEN /* API 11 */; @@ -2237,6 +2356,29 @@ class SDLInputConnection extends BaseInputConnection { @Override public boolean commitText(CharSequence text, int newCursorPosition) { + /* Generate backspaces for the text we're going to replace */ + final Editable content = getEditable(); + if (content != null) { + int a = getComposingSpanStart(content); + int b = getComposingSpanEnd(content); + if (a == -1 || b == -1) { + a = Selection.getSelectionStart(content); + b = Selection.getSelectionEnd(content); + } + if (a < 0) a = 0; + if (b < 0) b = 0; + if (b < a) { + int tmp = a; + a = b; + b = tmp; + } + int backspaces = (b - a); + + for (int i = 0; i < backspaces; i++) { + nativeGenerateScancodeForUnichar('\b'); + } + } + for (int i = 0; i < text.length(); i++) { char c = text.charAt(i); if (c == '\n') { @@ -2271,14 +2413,11 @@ class SDLInputConnection extends BaseInputConnection { // Workaround to capture backspace key. Ref: http://stackoverflow.com/questions/14560344/android-backspace-in-webview-baseinputconnection // and https://bugzilla.libsdl.org/show_bug.cgi?id=2265 if (beforeLength > 0 && afterLength == 0) { - boolean ret = true; // backspace(s) while (beforeLength-- > 0) { - boolean ret_key = sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL)) - && sendKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_DEL)); - ret = ret && ret_key; + nativeGenerateScancodeForUnichar('\b'); } - return ret; + return true; } return super.deleteSurroundingText(beforeLength, afterLength); diff --git a/libs/SDL2/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java b/libs/SDL2/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java index 05e0f0ca..82373d9d 100644 --- a/libs/SDL2/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java +++ b/libs/SDL2/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java @@ -255,23 +255,21 @@ class SDLJoystickHandler_API16 extends SDLJoystickHandler { @Override public boolean handleMotionEvent(MotionEvent event) { - if ((event.getSource() & InputDevice.SOURCE_JOYSTICK) != 0) { - int actionPointerIndex = event.getActionIndex(); - int action = event.getActionMasked(); - if (action == MotionEvent.ACTION_MOVE) { - SDLJoystick joystick = getJoystick(event.getDeviceId()); - if (joystick != null) { - for (int i = 0; i < joystick.axes.size(); i++) { - InputDevice.MotionRange range = joystick.axes.get(i); - /* Normalize the value to -1...1 */ - float value = (event.getAxisValue(range.getAxis(), actionPointerIndex) - range.getMin()) / range.getRange() * 2.0f - 1.0f; - SDLControllerManager.onNativeJoy(joystick.device_id, i, value); - } - for (int i = 0; i < joystick.hats.size() / 2; i++) { - int hatX = Math.round(event.getAxisValue(joystick.hats.get(2 * i).getAxis(), actionPointerIndex)); - int hatY = Math.round(event.getAxisValue(joystick.hats.get(2 * i + 1).getAxis(), actionPointerIndex)); - SDLControllerManager.onNativeHat(joystick.device_id, i, hatX, hatY); - } + int actionPointerIndex = event.getActionIndex(); + int action = event.getActionMasked(); + if (action == MotionEvent.ACTION_MOVE) { + SDLJoystick joystick = getJoystick(event.getDeviceId()); + if (joystick != null) { + for (int i = 0; i < joystick.axes.size(); i++) { + InputDevice.MotionRange range = joystick.axes.get(i); + /* Normalize the value to -1...1 */ + float value = (event.getAxisValue(range.getAxis(), actionPointerIndex) - range.getMin()) / range.getRange() * 2.0f - 1.0f; + SDLControllerManager.onNativeJoy(joystick.device_id, i, value); + } + for (int i = 0; i < joystick.hats.size() / 2; i++) { + int hatX = Math.round(event.getAxisValue(joystick.hats.get(2 * i).getAxis(), actionPointerIndex)); + int hatY = Math.round(event.getAxisValue(joystick.hats.get(2 * i + 1).getAxis(), actionPointerIndex)); + SDLControllerManager.onNativeHat(joystick.device_id, i, hatX, hatY); } } } @@ -319,6 +317,7 @@ class SDLJoystickHandler_API19 extends SDLJoystickHandler_API16 { KeyEvent.KEYCODE_BUTTON_X, KeyEvent.KEYCODE_BUTTON_Y, KeyEvent.KEYCODE_BACK, + KeyEvent.KEYCODE_MENU, KeyEvent.KEYCODE_BUTTON_MODE, KeyEvent.KEYCODE_BUTTON_START, KeyEvent.KEYCODE_BUTTON_THUMBL, @@ -360,6 +359,7 @@ class SDLJoystickHandler_API19 extends SDLJoystickHandler_API16 { (1 << 2), // X -> X (1 << 3), // Y -> Y (1 << 4), // BACK -> BACK + (1 << 6), // MENU -> START (1 << 5), // MODE -> GUIDE (1 << 6), // START -> START (1 << 7), // THUMBL -> LEFTSTICK @@ -560,8 +560,6 @@ class SDLGenericMotionListener_API12 implements View.OnGenericMotionListener { switch ( event.getSource() ) { case InputDevice.SOURCE_JOYSTICK: - case InputDevice.SOURCE_GAMEPAD: - case InputDevice.SOURCE_DPAD: return SDLControllerManager.handleJoystickMotionEvent(event); case InputDevice.SOURCE_MOUSE: @@ -691,8 +689,6 @@ class SDLGenericMotionListener_API26 extends SDLGenericMotionListener_API24 { switch ( event.getSource() ) { case InputDevice.SOURCE_JOYSTICK: - case InputDevice.SOURCE_GAMEPAD: - case InputDevice.SOURCE_DPAD: return SDLControllerManager.handleJoystickMotionEvent(event); case InputDevice.SOURCE_MOUSE: diff --git a/libs/SDL2/autogen.sh b/libs/SDL2/autogen.sh index daf160de..dffcf415 100755 --- a/libs/SDL2/autogen.sh +++ b/libs/SDL2/autogen.sh @@ -1,5 +1,7 @@ #!/bin/sh +set -e + echo "Generating build information using autoconf" echo "This may take a while ..." @@ -10,11 +12,7 @@ cd "$srcdir" # 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 --git a/libs/SDL2/build-scripts/androidbuildlibs.sh b/libs/SDL2/build-scripts/androidbuildlibs.sh index 3e57b471..dc721729 100644 --- a/libs/SDL2/build-scripts/androidbuildlibs.sh +++ b/libs/SDL2/build-scripts/androidbuildlibs.sh @@ -33,22 +33,21 @@ lib= 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 @@ done # 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 --git a/libs/SDL2/build-scripts/clang++-fat.sh b/libs/SDL2/build-scripts/clang++-fat.sh index d337109f..41fdf1c3 100644 --- a/libs/SDL2/build-scripts/clang++-fat.sh +++ b/libs/SDL2/build-scripts/clang++-fat.sh @@ -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 --git a/libs/SDL2/build-scripts/clang-fat.sh b/libs/SDL2/build-scripts/clang-fat.sh index 38c07275..4d1d30a6 100644 --- a/libs/SDL2/build-scripts/clang-fat.sh +++ b/libs/SDL2/build-scripts/clang-fat.sh @@ -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.7 runtime compatibility) +CLANG_COMPILE_X64="clang -arch x86_64 -mmacosx-version-min=10.7 \ +-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.7" # ARM 64-bit compiler flags (11.0 runtime compatibility) CLANG_COMPILE_ARM64="clang -arch arm64 -mmacosx-version-min=11.0 \ diff --git a/libs/SDL2/build-scripts/config.guess b/libs/SDL2/build-scripts/config.guess index b7806a8c..1817bdce 100644 --- a/libs/SDL2/build-scripts/config.guess +++ b/libs/SDL2/build-scripts/config.guess @@ -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 @@ EOF i*:PW*:*) GUESS=$UNAME_MACHINE-pc-pw32 ;; + *:SerenityOS:*:*) + GUESS=$UNAME_MACHINE-pc-serenity + ;; *:Interix*:*) case $UNAME_MACHINE in x86) @@ -1148,16 +1151,27 @@ EOF ;; 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 @@ EOF 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 --git a/libs/SDL2/build-scripts/fnsince.pl b/libs/SDL2/build-scripts/fnsince.pl index 6c69c547..fde65c86 100644 --- a/libs/SDL2/build-scripts/fnsince.pl +++ b/libs/SDL2/build-scripts/fnsince.pl @@ -46,9 +46,15 @@ my @releases = sort { # 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 --git a/libs/SDL2/build-scripts/gen_audio_resampler_filter.c b/libs/SDL2/build-scripts/gen_audio_resampler_filter.c new file mode 100644 index 00000000..99d77957 --- /dev/null +++ b/libs/SDL2/build-scripts/gen_audio_resampler_filter.c @@ -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 --git a/libs/SDL2/build-scripts/ltmain.sh b/libs/SDL2/build-scripts/ltmain.sh index c10d13d8..70a3e825 100755 --- a/libs/SDL2/build-scripts/ltmain.sh +++ b/libs/SDL2/build-scripts/ltmain.sh @@ -7081,8 +7081,20 @@ func_mode_link () prev=xcompiler continue ;; - - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ + # Solaris ld rejects as of 11.4. Refer to Oracle bug 22985199. + -pthread) + case $host in + *solaris2*) ;; + *) + case "$new_inherited_linker_flags " in + *" $arg "*) ;; + * ) func_append new_inherited_linker_flags " $arg" ;; + esac + ;; + esac + continue + ;; + -mt|-mthreads|-kthread|-Kthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) func_append compiler_flags " $arg" func_append compile_command " $arg" diff --git a/libs/SDL2/build-scripts/os2-buildbot.sh b/libs/SDL2/build-scripts/os2-buildbot.sh deleted file mode 100644 index abe0350d..00000000 --- a/libs/SDL2/build-scripts/os2-buildbot.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash - -# This is the script buildbot.libsdl.org uses to cross-compile SDL2 from -# x86 Linux to OS/2, using OpenWatcom. - -# The final zipfile can be unpacked on any machine that supports OpenWatcom -# (Windows, Linux, OS/2, etc). Point the compiler at the include directory -# and link against the SDL2.lib file. Ship the SDL2.dll with your app. - -if [ -z "$WATCOM" ]; then - echo "This script expects \$WATCOM to be set to the OpenWatcom install dir." 1>&2 - echo "This is often something like '/usr/local/share/watcom'" 1>&2 - exit 1 -fi -export PATH="$WATCOM/binl64:$PATH" - -ZIPFILE="$1" -if [ -z $1 ]; then - ZIPFILE=sdl-os2.zip -fi -ZIPDIR=buildbot/SDL - -set -e -set -x - -cd `dirname "$0"` -cd .. - -rm -f $ZIPFILE -wmake -f Makefile.os2 -rm -rf $ZIPDIR -mkdir -p $ZIPDIR -chmod 644 SDL2.dll SDL2.lib SDL2test.lib -mv SDL2.dll SDL2.lib SDL2test.lib $ZIPDIR/ -cp -R include $ZIPDIR/ -zip -9r "buildbot/$ZIPFILE" $ZIPDIR - -wmake -f Makefile.os2 distclean - -set +x -echo "All done. Final installable is in $ZIPFILE ..."; diff --git a/libs/SDL2/build-scripts/update-copyright.sh b/libs/SDL2/build-scripts/update-copyright.sh index ea1f7987..c69ec729 100755 --- a/libs/SDL2/build-scripts/update-copyright.sh +++ b/libs/SDL2/build-scripts/update-copyright.sh @@ -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 --git a/libs/SDL2/build-scripts/wikiheaders.pl b/libs/SDL2/build-scripts/wikiheaders.pl index 2be760ca..5aeeaf0d 100644 --- a/libs/SDL2/build-scripts/wikiheaders.pl +++ b/libs/SDL2/build-scripts/wikiheaders.pl @@ -4,10 +4,28 @@ use warnings; 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 @@ foreach (@ARGV) { $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 @@ sub wikify_chunk { 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 @@ sub wikify_chunk { $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 @@ sub dewikify_chunk { # 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 @@ sub dewikify_chunk { } 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 %headerfuncslocation = (); # $headerfuncslocation{"SDL_OpenAudio"} -> name 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 @@ opendir(DH, $wikipath) or die("Can't opendir '$wikipath': $!\n"); 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 @@ while (readdir(DH)) { 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 @@ while (readdir(DH)) { 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 @@ while (readdir(DH)) { 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 @@ if ($copy_direction == 1) { # --copy-to-headers 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 ($copy_direction == 1) { # --copy-to-headers 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 @@ if ($copy_direction == 1) { # --copy-to-headers } 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 @@ if ($copy_direction == 1) { # --copy-to-headers 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 @@ if ($copy_direction == 1) { # --copy-to-headers $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"; - $str .= ".TH $fn 3 \"SDL $sdlversion\" \"Simple Directmedia Layer\" \"SDL$majorver FUNCTIONS\"\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 \"$projectshortname $fullversion\" \"$projectfullname\" \"$projectshortname$majorver FUNCTIONS\"\n"; $str .= ".SH NAME\n"; $str .= "$fn"; @@ -1145,7 +1289,7 @@ if ($copy_direction == 1) { # --copy-to-headers $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 @@ if ($copy_direction == 1) { # --copy-to-headers 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 @@ if ($copy_direction == 1) { # --copy-to-headers $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 --git a/libs/SDL2/build-scripts/winrtbuild.ps1 b/libs/SDL2/build-scripts/winrtbuild.ps1 index d03cccaf..ad768c36 100644 --- a/libs/SDL2/build-scripts/winrtbuild.ps1 +++ b/libs/SDL2/build-scripts/winrtbuild.ps1 @@ -39,7 +39,7 @@ # # Base version of SDL, used for packaging purposes -$SDLVersion = "2.0.20" +$SDLVersion = "2.23.1" # Gets the .bat file that sets up an MSBuild environment, given one of # Visual Studio's, "PlatformToolset"s. diff --git a/libs/SDL2/cmake/macros.cmake b/libs/SDL2/cmake/macros.cmake index 84cb4c6d..920785ba 100644 --- a/libs/SDL2/cmake/macros.cmake +++ b/libs/SDL2/cmake/macros.cmake @@ -17,8 +17,8 @@ macro(SET_OPTION _NAME _DESC) 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 @@ macro(LISTTOSTR _LIST _OUTPUT) # 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,16 +88,23 @@ macro(LISTTOSTRREV _LIST _OUTPUT) # 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() -macro(CHECK_OBJC_SOURCE_COMPILES SOURCE VAR) - set(PREV_REQUIRED_DEFS "${CMAKE_REQUIRED_DEFINITIONS}") - set(CMAKE_REQUIRED_DEFINITIONS "-x objective-c ${PREV_REQUIRED_DEFS}") - CHECK_C_SOURCE_COMPILES(${SOURCE} ${VAR}) - set(CMAKE_REQUIRED_DEFINITIONS "${PREV_REQUIRED_DEFS}") -endmacro() +if(${CMAKE_VERSION} VERSION_LESS "3.16.0") + macro(CHECK_OBJC_SOURCE_COMPILES SOURCE VAR) + set(PREV_REQUIRED_DEFS "${CMAKE_REQUIRED_DEFINITIONS}") + set(CMAKE_REQUIRED_DEFINITIONS "-x objective-c ${PREV_REQUIRED_DEFS}") + CHECK_C_SOURCE_COMPILES(${SOURCE} ${VAR}) + set(CMAKE_REQUIRED_DEFINITIONS "${PREV_REQUIRED_DEFS}") + endmacro() +else() + include(CheckOBJCSourceCompiles) + if (APPLE) + enable_language(OBJC) + endif() +endif() if(CMAKE_VERSION VERSION_LESS 3.13.0) macro(target_link_directories _TARGET _SCOPE) diff --git a/libs/SDL2/cmake/sdlchecks.cmake b/libs/SDL2/cmake/sdlchecks.cmake index a09891cc..31d26486 100644 --- a/libs/SDL2/cmake/sdlchecks.cmake +++ b/libs/SDL2/cmake/sdlchecks.cmake @@ -48,6 +48,7 @@ macro(CheckDLOPEN) int main(int argc, char **argv) { void *handle = dlopen(\"\", RTLD_NOW); const char *loaderror = (char *) dlerror(); + return 0; }" HAVE_DLOPEN) set(CMAKE_REQUIRED_LIBRARIES) endif() @@ -57,8 +58,7 @@ macro(CheckO_CLOEXEC) check_c_source_compiles(" #include int flag = O_CLOEXEC; - int main(void) { - }" HAVE_O_CLOEXEC) + int main(int argc, char **argv) { return 0; }" HAVE_O_CLOEXEC) endmacro() # Requires: @@ -68,12 +68,12 @@ macro(CheckOSS) set(OSS_HEADER_FILE "sys/soundcard.h") check_c_source_compiles(" #include - int main() { int arg = SNDCTL_DSP_SETFRAGMENT; }" OSS_FOUND) + int main(int argc, char **argv) { int arg = SNDCTL_DSP_SETFRAGMENT; return 0; }" OSS_FOUND) if(NOT OSS_FOUND) set(OSS_HEADER_FILE "soundcard.h") check_c_source_compiles(" #include - int main() { int arg = SNDCTL_DSP_SETFRAGMENT; }" OSS_FOUND) + int main(int argc, char **argv) { int arg = SNDCTL_DSP_SETFRAGMENT; return 0; }" OSS_FOUND) endif() if(OSS_FOUND) @@ -83,7 +83,7 @@ macro(CheckOSS) 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 @@ macro(CheckALSA) 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 @@ macro(CheckPipewire) 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,18 +163,18 @@ macro(CheckPulseAudio) 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() - list(APPEND EXTRA_LDFLAGS ${PKG_sPULSEAUDIO_LDFLAGS}) + list(APPEND EXTRA_LDFLAGS ${PKG_PULSEAUDIO_LDFLAGS}) endif() set(HAVE_SDL_AUDIO TRUE) endif() @@ -192,14 +192,14 @@ macro(CheckJACK) 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 @@ macro(CheckESD) 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 @@ macro(CheckARTS) 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 @@ macro(CheckNAS) 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 @@ macro(CheckSNDIO) 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 @@ macro(CheckFusionSound) 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 @@ endmacro() # - 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") - endif() - if(SDL_LIBSAMPLERATE_SHARED AND HAVE_SDL_LOADSO) - FindLibraryAndSONAME("samplerate") - set(SDL_LIBSAMPLERATE_DYNAMIC "\"${SAMPLERATE_LIB_SONAME}\"") - set(HAVE_LIBSAMPLERATE_SHARED TRUE) + 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() - list(APPEND EXTRA_LDFLAGS -lsamplerate) + target_link_libraries(sdl-build-options INTERFACE SampleRate::samplerate) + list(APPEND SDL_REQUIRES_PRIVATE SampleRate::samplerate) + endif() + 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") + 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,7 +418,7 @@ endmacro() # - 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() @@ -415,7 +440,6 @@ macro(CheckX11) 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_) @@ -423,7 +447,6 @@ macro(CheckX11) 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) if(X11_LIB) @@ -435,7 +458,7 @@ macro(CheckX11) 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,12 +484,22 @@ macro(CheckX11) 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}) endif() set(CMAKE_REQUIRED_LIBRARIES ${X11_LIB} ${X11_LIB}) @@ -479,7 +512,8 @@ macro(CheckX11) XGenericEventCookie *cookie = &event.xcookie; XNextEvent(display, &event); XGetEventData(display, cookie); - XFreeEventData(display, cookie); }" HAVE_XGENERICEVENT) + XFreeEventData(display, cookie); + return 0; }" HAVE_XGENERICEVENT) if(HAVE_XGENERICEVENT) set(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1) endif() @@ -501,16 +535,6 @@ macro(CheckX11) 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) set(HAVE_X11_XINPUT TRUE) if(HAVE_X11_SHARED AND XI_LIB) @@ -527,11 +551,10 @@ macro(CheckX11) #include int event_type = XI_TouchBegin; XITouchClassInfo *t; - Status XIAllowTouchEvents(Display *a,int b,unsigned int c,Window d,int f) - { + Status XIAllowTouchEvents(Display *a,int b,unsigned int c,Window d,int f) { return (Status)0; } - int main(int argc, char **argv) {}" HAVE_XINPUT2_MULTITOUCH) + int main(int argc, char **argv) { return 0; }" HAVE_XINPUT2_MULTITOUCH) if(HAVE_XINPUT2_MULTITOUCH) set(SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH 1) endif() @@ -545,7 +568,7 @@ macro(CheckX11) #include #include BarrierEventID b; - int main(void) { }" HAVE_XFIXES_H) + 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) @@ -582,16 +605,6 @@ macro(CheckX11) 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() @@ -619,7 +632,8 @@ macro(WaylandProtocolGen _SCANNER _CODE_MODE _XML _PROTL) 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: @@ -630,7 +644,7 @@ endmacro() # - HAVE_SDL_LOADSO opt macro(CheckWayland) if(SDL_WAYLAND) - pkg_check_modules(WAYLAND wayland-client wayland-egl wayland-cursor egl "xkbcommon>=0.5.0") + pkg_check_modules(WAYLAND "wayland-client>=1.18" wayland-egl wayland-cursor egl "xkbcommon>=0.5.0") if(WAYLAND_FOUND) find_program(WAYLAND_SCANNER NAMES wayland-scanner REQUIRED) @@ -662,7 +676,7 @@ macro(CheckWayland) 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") @@ -682,18 +696,18 @@ macro(CheckWayland) 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) @@ -706,12 +720,12 @@ macro(CheckWayland) 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() @@ -731,8 +745,7 @@ macro(CheckCOCOA) 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() @@ -750,15 +763,16 @@ macro(CheckDirectFB) 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() @@ -775,24 +789,26 @@ macro(CheckVivante) if(SDL_VIVANTE) check_c_source_compiles(" #include - int main(int argc, char** argv) {}" HAVE_VIVANTE_VDK) + int main(int argc, char** argv) { return 0; }" HAVE_VIVANTE_VDK) check_c_source_compiles(" #define LINUX #define EGL_API_FB #include - int main(int argc, char** argv) {}" HAVE_VIVANTE_EGL_FB) + int main(int argc, char** argv) { return 0; }" HAVE_VIVANTE_EGL_FB) if(HAVE_VIVANTE_VDK OR HAVE_VIVANTE_EGL_FB) set(HAVE_VIVANTE TRUE) 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) - list(APPEND EXTRA_LIBS VDK VIVANTE) + find_library(VIVANTE_LIBRARY REQUIRED NAMES VIVANTE vivante drm_vivante) + 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() @@ -805,7 +821,7 @@ macro(CheckGLX) if(SDL_OPENGL) check_c_source_compiles(" #include - int main(int argc, char** argv) {}" HAVE_OPENGL_GLX) + int main(int argc, char** argv) { return 0; }" HAVE_OPENGL_GLX) if(HAVE_OPENGL_GLX) set(SDL_VIDEO_OPENGL_GLX 1) endif() @@ -824,7 +840,7 @@ macro(CheckEGL) #define EGL_NO_X11 #include #include - int main (int argc, char** argv) {}" HAVE_OPENGL_EGL) + int main (int argc, char** argv) { return 0; }" HAVE_OPENGL_EGL) if(HAVE_OPENGL_EGL) set(SDL_VIDEO_OPENGL_EGL 1) endif() @@ -838,7 +854,7 @@ macro(CheckOpenGL) check_c_source_compiles(" #include #include - int main(int argc, char** argv) {}" HAVE_OPENGL) + int main(int argc, char** argv) { return 0; }" HAVE_OPENGL) if(HAVE_OPENGL) set(SDL_VIDEO_OPENGL 1) set(SDL_VIDEO_RENDER_OGL 1) @@ -853,7 +869,7 @@ macro(CheckOpenGLES) check_c_source_compiles(" #include #include - int main (int argc, char** argv) {}" HAVE_OPENGLES_V1) + int main (int argc, char** argv) { return 0; }" HAVE_OPENGLES_V1) if(HAVE_OPENGLES_V1) set(HAVE_OPENGLES TRUE) set(SDL_VIDEO_OPENGL_ES 1) @@ -862,7 +878,7 @@ macro(CheckOpenGLES) check_c_source_compiles(" #include #include - int main (int argc, char** argv) {}" HAVE_OPENGLES_V2) + int main (int argc, char** argv) { return 0; }" HAVE_OPENGLES_V2) if(HAVE_OPENGLES_V2) set(HAVE_OPENGLES TRUE) set(SDL_VIDEO_OPENGL_ES2 1) @@ -940,8 +956,7 @@ macro(CheckPTHREAD) 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 @@ -1146,7 +1161,7 @@ macro(CheckUSBHID) 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) @@ -1174,7 +1189,9 @@ macro(CheckHIDAPI) else() # libusb is loaded dynamically, so don't add it to EXTRA_LIBS FindLibraryAndSONAME("usb-1.0") - set(SDL_LIBUSB_DYNAMIC "\"${USB_LIB_SONAME}\"") + if(USB_1.0_LIB) + set(SDL_LIBUSB_DYNAMIC "\"${USB_1.0_LIB_SONAME}\"") + endif() endif() endif() endif() @@ -1185,10 +1202,10 @@ macro(CheckHIDAPI) if(HAVE_HIDAPI) if(ANDROID) - set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/hidapi/android/hid.cpp) + list(APPEND 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) + list(APPEND SOURCE_FILES ${SDL2_SOURCE_DIR}/src/hidapi/ios/hid.m) set(SDL_FRAMEWORK_COREBLUETOOTH 1) endif() set(HAVE_SDL_HIDAPI TRUE) @@ -1198,7 +1215,7 @@ macro(CheckHIDAPI) 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}) + list(APPEND SOURCE_FILES ${HIDAPI_JOYSTICK_SOURCES}) endif() endif() endmacro() @@ -1234,7 +1251,7 @@ macro(CheckRPI) 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}") @@ -1261,7 +1278,7 @@ macro(CheckKMSDRM) 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}) @@ -1277,7 +1294,7 @@ macro(CheckKMSDRM) 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 --git a/libs/SDL2/cmake/test/CMakeLists.txt b/libs/SDL2/cmake/test/CMakeLists.txt new file mode 100644 index 00000000..db9e2f82 --- /dev/null +++ b/libs/SDL2/cmake/test/CMakeLists.txt @@ -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 --git a/libs/SDL2/cmake/test/jni/Android.mk b/libs/SDL2/cmake/test/jni/Android.mk new file mode 100644 index 00000000..c4956d68 --- /dev/null +++ b/libs/SDL2/cmake/test/jni/Android.mk @@ -0,0 +1,11 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_MODULE := main_gui_androidmk +LOCAL_SRC_FILES := ../main_gui.c +LOCAL_SHARED_LIBRARIES += SDL2 +include $(BUILD_SHARED_LIBRARY) + +$(call import-module,SDL2main) +$(call import-module,SDL2) diff --git a/libs/SDL2/cmake/test/main_cli.c b/libs/SDL2/cmake/test/main_cli.c new file mode 100644 index 00000000..f6b08360 --- /dev/null +++ b/libs/SDL2/cmake/test/main_cli.c @@ -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 --git a/libs/SDL2/cmake/test/main_gui.c b/libs/SDL2/cmake/test/main_gui.c new file mode 100644 index 00000000..4ffe9be1 --- /dev/null +++ b/libs/SDL2/cmake/test/main_gui.c @@ -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 --git a/libs/SDL2/cmake/test/test_pkgconfig.sh b/libs/SDL2/cmake/test/test_pkgconfig.sh new file mode 100644 index 00000000..2c58a752 --- /dev/null +++ b/libs/SDL2/cmake/test/test_pkgconfig.sh @@ -0,0 +1,46 @@ +#!/bin/sh + +if test "x$CC" = "x"; then + CC=gcc +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 )" + +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" + +echo "-- CC: $CC" +echo "-- CFLAGS: $CFLAGS" +echo "-- EXTRA_CFLAGS: $EXTRA_CFLAGS" +echo "-- LDFLASG: $LDFLAGS" +echo "-- EXTRA_LDFLAGS: $EXTRA_LDFLAGS" + +echo "-- COMPILE: $compile_cmd" +echo "-- LINK: $link_cmd" + +set -x + +$compile_cmd +$link_cmd diff --git a/libs/SDL2/cmake/test/test_sdlconfig.sh b/libs/SDL2/cmake/test/test_sdlconfig.sh new file mode 100644 index 00000000..ca09bc29 --- /dev/null +++ b/libs/SDL2/cmake/test/test_sdlconfig.sh @@ -0,0 +1,46 @@ +#!/bin/sh + +if test "x$CC" = "x"; then + CC=gcc +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 )" + +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" + +echo "-- CC: $CC" +echo "-- CFLAGS: $CFLAGS" +echo "-- EXTRA_CFLAGS: $EXTRA_CFLAGS" +echo "-- LDFLASG: $LDFLAGS" +echo "-- EXTRA_LDFLAGS: $EXTRA_LDFLAGS" + +echo "-- COMPILE: $compile_cmd" +echo "-- LINK: $link_cmd" + +set -x + +$compile_cmd +$link_cmd diff --git a/libs/SDL2/configure b/libs/SDL2/configure index a02b8f93..4497e254 100755 --- a/libs/SDL2/configure +++ b/libs/SDL2/configure @@ -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 @@ esac 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 @@ if test "${PATH_SEPARATOR+set}" != set; then 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 @@ case $0 in #(( 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 @@ if test "x$as_myself" = x; then 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 @@ esac 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_success || { exitcode=1; echo as_fn_success failed.; } 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 / || exit 1" 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 @@ fi 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 @@ esac 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_fn_unset () } as_unset=as_fn_unset + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -316,6 +318,14 @@ as_fn_exit () 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_fn_mkdir_p () 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 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ 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 @@ as_fn_executable_p () # 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 @@ fi # as_fn_append # 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_fn_error () 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_me=`$as_basename -- "$0" || $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 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits 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 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits 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 @@ case `echo -n x` in #((((( 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 @@ MFLAGS= 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 +#include +#ifdef HAVE_STDIO_H +# include #endif -#ifdef HAVE_SYS_STAT_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_RLD_FLAGS SDL_STATIC_LIBS SDL_LIBS SDL_CFLAGS +bin_prefix_relpath +cmake_prefix_relpath INSTALL_SDL2_CONFIG LIBUSB_LIBS LIBUSB_CFLAGS @@ -673,6 +702,8 @@ X_CFLAGS XMKMF RPI_LIBS RPI_CFLAGS +DECOR_LIBS +DECOR_CFLAGS FUSIONSOUND_LIBS FUSIONSOUND_CFLAGS ARTSCONFIG @@ -690,6 +721,7 @@ ALSA_CFLAGS POW_LIB LIBOBJS ALLOCA +CPP LIBTOOLLINKERTAG LINKER PKG_CONFIG_LIBDIR @@ -708,7 +740,6 @@ LT_REVISION LT_CURRENT LT_RELEASE RC -CPP LT_SYS_LIBRARY_PATH OTOOL64 OTOOL @@ -774,6 +805,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -804,6 +836,7 @@ with_aix_soname with_gnu_ld with_sysroot enable_libtool_lock +enable_largefile enable_assertions enable_dependency_tracking enable_libc @@ -822,6 +855,8 @@ enable_filesystem enable_threads enable_timers enable_file +enable_misc +enable_locale enable_loadso enable_cpuinfo enable_assembly @@ -832,6 +867,8 @@ enable_sse enable_sse2 enable_sse3 enable_altivec +enable_lsx +enable_lasx enable_oss enable_alsa with_alsa_prefix @@ -874,13 +911,11 @@ with_x 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 @@ -926,7 +961,6 @@ LDFLAGS LIBS CPPFLAGS LT_SYS_LIBRARY_PATH -CPP CXX CXXFLAGS CCC @@ -934,6 +968,7 @@ CXXCPP PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR +CPP JACK_CFLAGS JACK_LIBS PIPEWIRE_CFLAGS @@ -942,6 +977,8 @@ PULSEAUDIO_CFLAGS PULSEAUDIO_LIBS FUSIONSOUND_CFLAGS FUSIONSOUND_LIBS +DECOR_CFLAGS +DECOR_LIBS RPI_CFLAGS RPI_LIBS XMKMF @@ -995,6 +1032,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' @@ -1024,8 +1062,6 @@ do *) ac_optarg=yes ;; esac - # Accept the important Cygnus configure options, so we can diagnose typos. - case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; @@ -1066,9 +1102,9 @@ do 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" @@ -1092,9 +1128,9 @@ do 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" @@ -1247,6 +1283,15 @@ do | -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=* \ @@ -1296,9 +1341,9 @@ do 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" @@ -1312,9 +1357,9 @@ do 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" @@ -1358,9 +1403,9 @@ Try \`$0 --help' for more information" *) # 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}" ;; @@ -1376,7 +1421,7 @@ if test -n "$ac_unrecognized_opts"; then 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 @@ -1384,7 +1429,7 @@ fi 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. @@ -1440,7 +1485,7 @@ $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ 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 @@ -1537,6 +1582,7 @@ Fine tuning of the installation directories: --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] @@ -1577,6 +1623,7 @@ Optional Features: --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] @@ -1599,6 +1646,8 @@ Optional Features: --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] + --enable-locale Enable the locale subsystem [default=yes] --enable-loadso Enable the shared object loading subsystem [default=yes] --enable-cpuinfo Enable the cpuinfo subsystem [default=yes] @@ -1611,6 +1660,8 @@ Optional Features: --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 @@ -1660,8 +1711,6 @@ Optional Features: --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] @@ -1674,7 +1723,6 @@ Optional Features: 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] @@ -1752,7 +1800,6 @@ Some influential environment variables: 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 @@ -1761,6 +1808,7 @@ Some influential environment variables: 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 @@ -1775,6 +1823,9 @@ Some influential environment variables: C compiler flags for FUSIONSOUND, overriding pkg-config FUSIONSOUND_LIBS linker flags for FUSIONSOUND, overriding pkg-config + DECOR_CFLAGS + C compiler flags for DECOR, overriding pkg-config + DECOR_LIBS linker flags for DECOR, overriding pkg-config RPI_CFLAGS C compiler flags for RPI, overriding pkg-config RPI_LIBS linker flags for RPI, overriding pkg-config XMKMF Path to xmkmf, Makefile generator for X Window System @@ -1815,9 +1866,9 @@ if test "$ac_init_help" = "recursive"; then 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/ ;; @@ -1845,7 +1896,8 @@ esac 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 @@ -1853,7 +1905,7 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix 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 @@ -1863,9 +1915,9 @@ test -n "$ac_init_help" && exit $ac_status 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 @@ -1882,14 +1934,14 @@ fi 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 @@ -1897,14 +1949,15 @@ $as_echo "$ac_try_echo"; } >&5 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 @@ -1920,14 +1973,14 @@ fi 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 @@ -1935,17 +1988,18 @@ $as_echo "$ac_try_echo"; } >&5 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 @@ -1967,120 +2021,44 @@ fi 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. @@ -2088,16 +2066,9 @@ else #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. @@ -2115,24 +2086,25 @@ choke me #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 @@ -2143,14 +2115,14 @@ $as_echo "$ac_res" >&6; } 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 @@ -2158,14 +2130,15 @@ $as_echo "$ac_try_echo"; } >&5 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 @@ -2187,7 +2160,7 @@ case "(($ac_try" in *) 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 @@ -2195,14 +2168,15 @@ $as_echo "$ac_try_echo"; } >&5 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 @@ -2218,14 +2192,14 @@ fi 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 @@ -2233,17 +2207,18 @@ $as_echo "$ac_try_echo"; } >&5 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 @@ -2258,93 +2233,6 @@ fi } # 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 @@ -2352,17 +2240,18 @@ fi 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; @@ -2370,12 +2259,13 @@ if (sizeof ($2)) 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; @@ -2383,22 +2273,104 @@ if (sizeof (($2))) 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_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\"" +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 $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 @@ -2406,16 +2378,17 @@ $as_echo "$ac_res" >&6; } ac_fn_c_check_member () { 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 + { 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 () +main (void) { static $2 ac_aggr; if (ac_aggr.$3) @@ -2424,14 +2397,15 @@ return 0; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : eval "$4=yes" -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int -main () +main (void) { static $2 ac_aggr; if (sizeof ac_aggr.$3) @@ -2440,29 +2414,50 @@ return 0; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : eval "$4=yes" -else +else $as_nop eval "$4=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 -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=\$$4 - { $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_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 @@ -2495,8 +2490,12 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR 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 @@ -2531,7 +2530,7 @@ do | -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'" ;; @@ -2566,11 +2565,13 @@ done # 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 @@ -2581,8 +2582,8 @@ trap 'exit_status=$? 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) ;; #( @@ -2606,7 +2607,7 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; ) echo - $as_echo "## ----------------- ## + printf "%s\n" "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo @@ -2614,14 +2615,14 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; 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 @@ -2629,15 +2630,15 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; 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 @@ -2645,8 +2646,8 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; 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 && @@ -2660,63 +2661,48 @@ ac_signal=0 # 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 @@ -2726,19 +2712,650 @@ if test -r "$cache_file"; then # 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; +} +" + +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 + +namespace cxx11test +{ + constexpr int get_val() { return 20; } + + struct testinit + { + int i; + double d; + }; + + 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 @@ -2749,12 +3366,12 @@ for ac_var in $ac_precious_vars; do 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=: ;; ,);; *) @@ -2763,24 +3380,24 @@ $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} 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 @@ -2790,11 +3407,12 @@ $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} 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. ## @@ -2810,56 +3428,27 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers include/SDL_config.h" -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. - orig_CFLAGS="$CFLAGS" -# -# 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=20 -SDL_INTERFACE_AGE=2 -SDL_BINARY_AGE=20 +SDL_MINOR_VERSION=23 +SDL_MICRO_VERSION=1 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 + @@ -2868,10 +3457,12 @@ SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION # 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;} ;; + { 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 @@ -2891,28 +3482,32 @@ 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 -{ $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;; @@ -2931,21 +3526,22 @@ IFS=$ac_save_IFS 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;; @@ -2985,8 +3581,8 @@ ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ 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 @@ -3012,12 +3608,12 @@ func_echo_all () } 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 @@ -3030,6 +3626,15 @@ esac + + + + + + + + + @@ -3041,11 +3646,12 @@ 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 +{ 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 @@ -3053,11 +3659,15 @@ 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 + 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 @@ -3068,11 +3678,11 @@ 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 @@ -3081,11 +3691,12 @@ 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 @@ -3093,11 +3704,15 @@ 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 + 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 @@ -3108,11 +3723,11 @@ fi 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 @@ -3120,8 +3735,8 @@ fi 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 @@ -3134,11 +3749,12 @@ if test -z "$CC"; then 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 @@ -3146,11 +3762,15 @@ 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 + 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 @@ -3161,11 +3781,11 @@ 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 @@ -3174,11 +3794,12 @@ fi 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 @@ -3187,15 +3808,19 @@ 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 - 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 @@ -3211,18 +3836,18 @@ if test $ac_prog_rejected = yes; then # 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 @@ -3233,11 +3858,12 @@ if test -z "$CC"; then 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 @@ -3245,11 +3871,15 @@ 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 + 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 @@ -3260,11 +3890,11 @@ 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 @@ -3277,11 +3907,12 @@ if test -z "$CC"; then 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 @@ -3289,11 +3920,15 @@ 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 + 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 @@ -3304,11 +3939,11 @@ fi 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 @@ -3320,8 +3955,8 @@ done 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 @@ -3329,25 +3964,129 @@ esac 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 -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +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; } # 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 @@ -3357,7 +4096,7 @@ $as_echo "$ac_try_echo"; } >&5 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 @@ -3365,7 +4104,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; @@ -3377,9 +4116,9 @@ ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # 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.*" @@ -3400,11 +4139,12 @@ case "(($ac_try" in *) 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, @@ -3421,7 +4161,7 @@ do # 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 @@ -3437,44 +4177,46 @@ do 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; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "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; } +{ 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 @@ -3488,15 +4230,15 @@ for ac_file in conftest.exe conftest conftest.*; do * ) 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 @@ -3505,7 +4247,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main () +main (void) { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; @@ -3517,8 +4259,8 @@ _ACEOF 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 @@ -3526,10 +4268,10 @@ case "(($ac_try" in *) 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 @@ -3537,39 +4279,40 @@ $as_echo "$ac_try_echo"; } >&5 *) 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) { ; @@ -3583,11 +4326,12 @@ case "(($ac_try" in *) 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 @@ -3596,31 +4340,32 @@ $as_echo "$ac_try_echo"; } >&5 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 @@ -3630,29 +4375,33 @@ main () 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 @@ -3661,57 +4410,60 @@ else /* 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 @@ -3726,94 +4478,144 @@ else 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_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. */ +$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 + +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 + +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. */ -#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]; - -/* 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 **, 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; -} +$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 @@ -3822,11 +4624,12 @@ 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 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" @@ -3840,10 +4643,15 @@ else 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 @@ -3852,13 +4660,13 @@ case `"$ac_path_SED" --version 2>&1` in 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 @@ -3886,8 +4694,8 @@ else 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 @@ -3904,11 +4712,12 @@ Xsed="$SED -e 1s/^X//" -{ $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 @@ -3916,10 +4725,15 @@ else 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 @@ -3928,13 +4742,13 @@ case `"$ac_path_GREP" --version 2>&1` in 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 @@ -3962,16 +4776,17 @@ else 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 @@ -3982,10 +4797,15 @@ else 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 @@ -3994,13 +4814,13 @@ case `"$ac_path_EGREP" --version 2>&1` in 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 @@ -4029,16 +4849,17 @@ fi 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 @@ -4049,10 +4870,15 @@ else 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 @@ -4061,13 +4887,13 @@ case `"$ac_path_FGREP" --version 2>&1` in 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 @@ -4096,8 +4922,8 @@ fi 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" @@ -4122,17 +4948,18 @@ test -z "$GREP" && GREP=grep # 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 @@ -4161,15 +4988,16 @@ $as_echo_n "checking for ld used by $CC... " >&6; } ;; 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 @@ -4198,18 +5026,19 @@ fi 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 &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 @@ -4232,11 +5061,12 @@ with_gnu_ld=$lt_cv_prog_gnu_ld -{ $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 @@ -4286,8 +5116,8 @@ else : ${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 @@ -4300,11 +5130,12 @@ else 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 @@ -4312,11 +5143,15 @@ 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 + 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 @@ -4327,11 +5162,11 @@ fi 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 @@ -4344,11 +5179,12 @@ if test -z "$DUMPBIN"; then 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 @@ -4356,11 +5192,15 @@ 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 + 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 @@ -4371,11 +5211,11 @@ fi 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 @@ -4387,8 +5227,8 @@ done 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 @@ -4416,11 +5256,12 @@ test -z "$NM" && NM=nm -{ $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) @@ -4436,26 +5277,27 @@ else 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 @@ -4582,11 +5424,11 @@ else 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 @@ -4630,11 +5472,12 @@ esac -{ $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 @@ -4670,18 +5513,19 @@ esac 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 @@ -4697,22 +5541,23 @@ esac 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 "" | " "*) ;; @@ -4745,11 +5590,12 @@ esac 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 @@ -4757,11 +5603,15 @@ 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 + 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 @@ -4772,11 +5622,11 @@ fi 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 @@ -4785,11 +5635,12 @@ if test -z "$ac_cv_prog_OBJDUMP"; then 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 @@ -4797,11 +5648,15 @@ 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 + 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 @@ -4812,11 +5667,11 @@ fi 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 @@ -4824,8 +5679,8 @@ fi 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 @@ -4841,11 +5696,12 @@ test -z "$OBJDUMP" && OBJDUMP=objdump -{ $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' @@ -5043,8 +5899,8 @@ os2*) 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 @@ -5088,11 +5944,12 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown 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 @@ -5100,11 +5957,15 @@ 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 + 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 @@ -5115,11 +5976,11 @@ fi 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 @@ -5128,11 +5989,12 @@ if test -z "$ac_cv_prog_DLLTOOL"; then 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 @@ -5140,11 +6002,15 @@ 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 + 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 @@ -5155,11 +6021,11 @@ fi 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 @@ -5167,8 +6033,8 @@ fi 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 @@ -5185,11 +6051,12 @@ test -z "$DLLTOOL" && DLLTOOL=dlltool -{ $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 @@ -5212,8 +6079,8 @@ cygwin* | mingw* | pw32* | cegcc*) 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 @@ -5229,11 +6096,12 @@ if test -n "$ac_tool_prefix"; then 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 @@ -5241,11 +6109,15 @@ 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 + 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 @@ -5256,11 +6128,11 @@ fi 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 @@ -5273,11 +6145,12 @@ if test -z "$AR"; then 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 @@ -5285,11 +6158,15 @@ 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 + 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 @@ -5300,11 +6177,11 @@ fi 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 @@ -5316,8 +6193,8 @@ done 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 @@ -5337,30 +6214,32 @@ fi -{ $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. @@ -5368,7 +6247,7 @@ if ac_fn_c_try_compile "$LINENO"; then : { { 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=@ @@ -5377,11 +6256,11 @@ if ac_fn_c_try_compile "$LINENO"; then : 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= @@ -5398,11 +6277,12 @@ fi 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 @@ -5410,11 +6290,15 @@ 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 + 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 @@ -5425,11 +6309,11 @@ fi 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 @@ -5438,11 +6322,12 @@ if test -z "$ac_cv_prog_STRIP"; then 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 @@ -5450,11 +6335,15 @@ 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 + 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 @@ -5465,11 +6354,11 @@ fi 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 @@ -5477,8 +6366,8 @@ fi 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 @@ -5497,11 +6386,12 @@ test -z "$STRIP" && STRIP=: 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 @@ -5509,11 +6399,15 @@ 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 + 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 @@ -5524,11 +6418,11 @@ fi 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 @@ -5537,11 +6431,12 @@ if test -z "$ac_cv_prog_RANLIB"; then 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 @@ -5549,11 +6444,15 @@ 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 + 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 @@ -5564,11 +6463,11 @@ fi 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 @@ -5576,8 +6475,8 @@ fi 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 @@ -5641,11 +6540,12 @@ 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 -{ $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 @@ -5653,11 +6553,15 @@ 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 + 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 @@ -5668,11 +6572,11 @@ fi 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 @@ -5708,11 +6612,12 @@ compiler=$CC # 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?!! ;)] @@ -5864,14 +6769,14 @@ _LT_EOF 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 @@ -5940,7 +6845,7 @@ _LT_EOF 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 @@ -5975,11 +6880,11 @@ if test -z "$lt_cv_sys_global_symbol_pipe"; then 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. @@ -6025,13 +6930,14 @@ fi -{ $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 @@ -6049,24 +6955,25 @@ case $with_sysroot in #( 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} @@ -6077,10 +6984,15 @@ if test -z "$lt_DD"; then 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 \ @@ -6100,15 +7012,16 @@ fi 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= @@ -6119,8 +7032,8 @@ fi 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; } @@ -6143,7 +7056,8 @@ func_cc_basename () } # 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 @@ -6159,7 +7073,7 @@ ia64-*-hpux*) 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*) @@ -6179,7 +7093,7 @@ ia64-*-hpux*) 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 @@ -6217,7 +7131,7 @@ mips64*-*linux*) 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 @@ -6258,7 +7172,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) 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*) @@ -6321,11 +7235,12 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # 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' @@ -6336,19 +7251,20 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu /* 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' @@ -6357,8 +7273,8 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ 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 @@ -6371,7 +7287,7 @@ $as_echo "$lt_cv_cc_needs_belf" >&6; } 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*) @@ -6408,11 +7324,12 @@ need_locks=$enable_libtool_lock 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 @@ -6420,11 +7337,15 @@ 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 + 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 @@ -6435,11 +7356,11 @@ fi 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 @@ -6448,11 +7369,12 @@ if test -z "$ac_cv_prog_MANIFEST_TOOL"; then 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 @@ -6460,11 +7382,15 @@ 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 + 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 @@ -6475,11 +7401,11 @@ fi 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 @@ -6487,8 +7413,8 @@ fi 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 @@ -6498,11 +7424,12 @@ else 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 @@ -6512,8 +7439,8 @@ else 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 @@ -6528,11 +7455,12 @@ fi 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 @@ -6540,11 +7468,15 @@ 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 + 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 @@ -6555,11 +7487,11 @@ fi 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 @@ -6568,11 +7500,12 @@ if test -z "$ac_cv_prog_DSYMUTIL"; then 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 @@ -6580,11 +7513,15 @@ 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 + 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 @@ -6595,11 +7532,11 @@ fi 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 @@ -6607,8 +7544,8 @@ fi 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 @@ -6620,11 +7557,12 @@ fi 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 @@ -6632,11 +7570,15 @@ 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 + 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 @@ -6647,11 +7589,11 @@ fi 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 @@ -6660,11 +7602,12 @@ if test -z "$ac_cv_prog_NMEDIT"; then 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 @@ -6672,11 +7615,15 @@ 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 + 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 @@ -6687,11 +7634,11 @@ fi 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 @@ -6699,8 +7646,8 @@ fi 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 @@ -6712,11 +7659,12 @@ fi 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 @@ -6724,11 +7672,15 @@ 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 + 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 @@ -6739,11 +7691,11 @@ fi 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 @@ -6752,11 +7704,12 @@ if test -z "$ac_cv_prog_LIPO"; then 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 @@ -6764,11 +7717,15 @@ 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 + 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 @@ -6779,11 +7736,11 @@ fi 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 @@ -6791,8 +7748,8 @@ fi 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 @@ -6804,11 +7761,12 @@ fi 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 @@ -6816,11 +7774,15 @@ 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 + 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 @@ -6831,11 +7793,11 @@ fi 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 @@ -6844,11 +7806,12 @@ if test -z "$ac_cv_prog_OTOOL"; then 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 @@ -6856,11 +7819,15 @@ 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 + 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 @@ -6871,11 +7838,11 @@ fi 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 @@ -6883,8 +7850,8 @@ fi 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 @@ -6896,11 +7863,12 @@ fi 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 @@ -6908,11 +7876,15 @@ 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 + 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 @@ -6923,11 +7895,11 @@ fi 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 @@ -6936,11 +7908,12 @@ if test -z "$ac_cv_prog_OTOOL64"; then 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 @@ -6948,11 +7921,15 @@ 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 + 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 @@ -6963,11 +7940,11 @@ fi 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 @@ -6975,8 +7952,8 @@ fi 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 @@ -7011,11 +7988,12 @@ fi - { $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 @@ -7044,14 +8022,15 @@ else 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 @@ -7060,31 +8039,33 @@ else /* 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;} @@ -7112,15 +8093,15 @@ _LT_EOF 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' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; darwin*) - case ${MACOSX_DEPLOYMENT_TARGET},$host in + case $MACOSX_DEPLOYMENT_TARGET,$host in 10.[012],*|,*powerpc*-darwin[5-8]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; *) @@ -7179,286 +8160,43 @@ func_munge_path_list () 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 : - -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 - + 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 -# 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 + + + + + + + +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 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 +ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$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 +if test "x$ac_cv_header_dlfcn_h" = xyes +then : + printf "%s\n" "#define HAVE_DLFCN_H 1" >>confdefs.h 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 - -fi - -done - @@ -7471,11 +8209,12 @@ case $host in 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 @@ -7483,11 +8222,15 @@ 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 + 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 @@ -7498,11 +8241,11 @@ fi 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 @@ -7511,11 +8254,12 @@ if test -z "$ac_cv_prog_AS"; then 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 @@ -7523,11 +8267,15 @@ 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 + 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 @@ -7538,11 +8286,11 @@ fi 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 @@ -7550,8 +8298,8 @@ fi 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 @@ -7563,11 +8311,12 @@ fi 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 @@ -7575,11 +8324,15 @@ 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 + 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 @@ -7590,11 +8343,11 @@ fi 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 @@ -7603,11 +8356,12 @@ if test -z "$ac_cv_prog_DLLTOOL"; then 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 @@ -7615,11 +8369,15 @@ 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 + 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 @@ -7630,11 +8388,11 @@ fi 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 @@ -7642,8 +8400,8 @@ fi 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 @@ -7655,11 +8413,12 @@ fi 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 @@ -7667,11 +8426,15 @@ 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 + 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 @@ -7682,11 +8445,11 @@ fi 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 @@ -7695,11 +8458,12 @@ if test -z "$ac_cv_prog_OBJDUMP"; then 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 @@ -7707,11 +8471,15 @@ 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 + 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 @@ -7722,11 +8490,11 @@ fi 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 @@ -7734,8 +8502,8 @@ fi 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 @@ -7772,7 +8540,8 @@ test -z "$OBJDUMP" && OBJDUMP=objdump # 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 ;; @@ -7790,7 +8559,7 @@ if test "${enable_shared+set}" = set; then : IFS=$lt_save_ifs ;; esac -else +else $as_nop enable_shared=yes fi @@ -7803,7 +8572,8 @@ fi # 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 ;; @@ -7821,7 +8591,7 @@ if test "${enable_static+set}" = set; then : IFS=$lt_save_ifs ;; esac -else +else $as_nop enable_static=yes fi @@ -7835,7 +8605,8 @@ fi # 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 ;; @@ -7852,7 +8623,7 @@ if test "${with_pic+set}" = set; then : IFS=$lt_save_ifs ;; esac -else +else $as_nop pic_mode=default fi @@ -7864,7 +8635,8 @@ fi # 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 ;; @@ -7882,7 +8654,7 @@ if test "${enable_fast_install+set}" = set; then : IFS=$lt_save_ifs ;; esac -else +else $as_nop enable_fast_install=yes fi @@ -7896,11 +8668,12 @@ fi 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) ;; @@ -7909,18 +8682,19 @@ if test "${with_aix_soname+set}" = set; then : ;; 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', @@ -8002,11 +8776,12 @@ if test -n "${ZSH_VERSION+set}"; then 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 @@ -8017,17 +8792,15 @@ else 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 @@ -8073,11 +8846,12 @@ test -z "$MAGIC_CMD" && MAGIC_CMD=file 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. @@ -8126,11 +8900,11 @@ fi 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 @@ -8139,11 +8913,12 @@ fi 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. @@ -8192,11 +8967,11 @@ fi 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 @@ -8281,11 +9056,12 @@ if test yes = "$GCC"; then 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 @@ -8316,8 +9092,8 @@ else $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" @@ -8674,26 +9450,28 @@ case $host_os in ;; 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 @@ -8724,8 +9502,8 @@ else $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 @@ -8753,11 +9531,12 @@ fi # 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" @@ -8781,8 +9560,8 @@ else 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 : @@ -8796,11 +9575,12 @@ fi - { $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 @@ -8843,19 +9623,20 @@ else $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 @@ -8898,8 +9679,8 @@ else $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; } @@ -8907,19 +9688,19 @@ $as_echo "$lt_cv_prog_compiler_c_o" >&6; } 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 @@ -8931,8 +9712,8 @@ fi - { $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= @@ -9488,21 +10269,23 @@ _LT_EOF 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/,/^$/ { @@ -9517,7 +10300,7 @@ if ac_fn_c_try_link "$LINENO"; then : 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 @@ -9541,21 +10324,23 @@ fi 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/,/^$/ { @@ -9570,7 +10355,7 @@ if ac_fn_c_try_link "$LINENO"; then : 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 @@ -9821,11 +10606,12 @@ fi # 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" @@ -9849,8 +10635,8 @@ else 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' @@ -9890,28 +10676,30 @@ fi # 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 @@ -10192,8 +10980,8 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; } 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 @@ -10229,18 +11017,19 @@ x|xyes) # 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 @@ -10258,7 +11047,7 @@ else 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 @@ -10272,8 +11061,8 @@ else $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 @@ -10432,8 +11221,8 @@ esac - { $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 @@ -10996,9 +11785,10 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) 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 @@ -11008,19 +11798,21 @@ else /* 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 @@ -11257,8 +12049,8 @@ uts4*) 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" @@ -11379,8 +12171,8 @@ configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH - { $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" || @@ -11404,8 +12196,8 @@ else # 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 @@ -11449,11 +12241,12 @@ else 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 @@ -11462,32 +12255,31 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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= @@ -11507,14 +12299,16 @@ fi *) 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 @@ -11523,41 +12317,42 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 @@ -11566,37 +12361,37 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 @@ -11605,37 +12400,37 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 @@ -11644,30 +12439,29 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 @@ -11706,11 +12500,12 @@ fi 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 @@ -11789,7 +12584,7 @@ _LT_EOF 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=$? @@ -11807,16 +12602,17 @@ rm -fr conftest* 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 @@ -11895,7 +12691,7 @@ _LT_EOF 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=$? @@ -11913,8 +12709,8 @@ rm -fr conftest* 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 @@ -11952,40 +12748,40 @@ fi 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 @@ -12003,13 +12799,13 @@ fi # 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 @@ -12033,15 +12829,15 @@ $as_echo_n "checking whether to build shared libraries... " >&6; } 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; } @@ -12080,11 +12876,12 @@ CC=$lt_save_CC 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 @@ -12092,11 +12889,15 @@ 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 + 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 @@ -12107,11 +12908,11 @@ fi 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 @@ -12120,11 +12921,12 @@ if test -z "$ac_cv_prog_RC"; then 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 @@ -12132,11 +12934,15 @@ 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 + 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 @@ -12147,11 +12953,11 @@ fi 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 @@ -12159,8 +12965,8 @@ fi 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 @@ -12248,10 +13054,17 @@ CC=$lt_save_CC 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 @@ -12268,11 +13081,12 @@ 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 +{ 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 @@ -12280,11 +13094,15 @@ 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 + 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 @@ -12295,11 +13113,11 @@ 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 @@ -12308,11 +13126,12 @@ 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 @@ -12320,11 +13139,15 @@ 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 + 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 @@ -12335,11 +13158,11 @@ fi 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 @@ -12347,8 +13170,8 @@ fi 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 @@ -12361,11 +13184,12 @@ if test -z "$CC"; then 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 @@ -12373,11 +13197,15 @@ 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 + 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 @@ -12388,11 +13216,11 @@ 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 @@ -12401,11 +13229,12 @@ fi 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 @@ -12414,15 +13243,19 @@ 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 - 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 @@ -12438,18 +13271,18 @@ if test $ac_prog_rejected = yes; then # 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 @@ -12460,11 +13293,12 @@ if test -z "$CC"; then 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 @@ -12472,11 +13306,15 @@ 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 + 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 @@ -12487,11 +13325,11 @@ 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 @@ -12504,11 +13342,12 @@ if test -z "$CC"; then 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 @@ -12516,11 +13355,15 @@ 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 + 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 @@ -12531,11 +13374,11 @@ fi 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 @@ -12547,8 +13390,8 @@ done 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 @@ -12556,25 +13399,129 @@ esac 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 -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +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; } # 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 @@ -12584,20 +13531,21 @@ $as_echo "$ac_try_echo"; } >&5 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 @@ -12607,29 +13555,33 @@ main () 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 @@ -12638,57 +13590,60 @@ else /* 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 @@ -12703,94 +13658,144 @@ else 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_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. */ +$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 + +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 + +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. */ -#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]; - -/* 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 **, 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; -} +$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 @@ -12799,6 +13804,12 @@ 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_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -12809,15 +13820,16 @@ if test -z "$CXX"; then 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 @@ -12825,11 +13837,15 @@ 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 + 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 @@ -12840,11 +13856,11 @@ fi 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 @@ -12853,15 +13869,16 @@ fi 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 @@ -12869,11 +13886,15 @@ 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 + 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 @@ -12884,11 +13905,11 @@ fi 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 @@ -12900,8 +13921,8 @@ done 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 @@ -12911,7 +13932,7 @@ fi 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 @@ -12921,7 +13942,7 @@ case "(($ac_try" in *) 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 @@ -12931,20 +13952,21 @@ $as_echo "$ac_try_echo"; } >&5 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 @@ -12954,29 +13976,33 @@ main () 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 @@ -12985,57 +14011,60 @@ else /* 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 @@ -13050,6 +14079,100 @@ else 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_cxx11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cxx_cxx11=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_cxx98+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cxx_cxx98=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' @@ -13074,36 +14197,32 @@ ac_cpp='$CXXCPP $CPPFLAGS' 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 @@ -13115,10 +14234,11 @@ rm -f conftest.err conftest.i conftest.$ac_ext /* 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 @@ -13128,7 +14248,8 @@ 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 : +if $ac_preproc_ok +then : break fi @@ -13140,29 +14261,24 @@ fi 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 @@ -13174,10 +14290,11 @@ rm -f conftest.err conftest.i conftest.$ac_ext /* 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 @@ -13187,11 +14304,12 @@ 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 : +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 @@ -13327,17 +14445,18 @@ cc_basename=$func_cc_basename_result # 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 @@ -13366,15 +14485,16 @@ $as_echo_n "checking for ld used by $CC... " >&6; } ;; 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 @@ -13403,18 +14523,19 @@ fi 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 &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 @@ -13480,8 +14601,8 @@ with_gnu_ld=$lt_cv_prog_gnu_ld 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*) @@ -13619,21 +14740,23 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie 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/,/^$/ { @@ -13648,7 +14771,7 @@ if ac_fn_cxx_try_link "$LINENO"; then : 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 @@ -13673,21 +14796,23 @@ fi 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/,/^$/ { @@ -13702,7 +14827,7 @@ if ac_fn_cxx_try_link "$LINENO"; then : 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 @@ -14554,8 +15679,8 @@ fi ;; 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 @@ -14593,7 +15718,7 @@ esac 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. @@ -15075,26 +16200,28 @@ case $host_os in ;; 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 @@ -15125,8 +16252,8 @@ else $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 @@ -15148,11 +16275,12 @@ fi # 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" @@ -15176,8 +16304,8 @@ else 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 : @@ -15188,11 +16316,12 @@ fi - { $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 @@ -15235,16 +16364,17 @@ else $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 @@ -15287,8 +16417,8 @@ else $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; } @@ -15296,19 +16426,19 @@ $as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } 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 @@ -15317,8 +16447,8 @@ fi - { $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]_.*' @@ -15357,8 +16487,8 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie ;; 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 @@ -15385,18 +16515,19 @@ x|xyes) # 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 @@ -15414,7 +16545,7 @@ else 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 @@ -15428,8 +16559,8 @@ else $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 @@ -15498,8 +16629,8 @@ esac - { $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' @@ -15989,9 +17120,10 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) 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 @@ -16001,19 +17133,21 @@ else /* 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 @@ -16250,8 +17384,8 @@ uts4*) 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" @@ -16315,8 +17449,8 @@ configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH - { $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" || @@ -16340,8 +17474,8 @@ else # 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 @@ -16380,7 +17514,81 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -# Find a good install program. We prefer a C program (faster), +{ 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 @@ -16394,20 +17602,25 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # 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; } +{ 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 ${ac_cv_path_install+:} false; then : - $as_echo_n "(cached) " >&6 -else +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/* ) ;; @@ -16417,13 +17630,13 @@ case $as_dir/ in #(( # 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 @@ -16431,12 +17644,12 @@ case $as_dir/ in #(( 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 @@ -16452,7 +17665,7 @@ IFS=$as_save_IFS 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 @@ -16462,8 +17675,8 @@ fi 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. @@ -16473,13 +17686,14 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' 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: @@ -16495,12 +17709,12 @@ esac 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 @@ -16515,11 +17729,12 @@ if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then 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. @@ -16529,11 +17744,15 @@ else 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 @@ -16545,11 +17764,11 @@ esac 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 @@ -16558,11 +17777,12 @@ if test -z "$ac_cv_path_PKG_CONFIG"; then 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. @@ -16572,11 +17792,15 @@ else 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 @@ -16588,11 +17812,11 @@ esac 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 @@ -16600,8 +17824,8 @@ fi 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 @@ -16613,18 +17837,223 @@ fi 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 --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) @@ -16672,27 +18101,28 @@ case "$host" in # 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 @@ -16764,16 +18194,17 @@ find_lib() 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 @@ -16786,7 +18217,7 @@ main () /* 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 */ @@ -16814,7 +18245,7 @@ main () 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; @@ -16830,47 +18261,50 @@ main () 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) ;; @@ -16887,16 +18321,17 @@ _ACEOF ;; 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; @@ -16906,26 +18341,28 @@ return !x && !y; 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 @@ -16934,22 +18371,22 @@ case "$enable_assertions" in ;; 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 ;; *) @@ -16957,17 +18394,20 @@ $as_echo "#define SDL_DEFAULT_ASSERT_LEVEL 3" >>confdefs.h ;; 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. */ @@ -16976,32 +18416,32 @@ $as_echo_n "checking for GCC -MMD -MT option... " >&6; } #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*) + *-*-openbsd*) ;; - *) save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -Wl,--no-undefined" @@ -17009,29 +18449,30 @@ case "$host" in /* 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 *) @@ -17041,29 +18482,30 @@ case "$host" in /* 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 *) @@ -17073,29 +18515,30 @@ case "$host" in /* 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 *) @@ -17105,184 +18548,304 @@ case "$host" in /* 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 + + 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 + +fi +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 + +fi +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 + +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 + +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 + +fi +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 + +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 + +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 + +fi +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 +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 + +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 + +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 + +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 : + +else $as_nop + +printf "%s\n" "#define size_t unsigned int" >>confdefs.h + +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 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 -#include -#include -#include - -int -main () -{ - - ; - return 0; -} +#include + Syntax error _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 ac_fn_c_try_cpp "$LINENO" +then : -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. +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 - +#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 - - 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 - +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.err conftest.i conftest.$ac_ext done - - - 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 : - -else - -cat >>confdefs.h <<_ACEOF -#define size_t unsigned int -_ACEOF - +# 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 - { $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 +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 +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 @@ -17291,40 +18854,38 @@ YES_IS_DEFINED _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "YES_IS_DEFINED" >/dev/null 2>&1; then : + $EGREP "YES_IS_DEFINED" >/dev/null 2>&1 +then : ac_cv_define_M_PI=yes -else +else $as_nop ac_cv_define_M_PI=no fi -rm -f conftest* +rm -rf conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_define_M_PI" >&5 -$as_echo "$ac_cv_define_M_PI" >&6; } +{ 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 - case "$host" in - *-*-cygwin* | *-*-mingw*) - ;; - *) - # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works + # 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; @@ -17332,52 +18893,52 @@ char *p = (char *) alloca (2 * sizeof (int)); 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; @@ -17385,20 +18946,24 @@ char *p = (char *) alloca (1); 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; } + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 +printf "%s\n" "$ac_cv_func_alloca_works" >&6; } 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 @@ -17408,58 +18973,19 @@ else ALLOCA=\${LIBOBJDIR}alloca.$ac_objext -$as_echo "#define C_ALLOCA 1" >>confdefs.h +printf "%s\n" "#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 - - 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 @@ -17480,9 +19006,10 @@ main (int argc, char **argv) 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 \ @@ -17490,31 +19017,29 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 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 - ;; - esac - { $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. */ @@ -17545,9 +19070,10 @@ main () 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 \ @@ -17555,8 +19081,8 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 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" @@ -17566,17 +19092,19 @@ esac 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. */ @@ -17585,7 +19113,7 @@ $ac_includes_default double strtod (); #endif int -main() +main (void) { { /* Some versions of Linux strtod mis-parse strings with leading '+'. */ @@ -17610,9 +19138,10 @@ main() } _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 \ @@ -17620,8 +19149,8 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strtod" >&5 -$as_echo "$ac_cv_func_strtod" >&6; } +{ 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 "* ) ;; @@ -17630,16 +19159,18 @@ if test $ac_cv_func_strtod = no; then esac ac_fn_c_check_func "$LINENO" "pow" "ac_cv_func_pow" -if test "x$ac_cv_func_pow" = xyes; then : +if test "x$ac_cv_func_pow" = xyes +then : fi 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 + { 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 @@ -17648,34 +19179,33 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 : +{ 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_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;} +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 @@ -17684,11 +19214,12 @@ fi if test x$ac_cv_func_strtod = xyes; then -$as_echo "#define HAVE_STRTOD 1" >>confdefs.h +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 : +if test "x$ac_cv_func_mprotect" = xyes +then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -17696,41 +19227,458 @@ if test "x$ac_cv_func_mprotect" = xyes; then : #include 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 HAVE_MPROTECT 1" >>confdefs.h +printf "%s\n" "#define HAVE_MPROTECT 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 - 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 + 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 +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 + +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 fi -done - { $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 + { 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 @@ -17739,51 +19687,292 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 : +{ 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 - 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 + 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 + +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 + +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" "atanf" "ac_cv_func_atanf" +if test "x$ac_cv_func_atanf" = xyes +then : + printf "%s\n" "#define HAVE_ATANF 1" >>confdefs.h + +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 + +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 + +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 + +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 +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 + +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 +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 + +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 + +fi +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 +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 + +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 +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 + +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 -done - { $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 + { 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 @@ -17792,85 +19981,77 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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; @@ -17885,17 +20066,18 @@ main () 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 @@ -17903,7 +20085,7 @@ $as_echo "#define HAVE_GCC_ATOMICS 1" >>confdefs.h /* end confdefs.h. */ int -main () +main (void) { int a; @@ -17914,14 +20096,15 @@ main () 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 @@ -17953,244 +20136,296 @@ SOURCES="$SOURCES $srcdir/src/video/yuv2rgb/*.c" SOURCES="$SOURCES $srcdir/src/locale/*.c" +case "$host" in + *-*-emscripten*) + default_atomic=no + ;; + *) + default_atomic=yes + ;; +esac + # Check whether --enable-atomic was given. -if test "${enable_atomic+set}" = set; then : +if test ${enable_atomic+y} +then : enableval=$enable_atomic; -else - enable_atomic=yes +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 : +if test ${enable_threads+y} +then : enableval=$enable_threads; -else +else $as_nop enable_threads=yes fi 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-loadso was given. -if test "${enable_loadso+set}" = set; then : - enableval=$enable_loadso; +# Check whether --enable-misc was given. +if test ${enable_misc+y} +then : + enableval=$enable_misc; +else $as_nop + enable_misc=yes +fi + +if test x$enable_misc != xyes; then + +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+y} +then : + enableval=$enable_locale; +else $as_nop + enable_locale=yes +fi + +if test x$enable_locale != xyes; then + +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+y} +then : + enableval=$enable_loadso; +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 @@ -18207,9 +20442,10 @@ $as_echo "#define SDL_ASSEMBLY_ROUTINES 1" >>confdefs.h ;; 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 @@ -18219,18 +20455,19 @@ fi fi fi - # Check whether --enable-mmx was given. -if test "${enable_mmx+set}" = set; then : + # Check whether --enable-mmx was given. +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" @@ -18252,19 +20489,20 @@ $as_echo_n "checking for GCC -mmmx option... " >&6; } #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 @@ -18274,17 +20512,18 @@ $as_echo "$have_gcc_mmx" >&6; } 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" @@ -18297,7 +20536,7 @@ $as_echo_n "checking for GCC -m3dnow option... " >&6; } #endif int -main () +main (void) { void *p = 0; @@ -18307,13 +20546,14 @@ main () 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 @@ -18323,17 +20563,18 @@ $as_echo "$have_gcc_3dnow" >&6; } 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" @@ -18355,19 +20596,20 @@ $as_echo_n "checking for GCC -msse option... " >&6; } #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 @@ -18377,17 +20619,18 @@ $as_echo "$have_gcc_sse" >&6; } 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" @@ -18409,19 +20652,20 @@ $as_echo_n "checking for GCC -msse2 option... " >&6; } #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 @@ -18431,17 +20675,18 @@ $as_echo "$have_gcc_sse2" >&6; } 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" @@ -18463,19 +20708,20 @@ $as_echo_n "checking for GCC -msse3 option... " >&6; } #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 @@ -18484,37 +20730,39 @@ $as_echo "$have_gcc_sse3" >&6; } 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 @@ -18525,8 +20773,8 @@ fi 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. */ @@ -18536,26 +20784,27 @@ $as_echo_n "checking for Altivec with GCC altivec.h and -maltivec option... " >& } 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. */ @@ -18564,24 +20813,25 @@ $as_echo_n "checking for Altivec with GCC -maltivec option... " >&6; } } 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 @@ -18593,27 +20843,28 @@ $as_echo_n "checking for Altivec with GCC altivec.h and -faltivec option... " >& } 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. */ @@ -18622,29 +20873,30 @@ $as_echo_n "checking for Altivec with GCC -faltivec option... " >&6; } } 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 CFLAGS="$save_CFLAGS" if test x$have_gcc_altivec = xyes; then -$as_echo "#define SDL_ALTIVEC_BLITTERS 1" >>confdefs.h +printf "%s\n" "#define SDL_ALTIVEC_BLITTERS 1" >>confdefs.h if test x$have_altivec_h_hdr = xyes; then -$as_echo "#define HAVE_ALTIVEC_H 1" >>confdefs.h +printf "%s\n" "#define HAVE_ALTIVEC_H 1" >>confdefs.h fi EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS" @@ -18653,12 +20905,161 @@ $as_echo "#define HAVE_ALTIVEC_H 1" >>confdefs.h 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_lasxintrin_h_hdr=yes +else $as_nop + have_lasxintrin_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_lasxintrin_h_hdr" >&5 +printf "%s\n" "$have_lasxintrin_h_hdr" >&6; } + if test x$have_lasxintrin_h_hdr = xyes; then + +printf "%s\n" "#define HAVE_LASXINTRIN_H 1" >>confdefs.h + + 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 @@ -18675,8 +21076,8 @@ fi 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 @@ -18685,7 +21086,7 @@ $as_echo_n "checking for OSS audio support... " >&6; } #include int -main () +main (void) { int arg = SNDCTL_DSP_SETFRAGMENT; @@ -18694,10 +21095,11 @@ main () 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 @@ -18706,7 +21108,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext #include int -main () +main (void) { int arg = SNDCTL_DSP_SETFRAGMENT; @@ -18715,22 +21117,23 @@ main () 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 @@ -18747,9 +21150,10 @@ $as_echo "#define SDL_AUDIO_DRIVER_OSS 1" >>confdefs.h 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 @@ -18761,41 +21165,44 @@ alsa_found=yes # 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" @@ -18807,12 +21214,12 @@ LIBS=`echo $LIBS | sed 's/-ldl//'` 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/'` @@ -18833,7 +21240,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #include int -main () +main (void) { /* ensure backward compatibility */ @@ -18872,17 +21279,18 @@ exit(0); 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' @@ -18891,11 +21299,12 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu 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 @@ -18904,37 +21313,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 @@ -18966,31 +21372,30 @@ fi 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 @@ -19005,26 +21410,27 @@ _ACEOF 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 @@ -19038,10 +21444,10 @@ if test -n "$JACK_LIBS"; then 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 @@ -19055,8 +21461,8 @@ fi 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 @@ -19073,44 +21479,43 @@ fi 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)" @@ -19133,33 +21538,37 @@ _ACEOF 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 @@ -19179,11 +21588,12 @@ fi # 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. @@ -19193,11 +21603,15 @@ else 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 @@ -19210,17 +21624,17 @@ esac 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 @@ -19246,9 +21660,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu 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. */ @@ -19287,9 +21702,10 @@ int main (void) } _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 \ @@ -19307,12 +21723,12 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu 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" @@ -19338,14 +21754,15 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu #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" @@ -19355,13 +21772,13 @@ if ac_fn_c_try_link "$LINENO"; then : 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" @@ -19383,31 +21800,30 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu 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 @@ -19422,26 +21838,27 @@ _ACEOF 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 @@ -19455,10 +21872,10 @@ if test -n "$PIPEWIRE_LIBS"; then 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 @@ -19472,8 +21889,8 @@ fi 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 @@ -19490,44 +21907,43 @@ fi 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 @@ -19542,26 +21958,27 @@ _ACEOF 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 @@ -19575,10 +21992,10 @@ if test -n "$PULSEAUDIO_LIBS"; then 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 @@ -19592,8 +22009,8 @@ fi 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 @@ -19610,44 +22027,43 @@ fi 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)" @@ -19670,20 +22086,22 @@ _ACEOF 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. @@ -19693,11 +22111,15 @@ else 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 @@ -19709,11 +22131,11 @@ esac 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 @@ -19722,8 +22144,8 @@ fi 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" @@ -19733,7 +22155,7 @@ $as_echo_n "checking for aRts development environment... " >&6; } #include int -main () +main (void) { arts_stream_t stream; @@ -19742,40 +22164,40 @@ main () 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 @@ -19791,24 +22213,26 @@ _ACEOF 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 @@ -19817,36 +22241,35 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 @@ -19860,14 +22283,15 @@ $as_echo_n "checking for NAS audio support... " >&6; } 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 @@ -19875,16 +22299,14 @@ fi 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 @@ -19893,7 +22315,7 @@ _ACEOF 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" @@ -19905,24 +22327,26 @@ $as_echo "#define SDL_AUDIO_DRIVER_NAS 1" >>confdefs.h 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 @@ -19931,36 +22355,35 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 @@ -19968,14 +22391,15 @@ $as_echo_n "checking for sndio audio support... " >&6; } 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 @@ -19983,16 +22407,14 @@ fi 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 @@ -20001,7 +22423,7 @@ _ACEOF 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" @@ -20013,26 +22435,27 @@ $as_echo "#define SDL_AUDIO_DRIVER_SNDIO 1" >>confdefs.h 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 @@ -20046,10 +22469,10 @@ if test -n "$FUSIONSOUND_LIBS"; then 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 @@ -20063,8 +22486,8 @@ fi 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 @@ -20081,45 +22504,44 @@ fi 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)" @@ -20127,8 +22549,8 @@ _ACEOF 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 @@ -20138,66 +22560,72 @@ $as_echo "$fusionsound_shared" >&6; } 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" + have_audio=yes fi } 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" + have_audio=yes fi } 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 @@ -20206,16 +22634,14 @@ fi 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" @@ -20227,9 +22653,10 @@ _ACEOF 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 @@ -20238,8 +22665,8 @@ fi 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. */ @@ -20255,18 +22682,19 @@ $as_echo_n "checking for ARM SIMD... " >&6; } 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" @@ -20277,9 +22705,10 @@ $as_echo "#define SDL_ARM_SIMD_BLITTERS 1" >>confdefs.h 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 @@ -20288,8 +22717,8 @@ fi 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. */ @@ -20307,17 +22736,18 @@ $as_echo_n "checking for ARM NEON... " >&6; } 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" @@ -20325,10 +22755,45 @@ $as_echo "#define SDL_ARM_NEON_BLITTERS 1" >>confdefs.h 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" @@ -20342,19 +22807,20 @@ $as_echo_n "checking for GCC -fvisibility=hidden option... " >&6; } #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 @@ -20364,8 +22830,8 @@ $as_echo "$have_gcc_fvisibility" >&6; } 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" @@ -20376,19 +22842,20 @@ $as_echo_n "checking for GCC -fno-strict-aliasing option... " >&6; } 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 @@ -20398,8 +22865,8 @@ $as_echo "$have_gcc_no_strict_aliasing" >&6; } 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" @@ -20410,19 +22877,20 @@ $as_echo_n "checking for GCC -mpreferred-stack-boundary option... " >&6; } 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 @@ -20432,8 +22900,8 @@ $as_echo "$have_gcc_preferred_stack_boundary" >&6; } 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" @@ -20444,19 +22912,20 @@ $as_echo_n "checking for GCC -Wdeclaration-after-statement option... " >&6; } 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 @@ -20466,8 +22935,8 @@ $as_echo "$have_gcc_declaration_after_statement" >&6; } 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" @@ -20478,34 +22947,35 @@ $as_echo_n "checking for GCC -Wall option... " >&6; } 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 @@ -20515,49 +22985,52 @@ $as_echo "$need_gcc_Wno_multichar" >&6; } 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 - if $PKG_CONFIG --exists wayland-client wayland-scanner wayland-egl wayland-cursor egl 'xkbcommon >= 0.5.0'; then + if $PKG_CONFIG --exists 'wayland-client >= 1.18' wayland-scanner wayland-egl wayland-cursor egl 'xkbcommon >= 0.5.0'; then 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 @@ -20565,9 +23038,10 @@ $as_echo "#define SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 1" >>confdefs.h 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 @@ -20577,7 +23051,8 @@ fi wayland_client_lib=`find_lib "libwayland-client.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` wayland_egl_lib=`find_lib "libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` if test x$wayland_egl_lib = x; then - wayland_egl_lib=`find_lib "mesa-egl/libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` + # This works in Ubuntu 13.10, maybe others + wayland_egl_lib=`find_lib "mesa-egl/libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` fi wayland_cursor_lib=`find_lib "libwayland-cursor.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` xkbcommon_lib=`find_lib "libxkbcommon.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` @@ -20589,8 +23064,8 @@ fi 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 && \ @@ -20604,24 +23079,16 @@ $as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic Wa 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 @@ -20632,58 +23099,118 @@ _ACEOF 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 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libdecor support" >&5 -$as_echo_n "checking for libdecor support... " >&6; } - if $PKG_CONFIG --exists libdecor-0; then : - video_libdecor=yes -else - video_libdecor=no -fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_libdecor" >&5 -$as_echo "$video_libdecor" >&6; } - if test x$video_libdecor = xyes; then - EXTRA_CFLAGS="$EXTRA_CFLAGS `$PKG_CONFIG --cflags libdecor-0`" -$as_echo "#define HAVE_LIBDECOR_H 1" >>confdefs.h +pkg_failed=no +{ 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" && \ + { { 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=$? + 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 +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$DECOR_LIBS"; then + pkg_cv_DECOR_LIBS="$DECOR_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { 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=$? + 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 +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { 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 +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + DECOR_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libdecor-0" 2>&1` + else + DECOR_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libdecor-0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$DECOR_PKG_ERRORS" >&5 + + video_libdecor=no +elif test $pkg_failed = untried; then + { 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 + { 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" + +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 + decor_lib=`find_lib "libdecor-0.so.*" "$DECOR_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` + if test x$enable_wayland_shared != xyes; then enable_libdecor_shared=no fi - - decor_lib=`find_lib "libdecor-0.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'` - 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 `$PKG_CONFIG --libs libdecor-0`" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DECOR_LIBS" fi fi fi @@ -20701,32 +23228,33 @@ CheckNativeClient() #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" @@ -20734,36 +23262,39 @@ $as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h SDLMAIN_SOURCES="$srcdir/src/main/nacl/*.c" SOURCES="$SOURCES $srcdir/src/audio/nacl/*.c" SUMMARY_audio="${SUMMARY_audio} nacl" + have_audio=yes SOURCES="$SOURCES $srcdir/src/video/nacl/*.c" SUMMARY_video="${SUMMARY_video} nacl opengles2" + 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 @@ -20777,10 +23308,10 @@ if test -n "$RPI_LIBS"; then 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 @@ -20794,8 +23325,8 @@ fi 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 @@ -20812,14 +23343,14 @@ fi 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 @@ -20839,8 +23370,8 @@ fi # 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. */ @@ -20849,7 +23380,7 @@ $as_echo_n "checking for Raspberry Pi 2/3... " >&6; } #include int -main () +main (void) { EGL_DISPMANX_WINDOW_T window; @@ -20859,13 +23390,14 @@ main () 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" @@ -20877,9 +23409,10 @@ $as_echo "$have_video_rpi" >&6; } 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 fi fi } @@ -20887,9 +23420,10 @@ $as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h 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 @@ -20906,12 +23440,13 @@ fi 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 @@ -20922,9 +23457,10 @@ if test "x$with_x" = xno; then 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 @@ -20935,24 +23471,26 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 @@ -21042,10 +23580,11 @@ if test "$ac_x_includes" = no; then /* 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 @@ -21066,20 +23605,21 @@ if test "$ac_x_libraries" = no; then /* 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 @@ -21090,7 +23630,7 @@ do 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 @@ -21114,8 +23654,8 @@ fi 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. @@ -21125,14 +23665,14 @@ else 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 @@ -21145,8 +23685,8 @@ else 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 @@ -21154,42 +23694,44 @@ $as_echo_n "checking whether -R must be followed by a space... " >&6; } /* 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 @@ -21212,26 +23754,25 @@ rm -f core conftest.err conftest.$ac_objext \ /* 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 @@ -21240,39 +23781,39 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 @@ -21281,36 +23822,35 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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" @@ -21323,16 +23863,18 @@ rm -f core conftest.err conftest.$ac_objext \ # 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 @@ -21341,39 +23883,39 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 @@ -21382,30 +23924,29 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 @@ -21420,16 +23961,18 @@ fi # 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 @@ -21438,30 +23981,29 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 @@ -21469,16 +24011,18 @@ fi # 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 @@ -21487,30 +24031,29 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 @@ -21518,16 +24061,18 @@ fi # 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 @@ -21536,30 +24081,29 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 @@ -21575,11 +24119,12 @@ fi # 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 @@ -21588,30 +24133,29 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 @@ -21621,9 +24165,10 @@ fi 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 @@ -21634,37 +24179,31 @@ fi 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 @@ -21678,13 +24217,13 @@ fi #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? @@ -21692,7 +24231,7 @@ fi 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" @@ -21705,8 +24244,8 @@ $as_echo "#define SDL_VIDEO_DRIVER_X11 1" >>confdefs.h 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 && \ @@ -21714,14 +24253,10 @@ $as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic X1 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 @@ -21731,8 +24266,8 @@ _ACEOF 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. */ @@ -21740,7 +24275,7 @@ $as_echo_n "checking for XGenericEvent... " >&6; } #include int -main () +main (void) { Display *display; @@ -21754,23 +24289,25 @@ XFreeEventData(display, cookie); 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 @@ -21779,40 +24316,40 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 @@ -21821,28 +24358,27 @@ fi 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 @@ -21851,30 +24387,29 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 @@ -21887,14 +24422,15 @@ fi 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 @@ -21902,106 +24438,25 @@ fi 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 @@ -22010,28 +24465,27 @@ fi 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 @@ -22040,30 +24494,29 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 @@ -22077,10 +24530,10 @@ fi 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. */ @@ -22090,7 +24543,7 @@ $as_echo_n "checking for xinput2 multitouch... " >&6; } #include int -main () +main (void) { int event_type = XI_TouchBegin; @@ -22100,31 +24553,33 @@ XITouchClassInfo *t; 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. */ @@ -22133,36 +24588,36 @@ $as_echo_n "checking for X11/extensions/Xfixes.h... " >&6; } #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 @@ -22171,30 +24626,29 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 @@ -22207,19 +24661,20 @@ fi 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 if test x$enable_video_x11_xrandr = xyes; then - definitely_enable_video_x11_xrandr=no + definitely_enable_video_x11_xrandr=no have_xrandr_h_hdr=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -22228,7 +24683,7 @@ fi #include int -main () +main (void) { XRRScreenResources *res = NULL; @@ -22237,25 +24692,25 @@ main () 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 @@ -22264,30 +24719,29 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 @@ -22300,14 +24754,15 @@ fi 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 @@ -22315,28 +24770,27 @@ fi 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 @@ -22345,30 +24799,29 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 @@ -22381,14 +24834,15 @@ fi 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 @@ -22396,102 +24850,20 @@ fi 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 @@ -22503,15 +24875,16 @@ $as_echo "#define SDL_VIDEO_DRIVER_X11_XVIDMODE 1" >>confdefs.h 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. */ @@ -22521,22 +24894,23 @@ $as_echo_n "checking for Vivante VDK API... " >&6; } #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. */ @@ -22546,28 +24920,29 @@ $as_echo_n "checking for Vivante FB API... " >&6; } #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 @@ -22582,7 +24957,7 @@ CheckHaikuVideo() { 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 @@ -22593,17 +24968,18 @@ $as_echo "#define SDL_VIDEO_DRIVER_HAIKU 1" >>confdefs.h 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; } + CFLAGS="$CFLAGS -x objective-c" + { 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. */ @@ -22611,23 +24987,24 @@ $as_echo_n "checking for Cocoa framework... " >&6; } #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" @@ -22639,24 +25016,26 @@ $as_echo "#define SDL_VIDEO_DRIVER_COCOA 1" >>confdefs.h 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; } + CFLAGS="$CFLAGS -x objective-c" + { 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. */ @@ -22670,27 +25049,28 @@ $as_echo_n "checking for Metal framework... " >&6; } #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 @@ -22705,26 +25085,27 @@ $as_echo "#define SDL_VIDEO_RENDER_METAL 1" >>confdefs.h 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 @@ -22738,10 +25119,10 @@ if test -n "$DIRECTFB_LIBS"; then 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 @@ -22755,8 +25136,8 @@ fi 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 @@ -22773,14 +25154,14 @@ fi 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 @@ -22788,32 +25169,33 @@ fi # 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" @@ -22822,17 +25204,15 @@ $as_echo "#define SDL_VIDEO_RENDER_DIRECTFB 1" >>confdefs.h 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 @@ -22848,9 +25228,10 @@ _ACEOF 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 @@ -22863,17 +25244,17 @@ fi 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 @@ -22887,10 +25268,10 @@ if test -n "$LIBDRM_LIBS"; then 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 @@ -22904,8 +25285,8 @@ fi 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 @@ -22922,29 +25303,29 @@ fi 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 @@ -22958,10 +25339,10 @@ if test -n "$LIBGBM_LIBS"; then 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 @@ -22975,8 +25356,8 @@ fi 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 @@ -22993,14 +25374,14 @@ fi 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 @@ -23010,54 +25391,49 @@ fi 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" @@ -23070,15 +25446,16 @@ $as_echo "$kmsdrm_shared" >&6; } 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 @@ -23089,15 +25466,16 @@ $as_echo "#define SDL_VIDEO_DRIVER_DUMMY 1" >>confdefs.h 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 @@ -23109,7 +25487,7 @@ CheckQNXVideo() { 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 @@ -23122,7 +25500,7 @@ CheckQNXAudio() { 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 @@ -23132,9 +25510,10 @@ $as_echo "#define SDL_AUDIO_DRIVER_QSA 1" >>confdefs.h } # 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 @@ -23142,8 +25521,8 @@ fi 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. */ @@ -23151,48 +25530,52 @@ $as_echo_n "checking for GLX support... " >&6; } #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 @@ -23200,8 +25583,8 @@ fi 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. */ @@ -23214,22 +25597,23 @@ $as_echo_n "checking for EGL support... " >&6; } #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 @@ -23238,8 +25622,8 @@ $as_echo "#define SDL_VIDEO_OPENGL_EGL 1" >>confdefs.h 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. */ @@ -23248,25 +25632,26 @@ $as_echo_n "checking for OpenGL headers... " >&6; } #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 @@ -23277,8 +25662,8 @@ CheckOpenGLES() { 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. */ @@ -23287,33 +25672,34 @@ $as_echo_n "checking for OpenGL ES v1 headers... " >&6; } #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. */ @@ -23322,25 +25708,26 @@ $as_echo_n "checking for OpenGL ES v2 headers... " >&6; } #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 @@ -23352,13 +25739,13 @@ CheckWINDOWSGL() { 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 @@ -23368,8 +25755,8 @@ CheckWINDOWSGLES() { 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. */ @@ -23377,31 +25764,32 @@ $as_echo_n "checking for EGL support... " >&6; } #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. */ @@ -23410,28 +25798,29 @@ $as_echo_n "checking for OpenGL ES v2 headers... " >&6; } #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 @@ -23442,13 +25831,13 @@ CheckHaikuGL() { 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" @@ -23459,13 +25848,13 @@ CheckMacGL() { 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 @@ -23476,14 +25865,14 @@ CheckMacGLES() 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 @@ -23492,8 +25881,8 @@ $as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h 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. */ @@ -23501,27 +25890,28 @@ $as_echo_n "checking for EGL support... " >&6; } #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. */ @@ -23530,25 +25920,26 @@ $as_echo_n "checking for OpenGL ES v2 headers... " >&6; } #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 @@ -23556,9 +25947,10 @@ $as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h } # 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 @@ -23576,23 +25968,24 @@ CheckVulkan() #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" - CFLAGS="$CFLAGS -x objective-c" + CFLAGS="$CFLAGS -x objective-c" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -23605,19 +25998,20 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext #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" ;; *) @@ -23626,18 +26020,18 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 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 @@ -23645,8 +26039,8 @@ $as_echo "#define SDL_VIDEO_VULKAN 1" >>confdefs.h 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. */ @@ -23654,7 +26048,7 @@ $as_echo_n "checking for Linux 2.4 unified input interface... " >&6; } #include int -main () +main (void) { #ifndef EVIOCGNAME @@ -23665,15 +26059,16 @@ main () 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 @@ -23681,9 +26076,8 @@ $as_echo "#define SDL_INPUT_LINUXEV 1" >>confdefs.h 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. */ @@ -23692,7 +26086,7 @@ $as_echo_n "checking for Linux kd.h... " >&6; } #include int -main () +main (void) { struct kbentry kbe; @@ -23703,15 +26097,16 @@ main () 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 @@ -23719,8 +26114,8 @@ $as_echo "#define SDL_INPUT_LINUXKD 1" >>confdefs.h 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. */ @@ -23729,7 +26124,7 @@ $as_echo_n "checking for FreeBSD kbio.h... " >&6; } #include int -main () +main (void) { accentmap_t accTable; @@ -23739,15 +26134,16 @@ main () 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 @@ -23755,8 +26151,8 @@ $as_echo "#define SDL_INPUT_FBSDKBIO 1" >>confdefs.h 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. */ @@ -23768,7 +26164,7 @@ $as_echo_n "checking for OpenBSD wscons... " >&6; } #include int -main () +main (void) { struct wskbd_map_data data; @@ -23778,15 +26174,16 @@ main () 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 @@ -23795,33 +26192,32 @@ $as_echo "#define SDL_INPUT_WSCONS 1" >>confdefs.h 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 @@ -23831,26 +26227,27 @@ _ACEOF 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 @@ -23864,10 +26261,10 @@ if test -n "$DBUS_LIBS"; then 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 @@ -23881,8 +26278,8 @@ fi 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 @@ -23899,30 +26296,30 @@ fi 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" @@ -23933,15 +26330,16 @@ $as_echo "#define HAVE_DBUS_DBUS_H 1" >>confdefs.h 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 @@ -23954,43 +26352,37 @@ CheckInotify() *-*-freebsd*) 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*) @@ -24004,26 +26396,27 @@ $as_echo "#define HAVE_INOTIFY 1" >>confdefs.h 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 @@ -24037,10 +26430,10 @@ if test -n "$IBUS_LIBS"; then 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 @@ -24054,8 +26447,8 @@ fi 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 @@ -24072,43 +26465,43 @@ fi 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" @@ -24120,40 +26513,42 @@ $as_echo "#define HAVE_IBUS_IBUS_H 1" >>confdefs.h 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 @@ -24161,10 +26556,10 @@ fi if test x$enable_joystick_mfi = xyes; then save_CFLAGS="$CFLAGS" save_LDFLAGS="$LDFLAGS" - CFLAGS="$CFLAGS -x objective-c -fobjc-weak" + 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. */ @@ -24174,7 +26569,7 @@ $as_echo_n "checking for GameController framework... " >&6; } #import int -main () +main (void) { #if MAC_OS_X_VERSION_MIN_REQUIRED < 1080 @@ -24188,19 +26583,20 @@ main () 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" @@ -24222,16 +26618,18 @@ CheckPTHREAD() 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 : + # Check whether --enable-pthread-sem was given. +if test ${enable_pthread_sem+y} +then : enableval=$enable_pthread_sem; -else +else $as_nop enable_pthread_sem=maybe fi @@ -24323,8 +26721,8 @@ fi # 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. */ @@ -24332,7 +26730,7 @@ $as_echo_n "checking for pthreads... " >&6; } #include int -main () +main (void) { pthread_attr_t type; @@ -24342,20 +26740,21 @@ main () 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" @@ -24367,8 +26766,8 @@ $as_echo "#define SDL_THREAD_PTHREAD 1" >>confdefs.h 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 @@ -24378,7 +26777,7 @@ $as_echo_n "checking for recursive mutexes... " >&6; } #include int -main () +main (void) { pthread_mutexattr_t attr; @@ -24388,15 +26787,16 @@ main () 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 @@ -24407,7 +26807,7 @@ rm -f core conftest.err conftest.$ac_objext \ #include int -main () +main (void) { pthread_mutexattr_t attr; @@ -24417,24 +26817,25 @@ main () 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. */ @@ -24443,23 +26844,24 @@ $as_echo_n "checking for pthread semaphores... " >&6; } #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. */ @@ -24468,7 +26870,7 @@ $as_echo_n "checking for sem_timedwait... " >&6; } #include int -main () +main (void) { sem_timedwait(NULL, NULL); @@ -24477,109 +26879,106 @@ main () 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" @@ -24613,8 +27012,8 @@ $as_echo "$has_pthread_set_name_np" >&6; } 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. */ @@ -24622,27 +27021,28 @@ $as_echo_n "checking Windows compiler... " >&6; } #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. */ @@ -24652,14 +27052,15 @@ $as_echo_n "checking Windows CE... " >&6; } #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 $? " @@ -24667,36 +27068,72 @@ if ac_fn_c_try_compile "$LINENO"; then : " "$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_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 + +printf "%s\n" "#define HAVE_TPCSHRD_H 1" >>confdefs.h + + fi + 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 + +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! @@ -24707,68 +27144,99 @@ $as_echo "$have_os2_gcc" >&6; } 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. */ - 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 : +#include +#include +#include +ID3D12Device1 *device; +#if WDK_NTDDI_VERSION <= 0x0A000008 +asdf +#endif + +int +main (void) +{ + + ; + 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 @@ -24782,23 +27250,24 @@ $as_echo "#define HAVE_DXGI_H 1" >>confdefs.h 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. */ @@ -24807,21 +27276,22 @@ $as_echo_n "checking for struct XINPUT_GAMEPAD_EX... " >&6; } 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. */ @@ -24830,39 +27300,40 @@ $as_echo_n "checking for struct XINPUT_STATE_EX... " >&6; } 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. */ @@ -24871,57 +27342,59 @@ $as_echo_n "checking for windows.gaming.input.h... " >&6; } __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 @@ -24930,24 +27403,25 @@ fi 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 @@ -24956,37 +27430,37 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 @@ -24995,47 +27469,46 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 @@ -25045,8 +27518,8 @@ $as_echo "#define SDL_LOADSO_DLOPEN 1" >>confdefs.h 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. */ @@ -25054,24 +27527,25 @@ $as_echo_n "checking for O_CLOEXEC... " >&6; } 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 } @@ -25081,11 +27555,12 @@ CheckUSBHID() 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 @@ -25094,65 +27569,65 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 @@ -25161,30 +27636,29 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 @@ -25193,8 +27667,8 @@ fi 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. */ @@ -25219,7 +27693,7 @@ $as_echo_n "checking for usbhid... " >&6; } #endif int -main () +main (void) { struct report_desc *repdesc; @@ -25230,16 +27704,17 @@ main () 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. */ @@ -25264,7 +27739,7 @@ $as_echo_n "checking for ucr_data member of usb_ctl_report... " >&6; } #endif int -main () +main (void) { struct usb_ctl_report buf; @@ -25274,18 +27749,19 @@ main () 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. */ @@ -25310,7 +27786,7 @@ $as_echo_n "checking for new usbhid API... " >&6; } #endif int -main () +main (void) { report_desc_t d; @@ -25320,18 +27796,19 @@ main () 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. */ @@ -25339,7 +27816,7 @@ $as_echo_n "checking for struct joystick in machine/joystick.h... " >&6; } #include int -main () +main (void) { struct joystick t; @@ -25348,20 +27825,21 @@ main () 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" @@ -25378,16 +27856,18 @@ $as_echo "#define SDL_JOYSTICK_USBHID 1" >>confdefs.h 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 @@ -25412,17 +27892,17 @@ fi 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 @@ -25436,10 +27916,10 @@ if test -n "$LIBUSB_LIBS"; then 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 @@ -25453,8 +27933,8 @@ fi 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 @@ -25471,26 +27951,26 @@ fi 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 @@ -25504,8 +27984,8 @@ fi 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="" @@ -25524,23 +28004,21 @@ $as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic li 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 @@ -25549,18 +28027,20 @@ $as_echo "#define SDL_JOYSTICK_HIDAPI 1" >>confdefs.h 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 @@ -25569,44 +28049,44 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 @@ -25615,36 +28095,35 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 @@ -25654,12 +28133,12 @@ $as_echo "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h 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 @@ -25668,9 +28147,10 @@ fi 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 @@ -25679,9 +28159,10 @@ fi 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 @@ -25690,9 +28171,10 @@ fi 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 @@ -25704,15 +28186,16 @@ fi 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 @@ -25741,9 +28224,10 @@ case "$host" in 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 fi ;; *-*-linux*) ARCH=linux ;; @@ -25825,18 +28309,22 @@ $as_echo "#define SDL_VIDEO_DRIVER_ANDROID 1" >>confdefs.h CheckRPATH CheckVivanteVideo - SOURCES="$SOURCES $srcdir/src/misc/unix/*.c" - have_misc=yes - - SOURCES="$SOURCES $srcdir/src/locale/unix/*.c" - have_locale=yes - + # Set up files for the misc library + if test x$enable_misc = xyes; then + SOURCES="$SOURCES $srcdir/src/misc/unix/*.c" + have_misc=yes + fi + # Set up files for the locale library + if test x$enable_locale = xyes; then + SOURCES="$SOURCES $srcdir/src/locale/unix/*.c" + have_locale=yes + fi # Set up files for the audio library if test x$enable_audio = xyes; then 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" @@ -25844,7 +28332,7 @@ $as_echo "#define SDL_AUDIO_DRIVER_SUNAUDIO 1" >>confdefs.h ;; 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" @@ -25852,7 +28340,7 @@ $as_echo "#define SDL_AUDIO_DRIVER_NETBSD 1" >>confdefs.h ;; 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" @@ -25860,19 +28348,19 @@ $as_echo "#define SDL_AUDIO_DRIVER_PAUDIO 1" >>confdefs.h ;; 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" @@ -25889,7 +28377,7 @@ $as_echo "#define SDL_AUDIO_DRIVER_AAUDIO 1" >>confdefs.h 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" @@ -25898,7 +28386,7 @@ $as_echo "#define SDL_JOYSTICK_LINUX 1" >>confdefs.h 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" @@ -25907,7 +28395,7 @@ $as_echo "#define SDL_JOYSTICK_LINUX 1" >>confdefs.h ;; 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" @@ -25921,7 +28409,7 @@ $as_echo "#define SDL_JOYSTICK_ANDROID 1" >>confdefs.h 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 @@ -25929,7 +28417,7 @@ $as_echo "#define SDL_HAPTIC_LINUX 1" >>confdefs.h ;; 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 @@ -25941,7 +28429,7 @@ $as_echo "#define SDL_HAPTIC_ANDROID 1" >>confdefs.h 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 @@ -25953,14 +28441,14 @@ $as_echo "#define SDL_SENSOR_ANDROID 1" >>confdefs.h 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 @@ -25972,14 +28460,14 @@ $as_echo "#define SDL_POWER_ANDROID 1" >>confdefs.h 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 @@ -25989,7 +28477,7 @@ $as_echo "#define SDL_FILESYSTEM_UNIX 1" >>confdefs.h # 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 @@ -26042,56 +28530,67 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h # Set up the core platform files SOURCES="$SOURCES $srcdir/src/core/windows/*.c" - SOURCES="$SOURCES $srcdir/src/misc/windows/*.c" - have_misc=yes + # Set up files for the misc library + if test x$enable_misc = xyes; then + SOURCES="$SOURCES $srcdir/src/misc/windows/*.c" + have_misc=yes + fi # Use the Windows locale APIs. - SOURCES="$SOURCES $srcdir/src/locale/windows/*.c" - have_locale=yes - + if test x$enable_locale = xyes; then + SOURCES="$SOURCES $srcdir/src/locale/windows/*.c" + have_locale=yes + fi # 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" @@ -26101,22 +28600,22 @@ $as_echo "#define SDL_AUDIO_DRIVER_WASAPI 1" >>confdefs.h # 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 @@ -26128,46 +28627,35 @@ $as_echo "#define SDL_JOYSTICK_DINPUT 1" >>confdefs.h 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" have_haptic=yes fi fi - 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 : - have_tpcshrd_h=yes -fi - - - if test x$have_tpcshrd_h = xyes; then - -$as_echo "#define HAVE_TPCSHRD_H 1" >>confdefs.h - - 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 @@ -26175,7 +28663,7 @@ $as_echo "#define SDL_SENSOR_WINDOWS 1" >>confdefs.h # 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 @@ -26183,7 +28671,7 @@ $as_echo "#define SDL_POWER_WINDOWS 1" >>confdefs.h # 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 @@ -26191,10 +28679,10 @@ $as_echo "#define SDL_FILESYSTEM_WINDOWS 1" >>confdefs.h # 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" @@ -26203,7 +28691,7 @@ $as_echo "#define SDL_THREAD_WINDOWS 1" >>confdefs.h # 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 @@ -26211,7 +28699,7 @@ $as_echo "#define SDL_TIMER_WINDOWS 1" >>confdefs.h # 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 @@ -26231,11 +28719,12 @@ $as_echo "#define SDL_LOADSO_WINDOWS 1" >>confdefs.h # 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 @@ -26243,25 +28732,27 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext 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 @@ -26271,13 +28762,11 @@ fi SDL_LIBS="-lcygwin $SDL_LIBS" fi ;; - - *-*-beos*) + *-*-beos*) as_fn_error $? " *** BeOS support has been removed as of SDL 2.0.2. " "$LINENO" 5 ;; - *-*-haiku*) ARCH=haiku ac_default_prefix=/boot/system @@ -26294,7 +28783,7 @@ fi # 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" @@ -26303,7 +28792,7 @@ $as_echo "#define SDL_AUDIO_DRIVER_HAIKU 1" >>confdefs.h # 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 @@ -26311,7 +28800,7 @@ $as_echo "#define SDL_JOYSTICK_HAIKU 1" >>confdefs.h # 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 @@ -26319,7 +28808,7 @@ $as_echo "#define SDL_TIMER_HAIKU 1" >>confdefs.h # 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 @@ -26327,19 +28816,21 @@ $as_echo "#define SDL_POWER_HAIKU 1" >>confdefs.h # 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 fi - - SOURCES="$SOURCES $srcdir/src/misc/haiku/*.cc" - have_misc=yes - + # Set up files for the misc library + if test x$enable_misc = xyes; then + SOURCES="$SOURCES $srcdir/src/misc/haiku/*.cc" + have_misc=yes + fi # Set up files for the locale library - SOURCES="$SOURCES $srcdir/src/locale/haiku/*.cc" - have_locale=yes - + if test x$enable_locale = xyes; then + SOURCES="$SOURCES $srcdir/src/locale/haiku/*.cc" + have_locale=yes + fi # The Haiku platform requires special setup. SOURCES="$srcdir/src/main/haiku/*.cc $SOURCES" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding" @@ -26359,17 +28850,20 @@ $as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h CheckVulkan CheckPTHREAD - SOURCES="$SOURCES $srcdir/src/misc/ios/*.m" - have_misc=yes - + # Set up files for the misc library + if test x$enable_misc = xyes; then + SOURCES="$SOURCES $srcdir/src/misc/ios/*.m" + have_misc=yes + fi # Set up files for the locale library - SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m" - have_locale=yes - + if test x$enable_locale = xyes; then + SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m" + have_locale=yes + fi # 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" @@ -26378,7 +28872,7 @@ $as_echo "#define SDL_AUDIO_DRIVER_COREAUDIO 1" >>confdefs.h # 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" @@ -26396,7 +28890,7 @@ $as_echo "#define SDL_JOYSTICK_MFI 1" >>confdefs.h # 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 @@ -26404,7 +28898,7 @@ $as_echo "#define SDL_SENSOR_COREMOTION 1" >>confdefs.h # 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 @@ -26417,14 +28911,14 @@ $as_echo "#define SDL_POWER_UIKIT 1" >>confdefs.h # 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 @@ -26433,21 +28927,23 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h 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" + have_video=yes EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -liconv -lobjc" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AVFoundation" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox" @@ -26474,6 +28970,7 @@ $as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON" EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX" + CheckObjectiveCARC CheckVisibilityHidden CheckDeclarationAfterStatement CheckDummyVideo @@ -26493,17 +28990,20 @@ $as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h CheckPTHREAD CheckHIDAPI - SOURCES="$SOURCES $srcdir/src/misc/macosx/*.m" - have_misc=yes - + # Set up files for the misc library + if test x$enable_misc = xyes; then + SOURCES="$SOURCES $srcdir/src/misc/macosx/*.m" + have_misc=yes + fi # Set up files for the locale library - SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m" - have_locale=yes - + if test x$enable_locale = xyes; then + SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m" + have_locale=yes + fi # 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" @@ -26513,7 +29013,7 @@ $as_echo "#define SDL_AUDIO_DRIVER_COREAUDIO 1" >>confdefs.h # 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" @@ -26523,7 +29023,7 @@ $as_echo "#define SDL_JOYSTICK_IOKIT 1" >>confdefs.h # 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" @@ -26532,7 +29032,7 @@ $as_echo "#define SDL_HAPTIC_IOKIT 1" >>confdefs.h # 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 @@ -26540,7 +29040,7 @@ $as_echo "#define SDL_POWER_MACOSX 1" >>confdefs.h # 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 @@ -26548,7 +29048,7 @@ $as_echo "#define SDL_FILESYSTEM_COCOA 1" >>confdefs.h # 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 @@ -26583,7 +29083,7 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h # 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 @@ -26591,7 +29091,7 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h 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 @@ -26600,7 +29100,7 @@ $as_echo "#define SDL_FILESYSTEM_NACL 1" >>confdefs.h *-*-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 @@ -26609,7 +29109,7 @@ $as_echo "#define SDL_VIDEO_DRIVER_EMSCRIPTEN 1" >>confdefs.h 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 @@ -26627,19 +29127,25 @@ $as_echo "#define SDL_AUDIO_DRIVER_EMSCRIPTEN 1" >>confdefs.h CheckClockGettime CheckEmscriptenGLES + # Set up files for the misc library + if test x$enable_misc = xyes; then + SOURCES="$SOURCES $srcdir/src/misc/emscripten/*.c" + have_misc=yes + fi + # 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 fi - # Set up files for the power library + # 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 @@ -26648,7 +29154,7 @@ $as_echo "#define SDL_JOYSTICK_EMSCRIPTEN 1" >>confdefs.h # 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 @@ -26656,14 +29162,16 @@ $as_echo "#define SDL_FILESYSTEM_EMSCRIPTEN 1" >>confdefs.h # 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 fi # Set up files for the locale library - SOURCES="$SOURCES $srcdir/src/locale/emscripten/*.c" - have_locale=yes + if test x$enable_locale = xyes; then + SOURCES="$SOURCES $srcdir/src/locale/emscripten/*.c" + have_locale=yes + fi ;; *-*-riscos*) ARCH=riscos @@ -26679,13 +29187,15 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h CheckPTHREAD CheckClockGettime - SOURCES="$SOURCES $srcdir/src/misc/riscos/*.c" - have_misc=yes - + # Set up files for the misc library + if test x$enable_misc = xyes; then + SOURCES="$SOURCES $srcdir/src/misc/riscos/*.c" + have_misc=yes + fi # 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 @@ -26694,7 +29204,7 @@ $as_echo "#define SDL_VIDEO_DRIVER_RISCOS 1" >>confdefs.h # 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 @@ -26702,7 +29212,7 @@ $as_echo "#define SDL_FILESYSTEM_RISCOS 1" >>confdefs.h # 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 @@ -26734,12 +29244,14 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/core/os2/geniconv/*.c" fi # Use the Unix locale APIs. - SOURCES="$SOURCES $srcdir/src/locale/unix/*.c" - have_locale=yes + if test x$enable_locale = xyes; then + SOURCES="$SOURCES $srcdir/src/locale/unix/*.c" + have_locale=yes + fi # 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 @@ -26748,7 +29260,7 @@ $as_echo "#define SDL_VIDEO_DRIVER_OS2 1" >>confdefs.h # 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 @@ -26758,7 +29270,7 @@ $as_echo "#define SDL_AUDIO_DRIVER_OS2 1" >>confdefs.h # 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" @@ -26767,7 +29279,7 @@ $as_echo "#define SDL_THREAD_OS2 1" >>confdefs.h # 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 @@ -26775,7 +29287,7 @@ $as_echo "#define SDL_TIMER_OS2 1" >>confdefs.h # 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 @@ -26783,7 +29295,7 @@ $as_echo "#define SDL_LOADSO_OS2 1" >>confdefs.h # 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 @@ -26791,7 +29303,7 @@ $as_echo "#define SDL_FILESYSTEM_OS2 1" >>confdefs.h # 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 @@ -26807,41 +29319,68 @@ esac 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 # Verify that we have all the platform specific files we need +if test x$have_audio != xyes; then + if test x$enable_audio = xyes; then + +printf "%s\n" "#define SDL_AUDIO_DRIVER_DUMMY 1" >>confdefs.h + + fi + SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c" +fi +if test x$have_video != xyes; then + if test x$enable_video = xyes; then + +printf "%s\n" "#define SDL_VIDEO_DRIVER_DUMMY 1" >>confdefs.h + + fi + SOURCES="$SOURCES $srcdir/src/video/dummy/*.c" +fi if test x$have_misc != xyes; then + if test x$enable_misc = xyes; then + +printf "%s\n" "#define SDL_MISC_DUMMY 1" >>confdefs.h + + fi SOURCES="$SOURCES $srcdir/src/misc/dummy/*.c" fi if test x$have_locale != xyes; then + if test x$enable_locale = xyes; then + +printf "%s\n" "#define SDL_LOCALE_DUMMY 1" >>confdefs.h + + fi SOURCES="$SOURCES $srcdir/src/locale/dummy/*.c" fi 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" @@ -26849,7 +29388,7 @@ fi 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" @@ -26857,7 +29396,7 @@ fi 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" @@ -26865,7 +29404,7 @@ fi 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" @@ -26873,7 +29412,7 @@ fi if test x$have_timers != xyes; then if test x$enable_timers = xyes; then -$as_echo "#define SDL_TIMERS_DISABLED 1" >>confdefs.h +printf "%s\n" "#define SDL_TIMER_DUMMY 1" >>confdefs.h fi SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c" @@ -26881,7 +29420,7 @@ fi if test x$have_filesystem != xyes; then if test x$enable_filesystem = xyes; then -$as_echo "#define SDL_FILESYSTEM_DISABLED 1" >>confdefs.h +printf "%s\n" "#define SDL_FILESYSTEM_DUMMY 1" >>confdefs.h fi SOURCES="$SOURCES $srcdir/src/filesystem/dummy/*.c" @@ -26889,7 +29428,7 @@ fi if test x$have_loadso != xyes; then if test x$enable_loadso = xyes; then -$as_echo "#define SDL_LOADSO_DISABLED 1" >>confdefs.h +printf "%s\n" "#define SDL_LOADSO_DUMMY 1" >>confdefs.h fi SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c" @@ -26962,8 +29501,8 @@ if test "x$enable_rpath" = "xyes" -a "x$enable_shared" = "xyes"; then 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" @@ -26971,24 +29510,25 @@ $as_echo_n "checking for linker option --enable-new-dtags... " >&6; } /* 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}" @@ -26999,6 +29539,15 @@ fi SDL_STATIC_LIBS="$EXTRA_LDFLAGS" +eval pkg_prefix=$prefix +eval pkg_cmakedir=$libdir/cmake/SDL2 +cmake_prefix_relpath="$(echo -n "$pkg_cmakedir" | sed -E "s#^$pkg_prefix##" | sed -E "s#[A-Za-z0-9_ .-]+#..#g" )" + + +eval pkg_bindir=$bindir +bin_prefix_relpath="$(echo -n "pkg_bindir" | sed -E "s#^$pkg_prefix##" | sed -E "s#[A-Za-z0-9_ .-]+#..#g" )" + + @@ -27156,8 +29705,8 @@ _ACEOF 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) ;; #( @@ -27187,15 +29736,15 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; /^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 @@ -27209,8 +29758,8 @@ $as_echo "$as_me: updating cache $cache_file" >&6;} 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 @@ -27227,7 +29776,7 @@ U= 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" @@ -27243,8 +29792,8 @@ LTLIBOBJS=$ac_ltlibobjs 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 @@ -27267,14 +29816,16 @@ cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 # 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 ;; #( @@ -27284,46 +29835,46 @@ esac 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 || @@ -27332,13 +29883,6 @@ if test "${PATH_SEPARATOR+set}" != set; then 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 #(( @@ -27347,8 +29891,12 @@ case $0 in #(( 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 @@ -27360,30 +29908,10 @@ if test "x$as_myself" = x; then 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] @@ -27396,13 +29924,14 @@ as_fn_error () 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. @@ -27429,18 +29958,20 @@ as_fn_unset () { 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 @@ -27452,12 +29983,13 @@ fi # as_fn_append # 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` @@ -27488,7 +30020,7 @@ as_me=`$as_basename -- "$0" || $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 @@ -27510,6 +30042,10 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS 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*) @@ -27523,6 +30059,12 @@ case `echo -n x` in #((((( 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 @@ -27564,7 +30106,7 @@ as_fn_mkdir_p () 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" @@ -27573,7 +30115,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ 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 @@ -27636,7 +30178,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # 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 @@ -27698,14 +30240,16 @@ $config_commands 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." @@ -27744,15 +30288,15 @@ do -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'" @@ -27760,7 +30304,7 @@ do --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;; @@ -27769,7 +30313,7 @@ do 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=: ;; @@ -27797,7 +30341,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 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 "\$@" @@ -27811,7 +30355,7 @@ exec 5>>config.log 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 @@ -28319,9 +30863,9 @@ done # 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 @@ -28657,7 +31201,7 @@ do 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 @@ -28665,17 +31209,17 @@ do # 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 @@ -28692,7 +31236,7 @@ $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ 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 @@ -28716,9 +31260,9 @@ $as_echo X"$ac_file" | 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/ ;; @@ -28775,8 +31319,8 @@ ac_sed_dataroot=' 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=' @@ -28819,9 +31363,9 @@ test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { 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" @@ -28837,27 +31381,27 @@ which seems to be undefined. Please make sure it is defined" >&2;} # 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 @@ -29408,6 +31952,7 @@ _LT_EOF esac + ltmain=$ac_aux_dir/ltmain.sh @@ -29765,7 +32310,8 @@ if test "$no_create" != yes; then $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 --git a/libs/SDL2/configure.ac b/libs/SDL2/configure.ac index 3c1c6c85..0b2c7c72 100644 --- a/libs/SDL2/configure.ac +++ b/libs/SDL2/configure.ac @@ -10,23 +10,21 @@ dnl Save the CFLAGS to see whether they were passed in or generated 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=20 -SDL_INTERFACE_AGE=2 -SDL_BINARY_AGE=20 +SDL_MINOR_VERSION=23 +SDL_MICRO_VERSION=1 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 @@ AC_SUBST(SDL_VERSION) 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) @@ -55,10 +60,14 @@ dnl AC_CANONICAL_HOST dnl Check for tools AC_PROG_CC AC_PROG_CXX +AC_PROG_EGREP AC_PROG_INSTALL AC_PROG_MAKE_SET PKG_PROG_PKG_CONFIG +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*) @@ -218,6 +227,9 @@ case "$enable_assertions" in ;; 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], @@ -241,10 +253,9 @@ fi AC_MSG_CHECKING(for linker option --no-undefined) have_no_undefined=no case "$host" in - dnl Skip this on platforms where it is just simply busted. +dnl Skip this on platforms where it is just simply busted. *-*-openbsd*) ;; - *) save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -Wl,--no-undefined" @@ -309,25 +320,20 @@ AC_ARG_ENABLE(libc, if test x$enable_libc = xyes; then AC_DEFINE(HAVE_LIBC, 1, [ ]) - dnl Check for C library headers - AC_HEADER_STDC +dnl Check for C library headers +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. +dnl Check for typedefs, structures, etc. AC_TYPE_SIZE_T - dnl Check for defines +dnl Check for defines AC_CHECK_DEFINE(M_PI, math.h) - dnl Checks for library functions. - case "$host" in - *-*-cygwin* | *-*-mingw*) - ;; - *) - AC_FUNC_ALLOCA - ;; - esac + AC_FUNC_ALLOCA +dnl Checks for library functions. AC_FUNC_MEMCMP if test x$ac_cv_func_memcmp_working = xyes; then AC_DEFINE(HAVE_MEMCMP, 1, [ ]) @@ -344,7 +350,7 @@ if test x$enable_libc = xyes; then 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) @@ -354,7 +360,7 @@ if test x$enable_libc = xyes; then AC_CHECK_MEMBER(struct sigaction.sa_sigaction,[AC_DEFINE([HAVE_SA_SIGACTION], 1, [ ])], ,[#include ]) - dnl Check for additional non-standard headers +dnl Check for additional non-standard headers AC_CHECK_HEADERS(libunwind.h) fi @@ -422,9 +428,18 @@ SOURCES="$SOURCES $srcdir/src/locale/*.c" dnl Enable/disable various subsystems of the SDL library +case "$host" in + *-*-emscripten*) + default_atomic=no + ;; + *) + default_atomic=yes + ;; +esac + AC_ARG_ENABLE(atomic, [AS_HELP_STRING([--enable-atomic], [Enable the atomic operations subsystem [default=yes]])], - , enable_atomic=yes) + , enable_atomic=$default_atomic) if test x$enable_atomic != xyes; then AC_DEFINE(SDL_ATOMIC_DISABLED, 1, [ ]) else @@ -534,6 +549,22 @@ if test x$enable_file != xyes; then else SUMMARY_modules="${SUMMARY_modules} file" fi +AC_ARG_ENABLE(misc, +[AS_HELP_STRING([--enable-misc], [Enable the misc subsystem [default=yes]])], + , enable_misc=yes) +if test x$enable_misc != xyes; then + AC_DEFINE(SDL_MISC_DISABLED, 1, [ ]) +else + SUMMARY_modules="${SUMMARY_modules} misc" +fi +AC_ARG_ENABLE(locale, +[AS_HELP_STRING([--enable-locale], [Enable the locale subsystem [default=yes]])], + , enable_locale=yes) +if test x$enable_locale != xyes; then + AC_DEFINE(SDL_LOCALE_DISABLED, 1, [ ]) +else + SUMMARY_modules="${SUMMARY_modules} locale" +fi AC_ARG_ENABLE(loadso, [AS_HELP_STRING([--enable-loadso], [Enable the shared object loading subsystem [default=yes]])], , enable_loadso=yes) @@ -556,8 +587,6 @@ AC_ARG_ENABLE(assembly, 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 @@ -582,7 +611,7 @@ if test x$enable_assembly = xyes; then fi fi - dnl Check for various instruction support +dnl Check for various instruction support AC_ARG_ENABLE(mmx, [AS_HELP_STRING([--enable-mmx], [use MMX assembly routines [default=yes]])], , enable_mmx=yes) @@ -826,6 +855,70 @@ if test x$enable_assembly = xyes; then 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() { @@ -1280,6 +1373,7 @@ CheckDiskAudio() AC_DEFINE(SDL_AUDIO_DRIVER_DISK, 1, [ ]) SOURCES="$SOURCES $srcdir/src/audio/disk/*.c" SUMMARY_audio="${SUMMARY_audio} disk" + have_audio=yes fi } @@ -1293,6 +1387,7 @@ CheckDummyAudio() AC_DEFINE(SDL_AUDIO_DRIVER_DUMMY, 1, [ ]) SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c" SUMMARY_audio="${SUMMARY_audio} dummy" + have_audio=yes fi } @@ -1403,6 +1498,26 @@ CheckNEON() 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() @@ -1504,7 +1619,7 @@ CheckWarnAll() if test x$have_gcc_Wall = xyes; then EXTRA_CFLAGS="$EXTRA_CFLAGS -Wall" - dnl Haiku headers use multicharacter constants all over the place. Ignore these warnings when using -Wall. +dnl Haiku headers use multicharacter constants all over the place. Ignore these warnings when using -Wall. AC_MSG_CHECKING(for necessary GCC -Wno-multichar option) need_gcc_Wno_multichar=no case "$host" in @@ -1535,7 +1650,7 @@ CheckWayland() video_wayland=no if test x$video_opengl_egl = xyes && \ test x$video_opengles_v2 = xyes; then - if $PKG_CONFIG --exists wayland-client wayland-scanner wayland-egl wayland-cursor egl 'xkbcommon >= 0.5.0'; then + if $PKG_CONFIG --exists 'wayland-client >= 1.18' wayland-scanner wayland-egl wayland-cursor egl 'xkbcommon >= 0.5.0'; then 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` @@ -1566,7 +1681,7 @@ dnl FIXME: Do BSD and OS X need special cases? wayland_client_lib=[`find_lib "libwayland-client.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] wayland_egl_lib=[`find_lib "libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] if test x$wayland_egl_lib = x; then - dnl This works in Ubuntu 13.10, maybe others + # This works in Ubuntu 13.10, maybe others wayland_egl_lib=[`find_lib "mesa-egl/libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] fi wayland_cursor_lib=[`find_lib "libwayland-cursor.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] @@ -1606,39 +1721,31 @@ dnl FIXME: Do BSD and OS X need special cases? dnl See if libdecor is available AC_ARG_ENABLE(libdecor, -[AS_HELP_STRING([--enable-libdecor], [use libdecor for Wayland client-side decorations [default=yes]])], - , enable_libdecor=yes) +[AS_HELP_STRING([--enable-libdecor], [use libdecor for Wayland client-side decorations [default=yes]])],, enable_libdecor=yes) if test x$enable_libdecor = xyes; then - AC_MSG_CHECKING(for libdecor support) - AS_IF([$PKG_CONFIG --exists libdecor-0], - [video_libdecor=yes], - [video_libdecor=no]) - AC_MSG_RESULT($video_libdecor) + PKG_CHECK_MODULES([DECOR], [libdecor-0], video_libdecor=yes, video_libdecor=no) if test x$video_libdecor = xyes; then - EXTRA_CFLAGS="$EXTRA_CFLAGS `$PKG_CONFIG --cflags libdecor-0`" + EXTRA_CFLAGS="$EXTRA_CFLAGS $DECOR_CFLAGS" AC_DEFINE(HAVE_LIBDECOR_H, 1, [ ]) AC_ARG_ENABLE(libdecor-shared, -[AS_HELP_STRING([--enable-libdecor-shared], [dynamically load libdecor [default=yes]])], - , enable_libdecor_shared=yes) +[AS_HELP_STRING([--enable-libdecor-shared], [dynamically load libdecor [default=yes]])],, enable_libdecor_shared=yes) + + decor_lib=[`find_lib "libdecor-0.so.*" "$DECOR_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] if test x$enable_wayland_shared != xyes; then enable_libdecor_shared=no fi - - decor_lib=[`find_lib "libdecor-0.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`] - if test x$have_loadso != xyes && \ test x$enable_libdecor_shared = xyes; then AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic libdecor loading]) fi - if test x$have_loadso = xyes && \ test x$enable_libdecor_shared = xyes && test x$decor_lib != x; then echo "-- dynamic libdecor -> $decor_lib" AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR, "$decor_lib", [ ]) else - EXTRA_LDFLAGS="$EXTRA_LDFLAGS `$PKG_CONFIG --libs libdecor-0`" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DECOR_LIBS" fi fi fi @@ -1666,8 +1773,10 @@ CheckNativeClient() SDLMAIN_SOURCES="$srcdir/src/main/nacl/*.c" SOURCES="$SOURCES $srcdir/src/audio/nacl/*.c" SUMMARY_audio="${SUMMARY_audio} nacl" + have_audio=yes SOURCES="$SOURCES $srcdir/src/video/nacl/*.c" SUMMARY_video="${SUMMARY_video} nacl opengles2" + have_video=yes ],[]) } @@ -1717,6 +1826,7 @@ CheckRPI() SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c" AC_DEFINE(SDL_VIDEO_DRIVER_RPI, 1, [ ]) SUMMARY_video="${SUMMARY_video} rpi" + have_video=yes fi fi } @@ -1753,37 +1863,31 @@ CheckX11() 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 @@ -1834,7 +1938,6 @@ CheckX11() fi have_video=yes - dnl AC_CHECK_LIB(X11, XGetEventData, AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS, 1, [Have XGenericEvent])) AC_MSG_CHECKING([for XGenericEvent]) have_XGenericEvent=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ @@ -1896,34 +1999,6 @@ XFreeEventData(display, cookie); 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) @@ -2005,7 +2080,7 @@ XITouchClassInfo *t; [AS_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [default=yes]])], , enable_video_x11_xrandr=yes) if test x$enable_video_x11_xrandr = xyes; then - dnl XRRScreenResources is only present in Xrandr >= 1.2, we use that as a test. +dnl XRRScreenResources is only present in Xrandr >= 1.2, we use that as a test. definitely_enable_video_x11_xrandr=no have_xrandr_h_hdr=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ @@ -2073,34 +2148,6 @@ XITouchClassInfo *t; 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 @@ -2167,7 +2214,7 @@ CheckCOCOA() , enable_video_cocoa=yes) if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then save_CFLAGS="$CFLAGS" - dnl Work around that we don't have Objective-C support in autoconf +dnl Work around that we don't have Objective-C support in autoconf CFLAGS="$CFLAGS -x objective-c" AC_MSG_CHECKING(for Cocoa framework) have_cocoa=no @@ -2195,7 +2242,7 @@ CheckMETAL() , enable_render_metal=yes) if test x$enable_video = xyes -a x$enable_video_metal = xyes; then save_CFLAGS="$CFLAGS" - dnl Work around that we don't have Objective-C support in autoconf +dnl Work around that we don't have Objective-C support in autoconf CFLAGS="$CFLAGS -x objective-c" AC_MSG_CHECKING(for Metal framework) have_metal=no @@ -2619,7 +2666,7 @@ CheckVulkan() ;; *-*-darwin*) save_CFLAGS="$CFLAGS" - dnl Work around that we don't have Objective-C support in autoconf +dnl Work around that we don't have Objective-C support in autoconf CFLAGS="$CFLAGS -x objective-c" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include @@ -2654,7 +2701,7 @@ CheckVulkan() dnl See if we can use the new unified event interface in Linux 2.4 CheckInputEvents() { - dnl Check for Linux 2.4 unified input event interface support +dnl Check for Linux 2.4 unified input event interface support AC_MSG_CHECKING(for Linux 2.4 unified input interface) use_input_events=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ @@ -2674,7 +2721,6 @@ CheckInputEvents() dnl See if we can use the kernel kd.h header CheckInputKD() { - AC_MSG_CHECKING(for Linux kd.h) use_input_kd=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ @@ -2876,7 +2922,7 @@ CheckJoystickMFI() if test x$enable_joystick_mfi = xyes; then save_CFLAGS="$CFLAGS" save_LDFLAGS="$LDFLAGS" - dnl Work around that we don't have Objective-C support in autoconf +dnl Work around that we don't have Objective-C support in autoconf CFLAGS="$CFLAGS -x objective-c -fobjc-weak" LDFLAGS="$LDFLAGS -Wl,-weak_framework,CoreHaptics -Wl,-weak_framework,GameController" AC_MSG_CHECKING(for GameController framework) @@ -2908,15 +2954,15 @@ CheckJoystickMFI() dnl See what type of thread model to use on Linux and Solaris CheckPTHREAD() { - dnl Check for pthread support +dnl Check for pthread support - dnl Emscripten pthreads work, but you need to have a non-pthread fallback build - dnl for systems without support. It's not currently enough to not use - dnl pthread functions in a pthread-build; it won't start up on unsupported - dnl browsers. As such, you have to explicitly enable it on Emscripten builds - dnl for the time being. This default with change to ON once this becomes - dnl commonly supported in browsers or the Emscripten teams makes a single - dnl binary work everywhere. +dnl Emscripten pthreads work, but you need to have a non-pthread fallback build +dnl for systems without support. It's not currently enough to not use +dnl pthread functions in a pthread-build; it won't start up on unsupported +dnl browsers. As such, you have to explicitly enable it on Emscripten builds +dnl for the time being. This default with change to ON once this becomes +dnl commonly supported in browsers or the Emscripten teams makes a single +dnl binary work everywhere. case "$host" in *-*-emscripten*) @@ -2930,7 +2976,7 @@ CheckPTHREAD() AC_ARG_ENABLE(pthreads, [AS_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [default=maybe]])], , enable_pthreads=maybe) - dnl This is used on Linux for glibc binary compatibility (Doh!) +dnl This is used on Linux for glibc binary compatibility (Doh!) AC_ARG_ENABLE(pthread-sem, [AS_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [default=maybe]])], , enable_pthread_sem=maybe) @@ -3185,6 +3231,20 @@ CheckWINDOWS() # This fixes Windows stack alignment with newer GCC CheckStackBoundary + + # headers needed elsewhere + AC_CHECK_HEADER(tpcshrd.h,have_tpcshrd_h=yes) + if test x$have_tpcshrd_h = xyes; then + AC_DEFINE(HAVE_TPCSHRD_H, 1, [ ]) + fi + AC_CHECK_HEADER(roapi.h,have_roapi_h=yes) + 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 @@ -3211,6 +3271,17 @@ CheckDIRECTX() 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) @@ -3643,6 +3714,7 @@ case "$host" in SOURCES="$SOURCES $srcdir/src/core/android/*.c $srcdir/src/video/android/*.c" AC_DEFINE(SDL_VIDEO_DRIVER_ANDROID, 1, [ ]) SUMMARY_video="${SUMMARY_video} android" + have_video=yes fi ;; *-*-linux*) ARCH=linux ;; @@ -3724,12 +3796,16 @@ case "$host" in CheckRPATH CheckVivanteVideo - SOURCES="$SOURCES $srcdir/src/misc/unix/*.c" - have_misc=yes - - SOURCES="$SOURCES $srcdir/src/locale/unix/*.c" - have_locale=yes - + # Set up files for the misc library + if test x$enable_misc = xyes; then + SOURCES="$SOURCES $srcdir/src/misc/unix/*.c" + have_misc=yes + fi + # Set up files for the locale library + if test x$enable_locale = xyes; then + SOURCES="$SOURCES $srcdir/src/locale/unix/*.c" + have_locale=yes + fi # Set up files for the audio library if test x$enable_audio = xyes; then case $ARCH in @@ -3907,12 +3983,16 @@ case "$host" in # Set up the core platform files SOURCES="$SOURCES $srcdir/src/core/windows/*.c" - SOURCES="$SOURCES $srcdir/src/misc/windows/*.c" - have_misc=yes + # Set up files for the misc library + if test x$enable_misc = xyes; then + SOURCES="$SOURCES $srcdir/src/misc/windows/*.c" + have_misc=yes + fi # Use the Windows locale APIs. - SOURCES="$SOURCES $srcdir/src/locale/windows/*.c" - have_locale=yes - + if test x$enable_locale = xyes; then + SOURCES="$SOURCES $srcdir/src/locale/windows/*.c" + have_locale=yes + fi # Set up files for the video library if test x$enable_video = xyes; then AC_DEFINE(SDL_VIDEO_DRIVER_WINDOWS, 1, [ ]) @@ -3929,6 +4009,10 @@ case "$host" in 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 @@ -3977,10 +4061,6 @@ case "$host" in have_haptic=yes fi fi - AC_CHECK_HEADER(tpcshrd.h,have_tpcshrd_h=yes) - if test x$have_tpcshrd_h = xyes; then - AC_DEFINE(HAVE_TPCSHRD_H, 1, [ ]) - fi # Set up files for the sensor library AC_CHECK_HEADER(sensorsapi.h,have_winsensors=yes,have_winsensors=no) if test x$have_winsensors = xyes; then @@ -4045,14 +4125,12 @@ case "$host" in SDL_LIBS="-lcygwin $SDL_LIBS" fi ;; - - dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan. +dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan. *-*-beos*) AC_MSG_ERROR([ *** BeOS support has been removed as of SDL 2.0.2. ]) ;; - *-*-haiku*) ARCH=haiku ac_default_prefix=/boot/system @@ -4097,14 +4175,16 @@ case "$host" in SOURCES="$SOURCES $srcdir/src/filesystem/haiku/*.cc" have_filesystem=yes fi - - SOURCES="$SOURCES $srcdir/src/misc/haiku/*.cc" - have_misc=yes - + # Set up files for the misc library + if test x$enable_misc = xyes; then + SOURCES="$SOURCES $srcdir/src/misc/haiku/*.cc" + have_misc=yes + fi # Set up files for the locale library - SOURCES="$SOURCES $srcdir/src/locale/haiku/*.cc" - have_locale=yes - + if test x$enable_locale = xyes; then + SOURCES="$SOURCES $srcdir/src/locale/haiku/*.cc" + have_locale=yes + fi # The Haiku platform requires special setup. SOURCES="$srcdir/src/main/haiku/*.cc $SOURCES" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding" @@ -4124,13 +4204,16 @@ case "$host" in CheckVulkan CheckPTHREAD - SOURCES="$SOURCES $srcdir/src/misc/ios/*.m" - have_misc=yes - + # Set up files for the misc library + if test x$enable_misc = xyes; then + SOURCES="$SOURCES $srcdir/src/misc/ios/*.m" + have_misc=yes + fi # Set up files for the locale library - SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m" - have_locale=yes - + if test x$enable_locale = xyes; then + SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m" + have_locale=yes + fi # Set up files for the audio library if test x$enable_audio = xyes; then AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ]) @@ -4191,6 +4274,8 @@ case "$host" in AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES, 1, [ ]) AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ]) SOURCES="$SOURCES $srcdir/src/video/uikit/*.m" + SUMMARY_video="${SUMMARY_video} uikit" + have_video=yes EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -liconv -lobjc" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AVFoundation" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox" @@ -4217,6 +4302,7 @@ case "$host" in EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON" EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX" + CheckObjectiveCARC CheckVisibilityHidden CheckDeclarationAfterStatement CheckDummyVideo @@ -4236,13 +4322,16 @@ case "$host" in CheckPTHREAD CheckHIDAPI - SOURCES="$SOURCES $srcdir/src/misc/macosx/*.m" - have_misc=yes - + # Set up files for the misc library + if test x$enable_misc = xyes; then + SOURCES="$SOURCES $srcdir/src/misc/macosx/*.m" + have_misc=yes + fi # Set up files for the locale library - SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m" - have_locale=yes - + if test x$enable_locale = xyes; then + SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m" + have_locale=yes + fi # Set up files for the audio library if test x$enable_audio = xyes; then AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ]) @@ -4350,6 +4439,12 @@ case "$host" in CheckClockGettime CheckEmscriptenGLES + # Set up files for the misc library + if test x$enable_misc = xyes; then + SOURCES="$SOURCES $srcdir/src/misc/emscripten/*.c" + have_misc=yes + fi + # Set up files for the power library if test x$enable_power = xyes; then AC_DEFINE(SDL_POWER_EMSCRIPTEN, 1, [ ]) @@ -4357,7 +4452,7 @@ case "$host" in have_power=yes fi - # Set up files for the power library + # Set up files for the joystick library if test x$enable_joystick = xyes; then AC_DEFINE(SDL_JOYSTICK_EMSCRIPTEN, 1, [ ]) SOURCES="$SOURCES $srcdir/src/joystick/emscripten/*.c" @@ -4377,8 +4472,10 @@ case "$host" in have_timers=yes fi # Set up files for the locale library - SOURCES="$SOURCES $srcdir/src/locale/emscripten/*.c" - have_locale=yes + if test x$enable_locale = xyes; then + SOURCES="$SOURCES $srcdir/src/locale/emscripten/*.c" + have_locale=yes + fi ;; *-*-riscos*) ARCH=riscos @@ -4394,9 +4491,11 @@ case "$host" in CheckPTHREAD CheckClockGettime - SOURCES="$SOURCES $srcdir/src/misc/riscos/*.c" - have_misc=yes - + # Set up files for the misc library + if test x$enable_misc = xyes; then + SOURCES="$SOURCES $srcdir/src/misc/riscos/*.c" + have_misc=yes + fi # Set up files for the video library if test x$enable_video = xyes; then AC_DEFINE(SDL_VIDEO_DRIVER_RISCOS, 1, [ ]) @@ -4443,8 +4542,10 @@ case "$host" in SOURCES="$SOURCES $srcdir/src/core/os2/geniconv/*.c" fi # Use the Unix locale APIs. - SOURCES="$SOURCES $srcdir/src/locale/unix/*.c" - have_locale=yes + if test x$enable_locale = xyes; then + SOURCES="$SOURCES $srcdir/src/locale/unix/*.c" + have_locale=yes + fi # Set up files for the video library if test x$enable_video = xyes; then AC_DEFINE(SDL_VIDEO_DRIVER_OS2, 1, [ ]) @@ -4520,10 +4621,28 @@ AC_SUBST([INSTALL_SDL2_CONFIG], [$enable_sdl2_config]) # Verify that we have all the platform specific files we need +if test x$have_audio != xyes; then + if test x$enable_audio = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_DUMMY, 1, [ ]) + fi + SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c" +fi +if test x$have_video != xyes; then + if test x$enable_video = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY, 1, [ ]) + fi + SOURCES="$SOURCES $srcdir/src/video/dummy/*.c" +fi if test x$have_misc != xyes; then + if test x$enable_misc = xyes; then + AC_DEFINE(SDL_MISC_DUMMY, 1, [ ]) + fi SOURCES="$SOURCES $srcdir/src/misc/dummy/*.c" fi if test x$have_locale != xyes; then + if test x$enable_locale = xyes; then + AC_DEFINE(SDL_LOCALE_DUMMY, 1, [ ]) + fi SOURCES="$SOURCES $srcdir/src/locale/dummy/*.c" fi if test x$have_joystick != xyes; then @@ -4552,19 +4671,19 @@ if test x$have_threads != xyes; then fi if test x$have_timers != xyes; then if test x$enable_timers = xyes; then - AC_DEFINE(SDL_TIMERS_DISABLED, 1, [ ]) + AC_DEFINE(SDL_TIMER_DUMMY, 1, [ ]) fi SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c" fi if test x$have_filesystem != xyes; then if test x$enable_filesystem = xyes; then - AC_DEFINE(SDL_FILESYSTEM_DISABLED, 1, [ ]) + AC_DEFINE(SDL_FILESYSTEM_DUMMY, 1, [ ]) fi SOURCES="$SOURCES $srcdir/src/filesystem/dummy/*.c" fi if test x$have_loadso != xyes; then if test x$enable_loadso = xyes; then - AC_DEFINE(SDL_LOADSO_DISABLED, 1, [ ]) + AC_DEFINE(SDL_LOADSO_DUMMY, 1, [ ]) fi SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c" fi @@ -4656,6 +4775,17 @@ fi SDL_STATIC_LIBS="$EXTRA_LDFLAGS" +dnl Calculate the location of the prefix, relative to the cmake folder +eval pkg_prefix=$prefix +eval pkg_cmakedir=$libdir/cmake/SDL2 +cmake_prefix_relpath="$(echo -n "$pkg_cmakedir" | sed -E "s#^$pkg_prefix##" | sed -E "s#[A-Za-z0-9_ .-]+#..#g" )" +AC_SUBST([cmake_prefix_relpath]) + +dnl Calculate the location of the prefix, relative to bindir +eval pkg_bindir=$bindir +bin_prefix_relpath="$(echo -n "pkg_bindir" | sed -E "s#^$pkg_prefix##" | sed -E "s#[A-Za-z0-9_ .-]+#..#g" )" +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 --git a/libs/SDL2/docs/README-android.md b/libs/SDL2/docs/README-android.md index 9ad8627b..39db67ad 100644 --- a/libs/SDL2/docs/README-android.md +++ b/libs/SDL2/docs/README-android.md @@ -206,6 +206,9 @@ You should not use the SDL renderer API while the app going in background: after you read this message, GL context gets backed-up and you should not use the SDL renderer API. + When this event is received, you have to set the render target to NULL, if you're using it. + (eg call SDL_SetRenderTarget(renderer, NULL)) + - SDL_APP_DIDENTERFOREGROUND: GL context is restored, and the SDL renderer API is available (unless you receive SDL_RENDER_DEVICE_RESET). diff --git a/libs/SDL2/docs/README-cmake.md b/libs/SDL2/docs/README-cmake.md index b13f2d27..03fd2442 100644 --- a/libs/SDL2/docs/README-cmake.md +++ b/libs/SDL2/docs/README-cmake.md @@ -73,7 +73,7 @@ To use, set the following CMake variables when running CMake's configuration sta - 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 ~/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: diff --git a/libs/SDL2/docs/README-directfb.md b/libs/SDL2/docs/README-directfb.md index eeac4280..3b28eef3 100644 --- a/libs/SDL2/docs/README-directfb.md +++ b/libs/SDL2/docs/README-directfb.md @@ -15,29 +15,34 @@ What you need: * Kernel-Framebuffer support: required: vesafb, radeonfb .... * Mesa 7.0.x - optional for OpenGL -/etc/directfbrc - -This file should contain the following lines to make +The `/etc/directfbrc` file should contain the following lines to make your joystick work and avoid crashes: ------------------------- + +``` disable-module=joystick disable-module=cle266 disable-module=cyber5k no-linux-input-grab ------------------------- +``` To disable to use x11 backend when DISPLAY variable is found use +``` export SDL_DIRECTFB_X11_CHECK=0 +``` To disable the use of linux input devices, i.e. multimice/multikeyboard support, use +``` export SDL_DIRECTFB_LINUX_INPUT=0 +``` To use hardware accelerated YUV-overlays for YUV-textures, use: +``` export SDL_DIRECTFB_YUV_DIRECT=1 +``` This is disabled by default. It will only support one YUV texture, namely the first. Every other YUV texture will be @@ -45,7 +50,9 @@ rendered in software. In addition, you may use (directfb-1.2.x) +``` export SDL_DIRECTFB_YUV_UNDERLAY=1 +``` to make the YUV texture an underlay. This will make the cursor to be shown. @@ -54,14 +61,18 @@ Simple Window Manager ===================== The driver has support for a very, very basic window manager you may -want to use when running with "wm=default". Use +want to use when running with `wm=default`. Use +``` export SDL_DIRECTFB_WM=1 +``` to enable basic window borders. In order to have the window title rendered, you need to have the following font installed: +``` /usr/share/fonts/truetype/freefont/FreeSans.ttf +``` OpenGL Support ============== @@ -71,21 +82,25 @@ works at least on all directfb supported platforms. As of this writing 20100802 you need to pull Mesa from git and do the following: ------------------------- +``` git clone git://anongit.freedesktop.org/git/mesa/mesa cd mesa git checkout 2c9fdaf7292423c157fc79b5ce43f0f199dd753a ------------------------- +``` -Edit configs/linux-directfb so that the Directories-section looks like ------------------------- +Edit `configs/linux-directfb` so that the Directories-section looks like this: + +``` # Directories SRC_DIRS = mesa glu GLU_DIRS = sgi DRIVER_DIRS = directfb PROGRAM_DIRS = ------------------------- +``` +Then do the following: + +``` make linux-directfb make @@ -95,13 +110,14 @@ sudo make install INSTALL_DIR=/usr/local/dfb_GL cd src/mesa/drivers/directfb make sudo make install INSTALL_DIR=/usr/local/dfb_GL ------------------------- +``` To run the SDL - testprograms: +``` export SDL_VIDEODRIVER=directfb export LD_LIBRARY_PATH=/usr/local/dfb_GL/lib export LD_PRELOAD=/usr/local/dfb_GL/libGL.so.7 ./testgl - +``` diff --git a/libs/SDL2/docs/README-gdk.md b/libs/SDL2/docs/README-gdk.md new file mode 100644 index 00000000..5f6b18be --- /dev/null +++ b/libs/SDL2/docs/README-gdk.md @@ -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 --git a/libs/SDL2/docs/README-linux.md b/libs/SDL2/docs/README-linux.md index 9c1b0c4c..d440dee2 100644 --- a/libs/SDL2/docs/README-linux.md +++ b/libs/SDL2/docs/README-linux.md @@ -3,8 +3,8 @@ Linux 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. @@ -17,7 +17,7 @@ Ubuntu 20.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 \ + 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 @@ -27,12 +27,11 @@ 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 --git a/libs/SDL2/docs/README-macos.md b/libs/SDL2/docs/README-macos.md index d7bc98af..2f906791 100644 --- a/libs/SDL2/docs/README-macos.md +++ b/libs/SDL2/docs/README-macos.md @@ -43,15 +43,14 @@ make 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.7 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 4.6 and the 10.7 SDK. +PowerPC support for macOS has been officially dropped as of SDL 2.0.2. +32-bit Intel and macOS 10.6 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 --git a/libs/SDL2/docs/README-ngage.md b/libs/SDL2/docs/README-ngage.md new file mode 100644 index 00000000..83c2e338 --- /dev/null +++ b/libs/SDL2/docs/README-ngage.md @@ -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 --git a/libs/SDL2/docs/README-ps2.md b/libs/SDL2/docs/README-ps2.md new file mode 100644 index 00000000..39ca9007 --- /dev/null +++ b/libs/SDL2/docs/README-ps2.md @@ -0,0 +1,34 @@ +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 +``` + + +## 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 +- Audio +- Video +- Controllers +- Others \ No newline at end of file diff --git a/libs/SDL2/docs/README-psp.md b/libs/SDL2/docs/README-psp.md index 8e781f4c..0c84f866 100644 --- a/libs/SDL2/docs/README-psp.md +++ b/libs/SDL2/docs/README-psp.md @@ -1,31 +1,36 @@ PSP ====== -SDL port for the Sony PSP contributed by - Captian Lex +SDL2 port for the Sony PSP contributed by: +- Captian Lex +- Francisco Javier Trujillo Mata +- Wouter Wijsman + Credit to Marcus R.Brown,Jim Paris,Matthew H for the original SDL 1.2 for PSP Geecko for his PSP GU lib "Glib2d" -Building --------- -To build SDL2 library for the PSP, make sure psp-config is in the path and run: - make -f Makefile.psp +## Building +To build SDL2 library for the PSP, make sure you have the latest PSPDev status and run: +```bash +cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$PSPDEV/psp/share/pspdev.cmake +cmake --build build +cmake --install build +``` -Getting PSP toolchain ---------------------- -https://github.com/pspdev/psptoolchain +## Getting PSP Dev +[Installing PSP Dev](https://github.com/pspdev/pspdev) -Running on PPSSPP Emulator --------------------------- -https://github.com/hrydgard/ppsspp -( https://github.com/hrydgard/ppsspp/wiki/Build-instructions ) +## Running on PPSSPP Emulator +[PPSSPP](https://github.com/hrydgard/ppsspp) -Compiling an HelloWorld ------------------------ -https://psp-dev.org/doku.php?id=tutorial:hello_world +[Build Instructions](https://github.com/hrydgard/ppsspp/wiki/Build-instructions) -To Do ------- -PSP Screen Keyboard + +## Compiling a HelloWorld +[PSP Hello World](https://psp-dev.org/doku.php?id=tutorial:hello_world) + +## To Do +- PSP Screen Keyboard +- Dialogs \ No newline at end of file diff --git a/libs/SDL2/docs/README-raspberrypi.md b/libs/SDL2/docs/README-raspberrypi.md index 556b9f8d..d2eddb86 100644 --- a/libs/SDL2/docs/README-raspberrypi.md +++ b/libs/SDL2/docs/README-raspberrypi.md @@ -63,7 +63,7 @@ Now, before chrooting into the ARM sysroot, you'll need to apply a workaround, 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 --git a/libs/SDL2/docs/README-versions.md b/libs/SDL2/docs/README-versions.md new file mode 100644 index 00000000..097dba1c --- /dev/null +++ b/libs/SDL2/docs/README-versions.md @@ -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 --git a/libs/SDL2/docs/README-visualc.md b/libs/SDL2/docs/README-visualc.md index ea2bc185..759752a5 100644 --- a/libs/SDL2/docs/README-visualc.md +++ b/libs/SDL2/docs/README-visualc.md @@ -1,7 +1,7 @@ Using SDL with Microsoft Visual C++ =================================== -### by [Lion Kimbro](mailto:snowlion@sprynet.com) with additions by [James Turk](mailto:james@conceptofzero.net) +### by Lion Kimbro with additions by James Turk You can either use the precompiled libraries from the [SDL](https://www.libsdl.org/download.php) web site, or you can build SDL yourself. diff --git a/libs/SDL2/docs/README-vita.md b/libs/SDL2/docs/README-vita.md index aefa1970..503fef7d 100644 --- a/libs/SDL2/docs/README-vita.md +++ b/libs/SDL2/docs/README-vita.md @@ -3,7 +3,7 @@ PS Vita SDL port for the Sony Playstation Vita and Sony Playstation TV Credit to -* xerpi and rsn8887 for initial (vita2d) port +* xerpi, cpasjuste and rsn8887 for initial (vita2d) port * vitasdk/dolcesdk devs * CBPS discord (Namely Graphene and SonicMastr) @@ -22,6 +22,9 @@ Notes * gles1/gles2 support and renderers are disabled by default and can be enabled by configuring with `-DVIDEO_VITA_PVR=ON` These renderers support 720p and 1080i resolutions. These can be specified with: `SDL_setenv("VITA_RESOLUTION", "720", 1);` and `SDL_setenv("VITA_RESOLUTION", "1080", 1);` +* Desktop GL 1.X and 2.X support and renderers are also disabled by default and also can be enabled with `-DVIDEO_VITA_PVR=ON` as long as gl4es4vita is present in your SDK. + They support the same resolutions as the gles1/gles2 backends and require specifying `SDL_setenv("VITA_PVR_OGL", "1", 1);` + anytime before video subsystem initialization. * gles2 support via PIB is disabled by default and can be enabled by configuring with `-DVIDEO_VITA_PIB=ON` * By default SDL emits mouse events for touch events on every touchscreen. Vita has two touchscreens, so it's recommended to use `SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");` and handle touch events instead. diff --git a/libs/SDL2/docs/README-windows.md b/libs/SDL2/docs/README-windows.md index 71f968ee..ed0c93e2 100644 --- a/libs/SDL2/docs/README-windows.md +++ b/libs/SDL2/docs/README-windows.md @@ -1,45 +1,58 @@ -Windows -================================================================================ +# Windows -================================================================================ -OpenGL ES 2.x support -================================================================================ +## LLVM and Intel C++ compiler support -SDL has support for OpenGL ES 2.x under Windows via two alternative -implementations. -The most straightforward method consists in running your app in a system with -a graphic card paired with a relatively recent (as of November of 2013) driver -which supports the WGL_EXT_create_context_es2_profile extension. Vendors known +SDL will build with the Visual Studio project files with LLVM-based compilers, such as the Intel oneAPI C++ +compiler, but you'll have to manually add the "-msse3" command line option +to at least the SDL_audiocvt.c source file, and possibly others. This may +not be necessary if you build SDL with CMake instead of the included Visual +Studio solution. + +Details are here: https://github.com/libsdl-org/SDL/issues/5186 + + +## OpenGL ES 2.x support + +SDL has support for OpenGL ES 2.x under Windows via two alternative +implementations. + +The most straightforward method consists in running your app in a system with +a graphic card paired with a relatively recent (as of November of 2013) driver +which supports the WGL_EXT_create_context_es2_profile extension. Vendors known to ship said extension on Windows currently include nVidia and Intel. -The other method involves using the ANGLE library (https://code.google.com/p/angleproject/) -If an OpenGL ES 2.x context is requested and no WGL_EXT_create_context_es2_profile -extension is found, SDL will try to load the libEGL.dll library provided by -ANGLE. +The other method involves using the +[ANGLE library](https://code.google.com/p/angleproject/). If an OpenGL ES 2.x +context is requested and no WGL_EXT_create_context_es2_profile extension is +found, SDL will try to load the libEGL.dll library provided by ANGLE. + To obtain the ANGLE binaries, you can either compile from source from -https://chromium.googlesource.com/angle/angle or copy the relevant binaries from -a recent Chrome/Chromium install for Windows. The files you need are: - - * libEGL.dll - * libGLESv2.dll - * d3dcompiler_46.dll (supports Windows Vista or later, better shader compiler) - or... - * d3dcompiler_43.dll (supports Windows XP or later) +https://chromium.googlesource.com/angle/angle or copy the relevant binaries +from a recent Chrome/Chromium install for Windows. The files you need are: + +- libEGL.dll +- libGLESv2.dll +- d3dcompiler_46.dll (supports Windows Vista or later, better shader + compiler) *or* d3dcompiler_43.dll (supports Windows XP or later) If you compile ANGLE from source, you can configure it so it does not need the -d3dcompiler_* DLL at all (for details on this, see their documentation). +d3dcompiler_* DLL at all (for details on this, see their documentation). However, by default SDL will try to preload the d3dcompiler_46.dll to -comply with ANGLE's requirements. If you wish SDL to preload d3dcompiler_43.dll (to -support Windows XP) or to skip this step at all, you can use the -SDL_HINT_VIDEO_WIN_D3DCOMPILER hint (see SDL_hints.h for more details). +comply with ANGLE's requirements. If you wish SDL to preload +d3dcompiler_43.dll (to support Windows XP) or to skip this step at all, you +can use the SDL_HINT_VIDEO_WIN_D3DCOMPILER hint (see SDL_hints.h for more +details). Known Bugs: - - * SDL_GL_SetSwapInterval is currently a no op when using ANGLE. It appears - that there's a bug in the library which prevents the window contents from - refreshing if this is set to anything other than the default value. - -Vulkan Surface Support -============== -Support for creating Vulkan surfaces is configured on by default. To disable it change the value of `SDL_VIDEO_VULKAN` to 0 in `SDL_config_windows.h`. You must install the [Vulkan SDK](https://www.lunarg.com/vulkan-sdk/) in order to use Vulkan graphics in your application. +- SDL_GL_SetSwapInterval is currently a no op when using ANGLE. It appears + that there's a bug in the library which prevents the window contents from + refreshing if this is set to anything other than the default value. + +## Vulkan Surface Support + +Support for creating Vulkan surfaces is configured on by default. To disable +it change the value of `SDL_VIDEO_VULKAN` to 0 in `SDL_config_windows.h`. You +must install the [Vulkan SDK](https://www.lunarg.com/vulkan-sdk/) in order to +use Vulkan graphics in your application. + diff --git a/libs/SDL2/docs/README.md b/libs/SDL2/docs/README.md index 2dd8f1d6..99ec2287 100644 --- a/libs/SDL2/docs/README.md +++ b/libs/SDL2/docs/README.md @@ -14,7 +14,7 @@ hardware via OpenGL and Direct3D. It is used by video playback software, emulators, and popular games including Valve's award winning catalog and many Humble Bundle games. -SDL officially supports Windows, Mac OS X, Linux, iOS, and Android. +SDL officially supports Windows, macOS, Linux, iOS, and Android. Support for other platforms may be found in the source code. SDL is written in C, works natively with C++, and there are bindings @@ -34,23 +34,27 @@ More documentation and FAQs are available online at [the wiki](http://wiki.libsd - [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) - [Linux](README-linux.md) -- [OS X](README-macosx.md) +- [macOS](README-macos.md) - [OS/2](README-os2.md) - [Native Client](README-nacl.md) - [Pandora](README-pandora.md) - [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 --git a/libs/SDL2/docs/doxyfile b/libs/SDL2/docs/doxyfile index baf1c98d..7b80a3a8 100644 --- a/libs/SDL2/docs/doxyfile +++ b/libs/SDL2/docs/doxyfile @@ -640,6 +640,7 @@ EXCLUDE = ../include/SDL_opengles2_gl2ext.h \ ../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 --git a/libs/SDL2/docs/release_checklist.md b/libs/SDL2/docs/release_checklist.md new file mode 100644 index 00000000..b5d9bafb --- /dev/null +++ b/libs/SDL2/docs/release_checklist.md @@ -0,0 +1,92 @@ +# 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` + * `build-scripts/winrtbuild.ps1`: `$SDLVersion` + * `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 --git a/libs/SDL2/include/SDL_assert.h b/libs/SDL2/include/SDL_assert.h index defadf13..e71cf979 100644 --- a/libs/SDL2/include/SDL_assert.h +++ b/libs/SDL2/include/SDL_assert.h @@ -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 @@ assert can have unique static variables associated with it. /* 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 @@ assert can have unique static variables associated with it. #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 --git a/libs/SDL2/include/SDL_audio.h b/libs/SDL2/include/SDL_audio.h index 181f66c5..01d19787 100644 --- a/libs/SDL2/include/SDL_audio.h +++ b/libs/SDL2/include/SDL_audio.h @@ -500,9 +500,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index, * hardware. * * `spec` will be filled with the sample rate, sample format, and channel - * count. All other values in the structure are filled with 0. When the - * supported struct members are 0, SDL was unable to get the property from the - * backend. + * count. * * \param index the index of the audio device; valid values range from 0 to * SDL_GetNumAudioDevices() - 1 @@ -586,6 +584,7 @@ extern DECLSPEC int SDLCALL SDL_GetAudioDeviceSpec(int index, * - `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 --git a/libs/SDL2/include/SDL_blendmode.h b/libs/SDL2/include/SDL_blendmode.h index b6d140db..08c9f9dd 100644 --- a/libs/SDL2/include/SDL_blendmode.h +++ b/libs/SDL2/include/SDL_blendmode.h @@ -67,9 +67,8 @@ typedef enum SDL_BLENDOPERATION_ADD = 0x1, /**< dst + src: supported by all renderers */ SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */ SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */ - SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by D3D11 */ - SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by D3D11 */ - + SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by D3D9, D3D11 */ + SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by D3D9, D3D11 */ } SDL_BlendOperation; /** @@ -87,7 +86,6 @@ typedef enum SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = 0x8, /**< 1-dstR, 1-dstG, 1-dstB, 1-dstA */ SDL_BLENDFACTOR_DST_ALPHA = 0x9, /**< dstA, dstA, dstA, dstA */ SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 0xA /**< 1-dstA, 1-dstA, 1-dstA, 1-dstA */ - } SDL_BlendFactor; /** @@ -135,10 +133,10 @@ typedef enum * SDL 2.0.6. All renderers support the four blend modes listed in the * SDL_BlendMode enumeration. * - * - **direct3d**: Supports `SDL_BLENDOPERATION_ADD` with all factors. - * - **direct3d11**: Supports all operations with all factors. However, some + * - **direct3d**: Supports all operations with all factors. However, some * factors produce unexpected results with `SDL_BLENDOPERATION_MINIMUM` and * `SDL_BLENDOPERATION_MAXIMUM`. + * - **direct3d11**: Same as Direct3D 9. * - **opengl**: Supports the `SDL_BLENDOPERATION_ADD` operation with all * factors. OpenGL versions 1.1, 1.2, and 1.3 do not work correctly with SDL * 2.0.6. diff --git a/libs/SDL2/include/SDL_config.h b/libs/SDL2/include/SDL_config.h index 13014df8..f91cb47e 100644 --- a/libs/SDL2/include/SDL_config.h +++ b/libs/SDL2/include/SDL_config.h @@ -33,18 +33,22 @@ #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__) #include "SDL_config_iphoneos.h" #elif defined(__ANDROID__) #include "SDL_config_android.h" -#elif defined(__PSP__) -#include "SDL_config_psp.h" #elif defined(__OS2__) #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 --git a/libs/SDL2/include/SDL_config.h.cmake b/libs/SDL2/include/SDL_config.h.cmake index 7f96bbe2..043817f4 100644 --- a/libs/SDL2/include/SDL_config.h.cmake +++ b/libs/SDL2/include/SDL_config.h.cmake @@ -88,6 +88,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 +243,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@ @@ -253,12 +255,16 @@ #cmakedefine HAVE_AUDIOCLIENT_H @HAVE_AUDIOCLIENT_H@ #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@ @@ -277,6 +283,8 @@ #cmakedefine SDL_VIDEO_DISABLED @SDL_VIDEO_DISABLED@ #cmakedefine SDL_POWER_DISABLED @SDL_POWER_DISABLED@ #cmakedefine SDL_FILESYSTEM_DISABLED @SDL_FILESYSTEM_DISABLED@ +#cmakedefine SDL_LOCALE_DISABLED @SDL_LOCALE_DISABLED@ +#cmakedefine SDL_MISC_DISABLED @SDL_MISC_DISABLED@ /* Enable various audio drivers */ #cmakedefine SDL_AUDIO_DRIVER_ALSA @SDL_AUDIO_DRIVER_ALSA@ @@ -317,6 +325,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@ @@ -340,6 +349,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@ @@ -371,6 +381,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@ @@ -380,6 +391,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@ @@ -417,28 +429,25 @@ #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@ @@ -490,9 +499,15 @@ #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@ + +/* Enable locale subsystem */ +#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@ @@ -512,6 +527,7 @@ #cmakedefine SDL_VIDEO_VITA_PIB @SDL_VIDEO_VITA_PIB@ #cmakedefine SDL_VIDEO_VITA_PVR @SDL_VIDEO_VITA_PVR@ +#cmakedefine SDL_VIDEO_VITA_PVR_OGL @SDL_VIDEO_VITA_PVR_OGL@ #if !defined(__WIN32__) && !defined(__WINRT__) # if !defined(_STDINT_H_) && !defined(_STDINT_H) && !defined(HAVE_STDINT_H) && !defined(_HAVE_STDINT_H) diff --git a/libs/SDL2/include/SDL_config.h.in b/libs/SDL2/include/SDL_config.h.in index 0d981b41..7b6eb5db 100644 --- a/libs/SDL2/include/SDL_config.h.in +++ b/libs/SDL2/include/SDL_config.h.in @@ -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 @@ -242,6 +245,8 @@ #undef HAVE_AUDIOCLIENT_H #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 @@ -263,6 +268,8 @@ #undef SDL_VIDEO_DISABLED #undef SDL_POWER_DISABLED #undef SDL_FILESYSTEM_DISABLED +#undef SDL_LOCALE_DISABLED +#undef SDL_MISC_DISABLED /* Enable various audio drivers */ #undef SDL_AUDIO_DRIVER_AAUDIO @@ -384,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 @@ -411,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 @@ -445,19 +449,27 @@ #undef SDL_POWER_HARDWIRED /* Enable system filesystem support */ +#undef SDL_FILESYSTEM_ANDROID #undef SDL_FILESYSTEM_HAIKU #undef SDL_FILESYSTEM_COCOA #undef SDL_FILESYSTEM_DUMMY +#undef SDL_FILESYSTEM_RISCOS #undef SDL_FILESYSTEM_UNIX #undef SDL_FILESYSTEM_WINDOWS #undef SDL_FILESYSTEM_NACL -#undef SDL_FILESYSTEM_ANDROID #undef SDL_FILESYSTEM_EMSCRIPTEN #undef SDL_FILESYSTEM_OS2 -#undef SDL_FILESYSTEM_RISCOS +#undef SDL_FILESYSTEM_VITA +#undef SDL_FILESYSTEM_PSP +#undef SDL_FILESYSTEM_PS2 + +/* Enable misc subsystem */ +#undef SDL_MISC_DUMMY + +/* Enable locale subsystem */ +#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 --git a/libs/SDL2/include/SDL_config_android.h b/libs/SDL2/include/SDL_config_android.h index 4a13a3a5..5a9cfc04 100644 --- a/libs/SDL2/include/SDL_config_android.h +++ b/libs/SDL2/include/SDL_config_android.h @@ -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 --git a/libs/SDL2/include/SDL_config_emscripten.h b/libs/SDL2/include/SDL_config_emscripten.h index 7efe3237..989e1243 100644 --- a/libs/SDL2/include/SDL_config_emscripten.h +++ b/libs/SDL2/include/SDL_config_emscripten.h @@ -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 @@ -185,6 +186,7 @@ /* Enable various threading systems */ #ifdef __EMSCRIPTEN_PTHREADS__ #define SDL_THREAD_PTHREAD 1 +#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 #endif /* Enable various timer systems */ diff --git a/libs/SDL2/include/SDL_config_iphoneos.h b/libs/SDL2/include/SDL_config_iphoneos.h index 0aa24256..48f9f9f9 100644 --- a/libs/SDL2/include/SDL_config_iphoneos.h +++ b/libs/SDL2/include/SDL_config_iphoneos.h @@ -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 --git a/libs/SDL2/include/SDL_config_macosx.h b/libs/SDL2/include/SDL_config_macosx.h index ff42e3d5..023ecaae 100644 --- a/libs/SDL2/include/SDL_config_macosx.h +++ b/libs/SDL2/include/SDL_config_macosx.h @@ -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 --git a/libs/SDL2/include/SDL_config_minimal.h b/libs/SDL2/include/SDL_config_minimal.h index 4df92f74..c74fcdb1 100644 --- a/libs/SDL2/include/SDL_config_minimal.h +++ b/libs/SDL2/include/SDL_config_minimal.h @@ -49,6 +49,7 @@ typedef unsigned long long uint64_t; typedef unsigned long uintptr_t; #else #define HAVE_STDINT_H 1 +#define HAVE_INTTYPES_H 1 #endif /* Visual Studio 2008 */ #ifdef __GNUC__ diff --git a/libs/SDL2/include/SDL_config_ngage.h b/libs/SDL2/include/SDL_config_ngage.h new file mode 100644 index 00000000..a9d2d37a --- /dev/null +++ b/libs/SDL2/include/SDL_config_ngage.h @@ -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 --git a/libs/SDL2/include/SDL_config_os2.h b/libs/SDL2/include/SDL_config_os2.h index 1728bd77..1583245e 100644 --- a/libs/SDL2/include/SDL_config_os2.h +++ b/libs/SDL2/include/SDL_config_os2.h @@ -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 --git a/libs/SDL2/include/SDL_config_pandora.h b/libs/SDL2/include/SDL_config_pandora.h index e0be390b..01bbf49b 100644 --- a/libs/SDL2/include/SDL_config_pandora.h +++ b/libs/SDL2/include/SDL_config_pandora.h @@ -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 --git a/libs/SDL2/include/SDL_config_psp.h b/libs/SDL2/include/SDL_config_psp.h deleted file mode 100644 index 72c1eb66..00000000 --- a/libs/SDL2/include/SDL_config_psp.h +++ /dev/null @@ -1,165 +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 SDL_config_psp_h_ -#define SDL_config_psp_h_ -#define SDL_config_h_ - -#include "SDL_platform.h" - -#ifdef __GNUC__ -#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1 -#endif - -#define HAVE_GCC_ATOMICS 1 - -#define STDC_HEADERS 1 -#define HAVE_ALLOCA_H 1 -#define HAVE_CTYPE_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_LIMITS_H 1 -#define HAVE_MATH_H 1 -#define HAVE_SIGNAL_H 1 -#define HAVE_STDINT_H 1 -#define HAVE_STDIO_H 1 -#define HAVE_STRING_H 1 -#define HAVE_SYS_TYPES_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_GETENV 1 -#define HAVE_SETENV 1 -#define HAVE_PUTENV 1 -#define HAVE_SETENV 1 -#define HAVE_UNSETENV 1 -#define HAVE_QSORT 1 -#define HAVE_ABS 1 -#define HAVE_BCOPY 1 -#define HAVE_MEMSET 1 -#define HAVE_MEMCPY 1 -#define HAVE_MEMMOVE 1 -#define HAVE_MEMCMP 1 -#define HAVE_STRLEN 1 -#define HAVE_STRLCPY 1 -#define HAVE_STRLCAT 1 -#define HAVE_STRCHR 1 -#define HAVE_STRRCHR 1 -#define HAVE_STRSTR 1 -#define HAVE_STRTOL 1 -#define HAVE_STRTOUL 1 -#define HAVE_STRTOLL 1 -#define HAVE_STRTOULL 1 -#define HAVE_STRTOD 1 -#define HAVE_ATOI 1 -#define HAVE_ATOF 1 -#define HAVE_STRCMP 1 -#define HAVE_STRNCMP 1 -#define HAVE_STRCASECMP 1 -#define HAVE_STRNCASECMP 1 -#define HAVE_VSSCANF 1 -#define HAVE_VSNPRINTF 1 -#define HAVE_M_PI 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_ATAN2F 1 -#define HAVE_CEIL 1 -#define HAVE_CEILF 1 -#define HAVE_COPYSIGN 1 -#define HAVE_COPYSIGNF 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_SCALBN 1 -#define HAVE_SCALBNF 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 -#define HAVE_SETJMP 1 -#define HAVE_NANOSLEEP 1 -/* #define HAVE_SYSCONF 1 */ -/* #define HAVE_SIGACTION 1 */ - - -/* PSP isn't that sophisticated */ -#define LACKS_SYS_MMAN_H 1 - -/* Enable the PSP thread support (src/thread/psp/\*.c) */ -#define SDL_THREAD_PSP 1 - -/* Enable the PSP timer support (src/timer/psp/\*.c) */ -#define SDL_TIMER_PSP 1 - -/* Enable the PSP joystick driver (src/joystick/psp/\*.c) */ -#define SDL_JOYSTICK_PSP 1 -#define SDL_JOYSTICK_VIRTUAL 1 - -/* Enable the dummy sensor driver */ -#define SDL_SENSOR_DUMMY 1 - -/* Enable the PSP audio driver (src/audio/psp/\*.c) */ -#define SDL_AUDIO_DRIVER_PSP 1 - -/* PSP video driver */ -#define SDL_VIDEO_DRIVER_PSP 1 - -/* PSP render driver */ -#define SDL_VIDEO_RENDER_PSP 1 - -#define SDL_POWER_PSP 1 - -/* Enable the PSP filesystem support (src/filesystem/psp/\*.c) */ -#define SDL_FILESYSTEM_PSP 1 - -/* PSP doesn't have haptic device (src/haptic/dummy/\*.c) */ -#define SDL_HAPTIC_DISABLED 1 - -/* PSP doesn't have HIDAPI available */ -#define SDL_HIDAPI_DISABLED 1 - -/* PSP can't load shared object (src/loadso/dummy/\*.c) */ -#define SDL_LOADSO_DISABLED 1 - -#endif /* SDL_config_psp_h_ */ diff --git a/libs/SDL2/include/SDL_config_windows.h b/libs/SDL2/include/SDL_config_windows.h index c9ed1cfe..3ad3e8ff 100644 --- a/libs/SDL2/include/SDL_config_windows.h +++ b/libs/SDL2/include/SDL_config_windows.h @@ -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) @@ -90,9 +102,14 @@ typedef unsigned int uintptr_t; # define SIZEOF_VOIDP 4 #endif +#ifdef __clang__ +# define HAVE_GCC_ATOMICS 1 +#endif + #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 */ @@ -100,11 +117,19 @@ typedef unsigned int uintptr_t; #endif #if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0602 /* Windows 8 SDK */ #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)) @@ -131,7 +156,11 @@ typedef unsigned int uintptr_t; #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 @@ -162,37 +191,40 @@ typedef unsigned int uintptr_t; #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 @@ -212,8 +244,18 @@ typedef unsigned int uintptr_t; #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 @@ -222,7 +264,9 @@ typedef unsigned int uintptr_t; #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 @@ -243,7 +287,11 @@ typedef unsigned int uintptr_t; #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 @@ -265,6 +313,9 @@ typedef unsigned int uintptr_t; #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 @@ -295,11 +346,6 @@ typedef unsigned int uintptr_t; /* 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 --git a/libs/SDL2/include/SDL_config_wingdk.h b/libs/SDL2/include/SDL_config_wingdk.h new file mode 100644 index 00000000..d456024f --- /dev/null +++ b/libs/SDL2/include/SDL_config_wingdk.h @@ -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 --git a/libs/SDL2/include/SDL_config_winrt.h b/libs/SDL2/include/SDL_config_winrt.h index 690ffe15..55694036 100644 --- a/libs/SDL2/include/SDL_config_winrt.h +++ b/libs/SDL2/include/SDL_config_winrt.h @@ -92,6 +92,10 @@ typedef unsigned int uintptr_t; # define SIZEOF_VOIDP 4 #endif +#ifdef __clang__ +# define HAVE_GCC_ATOMICS 1 +#endif + /* Useful headers */ #define HAVE_DXGI_H 1 #if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP @@ -119,6 +123,7 @@ typedef unsigned int uintptr_t; #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 @@ -191,6 +196,8 @@ typedef unsigned int uintptr_t; #define HAVE_TRUNCF 1 #define HAVE__FSEEKI64 1 +#define HAVE_ROAPI_H 1 + /* Enable various audio drivers */ #define SDL_AUDIO_DRIVER_WASAPI 1 #define SDL_AUDIO_DRIVER_DISK 1 @@ -243,6 +250,9 @@ typedef unsigned int uintptr_t; /* 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 @@ -250,9 +260,4 @@ typedef unsigned int uintptr_t; /* 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 --git a/libs/SDL2/include/SDL_config_wiz.h b/libs/SDL2/include/SDL_config_wiz.h deleted file mode 100644 index 29b8242e..00000000 --- a/libs/SDL2/include/SDL_config_wiz.h +++ /dev/null @@ -1,154 +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 SDL_config_wiz_h_ -#define SDL_config_wiz_h_ -#define SDL_config_h_ - -/* This is a set of defines to configure the SDL features */ - -/* General platform specific identifiers */ -#include "SDL_platform.h" - -#define SDL_BYTEORDER 1234 - -#define STDC_HEADERS 1 -#define HAVE_ALLOCA_H 1 -#define HAVE_CTYPE_H 1 -#define HAVE_ICONV_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_LIMITS_H 1 -#define HAVE_MALLOC_H 1 -#define HAVE_MATH_H 1 -#define HAVE_MEMORY_H 1 -#define HAVE_SIGNAL_H 1 -#define HAVE_STDARG_H 1 -#define HAVE_STDINT_H 1 -#define HAVE_STDIO_H 1 -#define HAVE_STDLIB_H 1 -#define HAVE_STRINGS_H 1 -#define HAVE_STRING_H 1 -#define HAVE_SYS_TYPES_H 1 - -#define HAVE_DLOPEN 1 -#define HAVE_MALLOC 1 -#define HAVE_CALLOC 1 -#define HAVE_REALLOC 1 -#define HAVE_FREE 1 -#define HAVE_ALLOCA 1 -#define HAVE_GETENV 1 -#define HAVE_SETENV 1 -#define HAVE_PUTENV 1 -#define HAVE_UNSETENV 1 -#define HAVE_QSORT 1 -#define HAVE_ABS 1 -#define HAVE_BCOPY 1 -#define HAVE_MEMSET 1 -#define HAVE_MEMCPY 1 -#define HAVE_MEMMOVE 1 -#define HAVE_STRLEN 1 -#define HAVE_STRCHR 1 -#define HAVE_STRRCHR 1 -#define HAVE_STRSTR 1 -#define HAVE_STRTOK_R 1 -#define HAVE_STRTOL 1 -#define HAVE_STRTOUL 1 -#define HAVE_STRTOLL 1 -#define HAVE_STRTOULL 1 -#define HAVE_ATOI 1 -#define HAVE_ATOF 1 -#define HAVE_STRCMP 1 -#define HAVE_STRNCMP 1 -#define HAVE_STRCASECMP 1 -#define HAVE_STRNCASECMP 1 -#define HAVE_VSSCANF 1 -#define HAVE_VSNPRINTF 1 -#define HAVE_M_PI 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_ATAN2F 1 -#define HAVE_CEIL 1 -#define HAVE_CEILF 1 -#define HAVE_COPYSIGN 1 -#define HAVE_COPYSIGNF 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_LROUND 1 -#define HAVE_LROUNDF 1 -#define HAVE_POW 1 -#define HAVE_POWF 1 -#define HAVE_ROUND 1 -#define HAVE_ROUNDF 1 -#define HAVE_SCALBN 1 -#define HAVE_SCALBNF 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 -#define HAVE_TRUNC 1 -#define HAVE_TRUNCF 1 -#define HAVE_SIGACTION 1 -#define HAVE_SETJMP 1 -#define HAVE_NANOSLEEP 1 -#define HAVE_POW 1 - -#define SDL_AUDIO_DRIVER_DUMMY 1 -#define SDL_AUDIO_DRIVER_OSS 1 - -#define SDL_INPUT_LINUXEV 1 -#define SDL_JOYSTICK_LINUX 1 -#define SDL_JOYSTICK_VIRTUAL 1 -#define SDL_HAPTIC_LINUX 1 - -#define SDL_SENSOR_DUMMY 1 - -#define SDL_LOADSO_DLOPEN 1 - -#define SDL_THREAD_PTHREAD 1 -#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1 - -#define SDL_TIMER_UNIX 1 - -#define SDL_VIDEO_DRIVER_DUMMY 1 -#define SDL_VIDEO_DRIVER_PANDORA 1 -#define SDL_VIDEO_RENDER_OGL_ES 1 -#define SDL_VIDEO_OPENGL_ES 1 - -#endif /* SDL_config_wiz_h_ */ diff --git a/libs/SDL2/include/SDL_config_xbox.h b/libs/SDL2/include/SDL_config_xbox.h new file mode 100644 index 00000000..4e68e9f9 --- /dev/null +++ b/libs/SDL2/include/SDL_config_xbox.h @@ -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 --git a/libs/SDL2/include/SDL_cpuinfo.h b/libs/SDL2/include/SDL_cpuinfo.h index 1fc40991..e31b139c 100644 --- a/libs/SDL2/include/SDL_cpuinfo.h +++ b/libs/SDL2/include/SDL_cpuinfo.h @@ -79,7 +79,7 @@ _m_prefetch(void *__P) #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 @@ _m_prefetch(void *__P) #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 @@ -433,6 +441,32 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasARMSIMD(void); */ 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. * @@ -494,7 +528,7 @@ extern DECLSPEC size_t SDLCALL SDL_SIMDGetAlignment(void); * * \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 @@ extern DECLSPEC void * SDLCALL SDL_SIMDAlloc(const size_t len); * * \since This function is available since SDL 2.0.14. * - * \sa SDL_SIMDAlignment + * \sa SDL_SIMDGetAlignment * \sa SDL_SIMDAlloc * \sa SDL_SIMDFree */ diff --git a/libs/SDL2/include/SDL_endian.h b/libs/SDL2/include/SDL_endian.h index 46c29625..e1c6b5ef 100644 --- a/libs/SDL2/include/SDL_endian.h +++ b/libs/SDL2/include/SDL_endian.h @@ -65,6 +65,15 @@ _m_prefetch(void *__P) #elif defined(__FreeBSD__) || defined(__NetBSD__) #include #define SDL_BYTEORDER BYTE_ORDER +/* predefs from newer gcc and clang versions: */ +#elif defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__) && defined(__BYTE_ORDER__) +#if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) +#define SDL_BYTEORDER SDL_LIL_ENDIAN +#elif (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) +#define SDL_BYTEORDER SDL_BIG_ENDIAN +#else +#error Unsupported endianness +#endif /**/ #else #if defined(__hppa__) || \ defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \ @@ -78,6 +87,28 @@ _m_prefetch(void *__P) #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 --git a/libs/SDL2/include/SDL_events.h b/libs/SDL2/include/SDL_events.h index 3722a631..c0fc9bb1 100644 --- a/libs/SDL2/include/SDL_events.h +++ b/libs/SDL2/include/SDL_events.h @@ -102,6 +102,7 @@ typedef enum SDL_KEYMAPCHANGED, /**< Keymap changed due to a system event such as an input language or keyboard layout change. */ + SDL_TEXTEDITING_EXT, /**< Extended keyboard text editing (composition) */ /* Mouse events */ SDL_MOUSEMOTION = 0x400, /**< Mouse moved */ @@ -117,6 +118,7 @@ typedef enum 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 */ @@ -243,6 +245,19 @@ typedef struct SDL_TextEditingEvent Sint32 length; /**< The length of selected editing text */ } SDL_TextEditingEvent; +/** + * \brief Extended keyboard text editing event structure (event.editExt.*) when text would be + * truncated if stored in the text buffer SDL_TextEditingEvent + */ +typedef struct SDL_TextEditingExtEvent +{ + Uint32 type; /**< ::SDL_TEXTEDITING_EXT */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + Uint32 windowID; /**< The window with keyboard focus, if any */ + char* text; /**< The editing text, which should be freed with SDL_free(), and will not be NULL */ + Sint32 start; /**< The start cursor of selected editing text */ + Sint32 length; /**< The length of selected editing text */ +} SDL_TextEditingExtEvent; #define SDL_TEXTINPUTEVENT_TEXT_SIZE (32) /** @@ -381,6 +396,16 @@ typedef struct SDL_JoyDeviceEvent 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.*) @@ -601,6 +626,7 @@ typedef union SDL_Event SDL_WindowEvent window; /**< Window event data */ SDL_KeyboardEvent key; /**< Keyboard event data */ SDL_TextEditingEvent edit; /**< Text editing event data */ + SDL_TextEditingExtEvent editExt; /**< Extended text editing event data */ SDL_TextInputEvent text; /**< Text input event data */ SDL_MouseMotionEvent motion; /**< Mouse motion event data */ SDL_MouseButtonEvent button; /**< Mouse button event data */ @@ -610,6 +636,7 @@ typedef union SDL_Event 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 --git a/libs/SDL2/include/SDL_gamecontroller.h b/libs/SDL2/include/SDL_gamecontroller.h index bdd9b899..0f3ce583 100644 --- a/libs/SDL2/include/SDL_gamecontroller.h +++ b/libs/SDL2/include/SDL_gamecontroller.h @@ -289,6 +289,25 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index); */ 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. * @@ -386,6 +405,23 @@ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromPlayerIndex(in */ 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 * @@ -457,6 +493,18 @@ extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProduct(SDL_GameController * */ 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. * @@ -869,8 +917,9 @@ extern DECLSPEC int SDLCALL SDL_GameControllerRumble(SDL_GameController *gamecon * calling it with 0 intensity stops any rumbling. * * Note that this is rumbling of the _triggers_ and not the game controller as - * a whole. The first controller to offer this feature was the PlayStation 5's - * DualShock 5. + * a whole. This is currently only supported on Xbox One controllers. If you + * want the (more common) whole-controller rumble, use + * SDL_GameControllerRumble() instead. * * \param gamecontroller The controller to vibrate * \param left_rumble The intensity of the left trigger rumble motor, from 0 diff --git a/libs/SDL2/include/SDL_guid.h b/libs/SDL2/include/SDL_guid.h new file mode 100644 index 00000000..b971636a --- /dev/null +++ b/libs/SDL2/include/SDL_guid.h @@ -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 --git a/libs/SDL2/include/SDL_hints.h b/libs/SDL2/include/SDL_hints.h index 514580fa..4a0e553a 100644 --- a/libs/SDL2/include/SDL_hints.h +++ b/libs/SDL2/include/SDL_hints.h @@ -392,13 +392,14 @@ extern "C" { #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 @@ -412,6 +413,19 @@ extern "C" { */ #define SDL_HINT_EVENT_LOGGING "SDL_EVENT_LOGGING" +/** + * \brief A variable controlling whether raising the window should be done more forcefully + * + * This variable can be set to the following values: + * "0" - No forcing (the default) + * "1" - Extra level of forcing + * + * At present, this is only an issue under MS Windows, which makes it nearly impossible to + * programmatically move a window to the foreground, for "security" reasons. See + * http://stackoverflow.com/a/34414846 for a discussion. + */ +#define SDL_HINT_FORCE_RAISEWINDOW "SDL_HINT_FORCE_RAISEWINDOW" + /** * \brief A variable controlling how 3D acceleration is used to accelerate the SDL screen surface. * @@ -566,6 +580,17 @@ extern "C" { */ #define SDL_HINT_IME_SHOW_UI "SDL_IME_SHOW_UI" +/** + * \brief A variable to control if extended IME text support is enabled. + * If enabled then SDL_TextEditingExtEvent will be issued if the text would be truncated otherwise. + * Additionally SDL_TextInputEvent will be dispatched multiple times so that it is not truncated. + * + * The variable can be set to the following values: + * "0" - Legacy behavior. Text can be truncated, no heap allocations. (default) + * "1" - Modern behavior. + */ +#define SDL_HINT_IME_SUPPORT_EXTENDED_TEXT "SDL_IME_SUPPORT_EXTENDED_TEXT" + /** * \brief A variable controlling whether the home indicator bar on iPhone X * should be hidden. @@ -612,7 +637,22 @@ extern "C" { */ #define SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE "SDL_JOYSTICK_HIDAPI_GAMECUBE" - /** +/** + * \brief A variable controlling whether "low_frequency_rumble" and "high_frequency_rumble" is used to implement + * the GameCube controller's 3 rumble modes, Stop(0), Rumble(1), and StopHard(2) + * this is useful for applications that need full compatibility for things like ADSR envelopes. + * Stop is implemented by setting "low_frequency_rumble" to "0" and "high_frequency_rumble" ">0" + * Rumble is both at any arbitrary value, + * StopHard is implemented by setting both "low_frequency_rumble" and "high_frequency_rumble" to "0" + * + * This variable can be set to the following values: + * "0" - Normal rumble behavior is behavior is used (default) + * "1" - Proper GameCube controller rumble behavior is used + * + */ +#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. * * This variable can be set to the following values: @@ -623,7 +663,7 @@ extern "C" { */ #define SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS "SDL_JOYSTICK_HIDAPI_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: @@ -760,17 +800,16 @@ extern "C" { */ #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: * "0" - RAWINPUT drivers are not used * "1" - RAWINPUT drivers are used (the default) - * */ #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: @@ -783,7 +822,16 @@ extern "C" { */ #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: + * "0" - ROG Chakram mice do not show up as joysticks (the default) + * "1" - ROG Chakram mice show up as joysticks + */ +#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 * @@ -817,14 +865,32 @@ extern "C" { */ #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: @@ -835,7 +901,7 @@ extern "C" { */ #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: @@ -886,6 +952,22 @@ extern "C" { */ #define SDL_HINT_MOUSE_NORMAL_SPEED_SCALE "SDL_MOUSE_NORMAL_SPEED_SCALE" +/** + * \brief A variable controlling whether relative mouse mode constrains the mouse to the center of the window + * + * This variable can be set to the following values: + * "0" - Relative mouse mode constrains the mouse to the window + * "1" - Relative mouse mode constrains the mouse to the center of the window + * + * Constraining to the center of the window works better for FPS games and when the + * application is running over RDP. Constraining to the whole window works better + * for 2D games and increases the chance that the mouse will be in the correct + * position when using high DPI mice. + * + * By default SDL will constrain the mouse to the center of the window + */ +#define SDL_HINT_MOUSE_RELATIVE_MODE_CENTER "SDL_MOUSE_RELATIVE_MODE_CENTER" + /** * \brief A variable controlling whether relative mouse mode is implemented using mouse warping * @@ -922,6 +1004,19 @@ extern "C" { */ #define SDL_HINT_MOUSE_TOUCH_EVENTS "SDL_MOUSE_TOUCH_EVENTS" +/** + * \brief A variable controlling whether the mouse is captured while mouse buttons are pressed + * + * This variable can be set to the following values: + * "0" - The mouse is not captured while mouse buttons are pressed + * "1" - The mouse is captured while mouse buttons are pressed + * + * By default the mouse is captured while mouse buttons are pressed so if the mouse is dragged + * outside the window, the application continues to receive mouse events until the button is + * released. + */ +#define SDL_HINT_MOUSE_AUTO_CAPTURE "SDL_MOUSE_AUTO_CAPTURE" + /** * \brief Tell SDL not to catch the SIGINT or SIGTERM signals. * @@ -1105,6 +1200,8 @@ extern "C" { * * This variable is case insensitive and can be set to the following values: * "direct3d" + * "direct3d11" + * "direct3d12" * "opengl" * "opengles2" * "opengles" @@ -1161,7 +1258,7 @@ extern "C" { */ #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. * @@ -1278,6 +1375,18 @@ extern "C" { */ #define SDL_HINT_TOUCH_MOUSE_EVENTS "SDL_TOUCH_MOUSE_EVENTS" +/** + * \brief A variable controlling which touchpad should generate synthetic mouse events + * + * This variable can be set to the following values: + * "0" - Only front touchpad should generate mouse events. Default + * "1" - Only back touchpad should generate mouse events. + * "2" - Both touchpads should generate mouse events. + * + * By default SDL will generate mouse events for all touch devices + */ +#define SDL_HINT_VITA_TOUCH_MOUSE_DEVICE "SDL_HINT_VITA_TOUCH_MOUSE_DEVICE" + /** * \brief A variable controlling whether the Android / tvOS remotes * should be listed as joystick devices, instead of sending keyboard events. @@ -1362,9 +1471,7 @@ extern "C" { * 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" @@ -1387,6 +1494,35 @@ extern "C" { */ #define SDL_HINT_VIDEO_WAYLAND_ALLOW_LIBDECOR "SDL_VIDEO_WAYLAND_ALLOW_LIBDECOR" +/** + * \brief A variable controlling whether the libdecor Wayland backend is preferred over native decrations. + * + * When this hint is set, libdecor will be used to provide window decorations, even if xdg-decoration is + * available. (Note that, by default, libdecor will use xdg-decoration itself if available). + * + * This variable can be set to the following values: + * "0" - libdecor is enabled only if server-side decorations are unavailable. + * "1" - libdecor is always enabled if available. + * + * libdecor is used over xdg-shell when xdg-decoration protocol is unavailable. + */ +#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"). * @@ -1406,6 +1542,28 @@ extern "C" { */ #define SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT "SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT" +/** + * \brief When calling SDL_CreateWindowFrom(), make the window compatible with OpenGL. + * + * This variable can be set to the following values: + * "0" - Don't add any graphics flags to the SDL_WindowFlags + * "1" - Add SDL_WINDOW_OPENGL to the SDL_WindowFlags + * + * By default SDL will not make the foreign window compatible with OpenGL. + */ +#define SDL_HINT_VIDEO_FOREIGN_WINDOW_OPENGL "SDL_VIDEO_FOREIGN_WINDOW_OPENGL" + +/** + * \brief When calling SDL_CreateWindowFrom(), make the window compatible with Vulkan. + * + * This variable can be set to the following values: + * "0" - Don't add any graphics flags to the SDL_WindowFlags + * "1" - Add SDL_WINDOW_VULKAN to the SDL_WindowFlags + * + * By default SDL will not make the foreign window compatible with Vulkan. + */ +#define SDL_HINT_VIDEO_FOREIGN_WINDOW_VULKAN "SDL_VIDEO_FOREIGN_WINDOW_VULKAN" + /** * \brief A variable specifying which shader compiler to preload when using the Chrome ANGLE binaries * @@ -1466,13 +1624,11 @@ extern "C" { #define SDL_HINT_VIDEO_X11_WINDOW_VISUALID "SDL_VIDEO_X11_WINDOW_VISUALID" /** - * \brief A variable controlling whether the X11 Xinerama extension should be used. + * \brief A no-longer-used 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 - * - * 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" @@ -1483,18 +1639,16 @@ extern "C" { * "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. + * \brief A no-longer-used 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 - * - * 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" @@ -1654,6 +1808,57 @@ extern "C" { */ #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 * @@ -1796,6 +2001,15 @@ extern "C" { */ #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. * @@ -1840,11 +2054,81 @@ extern "C" { * If not set or set to "", this hint is ignored. This hint must be set * before the SDL_CreateWindow() call that it is intended to affect. * - * This hint is available since SDL 2.0.22. Before then, virtual devices are - * always ignored. + * This hint is available since SDL 2.0.22. */ #define SDL_HINT_X11_WINDOW_TYPE "SDL_X11_WINDOW_TYPE" +/** + * \brief A variable that decides whether to send SDL_QUIT when closing the final window. + * + * By default, SDL sends an SDL_QUIT event when there is only one window + * and it receives an SDL_WINDOWEVENT_CLOSE event, under the assumption most + * apps would also take the loss of this window as a signal to terminate the + * program. + * + * However, it's not unreasonable in some cases to have the program continue + * to live on, perhaps to create new windows later. + * + * Changing this hint to "0" will cause SDL to not send an SDL_QUIT event + * when the final window is requesting to close. Note that in this case, + * there are still other legitimate reasons one might get an SDL_QUIT + * event: choosing "Quit" from the macOS menu bar, sending a SIGINT (ctrl-c) + * on Unix, etc. + * + * The default value is "1". This hint can be changed at any time. + * + * This hint is available since SDL 2.0.22. Before then, you always get + * an SDL_QUIT event when closing the final window. + */ +#define SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE "SDL_QUIT_ON_LAST_WINDOW_CLOSE" + + +/** + * \brief A variable that decides what video backend to use. + * + * By default, SDL will try all available video backends in a reasonable + * order until it finds one that can work, but this hint allows the app + * or user to force a specific target, such as "x11" if, say, you are + * on Wayland but want to try talking to the X server instead. + * + * This functionality has existed since SDL 2.0.0 (indeed, before that) + * but before 2.0.22 this was an environment variable only. In 2.0.22, + * it was upgraded to a full SDL hint, so you can set the environment + * variable as usual or programatically set the hint with SDL_SetHint, + * which won't propagate to child processes. + * + * The default value is unset, in which case SDL will try to figure out + * the best video backend on your behalf. This hint needs to be set + * before SDL_Init() is called to be useful. + * + * This hint is available since SDL 2.0.22. Before then, you could set + * the environment variable to get the same effect. + */ +#define SDL_HINT_VIDEODRIVER "SDL_VIDEODRIVER" + +/** + * \brief A variable that decides what audio backend to use. + * + * By default, SDL will try all available audio backends in a reasonable + * order until it finds one that can work, but this hint allows the app + * or user to force a specific target, such as "alsa" if, say, you are + * on PulseAudio but want to try talking to the lower level instead. + * + * This functionality has existed since SDL 2.0.0 (indeed, before that) + * but before 2.0.22 this was an environment variable only. In 2.0.22, + * it was upgraded to a full SDL hint, so you can set the environment + * variable as usual or programatically set the hint with SDL_SetHint, + * which won't propagate to child processes. + * + * The default value is unset, in which case SDL will try to figure out + * the best audio backend on your behalf. This hint needs to be set + * before SDL_Init() is called to be useful. + * + * This hint is available since SDL 2.0.22. Before then, you could set + * the environment variable to get the same effect. + */ +#define SDL_HINT_AUDIODRIVER "SDL_AUDIODRIVER" + /** * \brief An enumeration of hint priorities diff --git a/libs/SDL2/include/SDL_joystick.h b/libs/SDL2/include/SDL_joystick.h index e80c0057..60bd470f 100644 --- a/libs/SDL2/include/SDL_joystick.h +++ b/libs/SDL2/include/SDL_joystick.h @@ -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 @@ struct _SDL_Joystick; 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 @@ extern DECLSPEC void SDLCALL SDL_UnlockJoysticks(void); * \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); @@ -174,6 +174,23 @@ extern DECLSPEC int SDLCALL SDL_NumJoysticks(void); */ 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. @@ -330,6 +347,54 @@ extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtual(SDL_JoystickType type, int nbuttons, 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. * @@ -419,6 +484,19 @@ extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualHat(SDL_Joystick *joystick, in */ 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. * @@ -495,6 +573,19 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProduct(SDL_Joystick *joystick); */ 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. * @@ -829,9 +920,9 @@ extern DECLSPEC int SDLCALL SDL_JoystickRumble(SDL_Joystick *joystick, Uint16 lo * Each call to this function cancels any previous trigger rumble effect, and * calling it with 0 intensity stops any rumbling. * - * Note that this function is for _trigger_ rumble; the first joystick to - * support this was the PlayStation 5's DualShock 5 controller. If you want - * the (more common) whole-controller rumble, use SDL_JoystickRumble() + * Note that this is rumbling of the _triggers_ and not the game controller as + * a whole. This is currently only supported on Xbox One controllers. If you + * want the (more common) whole-controller rumble, use SDL_JoystickRumble() * instead. * * \param joystick The joystick to vibrate diff --git a/libs/SDL2/include/SDL_keyboard.h b/libs/SDL2/include/SDL_keyboard.h index a53dde68..0aa59907 100644 --- a/libs/SDL2/include/SDL_keyboard.h +++ b/libs/SDL2/include/SDL_keyboard.h @@ -268,9 +268,30 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputActive(void); */ extern DECLSPEC void SDLCALL SDL_StopTextInput(void); +/** + * Dismiss the composition window/IME without disabling the subsystem. + * + * \since This function is available since SDL 2.0.22. + * + * \sa SDL_StartTextInput + * \sa SDL_StopTextInput + */ +extern DECLSPEC void SDLCALL SDL_ClearComposition(void); + +/** + * Returns if an IME Composite or Candidate window is currently shown. + * + * \since This function is available since SDL 2.0.22. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputShown(void); + /** * Set the rectangle used to type Unicode text inputs. * + * Note: If you want use system native IME window, try to set hint + * **SDL_HINT_IME_SHOW_UI** to **1**, otherwise this function won't give you + * any feedback. + * * \param rect the SDL_Rect structure representing the rectangle to receive * text (ignored if NULL) * diff --git a/libs/SDL2/include/SDL_keycode.h b/libs/SDL2/include/SDL_keycode.h index 35602541..65420f29 100644 --- a/libs/SDL2/include/SDL_keycode.h +++ b/libs/SDL2/include/SDL_keycode.h @@ -318,7 +318,12 @@ typedef enum 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 --git a/libs/SDL2/include/SDL_log.h b/libs/SDL2/include/SDL_log.h index dbbcb1e6..1d8b20b6 100644 --- a/libs/SDL2/include/SDL_log.h +++ b/libs/SDL2/include/SDL_log.h @@ -47,9 +47,9 @@ extern "C" { /** - * \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 --git a/libs/SDL2/include/SDL_main.h b/libs/SDL2/include/SDL_main.h index b3fec15f..1af74e92 100644 --- a/libs/SDL2/include/SDL_main.h +++ b/libs/SDL2/include/SDL_main.h @@ -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,9 @@ */ #define SDL_MAIN_AVAILABLE +#elif defined(__PS2__) +#define SDL_MAIN_AVAILABLE + #endif #endif /* SDL_MAIN_HANDLED */ @@ -145,7 +157,7 @@ extern SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]); */ 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 +201,7 @@ extern DECLSPEC int SDLCALL SDL_RegisterApp(const char *name, Uint32 style, void */ extern DECLSPEC void SDLCALL SDL_UnregisterApp(void); -#endif /* __WIN32__ */ +#endif /* defined(__WIN32__) || defined(__GDK__) */ #ifdef __WINRT__ @@ -224,6 +236,21 @@ extern DECLSPEC int SDLCALL SDL_UIKitRunApp(int argc, char *argv[], SDL_main_fun #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 --git a/libs/SDL2/include/SDL_metal.h b/libs/SDL2/include/SDL_metal.h index 9ecaa815..eb308287 100644 --- a/libs/SDL2/include/SDL_metal.h +++ b/libs/SDL2/include/SDL_metal.h @@ -92,6 +92,7 @@ extern DECLSPEC void *SDLCALL SDL_Metal_GetLayer(SDL_MetalView view); * * \param window SDL_Window from which the drawable size should be queried * \param w Pointer to variable for storing the width in pixels, may be NULL + * \param h Pointer to variable for storing the height in pixels, may be NULL * * \since This function is available since SDL 2.0.14. * diff --git a/libs/SDL2/include/SDL_platform.h b/libs/SDL2/include/SDL_platform.h index 79b8b6f4..f1f6f8b0 100644 --- a/libs/SDL2/include/SDL_platform.h +++ b/libs/SDL2/include/SDL_platform.h @@ -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 --git a/libs/SDL2/include/SDL_rect.h b/libs/SDL2/include/SDL_rect.h index 6616ba6a..6c641c58 100644 --- a/libs/SDL2/include/SDL_rect.h +++ b/libs/SDL2/include/SDL_rect.h @@ -54,8 +54,8 @@ typedef struct SDL_Point /** * The structure that defines a point (floating point) * - * \sa SDL_EnclosePoints - * \sa SDL_PointInRect + * \sa SDL_EncloseFPoints + * \sa SDL_PointInFRect */ typedef struct SDL_FPoint { @@ -71,6 +71,7 @@ typedef struct SDL_FPoint * \sa SDL_RectEquals * \sa SDL_HasIntersection * \sa SDL_IntersectRect + * \sa SDL_IntersectRectAndLine * \sa SDL_UnionRect * \sa SDL_EnclosePoints */ @@ -83,6 +84,16 @@ typedef struct SDL_Rect /** * A rectangle, with the origin at the upper left (floating point). + * + * \sa SDL_FRectEmpty + * \sa SDL_FRectEquals + * \sa SDL_FRectEqualsEpsilon + * \sa SDL_HasIntersectionF + * \sa SDL_IntersectFRect + * \sa SDL_IntersectFRectAndLine + * \sa SDL_UnionFRect + * \sa SDL_EncloseFPoints + * \sa SDL_PointInFRect */ typedef struct SDL_FRect { @@ -213,6 +224,147 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect * int *Y1, int *X2, int *Y2); + +/* SDL_FRect versions... */ + +/** + * Returns true if point resides inside a rectangle. + */ +SDL_FORCE_INLINE SDL_bool SDL_PointInFRect(const SDL_FPoint *p, const SDL_FRect *r) +{ + return ( (p->x >= r->x) && (p->x < (r->x + r->w)) && + (p->y >= r->y) && (p->y < (r->y + r->h)) ) ? SDL_TRUE : SDL_FALSE; +} + +/** + * Returns true if the rectangle has no area. + */ +SDL_FORCE_INLINE SDL_bool SDL_FRectEmpty(const SDL_FRect *r) +{ + return ((!r) || (r->w <= 0.0f) || (r->h <= 0.0f)) ? SDL_TRUE : SDL_FALSE; +} + +/** + * Returns true if the two rectangles are equal, within some given epsilon. + * + * \since This function is available since SDL 2.0.22. + */ +SDL_FORCE_INLINE SDL_bool SDL_FRectEqualsEpsilon(const SDL_FRect *a, const SDL_FRect *b, const float epsilon) +{ + return (a && b && ((a == b) || + ((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; +} + +/** + * Returns true if the two rectangles are equal, using a default epsilon. + * + * \since This function is available since SDL 2.0.22. + */ +SDL_FORCE_INLINE SDL_bool SDL_FRectEquals(const SDL_FRect *a, const SDL_FRect *b) +{ + return SDL_FRectEqualsEpsilon(a, b, SDL_FLT_EPSILON); +} + +/** + * Determine whether two rectangles intersect with float precision. + * + * If either pointer is NULL the function will return SDL_FALSE. + * + * \param A an SDL_FRect structure representing the first rectangle + * \param B an SDL_FRect structure representing the second rectangle + * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.0.22. + * + * \sa SDL_IntersectRect + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersectionF(const SDL_FRect * A, + const SDL_FRect * B); + +/** + * Calculate the intersection of two rectangles with float precision. + * + * If `result` is NULL then this function will return SDL_FALSE. + * + * \param A an SDL_FRect structure representing the first rectangle + * \param B an SDL_FRect structure representing the second rectangle + * \param result an SDL_FRect structure filled in with the intersection of + * rectangles `A` and `B` + * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.0.22. + * + * \sa SDL_HasIntersectionF + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IntersectFRect(const SDL_FRect * A, + const SDL_FRect * B, + SDL_FRect * result); + +/** + * Calculate the union of two rectangles with float precision. + * + * \param A an SDL_FRect structure representing the first rectangle + * \param B an SDL_FRect structure representing the second rectangle + * \param result an SDL_FRect structure filled in with the union of rectangles + * `A` and `B` + * + * \since This function is available since SDL 2.0.22. + */ +extern DECLSPEC void SDLCALL SDL_UnionFRect(const SDL_FRect * A, + const SDL_FRect * B, + SDL_FRect * result); + +/** + * Calculate a minimal rectangle enclosing a set of points with float + * precision. + * + * If `clip` is not NULL then only points inside of the clipping rectangle are + * considered. + * + * \param points an array of SDL_FPoint structures representing points to be + * enclosed + * \param count the number of structures in the `points` array + * \param clip an SDL_FRect used for clipping or NULL to enclose all points + * \param result an SDL_FRect structure filled in with the minimal enclosing + * rectangle + * \returns SDL_TRUE if any points were enclosed or SDL_FALSE if all the + * points were outside of the clipping rectangle. + * + * \since This function is available since SDL 2.0.22. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_EncloseFPoints(const SDL_FPoint * points, + int count, + const SDL_FRect * clip, + SDL_FRect * result); + +/** + * Calculate the intersection of a rectangle and line segment with float + * precision. + * + * This function is used to clip a line segment to a rectangle. A line segment + * contained entirely within the rectangle or that does not intersect will + * remain unchanged. A line segment that crosses the rectangle at either or + * both ends will be clipped to the boundary of the rectangle and the new + * coordinates saved in `X1`, `Y1`, `X2`, and/or `Y2` as necessary. + * + * \param rect an SDL_FRect structure representing the rectangle to intersect + * \param X1 a pointer to the starting X-coordinate of the line + * \param Y1 a pointer to the starting Y-coordinate of the line + * \param X2 a pointer to the ending X-coordinate of the line + * \param Y2 a pointer to the ending Y-coordinate of the line + * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.0.22. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IntersectFRectAndLine(const SDL_FRect * + rect, float *X1, + float *Y1, float *X2, + float *Y2); + /* Ends C function definitions when using C++ */ #ifdef __cplusplus } diff --git a/libs/SDL2/include/SDL_render.h b/libs/SDL2/include/SDL_render.h index a7e4908a..3ff625e0 100644 --- a/libs/SDL2/include/SDL_render.h +++ b/libs/SDL2/include/SDL_render.h @@ -261,6 +261,17 @@ extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateSoftwareRenderer(SDL_Surface * */ extern DECLSPEC SDL_Renderer * SDLCALL SDL_GetRenderer(SDL_Window * window); +/** + * Get the window associated with a renderer. + * + * \param renderer the renderer to query + * \returns the window on success or NULL on failure; call SDL_GetError() for + * more information. + * + * \since This function is available since SDL 2.0.22. + */ +extern DECLSPEC SDL_Window * SDLCALL SDL_RenderGetWindow(SDL_Renderer *renderer); + /** * Get information about a rendering context. * @@ -356,11 +367,15 @@ extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureFromSurface(SDL_Renderer * \param texture the texture to query * \param format a pointer filled in with the raw format of the texture; the * actual format may differ, but pixel transfers will use this - * format (one of the SDL_PixelFormatEnum values) + * format (one of the SDL_PixelFormatEnum values). This argument + * can be NULL if you don't need this information. * \param access a pointer filled in with the actual access to the texture - * (one of the SDL_TextureAccess values) - * \param w a pointer filled in with the width of the texture in pixels - * \param h a pointer filled in with the height of the texture in pixels + * (one of the SDL_TextureAccess values). This argument can be + * NULL if you don't need this information. + * \param w a pointer filled in with the width of the texture in pixels. This + * argument can be NULL if you don't need this information. + * \param h a pointer filled in with the height of the texture in pixels. This + * argument can be NULL if you don't need this information. * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * @@ -810,9 +825,13 @@ extern DECLSPEC int SDLCALL SDL_RenderSetLogicalSize(SDL_Renderer * renderer, in /** * 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 @@ -1002,19 +1021,23 @@ extern DECLSPEC void SDLCALL SDL_RenderWindowToLogical(SDL_Renderer * renderer, 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 @@ -1603,6 +1626,7 @@ extern DECLSPEC int SDLCALL SDL_RenderCopyExF(SDL_Renderer * renderer, * vertex array Color and alpha modulation is done per vertex * (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored). * + * \param renderer The rendering context. * \param texture (optional) The SDL texture to use. * \param vertices Vertices. * \param num_vertices Number of vertices. @@ -1627,6 +1651,7 @@ extern DECLSPEC int SDLCALL SDL_RenderGeometry(SDL_Renderer *renderer, * vertex arrays Color and alpha modulation is done per vertex * (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored). * + * \param renderer The rendering context. * \param texture (optional) The SDL texture to use. * \param xy Vertex positions * \param xy_stride Byte size to move from one element to the next element @@ -1658,7 +1683,8 @@ extern DECLSPEC int SDLCALL SDL_RenderGeometryRaw(SDL_Renderer *renderer, * Read pixels from the current rendering target to an array of pixels. * * **WARNING**: This is a very slow operation, and should not be used - * frequently. + * frequently. If you're using this on the main rendering target, it should be + * called after rendering and before SDL_RenderPresent(). * * `pitch` specifies the number of bytes between rows in the destination * `pixels` data. This allows you to write to a subrectangle or have padded diff --git a/libs/SDL2/include/SDL_rwops.h b/libs/SDL2/include/SDL_rwops.h index 71e5c8db..3960f567 100644 --- a/libs/SDL2/include/SDL_rwops.h +++ b/libs/SDL2/include/SDL_rwops.h @@ -45,9 +45,6 @@ extern "C" { #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 @@ typedef struct SDL_RWops { void *asset; } androidio; -#elif defined(__WIN32__) +#elif defined(__WIN32__) || defined(__GDK__) struct { SDL_bool append; @@ -113,17 +110,6 @@ typedef struct SDL_RWops 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 --git a/libs/SDL2/include/SDL_scancode.h b/libs/SDL2/include/SDL_scancode.h index 5b2c67c8..aaa782f8 100644 --- a/libs/SDL2/include/SDL_scancode.h +++ b/libs/SDL2/include/SDL_scancode.h @@ -402,6 +402,26 @@ typedef enum /* @} *//* 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 --git a/libs/SDL2/include/SDL_stdinc.h b/libs/SDL2/include/SDL_stdinc.h index c0d194c4..06f6fee2 100644 --- a/libs/SDL2/include/SDL_stdinc.h +++ b/libs/SDL2/include/SDL_stdinc.h @@ -115,6 +115,12 @@ char *alloca(); # 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 @@ -234,13 +240,26 @@ typedef uint64_t Uint64; /* @} *//* Basic data types */ +/** + * \name Floating-point constants + */ +/* @{ */ + +#ifdef FLT_EPSILON +#define SDL_FLT_EPSILON FLT_EPSILON +#else +#define SDL_FLT_EPSILON 1.1920928955078125e-07F /* 0x0.000002p0 */ +#endif + +/* @} *//* Floating-point constants */ + /* Make sure we have macros for printing width-based integers. * should define these but this is not true all platforms. * (for example win32) */ #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" @@ -251,7 +270,7 @@ typedef uint64_t Uint64; #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" @@ -262,7 +281,7 @@ typedef uint64_t Uint64; #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" @@ -273,7 +292,7 @@ typedef uint64_t Uint64; #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" @@ -354,8 +373,14 @@ typedef uint64_t Uint64; #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) +#define SDL_COMPILE_TIME_ASSERT(name, x) static_assert(x, #x) +#else /* 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); @@ -413,6 +438,16 @@ typedef void *(SDLCALL *SDL_calloc_func)(size_t nmemb, size_t size); typedef void *(SDLCALL *SDL_realloc_func)(void *mem, size_t size); 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 * @@ -443,7 +478,8 @@ extern DECLSPEC int SDLCALL SDL_GetNumAllocations(void); 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); @@ -475,6 +511,11 @@ extern DECLSPEC void *SDLCALL SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, #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) { @@ -535,6 +576,7 @@ extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c); 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); @@ -708,6 +750,65 @@ SDL_FORCE_INLINE void *SDL_memcpy4(SDL_OUT_BYTECAP(dwords*4) void *dst, SDL_IN_B 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 --git a/libs/SDL2/include/SDL_surface.h b/libs/SDL2/include/SDL_surface.h index 44123761..838de654 100644 --- a/libs/SDL2/include/SDL_surface.h +++ b/libs/SDL2/include/SDL_surface.h @@ -61,6 +61,8 @@ extern "C" { */ #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 @@ typedef struct SDL_Surface 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 --git a/libs/SDL2/include/SDL_system.h b/libs/SDL2/include/SDL_system.h index e2fa7b5f..0edca635 100644 --- a/libs/SDL2/include/SDL_system.h +++ b/libs/SDL2/include/SDL_system.h @@ -41,7 +41,7 @@ extern "C" { /* 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 @@ typedef void (SDLCALL * SDL_WindowsMessageHook)(void *userdata, void *hWnd, unsi */ 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 @@ typedef struct ID3D11Device ID3D11Device; */ 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 ID3D11Device* SDLCALL SDL_RenderGetD3D11Device(SDL_Renderer * re */ 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 @@ extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID, * 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 @@ extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID, * * \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) @@ -425,6 +452,18 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AndroidRequestPermission(const char *permis */ extern DECLSPEC int SDLCALL SDL_AndroidShowToast(const char* message, int duration, int gravity, int xoffset, int yoffset); +/** + * Send a user command to SDLActivity. + * + * Override "boolean onUnhandledMessage(Message msg)" to handle the message. + * + * \param command user command that must be greater or equal to 0x8000 + * \param param user parameter + * + * \since This function is available since SDL 2.0.22. + */ +extern DECLSPEC int SDLCALL SDL_AndroidSendMessage(Uint32 command, int param); + #endif /* __ANDROID__ */ /* Platform specific functions for WinRT */ @@ -520,7 +559,7 @@ extern DECLSPEC const wchar_t * SDLCALL SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path 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. * @@ -552,6 +591,27 @@ extern DECLSPEC void SDLCALL SDL_OnApplicationDidBecomeActive(void); 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 --git a/libs/SDL2/include/SDL_syswm.h b/libs/SDL2/include/SDL_syswm.h index f7cd670c..45f8e754 100644 --- a/libs/SDL2/include/SDL_syswm.h +++ b/libs/SDL2/include/SDL_syswm.h @@ -298,6 +298,8 @@ struct SDL_SysWMinfo struct wl_egl_window *egl_window; /**< Wayland EGL window (native window) */ struct xdg_surface *xdg_surface; /**< Wayland xdg surface (window manager handle) */ struct xdg_toplevel *xdg_toplevel; /**< Wayland xdg toplevel role */ + struct xdg_popup *xdg_popup; /**< Wayland xdg popup role */ + struct xdg_positioner *xdg_positioner; /**< Wayland xdg positioner, for popup */ } wl; #endif #if defined(SDL_VIDEO_DRIVER_MIR) /* no longer available, left for API/ABI compatibility. Remove in 2.1! */ diff --git a/libs/SDL2/include/SDL_test_font.h b/libs/SDL2/include/SDL_test_font.h index c5cbbbbd..6e7247dd 100644 --- a/libs/SDL2/include/SDL_test_font.h +++ b/libs/SDL2/include/SDL_test_font.h @@ -38,7 +38,8 @@ extern "C" { /* 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 @@ extern "C" { * * \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_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c); */ 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 --git a/libs/SDL2/include/SDL_thread.h b/libs/SDL2/include/SDL_thread.h index 35e680dd..7364f813 100644 --- a/libs/SDL2/include/SDL_thread.h +++ b/libs/SDL2/include/SDL_thread.h @@ -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 enum { typedef int (SDLCALL * SDL_ThreadFunction) (void *data); -#if defined(__WIN32__) +#if defined(__WIN32__) || defined(__GDK__) /** * \file SDL_thread.h * @@ -129,7 +129,7 @@ SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data, 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 --git a/libs/SDL2/include/SDL_touch.h b/libs/SDL2/include/SDL_touch.h index 9b00716b..95924135 100644 --- a/libs/SDL2/include/SDL_touch.h +++ b/libs/SDL2/include/SDL_touch.h @@ -95,6 +95,14 @@ extern DECLSPEC int SDLCALL SDL_GetNumTouchDevices(void); */ extern DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice(int index); +/** + * Get the touch device name as reported from the driver or NULL if the index + * is invalid. + * + * \since This function is available since SDL 2.0.22. + */ +extern DECLSPEC const char* SDLCALL SDL_GetTouchName(int index); + /** * Get the type of the given touch device. * diff --git a/libs/SDL2/include/SDL_version.h b/libs/SDL2/include/SDL_version.h index 2716eba7..562c5fa1 100644 --- a/libs/SDL2/include/SDL_version.h +++ b/libs/SDL2/include/SDL_version.h @@ -58,8 +58,8 @@ typedef struct SDL_version /* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL */ #define SDL_MAJOR_VERSION 2 -#define SDL_MINOR_VERSION 0 -#define SDL_PATCHLEVEL 20 +#define SDL_MINOR_VERSION 23 +#define SDL_PATCHLEVEL 1 /** * Macro to determine SDL version program was compiled against. @@ -83,6 +83,8 @@ typedef struct SDL_version (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 @@ typedef struct SDL_version \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 --git a/libs/SDL2/include/SDL_video.h b/libs/SDL2/include/SDL_video.h index e43cb27e..856560af 100644 --- a/libs/SDL2/include/SDL_video.h +++ b/libs/SDL2/include/SDL_video.h @@ -1337,6 +1337,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowKeyboardGrab(SDL_Window * window, * Mouse grab confines the mouse cursor to the window. * * \param window The window for which the mouse grab mode should be set. + * \param grabbed This is SDL_TRUE to grab mouse, and SDL_FALSE to release. * * \since This function is available since SDL 2.0.16. * @@ -2008,13 +2009,8 @@ extern DECLSPEC void SDLCALL SDL_GL_GetDrawableSize(SDL_Window * window, int *w, * 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 --git a/libs/SDL2/include/begin_code.h b/libs/SDL2/include/begin_code.h index 63f064b6..b3e69e85 100644 --- a/libs/SDL2/include/begin_code.h +++ b/libs/SDL2/include/begin_code.h @@ -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 @@ -107,7 +107,7 @@ #ifdef __BORLANDC__ #pragma nopackwarning #endif -#ifdef _M_X64 +#ifdef _WIN64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else diff --git a/libs/SDL2/sdl2-config-version.cmake.in b/libs/SDL2/sdl2-config-version.cmake.in index c987bc1a..5c6aee44 100644 --- a/libs/SDL2/sdl2-config-version.cmake.in +++ b/libs/SDL2/sdl2-config-version.cmake.in @@ -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 @@ else() set(PACKAGE_VERSION_EXACT TRUE) endif() endif() - diff --git a/libs/SDL2/sdl2-config.cmake.in b/libs/SDL2/sdl2-config.cmake.in index c570511f..59c254ef 100644 --- a/libs/SDL2/sdl2-config.cmake.in +++ b/libs/SDL2/sdl2-config.cmake.in @@ -1,81 +1,205 @@ -# sdl2 cmake project-config input for ./configure scripts +# sdl2 cmake project-config input for ./configure script -set(prefix "@prefix@") +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() + +# 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() + +get_filename_component(prefix "${CMAKE_CURRENT_LIST_DIR}@cmake_prefix_relpath@" ABSOLUTE) 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 +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}") - # 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) +set(SDL2_LIBRARIES SDL2::SDL2) +set(SDL2_STATIC_LIBRARIES SDL2::SDL2-static) +set(SDL2MAIN_LIBRARY) +set(SDL2TEST_LIBRARY SDL2::SDL2test) -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 +unset(prefix) +unset(exec_prefix) +unset(bindir) +unset(libdir) +unset(includedir) - 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") +set(_sdl2_libraries "@SDL_LIBS@") +set(_sdl2_static_private_libs "@SDL_STATIC_LIBS@") - add_library(SDL2::SDL2main INTERFACE IMPORTED) - set_target_properties(SDL2::SDL2main PROPERTIES - INTERFACE_LINK_LIBRARIES "-L${SDL2_LIBDIR} -lmingw32 -lSDL2main -mwindows") +# 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}") -else() # (not WIN32) or MSVC +# 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}") - 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") +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}") +# 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) -endif() # (not WIN32) or MSVC +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() - 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}") +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) -endif() # NOT TARGET SDL2::SDL2 +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 --git a/libs/SDL2/sdl2-config.in b/libs/SDL2/sdl2-config.in index 5a2aed29..f6eca766 100644 --- a/libs/SDL2/sdl2-config.in +++ b/libs/SDL2/sdl2-config.in @@ -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 @@ while test $# -gt 0; do @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 --git a/libs/SDL2/src/SDL.c b/libs/SDL2/src/SDL.c index 67afa67a..59602d62 100644 --- a/libs/SDL2/src/SDL.c +++ b/libs/SDL2/src/SDL.c @@ -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_HelperWindowCreate(void); 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 int SDL_HelperWindowDestroy(void); 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 */ @@ -153,10 +174,11 @@ SDL_InitSubSystem(Uint32 flags) Uint32 flags_initialized = 0; if (!SDL_MainIsReady) { - SDL_SetError("Application didn't initialize properly, did you include SDL_main.h in the file containing your main() function?"); - return -1; + 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(); @@ -208,7 +230,7 @@ SDL_InitSubSystem(Uint32 flags) /* Initialize the timer subsystem */ if ((flags & SDL_INIT_TIMER)){ -#if !SDL_TIMERS_DISABLED +#if !SDL_TIMERS_DISABLED && !SDL_TIMER_DUMMY if (SDL_PrivateShouldInitSubsystem(SDL_INIT_TIMER)) { if (SDL_TimerInit() < 0) { goto quit_and_error; @@ -317,6 +339,8 @@ SDL_InitSubSystem(Uint32 flags) #endif } + (void) flags_initialized; /* make static analysis happy, since this only gets used in error cases. */ + return (0); quit_and_error: @@ -402,7 +426,7 @@ SDL_QuitSubSystem(Uint32 flags) } #endif -#if !SDL_TIMERS_DISABLED +#if !SDL_TIMERS_DISABLED && !SDL_TIMER_DUMMY if ((flags & SDL_INIT_TIMER)) { if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_TIMER)) { SDL_TimerQuit(); @@ -469,12 +493,13 @@ SDL_Quit(void) 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. */ @@ -554,14 +579,24 @@ SDL_GetPlatform(void) 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 @@ -601,6 +636,6 @@ _DllMainCRTStartup(HANDLE hModule, } #endif /* Building DLL */ -#endif /* __WIN32__ */ +#endif /* defined(__WIN32__) || defined(__GDK__) */ /* vi: set sts=4 ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/SDL_assert.c b/libs/SDL2/src/SDL_assert.c index 9c7acac5..8153bf98 100644 --- a/libs/SDL2/src/SDL_assert.c +++ b/libs/SDL2/src/SDL_assert.c @@ -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 @@ static void SDL_AddAssertionToReport(SDL_assert_data *data) } } +#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 @@ static SDL_NORETURN void SDL_AbortAssertion(void) 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_PromptAssertion(const SDL_assert_data *data, void *userdata) { 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_PromptAssertion(const SDL_assert_data *data, void *userdata) SDL_RestoreWindow(window); } - SDL_stack_free(message); + if (message != stack_buf) { + SDL_free(message); + } return state; } diff --git a/libs/SDL2/src/SDL_error.c b/libs/SDL2/src/SDL_error.c index 4d25999a..1ca460a6 100644 --- a/libs/SDL2/src/SDL_error.c +++ b/libs/SDL2/src/SDL_error.c @@ -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 --git a/libs/SDL2/src/SDL_error_c.h b/libs/SDL2/src/SDL_error_c.h index af6a15e4..1ac1f425 100644 --- a/libs/SDL2/src/SDL_error_c.h +++ b/libs/SDL2/src/SDL_error_c.h @@ -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 --git a/libs/SDL2/src/SDL_guid.c b/libs/SDL2/src/SDL_guid.c new file mode 100644 index 00000000..d3529b72 --- /dev/null +++ b/libs/SDL2/src/SDL_guid.c @@ -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 --git a/libs/SDL2/src/SDL_hints.c b/libs/SDL2/src/SDL_hints.c index 2eea5501..96869f67 100644 --- a/libs/SDL2/src/SDL_hints.c +++ b/libs/SDL2/src/SDL_hints.c @@ -52,7 +52,7 @@ SDL_SetHintWithPriority(const char *name, const char *value, SDL_Hint *hint; SDL_HintWatch *entry; - if (!name || !value) { + if (!name) { return SDL_FALSE; } @@ -66,7 +66,7 @@ SDL_SetHintWithPriority(const char *name, const char *value, if (priority < hint->priority) { return SDL_FALSE; } - if (!hint->value || !value || SDL_strcmp(hint->value, value) != 0) { + if (((hint->value == NULL) != (value == NULL)) || (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; @@ -178,6 +178,12 @@ SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *userdata) return; } hint->name = SDL_strdup(name); + if (!hint->name) { + SDL_free(entry); + SDL_free(hint); + SDL_OutOfMemory(); + return; + } hint->value = NULL; hint->priority = SDL_HINT_DEFAULT; hint->callbacks = NULL; diff --git a/libs/SDL2/src/SDL_internal.h b/libs/SDL2/src/SDL_internal.h index 69da271c..43e407f8 100644 --- a/libs/SDL2/src/SDL_internal.h +++ b/libs/SDL2/src/SDL_internal.h @@ -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 --git a/libs/SDL2/src/SDL_list.c b/libs/SDL2/src/SDL_list.c new file mode 100644 index 00000000..af9f8bf8 --- /dev/null +++ b/libs/SDL2/src/SDL_list.c @@ -0,0 +1,93 @@ +/* + 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.h" +#include "./SDL_list.h" + +/* Push */ +int +SDL_ListAdd(SDL_ListNode **head, void *ent) +{ + SDL_ListNode *node = SDL_malloc(sizeof (*node)); + + if (node == NULL) { + return SDL_OutOfMemory(); + } + + node->entry = ent; + node->next = *head; + *head = node; + return 0; +} + +/* Pop from end as a FIFO (if add with SDL_ListAdd) */ +void +SDL_ListPop(SDL_ListNode **head, void **ent) +{ + SDL_ListNode **ptr = head; + + /* Invalid or empty */ + if (head == NULL || *head == NULL) { + return; + } + + while ((*ptr)->next) { + ptr = &(*ptr)->next; + } + + if (ent) { + *ent = (*ptr)->entry; + } + + SDL_free(*ptr); + *ptr = NULL; +} + +void +SDL_ListRemove(SDL_ListNode **head, void *ent) +{ + SDL_ListNode **ptr = head; + + while (*ptr) { + if ((*ptr)->entry == ent) { + SDL_ListNode *tmp = *ptr; + *ptr = (*ptr)->next; + SDL_free(tmp); + return; + } + ptr = &(*ptr)->next; + } +} + +void +SDL_ListClear(SDL_ListNode **head) +{ + SDL_ListNode *l = *head; + *head = NULL; + while (l) { + SDL_ListNode *tmp = l; + l = l->next; + SDL_free(tmp); + } +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/SDL_list.h b/libs/SDL2/src/SDL_list.h new file mode 100644 index 00000000..a7ead1dc --- /dev/null +++ b/libs/SDL2/src/SDL_list.h @@ -0,0 +1,39 @@ +/* + 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_list_h_ +#define SDL_list_h_ + +typedef struct SDL_ListNode +{ + void *entry; + struct SDL_ListNode *next; +} SDL_ListNode; + + +int SDL_ListAdd(SDL_ListNode **head, void *ent); +void SDL_ListPop(SDL_ListNode **head, void **ent); +void SDL_ListRemove(SDL_ListNode **head, void *ent); +void SDL_ListClear(SDL_ListNode **head); + +#endif /* SDL_list_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/SDL_log.c b/libs/SDL2/src/SDL_log.c index 4f820ffa..a00fa288 100644 --- a/libs/SDL2/src/SDL_log.c +++ b/libs/SDL2/src/SDL_log.c @@ -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_application_priority = DEFAULT_APPLICATION_PRIORITY; 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, @@ -92,6 +101,24 @@ static int SDL_android_priority[SDL_NUM_LOG_PRIORITIES] = { }; #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 +291,11 @@ GetCategoryPrefix(int category) 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 +312,33 @@ SDL_LogMessageV(int category, SDL_LogPriority priority, const char *fmt, va_list 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 +346,23 @@ SDL_LogMessageV(int category, SDL_LogPriority priority, const char *fmt, va_list } } + 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 +374,7 @@ static void SDLCALL 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 +383,7 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, 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 +422,7 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, } } } -#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 +432,7 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, /* 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 +447,7 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, 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 +462,12 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, #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 --git a/libs/SDL2/src/events/SDL_sysevents.h b/libs/SDL2/src/SDL_log_c.h similarity index 73% rename from libs/SDL2/src/events/SDL_sysevents.h rename to libs/SDL2/src/SDL_log_c.h index 1a48462b..4716b7ad 100644 --- a/libs/SDL2/src/events/SDL_sysevents.h +++ b/libs/SDL2/src/SDL_log_c.h @@ -18,19 +18,16 @@ 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_internal.h" -#include "../video/SDL_sysvideo.h" +/* This file defines useful function for working with SDL logging */ -/* Useful functions and variables from SDL_sysevents.c */ +#ifndef SDL_log_c_h_ +#define SDL_log_c_h_ -#if defined(__HAIKU__) -/* The Haiku event loops run in a separate thread */ -#define MUST_THREAD_EVENTS -#endif +extern void SDL_LogInit(void); +extern void SDL_LogQuit(void); -#ifdef __WIN32__ /* Windows doesn't allow a separate event thread */ -#define CANT_THREAD_EVENTS -#endif +#endif /* SDL_log_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/atomic/SDL_spinlock.c b/libs/SDL2/src/atomic/SDL_spinlock.c index bdd347e4..53776d5e 100644 --- a/libs/SDL2/src/atomic/SDL_spinlock.c +++ b/libs/SDL2/src/atomic/SDL_spinlock.c @@ -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,10 @@ #include #endif +#if defined(PS2) +#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,7 +135,19 @@ SDL_AtomicTryLock(SDL_SpinLock *lock) #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; diff --git a/libs/SDL2/src/audio/SDL_audio.c b/libs/SDL2/src/audio/SDL_audio.c index 849416c8..3ce3cb9d 100644 --- a/libs/SDL2/src/audio/SDL_audio.c +++ b/libs/SDL2/src/audio/SDL_audio.c @@ -95,6 +95,9 @@ static const AudioBootStrap *const bootstrap[] = { #if SDL_AUDIO_DRIVER_ANDROID &ANDROIDAUDIO_bootstrap, #endif +#if SDL_AUDIO_DRIVER_PS2 + &PS2AUDIO_bootstrap, +#endif #if SDL_AUDIO_DRIVER_PSP &PSPAUDIO_bootstrap, #endif @@ -245,11 +248,6 @@ SDL_AudioThreadDeinit_Default(_THIS) { /* no-op. */ } -static void -SDL_AudioBeginLoopIteration_Default(_THIS) -{ /* no-op. */ -} - static void SDL_AudioWaitDevice_Default(_THIS) { /* no-op. */ @@ -277,11 +275,6 @@ SDL_AudioFlushCapture_Default(_THIS) { /* no-op. */ } -static void -SDL_AudioPrepareToClose_Default(_THIS) -{ /* no-op. */ -} - static void SDL_AudioCloseDevice_Default(_THIS) { /* no-op. */ @@ -299,7 +292,7 @@ SDL_AudioFreeDeviceHandle_Default(void *handle) static int -SDL_AudioOpenDevice_Default(_THIS, void *handle, const char *devname, int iscapture) +SDL_AudioOpenDevice_Default(_THIS, const char *devname) { return SDL_Unsupported(); } @@ -334,11 +327,6 @@ SDL_AudioUnlockDevice_Default(SDL_AudioDevice * device) } } -static void -SDL_AudioLockOrUnlockDeviceWithNoMixerLock(SDL_AudioDevice * device) -{ -} - static void finish_audio_entry_points_init(void) { @@ -347,14 +335,6 @@ finish_audio_entry_points_init(void) * blindly call them without having to check for validity first. */ - if (current_audio.impl.SkipMixerLock) { - if (current_audio.impl.LockDevice == NULL) { - current_audio.impl.LockDevice = SDL_AudioLockOrUnlockDeviceWithNoMixerLock; - } - if (current_audio.impl.UnlockDevice == NULL) { - current_audio.impl.UnlockDevice = SDL_AudioLockOrUnlockDeviceWithNoMixerLock; - } - } #define FILL_STUB(x) \ if (current_audio.impl.x == NULL) { \ @@ -364,13 +344,11 @@ finish_audio_entry_points_init(void) FILL_STUB(OpenDevice); FILL_STUB(ThreadInit); FILL_STUB(ThreadDeinit); - FILL_STUB(BeginLoopIteration); FILL_STUB(WaitDevice); FILL_STUB(PlayDevice); FILL_STUB(GetDeviceBuf); FILL_STUB(CaptureFromDevice); FILL_STUB(FlushCapture); - FILL_STUB(PrepareToClose); FILL_STUB(CloseDevice); FILL_STUB(LockDevice); FILL_STUB(UnlockDevice); @@ -407,7 +385,7 @@ add_audio_device(const char *name, SDL_AudioSpec *spec, void *handle, SDL_AudioD 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); } @@ -429,8 +407,7 @@ add_audio_device(const char *name, SDL_AudioSpec *spec, void *handle, SDL_AudioD SDL_UnlockMutex(current_audio.detectionLock); SDL_free(item->original_name); SDL_free(item); - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } SDL_snprintf(replacement, len, "%s (%d)", name, dupenum + 1); @@ -483,7 +460,7 @@ free_device_list(SDL_AudioDeviceItem **devices, int *devCount) /* The audio backends call this when a new device is plugged in. */ void -SDL_AddAudioDevice(const int iscapture, const char *name, SDL_AudioSpec *spec, void *handle) +SDL_AddAudioDevice(const SDL_bool iscapture, const char *name, SDL_AudioSpec *spec, void *handle) { const int device_index = iscapture ? add_capture_device(name, spec, handle) : add_output_device(name, spec, handle); if (device_index != -1) { @@ -545,7 +522,7 @@ mark_device_removed(void *handle, SDL_AudioDeviceItem *devices, SDL_bool *remove /* The audio backends call this when a device is removed from the system. */ void -SDL_RemoveAudioDevice(const int iscapture, void *handle) +SDL_RemoveAudioDevice(const SDL_bool iscapture, void *handle) { int device_index; SDL_AudioDevice *device = NULL; @@ -723,7 +700,6 @@ SDL_RunAudio(void *devicep) /* Loop, filling the audio buffers */ while (!SDL_AtomicGet(&device->shutdown)) { - current_audio.impl.BeginLoopIteration(device); data_len = device->callbackspec.size; /* Fill the current buffer with sound */ @@ -786,8 +762,6 @@ SDL_RunAudio(void *devicep) } } - current_audio.impl.PrepareToClose(device); - /* Wait for the audio to drain. */ SDL_Delay(((device->spec.samples * 1000) / device->spec.freq) * 2); @@ -831,8 +805,6 @@ SDL_CaptureAudio(void *devicep) int still_need; Uint8 *ptr; - current_audio.impl.BeginLoopIteration(device); - if (SDL_AtomicGet(&device->paused)) { SDL_Delay(delay); /* just so we don't cook the CPU. */ if (device->stream) { @@ -956,20 +928,18 @@ SDL_GetAudioDriver(int index) int SDL_AudioInit(const char *driver_name) { - int i = 0; - int initialized = 0; - int tried_to_init = 0; + int i; + SDL_bool initialized = SDL_FALSE, tried_to_init = SDL_FALSE; if (SDL_GetCurrentAudioDriver()) { SDL_AudioQuit(); /* shutdown driver if already running. */ } - SDL_zero(current_audio); SDL_zeroa(open_devices); /* Select the proper audio driver */ if (driver_name == NULL) { - driver_name = SDL_getenv("SDL_AUDIODRIVER"); + driver_name = SDL_GetHint(SDL_HINT_AUDIODRIVER); } if (driver_name != NULL && *driver_name != 0) { @@ -978,6 +948,15 @@ SDL_AudioInit(const char *driver_name) 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") && @@ -990,7 +969,7 @@ SDL_AudioInit(const char *driver_name) 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)) { - tried_to_init = 1; + tried_to_init = SDL_TRUE; SDL_zero(current_audio); current_audio.name = bootstrap[i]->name; current_audio.desc = bootstrap[i]->desc; @@ -1007,7 +986,7 @@ SDL_AudioInit(const char *driver_name) continue; } - tried_to_init = 1; + tried_to_init = SDL_TRUE; SDL_zero(current_audio); current_audio.name = bootstrap[i]->name; current_audio.desc = bootstrap[i]->desc; @@ -1114,38 +1093,29 @@ SDL_GetNumAudioDevices(int iscapture) const char * SDL_GetAudioDeviceName(int index, int iscapture) { - const char *retval = NULL; + SDL_AudioDeviceItem *item; + int i; + const char *retval; if (!SDL_GetCurrentAudioDriver()) { SDL_SetError("Audio subsystem is not initialized"); return NULL; } - if (iscapture && !current_audio.impl.HasCaptureSupport) { - SDL_SetError("No capture support"); - return NULL; - } - - if (index >= 0) { - SDL_AudioDeviceItem *item; - int i; - - SDL_LockMutex(current_audio.detectionLock); - item = iscapture ? current_audio.inputDevices : current_audio.outputDevices; - i = iscapture ? current_audio.inputDeviceCount : current_audio.outputDeviceCount; - if (index < i) { - for (i--; i > index; i--, item = item->next) { - SDL_assert(item != NULL); - } + SDL_LockMutex(current_audio.detectionLock); + item = iscapture ? current_audio.inputDevices : current_audio.outputDevices; + i = iscapture ? current_audio.inputDeviceCount : current_audio.outputDeviceCount; + if (index >= 0 && index < i) { + for (i--; i > index; i--, item = item->next) { SDL_assert(item != NULL); - retval = item->name; } - SDL_UnlockMutex(current_audio.detectionLock); - } - - if (retval == NULL) { - SDL_SetError("No such device"); + SDL_assert(item != NULL); + retval = item->name; + } else { + SDL_InvalidParamError("index"); + retval = NULL; } + SDL_UnlockMutex(current_audio.detectionLock); return retval; } @@ -1154,38 +1124,33 @@ SDL_GetAudioDeviceName(int index, int iscapture) int SDL_GetAudioDeviceSpec(int index, int iscapture, SDL_AudioSpec *spec) { + SDL_AudioDeviceItem *item; + int i, retval; + if (spec == NULL) { return SDL_InvalidParamError("spec"); } - SDL_zerop(spec); - if (!SDL_GetCurrentAudioDriver()) { return SDL_SetError("Audio subsystem is not initialized"); } - if (iscapture && !current_audio.impl.HasCaptureSupport) { - return SDL_SetError("No capture support"); - } - - if (index >= 0) { - SDL_AudioDeviceItem *item; - int i; - - SDL_LockMutex(current_audio.detectionLock); - item = iscapture ? current_audio.inputDevices : current_audio.outputDevices; - i = iscapture ? current_audio.inputDeviceCount : current_audio.outputDeviceCount; - if (index < i) { - for (i--; i > index; i--, item = item->next) { - SDL_assert(item != NULL); - } + SDL_LockMutex(current_audio.detectionLock); + item = iscapture ? current_audio.inputDevices : current_audio.outputDevices; + i = iscapture ? current_audio.inputDeviceCount : current_audio.outputDeviceCount; + if (index >= 0 && index < i) { + for (i--; i > index; i--, item = item->next) { SDL_assert(item != NULL); - SDL_memcpy(spec, &item->spec, sizeof(SDL_AudioSpec)); } - SDL_UnlockMutex(current_audio.detectionLock); + SDL_assert(item != NULL); + SDL_copyp(spec, &item->spec); + retval = 0; + } else { + retval = SDL_InvalidParamError("index"); } + SDL_UnlockMutex(current_audio.detectionLock); - return 0; + return retval; } @@ -1240,7 +1205,7 @@ close_audio_device(SDL_AudioDevice * device) 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"); @@ -1421,7 +1386,7 @@ open_audio_device(const char *devname, int iscapture, SDL_AtomicSet(&device->enabled, 1); /* Create a mutex for locking the sound buffers */ - if (!current_audio.impl.SkipMixerLock) { + if (current_audio.impl.LockDevice == SDL_AudioLockDevice_Default) { device->mixer_lock = SDL_CreateMutex(); if (device->mixer_lock == NULL) { close_audio_device(device); @@ -1430,7 +1395,7 @@ open_audio_device(const char *devname, int iscapture, } } - if (current_audio.impl.OpenDevice(device, handle, devname, iscapture) < 0) { + if (current_audio.impl.OpenDevice(device, devname) < 0) { close_audio_device(device); return 0; } @@ -1555,8 +1520,7 @@ SDL_OpenAudio(SDL_AudioSpec * desired, SDL_AudioSpec * obtained) /* SDL_OpenAudio() is legacy and can only act on Device ID #1. */ if (open_devices[0] != NULL) { - SDL_SetError("Audio device is already opened"); - return -1; + return SDL_SetError("Audio device is already opened"); } if (obtained) { @@ -1697,8 +1661,6 @@ SDL_AudioQuit(void) #ifdef HAVE_LIBSAMPLERATE_H UnloadLibSampleRate(); #endif - - SDL_FreeResampleFilter(); } #define NUM_FORMATS 10 diff --git a/libs/SDL2/src/audio/SDL_audio_c.h b/libs/SDL2/src/audio/SDL_audio_c.h index cddaecef..bfa0760d 100644 --- a/libs/SDL2/src/audio/SDL_audio_c.h +++ b/libs/SDL2/src/audio/SDL_audio_c.h @@ -70,11 +70,6 @@ extern SDL_AudioFilter SDL_Convert_F32_to_S16; 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 --git a/libs/SDL2/src/audio/SDL_audio_resampler_filter.h b/libs/SDL2/src/audio/SDL_audio_resampler_filter.h new file mode 100644 index 00000000..9b4728c3 --- /dev/null +++ b/libs/SDL2/src/audio/SDL_audio_resampler_filter.h @@ -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 --git a/libs/SDL2/src/audio/SDL_audiocvt.c b/libs/SDL2/src/audio/SDL_audiocvt.c index 31e4e224..0b95b417 100644 --- a/libs/SDL2/src/audio/SDL_audiocvt.c +++ b/libs/SDL2/src/audio/SDL_audiocvt.c @@ -80,7 +80,7 @@ SDL_ConvertStereoToMono_SSE3(SDL_AudioCVT * cvt, SDL_AudioFormat format) Just use unaligned load/stores, if the memory at runtime is aligned it'll be just as fast on modern processors */ while (i >= 4) { /* 4 * float32 */ - _mm_storeu_ps(dst, _mm_mul_ps(_mm_hadd_ps(_mm_load_ps(src), _mm_loadu_ps(src+4)), divby2)); + _mm_storeu_ps(dst, _mm_mul_ps(_mm_hadd_ps(_mm_loadu_ps(src), _mm_loadu_ps(src+4)), divby2)); i -= 4; src += 8; dst += 4; } @@ -369,11 +369,11 @@ SDL_Convert71To51(SDL_AudioCVT * cvt, SDL_AudioFormat format) 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[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 */ + dst[5] = (src[5] + surround_right_distributed) * two_thirds; /* BR */ } cvt->len_cvt /= 8; @@ -398,12 +398,12 @@ SDL_Convert71To61(SDL_AudioCVT * cvt, SDL_AudioFormat format) 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[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 */ + dst[6] = src[0]; /* FL */ } cvt->len_cvt /= 8; @@ -428,13 +428,13 @@ SDL_Convert61To71(SDL_AudioCVT * cvt, SDL_AudioFormat format) 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[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 */ + dst[6] = src[5]; /* SL */ + dst[7] = src[3]; /* SR */ } cvt->len_cvt /= 7; @@ -459,12 +459,12 @@ SDL_Convert51To61(SDL_AudioCVT * cvt, SDL_AudioFormat format) 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[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 */ + dst[6] = src[0]; /* FL */ } cvt->len_cvt /= 6; @@ -489,7 +489,7 @@ SDL_Convert61To51(SDL_AudioCVT * cvt, SDL_AudioFormat format) 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[1] = src[2]; /* FR */ dst[2] = src[1]; /* FC */ dst[3] = src[0]; /* LFE */ dst[4] = src[5]; /* BL */ @@ -614,7 +614,7 @@ SDL_ConvertQuadTo51(SDL_AudioCVT * cvt, SDL_AudioFormat format) 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[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 */ @@ -704,105 +704,16 @@ SDL_Convert51To71(SDL_AudioCVT * cvt, SDL_AudioFormat 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) { if (inrate == outrate) { return 0; - } else if (inrate > outrate) { - return (int) SDL_ceil(((float) (RESAMPLER_SAMPLES_PER_ZERO_CROSSING * inrate) / ((float) outrate))); + } + if (inrate > outrate) { + return (int) SDL_ceilf(((float) (RESAMPLER_SAMPLES_PER_ZERO_CROSSING * inrate) / ((float) outrate))); } return RESAMPLER_SAMPLES_PER_ZERO_CROSSING; } @@ -814,33 +725,38 @@ SDL_ResampleAudio(const int chans, const int inrate, const int outrate, 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. */ @@ -848,12 +764,15 @@ SDL_ResampleAudio(const int chans, const int inrate, const int outrate, 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; } @@ -930,9 +849,7 @@ SDL_AddAudioCVTFilter(SDL_AudioCVT *cvt, const SDL_AudioFilter filter) if (cvt->filter_index >= SDL_AUDIOCVT_MAX_FILTERS) { return SDL_SetError("Too many filters needed for conversion, exceeded maximum of %d", SDL_AUDIOCVT_MAX_FILTERS); } - if (filter == NULL) { - return SDL_SetError("Audio filter pointer is NULL"); - } + SDL_assert(filter != NULL); cvt->filters[cvt->filter_index++] = filter; cvt->filters[cvt->filter_index] = NULL; /* Moving terminator */ return 0; @@ -943,7 +860,7 @@ SDL_BuildAudioTypeCVTToFloat(SDL_AudioCVT *cvt, const SDL_AudioFormat src_fmt) { int retval = 0; /* 0 == no conversion necessary. */ - if ((SDL_AUDIO_ISBIGENDIAN(src_fmt) != 0) == (SDL_BYTEORDER == SDL_LIL_ENDIAN)) { + if ((SDL_AUDIO_ISBIGENDIAN(src_fmt) != 0) == (SDL_BYTEORDER == SDL_LIL_ENDIAN) && SDL_AUDIO_BITSIZE(src_fmt) > 8) { if (SDL_AddAudioCVTFilter(cvt, SDL_Convert_Byteswap) < 0) { return -1; } @@ -1020,7 +937,7 @@ SDL_BuildAudioTypeCVTFromFloat(SDL_AudioCVT *cvt, const SDL_AudioFormat dst_fmt) retval = 1; /* added a converter. */ } - if ((SDL_AUDIO_ISBIGENDIAN(dst_fmt) != 0) == (SDL_BYTEORDER == SDL_LIL_ENDIAN)) { + if ((SDL_AUDIO_ISBIGENDIAN(dst_fmt) != 0) == (SDL_BYTEORDER == SDL_LIL_ENDIAN) && SDL_AUDIO_BITSIZE(dst_fmt) > 8) { if (SDL_AddAudioCVTFilter(cvt, SDL_Convert_Byteswap) < 0) { return -1; } @@ -1120,10 +1037,6 @@ SDL_BuildAudioResampleCVT(SDL_AudioCVT * cvt, const int dst_channels, 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; @@ -1217,19 +1130,26 @@ SDL_BuildAudioCVT(SDL_AudioCVT * cvt, if (!SDL_SupportedAudioFormat(src_fmt)) { return SDL_SetError("Invalid source format"); - } else if (!SDL_SupportedAudioFormat(dst_fmt)) { + } + if (!SDL_SupportedAudioFormat(dst_fmt)) { return SDL_SetError("Invalid destination format"); - } else if (!SDL_SupportedChannelCount(src_channels)) { + } + if (!SDL_SupportedChannelCount(src_channels)) { return SDL_SetError("Invalid source channels"); - } else if (!SDL_SupportedChannelCount(dst_channels)) { + } + if (!SDL_SupportedChannelCount(dst_channels)) { return SDL_SetError("Invalid destination channels"); - } else if (src_rate <= 0) { + } + if (src_rate <= 0) { return SDL_SetError("Source rate is equal to or less than zero"); - } else if (dst_rate <= 0) { + } + if (dst_rate <= 0) { return SDL_SetError("Destination rate is equal to or less than zero"); - } else if (src_rate >= SDL_MAX_SINT32 / RESAMPLER_SAMPLES_PER_ZERO_CROSSING) { + } + if (src_rate >= SDL_MAX_SINT32 / RESAMPLER_SAMPLES_PER_ZERO_CROSSING) { return SDL_SetError("Source rate is too high"); - } else if (dst_rate >= SDL_MAX_SINT32 / RESAMPLER_SAMPLES_PER_ZERO_CROSSING) { + } + if (dst_rate >= SDL_MAX_SINT32 / RESAMPLER_SAMPLES_PER_ZERO_CROSSING) { return SDL_SetError("Destination rate is too high"); } @@ -1273,6 +1193,9 @@ SDL_BuildAudioCVT(SDL_AudioCVT * cvt, /* just a byteswap needed? */ if ((src_fmt & ~SDL_AUDIO_MASK_ENDIAN) == (dst_fmt & ~SDL_AUDIO_MASK_ENDIAN)) { + if (SDL_AUDIO_BITSIZE(dst_fmt) == 8) { + return 0; + } if (SDL_AddAudioCVTFilter(cvt, SDL_Convert_Byteswap) < 0) { return -1; } @@ -1666,6 +1589,7 @@ SDL_NewAudioStream(const SDL_AudioFormat src_format, retval = (SDL_AudioStream *) SDL_calloc(1, sizeof (SDL_AudioStream)); if (!retval) { + SDL_OutOfMemory(); return NULL; } @@ -1733,13 +1657,6 @@ SDL_NewAudioStream(const SDL_AudioFormat src_format, 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; @@ -1907,11 +1824,14 @@ SDL_AudioStreamPut(SDL_AudioStream *stream, const void *buf, int len) if (!stream) { return SDL_InvalidParamError("stream"); - } else if (!buf) { + } + if (!buf) { return SDL_InvalidParamError("buf"); - } else if (len == 0) { + } + if (len == 0) { return 0; /* nothing to do. */ - } else if ((len % stream->src_sample_frame_size) != 0) { + } + if ((len % stream->src_sample_frame_size) != 0) { return SDL_SetError("Can't add partial sample frames"); } @@ -2017,11 +1937,14 @@ SDL_AudioStreamGet(SDL_AudioStream *stream, void *buf, int len) if (!stream) { return SDL_InvalidParamError("stream"); - } else if (!buf) { + } + if (!buf) { return SDL_InvalidParamError("buf"); - } else if (len <= 0) { + } + if (len <= 0) { return 0; /* nothing to do. */ - } else if ((len % stream->dst_sample_frame_size) != 0) { + } + if ((len % stream->dst_sample_frame_size) != 0) { return SDL_SetError("Can't request partial sample frames"); } @@ -2067,4 +1990,3 @@ SDL_FreeAudioStream(SDL_AudioStream *stream) } /* vi: set ts=4 sw=4 expandtab: */ - diff --git a/libs/SDL2/src/audio/SDL_mixer.c b/libs/SDL2/src/audio/SDL_mixer.c index 23adec05..9c9e5df2 100644 --- a/libs/SDL2/src/audio/SDL_mixer.c +++ b/libs/SDL2/src/audio/SDL_mixer.c @@ -29,7 +29,6 @@ /* This table is used to add two sound values together and pin * the value to avoid overflow. (used with permission from ARDI) - * Changed to use 0xFE instead of 0xFF for better sound quality. */ static const Uint8 mix8[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -66,24 +65,25 @@ static const Uint8 mix8[] = { 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, - 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFE, 0xFE, - 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, - 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, - 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, - 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, - 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, - 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, - 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, - 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, - 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, - 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, - 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, - 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE + 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; /* The volume ranges from 0 - 128 */ #define ADJUST_VOLUME(s, v) (s = (s*v)/SDL_MIX_MAXVOLUME) #define ADJUST_VOLUME_U8(s, v) (s = (((s-128)*v)/SDL_MIX_MAXVOLUME)+128) +#define ADJUST_VOLUME_U16(s, v) (s = (((s-32768)*v)/SDL_MIX_MAXVOLUME)+32768) void @@ -115,8 +115,8 @@ SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format, Sint8 *dst8, *src8; Sint8 src_sample; int dst_sample; - const int max_audioval = ((1 << (8 - 1)) - 1); - const int min_audioval = -(1 << (8 - 1)); + const int max_audioval = SDL_MAX_SINT8; + const int min_audioval = SDL_MIN_SINT8; src8 = (Sint8 *) src; dst8 = (Sint8 *) dst; @@ -125,12 +125,11 @@ SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format, ADJUST_VOLUME(src_sample, volume); dst_sample = *dst8 + src_sample; if (dst_sample > max_audioval) { - *dst8 = max_audioval; + dst_sample = max_audioval; } else if (dst_sample < min_audioval) { - *dst8 = min_audioval; - } else { - *dst8 = dst_sample; + dst_sample = min_audioval; } + *dst8 = dst_sample; ++dst8; ++src8; } @@ -141,14 +140,14 @@ SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format, { Sint16 src1, src2; int dst_sample; - const int max_audioval = ((1 << (16 - 1)) - 1); - const int min_audioval = -(1 << (16 - 1)); + const int max_audioval = SDL_MAX_SINT16; + const int min_audioval = SDL_MIN_SINT16; len /= 2; while (len--) { - src1 = ((src[1]) << 8 | src[0]); + src1 = SDL_SwapLE16(*(Sint16 *)src); ADJUST_VOLUME(src1, volume); - src2 = ((dst[1]) << 8 | dst[0]); + src2 = SDL_SwapLE16(*(Sint16 *)dst); src += 2; dst_sample = src1 + src2; if (dst_sample > max_audioval) { @@ -156,9 +155,7 @@ SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format, } else if (dst_sample < min_audioval) { dst_sample = min_audioval; } - dst[0] = dst_sample & 0xFF; - dst_sample >>= 8; - dst[1] = dst_sample & 0xFF; + *(Sint16 *)dst = SDL_SwapLE16(dst_sample); dst += 2; } } @@ -168,14 +165,14 @@ SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format, { Sint16 src1, src2; int dst_sample; - const int max_audioval = ((1 << (16 - 1)) - 1); - const int min_audioval = -(1 << (16 - 1)); + const int max_audioval = SDL_MAX_SINT16; + const int min_audioval = SDL_MIN_SINT16; len /= 2; while (len--) { - src1 = ((src[0]) << 8 | src[1]); + src1 = SDL_SwapBE16(*(Sint16 *)src); ADJUST_VOLUME(src1, volume); - src2 = ((dst[0]) << 8 | dst[1]); + src2 = SDL_SwapBE16(*(Sint16 *)dst); src += 2; dst_sample = src1 + src2; if (dst_sample > max_audioval) { @@ -183,9 +180,7 @@ SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format, } else if (dst_sample < min_audioval) { dst_sample = min_audioval; } - dst[1] = dst_sample & 0xFF; - dst_sample >>= 8; - dst[0] = dst_sample & 0xFF; + *(Sint16 *)dst = SDL_SwapBE16(dst_sample); dst += 2; } } @@ -195,21 +190,23 @@ SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format, { Uint16 src1, src2; int dst_sample; - const int max_audioval = 0xFFFF; + const int max_audioval = SDL_MAX_SINT16; + const int min_audioval = SDL_MIN_SINT16; len /= 2; while (len--) { - src1 = ((src[1]) << 8 | src[0]); - ADJUST_VOLUME(src1, volume); - src2 = ((dst[1]) << 8 | dst[0]); + src1 = SDL_SwapLE16(*(Uint16 *)src); + ADJUST_VOLUME_U16(src1, volume); + src2 = SDL_SwapLE16(*(Uint16 *)dst); src += 2; - dst_sample = src1 + src2; + dst_sample = src1 + src2 - 32768 * 2; if (dst_sample > max_audioval) { dst_sample = max_audioval; + } else if (dst_sample < min_audioval) { + dst_sample = min_audioval; } - dst[0] = dst_sample & 0xFF; - dst_sample >>= 8; - dst[1] = dst_sample & 0xFF; + dst_sample += 32768; + *(Uint16 *)dst = SDL_SwapLE16(dst_sample); dst += 2; } } @@ -219,21 +216,23 @@ SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format, { Uint16 src1, src2; int dst_sample; - const int max_audioval = 0xFFFF; + const int max_audioval = SDL_MAX_SINT16; + const int min_audioval = SDL_MIN_SINT16; len /= 2; while (len--) { - src1 = ((src[0]) << 8 | src[1]); - ADJUST_VOLUME(src1, volume); - src2 = ((dst[0]) << 8 | dst[1]); + src1 = SDL_SwapBE16(*(Uint16 *)src); + ADJUST_VOLUME_U16(src1, volume); + src2 = SDL_SwapBE16(*(Uint16 *)dst); src += 2; - dst_sample = src1 + src2; + dst_sample = src1 + src2 - 32768 * 2; if (dst_sample > max_audioval) { dst_sample = max_audioval; + } else if (dst_sample < min_audioval) { + dst_sample = min_audioval; } - dst[1] = dst_sample & 0xFF; - dst_sample >>= 8; - dst[0] = dst_sample & 0xFF; + dst_sample += 32768; + *(Uint16 *)dst = SDL_SwapBE16(dst_sample); dst += 2; } } @@ -245,8 +244,8 @@ SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format, Uint32 *dst32 = (Uint32 *) dst; Sint64 src1, src2; Sint64 dst_sample; - const Sint64 max_audioval = ((((Sint64) 1) << (32 - 1)) - 1); - const Sint64 min_audioval = -(((Sint64) 1) << (32 - 1)); + const Sint64 max_audioval = SDL_MAX_SINT32; + const Sint64 min_audioval = SDL_MIN_SINT32; len /= 4; while (len--) { @@ -271,8 +270,8 @@ SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format, Uint32 *dst32 = (Uint32 *) dst; Sint64 src1, src2; Sint64 dst_sample; - const Sint64 max_audioval = ((((Sint64) 1) << (32 - 1)) - 1); - const Sint64 min_audioval = -(((Sint64) 1) << (32 - 1)); + const Sint64 max_audioval = SDL_MAX_SINT32; + const Sint64 min_audioval = SDL_MIN_SINT32; len /= 4; while (len--) { diff --git a/libs/SDL2/src/audio/SDL_sysaudio.h b/libs/SDL2/src/audio/SDL_sysaudio.h index 6c602f07..d7e16853 100644 --- a/libs/SDL2/src/audio/SDL_sysaudio.h +++ b/libs/SDL2/src/audio/SDL_sysaudio.h @@ -39,11 +39,11 @@ typedef struct SDL_AudioDevice SDL_AudioDevice; /* Audio targets should call this as devices are added to the system (such as a USB headset being plugged in), and should also be called for for every device found during DetectDevices(). */ -extern void SDL_AddAudioDevice(const int iscapture, const char *name, SDL_AudioSpec *spec, void *handle); +extern void SDL_AddAudioDevice(const SDL_bool iscapture, const char *name, SDL_AudioSpec *spec, void *handle); /* Audio targets should call this as devices are removed, so SDL can update its list of available devices. */ -extern void SDL_RemoveAudioDevice(const int iscapture, void *handle); +extern void SDL_RemoveAudioDevice(const SDL_bool iscapture, void *handle); /* Audio targets should call this if an opened audio device is lost while being used. This can happen due to i/o errors, or a device being unplugged, @@ -65,16 +65,14 @@ extern void SDL_OpenedAudioDeviceDisconnected(SDL_AudioDevice *device); typedef struct SDL_AudioDriverImpl { void (*DetectDevices) (void); - int (*OpenDevice) (_THIS, void *handle, const char *devname, int iscapture); + int (*OpenDevice) (_THIS, const char *devname); void (*ThreadInit) (_THIS); /* Called by audio thread at start */ void (*ThreadDeinit) (_THIS); /* Called by audio thread at end */ - void (*BeginLoopIteration)(_THIS); /* Called by audio thread at top of loop */ void (*WaitDevice) (_THIS); void (*PlayDevice) (_THIS); Uint8 *(*GetDeviceBuf) (_THIS); int (*CaptureFromDevice) (_THIS, void *buffer, int buflen); void (*FlushCapture) (_THIS); - void (*PrepareToClose) (_THIS); /**< Called between run and draining wait for playback devices */ void (*CloseDevice) (_THIS); void (*LockDevice) (_THIS); void (*UnlockDevice) (_THIS); @@ -84,13 +82,11 @@ typedef struct SDL_AudioDriverImpl /* !!! FIXME: add pause(), so we can optimize instead of mixing silence. */ /* Some flags to push duplicate code into the core and reduce #ifdefs. */ - /* !!! FIXME: these should be SDL_bool */ - int ProvidesOwnCallbackThread; - int SkipMixerLock; - int HasCaptureSupport; - int OnlyHasDefaultOutputDevice; - int OnlyHasDefaultCaptureDevice; - int AllowsArbitraryDeviceNames; + SDL_bool ProvidesOwnCallbackThread; + SDL_bool HasCaptureSupport; + SDL_bool OnlyHasDefaultOutputDevice; + SDL_bool OnlyHasDefaultCaptureDevice; + SDL_bool AllowsArbitraryDeviceNames; } SDL_AudioDriverImpl; @@ -178,8 +174,8 @@ typedef struct AudioBootStrap { const char *name; const char *desc; - int (*init) (SDL_AudioDriverImpl * impl); - int demand_only; /* 1==request explicitly, or it won't be available. */ + SDL_bool (*init) (SDL_AudioDriverImpl * impl); + SDL_bool demand_only; /* 1==request explicitly, or it won't be available. */ } AudioBootStrap; /* Not all of these are available in a given build. Use #ifdefs, etc. */ @@ -208,6 +204,7 @@ extern AudioBootStrap FUSIONSOUND_bootstrap; 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 --git a/libs/SDL2/src/audio/SDL_wave.c b/libs/SDL2/src/audio/SDL_wave.c index 07eb1014..e49b5506 100644 --- a/libs/SDL2/src/audio/SDL_wave.c +++ b/libs/SDL2/src/audio/SDL_wave.c @@ -685,7 +685,7 @@ MS_ADPCM_Decode(WaveFile *file, Uint8 **audio_buf, Uint32 *audio_len) state.output.pos = 0; state.output.size = outputsize / sizeof(Sint16); - state.output.data = (Sint16 *)SDL_malloc(outputsize); + state.output.data = (Sint16 *)SDL_calloc(1, outputsize); if (state.output.data == NULL) { return SDL_OutOfMemory(); } diff --git a/libs/SDL2/src/audio/aaudio/SDL_aaudio.c b/libs/SDL2/src/audio/aaudio/SDL_aaudio.c index 4e728b5c..1d1553ba 100644 --- a/libs/SDL2/src/audio/aaudio/SDL_aaudio.c +++ b/libs/SDL2/src/audio/aaudio/SDL_aaudio.c @@ -71,9 +71,10 @@ void aaudio_errorCallback( AAudioStream *stream, void *userData, aaudio_result_t #define LIB_AAUDIO_SO "libaaudio.so" static int -aaudio_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +aaudio_OpenDevice(_THIS, const char *devname) { struct SDL_PrivateAudioData *private; + SDL_bool iscapture = this->iscapture; aaudio_result_t res; LOGI(__func__); @@ -268,7 +269,7 @@ aaudio_Deinitialize(void) LOGI("End AAUDIO %s", SDL_GetError()); } -static int +static SDL_bool aaudio_Init(SDL_AudioDriverImpl *impl) { aaudio_result_t res; @@ -280,7 +281,7 @@ aaudio_Init(SDL_AudioDriverImpl *impl) * See https://github.com/google/oboe/issues/40 for more information. */ if (SDL_GetAndroidSDKVersion() < 27) { - return 0; + return SDL_FALSE; } SDL_zero(ctx); @@ -315,12 +316,12 @@ aaudio_Init(SDL_AudioDriverImpl *impl) /* and the capabilities */ impl->HasCaptureSupport = SDL_TRUE; - impl->OnlyHasDefaultOutputDevice = 1; - impl->OnlyHasDefaultCaptureDevice = 1; + impl->OnlyHasDefaultOutputDevice = SDL_TRUE; + impl->OnlyHasDefaultCaptureDevice = SDL_TRUE; /* this audio target is available. */ LOGI("SDL aaudio_Init OK"); - return 1; + return SDL_TRUE; failure: if (ctx.handle) { @@ -331,11 +332,11 @@ failure: } ctx.handle = NULL; ctx.builder = NULL; - return 0; + return SDL_FALSE; } AudioBootStrap aaudio_bootstrap = { - "AAudio", "AAudio audio driver", aaudio_Init, 0 + "AAudio", "AAudio audio driver", aaudio_Init, SDL_FALSE }; /* Pause (block) all non already paused audio devices by taking their mixer lock */ diff --git a/libs/SDL2/src/audio/alsa/SDL_alsa_audio.c b/libs/SDL2/src/audio/alsa/SDL_alsa_audio.c index 78a491ed..3f990a2a 100644 --- a/libs/SDL2/src/audio/alsa/SDL_alsa_audio.c +++ b/libs/SDL2/src/audio/alsa/SDL_alsa_audio.c @@ -543,9 +543,10 @@ ALSA_set_buffer_size(_THIS, snd_pcm_hw_params_t *params) } static int -ALSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +ALSA_OpenDevice(_THIS, const char *devname) { int status = 0; + SDL_bool iscapture = this->iscapture; snd_pcm_t *pcm_handle = NULL; snd_pcm_hw_params_t *hwparams = NULL; snd_pcm_sw_params_t *swparams = NULL; @@ -569,7 +570,7 @@ ALSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) /* Open the audio device */ /* Name of device should depend on # channels in spec */ status = ALSA_snd_pcm_open(&pcm_handle, - get_audio_device(handle, this->spec.channels), + get_audio_device(this->handle, this->spec.channels), iscapture ? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK); @@ -597,10 +598,7 @@ ALSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) } /* Try for a closest match on audio format */ - status = -1; - for (test_format = SDL_FirstAudioFormat(this->spec.format); - test_format && (status < 0);) { - status = 0; /* if we can't support a format, it'll become -1. */ + for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { switch (test_format) { case AUDIO_U8: format = SND_PCM_FORMAT_U8; @@ -633,19 +631,14 @@ ALSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) format = SND_PCM_FORMAT_FLOAT_BE; break; default: - status = -1; + continue; + } + if (ALSA_snd_pcm_hw_params_set_format(pcm_handle, hwparams, format) >= 0) { break; } - if (status >= 0) { - status = ALSA_snd_pcm_hw_params_set_format(pcm_handle, - hwparams, format); - } - if (status < 0) { - test_format = SDL_NextAudioFormat(); - } } - if (status < 0) { - return SDL_SetError("ALSA: Couldn't find any hardware audio formats"); + if (!test_format) { + return SDL_SetError("%s: Unsupported audio format", "alsa"); } this->spec.format = test_format; @@ -997,11 +990,11 @@ ALSA_Deinitialize(void) UnloadALSALibrary(); } -static int +static SDL_bool ALSA_Init(SDL_AudioDriverImpl * impl) { if (LoadALSALibrary() < 0) { - return 0; + return SDL_FALSE; } /* Set the function pointers */ @@ -1017,12 +1010,12 @@ ALSA_Init(SDL_AudioDriverImpl * impl) impl->HasCaptureSupport = SDL_TRUE; - return 1; /* this audio target is available. */ + return SDL_TRUE; /* this audio target is available. */ } AudioBootStrap ALSA_bootstrap = { - "alsa", "ALSA PCM audio", ALSA_Init, 0 + "alsa", "ALSA PCM audio", ALSA_Init, SDL_FALSE }; #endif /* SDL_AUDIO_DRIVER_ALSA */ diff --git a/libs/SDL2/src/audio/android/SDL_androidaudio.c b/libs/SDL2/src/audio/android/SDL_androidaudio.c index 3efa2d63..aa0d4424 100644 --- a/libs/SDL2/src/audio/android/SDL_androidaudio.c +++ b/libs/SDL2/src/audio/android/SDL_androidaudio.c @@ -36,9 +36,10 @@ static SDL_AudioDevice* audioDevice = NULL; static SDL_AudioDevice* captureDevice = NULL; static int -ANDROIDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +ANDROIDAUDIO_OpenDevice(_THIS, const char *devname) { SDL_AudioFormat test_format; + SDL_bool iscapture = this->iscapture; SDL_assert((captureDevice == NULL) || !iscapture); SDL_assert((audioDevice == NULL) || iscapture); @@ -54,20 +55,18 @@ ANDROIDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) return SDL_OutOfMemory(); } - test_format = SDL_FirstAudioFormat(this->spec.format); - while (test_format != 0) { /* no "UNKNOWN" constant */ + for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { if ((test_format == AUDIO_U8) || (test_format == AUDIO_S16) || (test_format == AUDIO_F32)) { this->spec.format = test_format; break; } - test_format = SDL_NextAudioFormat(); } - if (test_format == 0) { + if (!test_format) { /* Didn't find a compatible format :( */ - return SDL_SetError("No compatible audio format!"); + return SDL_SetError("%s: Unsupported audio format", "android"); } if (Android_JNI_OpenAudioDevice(iscapture, &this->spec) < 0) { @@ -120,7 +119,7 @@ ANDROIDAUDIO_CloseDevice(_THIS) SDL_free(this->hidden); } -static int +static SDL_bool ANDROIDAUDIO_Init(SDL_AudioDriverImpl * impl) { /* Set the function pointers */ @@ -133,14 +132,14 @@ ANDROIDAUDIO_Init(SDL_AudioDriverImpl * impl) /* and the capabilities */ impl->HasCaptureSupport = SDL_TRUE; - impl->OnlyHasDefaultOutputDevice = 1; - impl->OnlyHasDefaultCaptureDevice = 1; + impl->OnlyHasDefaultOutputDevice = SDL_TRUE; + impl->OnlyHasDefaultCaptureDevice = SDL_TRUE; - return 1; /* this audio target is available. */ + return SDL_TRUE; /* this audio target is available. */ } AudioBootStrap ANDROIDAUDIO_bootstrap = { - "android", "SDL Android audio driver", ANDROIDAUDIO_Init, 0 + "android", "SDL Android audio driver", ANDROIDAUDIO_Init, SDL_FALSE }; /* Pause (block) all non already paused audio devices by taking their mixer lock */ diff --git a/libs/SDL2/src/audio/arts/SDL_artsaudio.c b/libs/SDL2/src/audio/arts/SDL_artsaudio.c index 040d9366..ce74b7d4 100644 --- a/libs/SDL2/src/audio/arts/SDL_artsaudio.c +++ b/libs/SDL2/src/audio/arts/SDL_artsaudio.c @@ -216,11 +216,11 @@ ARTS_Suspend(void) } static int -ARTS_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +ARTS_OpenDevice(_THIS, const char *devname) { int rc = 0; - int bits = 0, frag_spec = 0; - SDL_AudioFormat test_format = 0, format = 0; + int bits, frag_spec = 0; + SDL_AudioFormat test_format = 0; /* Initialize all variables that we clean on shutdown */ this->hidden = (struct SDL_PrivateAudioData *) @@ -231,32 +231,24 @@ ARTS_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) SDL_zerop(this->hidden); /* Try for a closest match on audio format */ - for (test_format = SDL_FirstAudioFormat(this->spec.format); - !format && test_format;) { + for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { #ifdef DEBUG_AUDIO fprintf(stderr, "Trying format 0x%4.4x\n", test_format); #endif switch (test_format) { case AUDIO_U8: - bits = 8; - format = 1; - break; case AUDIO_S16LSB: - bits = 16; - format = 1; break; default: - format = 0; - break; - } - if (!format) { - test_format = SDL_NextAudioFormat(); + continue; } + break; } - if (format == 0) { - return SDL_SetError("Couldn't find any hardware audio formats"); + if (!test_format) { + return SDL_SetError("%s: Unsupported audio format", "arts"); } this->spec.format = test_format; + bits = SDL_AUDIO_BITSIZE(test_format); if ((rc = SDL_NAME(arts_init) ()) != 0) { return SDL_SetError("Unable to initialize ARTS: %s", @@ -320,16 +312,16 @@ ARTS_Deinitialize(void) } -static int +static SDL_bool ARTS_Init(SDL_AudioDriverImpl * impl) { if (LoadARTSLibrary() < 0) { - return 0; + return SDL_FALSE; } else { if (SDL_NAME(arts_init) () != 0) { UnloadARTSLibrary(); SDL_SetError("ARTS: arts_init failed (no audio server?)"); - return 0; + return SDL_FALSE; } /* Play a stream so aRts doesn't crash */ @@ -350,14 +342,14 @@ ARTS_Init(SDL_AudioDriverImpl * impl) impl->GetDeviceBuf = ARTS_GetDeviceBuf; impl->CloseDevice = ARTS_CloseDevice; impl->Deinitialize = ARTS_Deinitialize; - impl->OnlyHasDefaultOutputDevice = 1; + impl->OnlyHasDefaultOutputDevice = SDL_TRUE; - return 1; /* this audio target is available. */ + return SDL_TRUE; /* this audio target is available. */ } AudioBootStrap ARTS_bootstrap = { - "arts", "Analog RealTime Synthesizer", ARTS_Init, 0 + "arts", "Analog RealTime Synthesizer", ARTS_Init, SDL_FALSE }; #endif /* SDL_AUDIO_DRIVER_ARTS */ diff --git a/libs/SDL2/src/audio/coreaudio/SDL_coreaudio.m b/libs/SDL2/src/audio/coreaudio/SDL_coreaudio.m index 67d838fd..6717feaa 100644 --- a/libs/SDL2/src/audio/coreaudio/SDL_coreaudio.m +++ b/libs/SDL2/src/audio/coreaudio/SDL_coreaudio.m @@ -522,8 +522,12 @@ static void 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 @@ outputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffe 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 @@ outputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffe 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 @@ outputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffe AudioQueueEnqueueBuffer(this->hidden->audioQueue, inBuffer, 0, NULL); inBuffer->mAudioDataByteSize = inBuffer->mAudioDataBytesCapacity; + + SDL_UnlockMutex(this->mixer_lock); } static void @@ -741,8 +743,10 @@ COREAUDIO_CloseDevice(_THIS) #if MACOSX_COREAUDIO static int -prepare_device(_THIS, void *handle, int iscapture) +prepare_device(_THIS) { + void *handle = this->handle; + SDL_bool iscapture = this->iscapture; AudioDeviceID devid = (AudioDeviceID) ((size_t) handle); OSStatus result = noErr; UInt32 size = 0; @@ -820,7 +824,10 @@ prepare_audioqueue(_THIS) 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); @@ -852,7 +859,6 @@ prepare_audioqueue(_THIS) SDL_CalculateAudioSpec(&this->spec); /* Set the channel layout for the audio queue */ - AudioChannelLayout layout; SDL_zero(layout); switch (this->spec.channels) { case 1: @@ -897,15 +903,13 @@ prepare_audioqueue(_THIS) } /* 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); } @@ -942,6 +946,7 @@ static int audioqueue_thread(void *arg) { SDL_AudioDevice *this = (SDL_AudioDevice *) arg; + int rc; #if MACOSX_COREAUDIO const AudioObjectPropertyAddress default_device_address = { @@ -956,7 +961,7 @@ audioqueue_thread(void *arg) } #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); @@ -973,6 +978,7 @@ audioqueue_thread(void *arg) #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 @@ -982,8 +988,7 @@ audioqueue_thread(void *arg) /* 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, this->handle, this->iscapture) && (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)) { int i; @@ -1015,11 +1020,11 @@ audioqueue_thread(void *arg) } static int -COREAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +COREAUDIO_OpenDevice(_THIS, const char *devname) { AudioStreamBasicDescription *strdesc; - SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format); - int valid_datatype = 0; + SDL_AudioFormat test_format; + SDL_bool iscapture = this->iscapture; SDL_AudioDevice **new_open_devices; /* Initialize all variables that we clean on shutdown */ @@ -1076,8 +1081,7 @@ COREAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) strdesc->mSampleRate = this->spec.freq; strdesc->mFramesPerPacket = 1; - while ((!valid_datatype) && (test_format)) { - this->spec.format = test_format; + for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { /* CoreAudio handles most of SDL's formats natively, but not U16, apparently. */ switch (test_format) { case AUDIO_U8: @@ -1088,32 +1092,32 @@ COREAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) case AUDIO_S32MSB: case AUDIO_F32LSB: case AUDIO_F32MSB: - valid_datatype = 1; - strdesc->mBitsPerChannel = SDL_AUDIO_BITSIZE(this->spec.format); - if (SDL_AUDIO_ISBIGENDIAN(this->spec.format)) - strdesc->mFormatFlags |= kLinearPCMFormatFlagIsBigEndian; - - if (SDL_AUDIO_ISFLOAT(this->spec.format)) - strdesc->mFormatFlags |= kLinearPCMFormatFlagIsFloat; - else if (SDL_AUDIO_ISSIGNED(this->spec.format)) - strdesc->mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger; break; default: - test_format = SDL_NextAudioFormat(); - break; + continue; } + break; } - if (!valid_datatype) { /* shouldn't happen, but just in case... */ - return SDL_SetError("Unsupported audio format"); + if (!test_format) { /* shouldn't happen, but just in case... */ + return SDL_SetError("%s: Unsupported audio format", "coreaudio"); } + this->spec.format = test_format; + strdesc->mBitsPerChannel = SDL_AUDIO_BITSIZE(test_format); + if (SDL_AUDIO_ISBIGENDIAN(test_format)) + strdesc->mFormatFlags |= kLinearPCMFormatFlagIsBigEndian; + + if (SDL_AUDIO_ISFLOAT(test_format)) + strdesc->mFormatFlags |= kLinearPCMFormatFlagIsFloat; + else if (SDL_AUDIO_ISSIGNED(test_format)) + strdesc->mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger; strdesc->mBytesPerFrame = strdesc->mChannelsPerFrame * strdesc->mBitsPerChannel / 8; strdesc->mBytesPerPacket = strdesc->mBytesPerFrame * strdesc->mFramesPerPacket; #if MACOSX_COREAUDIO - if (!prepare_device(this, handle, iscapture)) { + if (!prepare_device(this)) { return -1; } #endif @@ -1135,8 +1139,7 @@ COREAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) this->hidden->ready_semaphore = NULL; if ((this->hidden->thread != NULL) && (this->hidden->thread_error != NULL)) { - SDL_SetError("%s", this->hidden->thread_error); - return -1; + return SDL_SetError("%s", this->hidden->thread_error); } return (this->hidden->thread != NULL) ? 0 : -1; @@ -1152,7 +1155,7 @@ COREAUDIO_Deinitialize(void) #endif } -static int +static SDL_bool COREAUDIO_Init(SDL_AudioDriverImpl * impl) { /* Set the function pointers */ @@ -1164,18 +1167,18 @@ COREAUDIO_Init(SDL_AudioDriverImpl * impl) impl->DetectDevices = COREAUDIO_DetectDevices; AudioObjectAddPropertyListener(kAudioObjectSystemObject, &devlist_address, device_list_changed, NULL); #else - impl->OnlyHasDefaultOutputDevice = 1; - impl->OnlyHasDefaultCaptureDevice = 1; + impl->OnlyHasDefaultOutputDevice = SDL_TRUE; + impl->OnlyHasDefaultCaptureDevice = SDL_TRUE; #endif - impl->ProvidesOwnCallbackThread = 1; - impl->HasCaptureSupport = 1; + impl->ProvidesOwnCallbackThread = SDL_TRUE; + impl->HasCaptureSupport = SDL_TRUE; - return 1; /* this audio target is available. */ + return SDL_TRUE; /* this audio target is available. */ } AudioBootStrap COREAUDIO_bootstrap = { - "coreaudio", "CoreAudio", COREAUDIO_Init, 0 + "coreaudio", "CoreAudio", COREAUDIO_Init, SDL_FALSE }; #endif /* SDL_AUDIO_DRIVER_COREAUDIO */ diff --git a/libs/SDL2/src/audio/directsound/SDL_directsound.c b/libs/SDL2/src/audio/directsound/SDL_directsound.c index b4e8ce25..0242b139 100644 --- a/libs/SDL2/src/audio/directsound/SDL_directsound.c +++ b/libs/SDL2/src/audio/directsound/SDL_directsound.c @@ -98,10 +98,8 @@ DSOUND_Load(void) static int SetDSerror(const char *function, int code) { - static const char *error; - static char errbuf[1024]; + const char *error; - errbuf[0] = 0; switch (code) { case E_NOINTERFACE: error = "Unsupported interface -- Is DirectX 8.0 or later installed?"; @@ -137,15 +135,11 @@ SetDSerror(const char *function, int code) error = "Function not supported"; break; default: - SDL_snprintf(errbuf, SDL_arraysize(errbuf), - "%s: Unknown DirectSound error: 0x%x", function, code); + error = "Unknown DirectSound error"; break; } - if (!errbuf[0]) { - SDL_snprintf(errbuf, SDL_arraysize(errbuf), "%s: %s", function, - error); - } - return SDL_SetError("%s", errbuf); + + return SDL_SetError("%s: %s (0x%x)", function, error, code); } static void @@ -473,14 +467,14 @@ CreateCaptureBuffer(_THIS, const DWORD bufsize, WAVEFORMATEX *wfmt) } static int -DSOUND_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +DSOUND_OpenDevice(_THIS, const char *devname) { const DWORD numchunks = 8; HRESULT result; - SDL_bool valid_format = SDL_FALSE; SDL_bool tried_format = SDL_FALSE; - SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format); - LPGUID guid = (LPGUID) handle; + SDL_bool iscapture = this->iscapture; + SDL_AudioFormat test_format; + LPGUID guid = (LPGUID) this->handle; DWORD bufsize; /* Initialize all variables that we clean on shutdown */ @@ -510,7 +504,7 @@ DSOUND_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) } } - while ((!valid_format) && (test_format)) { + for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { switch (test_format) { case AUDIO_U8: case AUDIO_S16: @@ -547,19 +541,21 @@ DSOUND_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) rc = iscapture ? CreateCaptureBuffer(this, bufsize, &wfmt) : CreateSecondary(this, bufsize, &wfmt); if (rc == 0) { this->hidden->num_buffers = numchunks; - valid_format = SDL_TRUE; + break; } } - break; + continue; + default: + continue; } - test_format = SDL_NextAudioFormat(); + break; } - if (!valid_format) { + if (!test_format) { if (tried_format) { return -1; /* CreateSecondary() should have called SDL_SetError(). */ } - return SDL_SetError("DirectSound: Unsupported audio format"); + return SDL_SetError("%s: Unsupported audio format", "directsound"); } /* Playback buffers will auto-start playing in DSOUND_WaitDevice() */ @@ -575,11 +571,11 @@ DSOUND_Deinitialize(void) } -static int +static SDL_bool DSOUND_Init(SDL_AudioDriverImpl * impl) { if (!DSOUND_Load()) { - return 0; + return SDL_FALSE; } /* Set the function pointers */ @@ -596,11 +592,11 @@ DSOUND_Init(SDL_AudioDriverImpl * impl) impl->HasCaptureSupport = SDL_TRUE; - return 1; /* this audio target is available. */ + return SDL_TRUE; /* this audio target is available. */ } AudioBootStrap DSOUND_bootstrap = { - "directsound", "DirectSound", DSOUND_Init, 0 + "directsound", "DirectSound", DSOUND_Init, SDL_FALSE }; #endif /* SDL_AUDIO_DRIVER_DSOUND */ diff --git a/libs/SDL2/src/audio/disk/SDL_diskaudio.c b/libs/SDL2/src/audio/disk/SDL_diskaudio.c index 56dfca50..f1edf503 100644 --- a/libs/SDL2/src/audio/disk/SDL_diskaudio.c +++ b/libs/SDL2/src/audio/disk/SDL_diskaudio.c @@ -114,7 +114,7 @@ DISKAUDIO_CloseDevice(_THIS) static const char * -get_filename(const int iscapture, const char *devname) +get_filename(const SDL_bool iscapture, const char *devname) { if (devname == NULL) { devname = SDL_getenv(iscapture ? DISKENVR_INFILE : DISKENVR_OUTFILE); @@ -126,9 +126,11 @@ get_filename(const int iscapture, const char *devname) } static int -DISKAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +DISKAUDIO_OpenDevice(_THIS, const char *devname) { + void *handle = _this->handle; /* handle != NULL means "user specified the placeholder name on the fake detected device list" */ + SDL_bool iscapture = _this->iscapture; const char *fname = get_filename(iscapture, handle ? NULL : devname); const char *envr = SDL_getenv(DISKENVR_IODELAY); @@ -177,7 +179,7 @@ DISKAUDIO_DetectDevices(void) SDL_AddAudioDevice(SDL_TRUE, DEFAULT_INPUT_DEVNAME, NULL, (void *) 0x2); } -static int +static SDL_bool DISKAUDIO_Init(SDL_AudioDriverImpl * impl) { /* Set the function pointers */ @@ -191,14 +193,14 @@ DISKAUDIO_Init(SDL_AudioDriverImpl * impl) impl->CloseDevice = DISKAUDIO_CloseDevice; impl->DetectDevices = DISKAUDIO_DetectDevices; - impl->AllowsArbitraryDeviceNames = 1; + impl->AllowsArbitraryDeviceNames = SDL_TRUE; impl->HasCaptureSupport = SDL_TRUE; - return 1; /* this audio target is available. */ + return SDL_TRUE; /* this audio target is available. */ } AudioBootStrap DISKAUDIO_bootstrap = { - "disk", "direct-to-disk audio", DISKAUDIO_Init, 1 + "disk", "direct-to-disk audio", DISKAUDIO_Init, SDL_TRUE }; #endif /* SDL_AUDIO_DRIVER_DISK */ diff --git a/libs/SDL2/src/audio/dsp/SDL_dspaudio.c b/libs/SDL2/src/audio/dsp/SDL_dspaudio.c index 3c4b6aaf..531612a2 100644 --- a/libs/SDL2/src/audio/dsp/SDL_dspaudio.c +++ b/libs/SDL2/src/audio/dsp/SDL_dspaudio.c @@ -68,8 +68,9 @@ DSP_CloseDevice(_THIS) static int -DSP_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +DSP_OpenDevice(_THIS, const char *devname) { + SDL_bool iscapture = this->iscapture; const int flags = ((iscapture) ? OPEN_FLAGS_INPUT : OPEN_FLAGS_OUTPUT); int format; int value; @@ -301,13 +302,14 @@ look_for_devices_test(int fd) return 0; } -static int +static SDL_bool DSP_Init(SDL_AudioDriverImpl * impl) { InitTimeDevicesExist = SDL_FALSE; SDL_EnumUnixAudioDevices(0, look_for_devices_test); if (!InitTimeDevicesExist) { - return 0; /* maybe try a different backend. */ + SDL_SetError("dsp: No such audio device"); + return SDL_FALSE; /* maybe try a different backend. */ } /* Set the function pointers */ @@ -319,15 +321,15 @@ DSP_Init(SDL_AudioDriverImpl * impl) impl->CaptureFromDevice = DSP_CaptureFromDevice; impl->FlushCapture = DSP_FlushCapture; - impl->AllowsArbitraryDeviceNames = 1; + impl->AllowsArbitraryDeviceNames = SDL_TRUE; impl->HasCaptureSupport = SDL_TRUE; - return 1; /* this audio target is available. */ + return SDL_TRUE; /* this audio target is available. */ } AudioBootStrap DSP_bootstrap = { - "dsp", "OSS /dev/dsp standard audio", DSP_Init, 0 + "dsp", "OSS /dev/dsp standard audio", DSP_Init, SDL_FALSE }; #endif /* SDL_AUDIO_DRIVER_OSS */ diff --git a/libs/SDL2/src/audio/dummy/SDL_dummyaudio.c b/libs/SDL2/src/audio/dummy/SDL_dummyaudio.c index e8b557a2..dab1edb5 100644 --- a/libs/SDL2/src/audio/dummy/SDL_dummyaudio.c +++ b/libs/SDL2/src/audio/dummy/SDL_dummyaudio.c @@ -28,7 +28,7 @@ #include "SDL_dummyaudio.h" static int -DUMMYAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +DUMMYAUDIO_OpenDevice(_THIS, const char *devname) { _this->hidden = (void *) 0x1; /* just something non-NULL */ return 0; /* always succeeds. */ @@ -45,22 +45,22 @@ DUMMYAUDIO_CaptureFromDevice(_THIS, void *buffer, int buflen) return buflen; } -static int +static SDL_bool DUMMYAUDIO_Init(SDL_AudioDriverImpl * impl) { /* Set the function pointers */ impl->OpenDevice = DUMMYAUDIO_OpenDevice; impl->CaptureFromDevice = DUMMYAUDIO_CaptureFromDevice; - impl->OnlyHasDefaultOutputDevice = 1; - impl->OnlyHasDefaultCaptureDevice = 1; + impl->OnlyHasDefaultOutputDevice = SDL_TRUE; + impl->OnlyHasDefaultCaptureDevice = SDL_TRUE; impl->HasCaptureSupport = SDL_TRUE; - return 1; /* this audio target is available. */ + return SDL_TRUE; /* this audio target is available. */ } AudioBootStrap DUMMYAUDIO_bootstrap = { - "dummy", "SDL dummy audio driver", DUMMYAUDIO_Init, 1 + "dummy", "SDL dummy audio driver", DUMMYAUDIO_Init, SDL_TRUE }; /* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/audio/emscripten/SDL_emscriptenaudio.c b/libs/SDL2/src/audio/emscripten/SDL_emscriptenaudio.c index c85d8d0f..bfe42821 100644 --- a/libs/SDL2/src/audio/emscripten/SDL_emscriptenaudio.c +++ b/libs/SDL2/src/audio/emscripten/SDL_emscriptenaudio.c @@ -28,11 +28,16 @@ #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) { const int framelen = (SDL_AUDIO_BITSIZE(this->spec.format) / 8) * this->spec.channels; - EM_ASM_ARGS({ + MAIN_THREAD_EM_ASM({ var SDL2 = Module['SDL2']; var numChannels = SDL2.audio.currentOutputBuffer['numberOfChannels']; for (var c = 0; c < numChannels; ++c) { @@ -101,7 +106,7 @@ HandleCaptureProcess(_THIS) return; } - EM_ASM_ARGS({ + MAIN_THREAD_EM_ASM({ var SDL2 = Module['SDL2']; var numChannels = SDL2.capture.currentCaptureBuffer.numberOfChannels; for (var c = 0; c < numChannels; ++c) { @@ -147,7 +152,7 @@ HandleCaptureProcess(_THIS) static void EMSCRIPTENAUDIO_CloseDevice(_THIS) { - EM_ASM_({ + MAIN_THREAD_EM_ASM({ var SDL2 = Module['SDL2']; if ($0) { if (SDL2.capture.silenceTimer !== undefined) { @@ -192,16 +197,16 @@ EMSCRIPTENAUDIO_CloseDevice(_THIS) } static int -EMSCRIPTENAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +EMSCRIPTENAUDIO_OpenDevice(_THIS, const char *devname) { - SDL_bool valid_format = SDL_FALSE; SDL_AudioFormat test_format; + SDL_bool iscapture = this->iscapture; int result; /* based on parts of library_sdl.js */ /* create context */ - result = EM_ASM_INT({ + result = MAIN_THREAD_EM_ASM_INT({ if(typeof(Module['SDL2']) === 'undefined') { Module['SDL2'] = {}; } @@ -228,22 +233,21 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscaptu return SDL_SetError("Web Audio API is not available!"); } - test_format = SDL_FirstAudioFormat(this->spec.format); - while ((!valid_format) && (test_format)) { + for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { switch (test_format) { case AUDIO_F32: /* web audio only supports floats */ - this->spec.format = test_format; - - valid_format = SDL_TRUE; break; + default: + continue; } - test_format = SDL_NextAudioFormat(); + break; } - if (!valid_format) { + if (!test_format) { /* Didn't find a compatible format :( */ - return SDL_SetError("No compatible audio format!"); + return SDL_SetError("%s: Unsupported audio format", "emscripten"); } + this->spec.format = test_format; /* Initialize all variables that we clean on shutdown */ #if 0 /* !!! FIXME: currently not used. Can we move some stuff off the SDL2 namespace? --ryan. */ @@ -281,7 +285,7 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscaptu feels like it's a pretty inefficient tapdance in similar ways, to be honest. */ - EM_ASM_({ + MAIN_THREAD_EM_ASM({ var SDL2 = Module['SDL2']; var have_microphone = function(stream) { //console.log('SDL audio capture: we have a microphone! Replacing silence callback.'); @@ -324,7 +328,7 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscaptu }, this->spec.channels, this->spec.samples, HandleCaptureProcess, this); } else { /* setup a ScriptProcessorNode */ - EM_ASM_ARGS({ + MAIN_THREAD_EM_ASM({ var SDL2 = Module['SDL2']; SDL2.audio.scriptProcessorNode = SDL2.audioContext['createScriptProcessor']($1, 0, $0); SDL2.audio.scriptProcessorNode['onaudioprocess'] = function (e) { @@ -339,43 +343,47 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscaptu return 0; } -static int +static void +EMSCRIPTENAUDIO_LockOrUnlockDeviceWithNoMixerLock(SDL_AudioDevice * device) +{ +} + +static SDL_bool EMSCRIPTENAUDIO_Init(SDL_AudioDriverImpl * impl) { - int available; - int capture_available; + SDL_bool available, capture_available; /* Set the function pointers */ impl->OpenDevice = EMSCRIPTENAUDIO_OpenDevice; impl->CloseDevice = EMSCRIPTENAUDIO_CloseDevice; - impl->OnlyHasDefaultOutputDevice = 1; + impl->OnlyHasDefaultOutputDevice = SDL_TRUE; /* no threads here */ - impl->SkipMixerLock = 1; - impl->ProvidesOwnCallbackThread = 1; + impl->LockDevice = impl->UnlockDevice = EMSCRIPTENAUDIO_LockOrUnlockDeviceWithNoMixerLock; + impl->ProvidesOwnCallbackThread = SDL_TRUE; /* check availability */ - available = EM_ASM_INT_V({ + available = MAIN_THREAD_EM_ASM_INT({ if (typeof(AudioContext) !== 'undefined') { - return 1; + return true; } else if (typeof(webkitAudioContext) !== 'undefined') { - return 1; + return true; } - return 0; + return false; }); if (!available) { SDL_SetError("No audio context available"); } - capture_available = available && EM_ASM_INT_V({ + capture_available = available && MAIN_THREAD_EM_ASM_INT({ if ((typeof(navigator.mediaDevices) !== 'undefined') && (typeof(navigator.mediaDevices.getUserMedia) !== 'undefined')) { - return 1; + return true; } else if (typeof(navigator.webkitGetUserMedia) !== 'undefined') { - return 1; + return true; } - return 0; + return false; }); impl->HasCaptureSupport = capture_available ? SDL_TRUE : SDL_FALSE; @@ -385,7 +393,7 @@ EMSCRIPTENAUDIO_Init(SDL_AudioDriverImpl * impl) } AudioBootStrap EMSCRIPTENAUDIO_bootstrap = { - "emscripten", "SDL emscripten audio driver", EMSCRIPTENAUDIO_Init, 0 + "emscripten", "SDL emscripten audio driver", EMSCRIPTENAUDIO_Init, SDL_FALSE }; #endif /* SDL_AUDIO_DRIVER_EMSCRIPTEN */ diff --git a/libs/SDL2/src/audio/esd/SDL_esdaudio.c b/libs/SDL2/src/audio/esd/SDL_esdaudio.c index b0b794d7..ccf07916 100644 --- a/libs/SDL2/src/audio/esd/SDL_esdaudio.c +++ b/libs/SDL2/src/audio/esd/SDL_esdaudio.c @@ -208,7 +208,7 @@ get_progname(void) static int -ESD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +ESD_OpenDevice(_THIS, const char *devname) { esd_format_t format = (ESD_STREAM | ESD_PLAY); SDL_AudioFormat test_format = 0; @@ -293,11 +293,11 @@ ESD_Deinitialize(void) UnloadESDLibrary(); } -static int +static SDL_bool ESD_Init(SDL_AudioDriverImpl * impl) { if (LoadESDLibrary() < 0) { - return 0; + return SDL_FALSE; } else { int connection = 0; @@ -308,7 +308,7 @@ ESD_Init(SDL_AudioDriverImpl * impl) if (connection < 0) { UnloadESDLibrary(); SDL_SetError("ESD: esd_open_sound failed (no audio server?)"); - return 0; + return SDL_FALSE; } SDL_NAME(esd_close) (connection); } @@ -320,14 +320,14 @@ ESD_Init(SDL_AudioDriverImpl * impl) impl->GetDeviceBuf = ESD_GetDeviceBuf; impl->CloseDevice = ESD_CloseDevice; impl->Deinitialize = ESD_Deinitialize; - impl->OnlyHasDefaultOutputDevice = 1; + impl->OnlyHasDefaultOutputDevice = SDL_TRUE; - return 1; /* this audio target is available. */ + return SDL_TRUE; /* this audio target is available. */ } AudioBootStrap ESD_bootstrap = { - "esd", "Enlightened Sound Daemon", ESD_Init, 0 + "esd", "Enlightened Sound Daemon", ESD_Init, SDL_FALSE }; #endif /* SDL_AUDIO_DRIVER_ESD */ diff --git a/libs/SDL2/src/audio/fusionsound/SDL_fsaudio.c b/libs/SDL2/src/audio/fusionsound/SDL_fsaudio.c index 5f24cf44..fbe684de 100644 --- a/libs/SDL2/src/audio/fusionsound/SDL_fsaudio.c +++ b/libs/SDL2/src/audio/fusionsound/SDL_fsaudio.c @@ -174,10 +174,10 @@ SDL_FS_CloseDevice(_THIS) static int -SDL_FS_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +SDL_FS_OpenDevice(_THIS, const char *devname) { int bytes; - SDL_AudioFormat test_format = 0, format = 0; + SDL_AudioFormat test_format; FSSampleFormat fs_format; FSStreamDescription desc; DirectResult ret; @@ -191,45 +191,34 @@ SDL_FS_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) SDL_zerop(this->hidden); /* Try for a closest match on audio format */ - for (test_format = SDL_FirstAudioFormat(this->spec.format); - !format && test_format;) { + for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { #ifdef DEBUG_AUDIO fprintf(stderr, "Trying format 0x%4.4x\n", test_format); #endif switch (test_format) { case AUDIO_U8: fs_format = FSSF_U8; - bytes = 1; - format = 1; break; case AUDIO_S16SYS: fs_format = FSSF_S16; - bytes = 2; - format = 1; break; case AUDIO_S32SYS: fs_format = FSSF_S32; - bytes = 4; - format = 1; break; case AUDIO_F32SYS: fs_format = FSSF_FLOAT; - bytes = 4; - format = 1; break; default: - format = 0; - break; - } - if (!format) { - test_format = SDL_NextAudioFormat(); + continue; } + break; } - if (format == 0) { - return SDL_SetError("Couldn't find any hardware audio formats"); + if (!test_format) { + return SDL_SetError("%s: Unsupported audio format", "fusionsound"); } this->spec.format = test_format; + bytes = SDL_AUDIO_BITSIZE(test_format) / 8; /* Retrieve the main sound interface. */ ret = SDL_NAME(FusionSoundCreate) (&this->hidden->fs); @@ -288,11 +277,11 @@ SDL_FS_Deinitialize(void) } -static int +static SDL_bool SDL_FS_Init(SDL_AudioDriverImpl * impl) { if (LoadFusionSoundLibrary() < 0) { - return 0; + return SDL_FALSE; } else { DirectResult ret; @@ -302,7 +291,7 @@ SDL_FS_Init(SDL_AudioDriverImpl * impl) SDL_SetError ("FusionSound: SDL_FS_init failed (FusionSoundInit: %d)", ret); - return 0; + return SDL_FALSE; } } @@ -313,14 +302,14 @@ SDL_FS_Init(SDL_AudioDriverImpl * impl) impl->GetDeviceBuf = SDL_FS_GetDeviceBuf; impl->CloseDevice = SDL_FS_CloseDevice; impl->Deinitialize = SDL_FS_Deinitialize; - impl->OnlyHasDefaultOutputDevice = 1; + impl->OnlyHasDefaultOutputDevice = SDL_TRUE; - return 1; /* this audio target is available. */ + return SDL_TRUE; /* this audio target is available. */ } AudioBootStrap FUSIONSOUND_bootstrap = { - "fusionsound", "FusionSound", SDL_FS_Init, 0 + "fusionsound", "FusionSound", SDL_FS_Init, SDL_FALSE }; #endif /* SDL_AUDIO_DRIVER_FUSIONSOUND */ diff --git a/libs/SDL2/src/audio/haiku/SDL_haikuaudio.cc b/libs/SDL2/src/audio/haiku/SDL_haikuaudio.cc index 82da4782..aec5f4a2 100644 --- a/libs/SDL2/src/audio/haiku/SDL_haikuaudio.cc +++ b/libs/SDL2/src/audio/haiku/SDL_haikuaudio.cc @@ -49,39 +49,40 @@ FillSound(void *device, void *stream, size_t len, 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; - } + } else { + SDL_assert(audio->spec.size == len); - SDL_assert(audio->spec.size == len); + 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; + } + } - 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; + 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 @@ -120,11 +121,10 @@ UnmaskSignals(sigset_t * omask) static int -HAIKUAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +HAIKUAUDIO_OpenDevice(_THIS, const char *devname) { - int valid_datatype = 0; media_raw_audio_format format; - SDL_AudioFormat test_format = SDL_FirstAudioFormat(_this->spec.format); + SDL_AudioFormat test_format; /* Initialize all variables that we clean on shutdown */ _this->hidden = new SDL_PrivateAudioData; @@ -138,9 +138,7 @@ HAIKUAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) format.byte_order = B_MEDIA_LITTLE_ENDIAN; format.frame_rate = (float) _this->spec.freq; format.channel_count = _this->spec.channels; /* !!! FIXME: support > 2? */ - while ((!valid_datatype) && (test_format)) { - valid_datatype = 1; - _this->spec.format = test_format; + for (test_format = SDL_FirstAudioFormat(_this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { switch (test_format) { case AUDIO_S8: format.format = media_raw_audio_format::B_AUDIO_CHAR; @@ -178,15 +176,15 @@ HAIKUAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) break; default: - valid_datatype = 0; - test_format = SDL_NextAudioFormat(); - break; + continue; } + break; } - if (!valid_datatype) { /* shouldn't happen, but just in case... */ - return SDL_SetError("Unsupported audio format"); + if (!test_format) { /* shouldn't happen, but just in case... */ + return SDL_SetError("%s: Unsupported audio format", "haiku"); } + _this->spec.format = test_format; /* Calculate the final parameters for this audio specification */ SDL_CalculateAudioSpec(&_this->spec); @@ -216,22 +214,22 @@ HAIKUAUDIO_Deinitialize(void) SDL_QuitBeApp(); } -static int +static SDL_bool HAIKUAUDIO_Init(SDL_AudioDriverImpl * impl) { /* Initialize the Be Application, if it's not already started */ if (SDL_InitBeApp() < 0) { - return 0; + return SDL_FALSE; } /* Set the function pointers */ impl->OpenDevice = HAIKUAUDIO_OpenDevice; impl->CloseDevice = HAIKUAUDIO_CloseDevice; impl->Deinitialize = HAIKUAUDIO_Deinitialize; - impl->ProvidesOwnCallbackThread = 1; - impl->OnlyHasDefaultOutputDevice = 1; + impl->ProvidesOwnCallbackThread = SDL_TRUE; + impl->OnlyHasDefaultOutputDevice = SDL_TRUE; - return 1; /* this audio target is available. */ + return SDL_TRUE; /* this audio target is available. */ } extern "C" @@ -239,7 +237,7 @@ extern "C" extern AudioBootStrap HAIKUAUDIO_bootstrap; } AudioBootStrap HAIKUAUDIO_bootstrap = { - "haiku", "Haiku BSoundPlayer", HAIKUAUDIO_Init, 0 + "haiku", "Haiku BSoundPlayer", HAIKUAUDIO_Init, SDL_FALSE }; #endif /* SDL_AUDIO_DRIVER_HAIKU */ diff --git a/libs/SDL2/src/audio/jack/SDL_jackaudio.c b/libs/SDL2/src/audio/jack/SDL_jackaudio.c index 1c8aa0ba..f6e7e0cd 100644 --- a/libs/SDL2/src/audio/jack/SDL_jackaudio.c +++ b/libs/SDL2/src/audio/jack/SDL_jackaudio.c @@ -280,12 +280,13 @@ JACK_CloseDevice(_THIS) } static int -JACK_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +JACK_OpenDevice(_THIS, const char *devname) { /* Note that JACK uses "output" for capture devices (they output audio data to us) and "input" for playback (we input audio data to them). Likewise, SDL's playback port will be "output" (we write data out) and capture will be "input" (we read data in). */ + SDL_bool iscapture = this->iscapture; const unsigned long sysportflags = iscapture ? JackPortIsOutput : JackPortIsInput; const unsigned long sdlportflags = iscapture ? JackPortIsInput : JackPortIsOutput; const JackProcessCallback callback = iscapture ? jackProcessCaptureCallback : jackProcessPlaybackCallback; @@ -405,18 +406,18 @@ JACK_Deinitialize(void) UnloadJackLibrary(); } -static int +static SDL_bool JACK_Init(SDL_AudioDriverImpl * impl) { if (LoadJackLibrary() < 0) { - return 0; + return SDL_FALSE; } else { /* Make sure a JACK server is running and available. */ jack_status_t status; jack_client_t *client = JACK_jack_client_open("SDL", JackNoStartServer, &status, NULL); if (client == NULL) { UnloadJackLibrary(); - return 0; + return SDL_FALSE; } JACK_jack_client_close(client); } @@ -433,11 +434,11 @@ JACK_Init(SDL_AudioDriverImpl * impl) impl->OnlyHasDefaultCaptureDevice = SDL_TRUE; impl->HasCaptureSupport = SDL_TRUE; - return 1; /* this audio target is available. */ + return SDL_TRUE; /* this audio target is available. */ } AudioBootStrap JACK_bootstrap = { - "jack", "JACK Audio Connection Kit", JACK_Init, 0 + "jack", "JACK Audio Connection Kit", JACK_Init, SDL_FALSE }; #endif /* SDL_AUDIO_DRIVER_JACK */ diff --git a/libs/SDL2/src/audio/nacl/SDL_naclaudio.c b/libs/SDL2/src/audio/nacl/SDL_naclaudio.c index c651cfc6..c38070d8 100644 --- a/libs/SDL2/src/audio/nacl/SDL_naclaudio.c +++ b/libs/SDL2/src/audio/nacl/SDL_naclaudio.c @@ -49,8 +49,8 @@ static void nacl_audio_callback(void* stream, uint32_t buffer_size, PP_TimeDelta 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 @@ static void nacl_audio_callback(void* stream, uint32_t buffer_size, PP_TimeDelta 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. */ + 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; + } + } - 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; + 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,12 +91,11 @@ static void NACLAUDIO_CloseDevice(SDL_AudioDevice *device) { SDL_PrivateAudioData *hidden = (SDL_PrivateAudioData *) device->hidden; ppb_audio->StopPlayback(hidden->audio); - SDL_DestroyMutex(hidden->mutex); core->ReleaseResource(hidden->audio); } static int -NACLAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { +NACLAUDIO_OpenDevice(_THIS, const char *devname) { PP_Instance instance = PSGetInstanceId(); const PPB_Audio *ppb_audio = PSInterfaceAudio(); const PPB_AudioConfig *ppb_audiocfg = PSInterfaceAudioConfig(); @@ -109,7 +105,6 @@ NACLAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { return SDL_OutOfMemory(); } - private->mutex = SDL_CreateMutex(); _this->spec.freq = 44100; _this->spec.format = AUDIO_S16LSB; _this->spec.channels = 2; @@ -133,18 +128,18 @@ NACLAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { return 0; } -static int +static SDL_bool NACLAUDIO_Init(SDL_AudioDriverImpl * impl) { if (PSGetInstanceId() == 0) { - return 0; + return SDL_FALSE; } /* Set the function pointers */ impl->OpenDevice = NACLAUDIO_OpenDevice; impl->CloseDevice = NACLAUDIO_CloseDevice; - impl->OnlyHasDefaultOutputDevice = 1; - impl->ProvidesOwnCallbackThread = 1; + impl->OnlyHasDefaultOutputDevice = SDL_TRUE; + impl->ProvidesOwnCallbackThread = SDL_TRUE; /* * impl->WaitDevice = NACLAUDIO_WaitDevice; * impl->GetDeviceBuf = NACLAUDIO_GetDeviceBuf; @@ -152,12 +147,12 @@ NACLAUDIO_Init(SDL_AudioDriverImpl * impl) * impl->Deinitialize = NACLAUDIO_Deinitialize; */ - return 1; + return SDL_TRUE; } AudioBootStrap NACLAUDIO_bootstrap = { NACLAUDIO_DRIVER_NAME, "SDL NaCl Audio Driver", - NACLAUDIO_Init, 0 + NACLAUDIO_Init, SDL_FALSE }; #endif /* SDL_AUDIO_DRIVER_NACL */ diff --git a/libs/SDL2/src/audio/nacl/SDL_naclaudio.h b/libs/SDL2/src/audio/nacl/SDL_naclaudio.h index 8348a34e..13d8f8ca 100644 --- a/libs/SDL2/src/audio/nacl/SDL_naclaudio.h +++ b/libs/SDL2/src/audio/nacl/SDL_naclaudio.h @@ -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 --git a/libs/SDL2/src/audio/nas/SDL_nasaudio.c b/libs/SDL2/src/audio/nas/SDL_nasaudio.c index 87cda5e8..d6d86323 100644 --- a/libs/SDL2/src/audio/nas/SDL_nasaudio.c +++ b/libs/SDL2/src/audio/nas/SDL_nasaudio.c @@ -237,26 +237,6 @@ NAS_CloseDevice(_THIS) SDL_free(this->hidden); } -static unsigned char -sdlformat_to_auformat(unsigned int fmt) -{ - switch (fmt) { - case AUDIO_U8: - return AuFormatLinearUnsigned8; - case AUDIO_S8: - return AuFormatLinearSigned8; - case AUDIO_U16LSB: - return AuFormatLinearUnsigned16LSB; - case AUDIO_U16MSB: - return AuFormatLinearUnsigned16MSB; - case AUDIO_S16LSB: - return AuFormatLinearSigned16LSB; - case AUDIO_S16MSB: - return AuFormatLinearSigned16MSB; - } - return AuNone; -} - static AuBool event_handler(AuServer * aud, AuEvent * ev, AuEventHandlerRec * hnd) { @@ -331,11 +311,12 @@ find_device(_THIS) } static int -NAS_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +NAS_OpenDevice(_THIS, const char *devname) { AuElement elms[3]; int buffer_size; - SDL_AudioFormat test_format, format; + SDL_bool iscapture = this->iscapture; + SDL_AudioFormat test_format, format = 0; /* Initialize all variables that we clean on shutdown */ this->hidden = (struct SDL_PrivateAudioData *) @@ -346,16 +327,33 @@ NAS_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) SDL_zerop(this->hidden); /* Try for a closest match on audio format */ - format = 0; - for (test_format = SDL_FirstAudioFormat(this->spec.format); - !format && test_format;) { - format = sdlformat_to_auformat(test_format); - if (format == AuNone) { - test_format = SDL_NextAudioFormat(); + for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { + switch (test_format) { + case AUDIO_U8: + format = AuFormatLinearUnsigned8; + break; + case AUDIO_S8: + format = AuFormatLinearSigned8; + break; + case AUDIO_U16LSB: + format = AuFormatLinearUnsigned16LSB; + break; + case AUDIO_U16MSB: + format = AuFormatLinearUnsigned16MSB; + break; + case AUDIO_S16LSB: + format = AuFormatLinearSigned16LSB; + break; + case AUDIO_S16MSB: + format = AuFormatLinearSigned16MSB; + break; + default: + continue; } + break; } - if (format == 0) { - return SDL_SetError("NAS: Couldn't find any hardware audio formats"); + if (!test_format) { + return SDL_SetError("%s: Unsupported audio format", "nas"); } this->spec.format = test_format; @@ -423,16 +421,16 @@ NAS_Deinitialize(void) UnloadNASLibrary(); } -static int +static SDL_bool NAS_Init(SDL_AudioDriverImpl * impl) { if (LoadNASLibrary() < 0) { - return 0; + return SDL_FALSE; } else { AuServer *aud = NAS_AuOpenServer("", 0, NULL, 0, NULL, NULL); if (aud == NULL) { SDL_SetError("NAS: AuOpenServer() failed (no audio server?)"); - return 0; + return SDL_FALSE; } NAS_AuCloseServer(aud); } @@ -447,15 +445,15 @@ NAS_Init(SDL_AudioDriverImpl * impl) impl->CloseDevice = NAS_CloseDevice; impl->Deinitialize = NAS_Deinitialize; - impl->OnlyHasDefaultOutputDevice = 1; - impl->OnlyHasDefaultCaptureDevice = 1; + impl->OnlyHasDefaultOutputDevice = SDL_TRUE; + impl->OnlyHasDefaultCaptureDevice = SDL_TRUE; impl->HasCaptureSupport = SDL_TRUE; - return 1; /* this audio target is available. */ + return SDL_TRUE; /* this audio target is available. */ } AudioBootStrap NAS_bootstrap = { - "nas", "Network Audio System", NAS_Init, 0 + "nas", "Network Audio System", NAS_Init, SDL_FALSE }; #endif /* SDL_AUDIO_DRIVER_NAS */ diff --git a/libs/SDL2/src/audio/netbsd/SDL_netbsdaudio.c b/libs/SDL2/src/audio/netbsd/SDL_netbsdaudio.c index b061ce7f..5f021ea3 100644 --- a/libs/SDL2/src/audio/netbsd/SDL_netbsdaudio.c +++ b/libs/SDL2/src/audio/netbsd/SDL_netbsdaudio.c @@ -56,7 +56,7 @@ static void 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 @@ NETBSDAUDIO_Status(_THIS) "", this->spec.format, this->spec.size); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ #endif /* DEBUG_AUDIO */ } @@ -202,9 +202,11 @@ NETBSDAUDIO_CloseDevice(_THIS) } static int -NETBSDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +NETBSDAUDIO_OpenDevice(_THIS, const char *devname) { - SDL_AudioFormat format = 0; + SDL_bool iscapture = this->iscapture; + SDL_AudioFormat test_format; + int encoding = AUDIO_ENCODING_NONE; audio_info_t info, hwinfo; struct audio_prinfo *prinfo = iscapture ? &info.record : &info.play; @@ -244,54 +246,46 @@ NETBSDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) } #endif - prinfo->encoding = AUDIO_ENCODING_NONE; prinfo->sample_rate = this->spec.freq; prinfo->channels = this->spec.channels; - for (format = SDL_FirstAudioFormat(this->spec.format); format;) { - switch (format) { + for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { + switch (test_format) { case AUDIO_U8: - prinfo->encoding = AUDIO_ENCODING_ULINEAR; - prinfo->precision = 8; + encoding = AUDIO_ENCODING_ULINEAR; break; case AUDIO_S8: - prinfo->encoding = AUDIO_ENCODING_SLINEAR; - prinfo->precision = 8; + encoding = AUDIO_ENCODING_SLINEAR; break; case AUDIO_S16LSB: - prinfo->encoding = AUDIO_ENCODING_SLINEAR_LE; - prinfo->precision = 16; + encoding = AUDIO_ENCODING_SLINEAR_LE; break; case AUDIO_S16MSB: - prinfo->encoding = AUDIO_ENCODING_SLINEAR_BE; - prinfo->precision = 16; + encoding = AUDIO_ENCODING_SLINEAR_BE; break; case AUDIO_U16LSB: - prinfo->encoding = AUDIO_ENCODING_ULINEAR_LE; - prinfo->precision = 16; + encoding = AUDIO_ENCODING_ULINEAR_LE; break; case AUDIO_U16MSB: - prinfo->encoding = AUDIO_ENCODING_ULINEAR_BE; - prinfo->precision = 16; + encoding = AUDIO_ENCODING_ULINEAR_BE; break; case AUDIO_S32LSB: - prinfo->encoding = AUDIO_ENCODING_SLINEAR_LE; - prinfo->precision = 32; + encoding = AUDIO_ENCODING_SLINEAR_LE; break; case AUDIO_S32MSB: - prinfo->encoding = AUDIO_ENCODING_SLINEAR_BE; - prinfo->precision = 32; + encoding = AUDIO_ENCODING_SLINEAR_BE; break; + default: + continue; } - if (prinfo->encoding != AUDIO_ENCODING_NONE) { - break; - } - format = SDL_NextAudioFormat(); + break; } - if (prinfo->encoding == AUDIO_ENCODING_NONE) { - return SDL_SetError("No supported encoding for 0x%x", this->spec.format); + if (!test_format) { + return SDL_SetError("%s: Unsupported audio format", "netbsd"); } + prinfo->encoding = encoding; + prinfo->precision = SDL_AUDIO_BITSIZE(test_format); info.hiwat = 5; info.lowat = 3; @@ -304,7 +298,7 @@ NETBSDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) } /* Final spec used for the device. */ - this->spec.format = format; + this->spec.format = test_format; this->spec.freq = prinfo->sample_rate; this->spec.channels = prinfo->channels; @@ -326,7 +320,7 @@ NETBSDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) return 0; } -static int +static SDL_bool NETBSDAUDIO_Init(SDL_AudioDriverImpl * impl) { /* Set the function pointers */ @@ -339,14 +333,14 @@ NETBSDAUDIO_Init(SDL_AudioDriverImpl * impl) impl->FlushCapture = NETBSDAUDIO_FlushCapture; impl->HasCaptureSupport = SDL_TRUE; - impl->AllowsArbitraryDeviceNames = 1; + impl->AllowsArbitraryDeviceNames = SDL_TRUE; - return 1; /* this audio target is available. */ + return SDL_TRUE; /* this audio target is available. */ } AudioBootStrap NETBSDAUDIO_bootstrap = { - "netbsd", "NetBSD audio", NETBSDAUDIO_Init, 0 + "netbsd", "NetBSD audio", NETBSDAUDIO_Init, SDL_FALSE }; #endif /* SDL_AUDIO_DRIVER_NETBSD */ diff --git a/libs/SDL2/src/audio/openslES/SDL_openslES.c b/libs/SDL2/src/audio/openslES/SDL_openslES.c index ad020903..39d64b2b 100644 --- a/libs/SDL2/src/audio/openslES/SDL_openslES.c +++ b/libs/SDL2/src/audio/openslES/SDL_openslES.c @@ -407,6 +407,7 @@ openslES_CreatePCMPlayer(_THIS) { struct SDL_PrivateAudioData *audiodata = this->hidden; SLDataFormat_PCM format_pcm; + SLAndroidDataFormat_PCM_EX format_pcm_ex; SLresult result; int i; @@ -414,31 +415,30 @@ openslES_CreatePCMPlayer(_THIS) it can be done as described here: https://developer.android.com/ndk/guides/audio/opensl/android-extensions.html#floating-point */ -#if 1 - /* Just go with signed 16-bit audio as it's the most compatible */ - this->spec.format = AUDIO_S16SYS; -#else - SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format); - while (test_format != 0) { - if (SDL_AUDIO_ISSIGNED(test_format) && SDL_AUDIO_ISINT(test_format)) { - break; + if(SDL_GetAndroidSDKVersion() >= 21) { + SDL_AudioFormat test_format; + for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { + if (SDL_AUDIO_ISSIGNED(test_format)) { + break; + } } - test_format = SDL_NextAudioFormat(); - } - if (test_format == 0) { - /* Didn't find a compatible format : */ - LOGI( "No compatible audio format, using signed 16-bit audio" ); - test_format = AUDIO_S16SYS; + if (!test_format) { + /* Didn't find a compatible format : */ + LOGI( "No compatible audio format, using signed 16-bit audio" ); + test_format = AUDIO_S16SYS; + } + this->spec.format = test_format; + } else { + /* Just go with signed 16-bit audio as it's the most compatible */ + this->spec.format = AUDIO_S16SYS; } - this->spec.format = test_format; -#endif /* Update the fragment size as size in bytes */ SDL_CalculateAudioSpec(&this->spec); - LOGI("Try to open %u hz %u bit chan %u %s samples %u", - this->spec.freq, SDL_AUDIO_BITSIZE(this->spec.format), + LOGI("Try to open %u hz %s %u bit chan %u %s samples %u", + this->spec.freq, SDL_AUDIO_ISFLOAT(this->spec.format) ? "float" : "pcm", SDL_AUDIO_BITSIZE(this->spec.format), this->spec.channels, (this->spec.format & 0x1000) ? "BE" : "LE", this->spec.samples); /* configure audio source */ @@ -489,7 +489,19 @@ openslES_CreatePCMPlayer(_THIS) break; } - SLDataSource audioSrc = { &loc_bufq, &format_pcm }; + if(SDL_AUDIO_ISFLOAT(this->spec.format)) { + /* Copy all setup into PCM EX structure */ + format_pcm_ex.formatType = SL_ANDROID_DATAFORMAT_PCM_EX; + format_pcm_ex.endianness = format_pcm.endianness; + format_pcm_ex.channelMask = format_pcm.channelMask; + format_pcm_ex.numChannels = format_pcm.numChannels; + format_pcm_ex.sampleRate = format_pcm.samplesPerSec; + format_pcm_ex.bitsPerSample = format_pcm.bitsPerSample; + format_pcm_ex.containerSize = format_pcm.containerSize; + 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 }; /* configure audio sink */ SLDataLocator_OutputMix loc_outmix = { SL_DATALOCATOR_OUTPUTMIX, outputMixObject }; @@ -583,14 +595,14 @@ failed: } static int -openslES_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +openslES_OpenDevice(_THIS, const char *devname) { this->hidden = (struct SDL_PrivateAudioData *) SDL_calloc(1, (sizeof *this->hidden)); if (this->hidden == NULL) { return SDL_OutOfMemory(); } - if (iscapture) { + if (this->iscapture) { LOGI("openslES_OpenDevice() %s for capture", devname); return openslES_CreatePCMRecorder(this); } else { @@ -714,13 +726,13 @@ openslES_CloseDevice(_THIS) SDL_free(this->hidden); } -static int +static SDL_bool openslES_Init(SDL_AudioDriverImpl * impl) { LOGI("openslES_Init() called"); if (!openslES_CreateEngine()) { - return 0; + return SDL_FALSE; } LOGI("openslES_Init() - set pointers"); @@ -736,18 +748,18 @@ openslES_Init(SDL_AudioDriverImpl * impl) impl->Deinitialize = openslES_DestroyEngine; /* and the capabilities */ - impl->HasCaptureSupport = 1; - impl->OnlyHasDefaultOutputDevice = 1; - impl->OnlyHasDefaultCaptureDevice = 1; + impl->HasCaptureSupport = SDL_TRUE; + impl->OnlyHasDefaultOutputDevice = SDL_TRUE; + impl->OnlyHasDefaultCaptureDevice = SDL_TRUE; LOGI("openslES_Init() - success"); /* this audio target is available. */ - return 1; + return SDL_TRUE; } AudioBootStrap openslES_bootstrap = { - "openslES", "opensl ES audio driver", openslES_Init, 0 + "openslES", "opensl ES audio driver", openslES_Init, SDL_FALSE }; void openslES_ResumeDevices(void) diff --git a/libs/SDL2/src/audio/os2/SDL_os2audio.c b/libs/SDL2/src/audio/os2/SDL_os2audio.c index 5fa1ad4e..9ddfb760 100644 --- a/libs/SDL2/src/audio/os2/SDL_os2audio.c +++ b/libs/SDL2/src/audio/os2/SDL_os2audio.c @@ -248,29 +248,28 @@ static void OS2_CloseDevice(_THIS) SDL_free(pAData); } -static int OS2_OpenDevice(_THIS, void *handle, const char *devname, - int iscapture) +static int OS2_OpenDevice(_THIS, const char *devname) { SDL_PrivateAudioData *pAData; - SDL_AudioFormat SDLAudioFmt; + SDL_AudioFormat test_format; MCI_AMP_OPEN_PARMS stMCIAmpOpen; MCI_BUFFER_PARMS stMCIBuffer; ULONG ulRC; ULONG ulIdx; BOOL new_freq; + SDL_bool iscapture = _this->iscapture; new_freq = FALSE; SDL_zero(stMCIAmpOpen); SDL_zero(stMCIBuffer); - for (SDLAudioFmt = SDL_FirstAudioFormat(_this->spec.format); - SDLAudioFmt != 0; SDLAudioFmt = SDL_NextAudioFormat()) { - if (SDLAudioFmt == AUDIO_U8 || SDLAudioFmt == AUDIO_S16) + for (test_format = SDL_FirstAudioFormat(_this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { + if (test_format == AUDIO_U8 || test_format == AUDIO_S16) break; } - if (SDLAudioFmt == 0) { + if (!test_format) { debug_os2("Unsupported audio format, AUDIO_S16 used"); - SDLAudioFmt = AUDIO_S16; + test_format = AUDIO_S16; } pAData = (SDL_PrivateAudioData *) SDL_calloc(1, sizeof(struct SDL_PrivateAudioData)); @@ -285,7 +284,7 @@ static int OS2_OpenDevice(_THIS, void *handle, const char *devname, } /* Open audio device */ - stMCIAmpOpen.usDeviceID = (handle != NULL) ? ((ULONG)handle - 1) : 0; + stMCIAmpOpen.usDeviceID = (_this->handle != NULL) ? ((ULONG)_this->handle - 1) : 0; stMCIAmpOpen.pszDeviceType = (PSZ)MCI_DEVTYPE_AUDIO_AMPMIX; ulRC = mciSendCommand(0, MCI_OPEN, (_getEnvULong("SDL_AUDIO_SHARE", 1, 0) != 0)? @@ -298,7 +297,7 @@ static int OS2_OpenDevice(_THIS, void *handle, const char *devname, } pAData->usDeviceId = stMCIAmpOpen.usDeviceID; - if (iscapture != 0) { + if (iscapture) { MCI_CONNECTOR_PARMS stMCIConnector; MCI_AMP_SET_PARMS stMCIAmpSet; BOOL fLineIn = _getEnvULong("SDL_AUDIO_LINEIN", 1, 0); @@ -330,7 +329,7 @@ static int OS2_OpenDevice(_THIS, void *handle, const char *devname, &stMCIAmpSet, 0); } - _this->spec.format = SDLAudioFmt; + _this->spec.format = test_format; _this->spec.channels = _this->spec.channels > 1 ? 2 : 1; if (_this->spec.freq < 8000) { _this->spec.freq = 8000; @@ -342,11 +341,11 @@ static int OS2_OpenDevice(_THIS, void *handle, const char *devname, /* Setup mixer. */ pAData->stMCIMixSetup.ulFormatTag = MCI_WAVE_FORMAT_PCM; - pAData->stMCIMixSetup.ulBitsPerSample = SDL_AUDIO_BITSIZE(SDLAudioFmt); + pAData->stMCIMixSetup.ulBitsPerSample = SDL_AUDIO_BITSIZE(test_format); pAData->stMCIMixSetup.ulSamplesPerSec = _this->spec.freq; pAData->stMCIMixSetup.ulChannels = _this->spec.channels; pAData->stMCIMixSetup.ulDeviceType = MCI_DEVTYPE_WAVEFORM_AUDIO; - if (iscapture == 0) { + if (!iscapture) { pAData->stMCIMixSetup.ulFormatMode= MCI_PLAY; pAData->stMCIMixSetup.pmixEvent = cbAudioWriteEvent; } else { @@ -423,7 +422,7 @@ static int OS2_OpenDevice(_THIS, void *handle, const char *devname, } -static int OS2_Init(SDL_AudioDriverImpl * impl) +static SDL_bool OS2_Init(SDL_AudioDriverImpl * impl) { /* Set the function pointers */ impl->DetectDevices = OS2_DetectDevices; @@ -438,12 +437,12 @@ static int OS2_Init(SDL_AudioDriverImpl * impl) impl->FlushCapture = ; impl->HasCaptureSupport = SDL_TRUE; */ - return 1; /* this audio target is available. */ + return SDL_TRUE; /* this audio target is available. */ } AudioBootStrap OS2AUDIO_bootstrap = { - "DART", "OS/2 DART", OS2_Init, 0 + "DART", "OS/2 DART", OS2_Init, SDL_FALSE }; #endif /* SDL_AUDIO_DRIVER_OS2 */ diff --git a/libs/SDL2/src/audio/paudio/SDL_paudio.c b/libs/SDL2/src/audio/paudio/SDL_paudio.c index c4f40b35..ae2fc295 100644 --- a/libs/SDL2/src/audio/paudio/SDL_paudio.c +++ b/libs/SDL2/src/audio/paudio/SDL_paudio.c @@ -223,12 +223,12 @@ PAUDIO_CloseDevice(_THIS) } static int -PAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +PAUDIO_OpenDevice(_THIS, const char *devname) { const char *workaround = SDL_getenv("SDL_DSP_NOSELECT"); char audiodev[1024]; const char *err = NULL; - int format; + int flags; int bytes_per_sample; SDL_AudioFormat test_format; audio_init paud_init; @@ -316,63 +316,44 @@ PAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) paud_init.channels = this->spec.channels; /* Try for a closest match on audio format */ - format = 0; - for (test_format = SDL_FirstAudioFormat(this->spec.format); - !format && test_format;) { + for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { #ifdef DEBUG_AUDIO fprintf(stderr, "Trying format 0x%4.4x\n", test_format); #endif switch (test_format) { case AUDIO_U8: - bytes_per_sample = 1; - paud_init.bits_per_sample = 8; - paud_init.flags = TWOS_COMPLEMENT | FIXED; - format = 1; + flags = TWOS_COMPLEMENT | FIXED; break; case AUDIO_S8: - bytes_per_sample = 1; - paud_init.bits_per_sample = 8; - paud_init.flags = SIGNED | TWOS_COMPLEMENT | FIXED; - format = 1; + flags = SIGNED | TWOS_COMPLEMENT | FIXED; break; case AUDIO_S16LSB: - bytes_per_sample = 2; - paud_init.bits_per_sample = 16; - paud_init.flags = SIGNED | TWOS_COMPLEMENT | FIXED; - format = 1; + flags = SIGNED | TWOS_COMPLEMENT | FIXED; break; case AUDIO_S16MSB: - bytes_per_sample = 2; - paud_init.bits_per_sample = 16; - paud_init.flags = BIG_ENDIAN | SIGNED | TWOS_COMPLEMENT | FIXED; - format = 1; + flags = BIG_ENDIAN | SIGNED | TWOS_COMPLEMENT | FIXED; break; case AUDIO_U16LSB: - bytes_per_sample = 2; - paud_init.bits_per_sample = 16; - paud_init.flags = TWOS_COMPLEMENT | FIXED; - format = 1; + flags = TWOS_COMPLEMENT | FIXED; break; case AUDIO_U16MSB: - bytes_per_sample = 2; - paud_init.bits_per_sample = 16; - paud_init.flags = BIG_ENDIAN | TWOS_COMPLEMENT | FIXED; - format = 1; + flags = BIG_ENDIAN | TWOS_COMPLEMENT | FIXED; break; default: - break; - } - if (!format) { - test_format = SDL_NextAudioFormat(); + continue; } + break; } - if (format == 0) { + if (!test_format) { #ifdef DEBUG_AUDIO fprintf(stderr, "Couldn't find any hardware audio formats\n"); #endif - return SDL_SetError("Couldn't find any hardware audio formats"); + return SDL_SetError("%s: Unsupported audio format", "paud"); } this->spec.format = test_format; + paud_init.bits_per_sample = SDL_AUDIO_BITSIZE(test_format); + bytes_per_sample = SDL_AUDIO_BITSIZE(test_format) / 8; + paud_init.flags = flags; /* * We know the buffer size and the max number of subsequent writes @@ -406,28 +387,25 @@ PAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) if (ioctl(fd, AUDIO_INIT, &paud_init) < 0) { switch (paud_init.rc) { case 1: - err = "Couldn't set audio format: DSP can't do play requests"; + err = "DSP can't do play requests"; break; case 2: - err = "Couldn't set audio format: DSP can't do record requests"; + err = "DSP can't do record requests"; break; case 4: - err = "Couldn't set audio format: request was invalid"; + err = "request was invalid"; break; case 5: - err = "Couldn't set audio format: conflict with open's flags"; + err = "conflict with open's flags"; break; case 6: - err = "Couldn't set audio format: out of DSP MIPS or memory"; + err = "out of DSP MIPS or memory"; break; default: - err = "Couldn't set audio format: not documented in sys/audio.h"; + err = "not documented in sys/audio.h"; break; } - } - - if (err != NULL) { - return SDL_SetError("Paudio: %s", err); + return SDL_SetError("paud: Couldn't set audio format (%s)", err); } /* Allocate mixing buffer */ @@ -485,14 +463,14 @@ PAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) return 0; } -static int +static SDL_bool PAUDIO_Init(SDL_AudioDriverImpl * impl) { /* !!! FIXME: not right for device enum? */ int fd = OpenAudioPath(NULL, 0, OPEN_FLAGS, 0); if (fd < 0) { SDL_SetError("PAUDIO: Couldn't open audio device"); - return 0; + return SDL_FALSE; } close(fd); @@ -502,13 +480,13 @@ PAUDIO_Init(SDL_AudioDriverImpl * impl) impl->PlayDevice = PAUDIO_WaitDevice; impl->GetDeviceBuf = PAUDIO_GetDeviceBuf; impl->CloseDevice = PAUDIO_CloseDevice; - impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: add device enum! */ + impl->OnlyHasDefaultOutputDevice = SDL_TRUE; /* !!! FIXME: add device enum! */ - return 1; /* this audio target is available. */ + return SDL_TRUE; /* this audio target is available. */ } AudioBootStrap PAUDIO_bootstrap = { - "paud", "AIX Paudio", PAUDIO_Init, 0 + "paud", "AIX Paudio", PAUDIO_Init, SDL_FALSE }; #endif /* SDL_AUDIO_DRIVER_PAUDIO */ diff --git a/libs/SDL2/src/audio/pipewire/SDL_pipewire.c b/libs/SDL2/src/audio/pipewire/SDL_pipewire.c index 32d7d5a5..387028ed 100644 --- a/libs/SDL2/src/audio/pipewire/SDL_pipewire.c +++ b/libs/SDL2/src/audio/pipewire/SDL_pipewire.c @@ -31,8 +31,22 @@ #include #include -/* Older versions of Pipewire may not define this, but it's safe to pass at - * runtime even if older installations don't recognize it. +/* + * 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. + */ + +/* + * Introduced in 0.3.22 + * Taken from /src/pipewire/keys.h + */ +#ifndef PW_KEY_CONFIG_NAME +#define PW_KEY_CONFIG_NAME "config.name" +#endif + +/* + * Introduced in 0.3.33 * Taken from src/pipewire/keys.h */ #ifndef PW_KEY_NODE_RATE @@ -40,19 +54,22 @@ #endif /* - * These seem to be sane limits as Pipewire - * uses them in several of it's own modules. - * - * NOTE: 8192 is a hard upper limit in Pipewire and - * increasing this value can lead to buffer overflows. + * This seems to be a sane lower limit as Pipewire + * uses it in several of it's own modules. */ -#define PW_MIN_SAMPLES 32 /* About 0.67ms at 48kHz */ -#define PW_MAX_SAMPLES 8192 /* About 170.6ms at 48kHz */ +#define PW_MIN_SAMPLES 32 /* About 0.67ms at 48kHz */ #define PW_BASE_CLOCK_RATE 48000 #define PW_POD_BUFFER_LENGTH 1024 #define PW_THREAD_NAME_BUFFER_LENGTH 128 +enum PW_READY_FLAGS +{ + PW_READY_FLAG_BUFFER_ADDED = 0x1, + PW_READY_FLAG_STREAM_READY = 0x2, + PW_READY_FLAG_ALL_BITS = 0x3 +}; + #define PW_ID_TO_HANDLE(x) (void *)((uintptr_t)x) #define PW_HANDLE_TO_ID(x) (uint32_t)((uintptr_t)x) @@ -86,14 +103,13 @@ static enum pw_stream_state (*PIPEWIRE_pw_stream_get_state)(struct pw_stream *st static struct pw_buffer *(*PIPEWIRE_pw_stream_dequeue_buffer)(struct pw_stream *); static int (*PIPEWIRE_pw_stream_queue_buffer)(struct pw_stream *, struct pw_buffer *); static struct pw_properties *(*PIPEWIRE_pw_properties_new)(const char *, ...)SPA_SENTINEL; -static void (*PIPEWIRE_pw_properties_free)(struct pw_properties *); 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); #ifdef SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC static const char *pipewire_library = SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC; -static void * pipewire_handle = NULL; +static void *pipewire_handle = NULL; static int pipewire_dlsym(const char *fn, void **addr) @@ -176,7 +192,6 @@ load_pipewire_syms() SDL_PIPEWIRE_SYM(pw_stream_dequeue_buffer); SDL_PIPEWIRE_SYM(pw_stream_queue_buffer); SDL_PIPEWIRE_SYM(pw_properties_new); - SDL_PIPEWIRE_SYM(pw_properties_free); SDL_PIPEWIRE_SYM(pw_properties_set); SDL_PIPEWIRE_SYM(pw_properties_setf); @@ -239,16 +254,16 @@ struct io_node /* The global hotplug thread and associated objects. */ static struct pw_thread_loop *hotplug_loop; -static struct pw_core * hotplug_core; -static struct pw_context * hotplug_context; -static struct pw_registry * hotplug_registry; +static struct pw_core *hotplug_core; +static struct pw_context *hotplug_context; +static struct pw_registry *hotplug_registry; static struct spa_hook hotplug_registry_listener; static struct spa_hook hotplug_core_listener; static struct spa_list hotplug_pending_list; static struct spa_list hotplug_io_list; static int hotplug_init_seq_val; -static SDL_atomic_t hotplug_init_complete; -static SDL_atomic_t hotplug_events_enabled; +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; @@ -260,8 +275,6 @@ io_list_check_add(struct io_node *node) struct io_node *n; SDL_bool ret = SDL_TRUE; - PIPEWIRE_pw_thread_loop_lock(hotplug_loop); - /* See if the node is already in the list */ spa_list_for_each (n, &hotplug_io_list, link) { if (n->id == node->id) { @@ -273,14 +286,12 @@ io_list_check_add(struct io_node *node) /* Add to the list if the node doesn't already exist */ spa_list_append(&hotplug_io_list, &node->link); - if (SDL_AtomicGet(&hotplug_events_enabled)) { + if (hotplug_events_enabled) { SDL_AddAudioDevice(node->is_capture, node->name, &node->spec, PW_ID_TO_HANDLE(node->id)); } dup_found: - PIPEWIRE_pw_thread_loop_unlock(hotplug_loop); - return ret; } @@ -289,14 +300,12 @@ io_list_remove(Uint32 id) { struct io_node *n, *temp; - PIPEWIRE_pw_thread_loop_lock(hotplug_loop); - /* Find and remove the node from the list */ spa_list_for_each_safe (n, temp, &hotplug_io_list, link) { if (n->id == id) { spa_list_remove(&n->link); - if (SDL_AtomicGet(&hotplug_events_enabled)) { + if (hotplug_events_enabled) { SDL_RemoveAudioDevice(n->is_capture, PW_ID_TO_HANDLE(id)); } @@ -305,8 +314,6 @@ io_list_remove(Uint32 id) break; } } - - PIPEWIRE_pw_thread_loop_unlock(hotplug_loop); } static void @@ -315,8 +322,6 @@ io_list_sort() struct io_node *default_sink = NULL, *default_source = NULL; struct io_node *n, *temp; - PIPEWIRE_pw_thread_loop_lock(hotplug_loop); - /* 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) { @@ -335,8 +340,6 @@ io_list_sort() if (default_sink) { spa_list_prepend(&hotplug_io_list, &default_sink->link); } - - PIPEWIRE_pw_thread_loop_unlock(hotplug_loop); } static void @@ -395,7 +398,7 @@ pending_list_clear() static void * node_object_new(Uint32 id, const char *type, Uint32 version, const void *funcs, const struct pw_core_events *core_events) { - struct pw_proxy * proxy; + struct pw_proxy *proxy; struct node_object *node; /* Create the proxy object */ @@ -430,7 +433,7 @@ core_events_hotplug_init_callback(void *object, uint32_t id, int seq) spa_hook_remove(&hotplug_core_listener); /* Signal that the initial I/O list is populated */ - SDL_AtomicSet(&hotplug_init_complete, 1); + hotplug_init_complete = SDL_TRUE; PIPEWIRE_pw_thread_loop_signal(hotplug_loop, false); } } @@ -439,7 +442,7 @@ static void core_events_interface_callback(void *object, uint32_t id, int seq) { struct node_object *node = object; - struct io_node * io = node->userdata; + struct io_node *io = node->userdata; if (id == PW_ID_CORE && seq == node->seq) { /* @@ -479,7 +482,7 @@ hotplug_core_sync(struct node_object *node) node->seq = pw_core_sync(hotplug_core, PW_ID_CORE, node->seq); } - if (!SDL_AtomicGet(&hotplug_init_complete)) { + if (!hotplug_init_complete) { hotplug_init_seq_val = pw_core_sync(hotplug_core, PW_ID_CORE, hotplug_init_seq_val); } } @@ -489,7 +492,7 @@ static SDL_bool get_range_param(const struct spa_pod *param, Uint32 key, int *def, int *min, int *max) { const struct spa_pod_prop *prop; - struct spa_pod * value; + struct spa_pod *value; Uint32 n_values, choice; prop = spa_pod_find_prop(param, NULL, key); @@ -543,8 +546,8 @@ static void node_event_info(void *object, const struct pw_node_info *info) { struct node_object *node = object; - struct io_node * io = node->userdata; - const char * prop_val; + struct io_node *io = node->userdata; + const char *prop_val; Uint32 i; if (info) { @@ -566,7 +569,7 @@ static void node_event_param(void *object, int seq, uint32_t id, uint32_t index, uint32_t next, const struct spa_pod *param) { struct node_object *node = object; - struct io_node * io = node->userdata; + struct io_node *io = node->userdata; /* Get the default frequency */ if (io->spec.freq == 0) { @@ -619,7 +622,7 @@ registry_event_global_callback(void *object, uint32_t id, uint32_t permissions, const char *media_class = spa_dict_lookup(props, PW_KEY_MEDIA_CLASS); if (media_class) { - const char * node_desc; + const char *node_desc; struct io_node *io; SDL_bool is_capture; int str_buffer_len; @@ -738,23 +741,30 @@ hotplug_loop_destroy() pending_list_clear(); io_list_clear(); - SDL_AtomicSet(&hotplug_init_complete, 0); - SDL_AtomicSet(&hotplug_events_enabled, 0); + 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 (hotplug_registry) { PIPEWIRE_pw_proxy_destroy((struct pw_proxy *)hotplug_registry); + hotplug_registry = NULL; } if (hotplug_core) { PIPEWIRE_pw_core_disconnect(hotplug_core); + hotplug_core = NULL; } if (hotplug_context) { PIPEWIRE_pw_context_destroy(hotplug_context); + hotplug_context = NULL; } if (hotplug_loop) { PIPEWIRE_pw_thread_loop_destroy(hotplug_loop); + hotplug_loop = NULL; } } @@ -766,7 +776,7 @@ PIPEWIRE_DetectDevices() PIPEWIRE_pw_thread_loop_lock(hotplug_loop); /* Wait until the initial registry enumeration is complete */ - if (!SDL_AtomicGet(&hotplug_init_complete)) { + if (!hotplug_init_complete) { PIPEWIRE_pw_thread_loop_wait(hotplug_loop); } @@ -777,7 +787,7 @@ PIPEWIRE_DetectDevices() SDL_AddAudioDevice(io->is_capture, io->name, &io->spec, PW_ID_TO_HANDLE(io->id)); } - SDL_AtomicSet(&hotplug_events_enabled, 1); + hotplug_events_enabled = SDL_TRUE; PIPEWIRE_pw_thread_loop_unlock(hotplug_loop); } @@ -790,14 +800,14 @@ static const enum spa_audio_channel PIPEWIRE_channel_map_4[] = { SPA_AUDIO_CHANN SPA_AUDIO_CHANNEL_RR }; static const enum spa_audio_channel PIPEWIRE_channel_map_5[] = { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_RL, SPA_AUDIO_CHANNEL_RR }; -static const enum spa_audio_channel PIPEWIRE_channel_map_6[] = { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, SPA_AUDIO_CHANNEL_FC, +static const enum spa_audio_channel PIPEWIRE_channel_map_6[] = { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_LFE, SPA_AUDIO_CHANNEL_RL, SPA_AUDIO_CHANNEL_RR }; -static const enum spa_audio_channel PIPEWIRE_channel_map_7[] = { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, SPA_AUDIO_CHANNEL_FC, +static const enum spa_audio_channel PIPEWIRE_channel_map_7[] = { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_LFE, SPA_AUDIO_CHANNEL_RC, SPA_AUDIO_CHANNEL_RL, SPA_AUDIO_CHANNEL_RR }; -static const enum spa_audio_channel PIPEWIRE_channel_map_8[] = { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, SPA_AUDIO_CHANNEL_FC, +static const enum spa_audio_channel PIPEWIRE_channel_map_8[] = { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_LFE, SPA_AUDIO_CHANNEL_RL, SPA_AUDIO_CHANNEL_RR, - SPA_AUDIO_CHANNEL_SL, SPA_AUDIO_CHANNEL_SR }; + SPA_AUDIO_CHANNEL_SL, SPA_AUDIO_CHANNEL_SR }; #define COPY_CHANNEL_MAP(c) SDL_memcpy(info->position, PIPEWIRE_channel_map_##c, sizeof(PIPEWIRE_channel_map_##c)) @@ -872,9 +882,9 @@ initialize_spa_info(const SDL_AudioSpec *spec, struct spa_audio_info_raw *info) static void output_callback(void *data) { - struct pw_buffer * pw_buf; + struct pw_buffer *pw_buf; struct spa_buffer *spa_buf; - Uint8 * dst; + Uint8 *dst; _THIS = (SDL_AudioDevice *)data; struct pw_stream *stream = this->hidden->stream; @@ -900,6 +910,7 @@ output_callback(void *data) * 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; @@ -909,18 +920,13 @@ output_callback(void *data) } 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); } @@ -930,6 +936,7 @@ output_callback(void *data) } 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; @@ -941,9 +948,9 @@ output_callback(void *data) static void input_callback(void *data) { - struct pw_buffer * pw_buf; + struct pw_buffer *pw_buf; struct spa_buffer *spa_buf; - Uint8 * src; + Uint8 *src; _THIS = (SDL_AudioDevice *)data; struct pw_stream *stream = this->hidden->stream; @@ -985,35 +992,71 @@ input_callback(void *data) this->callbackspec.callback(this->callbackspec.userdata, this->work_buffer, this->callbackspec.size); SDL_UnlockMutex(this->mixer_lock); } - } else { /* Flush the buffer when paused */ + } else if (this->hidden->buffer) { /* Flush the buffer when paused */ if (SDL_CountDataQueue(this->hidden->buffer) != 0) { - SDL_ClearDataQueue(this->hidden->buffer, this->hidden->buffer_period_size * 2); + SDL_ClearDataQueue(this->hidden->buffer, this->hidden->input_buffer_packet_size); } } PIPEWIRE_pw_stream_queue_buffer(stream, pw_buf); } +static void +stream_add_buffer_callback(void *data, struct pw_buffer *buffer) +{ + _THIS = data; + + if (this->iscapture == SDL_FALSE) { + /* + * Clamp the output spec samples and size to the max size of the Pipewire buffer. + * If they exceed the maximum size of the Pipewire buffer, double buffering will be used. + */ + if (this->spec.size > buffer->buffer->datas[0].maxsize) { + this->spec.samples = buffer->buffer->datas[0].maxsize / this->hidden->stride; + this->spec.size = buffer->buffer->datas[0].maxsize; + } + } else if (this->hidden->buffer == NULL) { + /* + * The latency of source nodes can change, so buffering is always required. + * + * Ensure that the intermediate input buffer is large enough to hold the requested + * application packet size or a full buffer of data from Pipewire, whichever is larger. + * + * A packet size of 2 periods should be more than is ever needed. + */ + this->hidden->input_buffer_packet_size = SPA_MAX(this->spec.size, buffer->buffer->datas[0].maxsize) * 2; + this->hidden->buffer = SDL_NewDataQueue(this->hidden->input_buffer_packet_size, this->hidden->input_buffer_packet_size); + } + + this->hidden->stream_init_status |= PW_READY_FLAG_BUFFER_ADDED; + PIPEWIRE_pw_thread_loop_signal(this->hidden->loop, false); +} + static void stream_state_changed_callback(void *data, enum pw_stream_state old, enum pw_stream_state state, const char *error) { _THIS = data; + if (state == PW_STREAM_STATE_STREAMING) { + this->hidden->stream_init_status |= PW_READY_FLAG_STREAM_READY; + } + if (state == PW_STREAM_STATE_STREAMING || state == PW_STREAM_STATE_ERROR) { - SDL_AtomicSet(&this->hidden->stream_initialized, 1); PIPEWIRE_pw_thread_loop_signal(this->hidden->loop, false); } } static const struct pw_stream_events stream_output_events = { PW_VERSION_STREAM_EVENTS, .state_changed = stream_state_changed_callback, + .add_buffer = stream_add_buffer_callback, .process = output_callback }; static const struct pw_stream_events stream_input_events = { PW_VERSION_STREAM_EVENTS, - .state_changed = stream_state_changed_callback, - .process = input_callback }; + .state_changed = stream_state_changed_callback, + .add_buffer = stream_add_buffer_callback, + .process = input_callback }; static int -PIPEWIRE_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +PIPEWIRE_OpenDevice(_THIS, const char *devname) { /* * NOTE: The PW_STREAM_FLAG_RT_PROCESS flag can be set to call the stream @@ -1028,23 +1071,22 @@ PIPEWIRE_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) Uint8 pod_buffer[PW_POD_BUFFER_LENGTH]; struct spa_pod_builder b = SPA_POD_BUILDER_INIT(pod_buffer, sizeof(pod_buffer)); struct spa_audio_info_raw spa_info = { 0 }; - const struct spa_pod * params = NULL; + const struct spa_pod *params = NULL; 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); - enum pw_stream_state state; + 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); + SDL_bool iscapture = this->iscapture; int res; /* Clamp the period size to sane values */ - const int min_period = PW_MIN_SAMPLES * SPA_MAX(this->spec.freq / PW_BASE_CLOCK_RATE, 1); - const int adjusted_samples = SPA_CLAMP(this->spec.samples, min_period, PW_MAX_SAMPLES); + const int min_period = PW_MIN_SAMPLES * SPA_MAX(this->spec.freq / PW_BASE_CLOCK_RATE, 1); /* Get the hints for the application name, stream name and role */ app_name = SDL_GetHint(SDL_HINT_AUDIO_DEVICE_APP_NAME); if (!app_name || *app_name == '\0') { app_name = SDL_GetHint(SDL_HINT_APP_NAME); - if (!app_name || *app_name == '\0') { + if (!app_name || *app_name == '\0') { app_name = "SDL Application"; } } @@ -1077,38 +1119,34 @@ PIPEWIRE_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) /* Size of a single audio frame in bytes */ priv->stride = (SDL_AUDIO_BITSIZE(this->spec.format) >> 3) * this->spec.channels; - if (this->spec.samples != adjusted_samples && !iscapture) { - this->spec.samples = adjusted_samples; + if (this->spec.samples < min_period) { + this->spec.samples = min_period; this->spec.size = this->spec.samples * priv->stride; } - /* The latency of source nodes can change, so buffering is required. */ - if (iscapture) { - priv->buffer_period_size = SPA_MAX(this->spec.samples, adjusted_samples) * priv->stride; - - /* A packet size of 4 periods should be more than is ever needed (no more than 2 should be queued in practice). */ - priv->buffer = SDL_NewDataQueue(priv->buffer_period_size * 4, priv->buffer_period_size * 2); - if (priv->buffer == NULL) { - return SDL_SetError("Pipewire: Failed to allocate source buffer"); - } - } - - SDL_snprintf(thread_name, sizeof(thread_name), "SDLAudio%c%ld", (iscapture) ? 'C' : 'P', (long)handle); + SDL_snprintf(thread_name, sizeof(thread_name), "SDLAudio%c%ld", (iscapture) ? 'C' : 'P', (long)this->handle); priv->loop = PIPEWIRE_pw_thread_loop_new(thread_name, NULL); if (priv->loop == NULL) { return SDL_SetError("Pipewire: Failed to create stream loop (%i)", errno); } - /* Load the rtkit module so Pipewire can set the loop thread to the appropriate priority */ - props = PIPEWIRE_pw_properties_new(PW_KEY_CONTEXT_PROFILE_MODULES, "default,rtkit", NULL); + /* + * 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); if (props == NULL) { return SDL_SetError("Pipewire: Failed to create stream context properties (%i)", errno); } - /* On success, the context owns the properties object and will free it at destruction time. */ priv->context = PIPEWIRE_pw_context_new(PIPEWIRE_pw_thread_loop_get_loop(priv->loop), props, 0); if (priv->context == NULL) { - PIPEWIRE_pw_properties_free(props); return SDL_SetError("Pipewire: Failed to create stream context (%i)", errno); } @@ -1123,18 +1161,14 @@ PIPEWIRE_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) PIPEWIRE_pw_properties_set(props, PW_KEY_APP_NAME, app_name); PIPEWIRE_pw_properties_set(props, PW_KEY_NODE_NAME, stream_name); PIPEWIRE_pw_properties_set(props, PW_KEY_NODE_DESCRIPTION, stream_name); - PIPEWIRE_pw_properties_setf(props, PW_KEY_NODE_LATENCY, "%u/%i", adjusted_samples, this->spec.freq); + PIPEWIRE_pw_properties_setf(props, PW_KEY_NODE_LATENCY, "%u/%i", this->spec.samples, this->spec.freq); 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"); - /* - * Create the new stream - * On success, the stream owns the properties object and will free it at destruction time. - */ + /* 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); if (priv->stream == NULL) { - PIPEWIRE_pw_properties_free(props); return SDL_SetError("Pipewire: Failed to create stream (%i)", errno); } @@ -1149,19 +1183,23 @@ PIPEWIRE_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) return SDL_SetError("Pipewire: Failed to start stream loop"); } - /* Wait until the stream is either running or failed */ + /* Wait until all init flags are set or the stream has failed. */ PIPEWIRE_pw_thread_loop_lock(priv->loop); - if (!SDL_AtomicGet(&priv->stream_initialized)) { + while (priv->stream_init_status != PW_READY_FLAG_ALL_BITS && + PIPEWIRE_pw_stream_get_state(priv->stream, NULL) != PW_STREAM_STATE_ERROR) { PIPEWIRE_pw_thread_loop_wait(priv->loop); } PIPEWIRE_pw_thread_loop_unlock(priv->loop); - state = PIPEWIRE_pw_stream_get_state(priv->stream, &error); - - if (state == PW_STREAM_STATE_ERROR) { + if (PIPEWIRE_pw_stream_get_state(priv->stream, &error) == PW_STREAM_STATE_ERROR) { return SDL_SetError("Pipewire: Stream error: %s", error); } + /* If this is a capture stream, make sure the intermediate buffer was successfully allocated. */ + if (iscapture && priv->buffer == NULL) { + return SDL_SetError("Pipewire: Failed to allocate source buffer"); + } + return 0; } @@ -1200,19 +1238,19 @@ PIPEWIRE_Deinitialize() } } -static int +static SDL_bool PIPEWIRE_Init(SDL_AudioDriverImpl *impl) { if (!pipewire_initialized) { if (init_pipewire_library() < 0) { - return 0; + return SDL_FALSE; } pipewire_initialized = SDL_TRUE; if (hotplug_loop_init() < 0) { PIPEWIRE_Deinitialize(); - return 0; + return SDL_FALSE; } } @@ -1222,13 +1260,13 @@ PIPEWIRE_Init(SDL_AudioDriverImpl *impl) impl->CloseDevice = PIPEWIRE_CloseDevice; impl->Deinitialize = PIPEWIRE_Deinitialize; - impl->HasCaptureSupport = 1; - impl->ProvidesOwnCallbackThread = 1; + impl->HasCaptureSupport = SDL_TRUE; + impl->ProvidesOwnCallbackThread = SDL_TRUE; - return 1; + return SDL_TRUE; } -AudioBootStrap PIPEWIRE_bootstrap = { "pipewire", "Pipewire", PIPEWIRE_Init, 0 }; +AudioBootStrap PIPEWIRE_bootstrap = { "pipewire", "Pipewire", PIPEWIRE_Init, SDL_FALSE }; #endif /* SDL_AUDIO_DRIVER_PIPEWIRE */ diff --git a/libs/SDL2/src/audio/pipewire/SDL_pipewire.h b/libs/SDL2/src/audio/pipewire/SDL_pipewire.h index 731a2027..767b8f10 100644 --- a/libs/SDL2/src/audio/pipewire/SDL_pipewire.h +++ b/libs/SDL2/src/audio/pipewire/SDL_pipewire.h @@ -37,9 +37,9 @@ struct SDL_PrivateAudioData struct pw_context *context; struct SDL_DataQueue *buffer; - size_t buffer_period_size; - Sint32 stride; /* Bytes-per-frame */ - SDL_atomic_t stream_initialized; + size_t input_buffer_packet_size; + Sint32 stride; /* Bytes-per-frame */ + int stream_init_status; }; #endif /* SDL_pipewire_h_ */ diff --git a/libs/SDL2/src/audio/ps2/SDL_ps2audio.c b/libs/SDL2/src/audio/ps2/SDL_ps2audio.c new file mode 100644 index 00000000..daca266c --- /dev/null +++ b/libs/SDL2/src/audio/ps2/SDL_ps2audio.c @@ -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); + } +} + +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 --git a/libs/SDL2/src/audio/ps2/SDL_ps2audio.h b/libs/SDL2/src/audio/ps2/SDL_ps2audio.h new file mode 100644 index 00000000..0de2506c --- /dev/null +++ b/libs/SDL2/src/audio/ps2/SDL_ps2audio.h @@ -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 --git a/libs/SDL2/src/audio/psp/SDL_pspaudio.c b/libs/SDL2/src/audio/psp/SDL_pspaudio.c index 1966cafd..d908170c 100644 --- a/libs/SDL2/src/audio/psp/SDL_pspaudio.c +++ b/libs/SDL2/src/audio/psp/SDL_pspaudio.c @@ -42,7 +42,7 @@ #define PSPAUDIO_DRIVER_NAME "psp" static int -PSPAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +PSPAUDIO_OpenDevice(_THIS, const char *devname) { int format, mixlen, i; @@ -158,7 +158,7 @@ static void PSPAUDIO_ThreadInit(_THIS) } } -static int +static SDL_bool PSPAUDIO_Init(SDL_AudioDriverImpl * impl) { /* Set the function pointers */ @@ -170,16 +170,16 @@ PSPAUDIO_Init(SDL_AudioDriverImpl * impl) impl->ThreadInit = PSPAUDIO_ThreadInit; /* PSP audio device */ - impl->OnlyHasDefaultOutputDevice = 1; + impl->OnlyHasDefaultOutputDevice = SDL_TRUE; /* - impl->HasCaptureSupport = 1; - impl->OnlyHasDefaultCaptureDevice = 1; + impl->HasCaptureSupport = SDL_TRUE; + impl->OnlyHasDefaultCaptureDevice = SDL_TRUE; */ - return 1; /* this audio target is available. */ + return SDL_TRUE; /* this audio target is available. */ } AudioBootStrap PSPAUDIO_bootstrap = { - "psp", "PSP audio driver", PSPAUDIO_Init, 0 + "psp", "PSP audio driver", PSPAUDIO_Init, SDL_FALSE }; #endif /* SDL_AUDIO_DRIVER_PSP */ diff --git a/libs/SDL2/src/audio/pulseaudio/SDL_pulseaudio.c b/libs/SDL2/src/audio/pulseaudio/SDL_pulseaudio.c index bf16839b..85e1386c 100644 --- a/libs/SDL2/src/audio/pulseaudio/SDL_pulseaudio.c +++ b/libs/SDL2/src/audio/pulseaudio/SDL_pulseaudio.c @@ -107,8 +107,6 @@ static int (*PULSEAUDIO_pa_stream_connect_record) (pa_stream *, const char *, 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,7 @@ static pa_operation * (*PULSEAUDIO_pa_stream_flush) (pa_stream *, 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 int load_pulseaudio_syms(void); @@ -222,8 +221,6 @@ load_pulseaudio_syms(void) 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 +229,7 @@ load_pulseaudio_syms(void) 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); return 0; } @@ -359,51 +357,56 @@ ConnectToPulseServer(pa_mainloop **_mainloop, pa_context **_context) 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)) { +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) +{ + struct SDL_PrivateAudioData *h = this->hidden; + 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; } - if (PULSEAUDIO_pa_stream_writable_size(h->stream) >= (h->mixlen/8)) { - return; - } } -} -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) { - SDL_OpenedAudioDeviceDisconnected(this); - } - } + /*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; } @@ -522,7 +525,7 @@ SourceDeviceNameCallback(pa_context *c, const pa_source_info *i, int is_last, vo } static SDL_bool -FindDeviceName(struct SDL_PrivateAudioData *h, const int iscapture, void *handle) +FindDeviceName(struct SDL_PrivateAudioData *h, const SDL_bool iscapture, void *handle) { const uint32_t idx = ((uint32_t) ((size_t) handle)) - 1; @@ -544,16 +547,17 @@ FindDeviceName(struct SDL_PrivateAudioData *h, const int iscapture, void *handle } static int -PULSEAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +PULSEAUDIO_OpenDevice(_THIS, const char *devname) { struct SDL_PrivateAudioData *h = NULL; - Uint16 test_format = 0; + SDL_AudioFormat test_format; pa_sample_spec paspec; pa_buffer_attr paattr; pa_channel_map pacmap; pa_stream_flags_t flags = 0; const char *name = NULL; - int state = 0; + SDL_bool iscapture = this->iscapture; + int state = 0, format = PA_SAMPLE_INVALID; int rc = 0; /* Initialize all variables that we clean on shutdown */ @@ -564,53 +568,45 @@ PULSEAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) } SDL_zerop(this->hidden); - paspec.format = PA_SAMPLE_INVALID; - /* Try for a closest match on audio format */ - for (test_format = SDL_FirstAudioFormat(this->spec.format); - (paspec.format == PA_SAMPLE_INVALID) && test_format;) { + for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { #ifdef DEBUG_AUDIO fprintf(stderr, "Trying format 0x%4.4x\n", test_format); #endif switch (test_format) { case AUDIO_U8: - paspec.format = PA_SAMPLE_U8; + format = PA_SAMPLE_U8; break; case AUDIO_S16LSB: - paspec.format = PA_SAMPLE_S16LE; + format = PA_SAMPLE_S16LE; break; case AUDIO_S16MSB: - paspec.format = PA_SAMPLE_S16BE; + format = PA_SAMPLE_S16BE; break; case AUDIO_S32LSB: - paspec.format = PA_SAMPLE_S32LE; + format = PA_SAMPLE_S32LE; break; case AUDIO_S32MSB: - paspec.format = PA_SAMPLE_S32BE; + format = PA_SAMPLE_S32BE; break; case AUDIO_F32LSB: - paspec.format = PA_SAMPLE_FLOAT32LE; + format = PA_SAMPLE_FLOAT32LE; break; case AUDIO_F32MSB: - paspec.format = PA_SAMPLE_FLOAT32BE; + format = PA_SAMPLE_FLOAT32BE; break; default: - paspec.format = PA_SAMPLE_INVALID; - break; - } - if (paspec.format == PA_SAMPLE_INVALID) { - test_format = SDL_NextAudioFormat(); + continue; } + break; } - if (paspec.format == PA_SAMPLE_INVALID) { - return SDL_SetError("Couldn't find any hardware audio formats"); + if (!test_format) { + return SDL_SetError("%s: Unsupported audio format", "pulseaudio"); } this->spec.format = test_format; + 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 */ @@ -627,28 +623,18 @@ PULSEAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) 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"); } - if (!FindDeviceName(h, iscapture, handle)) { + if (!FindDeviceName(h, iscapture, this->handle)) { return SDL_SetError("Requested PulseAudio sink/source missing?"); } @@ -679,6 +665,7 @@ PULSEAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) 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); } @@ -832,16 +819,16 @@ PULSEAUDIO_Deinitialize(void) UnloadPulseAudioLibrary(); } -static int +static SDL_bool PULSEAUDIO_Init(SDL_AudioDriverImpl * impl) { if (LoadPulseAudioLibrary() < 0) { - return 0; + return SDL_FALSE; } if (ConnectToPulseServer(&hotplug_mainloop, &hotplug_context) < 0) { UnloadPulseAudioLibrary(); - return 0; + return SDL_FALSE; } include_monitors = SDL_GetHintBoolean(SDL_HINT_AUDIO_INCLUDE_MONITORS, SDL_FALSE); @@ -859,11 +846,11 @@ PULSEAUDIO_Init(SDL_AudioDriverImpl * impl) impl->HasCaptureSupport = SDL_TRUE; - return 1; /* this audio target is available. */ + return SDL_TRUE; /* this audio target is available. */ } AudioBootStrap PULSEAUDIO_bootstrap = { - "pulseaudio", "PulseAudio", PULSEAUDIO_Init, 0 + "pulseaudio", "PulseAudio", PULSEAUDIO_Init, SDL_FALSE }; #endif /* SDL_AUDIO_DRIVER_PULSEAUDIO */ diff --git a/libs/SDL2/src/audio/pulseaudio/SDL_pulseaudio.h b/libs/SDL2/src/audio/pulseaudio/SDL_pulseaudio.h index a0d0b0c9..7ef45fe2 100644 --- a/libs/SDL2/src/audio/pulseaudio/SDL_pulseaudio.h +++ b/libs/SDL2/src/audio/pulseaudio/SDL_pulseaudio.h @@ -43,11 +43,7 @@ struct SDL_PrivateAudioData 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 --git a/libs/SDL2/src/audio/qsa/SDL_qsa_audio.c b/libs/SDL2/src/audio/qsa/SDL_qsa_audio.c index ca1539fd..5c4ab38b 100644 --- a/libs/SDL2/src/audio/qsa/SDL_qsa_audio.c +++ b/libs/SDL2/src/audio/qsa/SDL_qsa_audio.c @@ -121,7 +121,7 @@ QSA_WaitDevice(_THIS) /* For example, Vortex 8820 audio driver stucks on second DAC because */ /* it doesn't exist ! */ result = SDL_IOReady(this->hidden->audio_fd, - this->hidden->iscapture ? SDL_IOR_READ : SDL_IOR_WRITE, + this->iscapture ? SDL_IOR_READ : SDL_IOR_WRITE, 2 * 1000); switch (result) { case -1: @@ -180,7 +180,7 @@ QSA_PlayDevice(_THIS) } else { if ((errno == EINVAL) || (errno == EIO)) { SDL_zero(cstatus); - if (!this->hidden->iscapture) { + if (!this->iscapture) { cstatus.channel = SND_PCM_CHANNEL_PLAYBACK; } else { cstatus.channel = SND_PCM_CHANNEL_CAPTURE; @@ -196,7 +196,7 @@ QSA_PlayDevice(_THIS) if ((cstatus.status == SND_PCM_STATUS_UNDERRUN) || (cstatus.status == SND_PCM_STATUS_READY)) { - if (!this->hidden->iscapture) { + if (!this->iscapture) { status = snd_pcm_plugin_prepare(this->hidden-> audio_handle, @@ -240,7 +240,7 @@ static void QSA_CloseDevice(_THIS) { if (this->hidden->audio_handle != NULL) { - if (!this->hidden->iscapture) { + if (!this->iscapture) { /* Finish playing available samples */ snd_pcm_plugin_flush(this->hidden->audio_handle, SND_PCM_CHANNEL_PLAYBACK); @@ -257,13 +257,13 @@ QSA_CloseDevice(_THIS) } static int -QSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +QSA_OpenDevice(_THIS, const char *devname) { - const QSA_Device *device = (const QSA_Device *) handle; + const QSA_Device *device = (const QSA_Device *) this->handle; + SDL_Bool iscapture = this->iscapture; int status = 0; int format = 0; - SDL_AudioFormat test_format = 0; - int found = 0; + SDL_AudioFormat test_format; snd_pcm_channel_setup_t csetup; snd_pcm_channel_params_t cparams; @@ -280,9 +280,6 @@ QSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) /* Initialize channel transfer parameters to default */ QSA_InitAudioParams(&cparams); - /* Initialize channel direction: capture or playback */ - this->hidden->iscapture = iscapture ? SDL_TRUE : SDL_FALSE; - if (device != NULL) { /* Open requested audio device */ this->hidden->deviceno = device->deviceno; @@ -305,89 +302,49 @@ QSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) } /* Try for a closest match on audio format */ - format = 0; - /* can't use format as SND_PCM_SFMT_U8 = 0 in qsa */ - found = 0; - - for (test_format = SDL_FirstAudioFormat(this->spec.format); !found;) { + for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { /* if match found set format to equivalent QSA format */ switch (test_format) { case AUDIO_U8: - { - format = SND_PCM_SFMT_U8; - found = 1; - } + format = SND_PCM_SFMT_U8; break; case AUDIO_S8: - { - format = SND_PCM_SFMT_S8; - found = 1; - } + format = SND_PCM_SFMT_S8; break; case AUDIO_S16LSB: - { - format = SND_PCM_SFMT_S16_LE; - found = 1; - } + format = SND_PCM_SFMT_S16_LE; break; case AUDIO_S16MSB: - { - format = SND_PCM_SFMT_S16_BE; - found = 1; - } + format = SND_PCM_SFMT_S16_BE; break; case AUDIO_U16LSB: - { - format = SND_PCM_SFMT_U16_LE; - found = 1; - } + format = SND_PCM_SFMT_U16_LE; break; case AUDIO_U16MSB: - { - format = SND_PCM_SFMT_U16_BE; - found = 1; - } + format = SND_PCM_SFMT_U16_BE; break; case AUDIO_S32LSB: - { - format = SND_PCM_SFMT_S32_LE; - found = 1; - } + format = SND_PCM_SFMT_S32_LE; break; case AUDIO_S32MSB: - { - format = SND_PCM_SFMT_S32_BE; - found = 1; - } + format = SND_PCM_SFMT_S32_BE; break; case AUDIO_F32LSB: - { - format = SND_PCM_SFMT_FLOAT_LE; - found = 1; - } + format = SND_PCM_SFMT_FLOAT_LE; break; case AUDIO_F32MSB: - { - format = SND_PCM_SFMT_FLOAT_BE; - found = 1; - } + format = SND_PCM_SFMT_FLOAT_BE; break; default: - { - break; - } - } - - if (!found) { - test_format = SDL_NextAudioFormat(); + continue; } + break; } - /* assumes test_format not 0 on success */ - if (test_format == 0) { - return SDL_SetError("QSA: Couldn't find any hardware audio formats"); + /* can't use format as SND_PCM_SFMT_U8 = 0 in qsa */ + if (!test_format) { + return SDL_SetError("%s: Unsupported audio format", "qsa"); } - this->spec.format = test_format; /* Set the audio format */ @@ -407,7 +364,7 @@ QSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) /* Make sure channel is setup right one last time */ SDL_zero(csetup); - if (!this->hidden->iscapture) { + if (!this->iscapture) { csetup.channel = SND_PCM_CHANNEL_PLAYBACK; } else { csetup.channel = SND_PCM_CHANNEL_CAPTURE; @@ -443,7 +400,7 @@ QSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) this->hidden->pcm_len); /* get the file descriptor */ - if (!this->hidden->iscapture) { + if (!this->iscapture) { this->hidden->audio_fd = snd_pcm_file_descriptor(this->hidden->audio_handle, SND_PCM_CHANNEL_PLAYBACK); @@ -458,7 +415,7 @@ QSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) } /* Prepare an audio channel */ - if (!this->hidden->iscapture) { + if (!this->iscapture) { /* Prepare audio playback */ status = snd_pcm_plugin_prepare(this->hidden->audio_handle, @@ -635,7 +592,7 @@ QSA_Deinitialize(void) qsa_capture_devices = 0; } -static int +static SDL_bool QSA_Init(SDL_AudioDriverImpl * impl) { /* Clear devices array */ @@ -655,20 +612,14 @@ QSA_Init(SDL_AudioDriverImpl * impl) impl->GetDeviceBuf = QSA_GetDeviceBuf; impl->CloseDevice = QSA_CloseDevice; impl->Deinitialize = QSA_Deinitialize; - impl->LockDevice = NULL; - impl->UnlockDevice = NULL; - impl->ProvidesOwnCallbackThread = 0; - impl->SkipMixerLock = 0; - impl->HasCaptureSupport = 1; - impl->OnlyHasDefaultOutputDevice = 0; - impl->OnlyHasDefaultCaptureDevice = 0; + impl->HasCaptureSupport = SDL_TRUE; - return 1; /* this audio target is available. */ + return SDL_TRUE; /* this audio target is available. */ } AudioBootStrap QSAAUDIO_bootstrap = { - "qsa", "QNX QSA Audio", QSA_Init, 0 + "qsa", "QNX QSA Audio", QSA_Init, SDL_FALSE }; #endif /* SDL_AUDIO_DRIVER_QSA */ diff --git a/libs/SDL2/src/audio/qsa/SDL_qsa_audio.h b/libs/SDL2/src/audio/qsa/SDL_qsa_audio.h index 7f5e9d3a..e4845c9e 100644 --- a/libs/SDL2/src/audio/qsa/SDL_qsa_audio.h +++ b/libs/SDL2/src/audio/qsa/SDL_qsa_audio.h @@ -33,9 +33,6 @@ struct SDL_PrivateAudioData { - /* SDL capture state */ - SDL_bool iscapture; - /* The audio device handle */ int cardno; int deviceno; diff --git a/libs/SDL2/src/audio/sndio/SDL_sndioaudio.c b/libs/SDL2/src/audio/sndio/SDL_sndioaudio.c index aa2f83ac..29e5315b 100644 --- a/libs/SDL2/src/audio/sndio/SDL_sndioaudio.c +++ b/libs/SDL2/src/audio/sndio/SDL_sndioaudio.c @@ -237,11 +237,11 @@ SNDIO_CloseDevice(_THIS) } static int -SNDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +SNDIO_OpenDevice(_THIS, const char *devname) { - SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format); + SDL_AudioFormat test_format; struct sio_par par; - int status; + SDL_bool iscapture = this->iscapture; this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc(sizeof(*this->hidden)); @@ -273,8 +273,7 @@ SNDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) par.appbufsz = par.round * 2; /* Try for a closest match on audio format */ - status = -1; - while (test_format && (status < 0)) { + for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { if (!SDL_AUDIO_ISFLOAT(test_format)) { par.le = SDL_AUDIO_ISLITTLEENDIAN(test_format) ? 1 : 0; par.sig = SDL_AUDIO_ISSIGNED(test_format) ? 1 : 0; @@ -290,15 +289,13 @@ SNDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) continue; } if ((par.bits == 8 * par.bps) || (par.msb)) { - status = 0; break; } } - test_format = SDL_NextAudioFormat(); } - if (status < 0) { - return SDL_SetError("sndio: Couldn't find any hardware audio formats"); + if (!test_format) { + return SDL_SetError("%s: Unsupported audio format", "sndio"); } if ((par.bps == 4) && (par.sig) && (par.le)) @@ -357,11 +354,11 @@ SNDIO_DetectDevices(void) SDL_AddAudioDevice(SDL_TRUE, DEFAULT_INPUT_DEVNAME, NULL, (void *) 0x2); } -static int +static SDL_bool SNDIO_Init(SDL_AudioDriverImpl * impl) { if (LoadSNDIOLibrary() < 0) { - return 0; + return SDL_FALSE; } /* Set the function pointers */ @@ -375,14 +372,14 @@ SNDIO_Init(SDL_AudioDriverImpl * impl) impl->Deinitialize = SNDIO_Deinitialize; impl->DetectDevices = SNDIO_DetectDevices; - impl->AllowsArbitraryDeviceNames = 1; + impl->AllowsArbitraryDeviceNames = SDL_TRUE; impl->HasCaptureSupport = SDL_TRUE; - return 1; /* this audio target is available. */ + return SDL_TRUE; /* this audio target is available. */ } AudioBootStrap SNDIO_bootstrap = { - "sndio", "OpenBSD sndio", SNDIO_Init, 0 + "sndio", "OpenBSD sndio", SNDIO_Init, SDL_FALSE }; #endif /* SDL_AUDIO_DRIVER_SNDIO */ diff --git a/libs/SDL2/src/audio/sun/SDL_sunaudio.c b/libs/SDL2/src/audio/sun/SDL_sunaudio.c index a78ec741..59569242 100644 --- a/libs/SDL2/src/audio/sun/SDL_sunaudio.c +++ b/libs/SDL2/src/audio/sun/SDL_sunaudio.c @@ -188,11 +188,12 @@ SUNAUDIO_CloseDevice(_THIS) } static int -SUNAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +SUNAUDIO_OpenDevice(_THIS, const char *devname) { #ifdef AUDIO_SETINFO int enc; #endif + SDL_bool iscapture = this->iscapture; int desired_freq = 0; const int flags = ((iscapture) ? OPEN_FLAGS_INPUT : OPEN_FLAGS_OUTPUT); SDL_AudioFormat format = 0; @@ -394,7 +395,7 @@ snd2au(int sample) return (mask & sample); } -static int +static SDL_bool SUNAUDIO_Init(SDL_AudioDriverImpl * impl) { /* Set the function pointers */ @@ -405,13 +406,13 @@ SUNAUDIO_Init(SDL_AudioDriverImpl * impl) impl->GetDeviceBuf = SUNAUDIO_GetDeviceBuf; impl->CloseDevice = SUNAUDIO_CloseDevice; - impl->AllowsArbitraryDeviceNames = 1; + impl->AllowsArbitraryDeviceNames = SDL_TRUE; - return 1; /* this audio target is available. */ + return SDL_TRUE; /* this audio target is available. */ } AudioBootStrap SUNAUDIO_bootstrap = { - "audio", "UNIX /dev/audio interface", SUNAUDIO_Init, 0 + "audio", "UNIX /dev/audio interface", SUNAUDIO_Init, SDL_FALSE }; #endif /* SDL_AUDIO_DRIVER_SUNAUDIO */ diff --git a/libs/SDL2/src/audio/vita/SDL_vitaaudio.c b/libs/SDL2/src/audio/vita/SDL_vitaaudio.c index 5433594b..88f4a328 100644 --- a/libs/SDL2/src/audio/vita/SDL_vitaaudio.c +++ b/libs/SDL2/src/audio/vita/SDL_vitaaudio.c @@ -37,18 +37,35 @@ #include #include +#include #define SCE_AUDIO_SAMPLE_ALIGN(s) (((s) + 63) & ~63) #define SCE_AUDIO_MAX_VOLUME 0x8000 -/* The tag name used by VITA audio */ -#define VITAAUD_DRIVER_NAME "vita" +static int +VITAAUD_OpenCaptureDevice(_THIS) +{ + this->spec.freq = 16000; + this->spec.samples = 512; + this->spec.channels = 1; + + SDL_CalculateAudioSpec(&this->spec); + + this->hidden->port = sceAudioInOpenPort(SCE_AUDIO_IN_PORT_TYPE_VOICE , 512, 16000, SCE_AUDIO_IN_PARAM_FORMAT_S16_MONO); + + if (this->hidden->port < 0) { + return SDL_SetError("Couldn't open audio in port: %x", this->hidden->port); + } + + return 0; +} static int -VITAAUD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +VITAAUD_OpenDevice(_THIS, const char *devname) { int format, mixlen, i, port = SCE_AUDIO_OUT_PORT_TYPE_MAIN; int vols[2] = {SCE_AUDIO_MAX_VOLUME, SCE_AUDIO_MAX_VOLUME}; + SDL_AudioFormat test_format; this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc(sizeof(*this->hidden)); @@ -56,13 +73,20 @@ VITAAUD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) return SDL_OutOfMemory(); } SDL_memset(this->hidden, 0, sizeof(*this->hidden)); - switch (this->spec.format & 0xff) { - case 8: - case 16: - this->spec.format = AUDIO_S16LSB; + + for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { + if (test_format == AUDIO_S16LSB) { + this->spec.format = test_format; break; - default: - return SDL_SetError("Unsupported audio format"); + } + } + + if(!test_format) { + return SDL_SetError("Unsupported audio format"); + } + + if (this->iscapture) { + return VITAAUD_OpenCaptureDevice(this); } /* The sample count must be a multiple of 64. */ @@ -91,14 +115,14 @@ VITAAUD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) port = SCE_AUDIO_OUT_PORT_TYPE_BGM; } - this->hidden->channel = sceAudioOutOpenPort(port, this->spec.samples, this->spec.freq, format); - if (this->hidden->channel < 0) { + this->hidden->port = sceAudioOutOpenPort(port, this->spec.samples, this->spec.freq, format); + if (this->hidden->port < 0) { free(this->hidden->rawbuf); this->hidden->rawbuf = NULL; - return SDL_SetError("Couldn't reserve hardware channel"); + return SDL_SetError("Couldn't open audio out port: %x", this->hidden->port); } - sceAudioOutSetVolume(this->hidden->channel, SCE_AUDIO_VOLUME_FLAG_L_CH|SCE_AUDIO_VOLUME_FLAG_R_CH, vols); + sceAudioOutSetVolume(this->hidden->port, SCE_AUDIO_VOLUME_FLAG_L_CH|SCE_AUDIO_VOLUME_FLAG_R_CH, vols); SDL_memset(this->hidden->rawbuf, 0, mixlen); for (i = 0; i < NUM_BUFFERS; i++) { @@ -113,7 +137,7 @@ static void VITAAUD_PlayDevice(_THIS) { Uint8 *mixbuf = this->hidden->mixbufs[this->hidden->next_buffer]; - sceAudioOutOutput(this->hidden->channel, mixbuf); + sceAudioOutOutput(this->hidden->port, mixbuf); this->hidden->next_buffer = (this->hidden->next_buffer + 1) % NUM_BUFFERS; } @@ -123,6 +147,7 @@ static void VITAAUD_WaitDevice(_THIS) { /* Because we block when sending audio, there's no need for this function to do anything. */ } + static Uint8 *VITAAUD_GetDeviceBuf(_THIS) { return this->hidden->mixbufs[this->hidden->next_buffer]; @@ -130,17 +155,32 @@ static Uint8 *VITAAUD_GetDeviceBuf(_THIS) static void VITAAUD_CloseDevice(_THIS) { - if (this->hidden->channel >= 0) { - sceAudioOutReleasePort(this->hidden->channel); - this->hidden->channel = -1; + if (this->hidden->port >= 0) { + if (this->iscapture) { + sceAudioInReleasePort(this->hidden->port); + } else { + sceAudioOutReleasePort(this->hidden->port); + } + this->hidden->port = -1; } - if (this->hidden->rawbuf != NULL) { + if (!this->iscapture && this->hidden->rawbuf != NULL) { free(this->hidden->rawbuf); /* this uses memalign(), not SDL_malloc(). */ this->hidden->rawbuf = NULL; } } +static int VITAAUD_CaptureFromDevice(_THIS, void *buffer, int buflen) +{ + int ret; + SDL_assert(buflen == this->spec.size); + ret = sceAudioInInput(this->hidden->port, buffer); + if (ret < 0) { + return SDL_SetError("Failed to capture from device: %x", ret); + } + return this->spec.size; +} + static void VITAAUD_ThreadInit(_THIS) { /* Increase the priority of this audio thread by 1 to put it @@ -154,7 +194,7 @@ static void VITAAUD_ThreadInit(_THIS) } } -static int +static SDL_bool VITAAUD_Init(SDL_AudioDriverImpl * impl) { /* Set the function pointers */ @@ -165,17 +205,18 @@ VITAAUD_Init(SDL_AudioDriverImpl * impl) impl->CloseDevice = VITAAUD_CloseDevice; impl->ThreadInit = VITAAUD_ThreadInit; - /* VITA audio device */ - impl->OnlyHasDefaultOutputDevice = 1; - /* - impl->HasCaptureSupport = 1; - impl->OnlyHasDefaultInputDevice = 1; - */ - return 1; /* this audio target is available. */ + impl->CaptureFromDevice = VITAAUD_CaptureFromDevice; + + /* and the capabilities */ + impl->HasCaptureSupport = SDL_TRUE; + impl->OnlyHasDefaultOutputDevice = SDL_TRUE; + impl->OnlyHasDefaultCaptureDevice = SDL_TRUE; + + return SDL_TRUE; /* this audio target is available. */ } AudioBootStrap VITAAUD_bootstrap = { - "vita", "VITA audio driver", VITAAUD_Init, 0 + "vita", "VITA audio driver", VITAAUD_Init, SDL_FALSE }; #endif /* SDL_AUDIO_DRIVER_VITA */ diff --git a/libs/SDL2/src/audio/vita/SDL_vitaaudio.h b/libs/SDL2/src/audio/vita/SDL_vitaaudio.h index 73870759..a5601b28 100644 --- a/libs/SDL2/src/audio/vita/SDL_vitaaudio.h +++ b/libs/SDL2/src/audio/vita/SDL_vitaaudio.h @@ -30,8 +30,8 @@ #define NUM_BUFFERS 2 struct SDL_PrivateAudioData { - /* The hardware output channel. */ - int channel; + /* The hardware input/output port. */ + int port; /* The raw allocated mixing buffer. */ Uint8 *rawbuf; /* Individual mixing buffers. */ diff --git a/libs/SDL2/src/audio/wasapi/SDL_wasapi.c b/libs/SDL2/src/audio/wasapi/SDL_wasapi.c index 8f287cdb..5b966aa3 100644 --- a/libs/SDL2/src/audio/wasapi/SDL_wasapi.c +++ b/libs/SDL2/src/audio/wasapi/SDL_wasapi.c @@ -209,7 +209,7 @@ UpdateAudioStream(_THIS, const SDL_AudioSpec *oldspec) } if (!this->stream) { - return -1; + return -1; /* SDL_NewAudioStream should have called SDL_SetError. */ } } @@ -512,15 +512,14 @@ WASAPI_PrepDevice(_THIS, const SDL_bool updatestream) IAudioRenderClient *render = NULL; IAudioCaptureClient *capture = NULL; WAVEFORMATEX *waveformat = NULL; - SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format); + SDL_AudioFormat test_format; SDL_AudioFormat wasapi_format = 0; - SDL_bool valid_format = SDL_FALSE; HRESULT ret = S_OK; DWORD streamflags = 0; 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); @@ -543,17 +542,15 @@ WASAPI_PrepDevice(_THIS, const SDL_bool updatestream) /* Make sure we have a valid format that we can convert to whatever WASAPI wants. */ wasapi_format = WaveFormatToSDLFormat(waveformat); - while ((!valid_format) && (test_format)) { + for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { if (test_format == wasapi_format) { this->spec.format = test_format; - valid_format = SDL_TRUE; break; } - test_format = SDL_NextAudioFormat(); } - if (!valid_format) { - return SDL_SetError("WASAPI: Unsupported audio format"); + if (!test_format) { + return SDL_SetError("%s: Unsupported audio format", "wasapi"); } ret = IAudioClient_GetDevicePeriod(client, &default_period, NULL); @@ -561,12 +558,16 @@ WASAPI_PrepDevice(_THIS, const SDL_bool updatestream) return WIN_SetErrorFromHRESULT("WASAPI can't determine minimum device period", ret); } +#if 1 /* we're getting reports that WASAPI's resampler introduces distortions, so it's disabled for now. --ryan. */ + this->spec.freq = waveformat->nSamplesPerSec; /* force sampling rate so our resampler kicks in, if necessary. */ +#else /* favor WASAPI's resampler over our own */ if (this->spec.freq != waveformat->nSamplesPerSec) { streamflags |= (AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM | AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY); waveformat->nSamplesPerSec = this->spec.freq; waveformat->nAvgBytesPerSec = waveformat->nSamplesPerSec * waveformat->nChannels * (waveformat->wBitsPerSample / 8); } +#endif streamflags |= AUDCLNT_STREAMFLAGS_EVENTCALLBACK; ret = IAudioClient_Initialize(client, sharemode, streamflags, 0, 0, waveformat, NULL); @@ -631,9 +632,7 @@ WASAPI_PrepDevice(_THIS, const SDL_bool updatestream) } if (updatestream) { - if (UpdateAudioStream(this, &oldspec) == -1) { - return -1; - } + return UpdateAudioStream(this, &oldspec); } return 0; /* good to go. */ @@ -641,9 +640,9 @@ WASAPI_PrepDevice(_THIS, const SDL_bool updatestream) static int -WASAPI_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +WASAPI_OpenDevice(_THIS, const char *devname) { - LPCWSTR devid = (LPCWSTR) handle; + LPCWSTR devid = (LPCWSTR) this->handle; /* Initialize all variables that we clean on shutdown */ this->hidden = (struct SDL_PrivateAudioData *) @@ -656,7 +655,7 @@ WASAPI_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) WASAPI_RefDevice(this); /* so CloseDevice() will unref to zero. */ if (!devid) { /* is default device? */ - this->hidden->default_device_generation = SDL_AtomicGet(iscapture ? &WASAPI_DefaultCaptureGeneration : &WASAPI_DefaultPlaybackGeneration); + this->hidden->default_device_generation = SDL_AtomicGet(this->iscapture ? &WASAPI_DefaultCaptureGeneration : &WASAPI_DefaultPlaybackGeneration); } else { this->hidden->devid = SDL_wcsdup(devid); if (!this->hidden->devid) { @@ -691,12 +690,6 @@ WASAPI_ThreadDeinit(_THIS) WASAPI_PlatformThreadDeinit(this); } -void -WASAPI_BeginLoopIteration(_THIS) -{ - /* no-op. */ -} - static void WASAPI_Deinitialize(void) { @@ -713,21 +706,20 @@ WASAPI_Deinitialize(void) deviceid_list = NULL; } -static int +static SDL_bool WASAPI_Init(SDL_AudioDriverImpl * impl) { SDL_AtomicSet(&WASAPI_DefaultPlaybackGeneration, 1); SDL_AtomicSet(&WASAPI_DefaultCaptureGeneration, 1); if (WASAPI_PlatformInit() == -1) { - return 0; + return SDL_FALSE; } /* Set the function pointers */ impl->DetectDevices = WASAPI_DetectDevices; impl->ThreadInit = WASAPI_ThreadInit; impl->ThreadDeinit = WASAPI_ThreadDeinit; - impl->BeginLoopIteration = WASAPI_BeginLoopIteration; impl->OpenDevice = WASAPI_OpenDevice; impl->PlayDevice = WASAPI_PlayDevice; impl->WaitDevice = WASAPI_WaitDevice; @@ -736,13 +728,13 @@ WASAPI_Init(SDL_AudioDriverImpl * impl) impl->FlushCapture = WASAPI_FlushCapture; impl->CloseDevice = WASAPI_CloseDevice; impl->Deinitialize = WASAPI_Deinitialize; - impl->HasCaptureSupport = 1; + impl->HasCaptureSupport = SDL_TRUE; - return 1; /* this audio target is available. */ + return SDL_TRUE; /* this audio target is available. */ } AudioBootStrap WASAPI_bootstrap = { - "wasapi", "WASAPI", WASAPI_Init, 0 + "wasapi", "WASAPI", WASAPI_Init, SDL_FALSE }; #endif /* SDL_AUDIO_DRIVER_WASAPI */ diff --git a/libs/SDL2/src/audio/wasapi/SDL_wasapi.h b/libs/SDL2/src/audio/wasapi/SDL_wasapi.h index 7fd02b45..af79637b 100644 --- a/libs/SDL2/src/audio/wasapi/SDL_wasapi.h +++ b/libs/SDL2/src/audio/wasapi/SDL_wasapi.h @@ -74,7 +74,6 @@ int WASAPI_ActivateDevice(_THIS, const SDL_bool isrecovery); void WASAPI_PlatformThreadInit(_THIS); void WASAPI_PlatformThreadDeinit(_THIS); void WASAPI_PlatformDeleteActivationHandler(void *handler); -void WASAPI_BeginLoopIteration(_THIS); #ifdef __cplusplus } diff --git a/libs/SDL2/src/audio/wasapi/SDL_wasapi_win32.c b/libs/SDL2/src/audio/wasapi/SDL_wasapi_win32.c index 8e5c7e2a..137f3701 100644 --- a/libs/SDL2/src/audio/wasapi/SDL_wasapi_win32.c +++ b/libs/SDL2/src/audio/wasapi/SDL_wasapi_win32.c @@ -362,7 +362,7 @@ typedef struct WAVEFORMATEXTENSIBLE fmt; } EndpointItem; -static int sort_endpoints(const void *_a, const void *_b) +static int SDLCALL sort_endpoints(const void *_a, const void *_b) { LPWSTR a = ((const EndpointItem *) _a)->devid; LPWSTR b = ((const EndpointItem *) _b)->devid; diff --git a/libs/SDL2/src/audio/winmm/SDL_winmm.c b/libs/SDL2/src/audio/winmm/SDL_winmm.c index e79d6eeb..444d2157 100644 --- a/libs/SDL2/src/audio/winmm/SDL_winmm.c +++ b/libs/SDL2/src/audio/winmm/SDL_winmm.c @@ -283,10 +283,11 @@ PrepWaveFormat(_THIS, UINT devId, WAVEFORMATEX *pfmt, const int iscapture) } static int -WINMM_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +WINMM_OpenDevice(_THIS, const char *devname) { - SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format); - int valid_datatype = 0; + SDL_AudioFormat test_format; + SDL_bool iscapture = this->iscapture; + void *handle = this->handle; MMRESULT result; WAVEFORMATEX waveformat; UINT devId = WAVE_MAPPER; /* WAVE_MAPPER == choose system's default */ @@ -313,7 +314,7 @@ WINMM_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) if (this->spec.channels > 2) this->spec.channels = 2; /* !!! FIXME: is this right? */ - while ((!valid_datatype) && (test_format)) { + for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { switch (test_format) { case AUDIO_U8: case AUDIO_S16: @@ -321,20 +322,17 @@ WINMM_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) case AUDIO_F32: this->spec.format = test_format; if (PrepWaveFormat(this, devId, &waveformat, iscapture)) { - valid_datatype = 1; - } else { - test_format = SDL_NextAudioFormat(); + break; } - break; - + continue; default: - test_format = SDL_NextAudioFormat(); - break; + continue; } + break; } - if (!valid_datatype) { - return SDL_SetError("Unsupported audio format"); + if (!test_format) { + return SDL_SetError("%s: Unsupported audio format", "winmm"); } /* Update the fragment size as size in bytes */ @@ -434,7 +432,7 @@ WINMM_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) return 0; /* Ready to go! */ } -static int +static SDL_bool WINMM_Init(SDL_AudioDriverImpl * impl) { /* Set the function pointers */ @@ -449,11 +447,11 @@ WINMM_Init(SDL_AudioDriverImpl * impl) impl->HasCaptureSupport = SDL_TRUE; - return 1; /* this audio target is available. */ + return SDL_TRUE; /* this audio target is available. */ } AudioBootStrap WINMM_bootstrap = { - "winmm", "Windows Waveform Audio", WINMM_Init, 0 + "winmm", "Windows Waveform Audio", WINMM_Init, SDL_FALSE }; #endif /* SDL_AUDIO_DRIVER_WINMM */ diff --git a/libs/SDL2/src/core/android/SDL_android.c b/libs/SDL2/src/core/android/SDL_android.c index 4236835c..b0884eda 100644 --- a/libs/SDL2/src/core/android/SDL_android.c +++ b/libs/SDL2/src/core/android/SDL_android.c @@ -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 @@ register_methods(JNIEnv *env, const char *classname, JNINativeMethod *methods, i /* 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; @@ -1009,6 +1008,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)(JNIEnv *env, j { SDL_LockMutex(Android_ActivityMutex); +#if SDL_VIDEO_OPENGL_EGL if (Android_Window) { SDL_VideoDevice *_this = SDL_GetVideoDevice(); @@ -1021,6 +1021,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)(JNIEnv *env, j /* GL Context handling is done in the event loop because this function is run from the Java thread */ } +#endif SDL_UnlockMutex(Android_ActivityMutex); } @@ -1051,10 +1052,12 @@ retry: } } +#if SDL_VIDEO_OPENGL_EGL if (data->egl_surface != EGL_NO_SURFACE) { SDL_EGL_DestroySurface(_this, data->egl_surface); data->egl_surface = EGL_NO_SURFACE; } +#endif if (data->native_window) { ANativeWindow_release(data->native_window); @@ -1265,29 +1268,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeGenerateScancod 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)( @@ -2126,6 +2107,15 @@ void Android_JNI_HapticStop(int device_id) /* See SDLActivity.java for constants. */ #define COMMAND_SET_KEEP_SCREEN_ON 5 + +int SDL_AndroidSendMessage(Uint32 command, int param) +{ + if (command >= 0x8000) { + return Android_JNI_SendMessage(command, param); + } + return -1; +} + /* sends message to be handled on the UI event dispatch thread */ int Android_JNI_SendMessage(int command, int param) { @@ -2540,6 +2530,7 @@ SDL_bool Android_JNI_SetRelativeMouseEnabled(SDL_bool enabled) 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 */ @@ -2548,7 +2539,7 @@ SDL_bool Android_JNI_RequestPermission(const char *permission) } 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 --git a/libs/SDL2/src/core/android/keyinfotable.h b/libs/SDL2/src/core/android/keyinfotable.h deleted file mode 100644 index 6c5d065b..00000000 --- a/libs/SDL2/src/core/android/keyinfotable.h +++ /dev/null @@ -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 --git a/libs/SDL2/src/core/gdk/SDL_gdk.cpp b/libs/SDL2/src/core/gdk/SDL_gdk.cpp new file mode 100644 index 00000000..4058a9b8 --- /dev/null +++ b/libs/SDL2/src/core/gdk/SDL_gdk.cpp @@ -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 --git a/libs/SDL2/src/core/gdk/SDL_gdk.h b/libs/SDL2/src/core/gdk/SDL_gdk.h new file mode 100644 index 00000000..628d3e62 --- /dev/null +++ b/libs/SDL2/src/core/gdk/SDL_gdk.h @@ -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 --git a/libs/SDL2/src/core/linux/SDL_dbus.c b/libs/SDL2/src/core/linux/SDL_dbus.c index 2fe12163..ecfbe6f4 100644 --- a/libs/SDL2/src/core/linux/SDL_dbus.c +++ b/libs/SDL2/src/core/linux/SDL_dbus.c @@ -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 --git a/libs/SDL2/src/core/linux/SDL_fcitx.c b/libs/SDL2/src/core/linux/SDL_fcitx.c index 3f079473..c7a73592 100644 --- a/libs/SDL2/src/core/linux/SDL_fcitx.c +++ b/libs/SDL2/src/core/linux/SDL_fcitx.c @@ -85,25 +85,56 @@ GetAppName() } 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 @@ Fcitx_GetPreeditString(SDL_DBusContext *dbus, DBusMessage *msg, char **ret) { 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 @@ DBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *data) 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; + 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); - 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 { @@ -339,11 +400,11 @@ SDL_Fcitx_Reset(void) } SDL_bool -SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode) +SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state) { - Uint32 state = Fcitx_ModState(); + Uint32 mod_state = Fcitx_ModState(); Uint32 handled = SDL_FALSE; - Uint32 is_release = SDL_FALSE; + Uint32 is_release = (state == SDL_RELEASED); Uint32 event_time = 0; if (!fcitx_client.ic_path) { @@ -351,7 +412,7 @@ SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode) } if (SDL_DBus_CallMethod(FCITX_DBUS_SERVICE, fcitx_client.ic_path, FCITX_IC_DBUS_INTERFACE, "ProcessKeyEvent", - DBUS_TYPE_UINT32, &keysym, DBUS_TYPE_UINT32, &keycode, DBUS_TYPE_UINT32, &state, DBUS_TYPE_BOOLEAN, &is_release, DBUS_TYPE_UINT32, &event_time, DBUS_TYPE_INVALID, + DBUS_TYPE_UINT32, &keysym, DBUS_TYPE_UINT32, &keycode, DBUS_TYPE_UINT32, &mod_state, DBUS_TYPE_BOOLEAN, &is_release, DBUS_TYPE_UINT32, &event_time, DBUS_TYPE_INVALID, DBUS_TYPE_BOOLEAN, &handled, DBUS_TYPE_INVALID)) { if (handled) { SDL_Fcitx_UpdateTextRect(NULL); @@ -371,7 +432,7 @@ SDL_Fcitx_UpdateTextRect(SDL_Rect *rect) 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 --git a/libs/SDL2/src/core/linux/SDL_fcitx.h b/libs/SDL2/src/core/linux/SDL_fcitx.h index f7884ea4..c3cea523 100644 --- a/libs/SDL2/src/core/linux/SDL_fcitx.h +++ b/libs/SDL2/src/core/linux/SDL_fcitx.h @@ -31,7 +31,7 @@ extern SDL_bool SDL_Fcitx_Init(void); extern void SDL_Fcitx_Quit(void); extern void SDL_Fcitx_SetFocus(SDL_bool focused); extern void SDL_Fcitx_Reset(void); -extern SDL_bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode); +extern SDL_bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state); extern void SDL_Fcitx_UpdateTextRect(SDL_Rect *rect); extern void SDL_Fcitx_PumpEvents(void); diff --git a/libs/SDL2/src/core/linux/SDL_ibus.c b/libs/SDL2/src/core/linux/SDL_ibus.c index a7bafda3..dc0b928e 100644 --- a/libs/SDL2/src/core/linux/SDL_ibus.c +++ b/libs/SDL2/src/core/linux/SDL_ibus.c @@ -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 @@ IBus_ModState(void) return ibus_mods; } +static SDL_bool +IBus_EnterVariant(DBusConnection *conn, DBusMessageIter *iter, SDL_DBusContext *dbus, + DBusMessageIter *inside, const char * struct_id, size_t id_size) +{ + DBusMessageIter sub; + if (dbus->message_iter_get_arg_type(iter) != DBUS_TYPE_VARIANT) { + return SDL_FALSE; + } + + dbus->message_iter_recurse(iter, &sub); + + if (dbus->message_iter_get_arg_type(&sub) != DBUS_TYPE_STRUCT) { + return SDL_FALSE; + } + + 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(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_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; - const char *struct_id = NULL; - DBusMessageIter sub1, sub2; + DBusMessageIter sub; - if (dbus->message_iter_get_arg_type(iter) != DBUS_TYPE_VARIANT) { + if (!IBus_EnterVariant(conn, iter, dbus, &sub, "IBusText", sizeof("IBusText"))) { return NULL; } - - dbus->message_iter_recurse(iter, &sub1); - - if (dbus->message_iter_get_arg_type(&sub1) != DBUS_TYPE_STRUCT) { + + 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_recurse(&sub1, &sub2); - - if (dbus->message_iter_get_arg_type(&sub2) != DBUS_TYPE_STRING) { - return NULL; - } - - dbus->message_iter_get_basic(&sub2, &struct_id); - if (!struct_id || SDL_strncmp(struct_id, "IBusText", sizeof("IBusText")) != 0) { - return NULL; - } - - dbus->message_iter_next(&sub2); - dbus->message_iter_next(&sub2); - - if (dbus->message_iter_get_arg_type(&sub2) != DBUS_TYPE_STRING) { - return NULL; - } - - dbus->message_iter_get_basic(&sub2, &text); - + 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); - i += sz; - cursor += chars; - } while (i < text_bytes); + if (text) { + 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); + } + + 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; } @@ -503,15 +614,20 @@ SDL_IBus_Reset(void) } SDL_bool -SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode) +SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state) { Uint32 result = 0; SDL_DBusContext *dbus = SDL_DBus_GetContext(); - + + if (IBus_CheckConnection(dbus)) { Uint32 mods = IBus_ModState(); + Uint32 ibus_keycode = keycode - 8; + if (state == SDL_RELEASED) { + mods |= (1 << 30); // IBUS_RELEASE_MASK + } if (!SDL_DBus_CallMethodOnConnection(ibus_conn, IBUS_SERVICE, input_ctx_path, IBUS_INPUT_INTERFACE, "ProcessKeyEvent", - DBUS_TYPE_UINT32, &keysym, DBUS_TYPE_UINT32, &keycode, DBUS_TYPE_UINT32, &mods, DBUS_TYPE_INVALID, + DBUS_TYPE_UINT32, &keysym, DBUS_TYPE_UINT32, &ibus_keycode, DBUS_TYPE_UINT32, &mods, DBUS_TYPE_INVALID, DBUS_TYPE_BOOLEAN, &result, DBUS_TYPE_INVALID)) { result = 0; } diff --git a/libs/SDL2/src/core/linux/SDL_ibus.h b/libs/SDL2/src/core/linux/SDL_ibus.h index 73a9f1b8..71d1f2d3 100644 --- a/libs/SDL2/src/core/linux/SDL_ibus.h +++ b/libs/SDL2/src/core/linux/SDL_ibus.h @@ -41,7 +41,7 @@ extern void SDL_IBus_Reset(void); /* Sends a keypress event to IBus, returns SDL_TRUE if IBus used this event to update its candidate list or change input methods. PumpEvents should be called some time after this, to recieve the TextInput / TextEditing event back. */ -extern SDL_bool SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode); +extern SDL_bool SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state); /* 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. */ diff --git a/libs/SDL2/src/core/linux/SDL_ime.c b/libs/SDL2/src/core/linux/SDL_ime.c index 84c461f8..9c0cb80f 100644 --- a/libs/SDL2/src/core/linux/SDL_ime.c +++ b/libs/SDL2/src/core/linux/SDL_ime.c @@ -27,7 +27,7 @@ typedef SDL_bool (*_SDL_IME_Init)(void); typedef void (*_SDL_IME_Quit)(void); typedef void (*_SDL_IME_SetFocus)(SDL_bool); typedef void (*_SDL_IME_Reset)(void); -typedef SDL_bool (*_SDL_IME_ProcessKeyEvent)(Uint32, Uint32); +typedef SDL_bool (*_SDL_IME_ProcessKeyEvent)(Uint32, Uint32, Uint8 state); typedef void (*_SDL_IME_UpdateTextRect)(SDL_Rect *); typedef void (*_SDL_IME_PumpEvents)(void); @@ -127,10 +127,10 @@ SDL_IME_Reset(void) } SDL_bool -SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode) +SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state) { if (SDL_IME_ProcessKeyEvent_Real) - return SDL_IME_ProcessKeyEvent_Real(keysym, keycode); + return SDL_IME_ProcessKeyEvent_Real(keysym, keycode, state); return SDL_FALSE; } diff --git a/libs/SDL2/src/core/linux/SDL_ime.h b/libs/SDL2/src/core/linux/SDL_ime.h index a28a4b43..cc5b105f 100644 --- a/libs/SDL2/src/core/linux/SDL_ime.h +++ b/libs/SDL2/src/core/linux/SDL_ime.h @@ -31,7 +31,7 @@ extern SDL_bool SDL_IME_Init(void); extern void SDL_IME_Quit(void); extern void SDL_IME_SetFocus(SDL_bool focused); extern void SDL_IME_Reset(void); -extern SDL_bool SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode); +extern SDL_bool SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state); extern void SDL_IME_UpdateTextRect(SDL_Rect *rect); extern void SDL_IME_PumpEvents(void); diff --git a/libs/SDL2/src/core/openbsd/SDL_wscons_kbd.c b/libs/SDL2/src/core/openbsd/SDL_wscons_kbd.c index bd19d151..121867d6 100644 --- a/libs/SDL2/src/core/openbsd/SDL_wscons_kbd.c +++ b/libs/SDL2/src/core/openbsd/SDL_wscons_kbd.c @@ -394,6 +394,7 @@ typedef struct { unsigned int text_len; keysym_t composebuffer[2]; unsigned char composelen; + int type; } SDL_WSCONS_input_data; static SDL_WSCONS_input_data* inputs[4] = {NULL, NULL, NULL, NULL}; @@ -432,6 +433,7 @@ static SDL_WSCONS_input_data* SDL_WSCONS_Init_Keyboard(const char* dev) RETIFIOCTLERR(ioctl(input->fd, WSKBDIO_GETLEDS, &input->ledstate)); input->origledstate = input->ledstate; RETIFIOCTLERR(ioctl(input->fd, WSKBDIO_GETENCODING, &input->encoding)); + RETIFIOCTLERR(ioctl(input->fd, WSKBDIO_GTYPE, &input->type)); #ifdef WSKBDIO_SETVERSION RETIFIOCTLERR(ioctl(input->fd, WSKBDIO_SETVERSION, &version)); #endif @@ -725,7 +727,12 @@ static void updateKeyboard(SDL_WSCONS_input_data* input) } break; } - Translate_to_keycode(input, type, events[i].value); + + if (input->type == WSKBD_TYPE_USB && events[i].value <= 0xE7) + SDL_SendKeyboardKey(type == WSCONS_EVENT_KEY_DOWN ? SDL_PRESSED : SDL_RELEASED, (SDL_Scancode)events[i].value); + else + Translate_to_keycode(input, type, events[i].value); + if (type == WSCONS_EVENT_KEY_UP) continue; if (IS_ALTGR_MODE && !IS_CONTROL_HELD) diff --git a/libs/SDL2/src/core/os2/geniconv/geniconv.c b/libs/SDL2/src/core/os2/geniconv/geniconv.c index d4f3fa19..5976fe79 100644 --- a/libs/SDL2/src/core/os2/geniconv/geniconv.c +++ b/libs/SDL2/src/core/os2/geniconv/geniconv.c @@ -46,17 +46,17 @@ extern size_t _System os2_iconv (iconv_t cd, char **outbuf, size_t *outbytesleft); extern int _System os2_iconv_close (iconv_t cd); -/* Functions pointers types */ +/* Functions pointers */ typedef iconv_t (_System *FNICONV_OPEN)(const char*, const char*); typedef size_t (_System *FNICONV) (iconv_t, char **, size_t *, char **, size_t *); typedef int (_System *FNICONV_CLOSE)(iconv_t); -/* Used DLL module handle */ static HMODULE hmIconv = NULLHANDLE; -/* Functions pointers */ -static FNICONV_OPEN fn_iconv_open = NULL; -static FNICONV fn_iconv = NULL; -static FNICONV_CLOSE fn_iconv_close = NULL; +static FNICONV_OPEN fn_iconv_open = os2_iconv_open; +static FNICONV fn_iconv = os2_iconv; +static FNICONV_CLOSE fn_iconv_close = os2_iconv_close; + +static int geniconv_init = 0; static BOOL _loadDLL(const char *dllname, @@ -102,10 +102,12 @@ static BOOL _loadDLL(const char *dllname, static void _init(void) { - if (fn_iconv_open != NULL) { + if (geniconv_init) { return; /* Already initialized */ } + geniconv_init = 1; + /* Try to load kiconv.dll, iconv2.dll or iconv.dll */ if (!_loadDLL("KICONV", "_libiconv_open", "_libiconv", "_libiconv_close") && !_loadDLL("ICONV2", "_libiconv_open", "_libiconv", "_libiconv_close") && @@ -123,16 +125,19 @@ static void _init(void) * ---------------- */ -/* Non-standard function for iconv to unload the used dynamic library */ +/* function to unload the used iconv dynamic library */ void libiconv_clean(void) { + geniconv_init = 0; + + /* reset the function pointers. */ + fn_iconv_open = os2_iconv_open; + fn_iconv = os2_iconv; + fn_iconv_close = os2_iconv_close; + if (hmIconv != NULLHANDLE) { DosFreeModule(hmIconv); hmIconv = NULLHANDLE; - - fn_iconv_open = NULL; - fn_iconv = NULL; - fn_iconv_close = NULL; } } diff --git a/libs/SDL2/src/core/windows/SDL_hid.c b/libs/SDL2/src/core/windows/SDL_hid.c index da941359..d9dd04fb 100644 --- a/libs/SDL2/src/core/windows/SDL_hid.c +++ b/libs/SDL2/src/core/windows/SDL_hid.c @@ -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 @@ WIN_LoadHIDDLL(void) 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 --git a/libs/SDL2/src/core/windows/SDL_hid.h b/libs/SDL2/src/core/windows/SDL_hid.h index 54b9feb5..82a001a2 100644 --- a/libs/SDL2/src/core/windows/SDL_hid.h +++ b/libs/SDL2/src/core/windows/SDL_hid.h @@ -183,8 +183,6 @@ extern int WIN_LoadHIDDLL(void); 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 @@ typedef NTSTATUS (WINAPI *HidP_GetData_t)(HIDP_REPORT_TYPE ReportType, PHIDP_DAT 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 --git a/libs/SDL2/src/core/windows/SDL_windows.c b/libs/SDL2/src/core/windows/SDL_windows.c index 2bdf878d..4ec9dbb6 100644 --- a/libs/SDL2/src/core/windows/SDL_windows.c +++ b/libs/SDL2/src/core/windows/SDL_windows.c @@ -20,12 +20,20 @@ */ #include "../../SDL_internal.h" -#if defined(__WIN32__) || defined(__WINRT__) +#if defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__) #include "SDL_windows.h" #include "SDL_error.h" -#include /* for CoInitialize/CoUninitialize (Win32 only) */ +#include /* for CoInitialize/CoUninitialize (Win32 only) */ +#if defined(HAVE_ROAPI_H) +#include /* For RoInitialize/RoUninitialize (Win32 only) */ +#else +typedef enum RO_INIT_TYPE { + RO_INIT_SINGLETHREADED = 0, + RO_INIT_MULTITHREADED = 1 +} RO_INIT_TYPE; +#endif #ifndef _WIN32_WINNT_VISTA #define _WIN32_WINNT_VISTA 0x0600 @@ -37,6 +45,10 @@ #define _WIN32_WINNT_WIN8 0x0602 #endif +#ifndef LOAD_LIBRARY_SEARCH_SYSTEM32 +#define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800 +#endif + /* Sets an error message based on an HRESULT */ int @@ -84,6 +96,9 @@ WIN_CoInitialize(void) 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) { @@ -109,6 +124,65 @@ WIN_CoUninitialize(void) } #ifndef __WINRT__ +void * +WIN_LoadComBaseFunction(const char *name) +{ + static SDL_bool s_bLoaded; + static HMODULE s_hComBase; + + if (!s_bLoaded) { + s_hComBase = LoadLibraryEx(TEXT("combase.dll"), NULL, LOAD_LIBRARY_SEARCH_SYSTEM32); + s_bLoaded = SDL_TRUE; + } + if (s_hComBase) { + return GetProcAddress(s_hComBase, name); + } else { + return NULL; + } +} +#endif + +HRESULT +WIN_RoInitialize(void) +{ +#ifdef __WINRT__ + return S_OK; +#else + typedef HRESULT (WINAPI *RoInitialize_t)(RO_INIT_TYPE initType); + RoInitialize_t RoInitializeFunc = (RoInitialize_t)WIN_LoadComBaseFunction("RoInitialize"); + if (RoInitializeFunc) { + /* RO_INIT_SINGLETHREADED is equivalent to COINIT_APARTMENTTHREADED */ + HRESULT hr = RoInitializeFunc(RO_INIT_SINGLETHREADED); + if (hr == RPC_E_CHANGED_MODE) { + hr = RoInitializeFunc(RO_INIT_MULTITHREADED); + } + + /* S_FALSE means success, but someone else already initialized. */ + /* You still need to call RoUninitialize in this case! */ + if (hr == S_FALSE) { + return S_OK; + } + + return hr; + } else { + return E_NOINTERFACE; + } +#endif +} + +void +WIN_RoUninitialize(void) +{ +#ifndef __WINRT__ + typedef void (WINAPI *RoUninitialize_t)(void); + RoUninitialize_t RoUninitializeFunc = (RoUninitialize_t)WIN_LoadComBaseFunction("RoUninitialize"); + if (RoUninitializeFunc) { + RoUninitializeFunc(); + } +#endif +} + +#if !defined(__WINRT__) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) static BOOL IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor) { @@ -132,7 +206,7 @@ IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServiceP 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); @@ -141,7 +215,7 @@ BOOL WIN_IsWindowsVistaOrGreater(void) 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); @@ -150,7 +224,7 @@ BOOL WIN_IsWindows7OrGreater(void) 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); @@ -181,8 +255,8 @@ WASAPI doesn't need this. This is just for DirectSound/WinMM. 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; @@ -267,6 +341,6 @@ WIN_RectToRECT(const SDL_Rect *sdlrect, RECT *winrect) 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 --git a/libs/SDL2/src/core/windows/SDL_windows.h b/libs/SDL2/src/core/windows/SDL_windows.h index 221c3bd8..e2d62edd 100644 --- a/libs/SDL2/src/core/windows/SDL_windows.h +++ b/libs/SDL2/src/core/windows/SDL_windows.h @@ -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,16 +89,30 @@ #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); /* Sets an error message based on GetLastError(). Always return -1. */ extern int WIN_SetError(const char *prefix); +#if !defined(__WINRT__) +/* Load a function from combase.dll */ +void *WIN_LoadComBaseFunction(const char *name); +#endif + /* Wrap up the oddities of CoInitialize() into a common function. */ extern HRESULT WIN_CoInitialize(void); extern void WIN_CoUninitialize(void); +/* Wrap up the oddities of RoInitialize() into a common function. */ +extern HRESULT WIN_RoInitialize(void); +extern void WIN_RoUninitialize(void); + /* Returns SDL_TRUE if we're running on Windows Vista and newer */ extern BOOL WIN_IsWindowsVistaOrGreater(void); @@ -87,6 +133,11 @@ extern BOOL WIN_IsEqualIID(REFIID a, REFIID b); 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 --git a/libs/SDL2/src/core/windows/SDL_xinput.c b/libs/SDL2/src/core/windows/SDL_xinput.c index 1893907e..8b9c26ef 100644 --- a/libs/SDL2/src/core/windows/SDL_xinput.c +++ b/libs/SDL2/src/core/windows/SDL_xinput.c @@ -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 HANDLE s_pXInputDLL = 0; static int s_XInputDLLRefCount = 0; -#ifdef __WINRT__ +#if defined(__WINRT__) || defined(__XBOXONE__) || defined(__XBOXSERIES__) int WIN_LoadXInputDLL(void) @@ -68,7 +70,7 @@ WIN_UnloadXInputDLL(void) { } -#else /* !__WINRT__ */ +#else /* !(defined(__WINRT__) || defined(__XBOXONE__) || defined(__XBOXSERIES__)) */ int WIN_LoadXInputDLL(void) @@ -137,6 +139,10 @@ WIN_UnloadXInputDLL(void) } #endif /* __WINRT__ */ -#endif /* HAVE_XINPUT_H */ + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif /* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/core/windows/SDL_xinput.h b/libs/SDL2/src/core/windows/SDL_xinput.h index 6e72327d..461d99b4 100644 --- a/libs/SDL2/src/core/windows/SDL_xinput.h +++ b/libs/SDL2/src/core/windows/SDL_xinput.h @@ -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 @@ typedef struct 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 XInputGetCapabilities_t SDL_XInputGetCapabilities; 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 --git a/libs/SDL2/src/core/winrt/SDL_winrtapp_xaml.cpp b/libs/SDL2/src/core/winrt/SDL_winrtapp_xaml.cpp index b64c5059..69716e11 100644 --- a/libs/SDL2/src/core/winrt/SDL_winrtapp_xaml.cpp +++ b/libs/SDL2/src/core/winrt/SDL_winrtapp_xaml.cpp @@ -115,7 +115,7 @@ SDL_WinRTInitXAMLApp(int (*mainFunction)(int, char **), void * backgroundPanelAs // Make sure we have a valid XAML element (to draw onto): if ( ! backgroundPanelAsIInspectable) { - return SDL_SetError("'backgroundPanelAsIInspectable' can't be NULL"); + return SDL_InvalidParamError("backgroundPanelAsIInspectable"); } Platform::Object ^ backgroundPanel = reinterpret_cast((IInspectable *) backgroundPanelAsIInspectable); diff --git a/libs/SDL2/src/cpuinfo/SDL_cpuinfo.c b/libs/SDL2/src/cpuinfo/SDL_cpuinfo.c index babbb816..8221f779 100644 --- a/libs/SDL2/src/cpuinfo/SDL_cpuinfo.c +++ b/libs/SDL2/src/cpuinfo/SDL_cpuinfo.c @@ -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 @@ CPU_haveCPUID(void) { 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 @@ done: ); #endif #endif -/* *INDENT-ON* */ +/* *INDENT-ON* */ /* clang-format on */ return has_CPUID; } @@ -446,7 +456,7 @@ CPU_haveNEON(void) 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 @@ CPU_haveNEON(void) #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 @@ SDL_GetCPUCount(void) 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_GetCPUFeatures(void) 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 @@ SDL_HasNEON(void) 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 @@ SDL_GetSystemRAM(void) } } #endif -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__GDK__) if (SDL_SystemRAM <= 0) { MEMORYSTATUSEX stat; stat.dwLength = sizeof(stat); @@ -1038,6 +1085,12 @@ SDL_GetSystemRAM(void) 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 @@ void * 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 @@ void * 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 @@ SDL_SIMDRealloc(void *mem, const size_t len) 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 @@ main() 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 --git a/libs/SDL2/src/dynapi/SDL2.exports b/libs/SDL2/src/dynapi/SDL2.exports new file mode 100644 index 00000000..746b5fc9 --- /dev/null +++ b/libs/SDL2/src/dynapi/SDL2.exports @@ -0,0 +1,854 @@ +# 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' diff --git a/libs/SDL2/src/dynapi/SDL_dynapi.c b/libs/SDL2/src/dynapi/SDL_dynapi.c index 38df73c3..d3f7f612 100644 --- a/libs/SDL2/src/dynapi/SDL_dynapi.c +++ b/libs/SDL2/src/dynapi/SDL_dynapi.c @@ -71,11 +71,28 @@ static void SDL_InitDynamicAPI(void); #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); \ + 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); \ - return jump_table.SDL_SetError("%s", buf); \ + 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 @@ static void dynapi_warn(const char *msg) { 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 --git a/libs/SDL2/src/dynapi/SDL_dynapi.h b/libs/SDL2/src/dynapi/SDL_dynapi.h index 452078b1..dc53e58b 100644 --- a/libs/SDL2/src/dynapi/SDL_dynapi.h +++ b/libs/SDL2/src/dynapi/SDL_dynapi.h @@ -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 --git a/libs/SDL2/src/dynapi/SDL_dynapi_overrides.h b/libs/SDL2/src/dynapi/SDL_dynapi_overrides.h index 53bb4d4f..babe19e0 100644 --- a/libs/SDL2/src/dynapi/SDL_dynapi_overrides.h +++ b/libs/SDL2/src/dynapi/SDL_dynapi_overrides.h @@ -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 @@ -855,3 +851,30 @@ #define SDL_GameControllerHasRumbleTriggers SDL_GameControllerHasRumbleTriggers_REAL #define SDL_hid_ble_scan SDL_hid_ble_scan_REAL #define SDL_PremultiplyAlpha SDL_PremultiplyAlpha_REAL +#define SDL_AndroidSendMessage SDL_AndroidSendMessage_REAL +#define SDL_GetTouchName SDL_GetTouchName_REAL +#define SDL_ClearComposition SDL_ClearComposition_REAL +#define SDL_IsTextInputShown SDL_IsTextInputShown_REAL +#define SDL_HasIntersectionF SDL_HasIntersectionF_REAL +#define SDL_IntersectFRect SDL_IntersectFRect_REAL +#define SDL_UnionFRect SDL_UnionFRect_REAL +#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 diff --git a/libs/SDL2/src/dynapi/SDL_dynapi_procs.h b/libs/SDL2/src/dynapi/SDL_dynapi_procs.h index 000cde80..4c61f19d 100644 --- a/libs/SDL2/src/dynapi/SDL_dynapi_procs.h +++ b/libs/SDL2/src/dynapi/SDL_dynapi_procs.h @@ -48,7 +48,7 @@ SDL_DYNAPI_PROC(int,SDL_snprintf,(SDL_OUT_Z_CAP(b) char *a, size_t b, SDL_PRINTF #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,(FILE *a, SDL_bool b),(a,b),return) 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 @@ -408,7 +411,7 @@ SDL_DYNAPI_PROC(void*,SDL_realloc,(void *a, size_t b),(a,b),return) 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_WaitThread,(SDL_Thread *a, int *b),(a,b),) 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(void,SDL_GL_ResetAttributes,(void),(),) 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(int,SDL_QueueAudio,(SDL_AudioDeviceID a, const void *b, Uint32 c 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 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_HasColorKey,(SDL_Surface *a),(a),return) #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(float,SDL_roundf,(float a),(a),return) 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) @@ -924,3 +927,37 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_GameControllerHasRumble,(SDL_GameController *a),(a) SDL_DYNAPI_PROC(SDL_bool,SDL_GameControllerHasRumbleTriggers,(SDL_GameController *a),(a),return) SDL_DYNAPI_PROC(void,SDL_hid_ble_scan,(SDL_bool a),(a),) SDL_DYNAPI_PROC(int,SDL_PremultiplyAlpha,(int a, int b, Uint32 c, const void *d, int e, Uint32 f, void *g, int h),(a,b,c,d,e,f,g,h),return) +#ifdef __ANDROID__ +SDL_DYNAPI_PROC(int,SDL_AndroidSendMessage,(Uint32 a, int b),(a,b),return) +#endif +SDL_DYNAPI_PROC(const char*,SDL_GetTouchName,(int a),(a),return) +SDL_DYNAPI_PROC(void,SDL_ClearComposition,(void),(),) +SDL_DYNAPI_PROC(SDL_bool,SDL_IsTextInputShown,(void),(),return) +SDL_DYNAPI_PROC(SDL_bool,SDL_HasIntersectionF,(const SDL_FRect *a, const SDL_FRect *b),(a,b),return) +SDL_DYNAPI_PROC(SDL_bool,SDL_IntersectFRect,(const SDL_FRect *a, const SDL_FRect *b, SDL_FRect *c),(a,b,c),return) +SDL_DYNAPI_PROC(void,SDL_UnionFRect,(const SDL_FRect *a, const SDL_FRect *b, SDL_FRect *c),(a,b,c),) +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),) diff --git a/libs/SDL2/src/dynapi/gendynapi.pl b/libs/SDL2/src/dynapi/gendynapi.pl index b99a8a49..a9ff9723 100755 --- a/libs/SDL2/src/dynapi/gendynapi.pl +++ b/libs/SDL2/src/dynapi/gendynapi.pl @@ -33,6 +33,7 @@ use File::Basename; 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 @@ if (-f $sdl_dynapi_procs_h) { 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 @@ while (my $d = readdir(HEADERS)) { 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 @@ closedir(HEADERS); close(SDL_DYNAPI_PROCS_H); close(SDL_DYNAPI_OVERRIDES_H); +close(SDL2_EXPORTS); # vi: set ts=4 sw=4 expandtab: diff --git a/libs/SDL2/src/events/SDL_events.c b/libs/SDL2/src/events/SDL_events.c index 220fe177..6e5ee319 100644 --- a/libs/SDL2/src/events/SDL_events.c +++ b/libs/SDL2/src/events/SDL_events.c @@ -35,7 +35,7 @@ #include "SDL_syswm.h" #undef SDL_PRIs64 -#ifdef __WIN32__ +#if (defined(__WIN32__) || defined(__GDK__)) && !defined(__CYGWIN__) #define SDL_PRIs64 "I64d" #else #define SDL_PRIs64 "lld" @@ -150,13 +150,19 @@ SDL_PollSentinelChanged(void *userdata, const char *name, const char *oldValue, 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 @@ SDL_LogEvent(const SDL_Event *event) 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 @@ SDL_LogEvent(const SDL_Event *event) 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 @@ -206,11 +217,28 @@ SDL_LogEvent(const SDL_Event *event) SDL_EVENT_CASE(SDL_APP_DIDENTERBACKGROUND) break; SDL_EVENT_CASE(SDL_APP_WILLENTERFOREGROUND) break; SDL_EVENT_CASE(SDL_APP_DIDENTERFOREGROUND) break; + SDL_EVENT_CASE(SDL_LOCALECHANGED) break; SDL_EVENT_CASE(SDL_KEYMAPCHANGED) break; SDL_EVENT_CASE(SDL_CLIPBOARDUPDATE) break; SDL_EVENT_CASE(SDL_RENDER_TARGETS_RESET) break; SDL_EVENT_CASE(SDL_RENDER_DEVICE_RESET) break; + SDL_EVENT_CASE(SDL_DISPLAYEVENT) { + char name2[64]; + switch (event->display.event) { + case SDL_DISPLAYEVENT_NONE: SDL_strlcpy(name2, "SDL_DISPLAYEVENT_NONE (THIS IS PROBABLY A BUG!)", sizeof(name2)); break; + #define SDL_DISPLAYEVENT_CASE(x) case x: SDL_strlcpy(name2, #x, sizeof (name2)); break + SDL_DISPLAYEVENT_CASE(SDL_DISPLAYEVENT_ORIENTATION); + SDL_DISPLAYEVENT_CASE(SDL_DISPLAYEVENT_CONNECTED); + SDL_DISPLAYEVENT_CASE(SDL_DISPLAYEVENT_DISCONNECTED); + #undef SDL_DISPLAYEVENT_CASE + default: SDL_strlcpy(name2, "UNKNOWN (bug? fixme?)", sizeof(name2)); break; + } + SDL_snprintf(details, sizeof (details), " (timestamp=%u display=%u event=%s data1=%d)", + (uint) event->display.timestamp, (uint) event->display.display, name2, (int) event->display.data1); + break; + } + SDL_EVENT_CASE(SDL_WINDOWEVENT) { char name2[64]; switch(event->window.event) { @@ -232,6 +260,8 @@ SDL_LogEvent(const SDL_Event *event) SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_CLOSE); SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_TAKE_FOCUS); SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_HIT_TEST); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_ICCPROF_CHANGED); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_DISPLAY_CHANGED); #undef SDL_WINDOWEVENT_CASE default: SDL_strlcpy(name2, "UNKNOWN (bug? fixme?)", sizeof (name2)); break; } @@ -571,7 +601,7 @@ SDL_AddEvent(SDL_Event * event) SDL_EventQ.free = entry->next; } - if (SDL_DoEventLogging) { + if (SDL_EventLoggingVerbosity > 0) { SDL_LogEvent(event); } @@ -660,12 +690,12 @@ static int SDL_PeepEventsInternal(SDL_Event * events, int numevents, SDL_eventaction action, Uint32 minType, Uint32 maxType, SDL_bool include_sentinel) { - int i, used; + int i, used, sentinels_expected = 0; /* Don't look after we've quit */ if (!SDL_AtomicGet(&SDL_EventQ.active)) { /* We get a few spurious events at shutdown, so don't warn then */ - if (action != SDL_ADDEVENT) { + if (action == SDL_GETEVENT) { SDL_SetError("The event system has been shut down"); } return (-1); @@ -723,8 +753,15 @@ SDL_PeepEventsInternal(SDL_Event * events, int numevents, SDL_eventaction action } if (type == SDL_POLLSENTINEL) { /* Special handling for the sentinel event */ - if (!include_sentinel || SDL_AtomicGet(&SDL_sentinel_pending) > 0) { - /* Skip it, we don't want to include it or there's another one pending */ + if (!include_sentinel) { + /* Skip it, we don't want to include it */ + continue; + } + if (!events || action != SDL_GETEVENT) { + ++sentinels_expected; + } + if (SDL_AtomicGet(&SDL_sentinel_pending) > sentinels_expected) { + /* Skip it, there's another one pending */ continue; } } @@ -891,7 +928,11 @@ SDL_WaitEventTimeout_Device(_THIS, SDL_Window *wakeup_window, SDL_Event * event, c) Periodic processing that takes place in some platform PumpEvents() functions happens d) Signals received in WaitEventTimeout() are turned into SDL events */ - SDL_PumpEventsInternal(SDL_TRUE); + /* We only want a single sentinel in the queue. We could get more than one if event is NULL, + * since the SDL_PeepEvents() call below won't remove it in that case. + */ + SDL_bool add_sentinel = (SDL_AtomicGet(&SDL_sentinel_pending) == 0) ? SDL_TRUE : SDL_FALSE; + SDL_PumpEventsInternal(add_sentinel); if (!_this->wakeup_lock || SDL_LockMutex(_this->wakeup_lock) == 0) { int status = SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT); @@ -932,7 +973,10 @@ SDL_WaitEventTimeout_Device(_THIS, SDL_Window *wakeup_window, SDL_Event * event, 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; } @@ -987,6 +1031,7 @@ SDL_WaitEventTimeout(SDL_Event * event, int timeout) SDL_Window *wakeup_window; Uint32 start, expiration; SDL_bool include_sentinel = (timeout == 0) ? SDL_TRUE : SDL_FALSE; + int result; /* If there isn't a poll sentinel event pending, pump events and add one */ if (SDL_AtomicGet(&SDL_sentinel_pending) == 0) { @@ -994,33 +1039,34 @@ SDL_WaitEventTimeout(SDL_Event * event, int timeout) } /* First check for existing events */ - switch (SDL_PeepEventsInternal(event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT, include_sentinel)) { - case -1: + result = SDL_PeepEventsInternal(event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT, include_sentinel); + if (result < 0) { return 0; - case 0: + } + if (include_sentinel) { + if (event) { + if (event->type == SDL_POLLSENTINEL) { + /* Reached the end of a poll cycle, and not willing to wait */ + return 0; + } + } else { + /* Need to peek the next event to check for sentinel */ + SDL_Event dummy; + + if (SDL_PeepEventsInternal(&dummy, 1, SDL_PEEKEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT, SDL_TRUE) && + dummy.type == SDL_POLLSENTINEL) { + SDL_PeepEventsInternal(&dummy, 1, SDL_GETEVENT, SDL_POLLSENTINEL, SDL_POLLSENTINEL, SDL_TRUE); + /* Reached the end of a poll cycle, and not willing to wait */ + return 0; + } + } + } + if (result == 0) { if (timeout == 0) { /* No events available, and not willing to wait */ return 0; } - break; - default: - if (include_sentinel) { - if (event) { - if (event->type == SDL_POLLSENTINEL) { - /* Reached the end of a poll cycle, and not willing to wait */ - return 0; - } - } else { - /* Need to peek the next event to check for sentinel */ - SDL_Event dummy; - - if (SDL_PeepEventsInternal(&dummy, 1, SDL_PEEKEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT, SDL_TRUE) && - dummy.type == SDL_POLLSENTINEL) { - /* Reached the end of a poll cycle, and not willing to wait */ - return 0; - } - } - } + } else { /* Has existing events */ return 1; } @@ -1232,8 +1278,7 @@ SDL_FilterEvents(SDL_EventFilter filter, void *userdata) Uint8 SDL_EventState(Uint32 type, int state) { - const SDL_bool isdnd = ((state == SDL_DISABLE) || (state == SDL_ENABLE)) && - ((type == SDL_DROPFILE) || (type == SDL_DROPTEXT)); + const SDL_bool isde = (state == SDL_DISABLE) || (state == SDL_ENABLE); Uint8 current_state; Uint8 hi = ((type >> 8) & 0xff); Uint8 lo = (type & 0xff); @@ -1245,44 +1290,32 @@ SDL_EventState(Uint32 type, int state) current_state = SDL_ENABLE; } - if (state != current_state) - { - switch (state) { - case SDL_DISABLE: + if (isde && state != current_state) { + if (state == SDL_DISABLE) { /* Disable this event type and discard pending events */ if (!SDL_disabled_events[hi]) { SDL_disabled_events[hi] = (SDL_DisabledEventBlock*) SDL_calloc(1, sizeof(SDL_DisabledEventBlock)); - if (!SDL_disabled_events[hi]) { - /* Out of memory, nothing we can do... */ - break; - } } - SDL_disabled_events[hi]->bits[lo/32] |= (1 << (lo&31)); - SDL_FlushEvent(type); - break; - case SDL_ENABLE: + /* Out of memory, nothing we can do... */ + if (SDL_disabled_events[hi]) { + SDL_disabled_events[hi]->bits[lo/32] |= (1 << (lo&31)); + SDL_FlushEvent(type); + } + } else { // state == SDL_ENABLE SDL_disabled_events[hi]->bits[lo/32] &= ~(1 << (lo&31)); - break; - default: - /* Querying state... */ - break; } #if !SDL_JOYSTICK_DISABLED - if (state == SDL_DISABLE || state == SDL_ENABLE) { - SDL_CalculateShouldUpdateJoysticks(); - } + SDL_CalculateShouldUpdateJoysticks(); #endif #if !SDL_SENSOR_DISABLED - if (state == SDL_DISABLE || state == SDL_ENABLE) { - SDL_CalculateShouldUpdateSensors(); - } + SDL_CalculateShouldUpdateSensors(); #endif } /* turn off drag'n'drop support if we've disabled the events. This might change some UI details at the OS level. */ - if (isdnd) { + if (isde && ((type == SDL_DROPFILE) || (type == SDL_DROPTEXT))) { SDL_ToggleDragAndDropSupport(); } diff --git a/libs/SDL2/src/events/SDL_gesture.c b/libs/SDL2/src/events/SDL_gesture.c index 8d97f313..2cdb0d59 100644 --- a/libs/SDL2/src/events/SDL_gesture.c +++ b/libs/SDL2/src/events/SDL_gesture.c @@ -488,7 +488,7 @@ int SDL_GestureDelTouch(SDL_TouchID touchId) 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 --git a/libs/SDL2/src/events/SDL_keyboard.c b/libs/SDL2/src/events/SDL_keyboard.c index 3400ca0c..aa75f5d8 100644 --- a/libs/SDL2/src/events/SDL_keyboard.c +++ b/libs/SDL2/src/events/SDL_keyboard.c @@ -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 @@ static const SDL_Keycode SDL_default_keymap[SDL_NUM_SCANCODES] = { 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 @@ static const char *SDL_scancode_names[SDL_NUM_SCANCODES] = { "App2", "AudioRewind", "AudioFastForward", + "SoftLeft", + "SoftRight", + "Call", + "EndCall", }; /* Taken from SDL_iconv() */ @@ -638,6 +647,7 @@ SDL_SetKeyboardFocus(SDL_Window * window) /* old window must lose an existing mouse capture. */ if (keyboard->focus->flags & SDL_WINDOW_MOUSE_CAPTURE) { SDL_CaptureMouse(SDL_FALSE); /* drop the capture. */ + SDL_UpdateMouseCapture(SDL_TRUE); SDL_assert(!(keyboard->focus->flags & SDL_WINDOW_MOUSE_CAPTURE)); } @@ -810,6 +820,33 @@ SDL_SendKeyboardKeyInternal(Uint8 source, Uint8 state, SDL_Scancode scancode) return (posted); } +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) { @@ -867,10 +904,14 @@ SDL_SendKeyboardText(const char *text) posted = 0; if (SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE) { SDL_Event event; + size_t i = 0, length = SDL_strlen(text); + event.text.type = SDL_TEXTINPUT; event.text.windowID = keyboard->focus ? keyboard->focus->id : 0; - SDL_utf8strlcpy(event.text.text, text, SDL_arraysize(event.text.text)); - posted = (SDL_PushEvent(&event) > 0); + while (i < length) { + i += SDL_utf8strlcpy(event.text.text, text + i, SDL_arraysize(event.text.text)); + posted |= (SDL_PushEvent(&event) > 0); + } } return (posted); } @@ -890,6 +931,22 @@ SDL_SendEditingText(const char *text, int start, int length) event.edit.start = start; event.edit.length = length; SDL_utf8strlcpy(event.edit.text, text, SDL_arraysize(event.edit.text)); + + if (SDL_GetHintBoolean(SDL_HINT_IME_SUPPORT_EXTENDED_TEXT, SDL_FALSE) && + SDL_strlen(text) > SDL_arraysize(event.text.text)) { + event.editExt.type = SDL_TEXTEDITING_EXT; + event.editExt.windowID = keyboard->focus ? keyboard->focus->id : 0; + event.editExt.text = text ? SDL_strdup(text) : NULL; + event.editExt.start = start; + event.editExt.length = length; + } else { + event.edit.type = SDL_TEXTEDITING; + event.edit.windowID = keyboard->focus ? keyboard->focus->id : 0; + event.edit.start = start; + event.edit.length = length; + SDL_utf8strlcpy(event.edit.text, text, SDL_arraysize(event.edit.text)); + } + posted = (SDL_PushEvent(&event) > 0); } return (posted); diff --git a/libs/SDL2/src/events/SDL_keyboard_c.h b/libs/SDL2/src/events/SDL_keyboard_c.h index fffd012c..d10158d0 100644 --- a/libs/SDL2/src/events/SDL_keyboard_c.h +++ b/libs/SDL2/src/events/SDL_keyboard_c.h @@ -47,6 +47,11 @@ extern void SDL_SetScancodeName(SDL_Scancode scancode, const char *name); /* 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 --git a/libs/SDL2/src/events/SDL_mouse.c b/libs/SDL2/src/events/SDL_mouse.c index 259ee9f2..45dffc77 100644 --- a/libs/SDL2/src/events/SDL_mouse.c +++ b/libs/SDL2/src/events/SDL_mouse.c @@ -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 @@ SDL_MouseDoubleClickTimeChanged(void *userdata, const char *name, const char *ol 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); @@ -109,6 +109,28 @@ SDL_TouchMouseEventsChanged(void *userdata, const char *name, const char *oldVal mouse->touch_mouse_events = SDL_GetStringBoolean(hint, SDL_TRUE); } +#if defined(__vita__) +static void SDLCALL +SDL_VitaTouchMouseDeviceChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + SDL_Mouse *mouse = (SDL_Mouse *)userdata; + if (hint) { + switch(*hint) { + default: + case '0': + mouse->vita_touch_mouse_device = 0; + break; + case '1': + mouse->vita_touch_mouse_device = 1; + break; + case '2': + mouse->vita_touch_mouse_device = 2; + break; + } + } +} +#endif + static void SDLCALL SDL_MouseTouchEventsChanged(void *userdata, const char *name, const char *oldValue, const char *hint) { @@ -127,6 +149,18 @@ SDL_MouseTouchEventsChanged(void *userdata, const char *name, const char *oldVal } } +static void SDLCALL +SDL_MouseAutoCaptureChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + SDL_Mouse *mouse = (SDL_Mouse *)userdata; + SDL_bool auto_capture = SDL_GetStringBoolean(hint, SDL_TRUE); + + if (auto_capture != mouse->auto_capture) { + mouse->auto_capture = auto_capture; + SDL_UpdateMouseCapture(SDL_FALSE); + } +} + /* Public functions */ int SDL_MouseInit(void) @@ -150,9 +184,17 @@ SDL_MouseInit(void) SDL_AddHintCallback(SDL_HINT_TOUCH_MOUSE_EVENTS, SDL_TouchMouseEventsChanged, mouse); +#if defined(__vita__) + SDL_AddHintCallback(SDL_HINT_VITA_TOUCH_MOUSE_DEVICE, + SDL_VitaTouchMouseDeviceChanged, mouse); +#endif + SDL_AddHintCallback(SDL_HINT_MOUSE_TOUCH_EVENTS, SDL_MouseTouchEventsChanged, mouse); + SDL_AddHintCallback(SDL_HINT_MOUSE_AUTO_CAPTURE, + SDL_MouseAutoCaptureChanged, mouse); + mouse->was_touch_mouse_events = SDL_FALSE; /* no touch to mouse movement event pending */ mouse->cursor_shown = SDL_TRUE; @@ -248,23 +290,10 @@ SDL_UpdateMouseFocus(SDL_Window * window, int x, int y, Uint32 buttonstate, SDL_ } } -/* Linux doesn't give you mouse events outside your window unless you grab - the pointer. - - Windows doesn't give you mouse events outside your window unless you call - SetCapture(). - - Both of these are slightly scary changes, so for now we'll punt and if the - mouse leaves the window you'll lose mouse focus and reset button state. -*/ -#ifdef SUPPORT_DRAG_OUTSIDE_WINDOW - if (!inWindow && !buttonstate) { -#else if (!inWindow) { -#endif if (window == mouse->focus) { #ifdef DEBUG_MOUSE - printf("Mouse left window, synthesizing move & focus lost event\n"); + SDL_Log("Mouse left window, synthesizing move & focus lost event\n"); #endif if (send_mouse_motion) { SDL_PrivateSendMouseMotion(window, mouse->mouseID, 0, x, y); @@ -276,7 +305,7 @@ SDL_UpdateMouseFocus(SDL_Window * window, int x, int y, Uint32 buttonstate, SDL_ if (window != mouse->focus) { #ifdef DEBUG_MOUSE - printf("Mouse entered window, synthesizing focus gain & move event\n"); + SDL_Log("Mouse entered window, synthesizing focus gain & move event\n"); #endif SDL_SetMouseFocus(window); if (send_mouse_motion) { @@ -378,14 +407,12 @@ SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relativ /* Ignore relative motion when first positioning the mouse */ if (!mouse->has_position) { - xrel = 0; - yrel = 0; mouse->x = x; mouse->y = y; mouse->has_position = SDL_TRUE; } else if (!xrel && !yrel) { /* Drop events that don't change state */ #ifdef DEBUG_MOUSE - printf("Mouse event didn't change state - dropped!\n"); + SDL_Log("Mouse event didn't change state - dropped!\n"); #endif return 0; } @@ -533,7 +560,7 @@ SDL_PrivateSendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state Uint32 type; Uint32 buttonstate; SDL_MouseInputSource *source; - + source = GetMouseInputSource(mouse, mouseID); if (!source) { return 0; @@ -633,6 +660,11 @@ SDL_PrivateSendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state SDL_UpdateMouseFocus(window, mouse->x, mouse->y, buttonstate, SDL_TRUE); } + /* Automatically capture the mouse while buttons are pressed */ + if (mouse->auto_capture) { + SDL_UpdateMouseCapture(SDL_FALSE); + } + return posted; } @@ -727,6 +759,7 @@ SDL_MouseQuit(void) if (mouse->CaptureMouse) { SDL_CaptureMouse(SDL_FALSE); + SDL_UpdateMouseCapture(SDL_TRUE); } SDL_SetRelativeMouseMode(SDL_FALSE); SDL_ShowCursor(1); @@ -757,11 +790,26 @@ SDL_MouseQuit(void) } mouse->num_clickstates = 0; + SDL_DelHintCallback(SDL_HINT_MOUSE_DOUBLE_CLICK_TIME, + SDL_MouseDoubleClickTimeChanged, mouse); + + SDL_DelHintCallback(SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS, + SDL_MouseDoubleClickRadiusChanged, mouse); + SDL_DelHintCallback(SDL_HINT_MOUSE_NORMAL_SPEED_SCALE, SDL_MouseNormalSpeedScaleChanged, mouse); SDL_DelHintCallback(SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE, SDL_MouseRelativeSpeedScaleChanged, mouse); + + SDL_DelHintCallback(SDL_HINT_TOUCH_MOUSE_EVENTS, + SDL_TouchMouseEventsChanged, mouse); + + SDL_DelHintCallback(SDL_HINT_MOUSE_TOUCH_EVENTS, + SDL_MouseTouchEventsChanged, mouse); + + SDL_DelHintCallback(SDL_HINT_MOUSE_AUTO_CAPTURE, + SDL_MouseAutoCaptureChanged, mouse); } Uint32 @@ -819,7 +867,7 @@ SDL_GetGlobalMouseState(int *x, int *y) } 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(); @@ -835,6 +883,20 @@ SDL_WarpMouseInWindow(SDL_Window * window, int x, int y) return; } + 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. + */ + mouse->x = x; + mouse->y = y; + mouse->has_position = SDL_TRUE; + return; + } + /* Ignore the previous position when we warp */ mouse->has_position = SDL_FALSE; @@ -846,6 +908,12 @@ SDL_WarpMouseInWindow(SDL_Window * window, int x, int y) } } +void +SDL_WarpMouseInWindow(SDL_Window * window, int x, int y) +{ + SDL_PerformWarpMouseInWindow(window, x, y, SDL_FALSE); +} + int SDL_WarpMouseGlobal(int x, int y) { @@ -905,8 +973,9 @@ SDL_SetRelativeMouseMode(SDL_bool enabled) 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) { @@ -914,8 +983,10 @@ SDL_SetRelativeMouseMode(SDL_bool enabled) /* 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); } if (!enabled) { @@ -937,39 +1008,84 @@ SDL_GetRelativeMouseMode() return mouse->relative_mode; } +int +SDL_UpdateMouseCapture(SDL_bool force_release) +{ + SDL_Mouse *mouse = SDL_GetMouse(); + SDL_Window *capture_window = NULL; + + if (!mouse->CaptureMouse) { + return 0; + } + + if (!force_release) { + if (SDL_GetMessageBoxCount() == 0 && + (mouse->capture_desired || (mouse->auto_capture && SDL_GetMouseState(NULL, NULL) != 0))) { + if (!mouse->relative_mode) { + capture_window = SDL_GetKeyboardFocus(); + } + } + } + + if (capture_window != mouse->capture_window) { + /* 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) { + 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; +} + int SDL_CaptureMouse(SDL_bool enabled) { SDL_Mouse *mouse = SDL_GetMouse(); - SDL_Window *focusWindow; - SDL_bool isCaptured; if (!mouse->CaptureMouse) { return SDL_Unsupported(); } - focusWindow = SDL_GetKeyboardFocus(); - - isCaptured = focusWindow && (focusWindow->flags & SDL_WINDOW_MOUSE_CAPTURE); - if (isCaptured == enabled) { - return 0; /* already done! */ +#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) { - if (!focusWindow) { - return SDL_SetError("No window has focus"); - } else if (mouse->CaptureMouse(focusWindow) == -1) { - return -1; /* CaptureMouse() should call SetError */ - } - focusWindow->flags |= SDL_WINDOW_MOUSE_CAPTURE; - } else { - if (mouse->CaptureMouse(NULL) == -1) { - return -1; /* CaptureMouse() should call SetError */ - } - focusWindow->flags &= ~SDL_WINDOW_MOUSE_CAPTURE; + if (enabled && SDL_GetKeyboardFocus() == NULL) { + return SDL_SetError("No window has focus"); } + mouse->capture_desired = enabled; - return 0; + return SDL_UpdateMouseCapture(SDL_FALSE); } SDL_Cursor * @@ -1029,7 +1145,7 @@ SDL_CreateColorCursor(SDL_Surface *surface, int hot_x, int hot_y) SDL_Cursor *cursor; if (!surface) { - SDL_SetError("Passed NULL cursor surface"); + SDL_InvalidParamError("surface"); return NULL; } diff --git a/libs/SDL2/src/events/SDL_mouse_c.h b/libs/SDL2/src/events/SDL_mouse_c.h index b7fb9fd5..70c32085 100644 --- a/libs/SDL2/src/events/SDL_mouse_c.h +++ b/libs/SDL2/src/events/SDL_mouse_c.h @@ -100,6 +100,12 @@ typedef struct SDL_bool touch_mouse_events; SDL_bool mouse_touch_events; SDL_bool was_touch_mouse_events; /* Was a touch-mouse event pending? */ +#if defined(__vita__) + Uint8 vita_touch_mouse_device; +#endif + SDL_bool auto_capture; + SDL_bool capture_desired; + SDL_Window *capture_window; /* Data for input source state */ int num_sources; @@ -131,6 +137,9 @@ extern void SDL_SetDefaultCursor(SDL_Cursor * cursor); /* Set the mouse focus window */ extern void SDL_SetMouseFocus(SDL_Window * window); +/* Update the mouse capture window */ +extern int SDL_UpdateMouseCapture(SDL_bool force_release); + /* Send a mouse motion event */ extern int SDL_SendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int x, int y); @@ -143,6 +152,9 @@ extern int SDL_SendMouseButtonClicks(SDL_Window * window, SDL_MouseID mouseID, U /* 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 --git a/libs/SDL2/src/events/SDL_touch.c b/libs/SDL2/src/events/SDL_touch.c index 8b1cf3a6..ebf26e09 100644 --- a/libs/SDL2/src/events/SDL_touch.c +++ b/libs/SDL2/src/events/SDL_touch.c @@ -63,6 +63,16 @@ SDL_GetTouchDevice(int index) return SDL_touchDevices[index]->id; } +const char* +SDL_GetTouchName(int index) +{ + if (index < 0 || index >= SDL_num_touch) { + SDL_SetError("Unknown touch device"); + return NULL; + } + return SDL_touchDevices[index]->name; +} + static int SDL_GetTouchIndex(SDL_TouchID id) { @@ -185,6 +195,7 @@ SDL_AddTouch(SDL_TouchID touchID, SDL_TouchDeviceType type, const char *name) SDL_touchDevices[index]->num_fingers = 0; SDL_touchDevices[index]->max_fingers = 0; SDL_touchDevices[index]->fingers = NULL; + SDL_touchDevices[index]->name = SDL_strdup(name ? name : ""); /* Record this touch device for gestures */ /* We could do this on the fly in the gesture code if we wanted */ @@ -254,8 +265,13 @@ SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window, #if SYNTHESIZE_TOUCH_TO_MOUSE /* SDL_HINT_TOUCH_MOUSE_EVENTS: controlling whether touch events should generate synthetic mouse events */ + /* SDL_HINT_VITA_TOUCH_MOUSE_DEVICE: controlling which touchpad should generate synthetic mouse events, PSVita-only */ { +#if defined(__vita__) + if (mouse->touch_mouse_events && ((mouse->vita_touch_mouse_device == id) || (mouse->vita_touch_mouse_device == 2)) ) { +#else if (mouse->touch_mouse_events) { +#endif /* FIXME: maybe we should only restrict to a few SDL_TouchDeviceType */ if (id != SDL_MOUSE_TOUCHID) { if (window) { @@ -302,8 +318,9 @@ SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window, finger = SDL_GetFinger(touch, fingerid); if (down) { if (finger) { - /* This finger is already down */ - return 0; + /* This finger is already down. + Assume the finger-up for the previous touch was lost, and send it. */ + SDL_SendTouch(id, fingerid, window, SDL_FALSE, x, y, pressure); } if (SDL_AddFinger(touch, fingerid, x, y, pressure) < 0) { @@ -451,6 +468,7 @@ SDL_DelTouch(SDL_TouchID id) SDL_free(touch->fingers[i]); } SDL_free(touch->fingers); + SDL_free(touch->name); SDL_free(touch); SDL_num_touch--; diff --git a/libs/SDL2/src/events/SDL_touch_c.h b/libs/SDL2/src/events/SDL_touch_c.h index c9d9a326..4d5caf13 100644 --- a/libs/SDL2/src/events/SDL_touch_c.h +++ b/libs/SDL2/src/events/SDL_touch_c.h @@ -31,6 +31,7 @@ typedef struct SDL_Touch int num_fingers; int max_fingers; SDL_Finger** fingers; + char *name; } SDL_Touch; diff --git a/libs/SDL2/src/events/SDL_windowevents.c b/libs/SDL2/src/events/SDL_windowevents.c index cb82d4ff..cc8b891d 100644 --- a/libs/SDL2/src/events/SDL_windowevents.c +++ b/libs/SDL2/src/events/SDL_windowevents.c @@ -25,7 +25,7 @@ #include "SDL_events.h" #include "SDL_events_c.h" #include "SDL_mouse_c.h" - +#include "SDL_hints.h" static int SDLCALL RemovePendingSizeChangedAndResizedEvents(void * userdata, SDL_Event *event) @@ -201,8 +201,9 @@ SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent, int data1, if (windowevent == SDL_WINDOWEVENT_CLOSE) { if ( !window->prev && !window->next ) { - /* This is the last window in the list so send the SDL_QUIT event */ - SDL_SendQuit(); + if (SDL_GetHintBoolean(SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE, SDL_TRUE)) { + SDL_SendQuit(); /* This is the last window in the list so send the SDL_QUIT event */ + } } } diff --git a/libs/SDL2/src/events/scancodes_ascii.h b/libs/SDL2/src/events/scancodes_ascii.h new file mode 100644 index 00000000..c30cddca --- /dev/null +++ b/libs/SDL2/src/events/scancodes_ascii.h @@ -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 --git a/libs/SDL2/src/events/scancodes_darwin.h b/libs/SDL2/src/events/scancodes_darwin.h index a511e11c..75564112 100644 --- a/libs/SDL2/src/events/scancodes_darwin.h +++ b/libs/SDL2/src/events/scancodes_darwin.h @@ -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 @@ static const SDL_Scancode darwin_scancode_table[] = { /* 126 */ SDL_SCANCODE_UP, /* 127 */ SDL_SCANCODE_POWER }; -/* *INDENT-ON* */ +/* *INDENT-ON* */ /* clang-format on */ diff --git a/libs/SDL2/src/events/scancodes_linux.h b/libs/SDL2/src/events/scancodes_linux.h index 72637b23..f274e993 100644 --- a/libs/SDL2/src/events/scancodes_linux.h +++ b/libs/SDL2/src/events/scancodes_linux.h @@ -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 @@ static SDL_Scancode const linux_scancode_table[] = { /* 235 */ SDL_SCANCODE_UNKNOWN, /* KEY_DOCUMENTS */ /* 236 */ SDL_SCANCODE_UNKNOWN, /* KEY_BATTERY */ }; -/* *INDENT-ON* */ +/* *INDENT-ON* */ /* clang-format on */ diff --git a/libs/SDL2/src/events/scancodes_windows.h b/libs/SDL2/src/events/scancodes_windows.h index eec768d6..9fc7067a 100644 --- a/libs/SDL2/src/events/scancodes_windows.h +++ b/libs/SDL2/src/events/scancodes_windows.h @@ -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 @@ static const SDL_Scancode windows_scancode_table[] = 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 --git a/libs/SDL2/src/events/scancodes_xfree86.h b/libs/SDL2/src/events/scancodes_xfree86.h index 7046b7a8..1ce2a8c5 100644 --- a/libs/SDL2/src/events/scancodes_xfree86.h +++ b/libs/SDL2/src/events/scancodes_xfree86.h @@ -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 @@ static const SDL_Scancode xvnc_scancode_table[] = { #endif /* scancodes_xfree86_h_ */ -/* *INDENT-ON* */ +/* *INDENT-ON* */ /* clang-format on */ diff --git a/libs/SDL2/src/file/SDL_rwops.c b/libs/SDL2/src/file/SDL_rwops.c index 5187fae0..a93c2fb3 100644 --- a/libs/SDL2/src/file/SDL_rwops.c +++ b/libs/SDL2/src/file/SDL_rwops.c @@ -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 @@ vita_file_close(SDL_RWops * context) 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 @@ windows_file_open(SDL_RWops * context, const char *filename, const char *mode) 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 @@ windows_file_open(SDL_RWops * context, const char *filename, const char *mode) 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 @@ windows_file_close(SDL_RWops * context) } return 0; } -#endif /* __WIN32__ */ +#endif /* defined(__WIN32__) || defined(__GDK__) */ #ifdef HAVE_STDIO_H @@ -803,7 +580,7 @@ SDL_RWFromFile(const char *file, const char *mode) 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,23 +594,9 @@ SDL_RWFromFile(const char *file, const char *mode) 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 { - #ifdef __APPLE__ + #if __APPLE__ && !SDL_FILE_DISABLED // TODO: add dummy? FILE *fp = SDL_OpenFPFromBundleOrFallback(file, mode); #elif __WINRT__ FILE *fp = NULL; diff --git a/libs/SDL2/src/file/cocoa/SDL_rwopsbundlesupport.m b/libs/SDL2/src/file/cocoa/SDL_rwopsbundlesupport.m index 478522ce..55e104a9 100644 --- a/libs/SDL2/src/file/cocoa/SDL_rwopsbundlesupport.m +++ b/libs/SDL2/src/file/cocoa/SDL_rwopsbundlesupport.m @@ -36,18 +36,22 @@ FILE* SDL_OpenFPFromBundleOrFallback(const char *file, const char *mode) { @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 --git a/libs/SDL2/src/filesystem/cocoa/SDL_sysfilesystem.m b/libs/SDL2/src/filesystem/cocoa/SDL_sysfilesystem.m index b20e8fc5..ba2e3327 100644 --- a/libs/SDL2/src/filesystem/cocoa/SDL_sysfilesystem.m +++ b/libs/SDL2/src/filesystem/cocoa/SDL_sysfilesystem.m @@ -71,6 +71,10 @@ char * SDL_GetPrefPath(const char *org, const char *app) { @autoreleasepool { + char *retval = NULL; + static SDL_bool shown = SDL_FALSE; + NSArray *array; + if (!app) { SDL_InvalidParamError("app"); return NULL; @@ -79,9 +83,8 @@ SDL_GetPrefPath(const char *org, const char *app) 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 +94,13 @@ SDL_GetPrefPath(const char *org, const char *app) * 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"); } - 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 --git a/libs/SDL2/src/filesystem/os2/SDL_sysfilesystem.c b/libs/SDL2/src/filesystem/os2/SDL_sysfilesystem.c index e8050cbe..3203f0b3 100644 --- a/libs/SDL2/src/filesystem/os2/SDL_sysfilesystem.c +++ b/libs/SDL2/src/filesystem/os2/SDL_sysfilesystem.c @@ -31,6 +31,7 @@ #define INCL_DOSFILEMGR #define INCL_DOSPROCESS +#define INCL_DOSMODULEMGR #define INCL_DOSERRORS #include @@ -42,30 +43,31 @@ SDL_GetBasePath(void) PPIB pib; ULONG ulRC = DosGetInfoBlocks(&tib, &pib); PCHAR pcEnd; - ULONG cbResult; CHAR acBuf[CCHMAXPATH]; if (ulRC != NO_ERROR) { - debug_os2("DosGetInfoBlocks() failed, rc = %u", ulRC); + SDL_SetError("Can't get process information block (E%lu)", ulRC); return NULL; } - pcEnd = SDL_strrchr(pib->pib_pchcmd, '\\'); + ulRC = DosQueryModuleName(pib->pib_hmte, sizeof(acBuf), acBuf); + if (ulRC != NO_ERROR) { + SDL_SetError("Can't query the module name (E%lu)", ulRC); + return NULL; + } + + pcEnd = SDL_strrchr(acBuf, '\\'); if (pcEnd != NULL) - pcEnd++; + pcEnd[1] = '\0'; else { - if (pib->pib_pchcmd[1] == ':') - pcEnd = &pib->pib_pchcmd[2]; + if (acBuf[1] == ':') /* e.g. "C:FOO" */ + acBuf[2] = '\0'; else { - SDL_SetError("No path in pib->pib_pchcmd"); + SDL_SetError("No path in module name"); return NULL; } } - cbResult = pcEnd - pib->pib_pchcmd; - SDL_memcpy(acBuf, pib->pib_pchcmd, cbResult); - acBuf[cbResult] = '\0'; - return OS2_SysToUTF8(acBuf); } diff --git a/libs/SDL2/src/filesystem/ps2/SDL_sysfilesystem.c b/libs/SDL2/src/filesystem/ps2/SDL_sysfilesystem.c new file mode 100644 index 00000000..21c24b61 --- /dev/null +++ b/libs/SDL2/src/filesystem/ps2/SDL_sysfilesystem.c @@ -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 --git a/libs/SDL2/src/filesystem/psp/SDL_sysfilesystem.c b/libs/SDL2/src/filesystem/psp/SDL_sysfilesystem.c index e9c6ee49..4abb90ad 100644 --- a/libs/SDL2/src/filesystem/psp/SDL_sysfilesystem.c +++ b/libs/SDL2/src/filesystem/psp/SDL_sysfilesystem.c @@ -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]; - return retval; + getcwd(cwd, sizeof(cwd)); + len = SDL_strlen(cwd) + 2; + retval = (char *) SDL_malloc(len); + SDL_snprintf(retval, len, "%s/", cwd); + + 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 = ""; - } + 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); + 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); + 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 --git a/libs/SDL2/src/filesystem/windows/SDL_sysfilesystem.c b/libs/SDL2/src/filesystem/windows/SDL_sysfilesystem.c index d50fb511..5d3099be 100644 --- a/libs/SDL2/src/filesystem/windows/SDL_sysfilesystem.c +++ b/libs/SDL2/src/filesystem/windows/SDL_sysfilesystem.c @@ -35,39 +35,23 @@ char * SDL_GetBasePath(void) { - typedef DWORD (WINAPI *GetModuleFileNameExW_t)(HANDLE, HMODULE, LPWSTR, DWORD); - GetModuleFileNameExW_t pGetModuleFileNameExW; DWORD buflen = 128; WCHAR *path = NULL; - HANDLE psapi = LoadLibrary(TEXT("psapi.dll")); char *retval = NULL; DWORD len = 0; int i; - if (!psapi) { - WIN_SetError("Couldn't load psapi.dll"); - return NULL; - } - - pGetModuleFileNameExW = (GetModuleFileNameExW_t)GetProcAddress(psapi, "GetModuleFileNameExW"); - if (!pGetModuleFileNameExW) { - WIN_SetError("Couldn't find GetModuleFileNameExW"); - FreeLibrary(psapi); - return NULL; - } - while (SDL_TRUE) { void *ptr = SDL_realloc(path, buflen * sizeof (WCHAR)); if (!ptr) { SDL_free(path); - FreeLibrary(psapi); SDL_OutOfMemory(); return NULL; } path = (WCHAR *) ptr; - len = pGetModuleFileNameExW(GetCurrentProcess(), NULL, path, buflen); + len = GetModuleFileNameW(NULL, path, buflen); /* if it truncated, then len >= buflen - 1 */ /* if there was enough room (or failure), len < buflen - 1 */ if (len < buflen - 1) { @@ -78,8 +62,6 @@ SDL_GetBasePath(void) buflen *= 2; } - FreeLibrary(psapi); - if (len == 0) { SDL_free(path); WIN_SetError("Couldn't locate our .exe"); @@ -190,4 +172,23 @@ SDL_GetPrefPath(const char *org, const char *app) #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 --git a/libs/SDL2/src/haptic/SDL_syshaptic.h b/libs/SDL2/src/haptic/SDL_syshaptic.h index 9e584095..d6ee3e1a 100644 --- a/libs/SDL2/src/haptic/SDL_syshaptic.h +++ b/libs/SDL2/src/haptic/SDL_syshaptic.h @@ -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_HapticUnpause(SDL_Haptic * haptic); */ 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 --git a/libs/SDL2/src/haptic/windows/SDL_dinputhaptic.c b/libs/SDL2/src/haptic/windows/SDL_dinputhaptic.c index 0ae71f4a..2229c691 100644 --- a/libs/SDL2/src/haptic/windows/SDL_dinputhaptic.c +++ b/libs/SDL2/src/haptic/windows/SDL_dinputhaptic.c @@ -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 @@ SDL_DINPUT_HapticInit(void) 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); @@ -492,8 +498,7 @@ SDL_DINPUT_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick) ++index; } - SDL_SetError("Couldn't find joystick in haptic device list"); - return -1; + return SDL_SetError("Couldn't find joystick in haptic device list"); } void @@ -959,8 +964,7 @@ SDL_DINPUT_HapticNewEffect(SDL_Haptic * haptic, struct haptic_effect *effect, SD REFGUID type = SDL_SYS_HapticEffectType(base); if (type == NULL) { - SDL_SetError("Haptic: Unknown effect type."); - return -1; + return SDL_SetError("Haptic: Unknown effect type."); } /* Get the effect. */ diff --git a/libs/SDL2/src/haptic/windows/SDL_dinputhaptic_c.h b/libs/SDL2/src/haptic/windows/SDL_dinputhaptic_c.h index e854971a..60fa414c 100644 --- a/libs/SDL2/src/haptic/windows/SDL_dinputhaptic_c.h +++ b/libs/SDL2/src/haptic/windows/SDL_dinputhaptic_c.h @@ -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_HapticPause(SDL_Haptic * haptic); 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 --git a/libs/SDL2/src/haptic/windows/SDL_windowshaptic.c b/libs/SDL2/src/haptic/windows/SDL_windowshaptic.c index 1be2fc48..475ae49c 100644 --- a/libs/SDL2/src/haptic/windows/SDL_windowshaptic.c +++ b/libs/SDL2/src/haptic/windows/SDL_windowshaptic.c @@ -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 @@ SDL_SYS_HapticStopAll(SDL_Haptic * haptic) } } +/* 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 --git a/libs/SDL2/src/haptic/windows/SDL_windowshaptic_c.h b/libs/SDL2/src/haptic/windows/SDL_windowshaptic_c.h index ec6e333c..dcfb7022 100644 --- a/libs/SDL2/src/haptic/windows/SDL_windowshaptic_c.h +++ b/libs/SDL2/src/haptic/windows/SDL_windowshaptic_c.h @@ -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 SDL_hapticlist_item *SDL_hapticlist; 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 --git a/libs/SDL2/src/haptic/windows/SDL_xinputhaptic.c b/libs/SDL2/src/haptic/windows/SDL_xinputhaptic.c index 2e1da598..2622fb7a 100644 --- a/libs/SDL2/src/haptic/windows/SDL_xinputhaptic.c +++ b/libs/SDL2/src/haptic/windows/SDL_xinputhaptic.c @@ -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 @@ int 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 */ @@ -246,8 +251,7 @@ SDL_XINPUT_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick) ++index; } - SDL_SetError("Couldn't find joystick in haptic device list"); - return -1; + return SDL_SetError("Couldn't find joystick in haptic device list"); } void @@ -366,6 +370,11 @@ SDL_XINPUT_HapticStopAll(SDL_Haptic * haptic) 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 --git a/libs/SDL2/src/haptic/windows/SDL_xinputhaptic_c.h b/libs/SDL2/src/haptic/windows/SDL_xinputhaptic_c.h index d0347e63..2fb5dd86 100644 --- a/libs/SDL2/src/haptic/windows/SDL_xinputhaptic_c.h +++ b/libs/SDL2/src/haptic/windows/SDL_xinputhaptic_c.h @@ -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_HapticPause(SDL_Haptic * haptic); 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 --git a/libs/SDL2/src/hidapi/SDL_hidapi.c b/libs/SDL2/src/hidapi/SDL_hidapi.c index aacff63b..718e5c19 100644 --- a/libs/SDL2/src/hidapi/SDL_hidapi.c +++ b/libs/SDL2/src/hidapi/SDL_hidapi.c @@ -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 @@ static struct 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 @@ static struct } SDL_HIDAPI_discovery; -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__WINGDK__) struct _DEV_BROADCAST_HDR { DWORD dbch_size; @@ -156,7 +156,7 @@ static LRESULT CALLBACK ControllerWndProc(HWND hwnd, UINT message, WPARAM wParam return DefWindowProc(hwnd, message, wParam, lParam); } -#endif /* __WIN32__ */ +#endif /* defined(__WIN32__) || defined(__WINGDK__) */ #if defined(__MACOSX__) @@ -219,7 +219,7 @@ HIDAPI_InitializeDiscovery() 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 @@ HIDAPI_InitializeDiscovery() 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 @@ HIDAPI_UpdateDiscovery() 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 @@ HIDAPI_UpdateDiscovery() } } #endif -#endif /* __WIN32__ */ +#endif /* defined(__WIN32__) || defined(__WINGDK__) */ #if defined(__MACOSX__) if (SDL_HIDAPI_discovery.m_notificationPort) { @@ -474,7 +474,7 @@ HIDAPI_ShutdownDiscovery() 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 @@ static const SDL_UDEV_Symbols *udev_ctx = NULL; #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 @@ -951,6 +951,7 @@ DeleteHIDDeviceWrapper(SDL_hid_device *device) } #if !SDL_HIDAPI_DISABLED +#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(SDL_LIBUSB_DYNAMIC) #define COPY_IF_EXISTS(var) \ if (pSrc->var != NULL) { \ @@ -987,6 +988,7 @@ CopyHIDDeviceInfo(struct SDL_hid_device_info *pSrc, struct SDL_hid_device_info * #undef COPY_IF_EXISTS #undef WCOPY_IF_EXISTS +#endif /* HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || SDL_LIBUSB_DYNAMIC */ #endif /* !SDL_HIDAPI_DISABLED */ static int SDL_hidapi_refcount = 0; @@ -1032,54 +1034,60 @@ int SDL_hid_init(void) #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 (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; + 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 */ @@ -1185,9 +1193,9 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned #ifdef SDL_LIBUSB_DYNAMIC if (libusb_ctx.libhandle) { usb_devs = LIBUSB_hid_enumerate(vendor_id, product_id); - #ifdef DEBUG_HIDAPI +#ifdef DEBUG_HIDAPI SDL_Log("libusb devices found:"); - #endif +#endif for (usb_dev = usb_devs; usb_dev; usb_dev = usb_dev->next) { new_dev = (struct SDL_hid_device_info*) SDL_malloc(sizeof(struct SDL_hid_device_info)); if (!new_dev) { @@ -1197,11 +1205,11 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned return NULL; } CopyHIDDeviceInfo(usb_dev, new_dev); - #ifdef DEBUG_HIDAPI +#ifdef DEBUG_HIDAPI SDL_Log(" - %ls %ls 0x%.4hx 0x%.4hx", usb_dev->manufacturer_string, usb_dev->product_string, usb_dev->vendor_id, usb_dev->product_id); - #endif +#endif if (last != NULL) { last->next = new_dev; @@ -1522,7 +1530,7 @@ int SDL_hid_get_indexed_string(SDL_hid_device *device, int string_index, wchar_t void SDL_hid_ble_scan(SDL_bool active) { -#if __IPHONEOS__ || __TVOS__ +#if !SDL_HIDAPI_DISABLED && (__IPHONEOS__ || __TVOS__) hid_ble_scan(active); #endif } diff --git a/libs/SDL2/src/hidapi/android/hid.cpp b/libs/SDL2/src/hidapi/android/hid.cpp index faed8855..de365d00 100644 --- a/libs/SDL2/src/hidapi/android/hid.cpp +++ b/libs/SDL2/src/hidapi/android/hid.cpp @@ -24,6 +24,30 @@ // // This layer glues the hidapi API to Android's USB and BLE stack. + +// Common to stub version and non-stub version of functions +#include +#include + +#define TAG "hidapi" + +// Have error log always available +#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__) + +#ifdef DEBUG +#define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, TAG, __VA_ARGS__) +#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__) +#else +#define LOGV(...) +#define LOGD(...) +#endif + +#define SDL_JAVA_PREFIX org_libsdl_app +#define CONCAT1(prefix, class, function) CONCAT2(prefix, class, function) +#define CONCAT2(prefix, class, function) Java_ ## prefix ## _ ## class ## _ ## function +#define HID_DEVICE_MANAGER_JAVA_INTERFACE(function) CONCAT1(SDL_JAVA_PREFIX, HIDDeviceManager, function) + + #if !SDL_HIDAPI_DISABLED #include "SDL_hints.h" @@ -48,30 +72,10 @@ #define hid_get_indexed_string PLATFORM_hid_get_indexed_string #define hid_error PLATFORM_hid_error -#include -#include #include #include // For ETIMEDOUT and ECONNRESET #include // For malloc() and free() -#define TAG "hidapi" - -// Have error log always available -#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__) - -#ifdef DEBUG -#define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, TAG, __VA_ARGS__) -#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__) -#else -#define LOGV(...) -#define LOGD(...) -#endif - -#define SDL_JAVA_PREFIX org_libsdl_app -#define CONCAT1(prefix, class, function) CONCAT2(prefix, class, function) -#define CONCAT2(prefix, class, function) Java_ ## prefix ## _ ## class ## _ ## function -#define HID_DEVICE_MANAGER_JAVA_INTERFACE(function) CONCAT1(SDL_JAVA_PREFIX, HIDDeviceManager, function) - #include "../hidapi/hidapi.h" typedef uint32_t uint32; @@ -1336,4 +1340,79 @@ int hid_exit(void) } +#else + +extern "C" +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceRegisterCallback)(JNIEnv *env, jobject thiz); + +extern "C" +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceReleaseCallback)(JNIEnv *env, jobject thiz); + +extern "C" +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceConnected)(JNIEnv *env, jobject thiz, int nDeviceID, jstring sIdentifier, int nVendorId, int nProductId, jstring sSerialNumber, int nReleaseNumber, jstring sManufacturer, jstring sProduct, int nInterface, int nInterfaceClass, int nInterfaceSubclass, int nInterfaceProtocol ); + +extern "C" +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceOpenPending)(JNIEnv *env, jobject thiz, int nDeviceID); + +extern "C" +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceOpenResult)(JNIEnv *env, jobject thiz, int nDeviceID, bool bOpened); + +extern "C" +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceDisconnected)(JNIEnv *env, jobject thiz, int nDeviceID); + +extern "C" +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceInputReport)(JNIEnv *env, jobject thiz, int nDeviceID, jbyteArray value); + +extern "C" +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceFeatureReport)(JNIEnv *env, jobject thiz, int nDeviceID, jbyteArray value); + + +extern "C" +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceRegisterCallback)(JNIEnv *env, jobject thiz ) +{ + LOGV("Stub HIDDeviceRegisterCallback()"); +} + +extern "C" +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceReleaseCallback)(JNIEnv *env, jobject thiz) +{ + LOGV("Stub HIDDeviceReleaseCallback()"); +} + +extern "C" +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceConnected)(JNIEnv *env, jobject thiz, int nDeviceID, jstring sIdentifier, int nVendorId, int nProductId, jstring sSerialNumber, int nReleaseNumber, jstring sManufacturer, jstring sProduct, int nInterface, int nInterfaceClass, int nInterfaceSubclass, int nInterfaceProtocol ) +{ + LOGV("Stub HIDDeviceConnected() id=%d VID/PID = %.4x/%.4x, interface %d\n", nDeviceID, nVendorId, nProductId, nInterface); +} + +extern "C" +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceOpenPending)(JNIEnv *env, jobject thiz, int nDeviceID) +{ + LOGV("Stub HIDDeviceOpenPending() id=%d\n", nDeviceID); +} + +extern "C" +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceOpenResult)(JNIEnv *env, jobject thiz, int nDeviceID, bool bOpened) +{ + LOGV("Stub HIDDeviceOpenResult() id=%d, result=%s\n", nDeviceID, bOpened ? "true" : "false"); +} + +extern "C" +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceDisconnected)(JNIEnv *env, jobject thiz, int nDeviceID) +{ + LOGV("Stub HIDDeviceDisconnected() id=%d\n", nDeviceID); +} + +extern "C" +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceInputReport)(JNIEnv *env, jobject thiz, int nDeviceID, jbyteArray value) +{ + LOGV("Stub HIDDeviceInput() id=%d len=%u\n", nDeviceID, nBufSize); +} + +extern "C" +JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceFeatureReport)(JNIEnv *env, jobject thiz, int nDeviceID, jbyteArray value) +{ + LOGV("Stub HIDDeviceFeatureReport() id=%d len=%u\n", nDeviceID, nBufSize); +} + #endif /* SDL_HIDAPI_DISABLED */ diff --git a/libs/SDL2/src/hidapi/libusb/hid.c b/libs/SDL2/src/hidapi/libusb/hid.c index 5cc60bcb..46306073 100644 --- a/libs/SDL2/src/hidapi/libusb/hid.c +++ b/libs/SDL2/src/hidapi/libusb/hid.c @@ -74,12 +74,8 @@ typedef struct _SDL_ThreadBarrier static int SDL_CreateThreadBarrier(SDL_ThreadBarrier *barrier, Uint32 count) { - if (barrier == NULL) { - return SDL_SetError("barrier must be non-NULL"); - } - if (count == 0) { - return SDL_SetError("count must be > 0"); - } + SDL_assert(barrier != NULL); + SDL_assert(count != 0); barrier->mutex = SDL_CreateMutex(); if (barrier->mutex == NULL) { @@ -639,6 +635,7 @@ static int is_xbox360(unsigned short vendor_id, const struct libusb_interface_de 0x1bad, /* Harmonix */ 0x20d6, /* PowerA */ 0x24c6, /* PowerA */ + 0x2c22, /* Qanba */ }; if (intf_desc->bInterfaceClass == LIBUSB_CLASS_VENDOR_SPEC && @@ -998,7 +995,7 @@ static void LIBUSB_CALL read_callback(struct libusb_transfer *transfer) } -static int read_thread(void *param) +static int SDLCALL read_thread(void *param) { hid_device *dev = (hid_device *)param; uint8_t *buf; @@ -1501,6 +1498,7 @@ void HID_API_EXPORT hid_close(hid_device *dev) /* Clean up the Transfer objects allocated in read_thread(). */ free(dev->transfer->buffer); + dev->transfer->buffer = NULL; libusb_free_transfer(dev->transfer); /* release the interface */ diff --git a/libs/SDL2/src/hidapi/mac/hid.c b/libs/SDL2/src/hidapi/mac/hid.c index 19314a6e..cfad07c2 100644 --- a/libs/SDL2/src/hidapi/mac/hid.c +++ b/libs/SDL2/src/hidapi/mac/hid.c @@ -156,11 +156,12 @@ static hid_device *new_hid_device(void) 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); @@ -259,15 +260,13 @@ static int get_string_property(IOHIDDeviceRef device, CFStringRef prop, wchar_t buf[0] = 0; - if (str) { - len --; - - CFIndex str_len = CFStringGetLength(str); + if (str && CFGetTypeID(str) == CFStringGetTypeID()) { + 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, @@ -298,15 +297,13 @@ static int get_string_property_utf8(IOHIDDeviceRef device, CFStringRef prop, cha buf[0] = 0; - if (str) { - len--; - - CFIndex str_len = CFStringGetLength(str); + if (str && CFGetTypeID(str) == CFStringGetTypeID()) { + 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, @@ -326,10 +323,7 @@ static int get_string_property_utf8(IOHIDDeviceRef device, CFStringRef prop, cha static int get_serial_number(IOHIDDeviceRef device, wchar_t *buf, size_t len) { - // This crashes on M1 Macs, tracked by radar bug 79667729 - //return get_string_property(device, CFSTR(kIOHIDSerialNumberKey), buf, len); - buf[0] = 0; - return 0; + return get_string_property(device, CFSTR(kIOHIDSerialNumberKey), buf, len); } static int get_manufacturer_string(IOHIDDeviceRef device, wchar_t *buf, size_t len) @@ -520,6 +514,8 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id, 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 */ @@ -530,7 +526,7 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id, 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; @@ -540,7 +536,7 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id, 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. */ @@ -557,6 +553,7 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id, continue; } +#if 0 // Prefer direct HID support as that has extended functionality #if defined(SDL_JOYSTICK_MFI) // We want to prefer Game Controller support where available, // as Apple will likely be requiring that for supported devices. @@ -564,6 +561,7 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id, if (IOS_SupportedHIDDevice(dev)) { continue; } +#endif #endif dev_vid = get_vendor_id(dev); @@ -573,8 +571,7 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id, if ((vendor_id == 0x0 && product_id == 0x0) || (vendor_id == dev_vid && product_id == dev_pid)) { struct hid_device_info *tmp; - size_t len; - + /* VID/PID match. Create the record. */ tmp = (struct hid_device_info *)calloc(1, sizeof(struct hid_device_info)); if (cur_dev) { @@ -591,7 +588,7 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id, /* Fill out the record */ cur_dev->next = NULL; - len = make_path(dev, cbuf, sizeof(cbuf)); + make_path(dev, cbuf, sizeof(cbuf)); cur_dev->path = strdup(cbuf); /* Serial Number */ @@ -735,13 +732,14 @@ static void perform_signal_callback(void *context) 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; @@ -758,7 +756,6 @@ static void *read_thread(void *param) /* 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 */ @@ -798,10 +795,12 @@ static void *read_thread(void *param) 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 */ @@ -811,22 +810,22 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path, int bExclusive) /* 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]; - size_t len; IOHIDDeviceRef os_dev = device_array[i]; - len = make_path(os_dev, cbuf, sizeof(cbuf)); + make_path(os_dev, cbuf, sizeof(cbuf)); if (!strcmp(cbuf, path)) { // Matched Paths. Open this Device. IOReturn ret = IOHIDDeviceOpen(os_dev, kIOHIDOptionsTypeNone); if (ret == kIOReturnSuccess) { char str[32]; + struct hid_device_list_node *node; free(device_array); CFRelease(device_set); @@ -834,6 +833,7 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path, int bExclusive) /* Create the buffers for receiving data */ dev->max_input_report_len = (CFIndex) get_max_report_length(os_dev); + SDL_assert(dev->max_input_report_len > 0); dev->input_report_buf = (uint8_t *)calloc(dev->max_input_report_len, sizeof(uint8_t)); /* Create the Run Loop Mode for this device. @@ -847,7 +847,7 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path, int bExclusive) 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; @@ -937,11 +937,14 @@ static int return_data(hid_device *dev, unsigned char *data, size_t length) /* Copy the data out of the linked list item (rpt) into the return buffer (data), and delete the liked list item. */ struct input_report *rpt = dev->input_reports; - size_t len = (length < rpt->len)? length: rpt->len; - memcpy(data, rpt->data, len); - dev->input_reports = rpt->next; - free(rpt->data); - free(rpt); + size_t len = 0; + if (rpt != NULL) { + len = (length < rpt->len)? length: rpt->len; + memcpy(data, rpt->data, len); + dev->input_reports = rpt->next; + free(rpt->data); + free(rpt); + } return (int)len; } @@ -1082,13 +1085,13 @@ int HID_API_EXPORT hid_get_feature_report(hid_device *dev, unsigned char *data, { 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 --git a/libs/SDL2/src/hidapi/windows/hid.c b/libs/SDL2/src/hidapi/windows/hid.c index f0a30c7d..8dfd11d0 100644 --- a/libs/SDL2/src/hidapi/windows/hid.c +++ b/libs/SDL2/src/hidapi/windows/hid.c @@ -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" { } /* 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 --git a/libs/SDL2/src/joystick/SDL_gamecontroller.c b/libs/SDL2/src/joystick/SDL_gamecontroller.c index e27922a6..b667e8dc 100644 --- a/libs/SDL2/src/joystick/SDL_gamecontroller.c +++ b/libs/SDL2/src/joystick/SDL_gamecontroller.c @@ -28,6 +28,7 @@ #include "SDL_sysjoystick.h" #include "SDL_joystick_c.h" #include "SDL_gamecontrollerdb.h" +#include "controller_type.h" #include "usb_ids.h" #if !SDL_EVENTS_DISABLED @@ -586,6 +587,12 @@ static ControllerMapping_t *SDL_CreateMappingForHIDAPIController(SDL_JoystickGUI (vendor == USB_VENDOR_SHENZHEN && product == USB_PRODUCT_EVORETRO_GAMECUBE_ADAPTER)) { /* GameCube driver has 12 buttons and 6 axes */ SDL_strlcat(mapping_string, "a:b0,b:b1,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:b2,y:b3,", sizeof(mapping_string)); + } else if (vendor == USB_VENDOR_NINTENDO && product == USB_PRODUCT_NINTENDO_N64_CONTROLLER) { + SDL_strlcat(mapping_string, "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,righttrigger:a5,start:b6,x:b2,y:b3,misc1:b15,", sizeof(mapping_string)); + } else if (vendor == USB_VENDOR_NINTENDO && product == USB_PRODUCT_NINTENDO_SEGA_GENESIS_CONTROLLER) { + SDL_strlcat(mapping_string, "a:b0,b:b1,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,rightshoulder:b10,righttrigger:a5,start:b6,misc1:b15,", sizeof(mapping_string)); + } else if (vendor == USB_VENDOR_NINTENDO && product == USB_PRODUCT_NINTENDO_SNES_CONTROLLER) { + SDL_strlcat(mapping_string, "a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,lefttrigger:a4,rightshoulder:b10,righttrigger:a5,start:b6,x:b2,y:b3,", sizeof(mapping_string)); } else { /* All other controllers have the standard set of 19 buttons and 6 axes */ SDL_strlcat(mapping_string, "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,", sizeof(mapping_string)); @@ -646,12 +653,20 @@ static ControllerMapping_t *SDL_CreateMappingForHIDAPIController(SDL_JoystickGUI */ static ControllerMapping_t *SDL_CreateMappingForRAWINPUTController(SDL_JoystickGUID guid) { + Uint16 vendor; + Uint16 product; SDL_bool existing; char mapping_string[1024]; - SDL_strlcpy(mapping_string, "none,*,", sizeof(mapping_string)); - SDL_strlcat(mapping_string, "a:b0,b:b1,x:b2,y:b3,back:b6,guide:b10,start:b7,leftstick:b8,rightstick:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,", sizeof(mapping_string)); + SDL_GetJoystickGUIDInfo(guid, &vendor, &product, NULL); + SDL_strlcpy(mapping_string, "none,*,", sizeof(mapping_string)); + if (GuessControllerType(vendor, product) == k_eControllerType_XInputSwitchController && + SDL_GetHintBoolean(SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS, SDL_TRUE)) { + SDL_strlcat(mapping_string, "a:b1,b:b0,x:b3,y:b2,back:b6,guide:b10,start:b7,leftstick:b8,rightstick:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,", sizeof(mapping_string)); + } else { + SDL_strlcat(mapping_string, "a:b0,b:b1,x:b2,y:b3,back:b6,guide:b10,start:b7,leftstick:b8,rightstick:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,", sizeof(mapping_string)); + } return SDL_PrivateAddMappingForGUID(guid, mapping_string, &existing, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT); } @@ -696,19 +711,20 @@ static ControllerMapping_t *SDL_PrivateGetControllerMappingForGUID(SDL_JoystickG return s_pXInputMapping; } #endif + if (!mapping) { + if (SDL_IsJoystickHIDAPI(guid)) { + mapping = SDL_CreateMappingForHIDAPIController(guid); + } else if (SDL_IsJoystickRAWINPUT(guid)) { + mapping = SDL_CreateMappingForRAWINPUTController(guid); + } else if (SDL_IsJoystickWGI(guid)) { + mapping = SDL_CreateMappingForWGIController(guid); + } else if (SDL_IsJoystickVirtual(guid)) { + /* We'll pick up a robust mapping in VIRTUAL_JoystickGetGamepadMapping */ #ifdef __ANDROID__ - if (!mapping && !SDL_IsJoystickHIDAPI(guid)) { - mapping = SDL_CreateMappingForAndroidController(guid); - } + } else { + mapping = SDL_CreateMappingForAndroidController(guid); #endif - if (!mapping && SDL_IsJoystickHIDAPI(guid)) { - mapping = SDL_CreateMappingForHIDAPIController(guid); - } - if (!mapping && SDL_IsJoystickRAWINPUT(guid)) { - mapping = SDL_CreateMappingForRAWINPUTController(guid); - } - if (!mapping && SDL_IsJoystickWGI(guid)) { - mapping = SDL_CreateMappingForWGIController(guid); + } } } return mapping; @@ -1003,7 +1019,7 @@ static char *SDL_PrivateGetControllerGUIDFromMappingString(const char *pMapping) pchGUID[pFirstComma - pMapping] = '\0'; /* Convert old style GUIDs to the new style in 2.0.5 */ -#if __WIN32__ +#if defined(__WIN32__) || defined(__WINGDK__) if (SDL_strlen(pchGUID) == 32 && SDL_memcmp(&pchGUID[20], "504944564944", 12) == 0) { SDL_memcpy(&pchGUID[20], "000000000000", 12); @@ -1258,6 +1274,11 @@ static ControllerMapping_t *SDL_PrivateGenerateAutomaticControllerMapping(const SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "dpdown", &raw_map->dpdown); 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); @@ -1732,6 +1753,20 @@ SDL_GameControllerNameForIndex(int device_index) } +/* + * 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 +1855,10 @@ SDL_bool SDL_ShouldIgnoreGameController(const char *name, SDL_JoystickGUID guid) } #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 +2327,15 @@ SDL_GameControllerName(SDL_GameController *gamecontroller) } } +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 +2375,12 @@ SDL_GameControllerGetProductVersion(SDL_GameController *gamecontroller) 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) { diff --git a/libs/SDL2/src/joystick/SDL_gamecontrollerdb.h b/libs/SDL2/src/joystick/SDL_gamecontrollerdb.h index 43c5d38f..aa9d3578 100644 --- a/libs/SDL2/src/joystick/SDL_gamecontrollerdb.h +++ b/libs/SDL2/src/joystick/SDL_gamecontrollerdb.h @@ -187,6 +187,7 @@ static const char *s_ControllerMappings [] = "030000006d04000016c2000000000000,Logitech Dual Action,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,", "030000006d04000018c2000000000000,Logitech F510 Gamepad,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,", "030000006d04000019c2000000000000,Logitech F710 Gamepad,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,", /* Guide button doesn't seem to be sent in DInput mode. */ + "030000006d0400001ac2000000000000,Logitech Precision Gamepad,a:b1,b:b2,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,", "03000000380700008081000000000000,MADCATZ SFV Arcade FightStick Alpha 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,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "03000000380700006382000000000000,MLG Gamepad PS3 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,", "03000000c62400002a89000000000000,MOGA XP5-A Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,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,", @@ -261,11 +262,18 @@ static const char *s_ControllerMappings [] = "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,", + "03000000050b00005819000000000000,ROG Chakram Core,a:b1,b:b0,leftx:a0,lefty:a1,x:b2,y:b3,", + "03000000050b0000181a000000000000,ROG Chakram X,a:b1,b:b0,leftx:a0,lefty:a1,x:b2,y:b3,", + "03000000050b00001a1a000000000000,ROG Chakram X,a:b1,b:b0,leftx:a0,lefty:a1,x:b2,y:b3,", + "03000000050b00001c1a000000000000,ROG Chakram X,a:b1,b:b0,leftx:a0,lefty:a1,x:b2,y:b3,", + "03000000050b0000e318000000000000,ROG Chakram,a:b1,b:b0,leftx:a0,lefty:a1,x:b2,y:b3,", + "03000000050b0000e518000000000000,ROG Chakram,a:b1,b:b0,leftx:a0,lefty:a1,x:b2,y:b3,", "03000000321500000003000000000000,Razer Hydra,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a2,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "03000000321500000204000000000000,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,", "03000000321500000104000000000000,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,", @@ -441,6 +449,7 @@ static const char *s_ControllerMappings [] = "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,", @@ -494,7 +503,7 @@ static const char *s_ControllerMappings [] = "03000000830500006020000000010000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "03000000830500006020000000000000,iBuffalo USB 2-axis 8-button Gamepad,a:b1,b:b0,back:b6,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b3,y:b2,", #endif -#if defined(__LINUX__) +#ifdef SDL_JOYSTICK_LINUX "xinput,*,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,", "03000000c82d00000090000011010000,8BitDo FC30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "03000000c82d00000090000011010000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", @@ -705,6 +714,10 @@ static const char *s_ControllerMappings [] = "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,", @@ -741,8 +754,11 @@ static const char *s_ControllerMappings [] = "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,", @@ -755,6 +771,7 @@ static const char *s_ControllerMappings [] = "0300000000f00000f100000000010000,Super RetroPort,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,", "030000004f0400000ed0000011010000,ThrustMaster eSwap PRO 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,", "030000004f04000020b3000010010000,Thrustmaster 2 in 1 DT,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,", + "030000004f04000015b3000001010000,Thrustmaster Dual Analog 3.2,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,", "030000004f04000015b3000010010000,Thrustmaster Dual Analog 4,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,", "030000004f04000023b3000000010000,Thrustmaster Dual Trigger 3-in-1,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:a5,start:b9,x:b0,y:b3,", "030000004f04000000b3000010010000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b11,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b10,x:b1,y:b3,", @@ -786,6 +803,7 @@ static const char *s_ControllerMappings [] = "030000005e040000ea02000001030000,Xbox One Wireless 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:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "050000005e040000e002000003090000,Xbox One Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "050000005e040000fd02000003090000,Xbox One Wireless Controller,a:b0,b:b1,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,guide:b16,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,", + "050000005e040000130b000011050000,Xbox Series X Controller,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,misc1:b15,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,", "05000000172700004431000029010000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b20,leftshoulder:b6,leftstick:b13,lefttrigger:a7,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a5,start:b11,x:b3,y:b4,", "03000000c0160000e105000001010000,Xin-Mo Xin-Mo Dual Arcade,a:b4,b:b3,back:b6,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b9,leftshoulder:b2,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b1,y:b0,", "03000000120c0000100e000011010000,ZEROPLUS P4 Gamepad,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,", @@ -887,9 +905,6 @@ static const char *s_ControllerMappings [] = "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 @@ -897,7 +912,10 @@ static const char *s_ControllerMappings [] = "50535669746120436f6e74726f6c6c65,PSVita Controller,a:b2,b:b1,back:b10,dpdown:b6,dpleft:b7,dpright:b9,dpup:b8,leftshoulder:b4,leftstick:b14,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b15,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b0,", #endif #if defined(SDL_JOYSTICK_PSP) - "505350206275696c74696e206a6f7970,PSP builtin joypad,y:b0,b:b1,a:b2,x:b3,leftshoulder:b4,rightshoulder:b5,dpdown:b6,dpleft:b7,dpup:b8,dpright:b9,back:b10,start:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,", + "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,leftx:a0,lefty:a1,rightshoulder:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,leftstick:b1,rightstick:b2,", #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 --git a/libs/SDL2/src/joystick/SDL_joystick.c b/libs/SDL2/src/joystick/SDL_joystick.c index 696038d2..0eb600ac 100644 --- a/libs/SDL2/src/joystick/SDL_joystick.c +++ b/libs/SDL2/src/joystick/SDL_joystick.c @@ -37,7 +37,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 +89,9 @@ static SDL_JoystickDriver *SDL_joystick_drivers[] = { #ifdef SDL_JOYSTICK_OS2 &SDL_OS2_JoystickDriver, #endif +#ifdef SDL_JOYSTICK_PS2 + &SDL_PS2_JoystickDriver, +#endif #ifdef SDL_JOYSTICK_PSP &SDL_PSP_JoystickDriver, #endif @@ -320,6 +323,28 @@ SDL_JoystickNameForIndex(int device_index) return name; } +/* + * 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 */ @@ -386,6 +411,8 @@ SDL_JoystickOpen(int device_index) SDL_Joystick *joystick; SDL_Joystick *joysticklist; const char *joystickname = NULL; + const char *joystickpath = NULL; + SDL_JoystickPowerLevel initial_power_level; SDL_LockJoysticks(); @@ -435,6 +462,13 @@ SDL_JoystickOpen(int device_index) 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 +512,11 @@ SDL_JoystickOpen(int device_index) 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; @@ -486,9 +525,23 @@ SDL_JoystickOpen(int device_index) int 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 +887,23 @@ SDL_JoystickName(SDL_Joystick *joystick) 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 */ @@ -886,17 +956,18 @@ SDL_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 h result = joystick->driver->Rumble(joystick, low_frequency_rumble, high_frequency_rumble); } - /* Save the rumble value regardless of success, so we don't spam the driver */ - joystick->low_frequency_rumble = low_frequency_rumble; - joystick->high_frequency_rumble = high_frequency_rumble; + if (result == 0) { + joystick->low_frequency_rumble = low_frequency_rumble; + joystick->high_frequency_rumble = high_frequency_rumble; - if ((low_frequency_rumble || high_frequency_rumble) && duration_ms) { - joystick->rumble_expiration = SDL_GetTicks() + SDL_min(duration_ms, SDL_MAX_RUMBLE_DURATION_MS); - if (!joystick->rumble_expiration) { - joystick->rumble_expiration = 1; + if ((low_frequency_rumble || high_frequency_rumble) && duration_ms) { + joystick->rumble_expiration = SDL_GetTicks() + SDL_min(duration_ms, SDL_MAX_RUMBLE_DURATION_MS); + if (!joystick->rumble_expiration) { + joystick->rumble_expiration = 1; + } + } else { + joystick->rumble_expiration = 0; } - } else { - joystick->rumble_expiration = 0; } SDL_UnlockJoysticks(); @@ -920,17 +991,18 @@ SDL_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 ri result = joystick->driver->RumbleTriggers(joystick, left_rumble, right_rumble); } - /* Save the rumble value regardless of success, so we don't spam the driver */ - joystick->left_trigger_rumble = left_rumble; - joystick->right_trigger_rumble = right_rumble; + if (result == 0) { + joystick->left_trigger_rumble = left_rumble; + joystick->right_trigger_rumble = right_rumble; - if ((left_rumble || right_rumble) && duration_ms) { - joystick->trigger_rumble_expiration = SDL_GetTicks() + SDL_min(duration_ms, SDL_MAX_RUMBLE_DURATION_MS); - if (!joystick->trigger_rumble_expiration) { - joystick->trigger_rumble_expiration = 1; + if ((left_rumble || right_rumble) && duration_ms) { + joystick->trigger_rumble_expiration = SDL_GetTicks() + SDL_min(duration_ms, SDL_MAX_RUMBLE_DURATION_MS); + if (!joystick->trigger_rumble_expiration) { + joystick->trigger_rumble_expiration = 1; + } + } else { + joystick->trigger_rumble_expiration = 0; } - } else { - joystick->trigger_rumble_expiration = 0; } SDL_UnlockJoysticks(); @@ -1004,14 +1076,13 @@ SDL_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue) 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; } @@ -1098,6 +1169,7 @@ SDL_JoystickClose(SDL_Joystick *joystick) } SDL_free(joystick->name); + SDL_free(joystick->path); SDL_free(joystick->serial); /* Free the data associated with this joystick */ @@ -1588,11 +1660,13 @@ SDL_JoystickUpdate(void) for (joystick = SDL_joysticks; joystick; joystick = joystick->next) { if (joystick->attached) { - /* This should always be true, but seeing a crash in the wild...? */ - if (joystick->driver) { - joystick->driver->Update(joystick); + /* This driver should always be != NULL, but seeing a crash in the wild...? */ + if (!joystick->driver) { + continue; /* nothing we can do, and other things use joystick->driver below here. */ } + joystick->driver->Update(joystick); + if (joystick->delayed_guide_button) { SDL_GameControllerHandleDelayedGuideButton(joystick); } @@ -1739,6 +1813,11 @@ SDL_CreateJoystickName(Uint16 vendor, Uint16 product, const char *vendor_name, c char *name; size_t i, len; + /* Use the given name for the Nintendo Online NES Controllers */ + if (product_name && SDL_strncmp(product_name, "NES Controller", 14) == 0) { + return SDL_strdup(product_name); + } + custom_name = GuessControllerName(vendor, product); if (custom_name) { return SDL_strdup(custom_name); @@ -1761,23 +1840,48 @@ SDL_CreateJoystickName(Uint16 vendor, Uint16 product, const char *vendor_name, c 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 */ @@ -1826,9 +1930,85 @@ SDL_CreateJoystickName(Uint16 vendor, Uint16 product, const char *vendor_name, c } 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_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_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; + case k_eControllerType_SwitchJoyConLeft: + case k_eControllerType_SwitchJoyConRight: + /* We always support the Nintendo Online NES Controllers */ + if (name && SDL_strncmp(name, "NES Controller", 14) == 0) { + type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO; + } else { + type = SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, SDL_FALSE) ? SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO : SDL_CONTROLLER_TYPE_UNKNOWN; + } + break; + default: + break; + } + } + return type; } SDL_GameControllerType @@ -1838,154 +2018,24 @@ SDL_GetJoystickGameControllerTypeFromGUID(SDL_JoystickGUID guid, const char *nam 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 Sabertooth */ - 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 Wildcat */ - 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_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 @@ -2149,10 +2199,14 @@ static SDL_bool SDL_IsJoystickProductWheel(Uint32 vidpid) MAKE_VIDPID(0x046d, 0xc261), /* Logitech G920 (initial mode) */ MAKE_VIDPID(0x046d, 0xc262), /* Logitech G920 (active mode) */ MAKE_VIDPID(0x046d, 0xc26e), /* Logitech G923 */ + MAKE_VIDPID(0x046d, 0xca03), /* Logitech Momo Racing */ MAKE_VIDPID(0x044f, 0xb65d), /* Thrustmaster Wheel FFB */ MAKE_VIDPID(0x044f, 0xb66d), /* Thrustmaster Wheel FFB */ MAKE_VIDPID(0x044f, 0xb677), /* Thrustmaster T150 */ - MAKE_VIDPID(0x044f, 0xb66e), /* Thrustmaster T300RS */ + MAKE_VIDPID(0x044f, 0xb696), /* Thrustmaster T248 */ + MAKE_VIDPID(0x044f, 0xb66e), /* Thrustmaster T300RS (normal mode) */ + MAKE_VIDPID(0x044f, 0xb66f), /* Thrustmaster T300RS (advanced mode) */ + MAKE_VIDPID(0x044f, 0xb66d), /* Thrustmaster T300RS (PS4 mode) */ MAKE_VIDPID(0x044f, 0xb65e), /* Thrustmaster T500RS */ MAKE_VIDPID(0x044f, 0xb664), /* Thrustmaster TX (initial mode) */ MAKE_VIDPID(0x044f, 0xb669), /* Thrustmaster TX (active mode) */ @@ -2190,6 +2244,12 @@ static SDL_bool SDL_IsJoystickProductArcadeStick(Uint32 vidpid) 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; @@ -2302,7 +2362,7 @@ static SDL_JoystickType SDL_GetJoystickGUIDType(SDL_JoystickGUID guid) static SDL_bool SDL_IsPS4RemapperRunning(void) { -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__WINGDK__) const char *mapper_processes[] = { "DS4Windows.exe", "InputMapper.exe", @@ -2438,11 +2498,24 @@ SDL_bool SDL_ShouldIgnoreJoystick(const char *name, SDL_JoystickGUID guid) /* Additional entries */ /*****************************************************************/ - MAKE_VIDPID(0x04d9, 0x8009), /* OBINLB USB-HID Keyboard */ - MAKE_VIDPID(0x0b05, 0x1958), /* ROG Chakram Mouse */ + MAKE_VIDPID(0x04d9, 0x8008), /* OBINLB USB-HID Keyboard (Anne Pro II) */ + MAKE_VIDPID(0x04d9, 0x8009), /* OBINLB USB-HID Keyboard (Anne Pro II) */ + MAKE_VIDPID(0x04d9, 0xa292), /* OBINLB USB-HID Keyboard (Anne Pro II) */ + MAKE_VIDPID(0x04d9, 0xa293), /* OBINLB USB-HID Keyboard (Anne Pro II) */ + MAKE_VIDPID(0x1532, 0x0266), /* Razer Huntman V2 Analog, non-functional DInput device */ + MAKE_VIDPID(0x1532, 0x0282), /* Razer Huntman Mini Analog, non-functional DInput device */ MAKE_VIDPID(0x26ce, 0x01a2), /* ASRock LED Controller */ }; + static Uint32 rog_chakram_list[] = { + MAKE_VIDPID(0x0b05, 0x1958), /* ROG Chakram Core Mouse */ + MAKE_VIDPID(0x0b05, 0x18e3), /* ROG Chakram (wired) Mouse */ + MAKE_VIDPID(0x0b05, 0x18e5), /* ROG Chakram (wireless) Mouse */ + MAKE_VIDPID(0x0b05, 0x1a18), /* ROG Chakram X (wired) Mouse */ + MAKE_VIDPID(0x0b05, 0x1a1a), /* ROG Chakram X (wireless) Mouse */ + MAKE_VIDPID(0x0b05, 0x1a1c), /* ROG Chakram X (Bluetooth) Mouse */ + }; + unsigned int i; Uint32 id; Uint16 vendor; @@ -2458,14 +2531,20 @@ SDL_bool SDL_ShouldIgnoreJoystick(const char *name, SDL_JoystickGUID guid) return SDL_TRUE; } } + if (!SDL_GetHintBoolean(SDL_HINT_JOYSTICK_ROG_CHAKRAM, SDL_FALSE)) { + for (i = 0; i < SDL_arraysize(rog_chakram_list); ++i) { + if (id == rog_chakram_list[i]) { + return SDL_TRUE; + } + } + } - 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; } @@ -2598,6 +2677,14 @@ Uint16 SDL_JoystickGetProductVersion(SDL_Joystick *joystick) 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)) { @@ -2623,74 +2710,31 @@ SDL_JoystickType SDL_JoystickGetType(SDL_Joystick *joystick) /* 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 */ @@ -2707,9 +2751,7 @@ int SDL_PrivateJoystickTouchpad(SDL_Joystick *joystick, int touchpad, int finger SDL_JoystickTouchpadInfo *touchpad_info; SDL_JoystickTouchpadFingerInfo *finger_info; int posted; -#if !SDL_EVENTS_DISABLED Uint32 event_type; -#endif if (touchpad < 0 || touchpad >= joystick->ntouchpads) { return 0; @@ -2753,7 +2795,6 @@ int SDL_PrivateJoystickTouchpad(SDL_Joystick *joystick, int touchpad, int finger } } -#if !SDL_EVENTS_DISABLED if (state == finger_info->state) { event_type = SDL_CONTROLLERTOUCHPADMOTION; } else if (state) { @@ -2761,7 +2802,6 @@ int SDL_PrivateJoystickTouchpad(SDL_Joystick *joystick, int touchpad, int finger } else { event_type = SDL_CONTROLLERTOUCHPADUP; } -#endif /* We ignore events if we don't have keyboard focus, except for touch release */ if (SDL_PrivateJoystickShouldIgnoreEvent()) { diff --git a/libs/SDL2/src/joystick/SDL_joystick_c.h b/libs/SDL2/src/joystick/SDL_joystick_c.h index 312e1133..0e50758a 100644 --- a/libs/SDL2/src/joystick/SDL_joystick_c.h +++ b/libs/SDL2/src/joystick/SDL_joystick_c.h @@ -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 void SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint16 *vendor, Uint1 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); @@ -168,6 +175,11 @@ typedef struct _SDL_GamepadMapping 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 +192,11 @@ typedef struct _SDL_GamepadMapping 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 --git a/libs/SDL2/src/joystick/SDL_sysjoystick.h b/libs/SDL2/src/joystick/SDL_sysjoystick.h index 8b879217..d5c8c0e2 100644 --- a/libs/SDL2/src/joystick/SDL_sysjoystick.h +++ b/libs/SDL2/src/joystick/SDL_sysjoystick.h @@ -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 @@ struct _SDL_Joystick { 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 @@ struct _SDL_Joystick }; /* 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 @@ typedef struct _SDL_JoystickDriver /* 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_WGI_JoystickDriver; 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 --git a/libs/SDL2/src/joystick/android/SDL_sysjoystick.c b/libs/SDL2/src/joystick/android/SDL_sysjoystick.c index b84c77db..104724af 100644 --- a/libs/SDL2/src/joystick/android/SDL_sysjoystick.c +++ b/libs/SDL2/src/joystick/android/SDL_sysjoystick.c @@ -103,6 +103,7 @@ keycode_to_SDL(int keycode) case AKEYCODE_BUTTON_THUMBR: button = SDL_CONTROLLER_BUTTON_RIGHTSTICK; break; + case AKEYCODE_MENU: case AKEYCODE_BUTTON_START: button = SDL_CONTROLLER_BUTTON_START; break; @@ -557,6 +558,12 @@ ANDROID_JoystickGetDeviceName(int device_index) return JoystickByDevIndex(device_index)->name; } +static const char * +ANDROID_JoystickGetDevicePath(int device_index) +{ + return NULL; +} + static int ANDROID_JoystickGetDevicePlayerIndex(int device_index) { @@ -712,6 +719,7 @@ SDL_JoystickDriver SDL_ANDROID_JoystickDriver = ANDROID_JoystickGetCount, ANDROID_JoystickDetect, ANDROID_JoystickGetDeviceName, + ANDROID_JoystickGetDevicePath, ANDROID_JoystickGetDevicePlayerIndex, ANDROID_JoystickSetDevicePlayerIndex, ANDROID_JoystickGetDeviceGUID, diff --git a/libs/SDL2/src/joystick/bsd/SDL_bsdjoystick.c b/libs/SDL2/src/joystick/bsd/SDL_bsdjoystick.c index f8859a53..d7b4d473 100644 --- a/libs/SDL2/src/joystick/bsd/SDL_bsdjoystick.c +++ b/libs/SDL2/src/joystick/bsd/SDL_bsdjoystick.c @@ -268,9 +268,15 @@ static const char * 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 @@ SDL_JoystickDriver SDL_BSD_JoystickDriver = BSD_JoystickGetCount, BSD_JoystickDetect, BSD_JoystickGetDeviceName, + BSD_JoystickGetDevicePath, BSD_JoystickGetDevicePlayerIndex, BSD_JoystickSetDevicePlayerIndex, BSD_JoystickGetDeviceGUID, diff --git a/libs/SDL2/src/joystick/controller_type.c b/libs/SDL2/src/joystick/controller_type.c new file mode 100644 index 00000000..36b024b7 --- /dev/null +++ b/libs/SDL2/src/joystick/controller_type.c @@ -0,0 +1,689 @@ +/* + 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, 0x0087 ), k_eControllerType_PS3Controller, NULL }, // HORI fighting mini stick + { 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, 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" }, // 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( 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) + + // 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( 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 +#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 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 --git a/libs/SDL2/src/joystick/controller_type.h b/libs/SDL2/src/joystick/controller_type.h index 26950345..9ec6c57e 100644 --- a/libs/SDL2/src/joystick/controller_type.h +++ b/libs/SDL2/src/joystick/controller_type.h @@ -53,8 +53,9 @@ typedef enum 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 @@ typedef enum 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 @@ typedef struct 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 --git a/libs/SDL2/src/joystick/darwin/SDL_iokitjoystick.c b/libs/SDL2/src/joystick/darwin/SDL_iokitjoystick.c index 7f251472..6b6945ea 100644 --- a/libs/SDL2/src/joystick/darwin/SDL_iokitjoystick.c +++ b/libs/SDL2/src/joystick/darwin/SDL_iokitjoystick.c @@ -744,7 +744,6 @@ DARWIN_JoystickDetect(void) } } -/* Function to get the device-dependent name of a joystick */ const char * DARWIN_JoystickGetDeviceName(int device_index) { @@ -752,6 +751,12 @@ DARWIN_JoystickGetDeviceName(int device_index) 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 @@ DARWIN_JoystickUpdate(SDL_Joystick *joystick) recDevice *device = joystick->hwdata; recElement *element; SInt32 value, range; - int i; + int i, goodRead = SDL_FALSE; if (!device) { return; @@ -996,7 +1001,6 @@ DARWIN_JoystickUpdate(SDL_Joystick *joystick) element = device->firstAxis; i = 0; - int goodRead = SDL_FALSE; while (element) { goodRead = GetHIDScaledCalibratedState(device, element, -32768, 32767, &value); if (goodRead) { @@ -1115,6 +1119,7 @@ SDL_JoystickDriver SDL_DARWIN_JoystickDriver = DARWIN_JoystickGetCount, DARWIN_JoystickDetect, DARWIN_JoystickGetDeviceName, + DARWIN_JoystickGetDevicePath, DARWIN_JoystickGetDevicePlayerIndex, DARWIN_JoystickSetDevicePlayerIndex, DARWIN_JoystickGetDeviceGUID, diff --git a/libs/SDL2/src/joystick/dummy/SDL_sysjoystick.c b/libs/SDL2/src/joystick/dummy/SDL_sysjoystick.c index ec1c8e65..3cf8da5f 100644 --- a/libs/SDL2/src/joystick/dummy/SDL_sysjoystick.c +++ b/libs/SDL2/src/joystick/dummy/SDL_sysjoystick.c @@ -52,6 +52,12 @@ DUMMY_JoystickGetDeviceName(int device_index) return NULL; } +static const char * +DUMMY_JoystickGetDevicePath(int device_index) +{ + return NULL; +} + static int DUMMY_JoystickGetDevicePlayerIndex(int device_index) { @@ -146,6 +152,7 @@ SDL_JoystickDriver SDL_DUMMY_JoystickDriver = DUMMY_JoystickGetCount, DUMMY_JoystickDetect, DUMMY_JoystickGetDeviceName, + DUMMY_JoystickGetDevicePath, DUMMY_JoystickGetDevicePlayerIndex, DUMMY_JoystickSetDevicePlayerIndex, DUMMY_JoystickGetDeviceGUID, diff --git a/libs/SDL2/src/joystick/emscripten/SDL_sysjoystick.c b/libs/SDL2/src/joystick/emscripten/SDL_sysjoystick.c index eb0ff2a7..1664a907 100644 --- a/libs/SDL2/src/joystick/emscripten/SDL_sysjoystick.c +++ b/libs/SDL2/src/joystick/emscripten/SDL_sysjoystick.c @@ -280,6 +280,12 @@ EMSCRIPTEN_JoystickGetDeviceName(int device_index) 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 @@ SDL_JoystickDriver SDL_EMSCRIPTEN_JoystickDriver = EMSCRIPTEN_JoystickGetCount, EMSCRIPTEN_JoystickDetect, EMSCRIPTEN_JoystickGetDeviceName, + EMSCRIPTEN_JoystickGetDevicePath, EMSCRIPTEN_JoystickGetDevicePlayerIndex, EMSCRIPTEN_JoystickSetDevicePlayerIndex, EMSCRIPTEN_JoystickGetDeviceGUID, diff --git a/libs/SDL2/src/joystick/haiku/SDL_haikujoystick.cc b/libs/SDL2/src/joystick/haiku/SDL_haikujoystick.cc index 38a97522..c0c6e012 100644 --- a/libs/SDL2/src/joystick/haiku/SDL_haikujoystick.cc +++ b/libs/SDL2/src/joystick/haiku/SDL_haikujoystick.cc @@ -64,15 +64,15 @@ extern "C" 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 @@ extern "C" { } -/* 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 @@ extern "C" HAIKU_JoystickGetCount, HAIKU_JoystickDetect, HAIKU_JoystickGetDeviceName, + HAIKU_JoystickGetDevicePath, HAIKU_JoystickGetDevicePlayerIndex, HAIKU_JoystickSetDevicePlayerIndex, HAIKU_JoystickGetDeviceGUID, diff --git a/libs/SDL2/src/joystick/hidapi/SDL_hidapi_gamecube.c b/libs/SDL2/src/joystick/hidapi/SDL_hidapi_gamecube.c index 5af93da6..dad4daea 100644 --- a/libs/SDL2/src/joystick/hidapi/SDL_hidapi_gamecube.c +++ b/libs/SDL2/src/joystick/hidapi/SDL_hidapi_gamecube.c @@ -53,6 +53,7 @@ typedef struct { /* Without this variable, hid_write starts to lag a TON */ SDL_bool rumbleUpdate; SDL_bool m_bUseButtonLabels; + SDL_bool useRumbleBrake; } SDL_DriverGameCube_Context; static SDL_bool @@ -70,7 +71,7 @@ HIDAPI_DriverGameCube_IsSupportedDevice(const char *name, SDL_GameControllerType } 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"; } @@ -92,6 +93,14 @@ static void SDLCALL SDL_GameControllerButtonReportingHintChanged(void *userdata, ctx->m_bUseButtonLabels = SDL_GetStringBoolean(hint, SDL_TRUE); } +static void SDLCALL SDL_JoystickGameCubeRumbleBrakeHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + if (hint) { + SDL_DriverGameCube_Context *ctx = (SDL_DriverGameCube_Context *)userdata; + ctx->useRumbleBrake = SDL_GetStringBoolean(hint, SDL_FALSE); + } +} + static Uint8 RemapButton(SDL_DriverGameCube_Context *ctx, Uint8 button) { if (!ctx->m_bUseButtonLabels) { @@ -142,6 +151,7 @@ HIDAPI_DriverGameCube_InitDevice(SDL_HIDAPI_Device *device) ctx->joysticks[2] = -1; ctx->joysticks[3] = -1; ctx->rumble[0] = rumbleMagic; + ctx->useRumbleBrake = SDL_FALSE; if (device->vendor_id != USB_VENDOR_NINTENDO) { ctx->pc_mode = SDL_TRUE; @@ -195,6 +205,8 @@ HIDAPI_DriverGameCube_InitDevice(SDL_HIDAPI_Device *device) } } + SDL_AddHintCallback(SDL_HINT_JOYSTICK_GAMECUBE_RUMBLE_BRAKE, + SDL_JoystickGameCubeRumbleBrakeHintChanged, ctx); SDL_AddHintCallback(SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS, SDL_GameControllerButtonReportingHintChanged, ctx); @@ -439,12 +451,22 @@ HIDAPI_DriverGameCube_RumbleJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *jo for (i = 0; i < MAX_CONTROLLERS; i += 1) { if (joystick->instance_id == ctx->joysticks[i]) { if (ctx->wireless[i]) { - return SDL_SetError("Ninteno GameCube WaveBird controllers do not support rumble"); + return SDL_SetError("Nintendo GameCube WaveBird controllers do not support rumble"); } if (!ctx->rumbleAllowed[i]) { return SDL_SetError("Second USB cable for WUP-028 not connected"); } - val = (low_frequency_rumble > 0 || high_frequency_rumble > 0); + if (ctx->useRumbleBrake) { + if (low_frequency_rumble == 0 && high_frequency_rumble > 0) { + val = 0; /* if only low is 0 we want to do a regular stop*/ + } else if (low_frequency_rumble == 0 && high_frequency_rumble == 0) { + val = 2; /* if both frequencies are 0 we want to do a hard stop */ + } else { + val = 1; /* normal rumble */ + } + } else { + val = (low_frequency_rumble > 0 || high_frequency_rumble > 0); + } if (val != ctx->rumble[i + 1]) { ctx->rumble[i + 1] = val; ctx->rumbleUpdate = SDL_TRUE; @@ -454,8 +476,7 @@ HIDAPI_DriverGameCube_RumbleJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *jo } /* Should never get here! */ - SDL_SetError("Couldn't find joystick"); - return -1; + return SDL_SetError("Couldn't find joystick"); } static int @@ -523,6 +544,8 @@ HIDAPI_DriverGameCube_FreeDevice(SDL_HIDAPI_Device *device) SDL_DelHintCallback(SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS, SDL_GameControllerButtonReportingHintChanged, ctx); + SDL_DelHintCallback(SDL_HINT_JOYSTICK_GAMECUBE_RUMBLE_BRAKE, + SDL_JoystickGameCubeRumbleBrakeHintChanged, ctx); SDL_LockMutex(device->dev_lock); { diff --git a/libs/SDL2/src/joystick/hidapi/SDL_hidapi_luna.c b/libs/SDL2/src/joystick/hidapi/SDL_hidapi_luna.c index ead55af3..4b283e28 100644 --- a/libs/SDL2/src/joystick/hidapi/SDL_hidapi_luna.c +++ b/libs/SDL2/src/joystick/hidapi/SDL_hidapi_luna.c @@ -54,7 +54,7 @@ HIDAPI_DriverLuna_IsSupportedDevice(const char *name, SDL_GameControllerType typ } 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 @@ HIDAPI_DriverLuna_HandleBluetoothStatePacket(SDL_Joystick *joystick, SDL_DriverL /* 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 --git a/libs/SDL2/src/joystick/hidapi/SDL_hidapi_ps4.c b/libs/SDL2/src/joystick/hidapi/SDL_hidapi_ps4.c index 12954126..7c87043c 100644 --- a/libs/SDL2/src/joystick/hidapi/SDL_hidapi_ps4.c +++ b/libs/SDL2/src/joystick/hidapi/SDL_hidapi_ps4.c @@ -155,7 +155,7 @@ HIDAPI_DriverPS4_IsSupportedDevice(const char *name, SDL_GameControllerType type } 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"; @@ -177,6 +177,12 @@ static SDL_bool HIDAPI_DriverPS4_CanRumble(Uint16 vendor_id, Uint16 product_id) (product_id == USB_PRODUCT_RAZER_PANTHERA || product_id == USB_PRODUCT_RAZER_PANTHERA_EVO)) { return SDL_FALSE; } + + /* The Victrix Pro FS v2 will hang on reboot if we send output reports */ + if (vendor_id == USB_VENDOR_PDP && product_id == USB_PRODUCT_VICTRIX_FS_PRO_V2) { + return SDL_FALSE; + } + return SDL_TRUE; } @@ -795,18 +801,18 @@ HIDAPI_DriverPS4_HandleStatePacket(SDL_Joystick *joystick, SDL_hid_device *dev, 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 --git a/libs/SDL2/src/joystick/hidapi/SDL_hidapi_ps5.c b/libs/SDL2/src/joystick/hidapi/SDL_hidapi_ps5.c index 6d7f87d5..5fcdf222 100644 --- a/libs/SDL2/src/joystick/hidapi/SDL_hidapi_ps5.c +++ b/libs/SDL2/src/joystick/hidapi/SDL_hidapi_ps5.c @@ -59,6 +59,7 @@ typedef enum { k_EPS5FeatureReportIdCalibration = 0x05, k_EPS5FeatureReportIdSerialNumber = 0x09, + k_EPS5FeatureReportIdFirmwareInfo = 0x20, } EPS5FeatureReportId; typedef struct @@ -119,7 +120,7 @@ typedef struct 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 @@ typedef struct { 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 @@ HIDAPI_DriverPS5_IsSupportedDevice(const char *name, SDL_GameControllerType type } 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"; @@ -395,12 +397,19 @@ HIDAPI_DriverPS5_UpdateEffects(SDL_HIDAPI_Device *device, int effect_mask) } 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 +610,14 @@ HIDAPI_DriverPS5_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joystick) 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) { @@ -747,7 +764,11 @@ HIDAPI_DriverPS5_SendJoystickEffect(SDL_HIDAPI_Device *device, SDL_Joystick *joy } } - return SDL_HIDAPI_SendRumbleAndUnlock(device, data, report_size); + if (SDL_HIDAPI_SendRumbleAndUnlock(device, data, report_size) != report_size) { + return -1; + } + + return 0; } static int @@ -957,7 +978,10 @@ HIDAPI_DriverPS5_HandleStatePacket(SDL_Joystick *joystick, SDL_hid_device *dev, axis = ((int)packet->ucRightJoystickY * 257) - 32768; SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis); - if (packet->ucBatteryLevel & 0x10) { + /* A check of packet->ucBatteryLevel & 0x10 should work as a check for BT vs USB but doesn't + * seem to always work. Possibly related to being 100% charged? + */ + if (!ctx->is_bluetooth) { /* 0x20 set means fully charged */ SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_WIRED); } else { diff --git a/libs/SDL2/src/joystick/hidapi/SDL_hidapi_rumble.c b/libs/SDL2/src/joystick/hidapi/SDL_hidapi_rumble.c index bf376277..9cbdb959 100644 --- a/libs/SDL2/src/joystick/hidapi/SDL_hidapi_rumble.c +++ b/libs/SDL2/src/joystick/hidapi/SDL_hidapi_rumble.c @@ -53,7 +53,7 @@ typedef struct SDL_HIDAPI_RumbleContext 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 --git a/libs/SDL2/src/joystick/hidapi/SDL_hidapi_stadia.c b/libs/SDL2/src/joystick/hidapi/SDL_hidapi_stadia.c index 0a5c2584..35025db9 100644 --- a/libs/SDL2/src/joystick/hidapi/SDL_hidapi_stadia.c +++ b/libs/SDL2/src/joystick/hidapi/SDL_hidapi_stadia.c @@ -55,7 +55,7 @@ HIDAPI_DriverStadia_IsSupportedDevice(const char *name, SDL_GameControllerType t } 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 --git a/libs/SDL2/src/joystick/hidapi/SDL_hidapi_steam.c b/libs/SDL2/src/joystick/hidapi/SDL_hidapi_steam.c index b69c598d..bbf1f0e2 100644 --- a/libs/SDL2/src/joystick/hidapi/SDL_hidapi_steam.c +++ b/libs/SDL2/src/joystick/hidapi/SDL_hidapi_steam.c @@ -1004,7 +1004,7 @@ HIDAPI_DriverSteam_IsSupportedDevice(const char *name, SDL_GameControllerType ty } 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 --git a/libs/SDL2/src/joystick/hidapi/SDL_hidapi_switch.c b/libs/SDL2/src/joystick/hidapi/SDL_hidapi_switch.c index d97e1f9c..3fbd91e0 100644 --- a/libs/SDL2/src/joystick/hidapi/SDL_hidapi_switch.c +++ b/libs/SDL2/src/joystick/hidapi/SDL_hidapi_switch.c @@ -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, @@ -114,6 +119,14 @@ typedef enum { #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 { @@ -266,6 +279,16 @@ typedef struct { 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; @@ -282,9 +305,29 @@ HasHomeLED(int vendor_id, int product_id) return SDL_FALSE; } + /* The Nintendo Online classic controllers don't have a Home LED */ + if (vendor_id == USB_VENDOR_NINTENDO && + (product_id == USB_PRODUCT_NINTENDO_N64_CONTROLLER || + product_id == USB_PRODUCT_NINTENDO_SEGA_GENESIS_CONTROLLER || + product_id == USB_PRODUCT_NINTENDO_SNES_CONTROLLER)) { + return SDL_FALSE; + } + return SDL_TRUE; } +static SDL_bool +AlwaysUsesLabels(int vendor_id, int product_id) +{ + /* These controllers don't have a diamond button configuration, so always use labels */ + if (vendor_id == USB_VENDOR_NINTENDO && + (product_id == USB_PRODUCT_NINTENDO_N64_CONTROLLER || + product_id == USB_PRODUCT_NINTENDO_SEGA_GENESIS_CONTROLLER)) { + return SDL_TRUE; + } + return SDL_FALSE; +} + static SDL_bool IsGameCubeFormFactor(int vendor_id, int product_id) { @@ -319,7 +362,7 @@ HIDAPI_DriverSwitch_IsSupportedDevice(const char *name, SDL_GameControllerType t } 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) { @@ -332,8 +375,24 @@ HIDAPI_DriverSwitch_GetDeviceName(Uint16 vendor_id, Uint16 product_id) } if (product_id == USB_PRODUCT_NINTENDO_SWITCH_JOY_CON_RIGHT) { + /* Use the given name for the Nintendo Online NES Controllers */ + if (SDL_strncmp(name, "NES Controller", 14) == 0) { + return name; + } return "Nintendo Switch Joy-Con Right"; } + + 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"; + } } return "Nintendo Switch Pro Controller"; @@ -769,6 +828,72 @@ static SDL_bool LoadStickCalibration(SDL_DriverSwitch_Context *ctx, Uint8 input_ 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; @@ -914,6 +1039,11 @@ HIDAPI_DriverSwitch_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joysti 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; @@ -967,8 +1097,12 @@ HIDAPI_DriverSwitch_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joysti ctx->m_bIsGameCube = SDL_TRUE; } - SDL_AddHintCallback(SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS, - SDL_GameControllerButtonReportingHintChanged, ctx); + if (AlwaysUsesLabels(device->vendor_id, device->product_id)) { + ctx->m_bUseButtonLabels = SDL_TRUE; + } else { + SDL_AddHintCallback(SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS, + SDL_GameControllerButtonReportingHintChanged, ctx); + } /* Initialize the joystick capabilities */ if (ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConLeft || @@ -1023,8 +1157,7 @@ HIDAPI_DriverSwitch_ActuallyRumbleJoystick(SDL_DriverSwitch_Context *ctx, Uint16 ctx->m_bRumbleActive = (low_frequency_rumble || high_frequency_rumble) ? SDL_TRUE : SDL_FALSE; if (!WriteRumble(ctx)) { - SDL_SetError("Couldn't send rumble packet"); - return -1; + return SDL_SetError("Couldn't send rumble packet"); } return 0; } @@ -1147,20 +1280,6 @@ HIDAPI_DriverSwitch_SetJoystickSensorsEnabled(SDL_HIDAPI_Device *device, SDL_Joy 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; @@ -1358,13 +1477,13 @@ static void SendSensorUpdate(SDL_Joystick *joystick, SDL_DriverSwitch_Context *c * 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 */ @@ -1441,20 +1560,20 @@ static void HandleFullControllerState(SDL_Joystick *joystick, SDL_DriverSwitch_C * 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); } } diff --git a/libs/SDL2/src/joystick/hidapi/SDL_hidapi_xbox360.c b/libs/SDL2/src/joystick/hidapi/SDL_hidapi_xbox360.c index da7aa240..28e04cfa 100644 --- a/libs/SDL2/src/joystick/hidapi/SDL_hidapi_xbox360.c +++ b/libs/SDL2/src/joystick/hidapi/SDL_hidapi_xbox360.c @@ -83,7 +83,7 @@ HIDAPI_DriverXbox360_IsSupportedDevice(const char *name, SDL_GameControllerType } 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; } diff --git a/libs/SDL2/src/joystick/hidapi/SDL_hidapi_xbox360w.c b/libs/SDL2/src/joystick/hidapi/SDL_hidapi_xbox360w.c index e6e6171a..0c7dfef9 100644 --- a/libs/SDL2/src/joystick/hidapi/SDL_hidapi_xbox360w.c +++ b/libs/SDL2/src/joystick/hidapi/SDL_hidapi_xbox360w.c @@ -57,7 +57,7 @@ HIDAPI_DriverXbox360W_IsSupportedDevice(const char *name, SDL_GameControllerType } 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 @@ UpdatePowerLevel(SDL_Joystick *joystick, Uint8 level) 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); } } diff --git a/libs/SDL2/src/joystick/hidapi/SDL_hidapi_xboxone.c b/libs/SDL2/src/joystick/hidapi/SDL_hidapi_xboxone.c index e325c9fc..35635b72 100644 --- a/libs/SDL2/src/joystick/hidapi/SDL_hidapi_xboxone.c +++ b/libs/SDL2/src/joystick/hidapi/SDL_hidapi_xboxone.c @@ -156,7 +156,7 @@ SetInitState(SDL_DriverXboxOne_Context *ctx, SDL_XboxOneInitState state) 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 @@ SendAckIfNeeded(SDL_HIDAPI_Device *device, Uint8 *data, int size) SDL_SetError("Couldn't send ack packet"); } } -#endif /* __WIN32__ */ +#endif /* defined(__WIN32__) || defined(__WINGDK__ */ } #if 0 @@ -285,7 +285,7 @@ HIDAPI_DriverXboxOne_IsSupportedDevice(const char *name, SDL_GameControllerType } 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; } @@ -478,30 +478,6 @@ HIDAPI_DriverXboxOne_SetJoystickSensorsEnabled(SDL_HIDAPI_Device *device, SDL_Jo return SDL_Unsupported(); } -static Sint16 FilterLeftThumb(Sint16 axis) -{ - if (axis <= XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE && axis >= -XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE) { - return 0; - } - return axis; -} - -static Sint16 FilterRightThumb(Sint16 axis) -{ - if (axis <= XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE && axis >= -XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE) { - return 0; - } - return axis; -} - -static Sint16 FilterTrigger(Sint16 axis) -{ - if (axis <= XINPUT_GAMEPAD_TRIGGER_THRESHOLD) { - return SDL_MIN_SINT16; - } - return axis; -} - static void HIDAPI_DriverXboxOne_HandleStatePacket(SDL_Joystick *joystick, SDL_DriverXboxOne_Context *ctx, Uint8 *data, int size) { @@ -636,7 +612,7 @@ HIDAPI_DriverXboxOne_HandleStatePacket(SDL_Joystick *joystick, SDL_DriverXboxOne if (axis == -32768 && size == 30 && (data[22] & 0x80) != 0) { axis = 32767; } - SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, FilterTrigger(axis)); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis); axis = ((int)*(Sint16*)(&data[8]) * 64) - 32768; if (axis == -32768 && size == 30 && (data[22] & 0x40) != 0) { @@ -645,16 +621,16 @@ HIDAPI_DriverXboxOne_HandleStatePacket(SDL_Joystick *joystick, SDL_DriverXboxOne if (axis == 32704) { axis = 32767; } - SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, FilterTrigger(axis)); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis); axis = *(Sint16*)(&data[10]); - SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTX, FilterLeftThumb(axis)); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTX, axis); axis = *(Sint16*)(&data[12]); - SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTY, FilterLeftThumb(~axis)); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTY, ~axis); axis = *(Sint16*)(&data[14]); - SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTX, FilterRightThumb(axis)); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTX, axis); axis = *(Sint16*)(&data[16]); - SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, FilterRightThumb(~axis)); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, ~axis); SDL_memcpy(ctx->last_state, data, SDL_min(size, sizeof(ctx->last_state))); } @@ -854,22 +830,22 @@ HIDAPI_DriverXboxOneBluetooth_HandleStatePacket(SDL_Joystick *joystick, SDL_Driv if (axis == 32704) { axis = 32767; } - SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, FilterTrigger(axis)); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis); axis = ((int)*(Sint16*)(&data[11]) * 64) - 32768; if (axis == 32704) { axis = 32767; } - SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, FilterTrigger(axis)); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis); axis = (int)*(Uint16*)(&data[1]) - 0x8000; - SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTX, FilterLeftThumb(axis)); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTX, axis); axis = (int)*(Uint16*)(&data[3]) - 0x8000; - SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTY, FilterLeftThumb(axis)); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTY, axis); axis = (int)*(Uint16*)(&data[5]) - 0x8000; - SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTX, FilterRightThumb(axis)); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTX, axis); axis = (int)*(Uint16*)(&data[7]) - 0x8000; - SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, FilterRightThumb(axis)); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis); SDL_memcpy(ctx->last_state, data, SDL_min(size, sizeof(ctx->last_state))); } @@ -936,7 +912,7 @@ HIDAPI_DriverXboxOne_UpdateInitState(SDL_HIDAPI_Device *device, SDL_DriverXboxOn 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 --git a/libs/SDL2/src/joystick/hidapi/SDL_hidapijoystick.c b/libs/SDL2/src/joystick/hidapi/SDL_hidapijoystick.c index 959b7241..cf35538d 100644 --- a/libs/SDL2/src/joystick/hidapi/SDL_hidapijoystick.c +++ b/libs/SDL2/src/joystick/hidapi/SDL_hidapijoystick.c @@ -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 @@ -110,11 +110,96 @@ HIDAPI_RemapVal(float val, float val_min, float val_max, float output_min, float 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 */ + 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 +219,8 @@ HIDAPI_GetDeviceDriver(SDL_HIDAPI_Device *device) 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 (SDL_ShouldIgnoreJoystick(device->name, device->guid)) { return NULL; } @@ -154,7 +233,7 @@ HIDAPI_GetDeviceDriver(SDL_HIDAPI_Device *device) } } - 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)) { @@ -206,8 +285,8 @@ HIDAPI_SetupDeviceDriver(SDL_HIDAPI_Device *device) 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); } @@ -227,7 +306,7 @@ HIDAPI_CleanupDeviceDriver(SDL_HIDAPI_Device *device) } /* Disconnect any joysticks */ - while (device->num_joysticks) { + while (device->num_joysticks && device->joysticks) { HIDAPI_JoystickDisconnected(device, device->joysticks[0]); } @@ -309,8 +388,7 @@ HIDAPI_JoystickInit(void) #endif if (SDL_hid_init() < 0) { - SDL_SetError("Couldn't initialize hidapi"); - return -1; + return SDL_SetError("Couldn't initialize hidapi"); } for (i = 0; i < SDL_arraysize(SDL_HIDAPI_drivers); ++i) { @@ -464,38 +542,6 @@ HIDAPI_AddDevice(struct SDL_hid_device_info *info) 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); @@ -628,13 +674,13 @@ HIDAPI_IsEquivalentToDevice(Uint16 vendor_id, Uint16 product_id, SDL_HIDAPI_Devi /* 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; } @@ -663,7 +709,7 @@ HIDAPI_IsDeviceTypePresent(SDL_GameControllerType type) device = SDL_HIDAPI_devices; while (device) { 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; } @@ -784,6 +830,21 @@ HIDAPI_JoystickGetDeviceName(int device_index) 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) { @@ -871,8 +932,7 @@ HIDAPI_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint1 result = device->driver->RumbleJoystick(device, joystick, low_frequency_rumble, high_frequency_rumble); } else { - SDL_SetError("Rumble failed, device disconnected"); - result = -1; + result = SDL_SetError("Rumble failed, device disconnected"); } return result; @@ -888,8 +948,7 @@ HIDAPI_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 result = device->driver->RumbleJoystickTriggers(device, joystick, left_rumble, right_rumble); } else { - SDL_SetError("Rumble failed, device disconnected"); - result = -1; + result = SDL_SetError("Rumble failed, device disconnected"); } return result; @@ -919,8 +978,7 @@ HIDAPI_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue result = device->driver->SetJoystickLED(device, joystick, red, green, blue); } else { - SDL_SetError("SetLED failed, device disconnected"); - result = -1; + result = SDL_SetError("SetLED failed, device disconnected"); } return result; @@ -936,8 +994,7 @@ HIDAPI_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int size) result = device->driver->SendJoystickEffect(device, joystick, data, size); } else { - SDL_SetError("SendEffect failed, device disconnected"); - result = -1; + result = SDL_SetError("SendEffect failed, device disconnected"); } return result; @@ -953,8 +1010,7 @@ HIDAPI_JoystickSetSensorsEnabled(SDL_Joystick *joystick, SDL_bool enabled) result = device->driver->SetJoystickSensorsEnabled(device, joystick, enabled); } else { - SDL_SetError("SetSensorsEnabled failed, device disconnected"); - result = -1; + result = SDL_SetError("SetSensorsEnabled failed, device disconnected"); } return result; @@ -1020,6 +1076,7 @@ HIDAPI_JoystickQuit(void) SDL_hid_exit(); + SDL_HIDAPI_change_count = 0; shutting_down = SDL_FALSE; initialized = SDL_FALSE; } @@ -1036,6 +1093,7 @@ SDL_JoystickDriver SDL_HIDAPI_JoystickDriver = HIDAPI_JoystickGetCount, HIDAPI_JoystickDetect, HIDAPI_JoystickGetDeviceName, + HIDAPI_JoystickGetDevicePath, HIDAPI_JoystickGetDevicePlayerIndex, HIDAPI_JoystickSetDevicePlayerIndex, HIDAPI_JoystickGetDeviceGUID, diff --git a/libs/SDL2/src/joystick/hidapi/SDL_hidapijoystick_c.h b/libs/SDL2/src/joystick/hidapi/SDL_hidapijoystick_c.h index c1b75d8d..73c2ad92 100644 --- a/libs/SDL2/src/joystick/hidapi/SDL_hidapijoystick_c.h +++ b/libs/SDL2/src/joystick/hidapi/SDL_hidapijoystick_c.h @@ -90,7 +90,7 @@ typedef struct _SDL_HIDAPI_DeviceDriver 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); diff --git a/libs/SDL2/src/joystick/iphoneos/SDL_mfijoystick.m b/libs/SDL2/src/joystick/iphoneos/SDL_mfijoystick.m index ed238425..7c701319 100644 --- a/libs/SDL2/src/joystick/iphoneos/SDL_mfijoystick.m +++ b/libs/SDL2/src/joystick/iphoneos/SDL_mfijoystick.m @@ -69,6 +69,9 @@ static NSString *GCInputXboxShareButton = @"Button Share"; #if !((__IPHONE_OS_VERSION_MAX_ALLOWED >= 130000) || (__APPLETV_OS_VERSION_MAX_ALLOWED >= 130000) || (__MAC_OS_VERSION_MAX_ALLOWED >= 1500000)) @property(nonatomic, readonly) NSString *productCategory; #endif +#if !((__IPHONE_OS_VERSION_MAX_ALLOWED >= 140500) || (__APPLETV_OS_VERSION_MAX_ALLOWED >= 140500) || (__MAC_OS_X_VERSION_MAX_ALLOWED >= 110300)) +@property(class, nonatomic, readwrite) BOOL shouldMonitorBackgroundEvents; +#endif @end @interface GCExtendedGamepad (SDL) #if !((__IPHONE_OS_VERSION_MAX_ALLOWED >= 121000) || (__APPLETV_OS_VERSION_MAX_ALLOWED >= 121000) || (__MAC_OS_VERSION_MAX_ALLOWED >= 1401000)) @@ -181,8 +184,12 @@ IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCController *controlle Uint16 vendor = 0; Uint16 product = 0; Uint8 subtype = 0; - const char *name = NULL; + + if ((@available(macOS 11.3, *)) && !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); @@ -206,6 +213,7 @@ IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCController *controlle BOOL is_MFi = (!is_xbox && !is_ps4 && !is_ps5); #endif int nbuttons = 0; + BOOL has_direct_menu; #ifdef SDL_JOYSTICK_HIDAPI if ((is_xbox && HIDAPI_IsDeviceTypePresent(SDL_CONTROLLER_TYPE_XBOXONE)) || @@ -244,7 +252,7 @@ IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCController *controlle 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) { @@ -327,6 +335,15 @@ IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCController *controlle subtype = 1; } + if (SDL_strcmp(name, "Backbone One") == 0) { + /* 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; + device->has_xbox_share_button = SDL_FALSE; + } + } + device->naxes = 6; /* 2 thumbsticks and 2 triggers */ device->nhats = 1; /* d-pad */ device->nbuttons = nbuttons; @@ -559,6 +576,7 @@ IOS_JoystickInit(void) #endif @autoreleasepool { + NSNotificationCenter *center; #ifdef SDL_JOYSTICK_iOS_ACCELEROMETER if (SDL_GetHintBoolean(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, SDL_TRUE)) { /* Default behavior, accelerometer as joystick */ @@ -583,7 +601,7 @@ IOS_JoystickInit(void) SDL_AppleTVRemoteRotationHintChanged, NULL); #endif /* TARGET_OS_TV */ - NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; + center = [NSNotificationCenter defaultCenter]; connectObserver = [center addObserverForName:GCControllerDidConnectNotification object:nil @@ -631,6 +649,12 @@ IOS_JoystickGetDeviceName(int device_index) return device ? device->name : "Unknown"; } +static const char * +IOS_JoystickGetDevicePath(int device_index) +{ + return NULL; +} + static int IOS_JoystickGetDevicePlayerIndex(int device_index) { @@ -719,7 +743,7 @@ IOS_JoystickOpen(SDL_Joystick *joystick, int device_index) } #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) { @@ -732,7 +756,7 @@ IOS_JoystickOpen(SDL_Joystick *joystick, int device_index) #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]; @@ -885,9 +909,8 @@ IOS_MFIJoystickUpdate(SDL_Joystick *joystick) #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) { @@ -944,7 +967,7 @@ IOS_MFIJoystickUpdate(SDL_Joystick *joystick) } #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]; @@ -1037,7 +1060,7 @@ IOS_MFIJoystickUpdate(SDL_Joystick *joystick) } #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; @@ -1078,8 +1101,8 @@ IOS_MFIJoystickUpdate(SDL_Joystick *joystick) #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 @@ -1089,7 +1112,7 @@ IOS_MFIJoystickUpdate(SDL_Joystick *joystick) -(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; @@ -1105,8 +1128,9 @@ IOS_MFIJoystickUpdate(SDL_Joystick *joystick) -(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"); @@ -1121,8 +1145,8 @@ IOS_MFIJoystickUpdate(SDL_Joystick *joystick) } 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]); @@ -1135,7 +1159,7 @@ IOS_MFIJoystickUpdate(SDL_Joystick *joystick) 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]); @@ -1151,11 +1175,13 @@ IOS_MFIJoystickUpdate(SDL_Joystick *joystick) } } --(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) { @@ -1169,7 +1195,6 @@ IOS_MFIJoystickUpdate(SDL_Joystick *joystick) return nil; } - __weak typeof(self) weakSelf = self; self.engine.stoppedHandler = ^(CHHapticEngineStoppedReason stoppedReason) { SDL_RumbleMotor *_this = weakSelf; if (_this == nil) { @@ -1251,7 +1276,7 @@ IOS_MFIJoystickUpdate(SDL_Joystick *joystick) 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]; @@ -1279,7 +1304,7 @@ IOS_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 h 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) { @@ -1309,7 +1334,7 @@ IOS_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 ri 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) { @@ -1342,7 +1367,7 @@ IOS_JoystickGetCapabilities(SDL_Joystick *joystick) 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) { @@ -1379,7 +1404,7 @@ IOS_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue) 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) { @@ -1412,7 +1437,7 @@ IOS_JoystickSetSensorsEnabled(SDL_Joystick *joystick, SDL_bool enabled) 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) { @@ -1475,7 +1500,7 @@ IOS_JoystickClose(SDL_Joystick *joystick) 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]) { @@ -1573,7 +1598,7 @@ SDL_bool IOS_SupportedHIDDevice(IOHIDDeviceRef device) 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]; } @@ -1607,7 +1632,7 @@ IOS_GameControllerGetAppleSFSymbolsNameForButton(SDL_GameController *gamecontrol 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; @@ -1720,7 +1745,7 @@ IOS_GameControllerGetAppleSFSymbolsNameForAxis(SDL_GameController *gamecontrolle 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; @@ -1761,6 +1786,7 @@ SDL_JoystickDriver SDL_IOS_JoystickDriver = IOS_JoystickGetCount, IOS_JoystickDetect, IOS_JoystickGetDeviceName, + IOS_JoystickGetDevicePath, IOS_JoystickGetDevicePlayerIndex, IOS_JoystickSetDevicePlayerIndex, IOS_JoystickGetDeviceGUID, diff --git a/libs/SDL2/src/joystick/linux/SDL_sysjoystick.c b/libs/SDL2/src/joystick/linux/SDL_sysjoystick.c index 851448ac..307dd564 100644 --- a/libs/SDL2/src/joystick/linux/SDL_sysjoystick.c +++ b/libs/SDL2/src/joystick/linux/SDL_sysjoystick.c @@ -82,6 +82,10 @@ #define DEBUG_INPUT_EVENTS 1 #endif +#if 0 +#define DEBUG_GAMEPAD_MAPPING 1 +#endif + typedef enum { ENUMERATION_UNSET, @@ -109,6 +113,7 @@ typedef struct SDL_joylist_item /* Steam Controller support */ SDL_bool m_bSteamController; + SDL_bool checked_mapping; SDL_GamepadMapping *mapping; } SDL_joylist_item; @@ -492,21 +497,6 @@ static void SteamControllerDisconnectedCallback(int device_instance) } } -#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) { @@ -561,6 +551,21 @@ IsJoystickDeviceNode(const char *node) } } +#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) { @@ -605,6 +610,26 @@ LINUX_InotifyJoystickDetect(void) } #endif /* HAVE_INOTIFY */ +static int get_event_joystick_index(int event) +{ + int joystick_index = -1; + int i, count; + struct dirent **entries = NULL; + char path[PATH_MAX]; + + SDL_snprintf(path, SDL_arraysize(path), "/sys/class/input/event%d/device", event); + count = scandir(path, &entries, NULL, alphasort); + for (i = 0; i < count; ++i) { + if (SDL_strncmp(entries[i]->d_name, "js", 2) == 0) { + joystick_index = SDL_atoi(entries[i]->d_name+2); + } + free(entries[i]); /* This should NOT be SDL_free() */ + } + free(entries); /* This should NOT be SDL_free() */ + + return joystick_index; +} + /* Detect devices by reading /dev/input. In the inotify code path we * have to do this the first time, to detect devices that already existed * before we started; in the non-inotify code path we do this repeatedly @@ -615,12 +640,39 @@ filter_entries(const struct dirent *entry) return IsJoystickDeviceNode(entry->d_name); } static int -sort_entries(const struct dirent **a, const struct dirent **b) +sort_entries(const void *_a, const void *_b) { - int numA = SDL_atoi((*a)->d_name+5); - int numB = SDL_atoi((*b)->d_name+5); + const struct dirent **a = (const struct dirent **)_a; + const struct dirent **b = (const struct dirent **)_b; + int numA, numB; + int offset; + + if (SDL_classic_joysticks) { + offset = 2; /* strlen("js") */ + numA = SDL_atoi((*a)->d_name+offset); + numB = SDL_atoi((*b)->d_name+offset); + } else { + offset = 5; /* strlen("event") */ + numA = SDL_atoi((*a)->d_name+offset); + numB = SDL_atoi((*b)->d_name+offset); + + /* See if we can get the joystick ordering */ + { + int jsA = get_event_joystick_index(numA); + int jsB = get_event_joystick_index(numB); + if (jsA >= 0 && jsB >= 0) { + numA = jsA; + numB = jsB; + } else if (jsA >= 0) { + return -1; + } else if (jsB >= 0) { + return 1; + } + } + } return (numA - numB); } + static void LINUX_FallbackJoystickDetect(void) { @@ -633,10 +685,13 @@ LINUX_FallbackJoystickDetect(void) /* Opening input devices can generate synchronous device I/O, so avoid it if we can */ if (stat("/dev/input", &sb) == 0 && sb.st_mtime != last_input_dir_mtime) { int i, count; - struct dirent **entries; + struct dirent **entries = NULL; char path[PATH_MAX]; - count = scandir("/dev/input", &entries, filter_entries, sort_entries); + count = scandir("/dev/input", &entries, filter_entries, NULL); + if (count > 1) { + qsort(entries, count, sizeof(*entries), sort_entries); + } for (i = 0; i < count; ++i) { SDL_snprintf(path, SDL_arraysize(path), "/dev/input/%s", entries[i]->d_name); MaybeAddDevice(path); @@ -683,29 +738,7 @@ LINUX_JoystickInit(void) SDL_classic_joysticks = SDL_GetHintBoolean(SDL_HINT_LINUX_JOYSTICK_CLASSIC, SDL_FALSE); -#if SDL_USE_LIBUDEV - if (enumeration_method == ENUMERATION_UNSET) { - if (SDL_GetHintBoolean("SDL_JOYSTICK_DISABLE_UDEV", SDL_FALSE)) { - SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, - "udev disabled by SDL_JOYSTICK_DISABLE_UDEV"); - enumeration_method = ENUMERATION_FALLBACK; - - } else if (access("/.flatpak-info", F_OK) == 0 - || access("/run/host/container-manager", F_OK) == 0) { - /* Explicitly check `/.flatpak-info` because, for old versions of - * Flatpak, this was the only available way to tell if we were in - * a Flatpak container. */ - SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, - "Container detected, disabling udev integration"); - enumeration_method = ENUMERATION_FALLBACK; - - } else { - SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, - "Using udev for joystick device discovery"); - enumeration_method = ENUMERATION_LIBUDEV; - } - } -#endif + enumeration_method = ENUMERATION_UNSET; /* First see if the user specified one or more joysticks to use */ if (devices != NULL) { @@ -734,6 +767,28 @@ LINUX_JoystickInit(void) LINUX_JoystickDetect(); #if SDL_USE_LIBUDEV + if (enumeration_method == ENUMERATION_UNSET) { + if (SDL_GetHintBoolean("SDL_JOYSTICK_DISABLE_UDEV", SDL_FALSE)) { + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + "udev disabled by SDL_JOYSTICK_DISABLE_UDEV"); + enumeration_method = ENUMERATION_FALLBACK; + + } else if (access("/.flatpak-info", F_OK) == 0 + || access("/run/host/container-manager", F_OK) == 0) { + /* Explicitly check `/.flatpak-info` because, for old versions of + * Flatpak, this was the only available way to tell if we were in + * a Flatpak container. */ + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + "Container detected, disabling udev integration"); + enumeration_method = ENUMERATION_FALLBACK; + + } else { + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + "Using udev for joystick device discovery"); + enumeration_method = ENUMERATION_LIBUDEV; + } + } + if (enumeration_method == ENUMERATION_LIBUDEV) { if (SDL_UDEV_Init() < 0) { return SDL_SetError("Could not initialize UDEV"); @@ -803,13 +858,18 @@ JoystickByDevIndex(int device_index) 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) { @@ -870,6 +930,37 @@ allocate_balldata(SDL_Joystick *joystick) 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) { @@ -880,6 +971,7 @@ ConfigJoystick(SDL_Joystick *joystick, int fd) 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) && @@ -907,10 +999,45 @@ ConfigJoystick(SDL_Joystick *joystick, int fd) ++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)) { @@ -922,9 +1049,9 @@ ConfigJoystick(SDL_Joystick *joystick, int fd) } #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; @@ -952,24 +1079,6 @@ ConfigJoystick(SDL_Joystick *joystick, int fd) ++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; } @@ -1015,14 +1124,19 @@ ConfigJoystick(SDL_Joystick *joystick, int fd) 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 @@ -1221,26 +1335,48 @@ LINUX_JoystickSetSensorsEnabled(SDL_Joystick *joystick, SDL_bool enabled) } 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]]); } } @@ -1295,10 +1431,7 @@ PollAllValues(SDL_Joystick *joystick) /* 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); @@ -1314,15 +1447,16 @@ PollAllValues(SDL_Joystick *joystick) } } - /* 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); } } } @@ -1350,7 +1484,7 @@ static void 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); @@ -1385,9 +1519,11 @@ HandleInputEvents(SDL_Joystick *joystick) 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, @@ -1440,7 +1576,7 @@ static void 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) { @@ -1464,9 +1600,11 @@ HandleClassicEvents(SDL_Joystick *joystick) 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], @@ -1572,10 +1710,18 @@ LINUX_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out) { SDL_Joystick *joystick; SDL_joylist_item *item = JoystickByDevIndex(device_index); + unsigned int mapped; - if (item->mapping) { - SDL_memcpy(out, item->mapping, sizeof(*out)); - return SDL_TRUE; + 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; + } } /* We temporarily open the device to check how it's configured. Make @@ -1595,6 +1741,8 @@ LINUX_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out) return SDL_FALSE; } + item->checked_mapping = SDL_TRUE; + if (PrepareJoystickHwdata(joystick, item) == -1) { SDL_free(joystick->hwdata); SDL_free(joystick); @@ -1617,11 +1765,17 @@ LINUX_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out) 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 */ @@ -1629,47 +1783,74 @@ LINUX_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out) 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 } /* @@ -1677,84 +1858,191 @@ LINUX_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out) 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 } - /* Prefer analog triggers, but settle for digital if missing. */ - if (joystick->hwdata->has_hat[2]) { /* Check if ABS_HAT2{X,Y} is available. */ + 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 + } + + 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]; - } - - 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]; - } + mapped |= 0x3; +#ifdef DEBUG_GAMEPAD_MAPPING + SDL_Log("Mapped LEFT+RIGHTTRIGGER to hat 2 (ABS_HAT2X, ABS_HAT2Y)"); +#endif } - /* Prefer digital D-Pad, but settle for analog if missing. */ + 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 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]) { @@ -1762,6 +2050,10 @@ LINUX_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out) 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]) { @@ -1769,6 +2061,10 @@ LINUX_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out) 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); @@ -1779,6 +2075,9 @@ LINUX_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out) 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; } @@ -1789,6 +2088,7 @@ SDL_JoystickDriver SDL_LINUX_JoystickDriver = LINUX_JoystickGetCount, LINUX_JoystickDetect, LINUX_JoystickGetDeviceName, + LINUX_JoystickGetDevicePath, LINUX_JoystickGetDevicePlayerIndex, LINUX_JoystickSetDevicePlayerIndex, LINUX_JoystickGetDeviceGUID, diff --git a/libs/SDL2/src/joystick/linux/SDL_sysjoystick_c.h b/libs/SDL2/src/joystick/linux/SDL_sysjoystick_c.h index 49b8686d..f0e27b9c 100644 --- a/libs/SDL2/src/joystick/linux/SDL_sysjoystick_c.h +++ b/libs/SDL2/src/joystick/linux/SDL_sysjoystick_c.h @@ -83,6 +83,12 @@ struct joystick_hwdata /* 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 --git a/libs/SDL2/src/joystick/os2/SDL_os2joystick.c b/libs/SDL2/src/joystick/os2/SDL_os2joystick.c index 00b7fc55..1c292ff4 100644 --- a/libs/SDL2/src/joystick/os2/SDL_os2joystick.c +++ b/libs/SDL2/src/joystick/os2/SDL_os2joystick.c @@ -377,15 +377,17 @@ static void OS2_JoystickDetect(void) { } -/***********************************************************/ -/* 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 @@ SDL_JoystickDriver SDL_OS2_JoystickDriver = OS2_NumJoysticks, OS2_JoystickDetect, OS2_JoystickGetDeviceName, + OS2_JoystickGetDevicePath, OS2_JoystickGetDevicePlayerIndex, OS2_JoystickSetDevicePlayerIndex, OS2_JoystickGetDeviceGUID, diff --git a/libs/SDL2/src/joystick/ps2/SDL_sysjoystick.c b/libs/SDL2/src/joystick/ps2/SDL_sysjoystick.c new file mode 100644 index 00000000..d30b3c1b --- /dev/null +++ b/libs/SDL2/src/joystick/ps2/SDL_sysjoystick.c @@ -0,0 +1,348 @@ +/* + 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; +} __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; + 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) +{ + 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); +} + +/* 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 --git a/libs/SDL2/src/joystick/psp/SDL_sysjoystick.c b/libs/SDL2/src/joystick/psp/SDL_sysjoystick.c index d7197956..df3be568 100644 --- a/libs/SDL2/src/joystick/psp/SDL_sysjoystick.c +++ b/libs/SDL2/src/joystick/psp/SDL_sysjoystick.c @@ -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 @@ static int calc_bezier_y(float t) 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 @@ static int PSP_JoystickInit(void) 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 @@ static int PSP_JoystickInit(void) return 1; } -static int PSP_NumJoysticks(void) +static int PSP_JoystickGetCount(void) { return 1; } @@ -141,20 +108,19 @@ static void PSP_JoystickDetect(void) { } -#if 0 -/* Function to get the device-dependent name of a joystick */ -static const char *PSP_JoystickName(int idx) -{ - if (idx == 0) return "PSP controller"; - SDL_SetError("No joystick available with that index"); - return NULL; -} -#endif - /* Function to get the device-dependent name of a joystick */ static const char *PSP_JoystickGetDeviceName(int device_index) { - return "PSP builtin joypad"; + if (device_index == 0) + return "PSP builtin joypad"; + + SDL_SetError("No joystick available with that index"); + return(NULL); +} + +static const char *PSP_JoystickGetDevicePath(int index) +{ + return NULL; } static int PSP_JoystickGetDevicePlayerIndex(int device_index) @@ -162,8 +128,7 @@ static int PSP_JoystickGetDevicePlayerIndex(int device_index) 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 SDL_JoystickID PSP_JoystickGetDeviceInstanceID(int device_index) */ 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 @@ static Uint32 PSP_JoystickGetCapabilities(SDL_Joystick *joystick) 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 void PSP_JoystickUpdate(SDL_Joystick *joystick) 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 @@ static void PSP_JoystickUpdate(SDL_Joystick *joystick) changed = old_buttons ^ buttons; old_buttons = buttons; if(changed) { - for(i=0; iaxes) { - 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 @@ VIRTUAL_FreeHWData(joystick_hwdata *hwdata) 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)); - hwdata->naxes = naxes; - hwdata->nbuttons = nbuttons; - hwdata->nhats = nhats; - hwdata->name = "Virtual Joystick"; + 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; + } + } + } + + /* 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 @@ SDL_JoystickAttachVirtualInner(SDL_JoystickType type, 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 @@ SDL_JoystickSetVirtualAxisInner(SDL_Joystick *joystick, int axis, Sint16 value) } 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 @@ SDL_JoystickSetVirtualButtonInner(SDL_Joystick *joystick, int button, Uint8 valu } 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 @@ SDL_JoystickSetVirtualHatInner(SDL_Joystick *joystick, int hat, Uint8 value) } 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 @@ VIRTUAL_JoystickGetDeviceName(int device_index) 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 @@ VIRTUAL_JoystickGetDevicePlayerIndex(int device_index) 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 @@ VIRTUAL_JoystickOpen(SDL_Joystick *joystick, int device_index) 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 @@ VIRTUAL_JoystickOpen(SDL_Joystick *joystick, int device_index) 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 @@ VIRTUAL_JoystickUpdate(SDL_Joystick *joystick) 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 @@ VIRTUAL_JoystickUpdate(SDL_Joystick *joystick) static void VIRTUAL_JoystickClose(SDL_Joystick *joystick) { - joystick_hwdata *hwdata; - - if (!joystick) { - return; + if (joystick->hwdata) { + joystick_hwdata *hwdata = joystick->hwdata; + hwdata->joystick = NULL; + joystick->hwdata = NULL; } - if (!joystick->hwdata) { - return; - } - - hwdata = (joystick_hwdata *)joystick->hwdata; - hwdata->opened = SDL_FALSE; } @@ -426,7 +614,145 @@ VIRTUAL_JoystickQuit(void) 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 @@ SDL_JoystickDriver SDL_VIRTUAL_JoystickDriver = VIRTUAL_JoystickGetCount, VIRTUAL_JoystickDetect, VIRTUAL_JoystickGetDeviceName, + VIRTUAL_JoystickGetDevicePath, VIRTUAL_JoystickGetDevicePlayerIndex, VIRTUAL_JoystickSetDevicePlayerIndex, VIRTUAL_JoystickGetDeviceGUID, diff --git a/libs/SDL2/src/joystick/virtual/SDL_virtualjoystick_c.h b/libs/SDL2/src/joystick/virtual/SDL_virtualjoystick_c.h index b251c2d1..5e15f1dd 100644 --- a/libs/SDL2/src/joystick/virtual/SDL_virtualjoystick_c.h +++ b/libs/SDL2/src/joystick/virtual/SDL_virtualjoystick_c.h @@ -34,24 +34,19 @@ typedef struct joystick_hwdata { 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_JoystickSetVirtualButtonInner(SDL_Joystick * joystick, int button, Uint8 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 --git a/libs/SDL2/src/joystick/vita/SDL_sysjoystick.c b/libs/SDL2/src/joystick/vita/SDL_sysjoystick.c index 3ef1fc17..7b384e7e 100644 --- a/libs/SDL2/src/joystick/vita/SDL_sysjoystick.c +++ b/libs/SDL2/src/joystick/vita/SDL_sysjoystick.c @@ -147,7 +147,7 @@ int VITA_JoystickInit(void) // after the app has already started. SDL_numjoysticks = 1; - + SDL_PrivateJoystickAdded(0); // How many additional paired controllers are there? sceCtrlGetControllerPortInfo(&myPortInfo); @@ -157,6 +157,7 @@ int VITA_JoystickInit(void) { if (myPortInfo.port[i]!=SCE_CTRL_TYPE_UNPAIRED) { + SDL_PrivateJoystickAdded(SDL_numjoysticks); SDL_numjoysticks++; } } @@ -178,7 +179,6 @@ SDL_JoystickID VITA_JoystickGetDeviceInstanceID(int device_index) return device_index; } -/* Function to get the device-dependent name of a joystick */ const char *VITA_JoystickGetDeviceName(int index) { if (index == 0) @@ -194,7 +194,12 @@ const char *VITA_JoystickGetDeviceName(int index) 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 @@ -393,12 +398,19 @@ VITA_JoystickSetSensorsEnabled(SDL_Joystick *joystick, SDL_bool enabled) 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, @@ -417,6 +429,7 @@ SDL_JoystickDriver SDL_VITA_JoystickDriver = VITA_JoystickUpdate, VITA_JoystickClose, VITA_JoystickQuit, + VITA_JoystickGetGamepadMapping, }; #endif /* SDL_JOYSTICK_VITA */ diff --git a/libs/SDL2/src/joystick/windows/SDL_dinputjoystick.c b/libs/SDL2/src/joystick/windows/SDL_dinputjoystick.c index c2f53a93..5122f0ca 100644 --- a/libs/SDL2/src/joystick/windows/SDL_dinputjoystick.c +++ b/libs/SDL2/src/joystick/windows/SDL_dinputjoystick.c @@ -24,6 +24,7 @@ #if SDL_JOYSTICK_DINPUT +#include "SDL_hints.h" #include "SDL_windowsjoystick_c.h" #include "SDL_dinputjoystick_c.h" #include "SDL_rawinputjoystick_c.h" @@ -253,7 +254,7 @@ SDL_IsXInputDevice(Uint16 vendor_id, Uint16 product_id, const char* hidPath) 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 +398,12 @@ SDL_DINPUT_JoystickInit(void) 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 +463,7 @@ EnumJoystickDetectCallback(LPCDIDEVICEINSTANCE pDeviceInstance, LPVOID pContext) 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 +490,7 @@ EnumJoystickDetectCallback(LPCDIDEVICEINSTANCE pDeviceInstance, LPVOID pContext) 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 +546,10 @@ err: void SDL_DINPUT_JoystickDetect(JoyStick_DeviceData **pContext) { + if (dinput == NULL) { + return; + } + IDirectInput8_EnumDevices(dinput, DI8DEVCLASS_GAMECTRL, EnumJoystickDetectCallback, pContext, DIEDFL_ATTACHEDONLY); } @@ -683,7 +694,7 @@ EnumDevObjectsCallback(LPCDIDEVICEOBJECTINSTANCE pDeviceObject, LPVOID pContext) /* 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; diff --git a/libs/SDL2/src/joystick/windows/SDL_dinputjoystick_c.h b/libs/SDL2/src/joystick/windows/SDL_dinputjoystick_c.h index d0e58346..229569ec 100644 --- a/libs/SDL2/src/joystick/windows/SDL_dinputjoystick_c.h +++ b/libs/SDL2/src/joystick/windows/SDL_dinputjoystick_c.h @@ -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_JoystickUpdate(SDL_Joystick * joystick); 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 --git a/libs/SDL2/src/joystick/windows/SDL_rawinputjoystick.c b/libs/SDL2/src/joystick/windows/SDL_rawinputjoystick.c index 8178ee62..e6e9831e 100644 --- a/libs/SDL2/src/joystick/windows/SDL_rawinputjoystick.c +++ b/libs/SDL2/src/joystick/windows/SDL_rawinputjoystick.c @@ -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" @@ -62,11 +61,18 @@ typedef struct WindowsGamingInputGamepadState WindowsGamingInputGamepadState; #define GamepadButtons_GUIDE 0x40000000 #define COBJMACROS #include "windows.gaming.input.h" +#include #endif #if defined(SDL_JOYSTICK_RAWINPUT_XINPUT) || defined(SDL_JOYSTICK_RAWINPUT_WGI) #define SDL_JOYSTICK_RAWINPUT_MATCHING #define SDL_JOYSTICK_RAWINPUT_MATCH_AXES +#define SDL_JOYSTICK_RAWINPUT_MATCH_TRIGGERS +#ifdef SDL_JOYSTICK_RAWINPUT_MATCH_TRIGGERS +#define SDL_JOYSTICK_RAWINPUT_MATCH_COUNT 6 // stick + trigger axes +#else +#define SDL_JOYSTICK_RAWINPUT_MATCH_COUNT 4 // stick axes +#endif #endif /*#define DEBUG_RAWINPUT*/ @@ -98,6 +104,7 @@ typedef struct _SDL_RAWINPUT_Device { SDL_atomic_t refcount; char *name; + char *path; Uint16 vendor_id; Uint16 product_id; Uint16 version; @@ -128,7 +135,7 @@ struct joystick_hwdata USHORT trigger_hack_index; #ifdef SDL_JOYSTICK_RAWINPUT_MATCHING - Uint32 match_state; /* Low 16 bits for button states, high 16 for 4 4bit axes */ + Uint64 match_state; /* Lowest 16 bits for button states, higher 24 for 6 4bit axes */ Uint32 last_state_packet; #endif @@ -173,7 +180,7 @@ static struct { typedef struct WindowsMatchState { #ifdef SDL_JOYSTICK_RAWINPUT_MATCH_AXES - SHORT match_axes[4]; + SHORT match_axes[SDL_JOYSTICK_RAWINPUT_MATCH_COUNT]; #endif #ifdef SDL_JOYSTICK_RAWINPUT_XINPUT WORD xinput_buttons; @@ -184,13 +191,13 @@ typedef struct WindowsMatchState { SDL_bool any_data; } WindowsMatchState; -static void RAWINPUT_FillMatchState(WindowsMatchState *state, Uint32 match_state) +static void RAWINPUT_FillMatchState(WindowsMatchState *state, Uint64 match_state) { #ifdef SDL_JOYSTICK_RAWINPUT_MATCH_AXES int ii; #endif - state->any_data = SDL_FALSE; + SDL_bool any_axes_data = SDL_FALSE; #ifdef SDL_JOYSTICK_RAWINPUT_MATCH_AXES /* SHORT state->match_axes[4] = { (match_state & 0x000F0000) >> 4, @@ -199,12 +206,18 @@ static void RAWINPUT_FillMatchState(WindowsMatchState *state, Uint32 match_state (match_state & 0xF0000000) >> 16, }; */ for (ii = 0; ii < 4; ii++) { - state->match_axes[ii] = (match_state & (0x000F0000 << (ii * 4))) >> (4 + ii * 4); - if ((Uint32)(state->match_axes[ii] + 0x1000) > 0x2000) { /* match_state bit is not 0xF, 0x1, or 0x2 */ - state->any_data = SDL_TRUE; - } + state->match_axes[ii] = (SHORT)((match_state & (0x000F0000ull << (ii * 4))) >> (4 + ii * 4)); + any_axes_data |= ((Uint32)(state->match_axes[ii] + 0x1000) > 0x2000); /* match_state bit is not 0xF, 0x1, or 0x2 */ } #endif /* SDL_JOYSTICK_RAWINPUT_MATCH_AXES */ +#ifdef SDL_JOYSTICK_RAWINPUT_MATCH_TRIGGERS + for (; ii < SDL_JOYSTICK_RAWINPUT_MATCH_COUNT; ii++) { + state->match_axes[ii] = (SHORT)((match_state & (0x000F0000ull << (ii * 4))) >> (4 + ii * 4)); + any_axes_data |= (state->match_axes[ii] != SDL_MIN_SINT16); + } +#endif /* SDL_JOYSTICK_RAWINPUT_MATCH_TRIGGERS */ + + state->any_data = any_axes_data; #ifdef SDL_JOYSTICK_RAWINPUT_XINPUT /* Match axes by checking if the distance between the high 4 bits of axis and the 4 bits from match_state is 1 or less */ @@ -220,9 +233,16 @@ static void RAWINPUT_FillMatchState(WindowsMatchState *state, Uint32 match_state SDL_abs((Sint8)((gamepad.sThumbRX & 0xF000) >> 8) - ((match_state & 0x0F000000) >> 20)) <= 0x10 && \ SDL_abs((Sint8)((~gamepad.sThumbRY & 0xF000) >> 8) - ((match_state & 0xF0000000) >> 24)) <= 0x10) */ + /* Can only match trigger values if a single trigger has a value. */ +#define XInputTriggersMatch(gamepad) ( \ + ((state->match_axes[4] == SDL_MIN_SINT16) && (state->match_axes[5] == SDL_MIN_SINT16)) || \ + ((gamepad.bLeftTrigger != 0) && (gamepad.bRightTrigger != 0)) || \ + ((Uint32)((((int)gamepad.bLeftTrigger * 257) - 32768) - state->match_axes[4]) <= 0x2fff) || \ + ((Uint32)((((int)gamepad.bRightTrigger * 257) - 32768) - state->match_axes[5]) <= 0x2fff)) + state->xinput_buttons = /* Bitwise map .RLDUWVQTS.KYXBA -> YXBA..WVQTKSRLDU */ - match_state << 12 | (match_state & 0x0780) >> 1 | (match_state & 0x0010) << 1 | (match_state & 0x0040) >> 2 | (match_state & 0x7800) >> 11; + (WORD)(match_state << 12 | (match_state & 0x0780) >> 1 | (match_state & 0x0010) << 1 | (match_state & 0x0040) >> 2 | (match_state & 0x7800) >> 11); /* Explicit ((match_state & (1<match_axes[2] + 0x1000) <= 0x2fff && \ (Uint16)((~(Sint16)(gamepad.RightThumbstickY * SDL_MAX_SINT16) & 0xF000) - state->match_axes[3] + 0x1000) <= 0x2fff) +#define WindowsGamingInputTriggersMatch(gamepad) ( \ + ((state->match_axes[4] == SDL_MIN_SINT16) && (state->match_axes[5] == SDL_MIN_SINT16)) || \ + ((gamepad.LeftTrigger == 0.0f) && (gamepad.RightTrigger == 0.0f)) || \ + ((Uint16)((((int)(gamepad.LeftTrigger * SDL_MAX_UINT16)) - 32768) - state->match_axes[4]) <= 0x2fff) || \ + ((Uint16)((((int)(gamepad.RightTrigger * SDL_MAX_UINT16)) - 32768) - state->match_axes[5]) <= 0x2fff)) state->wgi_buttons = /* Bitwise map .RLD UWVQ TS.K YXBA -> ..QT WVRL DUYX BAKS */ @@ -354,6 +379,9 @@ RAWINPUT_XInputSlotMatches(const WindowsMatchState *state, Uint8 slot_idx) if ((xinput_buttons & ~XINPUT_GAMEPAD_GUIDE) == state->xinput_buttons #ifdef SDL_JOYSTICK_RAWINPUT_MATCH_AXES && XInputAxesMatch(xinput_state[slot_idx].state.Gamepad) +#endif +#ifdef SDL_JOYSTICK_RAWINPUT_MATCH_TRIGGERS + && XInputTriggersMatch(xinput_state[slot_idx].state.Gamepad) #endif ) { return SDL_TRUE; @@ -538,22 +566,24 @@ RAWINPUT_InitWindowsGamingInput(RAWINPUT_DeviceContext *ctx) if (!wgi_state.initialized) { static const IID SDL_IID_IGamepadStatics = { 0x8BBCE529, 0xD49C, 0x39E9, { 0x95, 0x60, 0xE4, 0x7D, 0xDE, 0x96, 0xB7, 0xC8 } }; HRESULT hr; - HMODULE hModule; - /* I think this takes care of RoInitialize() in a way that is compatible with the rest of SDL */ - if (FAILED(WIN_CoInitialize())) { + if (FAILED(WIN_RoInitialize())) { return; } wgi_state.initialized = SDL_TRUE; wgi_state.dirty = SDL_TRUE; - hModule = LoadLibraryA("combase.dll"); - if (hModule != NULL) { + { typedef HRESULT (WINAPI *WindowsCreateStringReference_t)(PCWSTR sourceString, UINT32 length, HSTRING_HEADER *hstringHeader, HSTRING* string); typedef HRESULT (WINAPI *RoGetActivationFactory_t)(HSTRING activatableClassId, REFIID iid, void** factory); - WindowsCreateStringReference_t WindowsCreateStringReferenceFunc = (WindowsCreateStringReference_t)GetProcAddress(hModule, "WindowsCreateStringReference"); - RoGetActivationFactory_t RoGetActivationFactoryFunc = (RoGetActivationFactory_t)GetProcAddress(hModule, "RoGetActivationFactory"); +#ifdef __WINRT__ + WindowsCreateStringReference_t WindowsCreateStringReferenceFunc = WindowsCreateStringReference; + RoGetActivationFactory_t RoGetActivationFactoryFunc = RoGetActivationFactory; +#else + WindowsCreateStringReference_t WindowsCreateStringReferenceFunc = (WindowsCreateStringReference_t)WIN_LoadComBaseFunction("WindowsCreateStringReference"); + RoGetActivationFactory_t RoGetActivationFactoryFunc = (RoGetActivationFactory_t)WIN_LoadComBaseFunction("RoGetActivationFactory"); +#endif if (WindowsCreateStringReferenceFunc && RoGetActivationFactoryFunc) { PCWSTR pNamespace = L"Windows.Gaming.Input.Gamepad"; HSTRING_HEADER hNamespaceStringHeader; @@ -564,18 +594,21 @@ RAWINPUT_InitWindowsGamingInput(RAWINPUT_DeviceContext *ctx) RoGetActivationFactoryFunc(hNamespaceString, &SDL_IID_IGamepadStatics, (void **)&wgi_state.gamepad_statics); } } - FreeLibrary(hModule); } } } static SDL_bool -RAWINPUT_WindowsGamingInputSlotMatches(const WindowsMatchState *state, WindowsGamingInputGamepadState *slot) +RAWINPUT_WindowsGamingInputSlotMatches(const WindowsMatchState *state, WindowsGamingInputGamepadState *slot, SDL_bool xinput_correlated) { Uint32 wgi_buttons = slot->state.Buttons; if ((wgi_buttons & 0x3FFF) == state->wgi_buttons #ifdef SDL_JOYSTICK_RAWINPUT_MATCH_AXES && WindowsGamingInputAxesMatch(slot->state) +#endif +#ifdef SDL_JOYSTICK_RAWINPUT_MATCH_TRIGGERS + // Don't try to match WGI triggers if getting values from XInput + && (xinput_correlated || WindowsGamingInputTriggersMatch(slot->state)) #endif ) { return SDL_TRUE; @@ -584,14 +617,14 @@ RAWINPUT_WindowsGamingInputSlotMatches(const WindowsMatchState *state, WindowsGa } static SDL_bool -RAWINPUT_GuessWindowsGamingInputSlot(const WindowsMatchState *state, Uint8 *correlation_id, WindowsGamingInputGamepadState **slot) +RAWINPUT_GuessWindowsGamingInputSlot(const WindowsMatchState *state, Uint8 *correlation_id, WindowsGamingInputGamepadState **slot, SDL_bool xinput_correlated) { int match_count, user_index; match_count = 0; for (user_index = 0; user_index < wgi_state.per_gamepad_count; ++user_index) { WindowsGamingInputGamepadState *gamepad_state = wgi_state.per_gamepad[user_index]; - if (RAWINPUT_WindowsGamingInputSlotMatches(state, gamepad_state)) { + if (RAWINPUT_WindowsGamingInputSlotMatches(state, gamepad_state, xinput_correlated)) { ++match_count; *slot = gamepad_state; /* Incrementing correlation_id for any match, as negative evidence for others being correlated */ @@ -626,7 +659,7 @@ RAWINPUT_QuitWindowsGamingInput(RAWINPUT_DeviceContext *ctx) __x_ABI_CWindows_CGaming_CInput_CIGamepadStatics_Release(wgi_state.gamepad_statics); wgi_state.gamepad_statics = NULL; } - WIN_CoUninitialize(); + WIN_RoUninitialize(); wgi_state.initialized = SDL_FALSE; } } @@ -656,10 +689,9 @@ RAWINPUT_ReleaseDevice(SDL_RAWINPUT_Device *device) #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); } } @@ -683,9 +715,8 @@ RAWINPUT_AddDevice(HANDLE hDevice) 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 */ @@ -694,11 +725,13 @@ RAWINPUT_AddDevice(HANDLE hDevice) } /* 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 @@ -712,7 +745,13 @@ RAWINPUT_AddDevice(HANDLE hDevice) 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; @@ -758,8 +797,7 @@ RAWINPUT_AddDevice(HANDLE hDevice) SDL_free(product_string); } } - - CHECK(SDL_HidD_GetPreparsedData(hFile, &device->preparsed_data)); + device->path = SDL_strdup(dev_name); CloseHandle(hFile); hFile = INVALID_HANDLE_VALUE; @@ -792,8 +830,12 @@ err: 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 @@ -890,9 +932,12 @@ RAWINPUT_IsDevicePresent(Uint16 vendor_id, Uint16 product_id, Uint16 version, co return SDL_TRUE; } - /* The Xbox 360 wireless controller shows up as product 0 in WGI */ + /* The Xbox 360 wireless controller shows up as product 0 in WGI. + Try to match it to a Raw Input device via name or known product ID. */ if (vendor_id == device->vendor_id && product_id == 0 && - name && SDL_strstr(device->name, name) != NULL) { + ((name && SDL_strstr(device->name, name) != NULL) || + (device->vendor_id == USB_VENDOR_MICROSOFT && + device->product_id == USB_PRODUCT_XBOX360_XUSB_CONTROLLER))) { return SDL_TRUE; } @@ -993,6 +1038,12 @@ RAWINPUT_JoystickGetDeviceName(int device_index) 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) { @@ -1017,7 +1068,7 @@ RAWINPUT_JoystickGetDeviceInstanceID(int device_index) 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; @@ -1217,7 +1268,7 @@ RAWINPUT_JoystickOpen(SDL_Joystick *joystick, int device_index) } } - SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_UNKNOWN); + joystick->epowerlevel = SDL_JOYSTICK_POWER_UNKNOWN; return 0; } @@ -1227,8 +1278,8 @@ RAWINPUT_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uin { #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) { @@ -1261,6 +1312,13 @@ RAWINPUT_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uin } #endif /* SDL_JOYSTICK_RAWINPUT_XINPUT */ + if (!rumbled) { +#if defined(SDL_JOYSTICK_RAWINPUT_WGI) || defined(SDL_JOYSTICK_RAWINPUT_XINPUT) + return SDL_SetError("Controller isn't correlated yet, try hitting a button first"); +#else + return SDL_Unsupported(); +#endif + } return 0; } @@ -1269,7 +1327,7 @@ RAWINPUT_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint { #if defined(SDL_JOYSTICK_RAWINPUT_WGI) RAWINPUT_DeviceContext *ctx = joystick->hwdata; - + if (ctx->wgi_correlated) { WindowsGamingInputGamepadState *gamepad_state = ctx->wgi_slot; HRESULT hr; @@ -1279,8 +1337,10 @@ RAWINPUT_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint if (!SUCCEEDED(hr)) { return SDL_SetError("Setting vibration failed: 0x%lx\n", hr); } + return 0; + } else { + return SDL_SetError("Controller isn't correlated yet, try hitting a button first"); } - return 0; #else return SDL_Unsupported(); #endif @@ -1289,15 +1349,15 @@ RAWINPUT_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint 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; @@ -1307,6 +1367,7 @@ RAWINPUT_JoystickGetCapabilities(SDL_Joystick *joystick) } } #endif +#endif /**/ return result; } @@ -1383,12 +1444,13 @@ RAWINPUT_HandleStatePacket(SDL_Joystick *joystick, Uint8 *data, int size) (1 << SDL_CONTROLLER_BUTTON_DPAD_LEFT), (1 << SDL_CONTROLLER_BUTTON_DPAD_UP) | (1 << SDL_CONTROLLER_BUTTON_DPAD_LEFT), }; - Uint32 match_state = ctx->match_state; + Uint64 match_state = ctx->match_state; /* Update match_state with button bit, then fall through */ -#define SDL_PrivateJoystickButton(joystick, button, state) if (button < SDL_arraysize(button_map)) { if (state) match_state |= 1 << button_map[button]; else match_state &= ~(1 << button_map[button]); } SDL_PrivateJoystickButton(joystick, button, state) +#define SDL_PrivateJoystickButton(joystick, button, state) if (button < SDL_arraysize(button_map)) { Uint64 button_bit = 1ull << button_map[button]; match_state = (match_state & ~button_bit) | (button_bit * (state)); } SDL_PrivateJoystickButton(joystick, button, state) #ifdef SDL_JOYSTICK_RAWINPUT_MATCH_AXES /* Grab high 4 bits of value, then fall through */ -#define SDL_PrivateJoystickAxis(joystick, axis, value) if (axis < 4) match_state = (match_state & ~(0xF << (4 * axis + 16))) | ((value) & 0xF000) << (4 * axis + 4); SDL_PrivateJoystickAxis(joystick, axis, value) +#define AddAxisToMatchState(axis, value) { match_state = (match_state & ~(0xFull << (4 * axis + 16))) | ((value) & 0xF000ull) << (4 * axis + 4); } +#define SDL_PrivateJoystickAxis(joystick, axis, value) if (axis < 4) AddAxisToMatchState(axis, value); SDL_PrivateJoystickAxis(joystick, axis, value) #endif #endif /* SDL_JOYSTICK_RAWINPUT_MATCHING */ @@ -1453,8 +1515,14 @@ RAWINPUT_HandleStatePacket(SDL_Joystick *joystick, Uint8 *data, int size) #undef SDL_PrivateJoystickAxis #endif +#ifdef SDL_JOYSTICK_RAWINPUT_MATCH_TRIGGERS +#define AddTriggerToMatchState(axis, value) { int match_axis = axis + SDL_JOYSTICK_RAWINPUT_MATCH_COUNT - joystick->naxes; AddAxisToMatchState(match_axis, value); } +#endif /* SDL_JOYSTICK_RAWINPUT_MATCH_TRIGGERS */ + if (ctx->trigger_hack) { SDL_bool has_trigger_data = SDL_FALSE; + int left_trigger = joystick->naxes - 2; + int right_trigger = joystick->naxes - 1; #ifdef SDL_JOYSTICK_RAWINPUT_XINPUT /* Prefer XInput over WindowsGamingInput, it continues to provide data in the background */ @@ -1469,28 +1537,36 @@ RAWINPUT_HandleStatePacket(SDL_Joystick *joystick, Uint8 *data, int size) } #endif /* SDL_JOYSTICK_RAWINPUT_WGI */ - if (!has_trigger_data) { +#ifndef SDL_JOYSTICK_RAWINPUT_MATCH_TRIGGERS + if (!has_trigger_data) +#endif + { HIDP_DATA *item = GetData(ctx->trigger_hack_index, ctx->data, data_length); if (item) { - int left_trigger = joystick->naxes - 2; - int right_trigger = joystick->naxes - 1; Sint16 value = (int)(Uint16)item->RawValue - 0x8000; - if (value < 0) { - value = -value * 2 - 32769; - SDL_PrivateJoystickAxis(joystick, left_trigger, SDL_MIN_SINT16); - SDL_PrivateJoystickAxis(joystick, right_trigger, value); - } else if (value > 0) { - value = value * 2 - 32767; - SDL_PrivateJoystickAxis(joystick, left_trigger, value); - SDL_PrivateJoystickAxis(joystick, right_trigger, SDL_MIN_SINT16); - } else { - SDL_PrivateJoystickAxis(joystick, left_trigger, SDL_MIN_SINT16); - SDL_PrivateJoystickAxis(joystick, right_trigger, SDL_MIN_SINT16); + Sint16 left_value = (value > 0) ? (value * 2 - 32767) : SDL_MIN_SINT16; + Sint16 right_value = (value < 0) ? (-value * 2 - 32769) : SDL_MIN_SINT16; + +#ifdef SDL_JOYSTICK_RAWINPUT_MATCH_TRIGGERS + AddTriggerToMatchState(left_trigger, left_value); + AddTriggerToMatchState(right_trigger, right_value); + if (!has_trigger_data) +#endif /* SDL_JOYSTICK_RAWINPUT_MATCH_TRIGGERS */ + { + SDL_PrivateJoystickAxis(joystick, left_trigger, left_value); + SDL_PrivateJoystickAxis(joystick, right_trigger, right_value); } } } } +#ifdef AddAxisToMatchState +#undef AddAxisToMatchState +#endif +#ifdef AddTriggerToMatchState +#undef AddTriggerToMatchState +#endif + #ifdef SDL_JOYSTICK_RAWINPUT_MATCHING if (ctx->is_xinput) { ctx->match_state = match_state; @@ -1510,17 +1586,25 @@ RAWINPUT_UpdateOtherAPIs(SDL_Joystick *joystick) 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)) { + if (RAWINPUT_WindowsGamingInputSlotMatches(&match_state_xinput, ctx->wgi_slot, xinput_correlated)) { ctx->wgi_uncorrelate_count = 0; } else { ++ctx->wgi_uncorrelate_count; @@ -1549,7 +1633,7 @@ RAWINPUT_UpdateOtherAPIs(SDL_Joystick *joystick) if (RAWINPUT_MissingWindowsGamingInputSlot()) { Uint8 correlation_id; WindowsGamingInputGamepadState *slot_idx = NULL; - if (RAWINPUT_GuessWindowsGamingInputSlot(&match_state_xinput, &correlation_id, &slot_idx)) { + 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. */ @@ -1851,7 +1935,7 @@ RAWINPUT_UnregisterNotifications() return; } } - + LRESULT CALLBACK RAWINPUT_WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { @@ -1946,6 +2030,7 @@ SDL_JoystickDriver SDL_RAWINPUT_JoystickDriver = RAWINPUT_JoystickGetCount, RAWINPUT_JoystickDetect, RAWINPUT_JoystickGetDeviceName, + RAWINPUT_JoystickGetDevicePath, RAWINPUT_JoystickGetDevicePlayerIndex, RAWINPUT_JoystickSetDevicePlayerIndex, RAWINPUT_JoystickGetDeviceGUID, diff --git a/libs/SDL2/src/joystick/windows/SDL_windows_gaming_input.c b/libs/SDL2/src/joystick/windows/SDL_windows_gaming_input.c index 2cb5f2cb..a266d4b5 100644 --- a/libs/SDL2/src/joystick/windows/SDL_windows_gaming_input.c +++ b/libs/SDL2/src/joystick/windows/SDL_windows_gaming_input.c @@ -35,6 +35,13 @@ #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; @@ -68,6 +75,7 @@ static struct { EventRegistrationToken controller_added_token; EventRegistrationToken controller_removed_token; int controller_count; + SDL_bool ro_initialized; WindowsGamingInputControllerState *controllers; } wgi; @@ -260,10 +268,9 @@ static HRESULT STDMETHODCALLTYPE IEventHandler_CRawGameControllerVtbl_InvokeAdde WindowsGetStringRawBufferFunc = WindowsGetStringRawBuffer; WindowsDeleteStringFunc = WindowsDeleteString; #else - HMODULE hModule = LoadLibraryA("combase.dll"); - if (hModule != NULL) { - WindowsGetStringRawBufferFunc = (WindowsGetStringRawBuffer_t)GetProcAddress(hModule, "WindowsGetStringRawBuffer"); - WindowsDeleteStringFunc = (WindowsDeleteString_t)GetProcAddress(hModule, "WindowsDeleteString"); + { + WindowsGetStringRawBufferFunc = (WindowsGetStringRawBuffer_t)WIN_LoadComBaseFunction("WindowsGetStringRawBuffer"); + WindowsDeleteStringFunc = (WindowsDeleteString_t)WIN_LoadComBaseFunction("WindowsDeleteString"); } #endif /* __WINRT__ */ if (WindowsGetStringRawBufferFunc && WindowsDeleteStringFunc) { @@ -277,15 +284,10 @@ static HRESULT STDMETHODCALLTYPE IEventHandler_CRawGameControllerVtbl_InvokeAdde WindowsDeleteStringFunc(hString); } } -#ifndef __WINRT__ - if (hModule != NULL) { - FreeLibrary(hModule); - } -#endif __x_ABI_CWindows_CGaming_CInput_CIRawGameController2_Release(controller2); } if (!name) { - name = ""; + name = SDL_strdup(""); } hr = __x_ABI_CWindows_CGaming_CInput_CIRawGameController_QueryInterface(controller, &IID_IGameController, (void **)&gamecontroller); @@ -444,23 +446,43 @@ WGI_JoystickInit(void) WindowsCreateStringReference_t WindowsCreateStringReferenceFunc = NULL; RoGetActivationFactory_t RoGetActivationFactoryFunc = NULL; -#ifndef __WINRT__ - HMODULE hModule; -#endif HRESULT hr; - if (FAILED(WIN_CoInitialize())) { - return SDL_SetError("CoInitialize() failed"); + if (FAILED(WIN_RoInitialize())) { + return SDL_SetError("RoInitialize() failed"); } + wgi.ro_initialized = SDL_TRUE; + +#ifndef __WINRT__ + { + /* There seems to be a bug in Windows where a dependency of WGI can be unloaded from memory prior to WGI itself. + * This results in Windows_Gaming_Input!GameController::~GameController() invoking an unloaded DLL and crashing. + * As a workaround, we will keep a reference to the MTA to prevent COM from unloading DLLs later. + * See https://github.com/libsdl-org/SDL/issues/5552 for more details. + */ + static PVOID cookie = NULL; + if (!cookie) { + typedef HRESULT (WINAPI *CoIncrementMTAUsage_t)(PVOID* pCookie); + CoIncrementMTAUsage_t CoIncrementMTAUsageFunc = (CoIncrementMTAUsage_t)WIN_LoadComBaseFunction("CoIncrementMTAUsage"); + if (CoIncrementMTAUsageFunc) { + if (FAILED(CoIncrementMTAUsageFunc(&cookie))) { + return SDL_SetError("CoIncrementMTAUsage() failed"); + } + } else { + /* CoIncrementMTAUsage() is present since Win8, so we should never make it here. */ + return SDL_SetError("CoIncrementMTAUsage() not found"); + } + } + } +#endif #ifdef __WINRT__ WindowsCreateStringReferenceFunc = WindowsCreateStringReference; RoGetActivationFactoryFunc = RoGetActivationFactory; #else - hModule = LoadLibraryA("combase.dll"); - if (hModule != NULL) { - WindowsCreateStringReferenceFunc = (WindowsCreateStringReference_t)GetProcAddress(hModule, "WindowsCreateStringReference"); - RoGetActivationFactoryFunc = (RoGetActivationFactory_t)GetProcAddress(hModule, "RoGetActivationFactory"); + { + WindowsCreateStringReferenceFunc = (WindowsCreateStringReference_t)WIN_LoadComBaseFunction("WindowsCreateStringReference"); + RoGetActivationFactoryFunc = (RoGetActivationFactory_t)WIN_LoadComBaseFunction("RoGetActivationFactory"); } #endif /* __WINRT__ */ if (WindowsCreateStringReferenceFunc && RoGetActivationFactoryFunc) { @@ -519,11 +541,6 @@ WGI_JoystickInit(void) } } } -#ifndef __WINRT__ - if (hModule != NULL) { - FreeLibrary(hModule); - } -#endif if (wgi.statics) { __FIVectorView_1_Windows__CGaming__CInput__CRawGameController *controllers; @@ -576,6 +593,12 @@ WGI_JoystickGetDeviceName(int device_index) return wgi.controllers[device_index].name; } +static const char * +WGI_JoystickGetDevicePath(int device_index) +{ + return NULL; +} + static int WGI_JoystickGetDevicePlayerIndex(int device_index) { @@ -863,53 +886,12 @@ WGI_JoystickQuit(void) __x_ABI_CWindows_CGaming_CInput_CIRawGameControllerStatics_remove_RawGameControllerRemoved(wgi.statics, wgi.controller_removed_token); __x_ABI_CWindows_CGaming_CInput_CIRawGameControllerStatics_Release(wgi.statics); } + + if (wgi.ro_initialized) { + WIN_RoUninitialize(); + } + SDL_zero(wgi); - - /* Don't uninitialize COM because of what appears to be a bug in Microsoft WGI reference counting. - * - * If you plug in a non-Xbox controller and let the application run for 30 seconds, then it crashes in CoUninitialize() - * with this stack trace: - - Windows.Gaming.Input.dll!GameController::~GameController(void) Unknown - Windows.Gaming.Input.dll!GameController::`vector deleting destructor'(unsigned int) Unknown - Windows.Gaming.Input.dll!Microsoft::WRL::Details::RuntimeClassImpl,1,1,0,struct Windows::Gaming::Input::IGameController,struct Windows::Gaming::Input::IGameControllerBatteryInfo,struct Microsoft::WRL::CloakedIid,class Microsoft::WRL::FtmBase>::Release(void) Unknown - Windows.Gaming.Input.dll!Windows::Gaming::Input::Custom::Details::AggregableRuntimeClass,struct Microsoft::WRL::CloakedIid,struct Microsoft::WRL::CloakedIid,struct Microsoft::WRL::CloakedIid,class Microsoft::WRL::Details::Nil,class Microsoft::WRL::Details::Nil,class Microsoft::WRL::Details::Nil>::Release(void) Unknown - Windows.Gaming.Input.dll!Microsoft::WRL::ComPtr<`WaitForCompletion,Windows::Foundation::IAsyncOperationWithProgress>'::`2'::FTMEventDelegate>::~ComPtr<`WaitForCompletion,Windows::Foundation::IAsyncOperationWithProgress>'::`2'::FTMEventDelegate>() Unknown - Windows.Gaming.Input.dll!`eh vector destructor iterator'(void *,unsigned int,int,void (*)(void *)) Unknown - Windows.Gaming.Input.dll!Windows::Gaming::Input::Custom::Details::GameControllerCollection::~GameControllerCollection(void) Unknown - Windows.Gaming.Input.dll!Windows::Gaming::Input::Custom::Details::GameControllerCollection::`vector deleting destructor'(unsigned int) Unknown - Windows.Gaming.Input.dll!Microsoft::WRL::Details::RuntimeClassImpl,1,1,0,struct Windows::Foundation::Collections::IIterable,struct Windows::Foundation::Collections::IVectorView,class Microsoft::WRL::FtmBase>::Release(void) Unknown - Windows.Gaming.Input.dll!Windows::Gaming::Input::Custom::Details::CustomGameControllerFactoryBase::~CustomGameControllerFactoryBase(void) Unknown - Windows.Gaming.Input.dll!Windows::Gaming::Input::Custom::Details::CustomGameControllerFactoryBase::`vector deleting destructor'(unsigned int) Unknown - Windows.Gaming.Input.dll!Microsoft::WRL::ActivationFactory >,struct Windows::Gaming::Input::IFlightStickStatics,class Microsoft::WRL::Details::Nil,0>::Release(void) Unknown - Windows.Gaming.Input.dll!Microsoft::WRL::ComPtr<`WaitForCompletion,Windows::Foundation::IAsyncOperationWithProgress>'::`2'::FTMEventDelegate>::~ComPtr<`WaitForCompletion,Windows::Foundation::IAsyncOperationWithProgress>'::`2'::FTMEventDelegate>() Unknown - Windows.Gaming.Input.dll!NtList::~NtList(void) Unknown - Windows.Gaming.Input.dll!FactoryManager::`vector deleting destructor'(unsigned int) Unknown - Windows.Gaming.Input.dll!Microsoft::WRL::ActivationFactory,struct Windows::Gaming::Input::Custom::IGameControllerFactoryManagerStatics2,struct Microsoft::WRL::CloakedIid,0>::Release(void) Unknown - Windows.Gaming.Input.dll!Microsoft::WRL::Details::TerminateMap(class Microsoft::WRL::Details::ModuleBase *,unsigned short const *,bool) Unknown - Windows.Gaming.Input.dll!Microsoft::WRL::Module<1,class Microsoft::WRL::Details::DefaultModule<1> >::~Module<1,class Microsoft::WRL::Details::DefaultModule<1> >(void) Unknown - Windows.Gaming.Input.dll!Microsoft::WRL::Details::DefaultModule<1>::`vector deleting destructor'(unsigned int) Unknown - Windows.Gaming.Input.dll!`dynamic atexit destructor for 'Microsoft::WRL::Details::StaticStorage,0,int>::instance_''() Unknown - Windows.Gaming.Input.dll!__CRT_INIT@12() Unknown - Windows.Gaming.Input.dll!__DllMainCRTStartup() Unknown - ntdll.dll!_LdrxCallInitRoutine@16() Unknown - ntdll.dll!LdrpCallInitRoutine() Unknown - ntdll.dll!LdrpProcessDetachNode() Unknown - ntdll.dll!LdrpUnloadNode() Unknown - ntdll.dll!LdrpDecrementModuleLoadCountEx() Unknown - ntdll.dll!LdrUnloadDll() Unknown - KernelBase.dll!FreeLibrary() Unknown - combase.dll!FreeLibraryWithLogging(LoadOrFreeWhy why, HINSTANCE__ * hMod, const wchar_t * pswzOptionalFileName) Line 193 C++ - combase.dll!CClassCache::CDllPathEntry::CFinishObject::Finish() Line 3311 C++ - combase.dll!CClassCache::CFinishComposite::Finish() Line 3421 C++ - combase.dll!CClassCache::CleanUpDllsForProcess() Line 7009 C++ - [Inline Frame] combase.dll!CCCleanUpDllsForProcess() Line 8773 C++ - combase.dll!ProcessUninitialize() Line 2243 C++ - combase.dll!DecrementProcessInitializeCount() Line 993 C++ - combase.dll!wCoUninitialize(COleTls & Tls, int fHostThread) Line 4126 C++ - combase.dll!CoUninitialize() Line 3945 C++ - */ - /* WIN_CoUninitialize(); */ } static SDL_bool @@ -924,6 +906,7 @@ SDL_JoystickDriver SDL_WGI_JoystickDriver = WGI_JoystickGetCount, WGI_JoystickDetect, WGI_JoystickGetDeviceName, + WGI_JoystickGetDevicePath, WGI_JoystickGetDevicePlayerIndex, WGI_JoystickSetDevicePlayerIndex, WGI_JoystickGetDeviceGUID, diff --git a/libs/SDL2/src/joystick/windows/SDL_windowsjoystick.c b/libs/SDL2/src/joystick/windows/SDL_windowsjoystick.c index 7dae16d9..0b42ed6e 100644 --- a/libs/SDL2/src/joystick/windows/SDL_windowsjoystick.c +++ b/libs/SDL2/src/joystick/windows/SDL_windowsjoystick.c @@ -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 @@ static GUID GUID_DEVINTERFACE_HID = { 0x4D1E55B2L, 0xF16F, 0x11CF, { 0x88, 0xCB, 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 @@ SDL_WaitForDeviceNotification(SDL_DeviceNotificationData *data, SDL_mutex *mutex 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_JoystickThread(void *_data) 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 @@ SDL_JoystickThread(void *_data) 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 @@ SDL_JoystickThread(void *_data) #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 @@ SDL_StopJoystickThread(void) s_joystickThread = NULL; } -#endif /* !__WINRT__ */ +#endif /* !defined(__WINRT__) */ void WINDOWS_AddJoystickDevice(JoyStick_DeviceData *device) { @@ -453,7 +474,7 @@ WINDOWS_JoystickInit(void) 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 @@ WINDOWS_JoystickInit(void) } } #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 @@ WINDOWS_JoystickDetect(void) } } -/* Function to get the device-dependent name of a joystick */ static const char * WINDOWS_JoystickGetDeviceName(int device_index) { @@ -568,6 +596,18 @@ WINDOWS_JoystickGetDeviceName(int device_index) 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 @@ WINDOWS_JoystickQuit(void) } SYS_Joystick = NULL; -#ifndef __WINRT__ +#if !defined(__WINRT__) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) if (s_bJoystickThread) { SDL_StopJoystickThread(); } else { @@ -737,6 +777,12 @@ WINDOWS_JoystickQuit(void) SDL_CleanupDeviceNotificationFunc(); #endif +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) + if (s_bJoystickThread) { + SDL_StopJoystickThread(); + } +#endif + SDL_DINPUT_JoystickQuit(); SDL_XINPUT_JoystickQuit(); @@ -755,6 +801,7 @@ SDL_JoystickDriver SDL_WINDOWS_JoystickDriver = WINDOWS_JoystickGetCount, WINDOWS_JoystickDetect, WINDOWS_JoystickGetDeviceName, + WINDOWS_JoystickGetDevicePath, WINDOWS_JoystickGetDevicePlayerIndex, WINDOWS_JoystickSetDevicePlayerIndex, WINDOWS_JoystickGetDeviceGUID, @@ -772,6 +819,11 @@ SDL_JoystickDriver SDL_WINDOWS_JoystickDriver = WINDOWS_JoystickGetGamepadMapping }; +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif + #else #if SDL_JOYSTICK_RAWINPUT diff --git a/libs/SDL2/src/joystick/windows/SDL_windowsjoystick_c.h b/libs/SDL2/src/joystick/windows/SDL_windowsjoystick_c.h index 1b962538..00e1cf10 100644 --- a/libs/SDL2/src/joystick/windows/SDL_windowsjoystick_c.h +++ b/libs/SDL2/src/joystick/windows/SDL_windowsjoystick_c.h @@ -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 @@ typedef struct JoyStick_DeviceData 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 const DIDATAFORMAT SDL_c_dfDIJoystick2; 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 --git a/libs/SDL2/src/joystick/windows/SDL_xinputjoystick.c b/libs/SDL2/src/joystick/windows/SDL_xinputjoystick.c index a8eece5d..dcf2940f 100644 --- a/libs/SDL2/src/joystick/windows/SDL_xinputjoystick.c +++ b/libs/SDL2/src/joystick/windows/SDL_xinputjoystick.c @@ -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 @@ SDL_XInputUseOldJoystickMapping() /* 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 @@ GetXInputName(const Uint8 userid, BYTE SubType) 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; @@ -201,9 +208,20 @@ GuessXInputDevice(Uint8 userid, Uint16 *pVID, Uint16 *pPID, Uint16 *pVersion) * userid, but we'll record it so we'll at least be consistent * when the raw device list changes. */ - *pVID = (Uint16)rdi.hid.dwVendorId; - *pPID = (Uint16)rdi.hid.dwProductId; - *pVersion = (Uint16)rdi.hid.dwVersionNumber; + if (rdi.hid.dwVendorId == USB_VENDOR_VALVE && + rdi.hid.dwProductId == USB_PRODUCT_STEAM_VIRTUAL_GAMEPAD) { + /* Steam encodes the real device in the path */ + int realVID = rdi.hid.dwVendorId; + int realPID = rdi.hid.dwProductId; + SDL_sscanf(devName, "\\\\.\\pipe\\HID#VID_045E&PID_028E&IG_00#%x&%x&", &realVID, &realPID); + *pVID = (Uint16)realVID; + *pPID = (Uint16)realPID; + *pVersion = 0; + } else { + *pVID = (Uint16)rdi.hid.dwVendorId; + *pPID = (Uint16)rdi.hid.dwProductId; + *pVersion = (Uint16)rdi.hid.dwVersionNumber; + } if (s_arrXInputDevicePath[userid]) { SDL_free(s_arrXInputDevicePath[userid]); } @@ -286,6 +304,7 @@ AddXInputDevice(Uint8 userid, BYTE SubType, JoyStick_DeviceData **pContext) 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); @@ -374,7 +393,7 @@ SDL_XINPUT_JoystickOpen(SDL_Joystick * joystick, JoyStick_DeviceData *joystickde 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 */ @@ -529,6 +548,10 @@ SDL_XINPUT_JoystickUpdate(SDL_Joystick * joystick) 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()) { @@ -538,6 +561,7 @@ SDL_XINPUT_JoystickUpdate(SDL_Joystick * joystick) } joystick->hwdata->dwPacketNumber = XInputState.dwPacketNumber; } +#endif } void @@ -553,6 +577,11 @@ SDL_XINPUT_JoystickQuit(void) } } +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif + #else /* !SDL_JOYSTICK_XINPUT */ typedef struct JoyStick_DeviceData JoyStick_DeviceData; diff --git a/libs/SDL2/src/joystick/windows/SDL_xinputjoystick_c.h b/libs/SDL2/src/joystick/windows/SDL_xinputjoystick_c.h index c0a0600d..1a8bfdcf 100644 --- a/libs/SDL2/src/joystick/windows/SDL_xinputjoystick_c.h +++ b/libs/SDL2/src/joystick/windows/SDL_xinputjoystick_c.h @@ -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_JoystickUpdate(SDL_Joystick * joystick); 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 --git a/libs/SDL2/src/libm/math_private.h b/libs/SDL2/src/libm/math_private.h index 4a30a521..f560cca6 100644 --- a/libs/SDL2/src/libm/math_private.h +++ b/libs/SDL2/src/libm/math_private.h @@ -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 @@ typedef unsigned int u_int32_t; * 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 --git a/libs/SDL2/src/loadso/os2/SDL_sysloadso.c b/libs/SDL2/src/loadso/os2/SDL_sysloadso.c index 5e697125..2b96848a 100644 --- a/libs/SDL2/src/loadso/os2/SDL_sysloadso.c +++ b/libs/SDL2/src/loadso/os2/SDL_sysloadso.c @@ -41,7 +41,7 @@ SDL_LoadObject(const char *sofile) PSZ pszModName; if (!sofile) { - SDL_SetError("NULL sofile"); + SDL_InvalidParamError("sofile"); return NULL; } diff --git a/libs/SDL2/src/loadso/windows/SDL_sysloadso.c b/libs/SDL2/src/loadso/windows/SDL_sysloadso.c index 7e5730a8..d3c84042 100644 --- a/libs/SDL2/src/loadso/windows/SDL_sysloadso.c +++ b/libs/SDL2/src/loadso/windows/SDL_sysloadso.c @@ -36,7 +36,7 @@ SDL_LoadObject(const char *sofile) LPTSTR tstr; if (!sofile) { - SDL_SetError("NULL sofile"); + SDL_InvalidParamError("sofile"); return NULL; } tstr = WIN_UTF8ToString(sofile); diff --git a/libs/SDL2/src/locale/vita/SDL_syslocale.c b/libs/SDL2/src/locale/vita/SDL_syslocale.c new file mode 100644 index 00000000..0a057cbf --- /dev/null +++ b/libs/SDL2/src/locale/vita/SDL_syslocale.c @@ -0,0 +1,71 @@ +/* + 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_syslocale.h" + +#include +#include + +void +SDL_SYS_GetPreferredLocales(char *buf, size_t buflen) +{ + const char *vita_locales[] = { + "ja_JP", + "en_US", + "fr_FR", + "es_ES", + "de_DE", + "it_IT", + "nl_NL", + "pt_PT", + "ru_RU", + "ko_KR", + "zh_TW", + "zh_CN", + "fi_FI", + "sv_SE", + "da_DK", + "no_NO", + "pl_PL", + "pt_BR", + "en_GB", + "tr_TR", + }; + + Sint32 language = SCE_SYSTEM_PARAM_LANG_ENGLISH_US; + SceAppUtilInitParam initParam; + SceAppUtilBootParam bootParam; + SDL_zero(initParam); + SDL_zero(bootParam); + sceAppUtilInit(&initParam, &bootParam); + sceAppUtilSystemParamGetInt(SCE_SYSTEM_PARAM_ID_LANG, &language); + + if (language < 0 || language > SCE_SYSTEM_PARAM_LANG_TURKISH) + language = SCE_SYSTEM_PARAM_LANG_ENGLISH_US; // default to english + + SDL_strlcpy(buf, vita_locales[language], buflen); + + sceAppUtilShutdown(); +} + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/libs/SDL2/src/main/gdk/SDL_gdk_main.c b/libs/SDL2/src/main/gdk/SDL_gdk_main.c new file mode 100644 index 00000000..4a25bbb1 --- /dev/null +++ b/libs/SDL2/src/main/gdk/SDL_gdk_main.c @@ -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 --git a/libs/SDL2/src/main/ngage/SDL_ngage_main.cpp b/libs/SDL2/src/main/ngage/SDL_ngage_main.cpp new file mode 100644 index 00000000..6dbf2f14 --- /dev/null +++ b/libs/SDL2/src/main/ngage/SDL_ngage_main.cpp @@ -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 --git a/libs/SDL2/src/main/ps2/SDL_ps2_main.c b/libs/SDL2/src/main/ps2/SDL_ps2_main.c new file mode 100644 index 00000000..1bc8154b --- /dev/null +++ b/libs/SDL2/src/main/ps2/SDL_ps2_main.c @@ -0,0 +1,54 @@ +/* + 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 + +#ifdef main + #undef main +#endif + +static void prepare_IOP() +{ + SifInitRpc(0); + sbv_patch_enable_lmb(); + sbv_patch_disable_prefix_check(); +} + +static void init_drivers() { + init_fileXio_driver(); + init_memcard_driver(true); +} + +static void deinit_drivers() { + deinit_memcard_driver(true); + deinit_fileXio_driver(); +} + +int main(int argc, char *argv[]) +{ + int res; + prepare_IOP(); + init_drivers(); + + res = SDL_main(argc, argv); + + deinit_drivers(); + + return res; +} + +#endif /* _EE */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/main/uikit/SDL_uikit_main.c b/libs/SDL2/src/main/uikit/SDL_uikit_main.c index 702f6739..62cfffd5 100644 --- a/libs/SDL2/src/main/uikit/SDL_uikit_main.c +++ b/libs/SDL2/src/main/uikit/SDL_uikit_main.c @@ -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 --git a/libs/SDL2/src/main/windows/SDL_windows_main.c b/libs/SDL2/src/main/windows/SDL_windows_main.c index 056787e4..70fb9b9b 100644 --- a/libs/SDL2/src/main/windows/SDL_windows_main.c +++ b/libs/SDL2/src/main/windows/SDL_windows_main.c @@ -70,7 +70,7 @@ main_getcmdline(void) if (!argv[i]) { return OutOfMemory(); } - CopyMemory(argv[i], arg, len); + SDL_memcpy(argv[i], arg, len); SDL_free(arg); } argv[i] = NULL; diff --git a/libs/SDL2/src/main/windows/version.rc b/libs/SDL2/src/main/windows/version.rc index bedde9b1..786b7267 100644 --- a/libs/SDL2/src/main/windows/version.rc +++ b/libs/SDL2/src/main/windows/version.rc @@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,0,20,0 - PRODUCTVERSION 2,0,20,0 + FILEVERSION 2,23,1,0 + PRODUCTVERSION 2,23,1,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0x0L FILEOS 0x40004L @@ -23,12 +23,12 @@ BEGIN BEGIN VALUE "CompanyName", "\0" VALUE "FileDescription", "SDL\0" - VALUE "FileVersion", "2, 0, 20, 0\0" + VALUE "FileVersion", "2, 23, 1, 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, 20, 0\0" + VALUE "ProductVersion", "2, 23, 1, 0\0" END END BLOCK "VarFileInfo" diff --git a/libs/SDL2/src/misc/emscripten/SDL_sysurl.c b/libs/SDL2/src/misc/emscripten/SDL_sysurl.c new file mode 100644 index 00000000..f344232a --- /dev/null +++ b/libs/SDL2/src/misc/emscripten/SDL_sysurl.c @@ -0,0 +1,37 @@ +/* + 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_sysurl.h" + +#include + +int +SDL_SYS_OpenURL(const char *url) +{ + EM_ASM({ + window.open(UTF8ToString($0), "_blank"); + }, url); + + return 0; +} + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/libs/SDL2/src/misc/windows/SDL_sysurl.c b/libs/SDL2/src/misc/windows/SDL_sysurl.c index 12903db8..6cfe7de6 100644 --- a/libs/SDL2/src/misc/windows/SDL_sysurl.c +++ b/libs/SDL2/src/misc/windows/SDL_sysurl.c @@ -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 @@ SDL_SYS_OpenURL(const char *url) WIN_CoUninitialize(); return (rc > ((HINSTANCE) 32)) ? 0 : WIN_SetError("Couldn't open given URL."); } +#endif /* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/misc/winrt/SDL_sysurl.cpp b/libs/SDL2/src/misc/winrt/SDL_sysurl.cpp index c83cc851..111a1441 100644 --- a/libs/SDL2/src/misc/winrt/SDL_sysurl.cpp +++ b/libs/SDL2/src/misc/winrt/SDL_sysurl.cpp @@ -18,10 +18,9 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -#include -#include "../../core/windows/SDL_windows.h" #include "../SDL_sysurl.h" +#include "../../core/windows/SDL_windows.h" int SDL_SYS_OpenURL(const char *url) diff --git a/libs/SDL2/src/power/linux/SDL_syspower.c b/libs/SDL2/src/power/linux/SDL_syspower.c index 3b9ab1ba..f4e1ecc3 100644 --- a/libs/SDL2/src/power/linux/SDL_syspower.c +++ b/libs/SDL2/src/power/linux/SDL_syspower.c @@ -561,20 +561,30 @@ check_upower_device(DBusConnection *conn, const char *path, SDL_PowerState *stat return; } else if (!ui32) { return; /* we don't care about random devices with batteries, like wireless controllers, etc */ - } else if (!SDL_DBus_QueryPropertyOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "IsPresent", DBUS_TYPE_BOOLEAN, &ui32)) { + } + + if (!SDL_DBus_QueryPropertyOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "IsPresent", DBUS_TYPE_BOOLEAN, &ui32)) { return; - } else if (!ui32) { + } + if (!ui32) { st = SDL_POWERSTATE_NO_BATTERY; - } else if (!SDL_DBus_QueryPropertyOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "State", DBUS_TYPE_UINT32, &ui32)) { - st = SDL_POWERSTATE_UNKNOWN; /* uh oh */ - } else if (ui32 == 1) { /* 1 == charging */ - st = SDL_POWERSTATE_CHARGING; - } else if ((ui32 == 2) || (ui32 == 3)) { /* 2 == discharging, 3 == empty. */ - st = SDL_POWERSTATE_ON_BATTERY; - } else if (ui32 == 4) { /* 4 == full */ - st = SDL_POWERSTATE_CHARGED; } else { - st = SDL_POWERSTATE_UNKNOWN; /* uh oh */ + /* Get updated information on the battery status + * This can occasionally fail, and we'll just return slightly stale data in that case + */ + SDL_DBus_CallMethodOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "Refresh", DBUS_TYPE_INVALID, DBUS_TYPE_INVALID); + + if (!SDL_DBus_QueryPropertyOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "State", DBUS_TYPE_UINT32, &ui32)) { + st = SDL_POWERSTATE_UNKNOWN; /* uh oh */ + } else if (ui32 == 1) { /* 1 == charging */ + st = SDL_POWERSTATE_CHARGING; + } else if ((ui32 == 2) || (ui32 == 3)) { /* 2 == discharging, 3 == empty. */ + st = SDL_POWERSTATE_ON_BATTERY; + } else if (ui32 == 4) { /* 4 == full */ + st = SDL_POWERSTATE_CHARGED; + } else { + st = SDL_POWERSTATE_UNKNOWN; /* uh oh */ + } } if (!SDL_DBus_QueryPropertyOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "Percentage", DBUS_TYPE_DOUBLE, &d)) { diff --git a/libs/SDL2/src/render/SDL_d3dmath.c b/libs/SDL2/src/render/SDL_d3dmath.c index 63048bb8..fb7de371 100644 --- a/libs/SDL2/src/render/SDL_d3dmath.c +++ b/libs/SDL2/src/render/SDL_d3dmath.c @@ -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 @@ Float4X4 MatrixRotationZ(float r) } -#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 --git a/libs/SDL2/src/render/SDL_d3dmath.h b/libs/SDL2/src/render/SDL_d3dmath.h index 7b74cfe7..6460bf17 100644 --- a/libs/SDL2/src/render/SDL_d3dmath.h +++ b/libs/SDL2/src/render/SDL_d3dmath.h @@ -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 MatrixRotationX(float r); 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 --git a/libs/SDL2/src/render/SDL_render.c b/libs/SDL2/src/render/SDL_render.c index 03c2691d..cd33242d 100644 --- a/libs/SDL2/src/render/SDL_render.c +++ b/libs/SDL2/src/render/SDL_render.c @@ -48,13 +48,13 @@ this should probably be removed at some point in the future. --ryan. */ #define CHECK_RENDERER_MAGIC(renderer, retval) \ if (!renderer || renderer->magic != &renderer_magic) { \ - SDL_SetError("Invalid renderer"); \ + SDL_InvalidParamError("renderer"); \ return retval; \ } #define CHECK_TEXTURE_MAGIC(texture, retval) \ if (!texture || texture->magic != &texture_magic) { \ - SDL_SetError("Invalid texture"); \ + SDL_InvalidParamError("texture"); \ return retval; \ } @@ -96,6 +96,9 @@ static const SDL_RenderDriver *render_drivers[] = { #if SDL_VIDEO_RENDER_D3D11 &D3D11_RenderDriver, #endif +#if SDL_VIDEO_RENDER_D3D12 + &D3D12_RenderDriver, +#endif #if SDL_VIDEO_RENDER_METAL &METAL_RenderDriver, #endif @@ -350,13 +353,13 @@ static int 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) { cmd->command = SDL_RENDERCMD_SETVIEWPORT; cmd->data.viewport.first = 0; /* render backend will fill this in. */ - /* Convert SDL_FRect to SDL_Rect */ + /* Convert SDL_DRect to SDL_Rect */ cmd->data.viewport.rect.x = (int)SDL_floor(renderer->viewport.x); cmd->data.viewport.rect.y = (int)SDL_floor(renderer->viewport.y); cmd->data.viewport.rect.w = (int)SDL_floor(renderer->viewport.w); @@ -365,7 +368,7 @@ QueueCmdSetViewport(SDL_Renderer *renderer) 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,19 +382,19 @@ QueueCmdSetClipRect(SDL_Renderer *renderer) 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; } else { cmd->command = SDL_RENDERCMD_SETCLIPRECT; cmd->data.cliprect.enabled = renderer->clipping_enabled; - /* Convert SDL_FRect to SDL_Rect */ + /* Convert SDL_DRect to SDL_Rect */ cmd->data.cliprect.rect.x = (int)SDL_floor(renderer->clip_rect.x); 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; } @@ -580,10 +583,10 @@ QueueCmdFillRects(SDL_Renderer *renderer, const SDL_FRect * rects, const int cou if (retval < 0) { cmd->command = SDL_RENDERCMD_NO_OP; } - - SDL_small_free(xy, isstack1); - SDL_small_free(indices, isstack2); } + SDL_small_free(xy, isstack1); + SDL_small_free(indices, isstack2); + } else { retval = renderer->QueueFillRects(renderer, cmd, rects, count); if (retval < 0) { @@ -611,12 +614,12 @@ QueueCmdCopy(SDL_Renderer *renderer, SDL_Texture * texture, const SDL_Rect * src static int QueueCmdCopyEx(SDL_Renderer *renderer, SDL_Texture * texture, const SDL_Rect * srcquad, const SDL_FRect * dstrect, - const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip) + const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip, float scale_x, float scale_y) { SDL_RenderCommand *cmd = PrepQueueCmdDraw(renderer, SDL_RENDERCMD_COPY_EX, texture); int retval = -1; if (cmd != NULL) { - retval = renderer->QueueCopyEx(renderer, cmd, texture, srcquad, dstrect, angle, center, flip); + retval = renderer->QueueCopyEx(renderer, cmd, texture, srcquad, dstrect, angle, center, flip, scale_x, scale_y); if (retval < 0) { cmd->command = SDL_RENDERCMD_NO_OP; } @@ -649,7 +652,7 @@ QueueCmdGeometry(SDL_Renderer *renderer, SDL_Texture *texture, return retval; } -static int UpdateLogicalSize(SDL_Renderer *renderer); +static int UpdateLogicalSize(SDL_Renderer *renderer, SDL_bool flush_viewport_cmd); int SDL_GetNumRenderDrivers(void) @@ -676,7 +679,7 @@ SDL_GetRenderDriverInfo(int index, SDL_RendererInfo * info) #endif } -static void GetWindowViewportValues(SDL_Renderer *renderer, int *logical_w, int *logical_h, SDL_FRect *viewport, SDL_FPoint *scale) +static void GetWindowViewportValues(SDL_Renderer *renderer, int *logical_w, int *logical_h, SDL_DRect *viewport, SDL_FPoint *scale) { SDL_LockMutex(renderer->target_mutex); *logical_w = renderer->target ? renderer->logical_w_backup : renderer->logical_w; @@ -698,7 +701,17 @@ SDL_RendererEventWatch(void *userdata, SDL_Event *event) renderer->WindowEvent(renderer, &event->window); } - if (event->window.event == SDL_WINDOWEVENT_SIZE_CHANGED) { + /* 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 + */ + if (event->window.event == SDL_WINDOWEVENT_SIZE_CHANGED || + event->window.event == SDL_WINDOWEVENT_MOVED) { /* Make sure we're operating on the default render target */ SDL_Texture *saved_target = SDL_GetRenderTarget(renderer); if (saved_target) { @@ -717,7 +730,14 @@ SDL_RendererEventWatch(void *userdata, SDL_Event *event) } 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; @@ -728,19 +748,17 @@ SDL_RendererEventWatch(void *userdata, SDL_Event *event) SDL_GetWindowSize(renderer->window, &w, &h); } - if (renderer->target) { - renderer->viewport_backup.x = 0; - renderer->viewport_backup.y = 0; - renderer->viewport_backup.w = (float) w; - renderer->viewport_backup.h = (float) h; - } else { - renderer->viewport.x = 0; - renderer->viewport.y = 0; - renderer->viewport.w = (float) w; - renderer->viewport.h = (float) h; - QueueCmdSetViewport(renderer); - FlushRenderCommandsIfNotBatching(renderer); - } + renderer->viewport.x = (double)0; + renderer->viewport.y = (double)0; + 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) { @@ -765,7 +783,7 @@ SDL_RendererEventWatch(void *userdata, SDL_Event *event) SDL_Window *window = SDL_GetWindowFromID(event->motion.windowID); if (window == renderer->window) { int logical_w, logical_h; - SDL_FRect viewport; + SDL_DRect viewport; SDL_FPoint scale; GetWindowViewportValues(renderer, &logical_w, &logical_h, &viewport, &scale); if (logical_w) { @@ -792,7 +810,7 @@ SDL_RendererEventWatch(void *userdata, SDL_Event *event) SDL_Window *window = SDL_GetWindowFromID(event->button.windowID); if (window == renderer->window) { int logical_w, logical_h; - SDL_FRect viewport; + SDL_DRect viewport; SDL_FPoint scale; GetWindowViewportValues(renderer, &logical_w, &logical_h, &viewport, &scale); if (logical_w) { @@ -807,7 +825,7 @@ SDL_RendererEventWatch(void *userdata, SDL_Event *event) event->type == SDL_FINGERMOTION) { int logical_w, logical_h; float physical_w, physical_h; - SDL_FRect viewport; + SDL_DRect viewport; SDL_FPoint scale; GetWindowViewportValues(renderer, &logical_w, &logical_h, &viewport, &scale); @@ -930,7 +948,7 @@ SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags) #endif if (!window) { - SDL_SetError("Invalid window"); + SDL_InvalidParamError("window"); goto error; } @@ -979,24 +997,24 @@ SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags) } } } - if (index == n) { + if (!renderer) { SDL_SetError("Couldn't find matching render driver"); goto error; } } else { - if (index >= SDL_GetNumRenderDrivers()) { + if (index >= n) { SDL_SetError("index must be -1 or in the range of 0 - %d", - SDL_GetNumRenderDrivers() - 1); + n - 1); goto error; } /* Create a new renderer instance */ renderer = render_drivers[index]->CreateRenderer(window, flags); batching = SDL_FALSE; + if (!renderer) { + goto error; + } } - if (!renderer) { - goto error; - } VerifyDrawQueueFunctions(renderer); @@ -1102,6 +1120,13 @@ SDL_GetRenderer(SDL_Window * window) return (SDL_Renderer *)SDL_GetWindowData(window, SDL_WINDOWRENDERDATA); } +SDL_Window * +SDL_RenderGetWindow(SDL_Renderer *renderer) +{ + CHECK_RENDERER_MAGIC(renderer, NULL); + return renderer->window; +} + int SDL_GetRendererInfo(SDL_Renderer * renderer, SDL_RendererInfo * info) { @@ -1326,7 +1351,7 @@ SDL_CreateTextureFromSurface(SDL_Renderer * renderer, SDL_Surface * surface) CHECK_RENDERER_MAGIC(renderer, NULL); if (!surface) { - SDL_SetError("SDL_CreateTextureFromSurface() passed NULL surface"); + SDL_InvalidParamError("SDL_CreateTextureFromSurface(): surface"); return NULL; } @@ -1592,10 +1617,11 @@ SDL_SetTextureScaleMode(SDL_Texture * texture, SDL_ScaleMode scaleMode) CHECK_TEXTURE_MAGIC(texture, -1); renderer = texture->renderer; - renderer->SetTextureScaleMode(renderer, texture, scaleMode); texture->scaleMode = scaleMode; if (texture->native) { return SDL_SetTextureScaleMode(texture->native, scaleMode); + } else { + renderer->SetTextureScaleMode(renderer, texture, scaleMode); } return 0; } @@ -2217,10 +2243,10 @@ SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture) } if (texture) { - renderer->viewport.x = 0.0f; - renderer->viewport.y = 0.0f; - renderer->viewport.w = (float) texture->w; - renderer->viewport.h = (float) texture->h; + renderer->viewport.x = (double)0; + renderer->viewport.y = (double)0; + renderer->viewport.w = (double)texture->w; + renderer->viewport.h = (double)texture->h; SDL_zero(renderer->clip_rect); renderer->clipping_enabled = SDL_FALSE; renderer->scale.x = 1.0f; @@ -2252,11 +2278,13 @@ SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture) SDL_Texture * SDL_GetRenderTarget(SDL_Renderer *renderer) { + CHECK_RENDERER_MAGIC(renderer, NULL); + return renderer->target; } static int -UpdateLogicalSize(SDL_Renderer *renderer) +UpdateLogicalSize(SDL_Renderer *renderer, SDL_bool flush_viewport_cmd) { int w = 1, h = 1; float want_aspect; @@ -2313,12 +2341,12 @@ UpdateLogicalSize(SDL_Renderer *renderer) 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 - @@ -2330,7 +2358,6 @@ UpdateLogicalSize(SDL_Renderer *renderer) 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; @@ -2338,7 +2365,6 @@ UpdateLogicalSize(SDL_Renderer *renderer) 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) { @@ -2351,7 +2377,6 @@ UpdateLogicalSize(SDL_Renderer *renderer) 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; @@ -2359,10 +2384,19 @@ UpdateLogicalSize(SDL_Renderer *renderer) 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); @@ -2386,7 +2420,7 @@ SDL_RenderSetLogicalSize(SDL_Renderer * renderer, int w, int h) renderer->logical_w = w; renderer->logical_h = h; - return UpdateLogicalSize(renderer); + return UpdateLogicalSize(renderer, SDL_TRUE); } void @@ -2409,7 +2443,7 @@ SDL_RenderSetIntegerScale(SDL_Renderer * renderer, SDL_bool enable) renderer->integer_scale = enable; - return UpdateLogicalSize(renderer); + return UpdateLogicalSize(renderer, SDL_TRUE); } SDL_bool @@ -2427,19 +2461,19 @@ SDL_RenderSetViewport(SDL_Renderer * renderer, const SDL_Rect * rect) CHECK_RENDERER_MAGIC(renderer, -1); if (rect) { - renderer->viewport.x = rect->x * renderer->scale.x; - renderer->viewport.y = rect->y * renderer->scale.y; - renderer->viewport.w = rect->w * renderer->scale.x; - renderer->viewport.h = rect->h * renderer->scale.y; + renderer->viewport.x = (double)rect->x * renderer->scale.x; + renderer->viewport.y = (double)rect->y * renderer->scale.y; + renderer->viewport.w = (double)rect->w * renderer->scale.x; + renderer->viewport.h = (double)rect->h * renderer->scale.y; } else { int w, h; if (SDL_GetRendererOutputSize(renderer, &w, &h) < 0) { return -1; } - renderer->viewport.x = 0.0f; - renderer->viewport.y = 0.0f; - renderer->viewport.w = (float) w; - renderer->viewport.h = (float) h; + renderer->viewport.x = (double)0; + renderer->viewport.y = (double)0; + renderer->viewport.w = (double)w; + renderer->viewport.h = (double)h; } retval = QueueCmdSetViewport(renderer); return retval < 0 ? retval : FlushRenderCommandsIfNotBatching(renderer); @@ -2463,8 +2497,8 @@ RenderGetViewportSize(SDL_Renderer * renderer, SDL_FRect * rect) { rect->x = 0.0f; rect->y = 0.0f; - rect->w = renderer->viewport.w / renderer->scale.x; - rect->h = renderer->viewport.h / renderer->scale.y; + rect->w = (float)(renderer->viewport.w / renderer->scale.x); + rect->h = (float)(renderer->viewport.h / renderer->scale.y); } int @@ -2475,10 +2509,10 @@ SDL_RenderSetClipRect(SDL_Renderer * renderer, const SDL_Rect * rect) if (rect) { renderer->clipping_enabled = SDL_TRUE; - renderer->clip_rect.x = rect->x * renderer->scale.x; - renderer->clip_rect.y = rect->y * renderer->scale.y; - renderer->clip_rect.w = rect->w * renderer->scale.x; - renderer->clip_rect.h = rect->h * renderer->scale.y; + renderer->clip_rect.x = (double)rect->x * renderer->scale.x; + renderer->clip_rect.y = (double)rect->y * renderer->scale.y; + renderer->clip_rect.w = (double)rect->w * renderer->scale.x; + renderer->clip_rect.h = (double)rect->h * renderer->scale.y; } else { renderer->clipping_enabled = SDL_FALSE; SDL_zero(renderer->clip_rect); @@ -2542,10 +2576,10 @@ SDL_RenderWindowToLogical(SDL_Renderer * renderer, int windowX, int windowY, flo window_physical_y = ((float) windowY) / renderer->dpi_scale.y; if (logicalX) { - *logicalX = (window_physical_x - renderer->viewport.x) / renderer->scale.x; + *logicalX = (float)((window_physical_x - renderer->viewport.x) / renderer->scale.x); } if (logicalY) { - *logicalY = (window_physical_y - renderer->viewport.y) / renderer->scale.y; + *logicalY = (float)((window_physical_y - renderer->viewport.y) / renderer->scale.y); } } @@ -2556,8 +2590,8 @@ SDL_RenderLogicalToWindow(SDL_Renderer * renderer, float logicalX, float logical CHECK_RENDERER_MAGIC(renderer, ); - window_physical_x = (logicalX * renderer->scale.x) + renderer->viewport.x; - window_physical_y = (logicalY * renderer->scale.y) + renderer->viewport.y; + window_physical_x = (float)((logicalX * renderer->scale.x) + renderer->viewport.x); + window_physical_y = (float)((logicalY * renderer->scale.y) + renderer->viewport.y); if (windowX) { *windowX = (int)(window_physical_x * renderer->dpi_scale.x); @@ -2657,11 +2691,16 @@ static int 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(); } @@ -2673,9 +2712,7 @@ RenderDrawPointsWithRects(SDL_Renderer * renderer, frects[i].h = renderer->scale.y; } - if (count) { - retval = QueueCmdFillRects(renderer, frects, count); - } + retval = QueueCmdFillRects(renderer, frects, count); SDL_small_free(frects, isstack); @@ -2694,7 +2731,7 @@ SDL_RenderDrawPoints(SDL_Renderer * renderer, CHECK_RENDERER_MAGIC(renderer, -1); if (!points) { - return SDL_SetError("SDL_RenderDrawPoints(): Passed NULL points"); + return SDL_InvalidParamError("SDL_RenderDrawPoints(): points"); } if (count < 1) { return 0; @@ -2730,11 +2767,16 @@ static int 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(); } @@ -2746,9 +2788,7 @@ RenderDrawPointsWithRectsF(SDL_Renderer * renderer, frects[i].h = renderer->scale.y; } - if (count) { - retval = QueueCmdFillRects(renderer, frects, count); - } + retval = QueueCmdFillRects(renderer, frects, count); SDL_small_free(frects, isstack); @@ -2764,7 +2804,7 @@ SDL_RenderDrawPointsF(SDL_Renderer * renderer, CHECK_RENDERER_MAGIC(renderer, -1); if (!points) { - return SDL_SetError("SDL_RenderDrawPointsF(): Passed NULL points"); + return SDL_InvalidParamError("SDL_RenderDrawPointsF(): points"); } if (count < 1) { return 0; @@ -2973,7 +3013,7 @@ SDL_RenderDrawLines(SDL_Renderer * renderer, CHECK_RENDERER_MAGIC(renderer, -1); if (!points) { - return SDL_SetError("SDL_RenderDrawLines(): Passed NULL points"); + return SDL_InvalidParamError("SDL_RenderDrawLines(): points"); } if (count < 2) { return 0; @@ -3012,7 +3052,7 @@ SDL_RenderDrawLinesF(SDL_Renderer * renderer, CHECK_RENDERER_MAGIC(renderer, -1); if (!points) { - return SDL_SetError("SDL_RenderDrawLinesF(): Passed NULL points"); + return SDL_InvalidParamError("SDL_RenderDrawLinesF(): points"); } if (count < 2) { return 0; @@ -3145,10 +3185,11 @@ SDL_RenderDrawLinesF(SDL_Renderer * renderer, num_vertices, indices, num_indices, size_indices, 1.0f, 1.0f); - SDL_small_free(xy, isstack1); - SDL_small_free(indices, isstack2); } + SDL_small_free(xy, isstack1); + SDL_small_free(indices, isstack2); + } else if (renderer->scale.x != 1.0f || renderer->scale.y != 1.0f) { retval = RenderDrawLinesWithRectsF(renderer, points, count); } else { @@ -3211,7 +3252,7 @@ SDL_RenderDrawRects(SDL_Renderer * renderer, CHECK_RENDERER_MAGIC(renderer, -1); if (!rects) { - return SDL_SetError("SDL_RenderDrawRects(): Passed NULL rects"); + return SDL_InvalidParamError("SDL_RenderDrawRects(): rects"); } if (count < 1) { return 0; @@ -3241,7 +3282,7 @@ SDL_RenderDrawRectsF(SDL_Renderer * renderer, CHECK_RENDERER_MAGIC(renderer, -1); if (!rects) { - return SDL_SetError("SDL_RenderDrawRects(): Passed NULL rects"); + return SDL_InvalidParamError("SDL_RenderDrawRectsF(): rects"); } if (count < 1) { return 0; @@ -3308,7 +3349,7 @@ SDL_RenderFillRects(SDL_Renderer * renderer, CHECK_RENDERER_MAGIC(renderer, -1); if (!rects) { - return SDL_SetError("SDL_RenderFillRects(): Passed NULL rects"); + return SDL_InvalidParamError("SDL_RenderFillRects(): rects"); } if (count < 1) { return 0; @@ -3351,7 +3392,7 @@ SDL_RenderFillRectsF(SDL_Renderer * renderer, CHECK_RENDERER_MAGIC(renderer, -1); if (!rects) { - return SDL_SetError("SDL_RenderFillFRects(): Passed NULL rects"); + return SDL_InvalidParamError("SDL_RenderFillRectsF(): rects"); } if (count < 1) { return 0; @@ -3382,60 +3423,6 @@ SDL_RenderFillRectsF(SDL_Renderer * renderer, return retval < 0 ? retval : FlushRenderCommandsIfNotBatching(renderer); } -/* !!! FIXME: move this to a public API if we want to do float versions of all of these later */ -SDL_FORCE_INLINE SDL_bool SDL_FRectEmpty(const SDL_FRect *r) -{ - return ((!r) || (r->w <= 0.0f) || (r->h <= 0.0f)) ? SDL_TRUE : SDL_FALSE; -} - -/* !!! FIXME: move this to a public API if we want to do float versions of all of these later */ -static SDL_bool -SDL_HasIntersectionF(const SDL_FRect * A, const SDL_FRect * B) -{ - float Amin, Amax, Bmin, Bmax; - - if (!A) { - SDL_InvalidParamError("A"); - return SDL_FALSE; - } - - if (!B) { - SDL_InvalidParamError("B"); - return SDL_FALSE; - } - - /* Special cases for empty rects */ - if (SDL_FRectEmpty(A) || SDL_FRectEmpty(B)) { - return SDL_FALSE; - } - - /* Horizontal intersection */ - Amin = A->x; - Amax = Amin + A->w; - Bmin = B->x; - Bmax = Bmin + B->w; - if (Bmin > Amin) - Amin = Bmin; - if (Bmax < Amax) - Amax = Bmax; - if (Amax <= Amin) - return SDL_FALSE; - - /* Vertical intersection */ - Amin = A->y; - Amax = Amin + A->h; - Bmin = B->y; - Bmax = Bmin + B->h; - if (Bmin > Amin) - Amin = Bmin; - if (Bmax < Amax) - Amax = Bmax; - if (Amax <= Amin) - return SDL_FALSE; - - return SDL_TRUE; -} - int SDL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * srcrect, const SDL_Rect * dstrect) @@ -3734,15 +3721,7 @@ SDL_RenderCopyExF(SDL_Renderer * renderer, SDL_Texture * texture, renderer->scale.x, renderer->scale.y); } else { - real_dstrect.x *= renderer->scale.x; - real_dstrect.y *= renderer->scale.y; - real_dstrect.w *= renderer->scale.x; - real_dstrect.h *= renderer->scale.y; - - real_center.x *= renderer->scale.x; - real_center.y *= renderer->scale.y; - - retval = QueueCmdCopyEx(renderer, texture, &real_srcrect, &real_dstrect, angle, &real_center, flip); + retval = QueueCmdCopyEx(renderer, texture, &real_srcrect, &real_dstrect, angle, &real_center, flip, renderer->scale.x, renderer->scale.y); } return retval < 0 ? retval : FlushRenderCommandsIfNotBatching(renderer); } @@ -4046,7 +4025,23 @@ SDL_SW_RenderGeometryRaw(SDL_Renderer *renderer, 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); @@ -4056,8 +4051,8 @@ SDL_SW_RenderGeometryRaw(SDL_Renderer *renderer, 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); @@ -4239,7 +4234,11 @@ SDL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, FlushRenderCommands(renderer); /* we need to render before we read the results. */ if (!format) { - format = SDL_GetWindowPixelFormat(renderer->window); + if (renderer->target == NULL) { + format = SDL_GetWindowPixelFormat(renderer->window); + } else { + format = renderer->target->format; + } } real_rect.x = (int)SDL_floor(renderer->viewport.x); diff --git a/libs/SDL2/src/render/SDL_sysrender.h b/libs/SDL2/src/render/SDL_sysrender.h index ff38ed0d..f559a262 100644 --- a/libs/SDL2/src/render/SDL_sysrender.h +++ b/libs/SDL2/src/render/SDL_sysrender.h @@ -28,6 +28,23 @@ #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). + */ +typedef struct SDL_DRect +{ + double x; + double y; + double w; + double h; +} SDL_DRect; + + /* The SDL 2D rendering system */ typedef struct SDL_RenderDriver SDL_RenderDriver; @@ -143,7 +160,7 @@ struct SDL_Renderer const SDL_Rect * srcrect, const SDL_FRect * dstrect); int (*QueueCopyEx) (SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * texture, const SDL_Rect * srcquad, const SDL_FRect * dstrect, - const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip); + const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip, float scale_x, float scale_y); int (*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, @@ -201,12 +218,12 @@ struct SDL_Renderer SDL_bool integer_scale; /* The drawable area within the window */ - SDL_FRect viewport; - SDL_FRect viewport_backup; + SDL_DRect viewport; + SDL_DRect viewport_backup; /* The clip rectangle within the window */ - SDL_FRect clip_rect; - SDL_FRect clip_rect_backup; + SDL_DRect clip_rect; + SDL_DRect clip_rect_backup; /* Wether or not the clipping rectangle is used. */ SDL_bool clipping_enabled; @@ -244,8 +261,8 @@ struct SDL_Renderer SDL_RenderCommand *render_commands_pool; Uint32 render_command_generation; Uint32 last_queued_color; - SDL_FRect last_queued_viewport; - SDL_FRect last_queued_cliprect; + SDL_DRect last_queued_viewport; + SDL_DRect last_queued_cliprect; SDL_bool last_queued_cliprect_enabled; SDL_bool color_queued; SDL_bool viewport_queued; @@ -270,6 +287,7 @@ struct SDL_RenderDriver /* 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; @@ -295,6 +313,11 @@ extern void *SDL_AllocateRenderVertices(SDL_Renderer *renderer, const size_t num 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 --git a/libs/SDL2/src/render/direct3d/SDL_render_d3d.c b/libs/SDL2/src/render/direct3d/SDL_render_d3d.c index deb324c7..5344d0a5 100644 --- a/libs/SDL2/src/render/direct3d/SDL_render_d3d.c +++ b/libs/SDL2/src/render/direct3d/SDL_render_d3d.c @@ -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; @@ -71,7 +78,9 @@ typedef struct IDirect3DSurface9 *defaultRenderTarget; IDirect3DSurface9 *currentRenderTarget; void* d3dxDLL; +#if SDL_HAVE_YUV LPDIRECT3DPIXELSHADER9 shaders[NUM_SHADERS]; +#endif LPDIRECT3DVERTEXBUFFER9 vertexBuffers[8]; size_t vertexBufferSize[8]; int currentVertexBuffer; @@ -95,6 +104,7 @@ typedef struct D3D_TextureRep texture; D3DTEXTUREFILTERTYPE scaleMode; +#if SDL_HAVE_YUV /* YV12 texture support */ SDL_bool yuv; D3D_TextureRep utexture; @@ -102,6 +112,7 @@ typedef struct Uint8 *pixels; int pitch; SDL_Rect locked_rect; +#endif } D3D_TextureData; typedef struct @@ -297,7 +308,7 @@ D3D_ActivateRenderer(SDL_Renderer * renderer) 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) { @@ -343,7 +354,15 @@ D3D_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event) } } -static D3DBLEND GetBlendFunc(SDL_BlendFactor factor) +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) { switch (factor) { case SDL_BLENDFACTOR_ZERO: @@ -366,9 +385,28 @@ static D3DBLEND GetBlendFunc(SDL_BlendFactor factor) return D3DBLEND_DESTALPHA; case SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA: return D3DBLEND_INVDESTALPHA; - default: - return (D3DBLEND)0; + default: break; } + return (D3DBLEND) 0; +} + +static D3DBLENDOP +GetBlendEquation(SDL_BlendOperation operation) +{ + switch (operation) { + case SDL_BLENDOPERATION_ADD: + return D3DBLENDOP_ADD; + case SDL_BLENDOPERATION_SUBTRACT: + return D3DBLENDOP_SUBTRACT; + case SDL_BLENDOPERATION_REV_SUBTRACT: + return D3DBLENDOP_REVSUBTRACT; + case SDL_BLENDOPERATION_MINIMUM: + return D3DBLENDOP_MIN; + case SDL_BLENDOPERATION_MAXIMUM: + return D3DBLENDOP_MAX; + default: break; + } + return (D3DBLENDOP) 0; } static SDL_bool @@ -383,14 +421,16 @@ D3D_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode) SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode); if (!GetBlendFunc(srcColorFactor) || !GetBlendFunc(srcAlphaFactor) || - !GetBlendFunc(dstColorFactor) || !GetBlendFunc(dstAlphaFactor)) { + !GetBlendEquation(colorOperation) || + !GetBlendFunc(dstColorFactor) || !GetBlendFunc(dstAlphaFactor) || + !GetBlendEquation(alphaOperation)) { return SDL_FALSE; } - if ((srcColorFactor != srcAlphaFactor || dstColorFactor != dstAlphaFactor) && !data->enableSeparateAlphaBlend) { - return SDL_FALSE; - } - if (colorOperation != SDL_BLENDOPERATION_ADD || alphaOperation != SDL_BLENDOPERATION_ADD) { - return SDL_FALSE; + + if (!data->enableSeparateAlphaBlend) { + if ((srcColorFactor != srcAlphaFactor) || (dstColorFactor != dstAlphaFactor) || (colorOperation != alphaOperation)) { + return SDL_FALSE; + } } return SDL_TRUE; } @@ -534,7 +574,7 @@ D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) if (D3D_CreateTextureRep(data->device, &texturedata->texture, usage, texture->format, PixelFormatToD3DFMT(texture->format), texture->w, texture->h) < 0) { return -1; } - +#if SDL_HAVE_YUV if (texture->format == SDL_PIXELFORMAT_YV12 || texture->format == SDL_PIXELFORMAT_IYUV) { texturedata->yuv = SDL_TRUE; @@ -547,6 +587,7 @@ D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) return -1; } } +#endif return 0; } @@ -563,7 +604,7 @@ D3D_RecreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) if (D3D_RecreateTextureRep(data->device, &texturedata->texture) < 0) { return -1; } - +#if SDL_HAVE_YUV if (texturedata->yuv) { if (D3D_RecreateTextureRep(data->device, &texturedata->utexture) < 0) { return -1; @@ -573,6 +614,7 @@ D3D_RecreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) return -1; } } +#endif return 0; } @@ -584,14 +626,13 @@ D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, D3D_TextureData *texturedata = (D3D_TextureData *) texture->driverdata; if (!texturedata) { - SDL_SetError("Texture is not currently available"); - return -1; + return SDL_SetError("Texture is not currently available"); } if (D3D_UpdateTextureRep(data->device, &texturedata->texture, rect->x, rect->y, rect->w, rect->h, pixels, pitch) < 0) { return -1; } - +#if SDL_HAVE_YUV if (texturedata->yuv) { /* Skip to the correct offset into the next texture */ pixels = (const void*)((const Uint8*)pixels + rect->h * pitch); @@ -606,6 +647,7 @@ D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, return -1; } } +#endif return 0; } @@ -621,8 +663,7 @@ D3D_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture, D3D_TextureData *texturedata = (D3D_TextureData *) texture->driverdata; if (!texturedata) { - SDL_SetError("Texture is not currently available"); - return -1; + return SDL_SetError("Texture is not currently available"); } if (D3D_UpdateTextureRep(data->device, &texturedata->texture, rect->x, rect->y, rect->w, rect->h, Yplane, Ypitch) < 0) { @@ -647,10 +688,9 @@ D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, IDirect3DDevice9 *device = data->device; if (!texturedata) { - SDL_SetError("Texture is not currently available"); - return -1; + return SDL_SetError("Texture is not currently available"); } - +#if SDL_HAVE_YUV texturedata->locked_rect = *rect; if (texturedata->yuv) { @@ -666,7 +706,9 @@ D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, (void *) ((Uint8 *) texturedata->pixels + rect->y * texturedata->pitch + rect->x * SDL_BYTESPERPIXEL(texture->format)); *pitch = texturedata->pitch; - } else { + } else +#endif + { RECT d3drect; D3DLOCKED_RECT locked; HRESULT result; @@ -699,14 +741,17 @@ D3D_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) if (!texturedata) { return; } - +#if SDL_HAVE_YUV if (texturedata->yuv) { const SDL_Rect *rect = &texturedata->locked_rect; void *pixels = (void *) ((Uint8 *) texturedata->pixels + rect->y * texturedata->pitch + rect->x * SDL_BYTESPERPIXEL(texture->format)); D3D_UpdateTexture(renderer, texture, rect, pixels, texturedata->pitch); - } else { + } + else +#endif + { IDirect3DTexture9_UnlockRect(texturedata->texture.staging, 0); texturedata->texture.dirty = SDL_TRUE; if (data->drawstate.texture == texture) { @@ -714,10 +759,6 @@ D3D_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) data->drawstate.shader = NULL; IDirect3DDevice9_SetPixelShader(data->device, NULL); IDirect3DDevice9_SetTexture(data->device, 0, NULL); - if (texturedata->yuv) { - IDirect3DDevice9_SetTexture(data->device, 1, NULL); - IDirect3DDevice9_SetTexture(data->device, 2, NULL); - } } } } @@ -756,8 +797,7 @@ D3D_SetRenderTargetInternal(SDL_Renderer * renderer, SDL_Texture * texture) texturedata = (D3D_TextureData *)texture->driverdata; if (!texturedata) { - SDL_SetError("Texture is not currently available"); - return -1; + return SDL_SetError("Texture is not currently available"); } /* Make sure the render target is updated if it was locked and written to */ @@ -942,8 +982,7 @@ SetupTextureState(D3D_RenderData *data, SDL_Texture * texture, LPDIRECT3DPIXELSH SDL_assert(*shader == NULL); if (!texturedata) { - SDL_SetError("Texture is not currently available"); - return -1; + return SDL_SetError("Texture is not currently available"); } UpdateTextureScaleMode(data, texturedata, 0); @@ -951,7 +990,7 @@ SetupTextureState(D3D_RenderData *data, SDL_Texture * texture, LPDIRECT3DPIXELSH if (BindTextureRep(data->device, &texturedata->texture, 0) < 0) { return -1; } - +#if SDL_HAVE_YUV if (texturedata->yuv) { switch (SDL_GetYUVConversionModeForResolution(texture->w, texture->h)) { case SDL_YUV_CONVERSION_JPEG: @@ -977,6 +1016,7 @@ SetupTextureState(D3D_RenderData *data, SDL_Texture * texture, LPDIRECT3DPIXELSH return -1; } } +#endif return 0; } @@ -987,18 +1027,22 @@ SetDrawState(D3D_RenderData *data, const SDL_RenderCommand *cmd) const SDL_BlendMode blend = cmd->data.draw.blend; if (texture != data->drawstate.texture) { +#if SDL_HAVE_YUV D3D_TextureData *oldtexturedata = data->drawstate.texture ? (D3D_TextureData *) data->drawstate.texture->driverdata : NULL; D3D_TextureData *newtexturedata = texture ? (D3D_TextureData *) texture->driverdata : NULL; +#endif LPDIRECT3DPIXELSHADER9 shader = NULL; /* disable any enabled textures we aren't going to use, let SetupTextureState() do the rest. */ if (texture == NULL) { IDirect3DDevice9_SetTexture(data->device, 0, NULL); } +#if SDL_HAVE_YUV if ((!newtexturedata || !newtexturedata->yuv) && (oldtexturedata && oldtexturedata->yuv)) { IDirect3DDevice9_SetTexture(data->device, 1, NULL); IDirect3DDevice9_SetTexture(data->device, 2, NULL); } +#endif if (texture && SetupTextureState(data, texture, &shader) < 0) { return -1; } @@ -1015,10 +1059,12 @@ SetDrawState(D3D_RenderData *data, const SDL_RenderCommand *cmd) } else if (texture) { D3D_TextureData *texturedata = (D3D_TextureData *) texture->driverdata; UpdateDirtyTexture(data->device, &texturedata->texture); +#if SDL_HAVE_YUV if (texturedata->yuv) { UpdateDirtyTexture(data->device, &texturedata->utexture); UpdateDirtyTexture(data->device, &texturedata->vtexture); } +#endif } if (blend != data->drawstate.blend) { @@ -1030,11 +1076,15 @@ SetDrawState(D3D_RenderData *data, const SDL_RenderCommand *cmd) GetBlendFunc(SDL_GetBlendModeSrcColorFactor(blend))); IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLEND, GetBlendFunc(SDL_GetBlendModeDstColorFactor(blend))); + IDirect3DDevice9_SetRenderState(data->device, D3DRS_BLENDOP, + GetBlendEquation(SDL_GetBlendModeColorOperation(blend))); if (data->enableSeparateAlphaBlend) { IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLENDALPHA, GetBlendFunc(SDL_GetBlendModeSrcAlphaFactor(blend))); IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLENDALPHA, GetBlendFunc(SDL_GetBlendModeDstAlphaFactor(blend))); + IDirect3DDevice9_SetRenderState(data->device, D3DRS_BLENDOPALPHA, + GetBlendEquation(SDL_GetBlendModeAlphaOperation(blend))); } } @@ -1043,7 +1093,13 @@ SetDrawState(D3D_RenderData *data, const SDL_RenderCommand *cmd) 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 */ @@ -1070,7 +1126,11 @@ SetDrawState(D3D_RenderData *data, const SDL_RenderCommand *cmd) 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; } @@ -1147,8 +1207,8 @@ D3D_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *verti 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; @@ -1161,8 +1221,8 @@ D3D_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *verti 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; @@ -1185,7 +1245,9 @@ D3D_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *verti 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); @@ -1276,6 +1338,7 @@ D3D_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, RECT d3drect; D3DLOCKED_RECT locked; HRESULT result; + int status; if (data->currentRenderTarget) { backBuffer = data->currentRenderTarget; @@ -1310,7 +1373,7 @@ D3D_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, return D3D_SetError("LockRect()", result); } - SDL_ConvertPixels(rect->w, rect->h, + status = SDL_ConvertPixels(rect->w, rect->h, D3DFMTToPixelFormat(desc.Format), locked.pBits, locked.Pitch, format, pixels, pitch); @@ -1318,7 +1381,7 @@ D3D_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, IDirect3DSurface9_Release(surface); - return 0; + return status; } static void @@ -1357,10 +1420,12 @@ D3D_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture) renderdata->drawstate.shader = NULL; IDirect3DDevice9_SetPixelShader(renderdata->device, NULL); IDirect3DDevice9_SetTexture(renderdata->device, 0, NULL); +#if SDL_HAVE_YUV if (data->yuv) { IDirect3DDevice9_SetTexture(renderdata->device, 1, NULL); IDirect3DDevice9_SetTexture(renderdata->device, 2, NULL); } +#endif } if (!data) { @@ -1368,9 +1433,11 @@ D3D_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture) } D3D_DestroyTextureRep(&data->texture); +#if SDL_HAVE_YUV D3D_DestroyTextureRep(&data->utexture); D3D_DestroyTextureRep(&data->vtexture); SDL_free(data->pixels); +#endif SDL_free(data); texture->driverdata = NULL; } @@ -1392,12 +1459,14 @@ D3D_DestroyRenderer(SDL_Renderer * renderer) IDirect3DSurface9_Release(data->currentRenderTarget); data->currentRenderTarget = NULL; } +#if SDL_HAVE_YUV for (i = 0; i < SDL_arraysize(data->shaders); ++i) { if (data->shaders[i]) { IDirect3DPixelShader9_Release(data->shaders[i]); data->shaders[i] = NULL; } } +#endif /* Release all vertex buffers */ for (i = 0; i < SDL_arraysize(data->vertexBuffers); ++i) { if (data->vertexBuffers[i]) { @@ -1554,6 +1623,7 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags) } renderer->WindowEvent = D3D_WindowEvent; + renderer->GetOutputSize = D3D_GetOutputSize; renderer->SupportsBlendMode = D3D_SupportsBlendMode; renderer->CreateTexture = D3D_CreateTexture; renderer->UpdateTexture = D3D_UpdateTexture; @@ -1583,7 +1653,7 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags) 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); @@ -1670,7 +1740,7 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags) /* Set up parameters for rendering */ D3D_InitRenderState(data); - +#if SDL_HAVE_YUV if (caps.MaxSimultaneousTextures >= 3) { int i; for (i = 0; i < SDL_arraysize(data->shaders); ++i) { @@ -1684,7 +1754,10 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_IYUV; } } - +#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; @@ -1702,7 +1775,7 @@ SDL_RenderDriver D3D_RenderDriver = { }; #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) @@ -1726,6 +1799,6 @@ SDL_RenderGetD3D9Device(SDL_Renderer * renderer) return device; } -#endif /* __WIN32__ */ +#endif /* defined(__WIN32__) || defined(__WINGDK__) */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/render/direct3d11/SDL_render_d3d11.c b/libs/SDL2/src/render/direct3d11/SDL_render_d3d11.c index f8d8c7cf..cd3dab4a 100644 --- a/libs/SDL2/src/render/direct3d11/SDL_render_d3d11.c +++ b/libs/SDL2/src/render/direct3d11/SDL_render_d3d11.c @@ -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" @@ -91,7 +94,7 @@ typedef struct int lockedTexturePositionX; int lockedTexturePositionY; D3D11_FILTER scaleMode; - +#if SDL_HAVE_YUV /* YV12 texture support */ SDL_bool yuv; ID3D11Texture2D *mainTextureU; @@ -107,6 +110,7 @@ typedef struct Uint8 *pixels; int pitch; SDL_Rect locked_rect; +#endif } D3D11_TextureData; /* Blend mode data */ @@ -487,6 +491,11 @@ D3D11_CreateDeviceResources(SDL_Renderer * renderer) creationFlags |= D3D11_CREATE_DEVICE_DEBUG; } + /* Create a single-threaded device unless the app requests otherwise. */ + if (!SDL_GetHintBoolean(SDL_HINT_RENDER_DIRECT3D_THREADSAFE, SDL_FALSE)) { + creationFlags |= D3D11_CREATE_DEVICE_SINGLETHREADED; + } + /* Create the Direct3D 11 API device object and a corresponding context. */ result = D3D11CreateDeviceFunc( data->dxgiAdapter, @@ -663,7 +672,7 @@ done: return result; } -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__WINGDK__) static DXGI_MODE_ROTATION D3D11_GetCurrentRotation() @@ -672,7 +681,7 @@ D3D11_GetCurrentRotation() return DXGI_MODE_ROTATION_IDENTITY; } -#endif /* __WIN32__ */ +#endif /* defined(__WIN32__) || defined(__WINGDK__) */ static BOOL D3D11_IsDisplayRotated90Degrees(DXGI_MODE_ROTATION rotation) @@ -818,7 +827,7 @@ D3D11_CreateSwapChain(SDL_Renderer * renderer, int w, int h) goto done; #endif } else { -#ifdef __WIN32__ +#if defined(__WIN32__) || defined(__WINGDK__) SDL_SysWMinfo windowinfo; SDL_VERSION(&windowinfo.version); SDL_GetWindowWMInfo(renderer->window, &windowinfo); @@ -840,7 +849,7 @@ D3D11_CreateSwapChain(SDL_Renderer * renderer, int w, int h) #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; @@ -904,7 +913,11 @@ D3D11_CreateWindowSizeDependentResources(SDL_Renderer * renderer) /* 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)) { @@ -992,6 +1005,16 @@ D3D11_CreateWindowSizeDependentResources(SDL_Renderer * renderer) goto done; } + /* 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! + */ + ID3D11DeviceContext_OMSetRenderTargets(data->d3dContext, + 1, + &data->mainRenderTargetView, + NULL + ); + data->viewportDirty = SDL_TRUE; done: @@ -1035,6 +1058,15 @@ D3D11_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event) } } +#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) { @@ -1109,10 +1141,9 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ); if (FAILED(result)) { D3D11_DestroyTexture(renderer, texture); - WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result); - return -1; + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result); } - +#if SDL_HAVE_YUV if (texture->format == SDL_PIXELFORMAT_YV12 || texture->format == SDL_PIXELFORMAT_IYUV) { textureData->yuv = SDL_TRUE; @@ -1127,8 +1158,7 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ); if (FAILED(result)) { D3D11_DestroyTexture(renderer, texture); - WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result); - return -1; + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result); } result = ID3D11Device_CreateTexture2D(rendererData->d3dDevice, @@ -1138,8 +1168,7 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ); if (FAILED(result)) { D3D11_DestroyTexture(renderer, texture); - WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result); - return -1; + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result); } } @@ -1160,11 +1189,11 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ); if (FAILED(result)) { D3D11_DestroyTexture(renderer, texture); - WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result); - return -1; + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result); } } - +#endif /* SDL_HAVE_YUV */ + SDL_zero(resourceViewDesc); resourceViewDesc.Format = textureDesc.Format; resourceViewDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; resourceViewDesc.Texture2D.MostDetailedMip = 0; @@ -1176,10 +1205,9 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ); if (FAILED(result)) { D3D11_DestroyTexture(renderer, texture); - WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result); - return -1; + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result); } - +#if SDL_HAVE_YUV if (textureData->yuv) { result = ID3D11Device_CreateShaderResourceView(rendererData->d3dDevice, (ID3D11Resource *)textureData->mainTextureU, @@ -1188,8 +1216,7 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ); if (FAILED(result)) { D3D11_DestroyTexture(renderer, texture); - WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result); - return -1; + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result); } result = ID3D11Device_CreateShaderResourceView(rendererData->d3dDevice, (ID3D11Resource *)textureData->mainTextureV, @@ -1198,8 +1225,7 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ); if (FAILED(result)) { D3D11_DestroyTexture(renderer, texture); - WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result); - return -1; + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result); } } @@ -1215,13 +1241,14 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ); if (FAILED(result)) { D3D11_DestroyTexture(renderer, texture); - WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result); - return -1; + 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; @@ -1232,8 +1259,7 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) &textureData->mainTextureRenderTargetView); if (FAILED(result)) { D3D11_DestroyTexture(renderer, texture); - WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateRenderTargetView"), result); - return -1; + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateRenderTargetView"), result); } } @@ -1254,6 +1280,7 @@ D3D11_DestroyTexture(SDL_Renderer * renderer, SAFE_RELEASE(data->mainTextureResourceView); SAFE_RELEASE(data->mainTextureRenderTargetView); SAFE_RELEASE(data->stagingTexture); +#if SDL_HAVE_YUV SAFE_RELEASE(data->mainTextureU); SAFE_RELEASE(data->mainTextureResourceViewU); SAFE_RELEASE(data->mainTextureV); @@ -1261,6 +1288,7 @@ D3D11_DestroyTexture(SDL_Renderer * renderer, SAFE_RELEASE(data->mainTextureNV); SAFE_RELEASE(data->mainTextureResourceViewNV); SDL_free(data->pixels); +#endif SDL_free(data); texture->driverdata = NULL; } @@ -1290,8 +1318,7 @@ D3D11_UpdateTextureInternal(D3D11_RenderData *rendererData, ID3D11Texture2D *tex NULL, &stagingTexture); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D [create staging texture]"), result); - return -1; + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D [create staging texture]"), result); } /* Get a write-only pointer to data in the staging texture: */ @@ -1303,9 +1330,8 @@ D3D11_UpdateTextureInternal(D3D11_RenderData *rendererData, ID3D11Texture2D *tex &textureMemory ); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11DeviceContext1::Map [map staging texture]"), result); SAFE_RELEASE(stagingTexture); - return -1; + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11DeviceContext1::Map [map staging texture]"), result); } src = (const Uint8 *)pixels; @@ -1357,14 +1383,13 @@ D3D11_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, D3D11_TextureData *textureData = (D3D11_TextureData *)texture->driverdata; if (!textureData) { - SDL_SetError("Texture is not currently available"); - return -1; + return SDL_SetError("Texture is not currently available"); } if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTexture, SDL_BYTESPERPIXEL(texture->format), rect->x, rect->y, rect->w, rect->h, srcPixels, srcPitch) < 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); @@ -1388,6 +1413,7 @@ D3D11_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, return -1; } } +#endif /* SDL_HAVE_YUV */ return 0; } @@ -1403,8 +1429,7 @@ D3D11_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture, D3D11_TextureData *textureData = (D3D11_TextureData *)texture->driverdata; if (!textureData) { - SDL_SetError("Texture is not currently available"); - return -1; + return SDL_SetError("Texture is not currently available"); } if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTexture, SDL_BYTESPERPIXEL(texture->format), rect->x, rect->y, rect->w, rect->h, Yplane, Ypitch) < 0) { @@ -1429,8 +1454,7 @@ D3D11_UpdateTextureNV(SDL_Renderer * renderer, SDL_Texture * texture, D3D11_TextureData *textureData = (D3D11_TextureData *)texture->driverdata; if (!textureData) { - SDL_SetError("Texture is not currently available"); - return -1; + return SDL_SetError("Texture is not currently available"); } if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTexture, SDL_BYTESPERPIXEL(texture->format), rect->x, rect->y, rect->w, rect->h, Yplane, Ypitch) < 0) { @@ -1455,10 +1479,9 @@ D3D11_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, D3D11_MAPPED_SUBRESOURCE textureMemory; if (!textureData) { - SDL_SetError("Texture is not currently available"); - return -1; + 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) { @@ -1475,7 +1498,7 @@ D3D11_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, *pitch = textureData->pitch; return 0; } - +#endif if (textureData->stagingTexture) { return SDL_SetError("texture is already locked"); } @@ -1500,8 +1523,7 @@ D3D11_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, NULL, &textureData->stagingTexture); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D [create staging texture]"), result); - return -1; + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D [create staging texture]"), result); } /* Get a write-only pointer to data in the staging texture: */ @@ -1513,9 +1535,8 @@ D3D11_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, &textureMemory ); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11DeviceContext1::Map [map staging texture]"), result); SAFE_RELEASE(textureData->stagingTexture); - return -1; + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11DeviceContext1::Map [map staging texture]"), result); } /* Make note of where the staging texture will be written to @@ -1541,7 +1562,7 @@ D3D11_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) if (!textureData) { return; } - +#if SDL_HAVE_YUV if (textureData->yuv || textureData->nv12) { const SDL_Rect *rect = &textureData->locked_rect; void *pixels = @@ -1550,7 +1571,7 @@ D3D11_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) D3D11_UpdateTexture(renderer, texture, rect, pixels, textureData->pitch); return; } - +#endif /* Commit the pixel buffer's changes back to the staging texture: */ ID3D11DeviceContext_Unmap(rendererData->d3dContext, (ID3D11Resource *)textureData->stagingTexture, @@ -1713,8 +1734,7 @@ D3D11_UpdateVertexBuffer(SDL_Renderer *renderer, &mappedResource ); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11DeviceContext1::Map [vertex buffer]"), result); - return -1; + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11DeviceContext1::Map [vertex buffer]"), result); } SDL_memcpy(mappedResource.pData, vertexData, dataSizeInBytes); ID3D11DeviceContext_Unmap(rendererData->d3dContext, (ID3D11Resource *)rendererData->vertexBuffers[vbidx], 0); @@ -1741,8 +1761,7 @@ D3D11_UpdateVertexBuffer(SDL_Renderer *renderer, &rendererData->vertexBuffers[vbidx] ); if (FAILED(result)) { - WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateBuffer [vertex buffer]"), result); - return -1; + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateBuffer [vertex buffer]"), result); } rendererData->vertexBufferSizes[vbidx] = dataSizeInBytes; @@ -1963,7 +1982,7 @@ D3D11_SetDrawState(SDL_Renderer * renderer, const SDL_RenderCommand *cmd, ID3D11 } 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, @@ -1995,7 +2014,7 @@ D3D11_SetCopyState(SDL_Renderer * renderer, const SDL_RenderCommand *cmd, const default: return SDL_SetError("Unknown scale mode: %d\n", textureData->scaleMode); } - +#if SDL_HAVE_YUV if (textureData->yuv) { ID3D11ShaderResourceView *shaderResources[] = { textureData->mainTextureResourceView, @@ -2046,7 +2065,7 @@ D3D11_SetCopyState(SDL_Renderer * renderer, const SDL_RenderCommand *cmd, const SDL_arraysize(shaderResources), shaderResources, textureSampler, matrix); } - +#endif /* SDL_HAVE_YUV */ return D3D11_SetDrawState(renderer, cmd, rendererData->pixelShaders[SHADER_RGB], 1, &textureData->mainTextureResourceView, textureSampler, matrix); } @@ -2082,8 +2101,8 @@ D3D11_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *ver 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 @@ D3D11_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *ver 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; @@ -2249,30 +2268,20 @@ D3D11_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, /* Copy the data into the desired buffer, converting pixels to the * desired format at the same time: */ - if (SDL_ConvertPixels( + status = SDL_ConvertPixels( rect->w, rect->h, D3D11_DXGIFormatToSDLPixelFormat(stagingTextureDesc.Format), textureMemory.pData, textureMemory.RowPitch, format, pixels, - pitch) != 0) { - /* When SDL_ConvertPixels fails, it'll have already set the format. - * Get the error message, and attach some extra data to it. - */ - char errorMessage[1024]; - SDL_snprintf(errorMessage, sizeof(errorMessage), "%s, Convert Pixels failed: %s", __FUNCTION__, SDL_GetError()); - SDL_SetError("%s", errorMessage); - goto done; - } + pitch); /* Unmap the texture: */ ID3D11DeviceContext_Unmap(data->d3dContext, (ID3D11Resource *)stagingTexture, 0); - status = 0; - done: SAFE_RELEASE(backBuffer); SAFE_RELEASE(stagingTexture); @@ -2365,6 +2374,7 @@ D3D11_CreateRenderer(SDL_Window * window, Uint32 flags) data = (D3D11_RenderData *) SDL_calloc(1, sizeof(*data)); if (!data) { + SDL_free(renderer); SDL_OutOfMemory(); return NULL; } @@ -2372,6 +2382,9 @@ D3D11_CreateRenderer(SDL_Window * window, Uint32 flags) 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; @@ -2460,7 +2473,7 @@ SDL_RenderDriver D3D11_RenderDriver = { #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) @@ -2484,6 +2497,6 @@ SDL_RenderGetD3D11Device(SDL_Renderer * renderer) return device; } -#endif /* __WIN32__ */ +#endif /* defined(__WIN32__) || defined(__WINGDK__) */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/render/direct3d11/SDL_shaders_d3d11.c b/libs/SDL2/src/render/direct3d11/SDL_shaders_d3d11.c index 4c49cfe3..3a6807b5 100644 --- a/libs/SDL2/src/render/direct3d11/SDL_shaders_d3d11.c +++ b/libs/SDL2/src/render/direct3d11/SDL_shaders_d3d11.c @@ -1886,9 +1886,10 @@ static struct { const void *shader_data; SIZE_T shader_size; -} D3D11_shaders[] = { +} D3D11_shaders[NUM_SHADERS] = { { D3D11_PixelShader_Colors, sizeof(D3D11_PixelShader_Colors) }, { D3D11_PixelShader_Textures, sizeof(D3D11_PixelShader_Textures) }, +#if SDL_HAVE_YUV { D3D11_PixelShader_YUV_JPEG, sizeof(D3D11_PixelShader_YUV_JPEG) }, { D3D11_PixelShader_YUV_BT601, sizeof(D3D11_PixelShader_YUV_BT601) }, { D3D11_PixelShader_YUV_BT709, sizeof(D3D11_PixelShader_YUV_BT709) }, @@ -1898,6 +1899,7 @@ static struct { D3D11_PixelShader_NV21_JPEG, sizeof(D3D11_PixelShader_NV21_JPEG) }, { D3D11_PixelShader_NV21_BT601, sizeof(D3D11_PixelShader_NV21_BT601) }, { D3D11_PixelShader_NV21_BT709, sizeof(D3D11_PixelShader_NV21_BT709) }, +#endif }; int D3D11_CreateVertexShader(ID3D11Device1 *d3dDevice, ID3D11VertexShader **vertexShader, ID3D11InputLayout **inputLayout) diff --git a/libs/SDL2/src/render/direct3d11/SDL_shaders_d3d11.h b/libs/SDL2/src/render/direct3d11/SDL_shaders_d3d11.h index d25a79ad..d877c090 100644 --- a/libs/SDL2/src/render/direct3d11/SDL_shaders_d3d11.h +++ b/libs/SDL2/src/render/direct3d11/SDL_shaders_d3d11.h @@ -25,6 +25,7 @@ typedef enum { SHADER_SOLID, SHADER_RGB, +#if SDL_HAVE_YUV SHADER_YUV_JPEG, SHADER_YUV_BT601, SHADER_YUV_BT709, @@ -34,6 +35,7 @@ typedef enum { SHADER_NV21_JPEG, SHADER_NV21_BT601, SHADER_NV21_BT709, +#endif NUM_SHADERS } D3D11_Shader; diff --git a/libs/SDL2/src/render/direct3d12/SDL_render_d3d12.c b/libs/SDL2/src/render/direct3d12/SDL_render_d3d12.c new file mode 100644 index 00000000..924466cc --- /dev/null +++ b/libs/SDL2/src/render/direct3d12/SDL_render_d3d12.c @@ -0,0 +1,3141 @@ +/* + 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; + const UINT stride = sizeof(VertexPositionColor); + 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 --git a/libs/SDL2/src/render/direct3d12/SDL_render_d3d12_xbox.cpp b/libs/SDL2/src/render/direct3d12/SDL_render_d3d12_xbox.cpp new file mode 100644 index 00000000..db71ebca --- /dev/null +++ b/libs/SDL2/src/render/direct3d12/SDL_render_d3d12_xbox.cpp @@ -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 --git a/libs/SDL2/src/render/direct3d12/SDL_render_d3d12_xbox.h b/libs/SDL2/src/render/direct3d12/SDL_render_d3d12_xbox.h new file mode 100644 index 00000000..7afec9e4 --- /dev/null +++ b/libs/SDL2/src/render/direct3d12/SDL_render_d3d12_xbox.h @@ -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 --git a/libs/SDL2/src/render/direct3d12/SDL_shaders_d3d12.c b/libs/SDL2/src/render/direct3d12/SDL_shaders_d3d12.c new file mode 100644 index 00000000..2bb56d5d --- /dev/null +++ b/libs/SDL2/src/render/direct3d12/SDL_shaders_d3d12.c @@ -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 --git a/libs/SDL2/src/render/direct3d12/SDL_shaders_d3d12.h b/libs/SDL2/src/render/direct3d12/SDL_shaders_d3d12.h new file mode 100644 index 00000000..e56c5ccf --- /dev/null +++ b/libs/SDL2/src/render/direct3d12/SDL_shaders_d3d12.h @@ -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 --git a/libs/SDL2/src/render/direct3d12/SDL_shaders_d3d12_xboxone.cpp b/libs/SDL2/src/render/direct3d12/SDL_shaders_d3d12_xboxone.cpp new file mode 100644 index 00000000..8af238eb --- /dev/null +++ b/libs/SDL2/src/render/direct3d12/SDL_shaders_d3d12_xboxone.cpp @@ -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 --git a/libs/SDL2/src/render/direct3d12/SDL_shaders_d3d12_xboxseries.cpp b/libs/SDL2/src/render/direct3d12/SDL_shaders_d3d12_xboxseries.cpp new file mode 100644 index 00000000..768ff6be --- /dev/null +++ b/libs/SDL2/src/render/direct3d12/SDL_shaders_d3d12_xboxseries.cpp @@ -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 --git a/libs/SDL2/src/render/metal/SDL_render_metal.m b/libs/SDL2/src/render/metal/SDL_render_metal.m index e093fd4d..b17bb454 100644 --- a/libs/SDL2/src/render/metal/SDL_render_metal.m +++ b/libs/SDL2/src/render/metal/SDL_render_metal.m @@ -142,24 +142,6 @@ typedef struct METAL_ShaderPipelines @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 @@ -167,26 +149,17 @@ typedef struct METAL_ShaderPipelines @property (nonatomic, retain) id mtltexture_uv; @property (nonatomic, retain) id mtlsampler; @property (nonatomic, assign) SDL_MetalFragmentFunction fragmentFunction; +#if SDL_HAVE_YUV @property (nonatomic, assign) BOOL yuv; @property (nonatomic, assign) BOOL nv12; @property (nonatomic, assign) size_t conversionBufferOffset; +#endif @property (nonatomic, assign) BOOL hasdata; - @property (nonatomic, retain) id lockedbuffer; @property (nonatomic, assign) SDL_Rect lockedrect; @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 @@ -267,16 +240,24 @@ static id 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: @@ -314,7 +295,7 @@ MakePipelineState(METAL_RenderData *data, METAL_PipelineCache *cache, mtlpipedesc.vertexDescriptor = vertdesc; - MTLRenderPipelineColorAttachmentDescriptor *rtdesc = mtlpipedesc.colorAttachments[0]; + rtdesc = mtlpipedesc.colorAttachments[0]; rtdesc.pixelFormat = cache->renderTargetFormat; if (blendmode != SDL_BLENDMODE_NONE) { @@ -331,22 +312,13 @@ MakePipelineState(METAL_RenderData *data, METAL_PipelineCache *cache, 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; @@ -576,6 +548,10 @@ METAL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) { @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: @@ -594,7 +570,7 @@ METAL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) 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. */ @@ -605,16 +581,16 @@ METAL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) mtltexdesc.usage = MTLTextureUsageShaderRead; } } - - id mtltexture = [data.mtldevice newTextureWithDescriptor:mtltexdesc]; + + mtltexture = [data.mtldevice newTextureWithDescriptor:mtltexdesc]; if (mtltexture == nil) { return SDL_SetError("Texture allocation failed"); } - id mtltexture_uv = nil; - - BOOL yuv = (texture->format == SDL_PIXELFORMAT_IYUV) || (texture->format == SDL_PIXELFORMAT_YV12); - BOOL nv12 = (texture->format == SDL_PIXELFORMAT_NV12) || (texture->format == SDL_PIXELFORMAT_NV21); + mtltexture_uv = nil; +#if SDL_HAVE_YUV + 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; @@ -631,14 +607,11 @@ METAL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) 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"); } } - - METAL_TextureData *texturedata = [[METAL_TextureData alloc] init]; +#endif /* SDL_HAVE_YUV */ + texturedata = [[METAL_TextureData alloc] init]; if (texture->scaleMode == SDL_ScaleModeNearest) { texturedata.mtlsampler = data.mtlsamplernearest; } else { @@ -646,7 +619,7 @@ METAL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) } texturedata.mtltexture = mtltexture; texturedata.mtltexture_uv = mtltexture_uv; - +#if SDL_HAVE_YUV texturedata.yuv = yuv; texturedata.nv12 = nv12; @@ -656,10 +629,12 @@ METAL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) texturedata.fragmentFunction = SDL_METAL_FRAGMENT_NV12; } else if (texture->format == SDL_PIXELFORMAT_NV21) { texturedata.fragmentFunction = SDL_METAL_FRAGMENT_NV21; - } else { + } else +#endif + { texturedata.fragmentFunction = SDL_METAL_FRAGMENT_COPY; } - +#if SDL_HAVE_YUV if (yuv || nv12) { size_t offset = 0; SDL_YUV_CONVERSION_MODE mode = SDL_GetYUVConversionModeForResolution(texture->w, texture->h); @@ -671,14 +646,8 @@ METAL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) } texturedata.conversionBufferOffset = offset; } - - texture->driverdata = (void*)CFBridgingRetain(texturedata); - -#if !__has_feature(objc_arc) - [texturedata release]; - [mtltexture release]; - [mtltexture_uv release]; #endif + texture->driverdata = (void*)CFBridgingRetain(texturedata); return 0; }} @@ -713,6 +682,8 @@ METAL_UpdateTextureInternal(SDL_Renderer * renderer, METAL_TextureData *textured 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 @@ -734,15 +705,11 @@ METAL_UpdateTextureInternal(SDL_Renderer * renderer, METAL_TextureData *textured /* 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) { @@ -754,7 +721,7 @@ METAL_UpdateTextureInternal(SDL_Renderer * renderer, METAL_TextureData *textured data.mtlcmdbuffer = [data.mtlcmdqueue commandBuffer]; } - id blitcmd = [data.mtlcmdbuffer blitCommandEncoder]; + blitcmd = [data.mtlcmdbuffer blitCommandEncoder]; [blitcmd copyFromTexture:stagingtex sourceSlice:0 @@ -785,7 +752,7 @@ METAL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, if (METAL_UpdateTextureInternal(renderer, texturedata, texturedata.mtltexture, *rect, 0, pixels, pitch) < 0) { return -1; } - +#if SDL_HAVE_YUV if (texturedata.yuv) { int Uslice = texture->format == SDL_PIXELFORMAT_YV12 ? 1 : 0; int Vslice = texture->format == SDL_PIXELFORMAT_YV12 ? 0 : 1; @@ -815,7 +782,7 @@ METAL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, return -1; } } - +#endif texturedata.hasdata = YES; return 0; @@ -896,10 +863,12 @@ METAL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, } *pitch = SDL_BYTESPERPIXEL(texture->format) * rect->w; - +#if SDL_HAVE_YUV if (texturedata.yuv || texturedata.nv12) { buffersize = ((*pitch) * rect->h) + (2 * (*pitch + 1) / 2) * ((rect->h + 1) / 2); - } else { + } else +#endif + { buffersize = (*pitch) * rect->h; } @@ -912,11 +881,6 @@ METAL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, texturedata.lockedbuffer = lockedbuffer; *pixels = [lockedbuffer contents]; - /* METAL_TextureData.lockedbuffer retains. */ -#if !__has_feature(objc_arc) - [lockedbuffer release]; -#endif - return 0; }} @@ -925,6 +889,7 @@ METAL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) { @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}; @@ -942,7 +907,7 @@ METAL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) data.mtlcmdbuffer = [data.mtlcmdqueue commandBuffer]; } - id blitcmd = [data.mtlcmdbuffer blitCommandEncoder]; + blitcmd = [data.mtlcmdbuffer blitCommandEncoder]; [blitcmd copyFromBuffer:texturedata.lockedbuffer sourceOffset:0 @@ -953,7 +918,7 @@ METAL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) destinationSlice:0 destinationLevel:0 destinationOrigin:MTLOriginMake(rect.x, rect.y, 0)]; - +#if SDL_HAVE_YUV if (texturedata.yuv) { int Uslice = texture->format == SDL_PIXELFORMAT_YV12 ? 1 : 0; int Vslice = texture->format == SDL_PIXELFORMAT_YV12 ? 0 : 1; @@ -993,7 +958,7 @@ METAL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) destinationLevel:0 destinationOrigin:MTLOriginMake(UVrect.x, UVrect.y, 0)]; } - +#endif [blitcmd endEncoding]; [data.mtlcmdbuffer commit]; @@ -1116,11 +1081,13 @@ METAL_QueueDrawLines(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_ 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; } @@ -1143,15 +1110,17 @@ METAL_QueueDrawLines(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_ 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; + { + 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; + 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; @@ -1175,6 +1144,7 @@ METAL_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture 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) { @@ -1185,7 +1155,7 @@ METAL_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture 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; @@ -1204,13 +1174,8 @@ METAL_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture 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; @@ -1250,22 +1215,29 @@ SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, const SDL_Met } if (statecache->cliprect_dirty) { - MTLScissorRect mtlrect; + SDL_Rect output; + SDL_Rect clip; if (statecache->cliprect_enabled) { - const SDL_Rect *rect = &statecache->cliprect; - mtlrect.x = statecache->viewport.x + rect->x; - mtlrect.y = statecache->viewport.y + rect->y; - mtlrect.width = rect->w; - mtlrect.height = rect->h; + clip = statecache->cliprect; + clip.x += statecache->viewport.x; + clip.y += statecache->viewport.y; } else { - mtlrect.x = statecache->viewport.x; - mtlrect.y = statecache->viewport.y; - mtlrect.width = statecache->viewport.w; - mtlrect.height = statecache->viewport.h; + clip = statecache->viewport; } - if (mtlrect.width > 0 && mtlrect.height > 0) { + + /* Set Scissor Rect Validation: w/h must be <= render pass */ + SDL_zero(output); + METAL_GetOutputSize(renderer, &output.w, &output.h); + + if (SDL_IntersectRect(&output, &clip, &clip)) { + MTLScissorRect mtlrect; + mtlrect.x = clip.x; + mtlrect.y = clip.y; + mtlrect.width = clip.w; + mtlrect.height = clip.h; [data.mtlcmdencoder setScissorRect:mtlrect]; } + statecache->cliprect_dirty = SDL_FALSE; } @@ -1313,10 +1285,12 @@ SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, const size_t } [data.mtlcmdencoder setFragmentTexture:texturedata.mtltexture atIndex:0]; +#if SDL_HAVE_YUV if (texturedata.yuv || texturedata.nv12) { [data.mtlcmdencoder setFragmentTexture:texturedata.mtltexture_uv atIndex:1]; [data.mtlcmdencoder setFragmentBuffer:data.mtlbufconstants offset:texturedata.conversionBufferOffset atIndex:1]; } +#endif statecache->texture = texture; } return SDL_TRUE; @@ -1326,11 +1300,10 @@ static int 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; @@ -1351,9 +1324,6 @@ METAL_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *ver * 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); @@ -1410,15 +1380,17 @@ METAL_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *ver 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); + { + 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); + // 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; } @@ -1471,12 +1443,17 @@ METAL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, 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 @@ -1497,19 +1474,19 @@ METAL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, 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; }} @@ -1589,8 +1566,9 @@ METAL_GetMetalCommandEncoder(SDL_Renderer * renderer) // 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; }} @@ -1650,8 +1628,58 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags) 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)) { @@ -1697,9 +1725,6 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags) } if (view == NULL) { -#if !__has_feature(objc_arc) - [mtldevice release]; -#endif SDL_free(renderer); if (changed_window) { SDL_RecreateWindow(window, window_flags); @@ -1711,9 +1736,6 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags) 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) */ @@ -1732,7 +1754,7 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags) data.mtlview = view; #ifdef __MACOSX__ - layer = (CAMetalLayer *)[(NSView *)view layer]; + layer = (CAMetalLayer *)[(__bridge NSView *)view layer]; #else layer = (CAMetalLayer *)[(__bridge UIView *)view layer]; #endif @@ -1744,22 +1766,17 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags) 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. */ @@ -1767,80 +1784,35 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags) 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, - }; + mtlbufconstantstaging = [data.mtldevice newBufferWithLength:CONSTANTS_LENGTH options:MTLResourceStorageModeShared]; - 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 */ - }; - - 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; @@ -1851,16 +1823,16 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags) 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]; @@ -1915,7 +1887,7 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags) } /* 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__) @@ -1951,18 +1923,6 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags) 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 --git a/libs/SDL2/src/render/opengl/SDL_render_gl.c b/libs/SDL2/src/render/opengl/SDL_render_gl.c index 47d5ae8a..73a5694d 100644 --- a/libs/SDL2/src/render/opengl/SDL_render_gl.c +++ b/libs/SDL2/src/render/opengl/SDL_render_gl.c @@ -30,6 +30,11 @@ #include #endif +#ifdef SDL_VIDEO_VITA_PVR_OGL +#include +#include +#endif + /* To prevent unnecessary window recreation, * these should match the defaults selected in SDL_GL_ResetAttributes */ @@ -319,6 +324,20 @@ GL_GetFBO(GL_RenderData *data, Uint32 w, Uint32 h) return result; } +static void +GL_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event) +{ + /* If the window x/y/w/h changed at all, assume the viewport has been + * changed behind our backs. x/y changes might seem weird but viewport + * resets have been observed on macOS at minimum! + */ + if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED || + event->event == SDL_WINDOWEVENT_MOVED) { + GL_RenderData *data = (GL_RenderData *) renderer->driverdata; + data->drawstate.viewport_dirty = SDL_TRUE; + } +} + static int GL_GetOutputSize(SDL_Renderer * renderer, int *w, int *h) { @@ -1038,7 +1057,7 @@ GL_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *te return 0; } -static void +static int SetDrawState(GL_RenderData *data, const SDL_RenderCommand *cmd, const GL_Shader shader) { const SDL_BlendMode blend = cmd->data.draw.blend; @@ -1111,7 +1130,8 @@ SetDrawState(GL_RenderData *data, const SDL_RenderCommand *cmd, const GL_Shader } } - vertex_array = cmd->command == SDL_RENDERCMD_DRAW_LINES + vertex_array = cmd->command == SDL_RENDERCMD_DRAW_POINTS + || cmd->command == SDL_RENDERCMD_DRAW_LINES || cmd->command == SDL_RENDERCMD_GEOMETRY; color_array = cmd->command == SDL_RENDERCMD_GEOMETRY; texture_array = cmd->data.draw.texture != NULL; @@ -1144,9 +1164,11 @@ SetDrawState(GL_RenderData *data, const SDL_RenderCommand *cmd, const GL_Shader } data->drawstate.texture_array = texture_array; } + + return 0; } -static void +static int SetCopyState(GL_RenderData *data, const SDL_RenderCommand *cmd) { SDL_Texture *texture = cmd->data.draw.texture; @@ -1182,6 +1204,8 @@ SetCopyState(GL_RenderData *data, const SDL_RenderCommand *cmd) data->drawstate.texture = texture; } + + return 0; } static int @@ -1189,7 +1213,6 @@ GL_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic { /* !!! FIXME: it'd be nice to use a vertex buffer instead of immediate mode... */ GL_RenderData *data = (GL_RenderData *) renderer->driverdata; - size_t i; if (GL_ActivateRenderer(renderer) < 0) { return -1; @@ -1208,9 +1231,9 @@ GL_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic } #ifdef __MACOSX__ - // On macOS, moving the window seems to invalidate the OpenGL viewport state, - // so don't bother trying to persist it across frames; always reset it. - // Workaround for: https://github.com/libsdl-org/SDL/issues/1504 + // On macOS on older systems, the OpenGL view change and resize events aren't + // necessarily synchronized, so just always reset it. + // Workaround for: https://discourse.libsdl.org/t/sdl-2-0-22-prerelease/35306/6 data->drawstate.viewport_dirty = SDL_TRUE; #endif @@ -1231,8 +1254,8 @@ GL_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic 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; @@ -1244,8 +1267,9 @@ GL_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic 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; @@ -1272,31 +1296,6 @@ GL_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic } data->glClear(GL_COLOR_BUFFER_BIT); - - break; - } - - case SDL_RENDERCMD_DRAW_POINTS: { - const size_t count = cmd->data.draw.count; - const GLfloat *verts = (GLfloat *) (((Uint8 *) vertices) + cmd->data.draw.first); - SetDrawState(data, cmd, SHADER_SOLID); - data->glBegin(GL_POINTS); - for (i = 0; i < count; i++, verts += 2) { - data->glVertex2f(verts[0], verts[1]); - } - data->glEnd(); - break; - } - - case SDL_RENDERCMD_DRAW_LINES: { - const GLfloat *verts = (GLfloat *) (((Uint8 *) vertices) + cmd->data.draw.first); - const size_t count = cmd->data.draw.count; - SDL_assert(count >= 2); - SetDrawState(data, cmd, SHADER_SOLID); - - /* SetDrawState handles glEnableClientState. */ - data->glVertexPointer(2, GL_FLOAT, sizeof(float) * 2, verts); - data->glDrawArrays(GL_LINE_STRIP, 0, (GLsizei) count); break; } @@ -1309,42 +1308,113 @@ GL_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic case SDL_RENDERCMD_COPY_EX: /* unused */ break; - case SDL_RENDERCMD_GEOMETRY: { - const GLfloat *verts = (GLfloat *) (((Uint8 *) vertices) + cmd->data.draw.first); - SDL_Texture *texture = cmd->data.draw.texture; - const size_t count = cmd->data.draw.count; - - if (texture) { - SetCopyState(data, cmd); - } else { - SetDrawState(data, cmd, SHADER_SOLID); - } - - { - Uint32 color = data->drawstate.color; - GLubyte a = (GLubyte)((color >> 24) & 0xFF); - GLubyte r = (GLubyte)((color >> 16) & 0xFF); - GLubyte g = (GLubyte)((color >> 8) & 0xFF); - GLubyte b = (GLubyte)((color >> 0) & 0xFF); + case SDL_RENDERCMD_DRAW_LINES: { + if (SetDrawState(data, cmd, SHADER_SOLID) == 0) { + size_t count = cmd->data.draw.count; + const GLfloat *verts = (GLfloat *) (((Uint8 *) vertices) + cmd->data.draw.first); /* SetDrawState handles glEnableClientState. */ - if (texture) { - data->glVertexPointer(2, GL_FLOAT, sizeof(float) * 5, verts + 0); - data->glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(float) * 5, verts + 2); - data->glTexCoordPointer(2, GL_FLOAT, sizeof(float) * 5, verts + 3); + data->glVertexPointer(2, GL_FLOAT, sizeof(float) * 2, verts); + + if (count > 2) { + /* joined lines cannot be grouped */ + data->glDrawArrays(GL_LINE_STRIP, 0, (GLsizei)count); } else { - data->glVertexPointer(2, GL_FLOAT, sizeof(float) * 3, verts + 0); - data->glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(float) * 3, verts + 2); + /* let's group non joined lines */ + SDL_RenderCommand *finalcmd = cmd; + SDL_RenderCommand *nextcmd = cmd->next; + SDL_BlendMode thisblend = cmd->data.draw.blend; + + while (nextcmd != NULL) { + const SDL_RenderCommandType nextcmdtype = nextcmd->command; + if (nextcmdtype != SDL_RENDERCMD_DRAW_LINES) { + break; /* can't go any further on this draw call, different render command up next. */ + } else if (nextcmd->data.draw.count != 2) { + break; /* can't go any further on this draw call, those are joined lines */ + } else if (nextcmd->data.draw.blend != thisblend) { + break; /* can't go any further on this draw call, different blendmode copy up next. */ + } else { + finalcmd = nextcmd; /* we can combine copy operations here. Mark this one as the furthest okay command. */ + count += nextcmd->data.draw.count; + } + nextcmd = nextcmd->next; + } + + data->glDrawArrays(GL_LINES, 0, (GLsizei)count); + cmd = finalcmd; /* skip any copy commands we just combined in here. */ } - - data->glDrawArrays(GL_TRIANGLES, 0, (GLsizei) count); - - /* Restore previously set color when we're done. */ - data->glColor4ub(r, g, b, a); } break; - } + } + case SDL_RENDERCMD_DRAW_POINTS: + case SDL_RENDERCMD_GEOMETRY: { + /* as long as we have the same copy command in a row, with the + same texture, we can combine them all into a single draw call. */ + SDL_Texture *thistexture = cmd->data.draw.texture; + SDL_BlendMode thisblend = cmd->data.draw.blend; + const SDL_RenderCommandType thiscmdtype = cmd->command; + SDL_RenderCommand *finalcmd = cmd; + SDL_RenderCommand *nextcmd = cmd->next; + size_t count = cmd->data.draw.count; + int ret; + while (nextcmd != NULL) { + const SDL_RenderCommandType nextcmdtype = nextcmd->command; + if (nextcmdtype != thiscmdtype) { + break; /* can't go any further on this draw call, different render command up next. */ + } else if (nextcmd->data.draw.texture != thistexture || nextcmd->data.draw.blend != thisblend) { + break; /* can't go any further on this draw call, different texture/blendmode copy up next. */ + } else { + finalcmd = nextcmd; /* we can combine copy operations here. Mark this one as the furthest okay command. */ + count += nextcmd->data.draw.count; + } + nextcmd = nextcmd->next; + } + + if (thistexture) { + ret = SetCopyState(data, cmd); + } else { + ret = SetDrawState(data, cmd, SHADER_SOLID); + } + + if (ret == 0) { + const GLfloat *verts = (GLfloat *) (((Uint8 *) vertices) + cmd->data.draw.first); + int op = GL_TRIANGLES; /* SDL_RENDERCMD_GEOMETRY */ + if (thiscmdtype == SDL_RENDERCMD_DRAW_POINTS) { + op = GL_POINTS; + } + + if (thiscmdtype == SDL_RENDERCMD_DRAW_POINTS) { + /* SetDrawState handles glEnableClientState. */ + data->glVertexPointer(2, GL_FLOAT, sizeof(float) * 2, verts); + } else { + /* SetDrawState handles glEnableClientState. */ + if (thistexture) { + data->glVertexPointer(2, GL_FLOAT, sizeof(float) * 5, verts + 0); + data->glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(float) * 5, verts + 2); + data->glTexCoordPointer(2, GL_FLOAT, sizeof(float) * 5, verts + 3); + } else { + data->glVertexPointer(2, GL_FLOAT, sizeof(float) * 3, verts + 0); + data->glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(float) * 3, verts + 2); + } + } + + data->glDrawArrays(op, 0, (GLsizei) count); + + /* Restore previously set color when we're done. */ + if (thiscmdtype != SDL_RENDERCMD_DRAW_POINTS) { + Uint32 color = data->drawstate.color; + GLubyte a = (GLubyte)((color >> 24) & 0xFF); + GLubyte r = (GLubyte)((color >> 16) & 0xFF); + GLubyte g = (GLubyte)((color >> 8) & 0xFF); + GLubyte b = (GLubyte)((color >> 0) & 0xFF); + data->glColor4ub(r, g, b, a); + } + } + + cmd = finalcmd; /* skip any copy commands we just combined in here. */ + break; + } case SDL_RENDERCMD_NO_OP: break; @@ -1639,6 +1709,32 @@ GL_SetVSync(SDL_Renderer * renderer, const int vsync) return retval; } +static SDL_bool +GL_IsProbablyAccelerated(const GL_RenderData *data) +{ + /*const char *vendor = (const char *) data->glGetString(GL_VENDOR);*/ + const char *renderer = (const char *) data->glGetString(GL_RENDERER); + +#if defined(__WINDOWS__) || defined(__WINGDK__) + if (SDL_strcmp(renderer, "GDI Generic") == 0) { + return SDL_FALSE; /* Microsoft's fallback software renderer. Fix your system! */ + } +#endif + +#ifdef __APPLE__ + if (SDL_strcmp(renderer, "Apple Software Renderer") == 0) { + return SDL_FALSE; /* (a probably very old) Apple software-based OpenGL. */ + } +#endif + + if (SDL_strcmp(renderer, "Software Rasterizer") == 0) { + return SDL_FALSE; /* (a probably very old) Software Mesa, or some other generic thing. */ + } + + /* !!! FIXME: swrast? llvmpipe? softpipe? */ + + return SDL_TRUE; +} static SDL_Renderer * GL_CreateRenderer(SDL_Window * window, Uint32 flags) @@ -1649,11 +1745,14 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) Uint32 window_flags; int profile_mask = 0, major = 0, minor = 0; SDL_bool changed_window = SDL_FALSE; + const char *hint; + SDL_bool non_power_of_two_supported = SDL_FALSE; SDL_GL_GetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, &profile_mask); SDL_GL_GetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, &major); SDL_GL_GetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, &minor); +#ifndef SDL_VIDEO_VITA_PVR_OGL window_flags = SDL_GetWindowFlags(window); if (!(window_flags & SDL_WINDOW_OPENGL) || profile_mask == SDL_GL_CONTEXT_PROFILE_ES || major != RENDERER_CONTEXT_MAJOR || minor != RENDERER_CONTEXT_MINOR) { @@ -1667,6 +1766,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) goto error; } } +#endif renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer)); if (!renderer) { @@ -1681,6 +1781,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) goto error; } + renderer->WindowEvent = GL_WindowEvent; renderer->GetOutputSize = GL_GetOutputSize; renderer->SupportsBlendMode = GL_SupportsBlendMode; renderer->CreateTexture = GL_CreateTexture; @@ -1707,7 +1808,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->GL_BindTexture = GL_BindTexture; renderer->GL_UnbindTexture = GL_UnbindTexture; renderer->info = GL_RenderDriver.info; - renderer->info.flags = SDL_RENDERER_ACCELERATED; + renderer->info.flags = 0; /* will set some flags below. */ renderer->driverdata = data; renderer->window = window; @@ -1731,6 +1832,10 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) goto error; } + if (GL_IsProbablyAccelerated(data)) { + renderer->info.flags |= SDL_RENDERER_ACCELERATED; + } + #ifdef __MACOSX__ /* Enable multi-threaded rendering */ /* Disabled until Ryan finishes his VBO/PBO code... @@ -1764,15 +1869,37 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) data->glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB); } + hint = SDL_getenv("GL_ARB_texture_non_power_of_two"); + if (!hint || *hint != '0') { + SDL_bool isGL2 = SDL_FALSE; + const char *verstr = (const char *)data->glGetString(GL_VERSION); + if (verstr) { + char verbuf[16]; + char *ptr; + SDL_strlcpy(verbuf, verstr, sizeof (verbuf)); + ptr = SDL_strchr(verbuf, '.'); + if (ptr) { + *ptr = '\0'; + if (SDL_atoi(verbuf) >= 2) { + isGL2 = SDL_TRUE; + } + } + } + if (isGL2 || SDL_GL_ExtensionSupported("GL_ARB_texture_non_power_of_two")) { + non_power_of_two_supported = SDL_TRUE; + } + } + data->textype = GL_TEXTURE_2D; - if (SDL_GL_ExtensionSupported("GL_ARB_texture_non_power_of_two")) { + if (non_power_of_two_supported) { data->GL_ARB_texture_non_power_of_two_supported = SDL_TRUE; + data->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value); + renderer->info.max_texture_width = value; + renderer->info.max_texture_height = value; } else if (SDL_GL_ExtensionSupported("GL_ARB_texture_rectangle") || SDL_GL_ExtensionSupported("GL_EXT_texture_rectangle")) { data->GL_ARB_texture_rectangle_supported = SDL_TRUE; data->textype = GL_TEXTURE_RECTANGLE_ARB; - } - if (data->GL_ARB_texture_rectangle_supported) { data->glGetIntegerv(GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB, &value); renderer->info.max_texture_width = value; renderer->info.max_texture_height = value; @@ -1797,7 +1924,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) } SDL_LogInfo(SDL_LOG_CATEGORY_RENDER, "OpenGL shaders: %s", data->shaders ? "ENABLED" : "DISABLED"); - +#if SDL_HAVE_YUV /* We support YV12 textures using 3 textures and a shader */ if (data->shaders && data->num_texture_units >= 3) { renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_YV12; @@ -1805,7 +1932,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV12; renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV21; } - +#endif #ifdef __MACOSX__ renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_UYVY; #endif diff --git a/libs/SDL2/src/render/opengl/SDL_shaders_gl.c b/libs/SDL2/src/render/opengl/SDL_shaders_gl.c index b4f7aa39..4db08355 100644 --- a/libs/SDL2/src/render/opengl/SDL_shaders_gl.c +++ b/libs/SDL2/src/render/opengl/SDL_shaders_gl.c @@ -284,7 +284,7 @@ static const char *shader_source[NUM_SHADERS][2] = " gl_FragColor = texture2D(tex0, v_texCoord) * v_color;\n" "}" }, - +#if SDL_HAVE_YUV /* SHADER_YUV_JPEG */ { /* vertex shader */ @@ -384,6 +384,7 @@ static const char *shader_source[NUM_SHADERS][2] = BT709_SHADER_CONSTANTS NV21_SHADER_BODY }, +#endif /* SDL_HAVE_YUV */ }; static SDL_bool diff --git a/libs/SDL2/src/render/opengl/SDL_shaders_gl.h b/libs/SDL2/src/render/opengl/SDL_shaders_gl.h index 56382b4b..d3e6c398 100644 --- a/libs/SDL2/src/render/opengl/SDL_shaders_gl.h +++ b/libs/SDL2/src/render/opengl/SDL_shaders_gl.h @@ -32,6 +32,7 @@ typedef enum { SHADER_SOLID, SHADER_RGB, SHADER_RGBA, +#if SDL_HAVE_YUV SHADER_YUV_JPEG, SHADER_YUV_BT601, SHADER_YUV_BT709, @@ -43,6 +44,7 @@ typedef enum { SHADER_NV21_JPEG, SHADER_NV21_BT601, SHADER_NV21_BT709, +#endif NUM_SHADERS } GL_Shader; diff --git a/libs/SDL2/src/render/opengles/SDL_render_gles.c b/libs/SDL2/src/render/opengles/SDL_render_gles.c index a6b58f2d..9afd8d1a 100644 --- a/libs/SDL2/src/render/opengles/SDL_render_gles.c +++ b/libs/SDL2/src/render/opengles/SDL_render_gles.c @@ -796,8 +796,8 @@ GLES_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vert 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 +809,8 @@ GLES_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vert 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 --git a/libs/SDL2/src/render/opengles2/SDL_render_gles2.c b/libs/SDL2/src/render/opengles2/SDL_render_gles2.c index 2df9d546..112c1e8a 100644 --- a/libs/SDL2/src/render/opengles2/SDL_render_gles2.c +++ b/libs/SDL2/src/render/opengles2/SDL_render_gles2.c @@ -31,7 +31,8 @@ /* WebGL doesn't offer client-side arrays, so use Vertex Buffer Objects on Emscripten, which converts GLES2 into WebGL calls. In all other cases, attempt to use client-side arrays, as they tend to - be faster. */ + be dramatically faster when not batching, and about the same when + we are. */ #if defined(__EMSCRIPTEN__) #define USE_VERTEX_BUFFER_OBJECTS 1 #else @@ -560,6 +561,7 @@ GLES2_SelectProgram(GLES2_RenderData *data, GLES2_ImageSource source, int w, int case GLES2_IMAGESOURCE_TEXTURE_BGR: ftype = GLES2_SHADER_FRAGMENT_TEXTURE_BGR; break; +#if SDL_HAVE_YUV case GLES2_IMAGESOURCE_TEXTURE_YUV: switch (SDL_GetYUVConversionModeForResolution(w, h)) { case SDL_YUV_CONVERSION_JPEG: @@ -616,6 +618,7 @@ GLES2_SelectProgram(GLES2_RenderData *data, GLES2_ImageSource source, int w, int goto fault; } break; +#endif /* SDL_HAVE_YUV */ case GLES2_IMAGESOURCE_TEXTURE_EXTERNAL_OES: ftype = GLES2_SHADER_FRAGMENT_TEXTURE_EXTERNAL_OES; break; @@ -897,39 +900,14 @@ SetDrawState(GLES2_RenderData *data, const SDL_RenderCommand *cmd, const GLES2_I data->drawstate.cliprect_dirty = SDL_FALSE; } - if (texture != data->drawstate.texture) { - if ((texture != NULL) != data->drawstate.texturing) { - if (texture == NULL) { - data->glDisableVertexAttribArray((GLenum) GLES2_ATTRIBUTE_TEXCOORD); - data->drawstate.texturing = SDL_FALSE; - } else { - data->glEnableVertexAttribArray((GLenum) GLES2_ATTRIBUTE_TEXCOORD); - data->drawstate.texturing = SDL_TRUE; - } + if ((texture != NULL) != data->drawstate.texturing) { + if (texture == NULL) { + data->glDisableVertexAttribArray((GLenum) GLES2_ATTRIBUTE_TEXCOORD); + data->drawstate.texturing = SDL_FALSE; + } else { + data->glEnableVertexAttribArray((GLenum) GLES2_ATTRIBUTE_TEXCOORD); + data->drawstate.texturing = SDL_TRUE; } - - if (texture) { - GLES2_TextureData *tdata = (GLES2_TextureData *) texture->driverdata; -#if SDL_HAVE_YUV - if (tdata->yuv) { - data->glActiveTexture(GL_TEXTURE2); - data->glBindTexture(tdata->texture_type, tdata->texture_v); - - data->glActiveTexture(GL_TEXTURE1); - data->glBindTexture(tdata->texture_type, tdata->texture_u); - - data->glActiveTexture(GL_TEXTURE0); - } else if (tdata->nv12) { - data->glActiveTexture(GL_TEXTURE1); - data->glBindTexture(tdata->texture_type, tdata->texture_u); - - data->glActiveTexture(GL_TEXTURE0); - } -#endif - data->glBindTexture(tdata->texture_type, tdata->texture); - } - - data->drawstate.texture = texture; } if (texture) { @@ -987,6 +965,7 @@ SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, void *vertice GLES2_RenderData *data = (GLES2_RenderData *) renderer->driverdata; GLES2_ImageSource sourceType = GLES2_IMAGESOURCE_TEXTURE_ABGR; SDL_Texture *texture = cmd->data.draw.texture; + int ret; /* Pick an appropriate shader */ if (renderer->target) { @@ -1041,6 +1020,7 @@ SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, void *vertice break; } break; +#if SDL_HAVE_YUV case SDL_PIXELFORMAT_IYUV: case SDL_PIXELFORMAT_YV12: sourceType = GLES2_IMAGESOURCE_TEXTURE_YUV; @@ -1051,6 +1031,7 @@ SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, void *vertice case SDL_PIXELFORMAT_NV21: sourceType = GLES2_IMAGESOURCE_TEXTURE_NV21; break; +#endif case SDL_PIXELFORMAT_EXTERNAL_OES: sourceType = GLES2_IMAGESOURCE_TEXTURE_EXTERNAL_OES; break; @@ -1074,6 +1055,7 @@ SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, void *vertice case SDL_PIXELFORMAT_BGR888: sourceType = GLES2_IMAGESOURCE_TEXTURE_BGR; break; +#if SDL_HAVE_YUV case SDL_PIXELFORMAT_IYUV: case SDL_PIXELFORMAT_YV12: sourceType = GLES2_IMAGESOURCE_TEXTURE_YUV; @@ -1084,6 +1066,7 @@ SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, void *vertice case SDL_PIXELFORMAT_NV21: sourceType = GLES2_IMAGESOURCE_TEXTURE_NV21; break; +#endif case SDL_PIXELFORMAT_EXTERNAL_OES: sourceType = GLES2_IMAGESOURCE_TEXTURE_EXTERNAL_OES; break; @@ -1092,7 +1075,31 @@ SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, void *vertice } } - return SetDrawState(data, cmd, sourceType, vertices); + ret = SetDrawState(data, cmd, sourceType, vertices); + + if (texture != data->drawstate.texture) { + GLES2_TextureData *tdata = (GLES2_TextureData *) texture->driverdata; +#if SDL_HAVE_YUV + if (tdata->yuv) { + data->glActiveTexture(GL_TEXTURE2); + data->glBindTexture(tdata->texture_type, tdata->texture_v); + + data->glActiveTexture(GL_TEXTURE1); + data->glBindTexture(tdata->texture_type, tdata->texture_u); + + data->glActiveTexture(GL_TEXTURE0); + } else if (tdata->nv12) { + data->glActiveTexture(GL_TEXTURE1); + data->glBindTexture(tdata->texture_type, tdata->texture_u); + + data->glActiveTexture(GL_TEXTURE0); + } +#endif + data->glBindTexture(tdata->texture_type, tdata->texture); + data->drawstate.texture = texture; + } + + return ret; } static int @@ -1148,8 +1155,8 @@ GLES2_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *ver 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; @@ -1162,8 +1169,8 @@ GLES2_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *ver 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; @@ -1363,6 +1370,7 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) format = GL_RGBA; type = GL_UNSIGNED_BYTE; break; +#if SDL_HAVE_YUV case SDL_PIXELFORMAT_IYUV: case SDL_PIXELFORMAT_YV12: case SDL_PIXELFORMAT_NV12: @@ -1370,6 +1378,7 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) format = GL_LUMINANCE; type = GL_UNSIGNED_BYTE; break; +#endif #ifdef GL_TEXTURE_EXTERNAL_OES case SDL_PIXELFORMAT_EXTERNAL_OES: format = GL_NONE; @@ -2128,11 +2137,12 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags) renderer->SetVSync = GLES2_SetVSync; renderer->GL_BindTexture = GLES2_BindTexture; renderer->GL_UnbindTexture = GLES2_UnbindTexture; - +#if SDL_HAVE_YUV renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_YV12; renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_IYUV; renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV12; renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV21; +#endif #ifdef GL_TEXTURE_EXTERNAL_OES renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_EXTERNAL_OES; #endif @@ -2188,3 +2198,4 @@ SDL_RenderDriver GLES2_RenderDriver = { #endif /* SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED */ /* vi: set ts=4 sw=4 expandtab: */ + diff --git a/libs/SDL2/src/render/opengles2/SDL_shaders_gles2.c b/libs/SDL2/src/render/opengles2/SDL_shaders_gles2.c index 49b2a360..a1f78fdd 100644 --- a/libs/SDL2/src/render/opengles2/SDL_shaders_gles2.c +++ b/libs/SDL2/src/render/opengles2/SDL_shaders_gles2.c @@ -121,6 +121,8 @@ static const Uint8 GLES2_Fragment_TextureBGR[] = " \ } \ "; +#if SDL_HAVE_YUV + #define JPEG_SHADER_CONSTANTS \ "// YUV offset \n" \ "const vec3 offset = vec3(0, -0.501960814, -0.501960814);\n" \ @@ -299,6 +301,7 @@ static const Uint8 GLES2_Fragment_TextureNV21BT709[] = \ BT709_SHADER_CONSTANTS \ NV21_SHADER_BODY \ ; +#endif /* Custom Android video format texture */ static const Uint8 GLES2_Fragment_TextureExternalOES[] = " \ @@ -335,6 +338,7 @@ const Uint8 *GLES2_GetShader(GLES2_ShaderType type) return GLES2_Fragment_TextureRGB; case GLES2_SHADER_FRAGMENT_TEXTURE_BGR: return GLES2_Fragment_TextureBGR; +#if SDL_HAVE_YUV case GLES2_SHADER_FRAGMENT_TEXTURE_YUV_JPEG: return GLES2_Fragment_TextureYUVJPEG; case GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT601: @@ -357,6 +361,7 @@ const Uint8 *GLES2_GetShader(GLES2_ShaderType type) return GLES2_Fragment_TextureNV21BT601; case GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT709: return GLES2_Fragment_TextureNV21BT709; +#endif case GLES2_SHADER_FRAGMENT_TEXTURE_EXTERNAL_OES: return GLES2_Fragment_TextureExternalOES; default: diff --git a/libs/SDL2/src/render/opengles2/SDL_shaders_gles2.h b/libs/SDL2/src/render/opengles2/SDL_shaders_gles2.h index 32c4309c..09780239 100644 --- a/libs/SDL2/src/render/opengles2/SDL_shaders_gles2.h +++ b/libs/SDL2/src/render/opengles2/SDL_shaders_gles2.h @@ -34,6 +34,7 @@ typedef enum GLES2_SHADER_FRAGMENT_TEXTURE_ARGB, GLES2_SHADER_FRAGMENT_TEXTURE_BGR, GLES2_SHADER_FRAGMENT_TEXTURE_RGB, +#if SDL_HAVE_YUV GLES2_SHADER_FRAGMENT_TEXTURE_YUV_JPEG, GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT601, GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT709, @@ -45,6 +46,7 @@ typedef enum GLES2_SHADER_FRAGMENT_TEXTURE_NV21_JPEG, GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT601, GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT709, +#endif GLES2_SHADER_FRAGMENT_TEXTURE_EXTERNAL_OES, GLES2_SHADER_COUNT } GLES2_ShaderType; diff --git a/libs/SDL2/src/render/psp/SDL_render_psp.c b/libs/SDL2/src/render/psp/SDL_render_psp.c index 9431b929..cdc0b915 100644 --- a/libs/SDL2/src/render/psp/SDL_render_psp.c +++ b/libs/SDL2/src/render/psp/SDL_render_psp.c @@ -442,8 +442,8 @@ TextureSpillLRU(PSP_RenderData* data, size_t wanted) { } LRUTargetRemove(data, lru); } else { - SDL_SetError("Could not spill more VRAM to system memory. VRAM : %dKB,(%dKB), wanted %dKB", vmemavail()/1024, vlargestblock()/1024, wanted/1024); - return -1; //Asked to spill but there nothing to spill + // Asked to spill but there nothing to spill + return SDL_SetError("Could not spill more VRAM to system memory. VRAM : %dKB,(%dKB), wanted %dKB", vmemavail()/1024, vlargestblock()/1024, wanted/1024); } return 0; } @@ -556,7 +556,8 @@ static int TextureShouldSwizzle(PSP_TextureData* psp_texture, SDL_Texture *texture) { return !((texture->access == SDL_TEXTUREACCESS_TARGET) && InVram(psp_texture->data)) - && (texture->w >= 16 || texture->h >= 16); + && texture->access != SDL_TEXTUREACCESS_STREAMING + && (texture->w >= 16 || texture->h >= 16); } static void @@ -774,14 +775,13 @@ PSP_QueueFillRects(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FR cmd->data.draw.count = count; for (i = 0; i < count; i++, rects++) { - const SDL_FRect *rect = &rects[i]; - verts->x = rect->x; - verts->y = rect->y; + verts->x = rects->x; + verts->y = rects->y; verts->z = 0.0f; verts++; - verts->x = rect->x + rect->w; - verts->y = rect->y + rect->h; + verts->x = rects->x + rects->w + 0.5f; + verts->y = rects->y + rects->h + 0.5f; verts->z = 0.0f; verts++; } @@ -881,7 +881,7 @@ PSP_QueueCopy(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * tex static int PSP_QueueCopyEx(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * texture, const SDL_Rect * srcrect, const SDL_FRect * dstrect, - const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip) + const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip, float scale_x, float scale_y) { VertTV *verts = (VertTV *) SDL_AllocateRenderVertices(renderer, 4 * sizeof (VertTV), 4, &cmd->data.draw.first); const float centerx = center->x; @@ -891,27 +891,29 @@ PSP_QueueCopyEx(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * t const float width = dstrect->w - centerx; const float height = dstrect->h - centery; float s, c; - float cw, sw, ch, sh; + float cw1, sw1, ch1, sh1, cw2, sw2, ch2, sh2; float u0 = srcrect->x; float v0 = srcrect->y; float u1 = srcrect->x + srcrect->w; float v1 = srcrect->y + srcrect->h; - - if (!verts) { return -1; } cmd->data.draw.count = 1; - MathSincos(degToRad(angle), &s, &c); + MathSincos(degToRad(360-angle), &s, &c); - cw = c * width; - sw = s * width; - ch = c * height; - sh = s * height; + cw1 = c * -centerx; + sw1 = s * -centerx; + ch1 = c * -centery; + sh1 = s * -centery; + cw2 = c * width; + sw2 = s * width; + ch2 = c * height; + sh2 = s * height; if (flip & SDL_FLIP_VERTICAL) { Swap(&v0, &v1); @@ -923,31 +925,44 @@ PSP_QueueCopyEx(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * t verts->u = u0; verts->v = v0; - verts->x = x - cw + sh; - verts->y = y - sw - ch; + verts->x = x + cw1 + sh1; + verts->y = y - sw1 + ch1; verts->z = 0; verts++; verts->u = u0; verts->v = v1; - verts->x = x - cw - sh; - verts->y = y - sw + ch; + verts->x = x + cw1 + sh2; + verts->y = y - sw1 + ch2; verts->z = 0; verts++; verts->u = u1; verts->v = v1; - verts->x = x + cw - sh; - verts->y = y + sw + ch; + verts->x = x + cw2 + sh2; + verts->y = y - sw2 + ch2; verts->z = 0; verts++; verts->u = u1; verts->v = v0; - verts->x = x + cw + sh; - verts->y = y + sw - ch; + verts->x = x + cw2 + sh1; + verts->y = y - sw2 + ch1; verts->z = 0; - verts++; + + if (scale_x != 1.0f || scale_y != 1.0f) { + verts->x *= scale_x; + verts->y *= scale_y; + verts--; + verts->x *= scale_x; + verts->y *= scale_y; + verts--; + verts->x *= scale_x; + verts->y *= scale_y; + verts--; + verts->x *= scale_x; + verts->y *= scale_y; + } return 0; } diff --git a/libs/SDL2/src/render/software/SDL_blendfillrect.c b/libs/SDL2/src/render/software/SDL_blendfillrect.c index 5f491265..569c1505 100644 --- a/libs/SDL2/src/render/software/SDL_blendfillrect.c +++ b/libs/SDL2/src/render/software/SDL_blendfillrect.c @@ -220,7 +220,7 @@ SDL_BlendFillRect(SDL_Surface * dst, const SDL_Rect * rect, SDL_Rect clipped; if (!dst) { - return SDL_SetError("Passed NULL destination surface"); + return SDL_InvalidParamError("SDL_BlendFillRect(): dst"); } /* This function doesn't work on surfaces < 8 bpp */ @@ -291,7 +291,7 @@ SDL_BlendFillRects(SDL_Surface * dst, const SDL_Rect * rects, int count, int status = 0; if (!dst) { - return SDL_SetError("Passed NULL destination surface"); + return SDL_InvalidParamError("SDL_BlendFillRects(): dst"); } /* This function doesn't work on surfaces < 8 bpp */ diff --git a/libs/SDL2/src/render/software/SDL_blendline.c b/libs/SDL2/src/render/software/SDL_blendline.c index c38c4425..4921bf10 100644 --- a/libs/SDL2/src/render/software/SDL_blendline.c +++ b/libs/SDL2/src/render/software/SDL_blendline.c @@ -809,7 +809,7 @@ SDL_BlendLine(SDL_Surface * dst, int x1, int y1, int x2, int y2, BlendLineFunc func; if (!dst) { - return SDL_SetError("SDL_BlendLine(): Passed NULL destination surface"); + return SDL_InvalidParamError("SDL_BlendLine(): dst"); } func = SDL_CalculateBlendLineFunc(dst->format); diff --git a/libs/SDL2/src/render/software/SDL_blendpoint.c b/libs/SDL2/src/render/software/SDL_blendpoint.c index d5b662cc..613169b7 100644 --- a/libs/SDL2/src/render/software/SDL_blendpoint.c +++ b/libs/SDL2/src/render/software/SDL_blendpoint.c @@ -218,7 +218,7 @@ SDL_BlendPoint(SDL_Surface * dst, int x, int y, SDL_BlendMode blendMode, Uint8 r Uint8 g, Uint8 b, Uint8 a) { if (!dst) { - return SDL_SetError("Passed NULL destination surface"); + return SDL_InvalidParamError("SDL_BlendPoint(): dst"); } /* This function doesn't work on surfaces < 8 bpp */ @@ -287,7 +287,7 @@ SDL_BlendPoints(SDL_Surface * dst, const SDL_Point * points, int count, int status = 0; if (!dst) { - return SDL_SetError("Passed NULL destination surface"); + return SDL_InvalidParamError("SDL_BlendPoints(): dst"); } /* This function doesn't work on surfaces < 8 bpp */ diff --git a/libs/SDL2/src/render/software/SDL_drawline.c b/libs/SDL2/src/render/software/SDL_drawline.c index 8dbd3d21..e309f161 100644 --- a/libs/SDL2/src/render/software/SDL_drawline.c +++ b/libs/SDL2/src/render/software/SDL_drawline.c @@ -144,7 +144,7 @@ SDL_DrawLine(SDL_Surface * dst, int x1, int y1, int x2, int y2, Uint32 color) DrawLineFunc func; if (!dst) { - return SDL_SetError("SDL_DrawLine(): Passed NULL destination surface"); + return SDL_InvalidParamError("SDL_DrawLine(): dst"); } func = SDL_CalculateDrawLineFunc(dst->format); @@ -173,7 +173,7 @@ SDL_DrawLines(SDL_Surface * dst, const SDL_Point * points, int count, DrawLineFunc func; if (!dst) { - return SDL_SetError("SDL_DrawLines(): Passed NULL destination surface"); + return SDL_InvalidParamError("SDL_DrawLines(): dst"); } func = SDL_CalculateDrawLineFunc(dst->format); diff --git a/libs/SDL2/src/render/software/SDL_drawpoint.c b/libs/SDL2/src/render/software/SDL_drawpoint.c index 999f015c..b99838ac 100644 --- a/libs/SDL2/src/render/software/SDL_drawpoint.c +++ b/libs/SDL2/src/render/software/SDL_drawpoint.c @@ -30,7 +30,7 @@ int SDL_DrawPoint(SDL_Surface * dst, int x, int y, Uint32 color) { if (!dst) { - return SDL_SetError("Passed NULL destination surface"); + return SDL_InvalidParamError("SDL_DrawPoint(): dst"); } /* This function doesn't work on surfaces < 8 bpp */ @@ -71,7 +71,7 @@ SDL_DrawPoints(SDL_Surface * dst, const SDL_Point * points, int count, int x, y; if (!dst) { - return SDL_SetError("Passed NULL destination surface"); + return SDL_InvalidParamError("SDL_DrawPoints(): dst"); } /* This function doesn't work on surfaces < 8 bpp */ diff --git a/libs/SDL2/src/render/software/SDL_render_sw.c b/libs/SDL2/src/render/software/SDL_render_sw.c index 7a2aac29..34092b58 100644 --- a/libs/SDL2/src/render/software/SDL_render_sw.c +++ b/libs/SDL2/src/render/software/SDL_render_sw.c @@ -99,8 +99,7 @@ SW_GetOutputSize(SDL_Renderer * renderer, int *w, int *h) return 0; } - SDL_SetError("Software renderer doesn't have an output surface"); - return -1; + return SDL_SetError("Software renderer doesn't have an output surface"); } static int @@ -256,7 +255,7 @@ SW_QueueCopy(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * text cmd->data.draw.count = 1; - SDL_memcpy(verts, srcrect, sizeof (SDL_Rect)); + SDL_copyp(verts, srcrect); verts++; verts->x = (int)dstrect->x; @@ -274,12 +273,14 @@ typedef struct CopyExData double angle; SDL_FPoint center; SDL_RendererFlip flip; + float scale_x; + float scale_y; } CopyExData; static int SW_QueueCopyEx(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * texture, const SDL_Rect * srcrect, const SDL_FRect * dstrect, - const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip) + const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip, float scale_x, float scale_y) { CopyExData *verts = (CopyExData *) SDL_AllocateRenderVertices(renderer, sizeof (CopyExData), 0, &cmd->data.draw.first); @@ -289,30 +290,50 @@ SW_QueueCopyEx(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * te 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; return 0; } +static int +Blit_to_Screen(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *surface, SDL_Rect *dstrect, + float scale_x, float scale_y, SDL_ScaleMode scaleMode) +{ + int retval; + /* Renderer scaling, if needed */ + if (scale_x != 1.0f || scale_y != 1.0f) { + SDL_Rect r; + r.x = (int)((float) dstrect->x * scale_x); + r.y = (int)((float) dstrect->y * scale_y); + r.w = (int)((float) dstrect->w * scale_x); + r.h = (int)((float) dstrect->h * scale_y); + retval = SDL_PrivateUpperBlitScaled(src, srcrect, surface, &r, scaleMode); + } else { + retval = SDL_BlitSurface(src, srcrect, surface, dstrect); + } + return retval; +} + static int SW_RenderCopyEx(SDL_Renderer * renderer, SDL_Surface *surface, SDL_Texture * texture, const SDL_Rect * srcrect, const SDL_Rect * final_rect, - const double angle, const SDL_FPoint * center, const SDL_RendererFlip flip) + const double angle, const SDL_FPoint * center, const SDL_RendererFlip flip, float scale_x, float scale_y) { SDL_Surface *src = (SDL_Surface *) texture->driverdata; SDL_Rect tmp_rect; SDL_Surface *src_clone, *src_rotated, *src_scaled; SDL_Surface *mask = NULL, *mask_rotated = NULL; - int retval = 0, dstwidth, dstheight, abscenterx, abscentery; - double cangle, sangle, px, py, p1x, p1y, p2x, p2y, p3x, p3y, p4x, p4y; + int retval = 0; SDL_BlendMode blendmode; Uint8 alphaMod, rMod, gMod, bMod; int applyModulation = SDL_FALSE; @@ -414,53 +435,32 @@ SW_RenderCopyEx(SDL_Renderer * renderer, SDL_Surface *surface, SDL_Texture * tex SDL_SetSurfaceBlendMode(src_clone, blendmode); if (!retval) { - SDLgfx_rotozoomSurfaceSizeTrig(tmp_rect.w, tmp_rect.h, angle, &dstwidth, &dstheight, &cangle, &sangle); - src_rotated = SDLgfx_rotateSurface(src_clone, angle, dstwidth/2, dstheight/2, (texture->scaleMode == SDL_ScaleModeNearest) ? 0 : 1, flip & SDL_FLIP_HORIZONTAL, flip & SDL_FLIP_VERTICAL, dstwidth, dstheight, cangle, sangle); + SDL_Rect rect_dest; + double cangle, sangle; + + SDLgfx_rotozoomSurfaceSizeTrig(tmp_rect.w, tmp_rect.h, angle, center, + &rect_dest, &cangle, &sangle); + src_rotated = SDLgfx_rotateSurface(src_clone, angle, + (texture->scaleMode == SDL_ScaleModeNearest) ? 0 : 1, flip & SDL_FLIP_HORIZONTAL, flip & SDL_FLIP_VERTICAL, + &rect_dest, cangle, sangle, center); if (src_rotated == NULL) { retval = -1; } if (!retval && mask != NULL) { /* The mask needed for the NONE blend mode gets rotated with the same parameters. */ - mask_rotated = SDLgfx_rotateSurface(mask, angle, dstwidth/2, dstheight/2, SDL_FALSE, 0, 0, dstwidth, dstheight, cangle, sangle); + mask_rotated = SDLgfx_rotateSurface(mask, angle, + SDL_FALSE, 0, 0, + &rect_dest, cangle, sangle, center); if (mask_rotated == NULL) { retval = -1; } } if (!retval) { - /* Find out where the new origin is by rotating the four final_rect points around the center and then taking the extremes */ - abscenterx = final_rect->x + (int)center->x; - abscentery = final_rect->y + (int)center->y; - /* Compensate the angle inversion to match the behaviour of the other backends */ - sangle = -sangle; - /* Top Left */ - px = final_rect->x - abscenterx; - py = final_rect->y - abscentery; - p1x = px * cangle - py * sangle + abscenterx; - p1y = px * sangle + py * cangle + abscentery; - - /* Top Right */ - px = final_rect->x + final_rect->w - abscenterx; - py = final_rect->y - abscentery; - p2x = px * cangle - py * sangle + abscenterx; - p2y = px * sangle + py * cangle + abscentery; - - /* Bottom Left */ - px = final_rect->x - abscenterx; - py = final_rect->y + final_rect->h - abscentery; - p3x = px * cangle - py * sangle + abscenterx; - p3y = px * sangle + py * cangle + abscentery; - - /* Bottom Right */ - px = final_rect->x + final_rect->w - abscenterx; - py = final_rect->y + final_rect->h - abscentery; - p4x = px * cangle - py * sangle + abscenterx; - p4y = px * sangle + py * cangle + abscentery; - - tmp_rect.x = (int)MIN(MIN(p1x, p2x), MIN(p3x, p4x)); - tmp_rect.y = (int)MIN(MIN(p1y, p2y), MIN(p3y, p4y)); - tmp_rect.w = dstwidth; - tmp_rect.h = dstheight; + tmp_rect.x = final_rect->x + rect_dest.x; + tmp_rect.y = final_rect->y + rect_dest.y; + tmp_rect.w = rect_dest.w; + tmp_rect.h = rect_dest.h; /* The NONE blend mode needs some special care with non-opaque surfaces. * Other blend modes or opaque surfaces can be blitted directly. @@ -471,7 +471,8 @@ SW_RenderCopyEx(SDL_Renderer * renderer, SDL_Surface *surface, SDL_Texture * tex SDL_SetSurfaceAlphaMod(src_rotated, alphaMod); SDL_SetSurfaceColorMod(src_rotated, rMod, gMod, bMod); } - retval = SDL_BlitSurface(src_rotated, NULL, surface, &tmp_rect); + /* Renderer scaling, if needed */ + retval = Blit_to_Screen(src_rotated, NULL, surface, &tmp_rect, scale_x, scale_y, texture->scaleMode); } else { /* The NONE blend mode requires three steps to get the pixels onto the destination surface. * First, the area where the rotated pixels will be blitted to get set to zero. @@ -480,7 +481,8 @@ SW_RenderCopyEx(SDL_Renderer * renderer, SDL_Surface *surface, SDL_Texture * tex */ SDL_Rect mask_rect = tmp_rect; SDL_SetSurfaceBlendMode(mask_rotated, SDL_BLENDMODE_NONE); - retval = SDL_BlitSurface(mask_rotated, NULL, surface, &mask_rect); + /* Renderer scaling, if needed */ + retval = Blit_to_Screen(mask_rotated, NULL, surface, &mask_rect, scale_x, scale_y, texture->scaleMode); if (!retval) { /* The next step copies the alpha value. This is done with the BLEND blend mode and * by modulating the source colors with 0. Since the destination is all zeros, this @@ -488,7 +490,8 @@ SW_RenderCopyEx(SDL_Renderer * renderer, SDL_Surface *surface, SDL_Texture * tex */ SDL_SetSurfaceColorMod(src_rotated, 0, 0, 0); mask_rect = tmp_rect; - retval = SDL_BlitSurface(src_rotated, NULL, surface, &mask_rect); + /* Renderer scaling, if needed */ + retval = Blit_to_Screen(src_rotated, NULL, surface, &mask_rect, scale_x, scale_y, texture->scaleMode); if (!retval) { /* The last step gets the color values in place. The ADD blend mode simply adds them to * the destination (where the color values are all zero). However, because the ADD blend @@ -504,7 +507,8 @@ SW_RenderCopyEx(SDL_Renderer * renderer, SDL_Surface *surface, SDL_Texture * tex retval = -1; } else { SDL_SetSurfaceBlendMode(src_rotated_rgb, SDL_BLENDMODE_ADD); - retval = SDL_BlitSurface(src_rotated_rgb, NULL, surface, &tmp_rect); + /* Renderer scaling, if needed */ + retval = Blit_to_Screen(src_rotated_rgb, NULL, surface, &tmp_rect, scale_x, scale_y, texture->scaleMode); SDL_FreeSurface(src_rotated_rgb); } } @@ -823,7 +827,42 @@ SW_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic * to avoid potentially frequent RLE encoding/decoding. */ SDL_SetSurfaceRLE(surface, 0); - SDL_PrivateUpperBlitScaled(src, srcrect, surface, dstrect, texture->scaleMode); + + /* Prevent to do scaling + clipping on viewport boundaries as it may lose proportion */ + if (dstrect->x < 0 || dstrect->y < 0 || dstrect->x + dstrect->w > surface->w || dstrect->y + dstrect->h > surface->h) { + SDL_Surface *tmp = SDL_CreateRGBSurfaceWithFormat(0, dstrect->w, dstrect->h, 0, src->format->format); + /* Scale to an intermediate surface, then blit */ + if (tmp) { + SDL_Rect r; + SDL_BlendMode blendmode; + Uint8 alphaMod, rMod, gMod, bMod; + + SDL_GetSurfaceBlendMode(src, &blendmode); + SDL_GetSurfaceAlphaMod(src, &alphaMod); + SDL_GetSurfaceColorMod(src, &rMod, &gMod, &bMod); + + r.x = 0; + r.y = 0; + r.w = dstrect->w; + r.h = dstrect->h; + + SDL_SetSurfaceBlendMode(src, SDL_BLENDMODE_NONE); + SDL_SetSurfaceColorMod(src, 255, 255, 255); + SDL_SetSurfaceAlphaMod(src, 255); + + SDL_PrivateUpperBlitScaled(src, srcrect, tmp, &r, texture->scaleMode); + + SDL_SetSurfaceColorMod(tmp, rMod, gMod, bMod); + SDL_SetSurfaceAlphaMod(tmp, alphaMod); + SDL_SetSurfaceBlendMode(tmp, blendmode); + + SDL_BlitSurface(tmp, NULL, surface, dstrect); + SDL_FreeSurface(tmp); + /* No need to set back r/g/b/a/blendmode to 'src' since it's done in PrepTextureForCopy() */ + } + } else{ + SDL_PrivateUpperBlitScaled(src, srcrect, surface, dstrect, texture->scaleMode); + } } break; } @@ -840,7 +879,8 @@ SW_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic } SW_RenderCopyEx(renderer, surface, cmd->data.draw.texture, ©data->srcrect, - ©data->dstrect, copydata->angle, ©data->center, copydata->flip); + ©data->dstrect, copydata->angle, ©data->center, copydata->flip, + copydata->scale_x, copydata->scale_y); break; } @@ -977,7 +1017,7 @@ SW_CreateRendererForSurface(SDL_Surface * surface) SW_RenderData *data; if (!surface) { - SDL_SetError("Can't create renderer for NULL surface"); + SDL_InvalidParamError("surface"); return NULL; } diff --git a/libs/SDL2/src/render/software/SDL_rotate.c b/libs/SDL2/src/render/software/SDL_rotate.c index b5ac715e..ade08726 100644 --- a/libs/SDL2/src/render/software/SDL_rotate.c +++ b/libs/SDL2/src/render/software/SDL_rotate.c @@ -32,7 +32,7 @@ Andreas Schiffler -- aschiffler at ferzkopp dot net #if SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED -#if defined(__WIN32__) +#if defined(__WIN32__) || defined(__GDK__) #include "../../core/windows/SDL_windows.h" #endif @@ -61,11 +61,6 @@ typedef struct tColorY { Uint8 y; } 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. @@ -82,7 +77,7 @@ to a situation where the program can segfault. \brief Returns colorkey info for a surface */ static Uint32 -_colorkey(SDL_Surface *src) +get_colorkey(SDL_Surface *src) { Uint32 key = 0; if (SDL_HasColorKey(src)) { @@ -91,6 +86,18 @@ _colorkey(SDL_Surface *src) return key; } +/* rotate (sx, sy) by (angle, center) into (dx, dy) */ +static void +rotate(double sx, double sy, double sinangle, double cosangle, const SDL_FPoint *center, double *dx, double *dy) { + sx -= center->x; + sy -= center->y; + + *dx = cosangle * sx - sinangle * sy; + *dy = sinangle * sx + cosangle * sy; + + *dx += center->x; + *dy += center->y; +} /* ! \brief Internal target surface sizing function for rotations with trig result return. @@ -105,49 +112,61 @@ _colorkey(SDL_Surface *src) */ void -SDLgfx_rotozoomSurfaceSizeTrig(int width, int height, double angle, - int *dstwidth, int *dstheight, - double *cangle, double *sangle) +SDLgfx_rotozoomSurfaceSizeTrig(int width, int height, double angle, const SDL_FPoint *center, + SDL_Rect *rect_dest, double *cangle, double *sangle) { - /* The trig code below gets the wrong size (due to FP inaccuracy?) when angle is a multiple of 90 degrees */ - int angle90 = (int)(angle/90); - if(angle90 == angle/90) { /* if the angle is a multiple of 90 degrees */ - angle90 %= 4; - if(angle90 < 0) angle90 += 4; /* 0:0 deg, 1:90 deg, 2:180 deg, 3:270 deg */ - if(angle90 & 1) { - *dstwidth = height; - *dstheight = width; - *cangle = 0; - *sangle = angle90 == 1 ? -1 : 1; /* reversed because our rotations are clockwise */ - } else { - *dstwidth = width; - *dstheight = height; - *cangle = angle90 == 0 ? 1 : -1; - *sangle = 0; - } - } else { - double x, y, cx, cy, sx, sy; - double radangle; - int dstwidthhalf, dstheighthalf; - /* - * Determine destination width and height by rotating a centered source box - */ - radangle = angle * (M_PI / -180.0); /* reverse the angle because our rotations are clockwise */ - *sangle = SDL_sin(radangle); - *cangle = SDL_cos(radangle); - x = (double)(width / 2); - y = (double)(height / 2); - cx = *cangle * x; - cy = *cangle * y; - sx = *sangle * x; - sy = *sangle * y; + int minx, maxx, miny, maxy; + double radangle; + double x0, x1, x2, x3; + double y0, y1, y2, y3; + double sinangle; + double cosangle; - dstwidthhalf = MAX((int) - SDL_ceil(MAX(MAX(MAX(SDL_fabs(cx + sy), SDL_fabs(cx - sy)), SDL_fabs(-cx + sy)), SDL_fabs(-cx - sy))), 1); - dstheighthalf = MAX((int) - SDL_ceil(MAX(MAX(MAX(SDL_fabs(sx + cy), SDL_fabs(sx - cy)), SDL_fabs(-sx + cy)), SDL_fabs(-sx - cy))), 1); - *dstwidth = 2 * dstwidthhalf; - *dstheight = 2 * dstheighthalf; + radangle = angle * (M_PI / 180.0); + sinangle = SDL_sin(radangle); + cosangle = SDL_cos(radangle); + + /* + * Determine destination width and height by rotating a source box, at pixel center + */ + rotate(0.5, 0.5, sinangle, cosangle, center, &x0, &y0); + rotate(width - 0.5, 0.5, sinangle, cosangle, center, &x1, &y1); + rotate(0.5, height - 0.5, sinangle, cosangle, center, &x2, &y2); + rotate(width - 0.5, height - 0.5, sinangle, cosangle, center, &x3, &y3); + + minx = (int)SDL_floor( SDL_min( SDL_min(x0, x1), SDL_min(x2, x3) ) ); + maxx = (int)SDL_ceil( SDL_max( SDL_max(x0, x1), SDL_max(x2, x3) ) ); + + miny = (int)SDL_floor( SDL_min( SDL_min(y0, y1), SDL_min(y2, y3) ) ); + maxy = (int)SDL_ceil( SDL_max( SDL_max(y0, y1), SDL_max(y2, y3) ) ); + + rect_dest->w = maxx - minx; + rect_dest->h = maxy - miny; + rect_dest->x = minx; + rect_dest->y = miny; + + /* reverse the angle because our rotations are clockwise */ + *sangle = -sinangle; + *cangle = cosangle; + + { + /* The trig code below gets the wrong size (due to FP inaccuracy?) when angle is a multiple of 90 degrees */ + int angle90 = (int)(angle/90); + if(angle90 == angle/90) { /* if the angle is a multiple of 90 degrees */ + angle90 %= 4; + if(angle90 < 0) angle90 += 4; /* 0:0 deg, 1:90 deg, 2:180 deg, 3:270 deg */ + if(angle90 & 1) { + rect_dest->w = height; + rect_dest->h = width; + *cangle = 0; + *sangle = angle90 == 1 ? -1 : 1; /* reversed because our rotations are clockwise */ + } else { + rect_dest->w = width; + rect_dest->h = height; + *cangle = angle90 == 0 ? 1 : -1; + *sangle = 0; + } + } } } @@ -220,48 +239,56 @@ Assumes dst surface was allocated with the correct dimensions. \param src Source surface. \param dst Destination surface. -\param cx Horizontal center coordinate. -\param cy Vertical center coordinate. \param isin Integer version of sine of angle. \param icos Integer version of cosine of angle. \param flipx Flag indicating horizontal mirroring should be applied. \param flipy Flag indicating vertical mirroring should be applied. \param smooth Flag indicating anti-aliasing should be used. +\param dst_rect destination coordinates +\param center true center. */ static void -_transformSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int isin, int icos, int flipx, int flipy, int smooth) +transformSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int isin, int icos, + int flipx, int flipy, int smooth, + const SDL_Rect *rect_dest, + const SDL_FPoint *center) { - int x, y, t1, t2, dx, dy, xd, yd, sdx, sdy, ax, ay, ex, ey, sw, sh; + int sw, sh; + int cx, cy; tColorRGBA c00, c01, c10, c11, cswap; tColorRGBA *pc, *sp; int gap; + const int fp_half = (1<<15); /* * Variable setup */ - xd = ((src->w - dst->w) << 15); - yd = ((src->h - dst->h) << 15); - ax = (cx << 16) - (icos * cx); - ay = (cy << 16) - (isin * cx); sw = src->w - 1; sh = src->h - 1; pc = (tColorRGBA*) dst->pixels; gap = dst->pitch - dst->w * 4; + cx = (int)(center->x * 65536.0); + cy = (int)(center->y * 65536.0); /* * Switch between interpolating and non-interpolating code */ if (smooth) { + int y; for (y = 0; y < dst->h; y++) { - dy = cy - y; - sdx = (ax + (isin * dy)) + xd; - sdy = (ay - (icos * dy)) + yd; + int x; + double src_x = (rect_dest->x + 0 + 0.5 - center->x); + double src_y = (rect_dest->y + y + 0.5 - center->y); + int sdx = (int)((icos * src_x - isin * src_y) + cx - fp_half); + int sdy = (int)((isin * src_x + icos * src_y) + cy - fp_half); for (x = 0; x < dst->w; x++) { - dx = (sdx >> 16); - dy = (sdy >> 16); + int dx = (sdx >> 16); + int dy = (sdy >> 16); if (flipx) dx = sw - dx; if (flipy) dy = sh - dy; if ((dx > -1) && (dy > -1) && (dx < (src->w-1)) && (dy < (src->h-1))) { + int ex, ey; + int t1, t2; sp = (tColorRGBA *) ((Uint8 *) src->pixels + src->pitch * dy) + dx; c00 = *sp; sp += 1; @@ -303,13 +330,16 @@ _transformSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int pc = (tColorRGBA *) ((Uint8 *) pc + gap); } } else { + int y; for (y = 0; y < dst->h; y++) { - dy = cy - y; - sdx = (ax + (isin * dy)) + xd; - sdy = (ay - (icos * dy)) + yd; + int x; + double src_x = (rect_dest->x + 0 + 0.5 - center->x); + double src_y = (rect_dest->y + y + 0.5 - center->y); + int sdx = (int)((icos * src_x - isin * src_y) + cx - fp_half); + int sdy = (int)((isin * src_x + icos * src_y) + cy - fp_half); for (x = 0; x < dst->w; x++) { - dx = (sdx >> 16); - dy = (sdy >> 16); + int dx = (sdx >> 16); + int dy = (sdy >> 16); if ((unsigned)dx < (unsigned)src->w && (unsigned)dy < (unsigned)src->h) { if(flipx) dx = sw - dx; if(flipy) dy = sh - dy; @@ -335,46 +365,54 @@ Assumes dst surface was allocated with the correct dimensions. \param src Source surface. \param dst Destination surface. -\param cx Horizontal center coordinate. -\param cy Vertical center coordinate. \param isin Integer version of sine of angle. \param icos Integer version of cosine of angle. \param flipx Flag indicating horizontal mirroring should be applied. \param flipy Flag indicating vertical mirroring should be applied. +\param dst_rect destination coordinates +\param center true center. */ static void -transformSurfaceY(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int isin, int icos, int flipx, int flipy) +transformSurfaceY(SDL_Surface * src, SDL_Surface * dst, int isin, int icos, int flipx, int flipy, + const SDL_Rect *rect_dest, + const SDL_FPoint *center) { - int x, y, dx, dy, xd, yd, sdx, sdy, ax, ay; + int sw, sh; + int cx, cy; tColorY *pc; int gap; + const int fp_half = (1<<15); + int y; /* * Variable setup */ - xd = ((src->w - dst->w) << 15); - yd = ((src->h - dst->h) << 15); - ax = (cx << 16) - (icos * cx); - ay = (cy << 16) - (isin * cx); + sw = src->w - 1; + sh = src->h - 1; pc = (tColorY*) dst->pixels; gap = dst->pitch - dst->w; + cx = (int)(center->x * 65536.0); + cy = (int)(center->y * 65536.0); + /* * Clear surface to colorkey */ - SDL_memset(pc, (int)(_colorkey(src) & 0xff), dst->pitch * dst->h); + SDL_memset(pc, (int)(get_colorkey(src) & 0xff), dst->pitch * dst->h); /* * Iterate through destination surface */ for (y = 0; y < dst->h; y++) { - dy = cy - y; - sdx = (ax + (isin * dy)) + xd; - sdy = (ay - (icos * dy)) + yd; + int x; + double src_x = (rect_dest->x + 0 + 0.5 - center->x); + double src_y = (rect_dest->y + y + 0.5 - center->y); + int sdx = (int)((icos * src_x - isin * src_y) + cx - fp_half); + int sdy = (int)((isin * src_x + icos * src_y) + cy - fp_half); for (x = 0; x < dst->w; x++) { - dx = (sdx >> 16); - dy = (sdy >> 16); + int dx = (sdx >> 16); + int dy = (sdy >> 16); if ((unsigned)dx < (unsigned)src->w && (unsigned)dy < (unsigned)src->h) { - if (flipx) dx = (src->w-1)-dx; - if (flipy) dy = (src->h-1)-dy; + if (flipx) dx = sw - dx; + if (flipy) dy = sh- dy; *pc = *((tColorY *)src->pixels + src->pitch * dy + dx); } sdx += icos; @@ -390,7 +428,7 @@ transformSurfaceY(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int isin \brief Rotates and zooms a surface with different horizontal and vertival scaling factors and optional anti-aliasing. Rotates a 32-bit or 8-bit 'src' surface to newly created 'dst' surface. -'angle' is the rotation in degrees, 'centerx' and 'centery' the rotation center. If 'smooth' is set +'angle' is the rotation in degrees, 'center' the rotation center. If 'smooth' is set then the destination 32-bit surface is anti-aliased. 8-bit surfaces must have a colorkey. 32-bit surfaces must have a 8888 layout with red, green, blue and alpha masks (any ordering goes). The blend mode of the 'src' surface has some effects on generation of the 'dst' surface: The NONE @@ -400,21 +438,21 @@ When using the NONE and MOD modes, color and alpha modulation must be applied be \param src The surface to rotozoom. \param angle The angle to rotate in degrees. -\param centerx The horizontal coordinate of the center of rotation \param zoomy The vertical coordinate of the center of rotation \param smooth Antialiasing flag; set to SMOOTHING_ON to enable. \param flipx Set to 1 to flip the image horizontally \param flipy Set to 1 to flip the image vertically -\param dstwidth The destination surface width -\param dstheight The destination surface height +\param rect_dest The destination rect bounding box \param cangle The angle cosine \param sangle The angle sine +\param center The true coordinate of the center of rotation \return The new rotated surface. */ SDL_Surface * -SDLgfx_rotateSurface(SDL_Surface * src, double angle, int centerx, int centery, int smooth, int flipx, int flipy, int dstwidth, int dstheight, double cangle, double sangle) +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) { SDL_Surface *rz_dst; int is8bit, angle90; @@ -433,7 +471,6 @@ SDLgfx_rotateSurface(SDL_Surface * src, double angle, int centerx, int centery, colorKeyAvailable = SDL_TRUE; } } - /* This function requires a 32-bit surface or 8-bit surface with a colorkey */ is8bit = src->format->BitsPerPixel == 8 && colorKeyAvailable; if (!(is8bit || (src->format->BitsPerPixel == 32 && src->format->Amask))) @@ -447,16 +484,18 @@ SDLgfx_rotateSurface(SDL_Surface * src, double angle, int centerx, int centery, rz_dst = NULL; if (is8bit) { /* Target surface is 8 bit */ - rz_dst = SDL_CreateRGBSurface(0, dstwidth, dstheight + GUARD_ROWS, 8, 0, 0, 0, 0); + rz_dst = SDL_CreateRGBSurfaceWithFormat(0, rect_dest->w, rect_dest->h + GUARD_ROWS, 8, src->format->format); if (rz_dst != NULL) { - for (i = 0; i < src->format->palette->ncolors; i++) { - rz_dst->format->palette->colors[i] = src->format->palette->colors[i]; + if (src->format->palette) { + for (i = 0; i < src->format->palette->ncolors; i++) { + rz_dst->format->palette->colors[i] = src->format->palette->colors[i]; + } + rz_dst->format->palette->ncolors = src->format->palette->ncolors; } - rz_dst->format->palette->ncolors = src->format->palette->ncolors; } } else { /* Target surface is 32 bit with source RGBA ordering */ - rz_dst = SDL_CreateRGBSurface(0, dstwidth, dstheight + GUARD_ROWS, 32, + rz_dst = SDL_CreateRGBSurface(0, rect_dest->w, rect_dest->h + GUARD_ROWS, 32, src->format->Rmask, src->format->Gmask, src->format->Bmask, src->format->Amask); } @@ -466,7 +505,7 @@ SDLgfx_rotateSurface(SDL_Surface * src, double angle, int centerx, int centery, return NULL; /* Adjust for guard rows */ - rz_dst->h = dstheight; + rz_dst->h = rect_dest->h; SDL_GetSurfaceBlendMode(src, &blendmode); @@ -497,7 +536,7 @@ SDLgfx_rotateSurface(SDL_Surface * src, double angle, int centerx, int centery, } /* check if the rotation is a multiple of 90 degrees so we can take a fast path and also somewhat reduce - * the off-by-one problem in _transformSurfaceRGBA that expresses itself when the rotation is near + * the off-by-one problem in transformSurfaceRGBA that expresses itself when the rotation is near * multiples of 90 degrees. */ angle90 = (int)(angle/90); @@ -513,16 +552,16 @@ SDLgfx_rotateSurface(SDL_Surface * src, double angle, int centerx, int centery, if(angle90 >= 0) { transformSurfaceY90(src, rz_dst, angle90, flipx, flipy); } else { - transformSurfaceY(src, rz_dst, centerx, centery, (int)sangleinv, (int)cangleinv, - flipx, flipy); + transformSurfaceY(src, rz_dst, (int)sangleinv, (int)cangleinv, + flipx, flipy, rect_dest, center); } } else { /* Call the 32-bit transformation routine to do the rotation */ if (angle90 >= 0) { transformSurfaceRGBA90(src, rz_dst, angle90, flipx, flipy); } else { - _transformSurfaceRGBA(src, rz_dst, centerx, centery, (int)sangleinv, (int)cangleinv, - flipx, flipy, smooth); + transformSurfaceRGBA(src, rz_dst, (int)sangleinv, (int)cangleinv, + flipx, flipy, smooth, rect_dest, center); } } diff --git a/libs/SDL2/src/render/software/SDL_rotate.h b/libs/SDL2/src/render/software/SDL_rotate.h index e1746c92..8d7ec9d2 100644 --- a/libs/SDL2/src/render/software/SDL_rotate.h +++ b/libs/SDL2/src/render/software/SDL_rotate.h @@ -22,11 +22,9 @@ #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 centerx, int centery, int smooth, int flipx, int flipy, int dstwidth, int dstheight, double cangle, double sangle); -extern void SDLgfx_rotozoomSurfaceSizeTrig(int width, int height, double angle, int *dstwidth, int *dstheight, double *cangle, double *sangle); +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, + SDL_Rect *rect_dest, double *cangle, double *sangle); #endif /* SDL_rotate_h_ */ diff --git a/libs/SDL2/src/render/software/SDL_triangle.c b/libs/SDL2/src/render/software/SDL_triangle.c index ce003e16..694cb4d9 100644 --- a/libs/SDL2/src/render/software/SDL_triangle.c +++ b/libs/SDL2/src/render/software/SDL_triangle.c @@ -718,6 +718,21 @@ end: } +#define FORMAT_ALPHA 0 +#define FORMAT_NO_ALPHA -1 +#define FORMAT_2101010 1 +#define FORMAT_HAS_ALPHA(format) format == 0 +#define FORMAT_HAS_NO_ALPHA(format) format < 0 +static int SDL_INLINE detect_format(SDL_PixelFormat *pf) { + if (pf->format == SDL_PIXELFORMAT_ARGB2101010) { + return FORMAT_2101010; + } else if (pf->Amask) { + return FORMAT_ALPHA; + } else { + return FORMAT_NO_ALPHA; + } +} + static void SDL_BlitTriangle_Slow(SDL_BlitInfo *info, SDL_Point s2_x_area, SDL_Rect dstrect, int area, int bias_w0, int bias_w1, int bias_w2, @@ -738,25 +753,32 @@ SDL_BlitTriangle_Slow(SDL_BlitInfo *info, SDL_PixelFormat *dst_fmt = info->dst_fmt; int srcbpp = src_fmt->BytesPerPixel; int dstbpp = dst_fmt->BytesPerPixel; + int srcfmt_val; + int dstfmt_val; Uint32 rgbmask = ~src_fmt->Amask; Uint32 ckey = info->colorkey & rgbmask; Uint8 *dst_ptr = info->dst; int dst_pitch = info->dst_pitch;; + srcfmt_val = detect_format(src_fmt); + dstfmt_val = detect_format(dst_fmt); + TRIANGLE_BEGIN_LOOP { Uint8 *src; Uint8 *dst = dptr; TRIANGLE_GET_TEXTCOORD src = (info->src + (srcy * info->src_pitch) + (srcx * srcbpp)); - if (src_fmt->Amask) { - DISEMBLE_RGBA(src, srcbpp, src_fmt, srcpixel, srcR, srcG, - srcB, srcA); - } else { - DISEMBLE_RGB(src, srcbpp, src_fmt, srcpixel, srcR, srcG, - srcB); + if (FORMAT_HAS_ALPHA(srcfmt_val)) { + DISEMBLE_RGBA(src, srcbpp, src_fmt, srcpixel, srcR, srcG, srcB, srcA); + } else if (FORMAT_HAS_NO_ALPHA(srcfmt_val)) { + DISEMBLE_RGB(src, srcbpp, src_fmt, srcpixel, srcR, srcG, srcB); srcA = 0xFF; + } else { + /* SDL_PIXELFORMAT_ARGB2101010 */ + srcpixel = *((Uint32 *)(src)); + RGBA_FROM_ARGB2101010(srcpixel, srcR, srcG, srcB, srcA); } if (flags & SDL_COPY_COLORKEY) { /* srcpixel isn't set for 24 bpp */ @@ -768,13 +790,15 @@ SDL_BlitTriangle_Slow(SDL_BlitInfo *info, continue; } } - if (dst_fmt->Amask) { - DISEMBLE_RGBA(dst, dstbpp, dst_fmt, dstpixel, dstR, dstG, - dstB, dstA); - } else { - DISEMBLE_RGB(dst, dstbpp, dst_fmt, dstpixel, dstR, dstG, - dstB); + if (FORMAT_HAS_ALPHA(dstfmt_val)) { + DISEMBLE_RGBA(dst, dstbpp, dst_fmt, dstpixel, dstR, dstG, dstB, dstA); + } else if (FORMAT_HAS_NO_ALPHA(dstfmt_val)) { + DISEMBLE_RGB(dst, dstbpp, dst_fmt, dstpixel, dstR, dstG, dstB); dstA = 0xFF; + } else { + /* SDL_PIXELFORMAT_ARGB2101010 */ + dstpixel = *((Uint32 *)(dst)); + RGBA_FROM_ARGB2101010(dstpixel, dstR, dstG, dstB, dstA); } if (! is_uniform) { @@ -845,10 +869,15 @@ SDL_BlitTriangle_Slow(SDL_BlitInfo *info, dstA = 255; break; } - if (dst_fmt->Amask) { + if (FORMAT_HAS_ALPHA(dstfmt_val)) { ASSEMBLE_RGBA(dst, dstbpp, dst_fmt, dstR, dstG, dstB, dstA); - } else { + } else if (FORMAT_HAS_NO_ALPHA(dstfmt_val)) { ASSEMBLE_RGB(dst, dstbpp, dst_fmt, dstR, dstG, dstB); + } else { + /* SDL_PIXELFORMAT_ARGB2101010 */ + Uint32 pixel; + ARGB2101010_FROM_RGBA(pixel, dstR, dstG, dstB, dstA); + *(Uint32 *)dst = pixel; } } TRIANGLE_END_LOOP diff --git a/libs/SDL2/src/render/vitagxm/SDL_render_vita_gxm.c b/libs/SDL2/src/render/vitagxm/SDL_render_vita_gxm.c index 93770129..a4b2cee6 100644 --- a/libs/SDL2/src/render/vitagxm/SDL_render_vita_gxm.c +++ b/libs/SDL2/src/render/vitagxm/SDL_render_vita_gxm.c @@ -61,6 +61,11 @@ static int VITA_GXM_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * text const Uint8 *Uplane, int Upitch, const Uint8 *Vplane, int Vpitch); +static int VITA_GXM_UpdateTextureNV(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * rect, + const Uint8 *Yplane, int Ypitch, + const Uint8 *UVplane, int UVpitch); + static int VITA_GXM_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect, void **pixels, int *pitch); @@ -105,12 +110,16 @@ SDL_RenderDriver VITA_GXM_RenderDriver = { .info = { .name = "VITA gxm", .flags = SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE, - .num_texture_formats = 4, + .num_texture_formats = 8, .texture_formats = { [0] = SDL_PIXELFORMAT_ABGR8888, [1] = SDL_PIXELFORMAT_ARGB8888, [2] = SDL_PIXELFORMAT_RGB565, - [3] = SDL_PIXELFORMAT_BGR565 + [3] = SDL_PIXELFORMAT_BGR565, + [4] = SDL_PIXELFORMAT_YV12, + [5] = SDL_PIXELFORMAT_IYUV, + [6] = SDL_PIXELFORMAT_NV12, + [7] = SDL_PIXELFORMAT_NV21, }, .max_texture_width = 4096, .max_texture_height = 4096, @@ -133,6 +142,15 @@ PixelFormatToVITAFMT(Uint32 format) return SCE_GXM_TEXTURE_FORMAT_U5U6U5_RGB; case SDL_PIXELFORMAT_BGR565: return SCE_GXM_TEXTURE_FORMAT_U5U6U5_BGR; + case SDL_PIXELFORMAT_YV12: + return SCE_GXM_TEXTURE_FORMAT_YVU420P3_CSC0; + case SDL_PIXELFORMAT_IYUV: + return SCE_GXM_TEXTURE_FORMAT_YUV420P3_CSC0; + // should be the other way around. looks like SCE bug. + case SDL_PIXELFORMAT_NV12: + return SCE_GXM_TEXTURE_FORMAT_YVU420P2_CSC0; + case SDL_PIXELFORMAT_NV21: + return SCE_GXM_TEXTURE_FORMAT_YUV420P2_CSC0; default: return SCE_GXM_TEXTURE_FORMAT_U8U8U8U8_ABGR; } @@ -217,7 +235,7 @@ VITA_GXM_CreateRenderer(SDL_Window *window, Uint32 flags) data = (VITA_GXM_RenderData *) SDL_calloc(1, sizeof(VITA_GXM_RenderData)); if (!data) { - VITA_GXM_DestroyRenderer(renderer); + SDL_free(renderer); SDL_OutOfMemory(); return NULL; } @@ -226,7 +244,10 @@ VITA_GXM_CreateRenderer(SDL_Window *window, Uint32 flags) renderer->SupportsBlendMode = VITA_GXM_SupportsBlendMode; renderer->CreateTexture = VITA_GXM_CreateTexture; renderer->UpdateTexture = VITA_GXM_UpdateTexture; +#if SDL_HAVE_YUV renderer->UpdateTextureYUV = VITA_GXM_UpdateTextureYUV; + renderer->UpdateTextureNV = VITA_GXM_UpdateTextureNV; +#endif renderer->LockTexture = VITA_GXM_LockTexture; renderer->UnlockTexture = VITA_GXM_UnlockTexture; renderer->SetTextureScaleMode = VITA_GXM_SetTextureScaleMode; @@ -293,7 +314,17 @@ VITA_GXM_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) return SDL_OutOfMemory(); } - vita_texture->tex = create_gxm_texture(data, texture->w, texture->h, PixelFormatToVITAFMT(texture->format), (texture->access == SDL_TEXTUREACCESS_TARGET)); + vita_texture->tex = create_gxm_texture( + data, + texture->w, + texture->h, + PixelFormatToVITAFMT(texture->format), + (texture->access == SDL_TEXTUREACCESS_TARGET), + &(vita_texture->w), + &(vita_texture->h), + &(vita_texture->pitch), + &(vita_texture->wscale) + ); if (!vita_texture->tex) { SDL_free(vita_texture); @@ -304,38 +335,129 @@ VITA_GXM_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) VITA_GXM_SetTextureScaleMode(renderer, texture, texture->scaleMode); - vita_texture->w = gxm_texture_get_width(vita_texture->tex); - vita_texture->h = gxm_texture_get_height(vita_texture->tex); - vita_texture->pitch = gxm_texture_get_stride(vita_texture->tex); +#if SDL_HAVE_YUV + vita_texture->yuv = ((texture->format == SDL_PIXELFORMAT_IYUV) || (texture->format == SDL_PIXELFORMAT_YV12)); + vita_texture->nv12 = ((texture->format == SDL_PIXELFORMAT_NV12) || (texture->format == SDL_PIXELFORMAT_NV21)); +#endif return 0; } +static void VITA_GXM_SetYUVProfile(SDL_Renderer * renderer, SDL_Texture *texture) +{ + VITA_GXM_RenderData *data = (VITA_GXM_RenderData *) renderer->driverdata; + int ret = 0; + switch (SDL_GetYUVConversionModeForResolution(texture->w, texture->h)) { + case SDL_YUV_CONVERSION_BT601: + ret = sceGxmSetYuvProfile(data->gxm_context, 0, SCE_GXM_YUV_PROFILE_BT601_STANDARD); + break; + case SDL_YUV_CONVERSION_BT709: + ret = sceGxmSetYuvProfile(data->gxm_context, 0, SCE_GXM_YUV_PROFILE_BT709_STANDARD); + break; + case SDL_YUV_CONVERSION_JPEG: + default: + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Unsupported YUV profile: %d\n", SDL_GetYUVConversionModeForResolution(texture->w, texture->h)); + break; + } + + if (ret < 0) { + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Setting YUV profile failed: %x\n", ret); + } +} static int VITA_GXM_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch) { - const Uint8 *src; + VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *) texture->driverdata; Uint8 *dst; - int row, length,dpitch; - src = pixels; + int row, length, dpitch; + +#if SDL_HAVE_YUV + if (vita_texture->yuv || vita_texture->nv12) { + VITA_GXM_SetYUVProfile(renderer, texture); + } +#endif VITA_GXM_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); + SDL_memcpy(dst, pixels, length*rect->h); } else { for (row = 0; row < rect->h; ++row) { - SDL_memcpy(dst, src, length); - src += pitch; + SDL_memcpy(dst, pixels, length); + pixels += pitch; dst += dpitch; } } +#if SDL_HAVE_YUV + if (vita_texture->yuv) { + void *Udst; + void *Vdst; + int uv_pitch = (dpitch+1) / 2; + int uv_src_pitch = (pitch+1) / 2; + SDL_Rect UVrect = {rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2}; + + // skip Y plane + Uint8 *Dpixels = gxm_texture_get_datap(vita_texture->tex) + (vita_texture->pitch * vita_texture->h); + + Udst = Dpixels + (UVrect.y * uv_pitch) + UVrect.x; + Vdst = Dpixels + (uv_pitch * ((vita_texture->h + 1) / 2)) + (UVrect.y * uv_pitch) + UVrect.x; + + length = UVrect.w; + + // U plane + if (length == uv_src_pitch && length == uv_pitch) { + SDL_memcpy(Udst, pixels, length*UVrect.h); + } else { + for (row = 0; row < UVrect.h; ++row) { + SDL_memcpy(Udst, pixels, length); + pixels += uv_src_pitch; + Udst += uv_pitch; + } + } + + // V plane + if (length == uv_src_pitch && length == uv_pitch) { + SDL_memcpy(Vdst, pixels, length*UVrect.h); + } else { + for (row = 0; row < UVrect.h; ++row) { + SDL_memcpy(Vdst, pixels, length); + pixels += uv_src_pitch; + Vdst += uv_pitch; + } + } + + } else if (vita_texture->nv12) { + void *UVdst; + int uv_pitch = 2 * ((dpitch+1) / 2); + int uv_src_pitch = 2 * ((pitch+1) / 2); + SDL_Rect UVrect = {rect->x / 2, rect->y / 2, (rect->w + 1) / 2 , (rect->h + 1) / 2}; + + // skip Y plane + void *Dpixels = (void *) ((Uint8 *) gxm_texture_get_datap(vita_texture->tex) + (vita_texture->pitch * vita_texture->h)); + UVdst = Dpixels + (UVrect.y * uv_pitch) + UVrect.x; + + length = UVrect.w*2; + + // UV plane + if (length == uv_src_pitch && length == uv_pitch) { + SDL_memcpy(UVdst, pixels, length*UVrect.h); + } else { + for (row = 0; row < UVrect.h; ++row) { + SDL_memcpy(UVdst, pixels, length); + pixels += uv_src_pitch; + UVdst += uv_pitch; + } + } + } +#endif + return 0; } +#if SDL_HAVE_YUV static int VITA_GXM_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, @@ -343,9 +465,133 @@ VITA_GXM_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture, const Uint8 *Uplane, int Upitch, const Uint8 *Vplane, int Vpitch) { + Uint8 *dst; + int row, length, dpitch; + SDL_Rect UVrect = {rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2}; + + VITA_GXM_SetYUVProfile(renderer, texture); + + // copy Y plane + // obtain pixels via locking so that texture is flushed + VITA_GXM_LockTexture(renderer, texture, rect, (void **)&dst, &dpitch); + + length = rect->w; + + if (length == Ypitch && length == dpitch) { + SDL_memcpy(dst, Yplane, length*rect->h); + } else { + for (row = 0; row < rect->h; ++row) { + SDL_memcpy(dst, Yplane, length); + Yplane += Ypitch; + dst += dpitch; + } + } + + // U/V planes + { + void *Udst; + void *Vdst; + VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *) texture->driverdata; + int uv_pitch = (dpitch+1) / 2; + + // skip Y plane + void *pixels = (void *) ((Uint8 *) gxm_texture_get_datap(vita_texture->tex) + (vita_texture->pitch * vita_texture->h)); + + if (texture->format == SDL_PIXELFORMAT_YV12) { // YVU + Vdst = pixels + (UVrect.y * uv_pitch) + UVrect.x; + Udst = pixels + (uv_pitch * ((vita_texture->h + 1) / 2)) + (UVrect.y * uv_pitch) + UVrect.x; + } else { // YUV + Udst = pixels + (UVrect.y * uv_pitch) + UVrect.x; + Vdst = pixels + (uv_pitch * ((vita_texture->h + 1) / 2)) + (UVrect.y * uv_pitch) + UVrect.x; + } + + length = UVrect.w; + + // U plane + if (length == Upitch && length == uv_pitch) { + SDL_memcpy(Udst, Uplane, length*UVrect.h); + } else { + for (row = 0; row < UVrect.h; ++row) { + SDL_memcpy(Udst, Uplane, length); + Uplane += Upitch; + Udst += uv_pitch; + } + } + + // V plane + if (length == Vpitch && length == uv_pitch) { + SDL_memcpy(Vdst, Vplane, length*UVrect.h); + } else { + for (row = 0; row < UVrect.h; ++row) { + SDL_memcpy(Vdst, Vplane, length); + Vplane += Vpitch; + Vdst += uv_pitch; + } + } + + } + return 0; } +static int +VITA_GXM_UpdateTextureNV(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * rect, + const Uint8 *Yplane, int Ypitch, + const Uint8 *UVplane, int UVpitch) +{ + + Uint8 *dst; + int row, length, dpitch; + SDL_Rect UVrect = {rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2}; + + VITA_GXM_SetYUVProfile(renderer, texture); + + // copy Y plane + VITA_GXM_LockTexture(renderer, texture, rect, (void **)&dst, &dpitch); + + length = rect->w * SDL_BYTESPERPIXEL(texture->format); + + if (length == Ypitch && length == dpitch) { + SDL_memcpy(dst, Yplane, length*rect->h); + } else { + for (row = 0; row < rect->h; ++row) { + SDL_memcpy(dst, Yplane, length); + Yplane += Ypitch; + dst += dpitch; + } + } + + // UV plane + { + void *UVdst; + VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *) texture->driverdata; + int uv_pitch = 2 * ((dpitch+1) / 2); + + // skip Y plane + void *pixels = (void *) ((Uint8 *) gxm_texture_get_datap(vita_texture->tex) + (vita_texture->pitch * vita_texture->h)); + + UVdst = pixels + (UVrect.y * uv_pitch) + UVrect.x; + + length = UVrect.w * 2; + + // UV plane + if (length == UVpitch && length == uv_pitch) { + SDL_memcpy(UVdst, UVplane, length*UVrect.h); + } else { + for (row = 0; row < UVrect.h; ++row) { + SDL_memcpy(UVdst, UVplane, length); + UVplane += UVpitch; + UVdst += uv_pitch; + } + } + } + + return 0; +} + +#endif + static int VITA_GXM_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect, void **pixels, int *pitch) @@ -517,6 +763,7 @@ VITA_GXM_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Textu size_indices = indices ? size_indices : 0; if (texture) { + VITA_GXM_TextureData* vita_texture = (VITA_GXM_TextureData*) texture->driverdata; texture_vertex *vertices; vertices = (texture_vertex *)pool_malloc( @@ -549,7 +796,7 @@ VITA_GXM_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Textu vertices[i].x = xy_[0] * scale_x; vertices[i].y = xy_[1] * scale_y; - vertices[i].u = uv_[0]; + vertices[i].u = uv_[0] * vita_texture->wscale; vertices[i].v = uv_[1]; vertices[i].color = col_; } @@ -728,14 +975,6 @@ SetDrawState(VITA_GXM_RenderData *data, const SDL_RenderCommand *cmd) return 0; } -static int -SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd) -{ - VITA_GXM_RenderData *data = (VITA_GXM_RenderData *) renderer->driverdata; - - return SetDrawState(data, cmd); -} - static int VITA_GXM_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize) { @@ -760,8 +999,8 @@ VITA_GXM_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void * 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; @@ -774,8 +1013,8 @@ VITA_GXM_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void * 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; @@ -822,11 +1061,7 @@ VITA_GXM_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void * nextcmd = nextcmd->next; } - if (thistexture) { - ret = SetCopyState(renderer, cmd); - } else { - ret = SetDrawState(data, cmd); - } + ret = SetDrawState(data, cmd); if (ret == 0) { int op = SCE_GXM_PRIMITIVE_TRIANGLES; @@ -1011,7 +1246,7 @@ VITA_GXM_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture) sceGxmFinish(data->gxm_context); - free_gxm_texture(vita_texture->tex); + free_gxm_texture(data, vita_texture->tex); SDL_free(vita_texture); diff --git a/libs/SDL2/src/render/vitagxm/SDL_render_vita_gxm_memory.c b/libs/SDL2/src/render/vitagxm/SDL_render_vita_gxm_memory.c index d3322730..85d682ad 100644 --- a/libs/SDL2/src/render/vitagxm/SDL_render_vita_gxm_memory.c +++ b/libs/SDL2/src/render/vitagxm/SDL_render_vita_gxm_memory.c @@ -26,7 +26,7 @@ #include "SDL_render_vita_gxm_memory.h" void * -mem_gpu_alloc(SceKernelMemBlockType type, unsigned int size, unsigned int alignment, unsigned int attribs, SceUID *uid) +vita_mem_alloc(unsigned int type, unsigned int size, unsigned int alignment, unsigned int attribs, SceUID *uid) { void *mem; @@ -51,7 +51,7 @@ mem_gpu_alloc(SceKernelMemBlockType type, unsigned int size, unsigned int alignm } void -mem_gpu_free(SceUID uid) +vita_mem_free(SceUID uid) { void *mem = NULL; if (sceKernelGetMemBlockBase(uid, &mem) < 0) @@ -61,7 +61,71 @@ mem_gpu_free(SceUID uid) } void * -mem_vertex_usse_alloc(unsigned int size, SceUID *uid, unsigned int *usse_offset) +vita_gpu_mem_alloc(VITA_GXM_RenderData *data, unsigned int size) +{ + void *mem; + + if (data->texturePool == NULL) { + int poolsize; + int ret; + SceKernelFreeMemorySizeInfo info; + info.size = sizeof(SceKernelFreeMemorySizeInfo); + sceKernelGetFreeMemorySize(&info); + + poolsize = ALIGN(info.size_cdram, 256*1024); + if (poolsize > info.size_cdram) { + poolsize = ALIGN(info.size_cdram - 256*1024, 256*1024); + } + data->texturePoolUID = sceKernelAllocMemBlock("gpu_texture_pool", SCE_KERNEL_MEMBLOCK_TYPE_USER_CDRAM_RW, poolsize, NULL); + if (data->texturePoolUID < 0) { + return NULL; + } + + ret = sceKernelGetMemBlockBase(data->texturePoolUID, &mem); + if ( ret < 0) + { + return NULL; + } + data->texturePool = sceClibMspaceCreate(mem, poolsize); + + if (data->texturePool == NULL) { + return NULL; + } + ret = sceGxmMapMemory(mem, poolsize, SCE_GXM_MEMORY_ATTRIB_READ | SCE_GXM_MEMORY_ATTRIB_WRITE); + if (ret < 0) + { + return NULL; + } + } + return sceClibMspaceMemalign(data->texturePool, SCE_GXM_TEXTURE_ALIGNMENT, size); +} + +void +vita_gpu_mem_free(VITA_GXM_RenderData *data, void* ptr) +{ + if (data->texturePool != NULL) + { + sceClibMspaceFree(data->texturePool, ptr); + } +} + +void +vita_gpu_mem_destroy(VITA_GXM_RenderData *data) +{ + void *mem = NULL; + if (data->texturePool != NULL) + { + sceClibMspaceDestroy(data->texturePool); + data->texturePool = NULL; + if (sceKernelGetMemBlockBase(data->texturePoolUID, &mem) < 0) + return; + sceGxmUnmapMemory(mem); + sceKernelFreeMemBlock(data->texturePoolUID); + } +} + +void * +vita_mem_vertex_usse_alloc(unsigned int size, SceUID *uid, unsigned int *usse_offset) { void *mem = NULL; @@ -77,7 +141,7 @@ mem_vertex_usse_alloc(unsigned int size, SceUID *uid, unsigned int *usse_offset) } void -mem_vertex_usse_free(SceUID uid) +vita_mem_vertex_usse_free(SceUID uid) { void *mem = NULL; if (sceKernelGetMemBlockBase(uid, &mem) < 0) @@ -87,7 +151,7 @@ mem_vertex_usse_free(SceUID uid) } void * -mem_fragment_usse_alloc(unsigned int size, SceUID *uid, unsigned int *usse_offset) +vita_mem_fragment_usse_alloc(unsigned int size, SceUID *uid, unsigned int *usse_offset) { void *mem = NULL; @@ -103,7 +167,7 @@ mem_fragment_usse_alloc(unsigned int size, SceUID *uid, unsigned int *usse_offse } void -mem_fragment_usse_free(SceUID uid) +vita_mem_fragment_usse_free(SceUID uid) { void *mem = NULL; if (sceKernelGetMemBlockBase(uid, &mem) < 0) diff --git a/libs/SDL2/src/render/vitagxm/SDL_render_vita_gxm_memory.h b/libs/SDL2/src/render/vitagxm/SDL_render_vita_gxm_memory.h index 51bc8a80..93b9f349 100644 --- a/libs/SDL2/src/render/vitagxm/SDL_render_vita_gxm_memory.h +++ b/libs/SDL2/src/render/vitagxm/SDL_render_vita_gxm_memory.h @@ -25,15 +25,19 @@ #include #include #include +#include "SDL_render_vita_gxm_types.h" #define ALIGN(x, a) (((x) + ((a) - 1)) & ~((a) - 1)) -void *mem_gpu_alloc(SceKernelMemBlockType type, unsigned int size, unsigned int alignment, unsigned int attribs, SceUID *uid); -void mem_gpu_free(SceUID uid); -void *mem_vertex_usse_alloc(unsigned int size, SceUID *uid, unsigned int *usse_offset); -void mem_vertex_usse_free(SceUID uid); -void *mem_fragment_usse_alloc(unsigned int size, SceUID *uid, unsigned int *usse_offset); -void mem_fragment_usse_free(SceUID uid); +void *vita_mem_alloc(unsigned int type, unsigned int size, unsigned int alignment, unsigned int attribs, SceUID *uid); +void vita_mem_free(SceUID uid); +void *vita_gpu_mem_alloc(VITA_GXM_RenderData *data, unsigned int size); +void vita_gpu_mem_free(VITA_GXM_RenderData *data, void* ptr); +void vita_gpu_mem_destroy(VITA_GXM_RenderData *data); +void *vita_mem_vertex_usse_alloc(unsigned int size, SceUID *uid, unsigned int *usse_offset); +void vita_mem_vertex_usse_free(SceUID uid); +void *vita_mem_fragment_usse_alloc(unsigned int size, SceUID *uid, unsigned int *usse_offset); +void vita_mem_fragment_usse_free(SceUID uid); #endif /* SDL_RENDER_VITA_GXM_MEMORY_H */ diff --git a/libs/SDL2/src/render/vitagxm/SDL_render_vita_gxm_tools.c b/libs/SDL2/src/render/vitagxm/SDL_render_vita_gxm_tools.c index e043b55a..10deb556 100644 --- a/libs/SDL2/src/render/vitagxm/SDL_render_vita_gxm_tools.c +++ b/libs/SDL2/src/render/vitagxm/SDL_render_vita_gxm_tools.c @@ -117,6 +117,8 @@ tex_format_to_bytespp(SceGxmTextureFormat format) case SCE_GXM_TEXTURE_BASE_FORMAT_U8: case SCE_GXM_TEXTURE_BASE_FORMAT_S8: case SCE_GXM_TEXTURE_BASE_FORMAT_P8: + case SCE_GXM_TEXTURE_BASE_FORMAT_YUV420P2: // YUV actually uses 12 bits per pixel. UV planes bits/mem are handled elsewhere + case SCE_GXM_TEXTURE_BASE_FORMAT_YUV420P3: return 1; case SCE_GXM_TEXTURE_BASE_FORMAT_U4U4U4U4: case SCE_GXM_TEXTURE_BASE_FORMAT_U8U3U3U2: @@ -414,28 +416,28 @@ gxm_init(SDL_Renderer *renderer) } // allocate ring buffer memory using default sizes - vdmRingBuffer = mem_gpu_alloc( + vdmRingBuffer = vita_mem_alloc( SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE, SCE_GXM_DEFAULT_VDM_RING_BUFFER_SIZE, 4, SCE_GXM_MEMORY_ATTRIB_READ, &data->vdmRingBufferUid); - vertexRingBuffer = mem_gpu_alloc( + vertexRingBuffer = vita_mem_alloc( SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE, SCE_GXM_DEFAULT_VERTEX_RING_BUFFER_SIZE, 4, SCE_GXM_MEMORY_ATTRIB_READ, &data->vertexRingBufferUid); - fragmentRingBuffer = mem_gpu_alloc( + fragmentRingBuffer = vita_mem_alloc( SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE, SCE_GXM_DEFAULT_FRAGMENT_RING_BUFFER_SIZE, 4, SCE_GXM_MEMORY_ATTRIB_READ, &data->fragmentRingBufferUid); - fragmentUsseRingBuffer = mem_fragment_usse_alloc( + fragmentUsseRingBuffer = vita_mem_fragment_usse_alloc( SCE_GXM_DEFAULT_FRAGMENT_USSE_RING_BUFFER_SIZE, &data->fragmentUsseRingBufferUid, &fragmentUsseRingBufferOffset); @@ -480,7 +482,7 @@ gxm_init(SDL_Renderer *renderer) for (i = 0; i < VITA_GXM_BUFFERS; i++) { // allocate memory for display - data->displayBufferData[i] = mem_gpu_alloc( + data->displayBufferData[i] = vita_mem_alloc( SCE_KERNEL_MEMBLOCK_TYPE_USER_CDRAM_RW, 4 * VITA_GXM_SCREEN_STRIDE * VITA_GXM_SCREEN_HEIGHT, SCE_GXM_COLOR_SURFACE_ALIGNMENT, @@ -525,7 +527,7 @@ gxm_init(SDL_Renderer *renderer) // allocate the depth buffer - data->depthBufferData = mem_gpu_alloc( + data->depthBufferData = vita_mem_alloc( SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE, 4 * sampleCount, SCE_GXM_DEPTHSTENCIL_SURFACE_ALIGNMENT, @@ -533,7 +535,7 @@ gxm_init(SDL_Renderer *renderer) &data->depthBufferUid); // allocate the stencil buffer - data->stencilBufferData = mem_gpu_alloc( + data->stencilBufferData = vita_mem_alloc( SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE, 4 * sampleCount, SCE_GXM_DEPTHSTENCIL_SURFACE_ALIGNMENT, @@ -565,19 +567,19 @@ gxm_init(SDL_Renderer *renderer) // allocate memory for buffers and USSE code - patcherBuffer = mem_gpu_alloc( + patcherBuffer = vita_mem_alloc( SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE, patcherBufferSize, 4, SCE_GXM_MEMORY_ATTRIB_READ | SCE_GXM_MEMORY_ATTRIB_WRITE, &data->patcherBufferUid); - patcherVertexUsse = mem_vertex_usse_alloc( + patcherVertexUsse = vita_mem_vertex_usse_alloc( patcherVertexUsseSize, &data->patcherVertexUsseUid, &patcherVertexUsseOffset); - patcherFragmentUsse = mem_fragment_usse_alloc( + patcherFragmentUsse = vita_mem_fragment_usse_alloc( patcherFragmentUsseSize, &data->patcherFragmentUsseUid, &patcherFragmentUsseOffset); @@ -728,7 +730,7 @@ gxm_init(SDL_Renderer *renderer) } // create the clear triangle vertex/index data - data->clearVertices = (clear_vertex *)mem_gpu_alloc( + data->clearVertices = (clear_vertex *)vita_mem_alloc( SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE, 3*sizeof(clear_vertex), 4, @@ -740,7 +742,7 @@ gxm_init(SDL_Renderer *renderer) // Allocate a 64k * 2 bytes = 128 KiB buffer and store all possible // 16-bit indices in linear ascending order, so we can use this for // all drawing operations where we don't want to use indexing. - data->linearIndices = (uint16_t *)mem_gpu_alloc( + data->linearIndices = (uint16_t *)vita_mem_alloc( SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE, UINT16_MAX*sizeof(uint16_t), sizeof(uint16_t), @@ -871,7 +873,7 @@ gxm_init(SDL_Renderer *renderer) data->textureWvpParam = (SceGxmProgramParameter *)sceGxmProgramFindParameterByName(textureVertexProgramGxp, "wvp"); // Allocate memory for the memory pool - data->pool_addr[0] = mem_gpu_alloc( + data->pool_addr[0] = vita_mem_alloc( SCE_KERNEL_MEMBLOCK_TYPE_USER_RW, VITA_GXM_POOL_SIZE, sizeof(void *), @@ -879,7 +881,7 @@ gxm_init(SDL_Renderer *renderer) &data->poolUid[0] ); - data->pool_addr[1] = mem_gpu_alloc( + data->pool_addr[1] = vita_mem_alloc( SCE_KERNEL_MEMBLOCK_TYPE_USER_RW, VITA_GXM_POOL_SIZE, sizeof(void *), @@ -918,28 +920,28 @@ void gxm_finish(SDL_Renderer *renderer) free_fragment_programs(data, &data->blendFragmentPrograms.blend_mode_mod); free_fragment_programs(data, &data->blendFragmentPrograms.blend_mode_mul); - mem_gpu_free(data->linearIndicesUid); - mem_gpu_free(data->clearVerticesUid); + vita_mem_free(data->linearIndicesUid); + vita_mem_free(data->clearVerticesUid); // wait until display queue is finished before deallocating display buffers sceGxmDisplayQueueFinish(); // clean up display queue - mem_gpu_free(data->depthBufferUid); + vita_mem_free(data->depthBufferUid); for (size_t i = 0; i < VITA_GXM_BUFFERS; i++) { // clear the buffer then deallocate SDL_memset(data->displayBufferData[i], 0, VITA_GXM_SCREEN_HEIGHT * VITA_GXM_SCREEN_STRIDE * 4); - mem_gpu_free(data->displayBufferUid[i]); + vita_mem_free(data->displayBufferUid[i]); // destroy the sync object sceGxmSyncObjectDestroy(data->displayBufferSync[i]); } // Free the depth and stencil buffer - mem_gpu_free(data->depthBufferUid); - mem_gpu_free(data->stencilBufferUid); + vita_mem_free(data->depthBufferUid); + vita_mem_free(data->stencilBufferUid); // unregister programs and destroy shader patcher sceGxmShaderPatcherUnregisterProgram(data->shaderPatcher, data->clearFragmentProgramId); @@ -950,23 +952,24 @@ void gxm_finish(SDL_Renderer *renderer) sceGxmShaderPatcherUnregisterProgram(data->shaderPatcher, data->textureVertexProgramId); sceGxmShaderPatcherDestroy(data->shaderPatcher); - mem_fragment_usse_free(data->patcherFragmentUsseUid); - mem_vertex_usse_free(data->patcherVertexUsseUid); - mem_gpu_free(data->patcherBufferUid); + vita_mem_fragment_usse_free(data->patcherFragmentUsseUid); + vita_mem_vertex_usse_free(data->patcherVertexUsseUid); + vita_mem_free(data->patcherBufferUid); // destroy the render target sceGxmDestroyRenderTarget(data->renderTarget); // destroy the gxm context sceGxmDestroyContext(data->gxm_context); - mem_fragment_usse_free(data->fragmentUsseRingBufferUid); - mem_gpu_free(data->fragmentRingBufferUid); - mem_gpu_free(data->vertexRingBufferUid); - mem_gpu_free(data->vdmRingBufferUid); + vita_mem_fragment_usse_free(data->fragmentUsseRingBufferUid); + vita_mem_free(data->fragmentRingBufferUid); + vita_mem_free(data->vertexRingBufferUid); + vita_mem_free(data->vdmRingBufferUid); SDL_free(data->contextParams.hostMem); - mem_gpu_free(data->poolUid[0]); - mem_gpu_free(data->poolUid[1]); + vita_mem_free(data->poolUid[0]); + vita_mem_free(data->poolUid[1]); + vita_gpu_mem_destroy(data); // terminate libgxm sceGxmTerminate(); @@ -975,16 +978,20 @@ void gxm_finish(SDL_Renderer *renderer) // textures void -free_gxm_texture(gxm_texture *texture) +free_gxm_texture(VITA_GXM_RenderData *data, gxm_texture *texture) { if (texture) { if (texture->gxm_rendertarget) { sceGxmDestroyRenderTarget(texture->gxm_rendertarget); } if (texture->depth_UID) { - mem_gpu_free(texture->depth_UID); + vita_mem_free(texture->depth_UID); + } + if (texture->cdram) { + vita_gpu_mem_free(data, sceGxmTextureGetData(&texture->gxm_tex)); + } else { + vita_mem_free(texture->data_UID); } - mem_gpu_free(texture->data_UID); SDL_free(texture); } } @@ -995,60 +1002,80 @@ gxm_texture_get_format(const gxm_texture *texture) return sceGxmTextureGetFormat(&texture->gxm_tex); } -unsigned int -gxm_texture_get_width(const gxm_texture *texture) -{ - return sceGxmTextureGetWidth(&texture->gxm_tex); -} - -unsigned int -gxm_texture_get_height(const gxm_texture *texture) -{ - return sceGxmTextureGetHeight(&texture->gxm_tex); -} - -unsigned int -gxm_texture_get_stride(const gxm_texture *texture) -{ - return ((gxm_texture_get_width(texture) + 7) & ~7) - * tex_format_to_bytespp(gxm_texture_get_format(texture)); -} - void * gxm_texture_get_datap(const gxm_texture *texture) { 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) +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) { gxm_texture *texture = SDL_calloc(1, sizeof(gxm_texture)); - const int tex_size = ((w + 7) & ~ 7) * h * tex_format_to_bytespp(format); + int aligned_w = ALIGN(w, 8); + int texture_w = w; + int tex_size = aligned_w * h * tex_format_to_bytespp(format); void *texture_data; + int ret; + + *return_wscale = 1.0f; + + // SCE_GXM_TEXTURE_BASE_FORMAT_YUV420P3/P2 based formats require width aligned to 16 + if ( (format & 0x9f000000U) == SCE_GXM_TEXTURE_BASE_FORMAT_YUV420P3 || (format & 0x9f000000U) == SCE_GXM_TEXTURE_BASE_FORMAT_YUV420P2) { + aligned_w = ALIGN(w, 16); + texture_w = aligned_w; + tex_size = aligned_w * h * tex_format_to_bytespp(format); + *return_wscale = (float) (w) / texture_w; + // add storage for UV planes + tex_size += (((aligned_w + 1) / 2) * ((h + 1) / 2)) * 2; + } if (!texture) return NULL; + *return_w = w; + *return_h = h; + *return_pitch = aligned_w * tex_format_to_bytespp(format); + /* Allocate a GPU buffer for the texture */ - texture_data = mem_gpu_alloc( - SCE_KERNEL_MEMBLOCK_TYPE_USER_CDRAM_RW, - tex_size, - SCE_GXM_TEXTURE_ALIGNMENT, - SCE_GXM_MEMORY_ATTRIB_READ | SCE_GXM_MEMORY_ATTRIB_WRITE, - &texture->data_UID + texture_data = vita_gpu_mem_alloc( + data, + tex_size ); /* Try SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE in case we're out of VRAM */ if (!texture_data) { SDL_LogWarn(SDL_LOG_CATEGORY_RENDER, "CDRAM texture allocation failed\n"); - texture_data = mem_gpu_alloc( + texture_data = vita_mem_alloc( SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE, tex_size, SCE_GXM_TEXTURE_ALIGNMENT, SCE_GXM_MEMORY_ATTRIB_READ | SCE_GXM_MEMORY_ATTRIB_WRITE, &texture->data_UID ); + texture->cdram = 0; + } else { + texture->cdram = 1; } if (!texture_data) { @@ -1060,7 +1087,12 @@ create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsigned int h, Sc SDL_memset(texture_data, 0, tex_size); /* Create the gxm texture */ - sceGxmTextureInitLinear( &texture->gxm_tex, texture_data, format, w, h, 0); + ret = sceGxmTextureInitLinear( &texture->gxm_tex, texture_data, format, texture_w, h, 0); + if (ret < 0) { + free_gxm_texture(data, texture); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "texture init failed: %x\n", ret); + return NULL; + } if (isRenderTarget) { void *depthBufferData; @@ -1070,9 +1102,10 @@ create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsigned int h, Sc 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, @@ -1083,13 +1116,13 @@ create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsigned int h, Sc ); if (err < 0) { - free_gxm_texture(texture); - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "color surface init failed: %d\n", err); + free_gxm_texture(data, texture); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "color surface init failed: %x\n", err); return NULL; } // allocate it - depthBufferData = mem_gpu_alloc( + depthBufferData = vita_mem_alloc( SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE, 4*sampleCount, SCE_GXM_DEPTHSTENCIL_SURFACE_ALIGNMENT, @@ -1106,8 +1139,8 @@ create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsigned int h, Sc NULL); if (err < 0) { - free_gxm_texture(texture); - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "depth stencil init failed: %d\n", err); + free_gxm_texture(data, texture); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "depth stencil init failed: %x\n", err); return NULL; } @@ -1131,8 +1164,8 @@ create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsigned int h, Sc texture->gxm_rendertarget = tgt; if (err < 0) { - free_gxm_texture(texture); - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create render target failed: %d\n", err); + free_gxm_texture(data, texture); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create render target failed: %x\n", err); return NULL; } } @@ -1181,7 +1214,7 @@ void gxm_init_for_common_dialog(void) for (int i = 0; i < VITA_GXM_BUFFERS; i += 1) { buffer_for_common_dialog[i].displayData.wait_vblank = SDL_TRUE; - buffer_for_common_dialog[i].displayData.address = mem_gpu_alloc( + buffer_for_common_dialog[i].displayData.address = vita_mem_alloc( SCE_KERNEL_MEMBLOCK_TYPE_USER_CDRAM_RW, 4 * VITA_GXM_SCREEN_STRIDE * VITA_GXM_SCREEN_HEIGHT, SCE_GXM_COLOR_SURFACE_ALIGNMENT, @@ -1229,7 +1262,7 @@ void gxm_term_for_common_dialog(void) sceGxmDisplayQueueFinish(); for (int i = 0; i < VITA_GXM_BUFFERS; i += 1) { - mem_gpu_free(buffer_for_common_dialog[i].uid); + vita_mem_free(buffer_for_common_dialog[i].uid); sceGxmSyncObjectDestroy(buffer_for_common_dialog[i].sync); } } diff --git a/libs/SDL2/src/render/vitagxm/SDL_render_vita_gxm_tools.h b/libs/SDL2/src/render/vitagxm/SDL_render_vita_gxm_tools.h index 351bdc2e..67659889 100644 --- a/libs/SDL2/src/render/vitagxm/SDL_render_vita_gxm_tools.h +++ b/libs/SDL2/src/render/vitagxm/SDL_render_vita_gxm_tools.h @@ -48,15 +48,12 @@ void unset_clip_rectangle(VITA_GXM_RenderData *data); int gxm_init(SDL_Renderer *renderer); void gxm_finish(SDL_Renderer *renderer); -gxm_texture *create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsigned int h, SceGxmTextureFormat format, unsigned int isRenderTarget); -void free_gxm_texture(gxm_texture *texture); +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); +void free_gxm_texture(VITA_GXM_RenderData *data, gxm_texture *texture); void gxm_texture_set_filters(gxm_texture *texture, SceGxmTextureFilter min_filter, SceGxmTextureFilter mag_filter); SceGxmTextureFormat gxm_texture_get_format(const gxm_texture *texture); -unsigned int gxm_texture_get_width(const gxm_texture *texture); -unsigned int gxm_texture_get_height(const gxm_texture *texture); -unsigned int gxm_texture_get_stride(const gxm_texture *texture); void *gxm_texture_get_datap(const gxm_texture *texture); void gxm_minimal_init_for_common_dialog(void); diff --git a/libs/SDL2/src/render/vitagxm/SDL_render_vita_gxm_types.h b/libs/SDL2/src/render/vitagxm/SDL_render_vita_gxm_types.h index 898a92d9..c5cbf589 100644 --- a/libs/SDL2/src/render/vitagxm/SDL_render_vita_gxm_types.h +++ b/libs/SDL2/src/render/vitagxm/SDL_render_vita_gxm_types.h @@ -33,6 +33,7 @@ #include #include #include +#include #include @@ -79,6 +80,7 @@ typedef struct gxm_texture { SceGxmColorSurface gxm_colorsurface; SceGxmDepthStencilSurface gxm_depthstencil; SceUID depth_UID; + SDL_bool cdram; } gxm_texture; typedef struct fragment_programs { @@ -186,14 +188,19 @@ typedef struct blend_fragment_programs blendFragmentPrograms; gxm_drawstate_cache drawstate; + SceClibMspace texturePool; + SceUID texturePoolUID; } VITA_GXM_RenderData; typedef struct { gxm_texture *tex; - unsigned int pitch; - unsigned int w; - unsigned int h; + unsigned int pitch; + unsigned int w; + unsigned int h; + float wscale; + SDL_bool yuv; + SDL_bool nv12; } VITA_GXM_TextureData; #endif /* SDL_RENDER_VITA_GXM_TYPES_H */ diff --git a/libs/SDL2/src/sensor/windows/SDL_windowssensor.c b/libs/SDL2/src/sensor/windows/SDL_windowssensor.c index bb8d39ed..21b119d2 100644 --- a/libs/SDL2/src/sensor/windows/SDL_windowssensor.c +++ b/libs/SDL2/src/sensor/windows/SDL_windowssensor.c @@ -325,7 +325,10 @@ static int DisconnectSensor(ISensor *sensor) for (i = 0; i < SDL_num_sensors; ++i) { old_sensor = &SDL_sensors[i]; if (sensor == old_sensor->sensor) { - ISensor_SetEventSink(sensor, NULL); + /* This call hangs for some reason: + * https://github.com/libsdl-org/SDL/issues/5288 + */ + /*ISensor_SetEventSink(sensor, NULL);*/ ISensor_Release(sensor); SDL_free(old_sensor->name); --SDL_num_sensors; diff --git a/libs/SDL2/src/stdlib/SDL_getenv.c b/libs/SDL2/src/stdlib/SDL_getenv.c index d54cfe9e..b74974c3 100644 --- a/libs/SDL2/src/stdlib/SDL_getenv.c +++ b/libs/SDL2/src/stdlib/SDL_getenv.c @@ -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; @@ -48,18 +48,18 @@ int SDL_setenv(const char *name, const char *value, int overwrite) { /* Input validation */ - if (!name || SDL_strlen(name) == 0 || SDL_strchr(name, '=') != NULL || !value) { + if (!name || *name == '\0' || SDL_strchr(name, '=') != NULL || !value) { return (-1); } return setenv(name, value, overwrite); } -#elif defined(__WIN32__) +#elif defined(__WIN32__) || defined(__WINGDK__) int SDL_setenv(const char *name, const char *value, int overwrite) { /* Input validation */ - if (!name || SDL_strlen(name) == 0 || SDL_strchr(name, '=') != NULL || !value) { + if (!name || *name == '\0' || SDL_strchr(name, '=') != NULL || !value) { return (-1); } @@ -82,7 +82,7 @@ SDL_setenv(const char *name, const char *value, int overwrite) char *new_variable; /* Input validation */ - if (!name || SDL_strlen(name) == 0 || SDL_strchr(name, '=') != NULL || !value) { + if (!name || *name == '\0' || SDL_strchr(name, '=') != NULL || !value) { return (-1); } @@ -115,7 +115,7 @@ SDL_setenv(const char *name, const char *value, int overwrite) char *new_variable; /* Input validation */ - if (!name || SDL_strlen(name) == 0 || SDL_strchr(name, '=') != NULL || !value) { + if (!name || *name == '\0' || SDL_strchr(name, '=') != NULL || !value) { return (-1); } @@ -181,20 +181,20 @@ SDL_getenv(const char *name) #endif /* Input validation */ - if (!name || !*name) { + if (!name || *name == '\0') { return NULL; } return getenv(name); } -#elif defined(__WIN32__) +#elif defined(__WIN32__) || defined(__WINGDK__) char * SDL_getenv(const char *name) { size_t bufferlen; /* Input validation */ - if (!name || SDL_strlen(name)==0) { + if (!name || *name == '\0') { return NULL; } @@ -222,7 +222,7 @@ SDL_getenv(const char *name) char *value; /* Input validation */ - if (!name || SDL_strlen(name)==0) { + if (!name || *name == '\0') { return NULL; } diff --git a/libs/SDL2/src/stdlib/SDL_iconv.c b/libs/SDL2/src/stdlib/SDL_iconv.c index c88731b8..bee60d50 100644 --- a/libs/SDL2/src/stdlib/SDL_iconv.c +++ b/libs/SDL2/src/stdlib/SDL_iconv.c @@ -36,18 +36,6 @@ #define LIBICONV_PLUG 1 #endif #include - -/* Depending on which standard the iconv() was implemented with, - iconv() may or may not use const char ** for the inbuf param. - If we get this wrong, it's just a warning, so no big deal. -*/ -#if defined(_XGP6) || defined(__APPLE__) || defined(__RISCOS__) || defined(__FREEBSD__) || \ - defined(__EMSCRIPTEN__) || \ - (defined(__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) || \ - (defined(_NEWLIB_VERSION))) -#define ICONV_INBUF_NONCONST -#endif - #include SDL_COMPILE_TIME_ASSERT(iconv_t, sizeof (iconv_t) <= sizeof (SDL_iconv_t)); @@ -69,12 +57,9 @@ SDL_iconv(SDL_iconv_t cd, const char **inbuf, size_t * inbytesleft, char **outbuf, size_t * outbytesleft) { - size_t retCode; -#ifdef ICONV_INBUF_NONCONST - retCode = iconv((iconv_t) ((uintptr_t) cd), (char **) inbuf, inbytesleft, outbuf, outbytesleft); -#else - retCode = iconv((iconv_t) ((uintptr_t) cd), inbuf, inbytesleft, outbuf, outbytesleft); -#endif + /* iconv's second parameter may or may not be `const char const *` depending on the + C runtime's whims. Casting to void * seems to make everyone happy, though. */ + const size_t retCode = iconv((iconv_t) ((uintptr_t) cd), (void *) inbuf, inbytesleft, outbuf, outbytesleft); if (retCode == (size_t) - 1) { switch (errno) { case E2BIG: @@ -141,12 +126,12 @@ static struct 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 }, @@ -175,7 +160,7 @@ static struct { "UCS-4LE", ENCODING_UCS4LE }, { "UCS-4BE", ENCODING_UCS4BE }, { "UCS-4-INTERNAL", ENCODING_UCS4NATIVE }, -/* *INDENT-ON* */ +/* *INDENT-ON* */ /* clang-format on */ }; static const char * diff --git a/libs/SDL2/src/stdlib/SDL_malloc.c b/libs/SDL2/src/stdlib/SDL_malloc.c index b5dd6414..980120bc 100644 --- a/libs/SDL2/src/stdlib/SDL_malloc.c +++ b/libs/SDL2/src/stdlib/SDL_malloc.c @@ -487,7 +487,9 @@ DEFAULT_MMAP_THRESHOLD default: 256K #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 @@ extern "C" 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 @@ extern "C" 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 @@ extern "C" 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); @@ -5305,10 +5307,10 @@ History: #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 @@ static struct 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 --git a/libs/SDL2/src/stdlib/SDL_memcpy.c b/libs/SDL2/src/stdlib/SDL_memcpy.c new file mode 100644 index 00000000..bedbce8f --- /dev/null +++ b/libs/SDL2/src/stdlib/SDL_memcpy.c @@ -0,0 +1,79 @@ +/* + 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 contains a portable memcpy manipulation function for SDL */ + +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__ */ +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/stdlib/SDL_memset.c b/libs/SDL2/src/stdlib/SDL_memset.c new file mode 100644 index 00000000..c2a48759 --- /dev/null +++ b/libs/SDL2/src/stdlib/SDL_memset.c @@ -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" + +/* This file contains a portable memset manipulation function for SDL */ + +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 */ +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/stdlib/SDL_qsort.c b/libs/SDL2/src/stdlib/SDL_qsort.c index b175f444..26e97c90 100644 --- a/libs/SDL2/src/stdlib/SDL_qsort.c +++ b/libs/SDL2/src/stdlib/SDL_qsort.c @@ -534,5 +534,38 @@ extern void qsortG(void *base, size_t nmemb, size_t size, #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 --git a/libs/SDL2/src/stdlib/SDL_stdlib.c b/libs/SDL2/src/stdlib/SDL_stdlib.c index 9d785aad..62cbef88 100644 --- a/libs/SDL2/src/stdlib/SDL_stdlib.c +++ b/libs/SDL2/src/stdlib/SDL_stdlib.c @@ -549,8 +549,9 @@ int SDL_isblank(int x) { return ((x) == ' ') || ((x) == '\t'); } __declspec(selectany) int _fltused = 1; #endif -/* The optimizer on Visual Studio 2005 and later generates memcpy() and memset() calls */ -#if _MSC_VER >= 1400 +/* 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) @@ -570,7 +571,7 @@ memset(void *dst, int c, size_t len) { return SDL_memset(dst, c, len); } -#endif /* _MSC_VER >= 1400 */ +#endif /* (_MSC_VER >= 1400) && (!defined(_MT) || defined(DLL_EXPORT)) */ #ifdef _M_IX86 diff --git a/libs/SDL2/src/stdlib/SDL_string.c b/libs/SDL2/src/stdlib/SDL_string.c index 695fccbc..fa1bcc10 100644 --- a/libs/SDL2/src/stdlib/SDL_string.c +++ b/libs/SDL2/src/stdlib/SDL_string.c @@ -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 @@ static unsigned UTF8_TrailingBytes(unsigned char c) #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 @@ SDL_ScanLong(const char *text, int radix, long *valuep) value *= radix; value += v; ++text; + + if (count > 0 && (text - textstart) == count) { + break; + } } if (valuep && text > textstart) { if (negative && value) { @@ -99,7 +96,7 @@ SDL_ScanLong(const char *text, int radix, long *valuep) #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 @@ SDL_ScanUnsignedLong(const char *text, int radix, unsigned long *valuep) value *= radix; value += v; ++text; + + if (count > 0 && (text - textstart) == count) { + break; + } } if (valuep && text > textstart) { *valuep = value; @@ -163,7 +164,7 @@ SDL_ScanUintPtrT(const char *text, int radix, uintptr_t * valuep) #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 @@ SDL_ScanLongLong(const char *text, int radix, Sint64 * valuep) value *= radix; value += v; ++text; + + if (count > 0 && (text - textstart) == count) { + break; + } } if (valuep && text > textstart) { if (negative && value) { @@ -204,7 +209,7 @@ SDL_ScanLongLong(const char *text, int radix, Sint64 * valuep) #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 @@ SDL_ScanUnsignedLongLong(const char *text, int radix, Uint64 * valuep) value *= radix; value += v; ++text; + + if (count > 0 && (text - textstart) == count) { + break; + } } if (valuep && text > textstart) { *valuep = value; @@ -247,7 +256,7 @@ SDL_ScanFloat(const char *text, double *valuep) negative = SDL_TRUE; ++text; } - text += SDL_ScanUnsignedLong(text, 10, &lvalue); + text += SDL_ScanUnsignedLong(text, 0, 10, &lvalue); value += lvalue; if (*text == '.') { int mult = 10; @@ -270,108 +279,6 @@ SDL_ScanFloat(const char *text, double *valuep) } #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) { @@ -641,19 +548,16 @@ SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_ size_t bytes = SDL_min(src_bytes, dst_bytes - 1); size_t i = 0; unsigned char trailing_bytes = 0; - if (bytes) - { + + if (bytes) { unsigned char c = (unsigned char)src[bytes - 1]; - if (UTF8_IsLeadByte(c)) + if (UTF8_IsLeadByte(c)) { --bytes; - else if (UTF8_IsTrailingByte(c)) - { - for (i = bytes - 1; i != 0; --i) - { + } else if (UTF8_IsTrailingByte(c)) { + for (i = bytes - 1; i != 0; --i) { c = (unsigned char)src[i]; trailing_bytes = UTF8_TrailingBytes(c); - if (trailing_bytes) - { + if (trailing_bytes) { if (bytes - i != trailing_bytes + 1) bytes = i; @@ -664,6 +568,7 @@ SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_ SDL_memcpy(dst, src, bytes); } dst[bytes] = '\0'; + return bytes; } @@ -684,6 +589,23 @@ SDL_utf8strlen(const char *str) return retval; } +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) { @@ -966,7 +888,7 @@ SDL_strtol(const char *string, char **endp, int base) } } - len = SDL_ScanLong(string, base, &value); + len = SDL_ScanLong(string, 0, base, &value); if (endp) { *endp = (char *) string + len; } @@ -991,7 +913,7 @@ SDL_strtoul(const char *string, char **endp, int base) } } - len = SDL_ScanUnsignedLong(string, base, &value); + len = SDL_ScanUnsignedLong(string, 0, base, &value); if (endp) { *endp = (char *) string + len; } @@ -1016,7 +938,7 @@ SDL_strtoll(const char *string, char **endp, int base) } } - len = SDL_ScanLongLong(string, base, &value); + len = SDL_ScanLongLong(string, 0, base, &value); if (endp) { *endp = (char *) string + len; } @@ -1041,7 +963,7 @@ SDL_strtoull(const char *string, char **endp, int base) } } - len = SDL_ScanUnsignedLongLong(string, base, &value); + len = SDL_ScanUnsignedLongLong(string, 0, base, &value); if (endp) { *endp = (char *) string + len; } @@ -1072,13 +994,16 @@ SDL_strcmp(const char *str1, const char *str2) #if defined(HAVE_STRCMP) return strcmp(str1, str2); #else - while (*str1 && *str2) { - if (*str1 != *str2) + int result; + + while(1) { + result = (int)((unsigned char) *str1 - (unsigned char) *str2); + if (result != 0 || (*str1 == '\0'/* && *str2 == '\0'*/)) break; ++str1; ++str2; } - return (int)((unsigned char) *str1 - (unsigned char) *str2); + return result; #endif /* HAVE_STRCMP */ } @@ -1088,17 +1013,20 @@ SDL_strncmp(const char *str1, const char *str2, size_t maxlen) #if defined(HAVE_STRNCMP) return strncmp(str1, str2, maxlen); #else - while (*str1 && *str2 && maxlen) { - if (*str1 != *str2) + int result; + + while (maxlen) { + result = (int) (unsigned char) *str1 - (unsigned char) *str2; + if (result != 0 || *str1 == '\0'/* && *str2 == '\0'*/) break; ++str1; ++str2; --maxlen; } if (!maxlen) { - return 0; + result = 0; } - return (int) ((unsigned char) *str1 - (unsigned char) *str2); + return result; #endif /* HAVE_STRNCMP */ } @@ -1110,19 +1038,18 @@ SDL_strcasecmp(const char *str1, const char *str2) #elif defined(HAVE__STRICMP) return _stricmp(str1, str2); #else - char a = 0; - char b = 0; - while (*str1 && *str2) { + int a, b, result; + + while (1) { a = SDL_toupper((unsigned char) *str1); b = SDL_toupper((unsigned char) *str2); - if (a != b) + result = a - b; + if (result != 0 || a == 0 /*&& b == 0*/) break; ++str1; ++str2; } - a = SDL_toupper(*str1); - b = SDL_toupper(*str2); - return (int) ((unsigned char) a - (unsigned char) b); + return result; #endif /* HAVE_STRCASECMP */ } @@ -1134,24 +1061,21 @@ SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen) #elif defined(HAVE__STRNICMP) return _strnicmp(str1, str2, maxlen); #else - char a = 0; - char b = 0; - while (*str1 && *str2 && maxlen) { + int a, b, result; + + while (maxlen) { a = SDL_tolower((unsigned char) *str1); b = SDL_tolower((unsigned char) *str2); - if (a != b) + result = a - b; + if (result != 0 || a == 0 /*&& b == 0*/) break; ++str1; ++str2; --maxlen; } - if (maxlen == 0) { - return 0; - } else { - a = SDL_tolower((unsigned char) *str1); - b = SDL_tolower((unsigned char) *str2); - return (int) ((unsigned char) a - (unsigned char) b); - } + if (maxlen == 0) + result = 0; + return result; #endif /* HAVE_STRNCASECMP */ } @@ -1217,7 +1141,7 @@ SDL_vsscanf(const char *text, const char *fmt, va_list ap) suppress = SDL_TRUE; ++fmt; } - fmt += SDL_ScanLong(fmt, 10, &count); + fmt += SDL_ScanLong(fmt, 0, 10, &count); if (*fmt == 'c') { if (!count) { @@ -1281,7 +1205,7 @@ SDL_vsscanf(const char *text, const char *fmt, va_list ap) case 'd': if (inttype == DO_LONGLONG) { Sint64 value; - advance = SDL_ScanLongLong(text, radix, &value); + advance = SDL_ScanLongLong(text, count, radix, &value); text += advance; if (advance && !suppress) { Sint64 *valuep = va_arg(ap, Sint64 *); @@ -1290,7 +1214,7 @@ SDL_vsscanf(const char *text, const char *fmt, va_list ap) } } else { long value; - advance = SDL_ScanLong(text, radix, &value); + advance = SDL_ScanLong(text, count, radix, &value); text += advance; if (advance && !suppress) { switch (inttype) { @@ -1335,7 +1259,7 @@ SDL_vsscanf(const char *text, const char *fmt, va_list ap) 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 +1268,7 @@ SDL_vsscanf(const char *text, const char *fmt, va_list ap) } } 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 --git a/libs/SDL2/src/stdlib/SDL_vacopy.h b/libs/SDL2/src/stdlib/SDL_vacopy.h new file mode 100644 index 00000000..ab600469 --- /dev/null +++ b/libs/SDL2/src/stdlib/SDL_vacopy.h @@ -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 --git a/libs/SDL2/src/test/SDL_test_common.c b/libs/SDL2/src/test/SDL_test_common.c index 48c6c72f..44013f67 100644 --- a/libs/SDL2/src/test/SDL_test_common.c +++ b/libs/SDL2/src/test/SDL_test_common.c @@ -1196,7 +1196,7 @@ SDLTest_CommonInit(SDLTest_CommonState * state) } } -#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,10 +1464,12 @@ default: return "???"; 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: diff --git a/libs/SDL2/src/test/SDL_test_font.c b/libs/SDL2/src/test/SDL_test_font.c index 4129f3da..91a620fd 100644 --- a/libs/SDL2/src/test/SDL_test_font.c +++ b/libs/SDL2/src/test/SDL_test_font.c @@ -24,17 +24,24 @@ /* ---- 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 +; +*/ -/* ZLIB (c) A. Schiffler 2012 */ - -#define SDL_TESTFONTDATAMAX (8*256) - -static unsigned char SDLTest_FontData[SDL_TESTFONTDATAMAX] = { +static unsigned char SDLTest_FontData[] = { /* - * 0 0x00 '^@' - */ + * 0 0x00 '^@' + */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ @@ -45,1667 +52,2856 @@ static unsigned char SDLTest_FontData[SDL_TESTFONTDATAMAX] = { 0x00, /* 00000000 */ /* - * 1 0x01 '^A' - */ + * 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 */ + + /* + * 37 0x25 '%' + */ + 0x00, /* 00000000 */ + 0x63, /* 11000110 */ + 0x33, /* 11001100 */ + 0x18, /* 00011000 */ + 0x0c, /* 00110000 */ + 0x66, /* 01100110 */ + 0x63, /* 11000110 */ + 0x00, /* 00000000 */ + + /* + * 38 0x26 '&' + */ + 0x1c, /* 00111000 */ + 0x36, /* 01101100 */ + 0x1c, /* 00111000 */ + 0x6e, /* 01110110 */ + 0x3b, /* 11011100 */ + 0x33, /* 11001100 */ + 0x6e, /* 01110110 */ + 0x00, /* 00000000 */ + + /* + * 39 0x27 ''' + */ + 0x06, /* 01100000 */ + 0x06, /* 01100000 */ + 0x03, /* 11000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 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 */ + + /* + * 44 0x2c ',' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x06, /* 01100000 */ + + /* + * 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 */ + + /* + * 83 0x53 'S' + */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x07, /* 11100000 */ + 0x0e, /* 01110000 */ + 0x38, /* 00011100 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ + 0x00, /* 00000000 */ + + /* + * 84 0x54 'T' + */ + 0x3f, /* 11111100 */ + 0x2d, /* 10110100 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x1e, /* 01111000 */ + 0x00, /* 00000000 */ + + /* + * 85 0x55 'U' + */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x3f, /* 11111100 */ + 0x00, /* 00000000 */ + + /* + * 86 0x56 'V' + */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ + 0x0c, /* 00110000 */ + 0x00, /* 00000000 */ + + /* + * 87 0x57 'W' + */ + 0x63, /* 11000110 */ + 0x63, /* 11000110 */ + 0x63, /* 11000110 */ + 0x6b, /* 11010110 */ + 0x7f, /* 11111110 */ + 0x77, /* 11101110 */ + 0x63, /* 11000110 */ + 0x00, /* 00000000 */ + + /* + * 88 0x58 'X' + */ + 0x63, /* 11000110 */ + 0x63, /* 11000110 */ + 0x36, /* 01101100 */ + 0x1c, /* 00111000 */ + 0x1c, /* 00111000 */ + 0x36, /* 01101100 */ + 0x63, /* 11000110 */ + 0x00, /* 00000000 */ + + /* + * 89 0x59 'Y' + */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x1e, /* 01111000 */ + 0x00, /* 00000000 */ + + /* + * 90 0x5a 'Z' + */ + 0x7f, /* 11111110 */ + 0x63, /* 11000110 */ + 0x31, /* 10001100 */ + 0x18, /* 00011000 */ + 0x4c, /* 00110010 */ + 0x66, /* 01100110 */ + 0x7f, /* 11111110 */ + 0x00, /* 00000000 */ + + /* + * 91 0x5b '[' + */ + 0x1e, /* 01111000 */ + 0x06, /* 01100000 */ + 0x06, /* 01100000 */ + 0x06, /* 01100000 */ + 0x06, /* 01100000 */ + 0x06, /* 01100000 */ + 0x1e, /* 01111000 */ + 0x00, /* 00000000 */ + + /* + * 92 0x5c '\' + */ + 0x03, /* 11000000 */ + 0x06, /* 01100000 */ + 0x0c, /* 00110000 */ + 0x18, /* 00011000 */ + 0x30, /* 00001100 */ + 0x60, /* 00000110 */ + 0x40, /* 00000010 */ + 0x00, /* 00000000 */ + + /* + * 93 0x5d ']' + */ + 0x1e, /* 01111000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x1e, /* 01111000 */ + 0x00, /* 00000000 */ + + /* + * 94 0x5e '^' + */ + 0x08, /* 00010000 */ + 0x1c, /* 00111000 */ + 0x36, /* 01101100 */ + 0x63, /* 11000110 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 95 0x5f '_' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0xff, /* 11111111 */ + + /* + * 96 0x60 '`' + */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 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 */ + 0x00, /* 00000000 */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x03, /* 11000000 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ + 0x00, /* 00000000 */ + + /* + * 100 0x64 'd' + */ + 0x38, /* 00011100 */ + 0x30, /* 00001100 */ + 0x30, /* 00001100 */ + 0x3e, /* 01111100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x6e, /* 01110110 */ + 0x00, /* 00000000 */ + + /* + * 101 0x65 'e' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x3f, /* 11111100 */ + 0x03, /* 11000000 */ + 0x1e, /* 01111000 */ + 0x00, /* 00000000 */ + + /* + * 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 */ + + /* + * 105 0x69 'i' + */ + 0x0c, /* 00110000 */ + 0x00, /* 00000000 */ + 0x0e, /* 01110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x1e, /* 01111000 */ + 0x00, /* 00000000 */ + + /* + * 106 0x6a 'j' + */ + 0x30, /* 00001100 */ + 0x00, /* 00000000 */ + 0x30, /* 00001100 */ + 0x30, /* 00001100 */ + 0x30, /* 00001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ + + /* + * 107 0x6b 'k' + */ + 0x07, /* 11100000 */ + 0x06, /* 01100000 */ + 0x66, /* 01100110 */ + 0x36, /* 01101100 */ + 0x1e, /* 01111000 */ + 0x36, /* 01101100 */ + 0x67, /* 11100110 */ + 0x00, /* 00000000 */ + + /* + * 108 0x6c 'l' + */ + 0x0e, /* 01110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x1e, /* 01111000 */ + 0x00, /* 00000000 */ + + /* + * 109 0x6d 'm' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x33, /* 11001100 */ + 0x7f, /* 11111110 */ + 0x7f, /* 11111110 */ + 0x6b, /* 11010110 */ + 0x63, /* 11000110 */ + 0x00, /* 00000000 */ + + /* + * 110 0x6e 'n' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x1f, /* 11111000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x00, /* 00000000 */ + + /* + * 111 0x6f 'o' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ + 0x00, /* 00000000 */ + + /* + * 112 0x70 'p' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x3b, /* 11011100 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 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 */ + + /* + * 114 0x72 'r' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x3b, /* 11011100 */ + 0x6e, /* 01110110 */ + 0x66, /* 01100110 */ + 0x06, /* 01100000 */ + 0x0f, /* 11110000 */ + 0x00, /* 00000000 */ + + /* + * 115 0x73 's' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x3e, /* 01111100 */ + 0x03, /* 11000000 */ + 0x1e, /* 01111000 */ + 0x30, /* 00001100 */ + 0x1f, /* 11111000 */ + 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 */ + + /* + * 119 0x77 'w' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x63, /* 11000110 */ + 0x6b, /* 11010110 */ + 0x7f, /* 11111110 */ + 0x7f, /* 11111110 */ + 0x36, /* 01101100 */ + 0x00, /* 00000000 */ + + /* + * 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 */ + + /* + * 122 0x7a 'z' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x3f, /* 11111100 */ + 0x19, /* 10011000 */ + 0x0c, /* 00110000 */ + 0x26, /* 01100100 */ + 0x3f, /* 11111100 */ + 0x00, /* 00000000 */ + + /* + * 123 0x7b '{' + */ + 0x38, /* 00011100 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x07, /* 11100000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x38, /* 00011100 */ + 0x00, /* 00000000 */ + + /* + * 124 0x7c '|' + */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + + /* + * 125 0x7d '}' + */ + 0x07, /* 11100000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x38, /* 00011100 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x07, /* 11100000 */ + 0x00, /* 00000000 */ + + /* + * 126 0x7e '~' + */ + 0x6e, /* 01110110 */ + 0x3b, /* 11011100 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 127 0x7f '^?' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 128 0x80 '€' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 129 0x81 '' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 130 0x82 '‚' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 131 0x83 'ƒ' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 132 0x84 '„' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 133 0x85 ' +' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 134 0x86 '†' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 135 0x87 '‡' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 136 0x88 'ˆ' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 137 0x89 '‰' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 138 0x8a 'Š' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 139 0x8b '‹' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 140 0x8c 'Œ' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 141 0x8d '' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 142 0x8e 'Ž' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 143 0x8f '' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 144 0x90 '' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 145 0x91 '‘' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 146 0x92 '’' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 147 0x93 '“' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 148 0x94 '”' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 149 0x95 '•' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 150 0x96 '–' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 151 0x97 '—' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 152 0x98 '˜' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 153 0x99 '™' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 154 0x9a 'š' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 155 0x9b '›' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 156 0x9c 'œ' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 157 0x9d '' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 158 0x9e 'ž' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 159 0x9f 'Ÿ' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 160 0xa0 ' ' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 161 0xa1 '¡' + */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + + /* + * 162 0xa2 '¢' + */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ 0x7e, /* 01111110 */ - 0x81, /* 10000001 */ + 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 */ + + /* + * 164 0xa4 '¤' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x63, /* 11000110 */ + 0x3e, /* 01111100 */ + 0x36, /* 01101100 */ + 0x3e, /* 01111100 */ + 0x63, /* 11000110 */ + 0x00, /* 00000000 */ + + /* + * 165 0xa5 '¥' + */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ + 0x3f, /* 11111100 */ + 0x0c, /* 00110000 */ + 0x3f, /* 11111100 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + + /* + * 166 0xa6 '¦' + */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + + /* + * 167 0xa7 '§' + */ + 0x7c, /* 00111110 */ + 0xc6, /* 01100011 */ + 0x1c, /* 00111000 */ + 0x36, /* 01101100 */ + 0x36, /* 01101100 */ + 0x1c, /* 00111000 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ + + /* + * 168 0xa8 '¨' + */ + 0x33, /* 11001100 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 169 0xa9 '©' + */ + 0x3c, /* 00111100 */ + 0x42, /* 01000010 */ + 0x99, /* 10011001 */ + 0x85, /* 10100001 */ + 0x85, /* 10100001 */ + 0x99, /* 10011001 */ + 0x42, /* 01000010 */ + 0x3c, /* 00111100 */ + + /* + * 170 0xaa 'ª' + */ + 0x3c, /* 00111100 */ + 0x36, /* 01101100 */ + 0x36, /* 01101100 */ + 0x7c, /* 00111110 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 171 0xab '«' + */ + 0x00, /* 00000000 */ + 0xcc, /* 00110011 */ + 0x66, /* 01100110 */ + 0x33, /* 11001100 */ + 0x66, /* 01100110 */ + 0xcc, /* 00110011 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 172 0xac '¬' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x3f, /* 11111100 */ + 0x30, /* 00001100 */ + 0x30, /* 00001100 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 173 0xad '­' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 174 0xae '®' + */ + 0x3c, /* 00111100 */ + 0x42, /* 01000010 */ + 0x9d, /* 10111001 */ + 0xa5, /* 10100101 */ + 0x9d, /* 10111001 */ 0xa5, /* 10100101 */ - 0x81, /* 10000001 */ - 0xbd, /* 10111101 */ - 0x99, /* 10011001 */ - 0x81, /* 10000001 */ - 0x7e, /* 01111110 */ - - /* - * 2 0x02 '^B' - */ - 0x7e, /* 01111110 */ - 0xff, /* 11111111 */ - 0xdb, /* 11011011 */ - 0xff, /* 11111111 */ - 0xc3, /* 11000011 */ - 0xe7, /* 11100111 */ - 0xff, /* 11111111 */ - 0x7e, /* 01111110 */ - - /* - * 3 0x03 '^C' - */ - 0x6c, /* 01101100 */ - 0xfe, /* 11111110 */ - 0xfe, /* 11111110 */ - 0xfe, /* 11111110 */ - 0x7c, /* 01111100 */ - 0x38, /* 00111000 */ - 0x10, /* 00010000 */ - 0x00, /* 00000000 */ - - /* - * 4 0x04 '^D' - */ - 0x10, /* 00010000 */ - 0x38, /* 00111000 */ - 0x7c, /* 01111100 */ - 0xfe, /* 11111110 */ - 0x7c, /* 01111100 */ - 0x38, /* 00111000 */ - 0x10, /* 00010000 */ - 0x00, /* 00000000 */ - - /* - * 5 0x05 '^E' - */ - 0x38, /* 00111000 */ - 0x7c, /* 01111100 */ - 0x38, /* 00111000 */ - 0xfe, /* 11111110 */ - 0xfe, /* 11111110 */ - 0xd6, /* 11010110 */ - 0x10, /* 00010000 */ - 0x38, /* 00111000 */ - - /* - * 6 0x06 '^F' - */ - 0x10, /* 00010000 */ - 0x38, /* 00111000 */ - 0x7c, /* 01111100 */ - 0xfe, /* 11111110 */ - 0xfe, /* 11111110 */ - 0x7c, /* 01111100 */ - 0x10, /* 00010000 */ - 0x38, /* 00111000 */ - - /* - * 7 0x07 '^G' - */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ - 0x3c, /* 00111100 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* - * 8 0x08 '^H' - */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - 0xe7, /* 11100111 */ - 0xc3, /* 11000011 */ - 0xc3, /* 11000011 */ - 0xe7, /* 11100111 */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - - /* - * 9 0x09 '^I' - */ - 0x00, /* 00000000 */ - 0x3c, /* 00111100 */ - 0x66, /* 01100110 */ 0x42, /* 01000010 */ - 0x42, /* 01000010 */ - 0x66, /* 01100110 */ 0x3c, /* 00111100 */ + + /* + * 175 0xaf '¯' + */ + 0x7e, /* 01111110 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ 0x00, /* 00000000 */ /* - * 10 0x0a '^J' - */ - 0xff, /* 11111111 */ + * 176 0xb0 '°' + */ + 0x1c, /* 00111000 */ + 0x36, /* 01101100 */ + 0x36, /* 01101100 */ + 0x1c, /* 00111000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 177 0xb1 '±' + */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x7e, /* 01111110 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + 0x7e, /* 01111110 */ + 0x00, /* 00000000 */ + + /* + * 178 0xb2 '²' + */ + 0x1c, /* 00111000 */ + 0x30, /* 00001100 */ + 0x18, /* 00011000 */ + 0x0c, /* 00110000 */ + 0x3c, /* 00111100 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 179 0xb3 '³' + */ + 0x1c, /* 00111000 */ + 0x30, /* 00001100 */ + 0x18, /* 00011000 */ + 0x30, /* 00001100 */ + 0x1c, /* 00111000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 180 0xb4 '´' + */ + 0x18, /* 00011000 */ + 0x0c, /* 00110000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 181 0xb5 'µ' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x3e, /* 01111100 */ + 0x06, /* 01100000 */ + 0x03, /* 11000000 */ + + /* + * 182 0xb6 '¶' + */ + 0xfe, /* 01111111 */ + 0xdb, /* 11011011 */ + 0xdb, /* 11011011 */ + 0xde, /* 01111011 */ + 0xd8, /* 00011011 */ + 0xd8, /* 00011011 */ + 0xd8, /* 00011011 */ + 0x00, /* 00000000 */ + + /* + * 183 0xb7 '·' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 184 0xb8 '¸' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x18, /* 00011000 */ + 0x30, /* 00001100 */ + 0x1e, /* 01111000 */ + + /* + * 185 0xb9 '¹' + */ + 0x08, /* 00010000 */ + 0x0c, /* 00110000 */ + 0x08, /* 00010000 */ + 0x1c, /* 00111000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 186 0xba 'º' + */ + 0x1c, /* 00111000 */ + 0x36, /* 01101100 */ + 0x36, /* 01101100 */ + 0x1c, /* 00111000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 187 0xbb '»' + */ + 0x00, /* 00000000 */ + 0x33, /* 11001100 */ + 0x66, /* 01100110 */ + 0xcc, /* 00110011 */ + 0x66, /* 01100110 */ + 0x33, /* 11001100 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + + /* + * 188 0xbc '¼' + */ 0xc3, /* 11000011 */ - 0x99, /* 10011001 */ + 0x63, /* 11000110 */ + 0x33, /* 11001100 */ 0xbd, /* 10111101 */ - 0xbd, /* 10111101 */ - 0x99, /* 10011001 */ + 0xec, /* 00110111 */ + 0xf6, /* 01101111 */ + 0xf3, /* 11001111 */ + 0x03, /* 11000000 */ + + /* + * 189 0xbd '½' + */ 0xc3, /* 11000011 */ - 0xff, /* 11111111 */ - - /* - * 11 0x0b '^K' - */ - 0x0f, /* 00001111 */ - 0x07, /* 00000111 */ - 0x0f, /* 00001111 */ - 0x7d, /* 01111101 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0x78, /* 01111000 */ - - /* - * 12 0x0c '^L' - */ - 0x3c, /* 00111100 */ + 0x63, /* 11000110 */ + 0x33, /* 11001100 */ + 0x7b, /* 11011110 */ + 0xcc, /* 00110011 */ 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x3c, /* 00111100 */ - 0x18, /* 00011000 */ - 0x7e, /* 01111110 */ - 0x18, /* 00011000 */ + 0x33, /* 11001100 */ + 0xf0, /* 00001111 */ /* - * 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 */ + * 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 */ + + /* + * 192 0xc0 'À' + */ + 0x07, /* 11100000 */ + 0x00, /* 00000000 */ + 0x1c, /* 00111000 */ + 0x36, /* 01101100 */ + 0x63, /* 11000110 */ + 0x7f, /* 11111110 */ + 0x63, /* 11000110 */ + 0x00, /* 00000000 */ + + /* + * 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 */ + + /* + * 195 0xc3 'Ã' + */ + 0x6e, /* 01110110 */ + 0x3b, /* 11011100 */ + 0x00, /* 00000000 */ + 0x3e, /* 01111100 */ + 0x63, /* 11000110 */ + 0x7f, /* 11111110 */ + 0x63, /* 11000110 */ + 0x00, /* 00000000 */ + + /* + * 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 */ + + /* + * 198 0xc6 'Æ' + */ + 0x7c, /* 00111110 */ + 0x36, /* 01101100 */ + 0x33, /* 11001100 */ + 0x7f, /* 11111110 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x73, /* 11001110 */ + 0x00, /* 00000000 */ + + /* + * 199 0xc7 'Ç' + */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x03, /* 11000000 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ 0x18, /* 00011000 */ + 0x30, /* 00001100 */ + 0x1e, /* 01111000 */ /* - * 16 0x10 '^P' - */ - 0x80, /* 10000000 */ - 0xe0, /* 11100000 */ - 0xf8, /* 11111000 */ - 0xfe, /* 11111110 */ - 0xf8, /* 11111000 */ - 0xe0, /* 11100000 */ - 0x80, /* 10000000 */ + * 200 0xc8 'È' + */ + 0x07, /* 11100000 */ + 0x00, /* 00000000 */ + 0x3f, /* 11111100 */ + 0x06, /* 01100000 */ + 0x1e, /* 01111000 */ + 0x06, /* 01100000 */ + 0x3f, /* 11111100 */ 0x00, /* 00000000 */ /* - * 17 0x11 '^Q' - */ - 0x02, /* 00000010 */ - 0x0e, /* 00001110 */ - 0x3e, /* 00111110 */ - 0xfe, /* 11111110 */ - 0x3e, /* 00111110 */ - 0x0e, /* 00001110 */ - 0x02, /* 00000010 */ + * 201 0xc9 'É' + */ + 0x38, /* 00011100 */ + 0x00, /* 00000000 */ + 0x3f, /* 11111100 */ + 0x06, /* 01100000 */ + 0x1e, /* 01111000 */ + 0x06, /* 01100000 */ + 0x3f, /* 11111100 */ 0x00, /* 00000000 */ /* - * 18 0x12 '^R' - */ + * 202 0xca 'Ê' + */ + 0x0c, /* 00110000 */ + 0x12, /* 01001000 */ + 0x3f, /* 11111100 */ + 0x06, /* 01100000 */ + 0x1e, /* 01111000 */ + 0x06, /* 01100000 */ + 0x3f, /* 11111100 */ + 0x00, /* 00000000 */ + + /* + * 203 0xcb 'Ë' + */ + 0x36, /* 01101100 */ + 0x00, /* 00000000 */ + 0x3f, /* 11111100 */ + 0x06, /* 01100000 */ + 0x1e, /* 01111000 */ + 0x06, /* 01100000 */ + 0x3f, /* 11111100 */ + 0x00, /* 00000000 */ + + /* + * 204 0xcc 'Ì' + */ + 0x07, /* 11100000 */ + 0x00, /* 00000000 */ + 0x1e, /* 01111000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x1e, /* 01111000 */ + 0x00, /* 00000000 */ + + /* + * 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 */ + + /* + * 207 0xcf 'Ï' + */ + 0x33, /* 11001100 */ + 0x00, /* 00000000 */ + 0x1e, /* 01111000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x1e, /* 01111000 */ + 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 */ + + /* + * 210 0xd2 'Ò' + */ + 0x0e, /* 01110000 */ + 0x00, /* 00000000 */ 0x18, /* 00011000 */ 0x3c, /* 00111100 */ - 0x7e, /* 01111110 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x7e, /* 01111110 */ + 0x66, /* 01100110 */ 0x3c, /* 00111100 */ 0x18, /* 00011000 */ - - /* - * 19 0x13 '^S' - */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x00, /* 00000000 */ - 0x66, /* 01100110 */ 0x00, /* 00000000 */ /* - * 20 0x14 '^T' - */ - 0x7f, /* 01111111 */ - 0xdb, /* 11011011 */ - 0xdb, /* 11011011 */ - 0x7b, /* 01111011 */ - 0x1b, /* 00011011 */ - 0x1b, /* 00011011 */ - 0x1b, /* 00011011 */ + * 211 0xd3 'Ó' + */ + 0x70, /* 00001110 */ + 0x00, /* 00000000 */ + 0x18, /* 00011000 */ + 0x3c, /* 00111100 */ + 0x66, /* 01100110 */ + 0x3c, /* 00111100 */ + 0x18, /* 00011000 */ 0x00, /* 00000000 */ /* - * 21 0x15 '^U' - */ - 0x3e, /* 00111110 */ - 0x61, /* 01100001 */ + * 212 0xd4 'Ô' + */ + 0x3c, /* 00111100 */ + 0x66, /* 01100110 */ + 0x18, /* 00011000 */ + 0x3c, /* 00111100 */ + 0x66, /* 01100110 */ + 0x3c, /* 00111100 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + + /* + * 213 0xd5 'Õ' + */ + 0x6e, /* 01110110 */ + 0x3b, /* 11011100 */ + 0x00, /* 00000000 */ + 0x3e, /* 01111100 */ + 0x63, /* 11000110 */ + 0x63, /* 11000110 */ + 0x3e, /* 01111100 */ + 0x00, /* 00000000 */ + + /* + * 214 0xd6 'Ö' + */ + 0xc3, /* 11000011 */ + 0x18, /* 00011000 */ 0x3c, /* 00111100 */ 0x66, /* 01100110 */ 0x66, /* 01100110 */ 0x3c, /* 00111100 */ - 0x86, /* 10000110 */ - 0x7c, /* 01111100 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ /* - * 22 0x16 '^V' - */ + * 215 0xd7 '×' + */ + 0x00, /* 00000000 */ + 0x36, /* 01101100 */ + 0x1c, /* 00111000 */ + 0x08, /* 00010000 */ + 0x1c, /* 00111000 */ + 0x36, /* 01101100 */ 0x00, /* 00000000 */ 0x00, /* 00000000 */ + + /* + * 216 0xd8 'Ø' + */ + 0x5c, /* 00111010 */ + 0x36, /* 01101100 */ + 0x73, /* 11001110 */ + 0x7b, /* 11011110 */ + 0x6f, /* 11110110 */ + 0x36, /* 01101100 */ + 0x1d, /* 10111000 */ 0x00, /* 00000000 */ + + /* + * 217 0xd9 'Ù' + */ + 0x0e, /* 01110000 */ 0x00, /* 00000000 */ - 0x7e, /* 01111110 */ - 0x7e, /* 01111110 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x3c, /* 00111100 */ + 0x00, /* 00000000 */ + + /* + * 218 0xda 'Ú' + */ + 0x70, /* 00001110 */ + 0x00, /* 00000000 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x3c, /* 00111100 */ + 0x00, /* 00000000 */ + + /* + * 219 0xdb 'Û' + */ + 0x3c, /* 00111100 */ + 0x66, /* 01100110 */ + 0x00, /* 00000000 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x3c, /* 00111100 */ + 0x00, /* 00000000 */ + + /* + * 220 0xdc 'Ü' + */ + 0x33, /* 11001100 */ + 0x00, /* 00000000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ + 0x00, /* 00000000 */ + + /* + * 221 0xdd 'Ý' + */ + 0x70, /* 00001110 */ + 0x00, /* 00000000 */ + 0x66, /* 01100110 */ + 0x66, /* 01100110 */ + 0x3c, /* 00111100 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ + + /* + * 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 */ 0x00, /* 00000000 */ /* - * 23 0x17 '^W' - */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ - 0x7e, /* 01111110 */ - 0x18, /* 00011000 */ - 0x7e, /* 01111110 */ - 0x3c, /* 00111100 */ - 0x18, /* 00011000 */ - 0xff, /* 11111111 */ - - /* - * 24 0x18 '^X' - */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ - 0x7e, /* 01111110 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - - /* - * 25 0x19 '^Y' - */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x7e, /* 01111110 */ - 0x3c, /* 00111100 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - - /* - * 26 0x1a '^Z' - */ - 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x0c, /* 00001100 */ - 0xfe, /* 11111110 */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* - * 27 0x1b '^[' - */ - 0x00, /* 00000000 */ - 0x30, /* 00110000 */ - 0x60, /* 01100000 */ - 0xfe, /* 11111110 */ - 0x60, /* 01100000 */ - 0x30, /* 00110000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* - * 28 0x1c '^\' - */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xfe, /* 11111110 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* - * 29 0x1d '^]' - */ - 0x00, /* 00000000 */ - 0x24, /* 00100100 */ - 0x66, /* 01100110 */ - 0xff, /* 11111111 */ - 0x66, /* 01100110 */ - 0x24, /* 00100100 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* - * 30 0x1e '^^' - */ - 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ - 0x7e, /* 01111110 */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* - * 31 0x1f '^_' - */ - 0x00, /* 00000000 */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - 0x7e, /* 01111110 */ - 0x3c, /* 00111100 */ - 0x18, /* 00011000 */ - 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 '"' - */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x24, /* 00100100 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* - * 35 0x23 '#' - */ - 0x6c, /* 01101100 */ - 0x6c, /* 01101100 */ - 0xfe, /* 11111110 */ - 0x6c, /* 01101100 */ - 0xfe, /* 11111110 */ - 0x6c, /* 01101100 */ - 0x6c, /* 01101100 */ - 0x00, /* 00000000 */ - - /* - * 36 0x24 '$' - */ - 0x18, /* 00011000 */ - 0x3e, /* 00111110 */ - 0x60, /* 01100000 */ - 0x3c, /* 00111100 */ - 0x06, /* 00000110 */ - 0x7c, /* 01111100 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - - /* - * 37 0x25 '%' - */ - 0x00, /* 00000000 */ - 0xc6, /* 11000110 */ - 0xcc, /* 11001100 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0x66, /* 01100110 */ - 0xc6, /* 11000110 */ - 0x00, /* 00000000 */ - - /* - * 38 0x26 '&' - */ - 0x38, /* 00111000 */ - 0x6c, /* 01101100 */ - 0x38, /* 00111000 */ - 0x76, /* 01110110 */ - 0xdc, /* 11011100 */ - 0xcc, /* 11001100 */ - 0x76, /* 01110110 */ - 0x00, /* 00000000 */ - - /* - * 39 0x27 ''' - */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* - * 40 0x28 '(' - */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0x30, /* 00110000 */ - 0x30, /* 00110000 */ - 0x18, /* 00011000 */ - 0x0c, /* 00001100 */ - 0x00, /* 00000000 */ - - /* - * 41 0x29 ')' - */ - 0x30, /* 00110000 */ - 0x18, /* 00011000 */ - 0x0c, /* 00001100 */ - 0x0c, /* 00001100 */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0x00, /* 00000000 */ - - /* - * 42 0x2a '*' - */ - 0x00, /* 00000000 */ - 0x66, /* 01100110 */ - 0x3c, /* 00111100 */ - 0xff, /* 11111111 */ - 0x3c, /* 00111100 */ - 0x66, /* 01100110 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* - * 43 0x2b '+' - */ - 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 '-' - */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x7e, /* 01111110 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* - * 46 0x2e '.' - */ - 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 */ + * 225 0xe1 'á' + */ + 0x38, /* 00011100 */ + 0x00, /* 00000000 */ + 0x1e, /* 01111000 */ + 0x30, /* 00001100 */ + 0x3e, /* 01111100 */ + 0x33, /* 11001100 */ 0x7e, /* 01111110 */ 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 */ + * 226 0xe2 'â' + */ 0x7e, /* 01111110 */ - 0x06, /* 00000110 */ - 0x0c, /* 00001100 */ - 0x78, /* 01111000 */ - 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 */ - 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 */ - 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' - */ + 0xc3, /* 11000011 */ 0x3c, /* 00111100 */ + 0x60, /* 00000110 */ + 0x7c, /* 00111110 */ 0x66, /* 01100110 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0x66, /* 01100110 */ - 0x3c, /* 00111100 */ + 0xfc, /* 00111111 */ 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 */ - 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 */ - 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 */ - 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 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* - * 95 0x5f '_' - */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0xff, /* 11111111 */ - - /* - * 96 0x60 '`' - */ - 0x30, /* 00110000 */ - 0x18, /* 00011000 */ - 0x0c, /* 00001100 */ - 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 */ - 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 */ - 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 */ - 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' - */ - 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' - */ - 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 */ - 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' - */ - 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' - */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x7e, /* 01111110 */ - 0x4c, /* 01001100 */ - 0x18, /* 00011000 */ - 0x32, /* 00110010 */ + * 227 0xe3 'ã' + */ + 0x6e, /* 01110110 */ + 0x3b, /* 11011100 */ + 0x1e, /* 01111000 */ + 0x30, /* 00001100 */ + 0x3e, /* 01111100 */ + 0x33, /* 11001100 */ 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 */ - 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 */ - 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 '' - */ - 0x00, /* 00000000 */ + * 228 0xe4 'ä' + */ + 0x33, /* 11001100 */ 0x00, /* 00000000 */ + 0x1e, /* 01111000 */ + 0x30, /* 00001100 */ + 0x3e, /* 01111100 */ + 0x33, /* 11001100 */ 0x7e, /* 01111110 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ + 0x00, /* 00000000 */ + + /* + * 229 0xe5 'å' + */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x1e, /* 01111000 */ + 0x30, /* 00001100 */ + 0x3e, /* 01111100 */ + 0x33, /* 11001100 */ 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 */ + * 230 0xe6 'æ' + */ 0x00, /* 00000000 */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xfe, /* 11111110 */ - 0xc0, /* 11000000 */ - 0x7c, /* 01111100 */ + 0x00, /* 00000000 */ + 0xfe, /* 01111111 */ + 0x30, /* 00001100 */ + 0xfe, /* 01111111 */ + 0x33, /* 11001100 */ + 0xfe, /* 01111111 */ 0x00, /* 00000000 */ /* - * 138 0x8a '' - */ - 0x30, /* 00110000 */ - 0x18, /* 00011000 */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xfe, /* 11111110 */ - 0xc0, /* 11000000 */ - 0x7c, /* 01111100 */ + * 231 0xe7 'ç' + */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 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 */ /* - * 139 0x8b '' - */ + * 233 0xe9 'é' + */ + 0x38, /* 00011100 */ + 0x00, /* 00000000 */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x3f, /* 11111100 */ + 0x03, /* 11000000 */ + 0x1e, /* 01111000 */ + 0x00, /* 00000000 */ + + /* + * 234 0xea 'ê' + */ + 0x7e, /* 01111110 */ + 0xc3, /* 11000011 */ + 0x3c, /* 00111100 */ 0x66, /* 01100110 */ + 0x7e, /* 01111110 */ + 0x06, /* 01100000 */ + 0x3c, /* 00111100 */ 0x00, /* 00000000 */ - 0x38, /* 00111000 */ + + /* + * 235 0xeb 'ë' + */ + 0x33, /* 11001100 */ + 0x00, /* 00000000 */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x3f, /* 11111100 */ + 0x03, /* 11000000 */ + 0x1e, /* 01111000 */ + 0x00, /* 00000000 */ + + /* + * 236 0xec 'ì' + */ + 0x07, /* 11100000 */ + 0x00, /* 00000000 */ + 0x0e, /* 01110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x1e, /* 01111000 */ + 0x00, /* 00000000 */ + + /* + * 237 0xed 'í' + */ + 0x1c, /* 00111000 */ + 0x00, /* 00000000 */ + 0x0e, /* 01110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x1e, /* 01111000 */ + 0x00, /* 00000000 */ + + /* + * 238 0xee 'î' + */ + 0x3e, /* 01111100 */ + 0x63, /* 11000110 */ + 0x1c, /* 00111000 */ 0x18, /* 00011000 */ 0x18, /* 00011000 */ 0x18, /* 00011000 */ @@ -1713,1396 +2909,208 @@ static unsigned char SDLTest_FontData[SDL_TESTFONTDATAMAX] = { 0x00, /* 00000000 */ /* - * 140 0x8c '' - */ - 0x7c, /* 01111100 */ - 0x82, /* 10000010 */ - 0x38, /* 00111000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ - 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 '' - */ - 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 */ - 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 */ - 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 */ - 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 */ - 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 '' - */ - 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 '' - */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ - 0x3c, /* 00111100 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - - /* - * 174 0xae '' - */ - 0x00, /* 00000000 */ - 0x33, /* 00110011 */ - 0x66, /* 01100110 */ - 0xcc, /* 11001100 */ - 0x66, /* 01100110 */ - 0x33, /* 00110011 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* - * 175 0xaf '' - */ - 0x00, /* 00000000 */ - 0xcc, /* 11001100 */ - 0x66, /* 01100110 */ - 0x33, /* 00110011 */ - 0x66, /* 01100110 */ - 0xcc, /* 11001100 */ - 0x00, /* 00000000 */ - 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 */ - - /* - * 179 0xb3 '' - */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - - /* - * 180 0xb4 '' - */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0xf8, /* 11111000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - - /* - * 181 0xb5 '' - */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0xf8, /* 11111000 */ - 0x18, /* 00011000 */ - 0xf8, /* 11111000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - - /* - * 182 0xb6 '' - */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0xf6, /* 11110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - - /* - * 183 0xb7 '' - */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0xfe, /* 11111110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - - /* - * 184 0xb8 '' - */ - 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 '' - */ - 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 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* - * 189 0xbd '' - */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0xfe, /* 11111110 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* - * 190 0xbe '' - */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0xf8, /* 11111000 */ - 0x18, /* 00011000 */ - 0xf8, /* 11111000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* - * 191 0xbf '' - */ + * 239 0xef 'ï' + */ + 0x33, /* 11001100 */ 0x00, /* 00000000 */ + 0x0e, /* 01110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x0c, /* 00110000 */ + 0x1e, /* 01111000 */ 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0xf8, /* 11111000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ /* - * 192 0xc0 '' - */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x1f, /* 00011111 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ + * 240 0xf0 'ð' + */ + 0x1b, /* 11011000 */ + 0x0e, /* 01110000 */ + 0x1b, /* 11011000 */ + 0x30, /* 00001100 */ + 0x3e, /* 01111100 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ 0x00, /* 00000000 */ /* - * 193 0xc1 '' - */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0xff, /* 11111111 */ + * 241 0xf1 'ñ' + */ 0x00, /* 00000000 */ + 0x1f, /* 11111000 */ 0x00, /* 00000000 */ + 0x1f, /* 11111000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ 0x00, /* 00000000 */ /* - * 194 0xc2 '' - */ - 0x00, /* 00000000 */ + * 242 0xf2 'ò' + */ 0x00, /* 00000000 */ + 0x07, /* 11100000 */ 0x00, /* 00000000 */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ 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 */ - 0x18, /* 00011000 */ /* - * 196 0xc4 '' - */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0xff, /* 11111111 */ + * 243 0xf3 'ó' + */ 0x00, /* 00000000 */ + 0x38, /* 00011100 */ 0x00, /* 00000000 */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ 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 */ - - /* - * 199 0xc7 '' - */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x37, /* 00110111 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - - /* - * 200 0xc8 '' - */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x37, /* 00110111 */ - 0x30, /* 00110000 */ - 0x3f, /* 00111111 */ - 0x00, /* 00000000 */ + * 244 0xf4 'ô' + */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ 0x00, /* 00000000 */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ 0x00, /* 00000000 */ /* - * 201 0xc9 '' - */ + * 245 0xf5 'õ' + */ + 0x6e, /* 01110110 */ + 0x3b, /* 11011100 */ 0x00, /* 00000000 */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ 0x00, /* 00000000 */ - 0x3f, /* 00111111 */ - 0x30, /* 00110000 */ - 0x37, /* 00110111 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ /* - * 202 0xca '' - */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0xf7, /* 11110111 */ - 0x00, /* 00000000 */ - 0xff, /* 11111111 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* - * 203 0xcb '' - */ - 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 '' - */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0xff, /* 11111111 */ - 0x00, /* 00000000 */ - 0xff, /* 11111111 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* - * 206 0xce '' - */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0xf7, /* 11110111 */ - 0x00, /* 00000000 */ - 0xf7, /* 11110111 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - - /* - * 207 0xcf '' - */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0xff, /* 11111111 */ - 0x00, /* 00000000 */ - 0xff, /* 11111111 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* - * 208 0xd0 '' - */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0xff, /* 11111111 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* - * 209 0xd1 '' - */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0xff, /* 11111111 */ - 0x00, /* 00000000 */ - 0xff, /* 11111111 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - - /* - * 210 0xd2 '' - */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0xff, /* 11111111 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - - /* - * 211 0xd3 '' - */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x3f, /* 00111111 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* - * 212 0xd4 '' - */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x1f, /* 00011111 */ - 0x18, /* 00011000 */ - 0x1f, /* 00011111 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* - * 213 0xd5 '' - */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x1f, /* 00011111 */ - 0x18, /* 00011000 */ - 0x1f, /* 00011111 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - - /* - * 214 0xd6 '' - */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 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 */ - - /* - * 216 0xd8 '' - */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0xff, /* 11111111 */ - 0x18, /* 00011000 */ - 0xff, /* 11111111 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - - /* - * 217 0xd9 '' - */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0xf8, /* 11111000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* - * 218 0xda '' - */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 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 */ - - /* - * 220 0xdc '' - */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 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 */ - - /* - * 223 0xdf '' - */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - 0xff, /* 11111111 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* - * 224 0xe0 '' - */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x76, /* 01110110 */ - 0xdc, /* 11011100 */ - 0xc8, /* 11001000 */ - 0xdc, /* 11011100 */ - 0x76, /* 01110110 */ - 0x00, /* 00000000 */ - - /* - * 225 0xe1 '' - */ - 0x78, /* 01111000 */ - 0xcc, /* 11001100 */ - 0xcc, /* 11001100 */ - 0xd8, /* 11011000 */ - 0xcc, /* 11001100 */ - 0xc6, /* 11000110 */ - 0xcc, /* 11001100 */ - 0x00, /* 00000000 */ - - /* - * 226 0xe2 '' - */ - 0xfe, /* 11111110 */ - 0xc6, /* 11000110 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0xc0, /* 11000000 */ - 0x00, /* 00000000 */ - - /* - * 227 0xe3 '' - */ - 0x00, /* 00000000 */ - 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 */ - 0x00, /* 00000000 */ - - /* - * 229 0xe5 '' - */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x7e, /* 01111110 */ - 0xd8, /* 11011000 */ - 0xd8, /* 11011000 */ - 0xd8, /* 11011000 */ - 0x70, /* 01110000 */ - 0x00, /* 00000000 */ - - /* - * 230 0xe6 '' - */ - 0x00, /* 00000000 */ - 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 */ - 0x00, /* 00000000 */ - - /* - * 232 0xe8 '' - */ - 0x7e, /* 01111110 */ - 0x18, /* 00011000 */ - 0x3c, /* 00111100 */ - 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 */ - 0x00, /* 00000000 */ - - /* - * 235 0xeb '' - */ - 0x0e, /* 00001110 */ - 0x18, /* 00011000 */ - 0x0c, /* 00001100 */ - 0x3e, /* 00111110 */ - 0x66, /* 01100110 */ - 0x66, /* 01100110 */ - 0x3c, /* 00111100 */ - 0x00, /* 00000000 */ - - /* - * 236 0xec '' - */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x7e, /* 01111110 */ - 0xdb, /* 11011011 */ - 0xdb, /* 11011011 */ - 0x7e, /* 01111110 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* - * 237 0xed '' - */ - 0x06, /* 00000110 */ - 0x0c, /* 00001100 */ - 0x7e, /* 01111110 */ - 0xdb, /* 11011011 */ - 0xdb, /* 11011011 */ - 0x7e, /* 01111110 */ - 0x60, /* 01100000 */ - 0xc0, /* 11000000 */ - - /* - * 238 0xee '' - */ - 0x1e, /* 00011110 */ - 0x30, /* 00110000 */ - 0x60, /* 01100000 */ - 0x7e, /* 01111110 */ - 0x60, /* 01100000 */ - 0x30, /* 00110000 */ - 0x1e, /* 00011110 */ - 0x00, /* 00000000 */ - - /* - * 239 0xef '' - */ - 0x00, /* 00000000 */ - 0x7c, /* 01111100 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0xc6, /* 11000110 */ - 0x00, /* 00000000 */ - - /* - * 240 0xf0 '' - */ - 0x00, /* 00000000 */ - 0xfe, /* 11111110 */ - 0x00, /* 00000000 */ - 0xfe, /* 11111110 */ + * 246 0xf6 'ö' + */ 0x00, /* 00000000 */ - 0xfe, /* 11111110 */ + 0x33, /* 11001100 */ 0x00, /* 00000000 */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x1e, /* 01111000 */ 0x00, /* 00000000 */ /* - * 241 0xf1 '' - */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x7e, /* 01111110 */ + * 247 0xf7 '÷' + */ 0x18, /* 00011000 */ 0x18, /* 00011000 */ 0x00, /* 00000000 */ 0x7e, /* 01111110 */ 0x00, /* 00000000 */ + 0x18, /* 00011000 */ + 0x18, /* 00011000 */ + 0x00, /* 00000000 */ /* - * 242 0xf2 '' - */ - 0x30, /* 00110000 */ - 0x18, /* 00011000 */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ + * 248 0xf8 'ø' + */ 0x00, /* 00000000 */ + 0x60, /* 00000110 */ + 0x3c, /* 00111100 */ + 0x76, /* 01101110 */ + 0x7e, /* 01111110 */ + 0x6e, /* 01110110 */ + 0x3c, /* 00111100 */ + 0x06, /* 01100000 */ + + /* + * 249 0xf9 'ù' + */ + 0x00, /* 00000000 */ + 0x07, /* 11100000 */ + 0x00, /* 00000000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ 0x7e, /* 01111110 */ 0x00, /* 00000000 */ /* - * 243 0xf3 '' - */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0x18, /* 00011000 */ - 0x0c, /* 00001100 */ + * 250 0xfa 'ú' + */ 0x00, /* 00000000 */ + 0x38, /* 00011100 */ + 0x00, /* 00000000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ 0x7e, /* 01111110 */ 0x00, /* 00000000 */ /* - * 244 0xf4 '' - */ - 0x0e, /* 00001110 */ - 0x1b, /* 00011011 */ - 0x1b, /* 00011011 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - - /* - * 245 0xf5 '' - */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0xd8, /* 11011000 */ - 0xd8, /* 11011000 */ - 0x70, /* 01110000 */ - - /* - * 246 0xf6 '' - */ - 0x00, /* 00000000 */ - 0x18, /* 00011000 */ + * 251 0xfb 'û' + */ + 0x1e, /* 01111000 */ + 0x33, /* 11001100 */ 0x00, /* 00000000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ 0x7e, /* 01111110 */ 0x00, /* 00000000 */ - 0x18, /* 00011000 */ + + /* + * 252 0xfc 'ü' + */ 0x00, /* 00000000 */ + 0x33, /* 11001100 */ + 0x00, /* 00000000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x7e, /* 01111110 */ 0x00, /* 00000000 */ /* - * 247 0xf7 '' - */ + * 253 0xfd 'ý' + */ 0x00, /* 00000000 */ - 0x76, /* 01110110 */ - 0xdc, /* 11011100 */ + 0x38, /* 00011100 */ 0x00, /* 00000000 */ - 0x76, /* 01110110 */ - 0xdc, /* 11011100 */ + 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 */ /* - * 248 0xf8 '' - */ - 0x38, /* 00111000 */ - 0x6c, /* 01101100 */ - 0x6c, /* 01101100 */ - 0x38, /* 00111000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* - * 249 0xf9 '' - */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* - * 250 0xfa '' - */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x18, /* 00011000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* - * 251 0xfb '' - */ - 0x0f, /* 00001111 */ - 0x0c, /* 00001100 */ - 0x0c, /* 00001100 */ - 0x0c, /* 00001100 */ - 0xec, /* 11101100 */ - 0x6c, /* 01101100 */ - 0x3c, /* 00111100 */ - 0x1c, /* 00011100 */ - - /* - * 252 0xfc '' - */ - 0x6c, /* 01101100 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x36, /* 00110110 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* - * 253 0xfd '' - */ - 0x78, /* 01111000 */ - 0x0c, /* 00001100 */ - 0x18, /* 00011000 */ - 0x30, /* 00110000 */ - 0x7c, /* 01111100 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* - * 254 0xfe '' - */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x3c, /* 00111100 */ - 0x3c, /* 00111100 */ - 0x3c, /* 00111100 */ - 0x3c, /* 00111100 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - - /* - * 255 0xff ' ' - */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ - 0x00, /* 00000000 */ + * 255 0xff 'ÿ' + */ 0x00, /* 00000000 */ + 0x33, /* 11001100 */ 0x00, /* 00000000 */ + 0x33, /* 11001100 */ + 0x33, /* 11001100 */ + 0x3e, /* 01111100 */ + 0x30, /* 00001100 */ + 0x1f, /* 11111000 */ }; @@ -3120,7 +3128,7 @@ struct SDLTest_CharTextureCache { */ 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 SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c) 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 @@ int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c) 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 @@ int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c) /* * 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,23 +3244,234 @@ int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c) 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; diff --git a/libs/SDL2/src/test/SDL_test_harness.c b/libs/SDL2/src/test/SDL_test_harness.c index 8f10f3e5..f66602a7 100644 --- a/libs/SDL2/src/test/SDL_test_harness.c +++ b/libs/SDL2/src/test/SDL_test_harness.c @@ -169,7 +169,7 @@ SDLTest_GenerateExecKey(const char *runSeed, const char *suiteName, const char * * \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 @@ SDLTest_SetTestTimeout(int timeout, void (*callback)(void)) #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 @@ static void SDLTest_LogTestSuiteSummary(SDLTest_TestSuiteReference *testSuites) /* 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 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user } } + 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 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user /* 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 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user 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 --git a/libs/SDL2/src/test/SDL_test_random.c b/libs/SDL2/src/test/SDL_test_random.c index c52e050b..b2babf18 100644 --- a/libs/SDL2/src/test/SDL_test_random.c +++ b/libs/SDL2/src/test/SDL_test_random.c @@ -70,7 +70,7 @@ void SDLTest_RandomInitTime(SDLTest_RandomContext * rndContext) srand((unsigned int)time(NULL)); a=rand(); - srand((unsigned int)clock()); + srand((unsigned int)SDL_GetPerformanceCounter()); b=rand(); SDLTest_RandomInit(rndContext, a, b); } diff --git a/libs/SDL2/src/thread/SDL_systhread.h b/libs/SDL2/src/thread/SDL_systhread.h index fd4492c9..ab6872c0 100644 --- a/libs/SDL2/src/thread/SDL_systhread.h +++ b/libs/SDL2/src/thread/SDL_systhread.h @@ -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 @@ extern SDL_Thread * 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 --git a/libs/SDL2/src/thread/SDL_thread.c b/libs/SDL2/src/thread/SDL_thread.c index 61af43f0..65610339 100644 --- a/libs/SDL2/src/thread/SDL_thread.c +++ b/libs/SDL2/src/thread/SDL_thread.c @@ -200,19 +200,38 @@ SDL_Generic_SetTLSData(SDL_TLSData *storage) 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_GetErrBuf(void) 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 --git a/libs/SDL2/src/thread/SDL_thread_c.h b/libs/SDL2/src/thread/SDL_thread_c.h index fb0885a2..55a4a887 100644 --- a/libs/SDL2/src/thread/SDL_thread_c.h +++ b/libs/SDL2/src/thread/SDL_thread_c.h @@ -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 --git a/libs/SDL2/src/thread/generic/SDL_syscond.c b/libs/SDL2/src/thread/generic/SDL_syscond.c index 328e37c9..59e8ce07 100644 --- a/libs/SDL2/src/thread/generic/SDL_syscond.c +++ b/libs/SDL2/src/thread/generic/SDL_syscond.c @@ -99,7 +99,7 @@ SDL_CondSignal_generic(SDL_cond * _cond) { SDL_cond_generic *cond = (SDL_cond_generic *)_cond; if (!cond) { - return SDL_SetError("Passed a NULL condition variable"); + return SDL_InvalidParamError("cond"); } /* If there are waiting threads not already signalled, then @@ -124,7 +124,7 @@ SDL_CondBroadcast_generic(SDL_cond * _cond) { SDL_cond_generic *cond = (SDL_cond_generic *)_cond; if (!cond) { - return SDL_SetError("Passed a NULL condition variable"); + return SDL_InvalidParamError("cond"); } /* If there are waiting threads not already signalled, then @@ -181,7 +181,7 @@ SDL_CondWaitTimeout_generic(SDL_cond * _cond, SDL_mutex * mutex, Uint32 ms) int retval; if (!cond) { - return SDL_SetError("Passed a NULL condition variable"); + return SDL_InvalidParamError("cond"); } /* Obtain the protection mutex, and increment the number of waiters. diff --git a/libs/SDL2/src/thread/generic/SDL_sysmutex.c b/libs/SDL2/src/thread/generic/SDL_sysmutex.c index 9028c726..42965aa8 100644 --- a/libs/SDL2/src/thread/generic/SDL_sysmutex.c +++ b/libs/SDL2/src/thread/generic/SDL_sysmutex.c @@ -78,7 +78,7 @@ SDL_LockMutex(SDL_mutex * mutex) SDL_threadID this_thread; if (mutex == NULL) { - return SDL_SetError("Passed a NULL mutex"); + return SDL_InvalidParamError("mutex"); } this_thread = SDL_ThreadID(); @@ -109,7 +109,7 @@ SDL_TryLockMutex(SDL_mutex * mutex) SDL_threadID this_thread; if (mutex == NULL) { - return SDL_SetError("Passed a NULL mutex"); + return SDL_InvalidParamError("mutex"); } this_thread = SDL_ThreadID(); @@ -139,7 +139,7 @@ SDL_mutexV(SDL_mutex * mutex) return 0; #else if (mutex == NULL) { - return SDL_SetError("Passed a NULL mutex"); + return SDL_InvalidParamError("mutex"); } /* If we don't own the mutex, we can't unlock it */ diff --git a/libs/SDL2/src/thread/generic/SDL_syssem.c b/libs/SDL2/src/thread/generic/SDL_syssem.c index 93ce2952..c21ff196 100644 --- a/libs/SDL2/src/thread/generic/SDL_syssem.c +++ b/libs/SDL2/src/thread/generic/SDL_syssem.c @@ -132,7 +132,7 @@ SDL_SemTryWait(SDL_sem * sem) int retval; if (!sem) { - return SDL_SetError("Passed a NULL semaphore"); + return SDL_InvalidParamError("sem"); } retval = SDL_MUTEX_TIMEDOUT; @@ -152,7 +152,7 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout) int retval; if (!sem) { - return SDL_SetError("Passed a NULL semaphore"); + return SDL_InvalidParamError("sem"); } /* A timeout of 0 is an easy case */ @@ -200,7 +200,7 @@ int SDL_SemPost(SDL_sem * sem) { if (!sem) { - return SDL_SetError("Passed a NULL semaphore"); + return SDL_InvalidParamError("sem"); } SDL_LockMutex(sem->count_lock); diff --git a/libs/SDL2/src/thread/ngage/SDL_sysmutex.cpp b/libs/SDL2/src/thread/ngage/SDL_sysmutex.cpp new file mode 100644 index 00000000..34cf4510 --- /dev/null +++ b/libs/SDL2/src/thread/ngage/SDL_sysmutex.cpp @@ -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 --git a/libs/SDL2/src/thread/ngage/SDL_syssem.cpp b/libs/SDL2/src/thread/ngage/SDL_syssem.cpp new file mode 100644 index 00000000..ab277ca5 --- /dev/null +++ b/libs/SDL2/src/thread/ngage/SDL_syssem.cpp @@ -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 --git a/libs/SDL2/src/thread/ngage/SDL_systhread.cpp b/libs/SDL2/src/thread/ngage/SDL_systhread.cpp new file mode 100644 index 00000000..f2c30f7b --- /dev/null +++ b/libs/SDL2/src/thread/ngage/SDL_systhread.cpp @@ -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 --git a/libs/SDL2/src/thread/ngage/SDL_systhread_c.h b/libs/SDL2/src/thread/ngage/SDL_systhread_c.h new file mode 100644 index 00000000..dedceb39 --- /dev/null +++ b/libs/SDL2/src/thread/ngage/SDL_systhread_c.h @@ -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 --git a/libs/SDL2/src/thread/os2/SDL_sysmutex.c b/libs/SDL2/src/thread/os2/SDL_sysmutex.c index 28986f63..d3fc7a3b 100644 --- a/libs/SDL2/src/thread/os2/SDL_sysmutex.c +++ b/libs/SDL2/src/thread/os2/SDL_sysmutex.c @@ -56,12 +56,12 @@ SDL_CreateMutex(void) void SDL_DestroyMutex(SDL_mutex * mutex) { - ULONG ulRC; HMTX hMtx = (HMTX)mutex; - - ulRC = DosCloseMutexSem(hMtx); - if (ulRC != NO_ERROR) { - debug_os2("DosCloseMutexSem(), rc = %u", ulRC); + if (hMtx != NULLHANDLE) { + const ULONG ulRC = DosCloseMutexSem(hMtx); + if (ulRC != NO_ERROR) { + debug_os2("DosCloseMutexSem(), rc = %u", ulRC); + } } } @@ -73,7 +73,7 @@ SDL_LockMutex(SDL_mutex * mutex) HMTX hMtx = (HMTX)mutex; if (hMtx == NULLHANDLE) - return SDL_SetError("Passed a NULL mutex"); + return SDL_InvalidParamError("mutex"); ulRC = DosRequestMutexSem(hMtx, SEM_INDEFINITE_WAIT); if (ulRC != NO_ERROR) { @@ -92,7 +92,7 @@ SDL_TryLockMutex(SDL_mutex * mutex) HMTX hMtx = (HMTX)mutex; if (hMtx == NULLHANDLE) - return SDL_SetError("Passed a NULL mutex"); + return SDL_InvalidParamError("mutex"); ulRC = DosRequestMutexSem(hMtx, SEM_IMMEDIATE_RETURN); @@ -115,7 +115,7 @@ SDL_UnlockMutex(SDL_mutex * mutex) HMTX hMtx = (HMTX)mutex; if (hMtx == NULLHANDLE) - return SDL_SetError("Passed a NULL mutex"); + return SDL_InvalidParamError("mutex"); ulRC = DosReleaseMutexSem(hMtx); if (ulRC != NO_ERROR) diff --git a/libs/SDL2/src/thread/os2/SDL_syssem.c b/libs/SDL2/src/thread/os2/SDL_syssem.c index d2ede699..79bf0673 100644 --- a/libs/SDL2/src/thread/os2/SDL_syssem.c +++ b/libs/SDL2/src/thread/os2/SDL_syssem.c @@ -89,7 +89,7 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout) ULONG cPost; if (sem == NULL) - return SDL_SetError("Passed a NULL sem"); + return SDL_InvalidParamError("sem"); if (timeout != SEM_INDEFINITE_WAIT) DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &ulStartTime, sizeof(ULONG)); @@ -147,7 +147,7 @@ SDL_SemValue(SDL_sem * sem) ULONG ulRC; if (sem == NULL) { - SDL_SetError("Passed a NULL sem"); + SDL_InvalidParamError("sem"); return 0; } @@ -167,7 +167,7 @@ SDL_SemPost(SDL_sem * sem) ULONG ulRC; if (sem == NULL) - return SDL_SetError("Passed a NULL sem"); + return SDL_InvalidParamError("sem"); ulRC = DosRequestMutexSem(sem->hMtx, SEM_INDEFINITE_WAIT); if (ulRC != NO_ERROR) diff --git a/libs/SDL2/src/thread/ps2/SDL_syssem.c b/libs/SDL2/src/thread/ps2/SDL_syssem.c new file mode 100644 index 00000000..e6b0aee2 --- /dev/null +++ b/libs/SDL2/src/thread/ps2/SDL_syssem.c @@ -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 --git a/libs/SDL2/src/thread/ps2/SDL_systhread.c b/libs/SDL2/src/thread/ps2/SDL_systhread.c new file mode 100644 index 00000000..4df65abf --- /dev/null +++ b/libs/SDL2/src/thread/ps2/SDL_systhread.c @@ -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 --git a/libs/SDL2/src/thread/ps2/SDL_systhread_c.h b/libs/SDL2/src/thread/ps2/SDL_systhread_c.h new file mode 100644 index 00000000..ffeca76d --- /dev/null +++ b/libs/SDL2/src/thread/ps2/SDL_systhread_c.h @@ -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 --git a/libs/SDL2/src/thread/psp/SDL_syscond.c b/libs/SDL2/src/thread/psp/SDL_syscond.c index 5c98610a..02307ed9 100644 --- a/libs/SDL2/src/thread/psp/SDL_syscond.c +++ b/libs/SDL2/src/thread/psp/SDL_syscond.c @@ -84,7 +84,7 @@ int SDL_CondSignal(SDL_cond * cond) { if (!cond) { - return SDL_SetError("Passed a NULL condition variable"); + return SDL_InvalidParamError("cond"); } /* If there are waiting threads not already signalled, then @@ -108,7 +108,7 @@ int SDL_CondBroadcast(SDL_cond * cond) { if (!cond) { - return SDL_SetError("Passed a NULL condition variable"); + return SDL_InvalidParamError("cond"); } /* If there are waiting threads not already signalled, then @@ -164,7 +164,7 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms) int retval; if (!cond) { - return SDL_SetError("Passed a NULL condition variable"); + return SDL_InvalidParamError("cond"); } /* Obtain the protection mutex, and increment the number of waiters. diff --git a/libs/SDL2/src/thread/psp/SDL_sysmutex.c b/libs/SDL2/src/thread/psp/SDL_sysmutex.c index 0adc16c0..9e391629 100644 --- a/libs/SDL2/src/thread/psp/SDL_sysmutex.c +++ b/libs/SDL2/src/thread/psp/SDL_sysmutex.c @@ -84,7 +84,7 @@ SDL_TryLockMutex(SDL_mutex * mutex) #else SceInt32 res = 0; if (mutex == NULL) { - return SDL_SetError("Passed a NULL mutex"); + return SDL_InvalidParamError("mutex"); } res = sceKernelTryLockLwMutex(&mutex->lock, 1); @@ -114,7 +114,7 @@ SDL_mutexP(SDL_mutex * mutex) #else SceInt32 res = 0; if (mutex == NULL) { - return SDL_SetError("Passed a NULL mutex"); + return SDL_InvalidParamError("mutex"); } res = sceKernelLockLwMutex(&mutex->lock, 1, NULL); @@ -136,7 +136,7 @@ SDL_mutexV(SDL_mutex * mutex) SceInt32 res = 0; if (mutex == NULL) { - return SDL_SetError("Passed a NULL mutex"); + return SDL_InvalidParamError("mutex"); } res = sceKernelUnlockLwMutex(&mutex->lock, 1); diff --git a/libs/SDL2/src/thread/psp/SDL_syssem.c b/libs/SDL2/src/thread/psp/SDL_syssem.c index aaac5b68..640619cd 100644 --- a/libs/SDL2/src/thread/psp/SDL_syssem.c +++ b/libs/SDL2/src/thread/psp/SDL_syssem.c @@ -82,7 +82,7 @@ int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout) int res; if (sem == NULL) { - SDL_SetError("Passed a NULL sem"); + SDL_InvalidParamError("sem"); return 0; } @@ -128,7 +128,7 @@ Uint32 SDL_SemValue(SDL_sem *sem) SceKernelSemaInfo info; if (sem == NULL) { - SDL_SetError("Passed a NULL sem"); + SDL_InvalidParamError("sem"); return 0; } @@ -144,7 +144,7 @@ int SDL_SemPost(SDL_sem *sem) int res; if (sem == NULL) { - return SDL_SetError("Passed a NULL sem"); + return SDL_InvalidParamError("sem"); } res = sceKernelSignalSema(sem->semid, 1); diff --git a/libs/SDL2/src/thread/pthread/SDL_syscond.c b/libs/SDL2/src/thread/pthread/SDL_syscond.c index 5ebd415c..c84ec7ad 100644 --- a/libs/SDL2/src/thread/pthread/SDL_syscond.c +++ b/libs/SDL2/src/thread/pthread/SDL_syscond.c @@ -68,7 +68,7 @@ SDL_CondSignal(SDL_cond * cond) int retval; if (!cond) { - return SDL_SetError("Passed a NULL condition variable"); + return SDL_InvalidParamError("cond"); } retval = 0; @@ -85,7 +85,7 @@ SDL_CondBroadcast(SDL_cond * cond) int retval; if (!cond) { - return SDL_SetError("Passed a NULL condition variable"); + return SDL_InvalidParamError("cond"); } retval = 0; @@ -105,7 +105,7 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms) struct timespec abstime; if (!cond) { - return SDL_SetError("Passed a NULL condition variable"); + return SDL_InvalidParamError("cond"); } #ifdef HAVE_CLOCK_GETTIME @@ -148,7 +148,7 @@ int SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex) { if (!cond) { - return SDL_SetError("Passed a NULL condition variable"); + return SDL_InvalidParamError("cond"); } else if (pthread_cond_wait(&cond->cond, &mutex->id) != 0) { return SDL_SetError("pthread_cond_wait() failed"); } diff --git a/libs/SDL2/src/thread/pthread/SDL_sysmutex.c b/libs/SDL2/src/thread/pthread/SDL_sysmutex.c index 027a6cb4..c26982ae 100644 --- a/libs/SDL2/src/thread/pthread/SDL_sysmutex.c +++ b/libs/SDL2/src/thread/pthread/SDL_sysmutex.c @@ -85,7 +85,7 @@ SDL_LockMutex(SDL_mutex * mutex) #endif if (mutex == NULL) { - return SDL_SetError("Passed a NULL mutex"); + return SDL_InvalidParamError("mutex"); } #if FAKE_RECURSIVE_MUTEX @@ -122,7 +122,7 @@ SDL_TryLockMutex(SDL_mutex * mutex) #endif if (mutex == NULL) { - return SDL_SetError("Passed a NULL mutex"); + return SDL_InvalidParamError("mutex"); } retval = 0; @@ -162,7 +162,7 @@ int SDL_UnlockMutex(SDL_mutex * mutex) { if (mutex == NULL) { - return SDL_SetError("Passed a NULL mutex"); + return SDL_InvalidParamError("mutex"); } #if FAKE_RECURSIVE_MUTEX diff --git a/libs/SDL2/src/thread/pthread/SDL_syssem.c b/libs/SDL2/src/thread/pthread/SDL_syssem.c index 2c97ef4e..9a0c8882 100644 --- a/libs/SDL2/src/thread/pthread/SDL_syssem.c +++ b/libs/SDL2/src/thread/pthread/SDL_syssem.c @@ -73,7 +73,7 @@ SDL_SemTryWait(SDL_sem * sem) int retval; if (!sem) { - return SDL_SetError("Passed a NULL semaphore"); + return SDL_InvalidParamError("sem"); } retval = SDL_MUTEX_TIMEDOUT; if (sem_trywait(&sem->sem) == 0) { @@ -88,7 +88,7 @@ SDL_SemWait(SDL_sem * sem) int retval; if (!sem) { - return SDL_SetError("Passed a NULL semaphore"); + return SDL_InvalidParamError("sem"); } do { @@ -115,7 +115,7 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout) #endif if (!sem) { - return SDL_SetError("Passed a NULL semaphore"); + return SDL_InvalidParamError("sem"); } /* Try the easy cases first */ @@ -195,7 +195,7 @@ SDL_SemPost(SDL_sem * sem) int retval; if (!sem) { - return SDL_SetError("Passed a NULL semaphore"); + return SDL_InvalidParamError("sem"); } retval = sem_post(&sem->sem); diff --git a/libs/SDL2/src/thread/pthread/SDL_systhread.c b/libs/SDL2/src/thread/pthread/SDL_systhread.c index 41184de5..3b3f40fa 100644 --- a/libs/SDL2/src/thread/pthread/SDL_systhread.c +++ b/libs/SDL2/src/thread/pthread/SDL_systhread.c @@ -30,13 +30,13 @@ #endif #include +#include #ifdef __LINUX__ #include #include #include #include -#include #include "../../core/linux/SDL_dbus.h" #endif /* __LINUX__ */ @@ -137,22 +137,29 @@ SDL_SYS_SetupThread(const char *name) #if defined(__MACOSX__) || defined(__IPHONEOS__) ppthread_setname_np(name); #elif defined(__LINUX__) - ppthread_setname_np(pthread_self(), name); + if (ppthread_setname_np(pthread_self(), name) == ERANGE) { + char namebuf[16]; /* Limited to 16 char */ + SDL_strlcpy(namebuf, name, sizeof (namebuf)); + ppthread_setname_np(pthread_self(), namebuf); + } #endif } #elif HAVE_PTHREAD_SETNAME_NP #if defined(__NETBSD__) pthread_setname_np(pthread_self(), "%s", name); #else - pthread_setname_np(pthread_self(), name); + if (pthread_setname_np(pthread_self(), name) == ERANGE) { + char namebuf[16]; /* Limited to 16 char */ + SDL_strlcpy(namebuf, name, sizeof (namebuf)); + pthread_setname_np(pthread_self(), namebuf); + } #endif #elif HAVE_PTHREAD_SET_NAME_NP pthread_set_name_np(pthread_self(), name); #elif defined(__HAIKU__) /* The docs say the thread name can't be longer than B_OS_NAME_LENGTH. */ char namebuf[B_OS_NAME_LENGTH]; - SDL_snprintf(namebuf, sizeof (namebuf), "%s", name); - namebuf[sizeof (namebuf) - 1] = '\0'; + SDL_strlcpy(namebuf, name, sizeof (namebuf)); rename_thread(find_thread(NULL), namebuf); #endif } diff --git a/libs/SDL2/src/thread/stdcpp/SDL_syscond.cpp b/libs/SDL2/src/thread/stdcpp/SDL_syscond.cpp index 8aa26d73..90c38adb 100644 --- a/libs/SDL2/src/thread/stdcpp/SDL_syscond.cpp +++ b/libs/SDL2/src/thread/stdcpp/SDL_syscond.cpp @@ -70,8 +70,7 @@ int SDL_CondSignal(SDL_cond * cond) { if (!cond) { - SDL_SetError("Passed a NULL condition variable"); - return -1; + return SDL_InvalidParamError("cond"); } cond->cpp_cond.notify_one(); @@ -84,8 +83,7 @@ int SDL_CondBroadcast(SDL_cond * cond) { if (!cond) { - SDL_SetError("Passed a NULL condition variable"); - return -1; + return SDL_InvalidParamError("cond"); } cond->cpp_cond.notify_all(); @@ -118,13 +116,11 @@ int SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms) { if (!cond) { - SDL_SetError("Passed a NULL condition variable"); - return -1; + return SDL_InvalidParamError("cond"); } if (!mutex) { - SDL_SetError("Passed a NULL mutex variable"); - return -1; + return SDL_InvalidParamError("mutex"); } try { @@ -148,8 +144,7 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms) } } } catch (std::system_error & ex) { - SDL_SetError("unable to wait on a C++ condition variable: code=%d; %s", ex.code(), ex.what()); - return -1; + return SDL_SetError("unable to wait on a C++ condition variable: code=%d; %s", ex.code(), ex.what()); } } diff --git a/libs/SDL2/src/thread/stdcpp/SDL_sysmutex.cpp b/libs/SDL2/src/thread/stdcpp/SDL_sysmutex.cpp index 4146bc98..82880104 100644 --- a/libs/SDL2/src/thread/stdcpp/SDL_sysmutex.cpp +++ b/libs/SDL2/src/thread/stdcpp/SDL_sysmutex.cpp @@ -65,16 +65,14 @@ int SDL_mutexP(SDL_mutex * mutex) { if (mutex == NULL) { - SDL_SetError("Passed a NULL mutex"); - return -1; + return SDL_InvalidParamError("mutex"); } try { mutex->cpp_mutex.lock(); return 0; } catch (std::system_error & ex) { - SDL_SetError("unable to lock a C++ mutex: code=%d; %s", ex.code(), ex.what()); - return -1; + return SDL_SetError("unable to lock a C++ mutex: code=%d; %s", ex.code(), ex.what()); } } @@ -84,7 +82,7 @@ SDL_TryLockMutex(SDL_mutex * mutex) { int retval = 0; if (mutex == NULL) { - return SDL_SetError("Passed a NULL mutex"); + return SDL_InvalidParamError("mutex"); } if (mutex->cpp_mutex.try_lock() == false) { @@ -99,8 +97,7 @@ int SDL_mutexV(SDL_mutex * mutex) { if (mutex == NULL) { - SDL_SetError("Passed a NULL mutex"); - return -1; + return SDL_InvalidParamError("mutex"); } mutex->cpp_mutex.unlock(); diff --git a/libs/SDL2/src/thread/stdcpp/SDL_systhread.cpp b/libs/SDL2/src/thread/stdcpp/SDL_systhread.cpp index 086a1fde..3d818ac5 100644 --- a/libs/SDL2/src/thread/stdcpp/SDL_systhread.cpp +++ b/libs/SDL2/src/thread/stdcpp/SDL_systhread.cpp @@ -52,11 +52,9 @@ SDL_SYS_CreateThread(SDL_Thread * thread) thread->handle = (void *) new std::thread(std::move(cpp_thread)); return 0; } catch (std::system_error & ex) { - SDL_SetError("unable to start a C++ thread: code=%d; %s", ex.code(), ex.what()); - return -1; + return SDL_SetError("unable to start a C++ thread: code=%d; %s", ex.code(), ex.what()); } catch (std::bad_alloc &) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } } diff --git a/libs/SDL2/src/thread/vita/SDL_syscond.c b/libs/SDL2/src/thread/vita/SDL_syscond.c index 799bc0ae..c6e46c47 100644 --- a/libs/SDL2/src/thread/vita/SDL_syscond.c +++ b/libs/SDL2/src/thread/vita/SDL_syscond.c @@ -84,7 +84,7 @@ int SDL_CondSignal(SDL_cond * cond) { if (!cond) { - return SDL_SetError("Passed a NULL condition variable"); + return SDL_InvalidParamError("cond"); } /* If there are waiting threads not already signalled, then @@ -108,7 +108,7 @@ int SDL_CondBroadcast(SDL_cond * cond) { if (!cond) { - return SDL_SetError("Passed a NULL condition variable"); + return SDL_InvalidParamError("cond"); } /* If there are waiting threads not already signalled, then @@ -164,7 +164,7 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms) int retval; if (!cond) { - return SDL_SetError("Passed a NULL condition variable"); + return SDL_InvalidParamError("cond"); } /* Obtain the protection mutex, and increment the number of waiters. diff --git a/libs/SDL2/src/thread/vita/SDL_sysmutex.c b/libs/SDL2/src/thread/vita/SDL_sysmutex.c index a18705a6..6327182c 100644 --- a/libs/SDL2/src/thread/vita/SDL_sysmutex.c +++ b/libs/SDL2/src/thread/vita/SDL_sysmutex.c @@ -80,7 +80,7 @@ SDL_TryLockMutex(SDL_mutex * mutex) #else SceInt32 res = 0; if (mutex == NULL) { - return SDL_SetError("Passed a NULL mutex"); + return SDL_InvalidParamError("mutex"); } res = sceKernelTryLockLwMutex(&mutex->lock, 1); @@ -110,7 +110,7 @@ SDL_mutexP(SDL_mutex * mutex) #else SceInt32 res = 0; if (mutex == NULL) { - return SDL_SetError("Passed a NULL mutex"); + return SDL_InvalidParamError("mutex"); } res = sceKernelLockLwMutex(&mutex->lock, 1, NULL); @@ -132,7 +132,7 @@ SDL_mutexV(SDL_mutex * mutex) SceInt32 res = 0; if (mutex == NULL) { - return SDL_SetError("Passed a NULL mutex"); + return SDL_InvalidParamError("mutex"); } res = sceKernelUnlockLwMutex(&mutex->lock, 1); diff --git a/libs/SDL2/src/thread/vita/SDL_syssem.c b/libs/SDL2/src/thread/vita/SDL_syssem.c index 34e4d9ca..7fecd6ca 100644 --- a/libs/SDL2/src/thread/vita/SDL_syssem.c +++ b/libs/SDL2/src/thread/vita/SDL_syssem.c @@ -83,7 +83,7 @@ int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout) unsigned int res; if (sem == NULL) { - SDL_SetError("Passed a NULL sem"); + SDL_InvalidParamError("sem"); return 0; } @@ -130,7 +130,7 @@ Uint32 SDL_SemValue(SDL_sem *sem) info.size = sizeof(info); if (sem == NULL) { - SDL_SetError("Passed a NULL sem"); + SDL_InvalidParamError("sem"); return 0; } @@ -146,7 +146,7 @@ int SDL_SemPost(SDL_sem *sem) int res; if (sem == NULL) { - return SDL_SetError("Passed a NULL sem"); + return SDL_InvalidParamError("sem"); } res = sceKernelSignalSema(sem->semid, 1); diff --git a/libs/SDL2/src/thread/windows/SDL_syscond_cv.c b/libs/SDL2/src/thread/windows/SDL_syscond_cv.c index 89c1a17f..9c0ceb3a 100644 --- a/libs/SDL2/src/thread/windows/SDL_syscond_cv.c +++ b/libs/SDL2/src/thread/windows/SDL_syscond_cv.c @@ -109,7 +109,7 @@ SDL_CondSignal_cv(SDL_cond * _cond) { SDL_cond_cv *cond = (SDL_cond_cv *)_cond; if (!cond) { - return SDL_SetError("Passed a NULL condition variable"); + return SDL_InvalidParamError("cond"); } pWakeConditionVariable(&cond->cond); @@ -122,7 +122,7 @@ SDL_CondBroadcast_cv(SDL_cond * _cond) { SDL_cond_cv *cond = (SDL_cond_cv *)_cond; if (!cond) { - return SDL_SetError("Passed a NULL condition variable"); + return SDL_InvalidParamError("cond"); } pWakeAllConditionVariable(&cond->cond); @@ -138,10 +138,10 @@ SDL_CondWaitTimeout_cv(SDL_cond * _cond, SDL_mutex * _mutex, Uint32 ms) int ret; if (!cond) { - return SDL_SetError("Passed a NULL condition variable"); + return SDL_InvalidParamError("cond"); } if (!_mutex) { - return SDL_SetError("Passed a NULL mutex"); + return SDL_InvalidParamError("mutex"); } if (ms == SDL_MUTEX_MAXWAIT) { @@ -261,7 +261,7 @@ SDL_CreateCond(void) } #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 --git a/libs/SDL2/src/thread/windows/SDL_sysmutex.c b/libs/SDL2/src/thread/windows/SDL_sysmutex.c index 327f31db..3974b336 100644 --- a/libs/SDL2/src/thread/windows/SDL_sysmutex.c +++ b/libs/SDL2/src/thread/windows/SDL_sysmutex.c @@ -88,7 +88,7 @@ SDL_LockMutex_srw(SDL_mutex * _mutex) DWORD this_thread; if (mutex == NULL) { - return SDL_SetError("Passed a NULL mutex"); + return SDL_InvalidParamError("mutex"); } this_thread = GetCurrentThreadId(); @@ -115,7 +115,7 @@ SDL_TryLockMutex_srw(SDL_mutex * _mutex) int retval = 0; if (mutex == NULL) { - return SDL_SetError("Passed a NULL mutex"); + return SDL_InvalidParamError("mutex"); } this_thread = GetCurrentThreadId(); @@ -139,7 +139,7 @@ SDL_UnlockMutex_srw(SDL_mutex * _mutex) SDL_mutex_srw *mutex = (SDL_mutex_srw *)_mutex; if (mutex == NULL) { - return SDL_SetError("Passed a NULL mutex"); + return SDL_InvalidParamError("mutex"); } if (mutex->owner == GetCurrentThreadId()) { @@ -208,7 +208,7 @@ SDL_LockMutex_cs(SDL_mutex * mutex_) { SDL_mutex_cs *mutex = (SDL_mutex_cs *)mutex_; if (mutex == NULL) { - return SDL_SetError("Passed a NULL mutex"); + return SDL_InvalidParamError("mutex"); } EnterCriticalSection(&mutex->cs); @@ -222,7 +222,7 @@ SDL_TryLockMutex_cs(SDL_mutex * mutex_) SDL_mutex_cs *mutex = (SDL_mutex_cs *)mutex_; int retval = 0; if (mutex == NULL) { - return SDL_SetError("Passed a NULL mutex"); + return SDL_InvalidParamError("mutex"); } if (TryEnterCriticalSection(&mutex->cs) == 0) { @@ -237,7 +237,7 @@ SDL_UnlockMutex_cs(SDL_mutex * mutex_) { SDL_mutex_cs *mutex = (SDL_mutex_cs *)mutex_; if (mutex == NULL) { - return SDL_SetError("Passed a NULL mutex"); + return SDL_InvalidParamError("mutex"); } LeaveCriticalSection(&mutex->cs); @@ -287,7 +287,7 @@ SDL_CreateMutex(void) } /* 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 --git a/libs/SDL2/src/thread/windows/SDL_syssem.c b/libs/SDL2/src/thread/windows/SDL_syssem.c index 3c2e69cf..629f2a9c 100644 --- a/libs/SDL2/src/thread/windows/SDL_syssem.c +++ b/libs/SDL2/src/thread/windows/SDL_syssem.c @@ -122,7 +122,7 @@ SDL_SemTryWait_atom(SDL_sem * _sem) LONG count; if (!sem) { - return SDL_SetError("Passed a NULL sem"); + return SDL_InvalidParamError("sem"); } count = sem->count; @@ -144,7 +144,7 @@ SDL_SemWait_atom(SDL_sem * _sem) LONG count; if (!sem) { - return SDL_SetError("Passed a NULL sem"); + return SDL_InvalidParamError("sem"); } for (;;) { @@ -176,7 +176,7 @@ SDL_SemWaitTimeout_atom(SDL_sem * _sem, Uint32 timeout) } if (!sem) { - return SDL_SetError("Passed a NULL sem"); + return SDL_InvalidParamError("sem"); } /** @@ -219,7 +219,7 @@ SDL_SemValue_atom(SDL_sem * _sem) SDL_sem_atom *sem = (SDL_sem_atom *)_sem; if (!sem) { - SDL_SetError("Passed a NULL sem"); + SDL_InvalidParamError("sem"); return 0; } @@ -232,7 +232,7 @@ SDL_SemPost_atom(SDL_sem * _sem) SDL_sem_atom *sem = (SDL_sem_atom *)_sem; if (!sem) { - return SDL_SetError("Passed a NULL sem"); + return SDL_InvalidParamError("sem"); } InterlockedIncrement(&sem->count); @@ -313,7 +313,7 @@ SDL_SemWaitTimeout_kern(SDL_sem * _sem, Uint32 timeout) DWORD dwMilliseconds; if (!sem) { - return SDL_SetError("Passed a NULL sem"); + return SDL_InvalidParamError("sem"); } if (timeout == SDL_MUTEX_MAXWAIT) { @@ -354,7 +354,7 @@ SDL_SemValue_kern(SDL_sem * _sem) { SDL_sem_kern *sem = (SDL_sem_kern *)_sem; if (!sem) { - SDL_SetError("Passed a NULL sem"); + SDL_InvalidParamError("sem"); return 0; } return (Uint32)sem->count; @@ -365,7 +365,7 @@ SDL_SemPost_kern(SDL_sem * _sem) { SDL_sem_kern *sem = (SDL_sem_kern *)_sem; if (!sem) { - return SDL_SetError("Passed a NULL sem"); + return SDL_InvalidParamError("sem"); } /* Increase the counter in the first place, because * after a successful release the semaphore may @@ -430,7 +430,7 @@ SDL_CreateSemaphore(Uint32 initial_value) #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 --git a/libs/SDL2/src/timer/ngage/SDL_systimer.cpp b/libs/SDL2/src/timer/ngage/SDL_systimer.cpp new file mode 100644 index 00000000..543d8494 --- /dev/null +++ b/libs/SDL2/src/timer/ngage/SDL_systimer.cpp @@ -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 --git a/libs/SDL2/src/timer/os2/SDL_systimer.c b/libs/SDL2/src/timer/os2/SDL_systimer.c index c5bcf64b..8a8425d2 100644 --- a/libs/SDL2/src/timer/os2/SDL_systimer.c +++ b/libs/SDL2/src/timer/os2/SDL_systimer.c @@ -39,6 +39,7 @@ typedef unsigned long long ULLONG; +static SDL_bool ticks_started = SDL_FALSE; static ULONG ulTmrFreq = 0; static ULLONG ullTmrStart = 0; @@ -46,7 +47,14 @@ void SDL_TicksInit(void) { ULONG ulTmrStart; /* for 32-bit fallback. */ - ULONG ulRC = DosTmrQueryFreq(&ulTmrFreq); + ULONG ulRC; + + if (ticks_started) { + return; + } + ticks_started = SDL_TRUE; + + ulRC = DosTmrQueryFreq(&ulTmrFreq); if (ulRC != NO_ERROR) { debug_os2("DosTmrQueryFreq() failed, rc = %u", ulRC); } else { @@ -65,6 +73,7 @@ SDL_TicksInit(void) void SDL_TicksQuit(void) { + ticks_started = SDL_FALSE; } Uint64 @@ -73,7 +82,7 @@ SDL_GetTicks64(void) Uint64 ui64Result; ULLONG ullTmrNow; - if (ulTmrFreq == 0) { /* Was not initialized. */ + if (!ticks_started) { SDL_TicksInit(); } diff --git a/libs/SDL2/src/timer/ps2/SDL_systimer.c b/libs/SDL2/src/timer/ps2/SDL_systimer.c new file mode 100644 index 00000000..42d29680 --- /dev/null +++ b/libs/SDL2/src/timer/ps2/SDL_systimer.c @@ -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 --git a/libs/SDL2/src/timer/unix/SDL_systimer.c b/libs/SDL2/src/timer/unix/SDL_systimer.c index 57fdab09..406bd48c 100644 --- a/libs/SDL2/src/timer/unix/SDL_systimer.c +++ b/libs/SDL2/src/timer/unix/SDL_systimer.c @@ -87,8 +87,7 @@ SDL_TicksInit(void) 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 @@ -187,13 +186,6 @@ SDL_GetPerformanceFrequency(void) void SDL_Delay(Uint32 ms) { -#ifdef __EMSCRIPTEN__ - if (emscripten_has_asyncify() && SDL_GetHintBoolean(SDL_HINT_EMSCRIPTEN_ASYNCIFY, SDL_TRUE)) { - /* pseudo-synchronous pause, used directly or through e.g. SDL_WaitEvent */ - emscripten_sleep(ms); - return; - } -#endif int was_error; #if HAVE_NANOSLEEP @@ -203,6 +195,14 @@ SDL_Delay(Uint32 ms) Uint64 then, now, elapsed; #endif +#ifdef __EMSCRIPTEN__ + if (emscripten_has_asyncify() && SDL_GetHintBoolean(SDL_HINT_EMSCRIPTEN_ASYNCIFY, SDL_TRUE)) { + /* pseudo-synchronous pause, used directly or through e.g. SDL_WaitEvent */ + emscripten_sleep(ms); + return; + } +#endif + /* Set the timeout interval */ #if HAVE_NANOSLEEP elapsed.tv_sec = ms / 1000; diff --git a/libs/SDL2/src/timer/windows/SDL_systimer.c b/libs/SDL2/src/timer/windows/SDL_systimer.c index 7972db13..52dea837 100644 --- a/libs/SDL2/src/timer/windows/SDL_systimer.c +++ b/libs/SDL2/src/timer/windows/SDL_systimer.c @@ -41,7 +41,7 @@ static LARGE_INTEGER ticks_per_second; 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 --git a/libs/SDL2/src/video/SDL_RLEaccel.c b/libs/SDL2/src/video/SDL_RLEaccel.c index 983c9d91..b67b765e 100644 --- a/libs/SDL2/src/video/SDL_RLEaccel.c +++ b/libs/SDL2/src/video/SDL_RLEaccel.c @@ -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 @@ RLEAlphaSurface(SDL_Surface * surface) 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 @@ RLEAlphaSurface(SDL_Surface * surface) 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 @@ RLEAlphaSurface(SDL_Surface * surface) /* 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 @@ RLEColorkeySurface(SDL_Surface * surface) 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 @@ RLEColorkeySurface(SDL_Surface * surface) /* 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 --git a/libs/SDL2/src/video/SDL_blit.c b/libs/SDL2/src/video/SDL_blit.c index dc4d7e9c..fa6492f5 100644 --- a/libs/SDL2/src/video/SDL_blit.c +++ b/libs/SDL2/src/video/SDL_blit.c @@ -231,9 +231,7 @@ SDL_CalculateBlit(SDL_Surface * surface) if (map->identity && !(map->info.flags & ~SDL_COPY_RLE_DESIRED)) { blit = SDL_BlitCopy; } else if (surface->format->Rloss > 8 || dst->format->Rloss > 8) { - /* Greater than 8 bits per channel not supported yet */ - SDL_InvalidateMap(map); - return SDL_SetError("Blit combination not supported"); + blit = SDL_Blit_Slow; } #if SDL_HAVE_BLIT_0 else if (surface->format->BitsPerPixel < 8 && diff --git a/libs/SDL2/src/video/SDL_blit.h b/libs/SDL2/src/video/SDL_blit.h index 53222e44..2f99fa8d 100644 --- a/libs/SDL2/src/video/SDL_blit.h +++ b/libs/SDL2/src/video/SDL_blit.h @@ -90,7 +90,8 @@ typedef struct } 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 @@ typedef struct SDL_BlitMap 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); @@ -269,18 +270,18 @@ do { \ { \ switch (bpp) { \ case 1: { \ - Uint8 _Pixel; \ + Uint8 _pixel; \ \ - PIXEL_FROM_RGB(_Pixel, fmt, r, g, b); \ - *((Uint8 *)(buf)) = _Pixel; \ + PIXEL_FROM_RGB(_pixel, fmt, r, g, b); \ + *((Uint8 *)(buf)) = _pixel; \ } \ break; \ \ case 2: { \ - Uint16 _Pixel; \ + Uint16 _pixel; \ \ - PIXEL_FROM_RGB(_Pixel, fmt, r, g, b); \ - *((Uint16 *)(buf)) = _Pixel; \ + PIXEL_FROM_RGB(_pixel, fmt, r, g, b); \ + *((Uint16 *)(buf)) = _pixel; \ } \ break; \ \ @@ -298,10 +299,10 @@ do { \ break; \ \ case 4: { \ - Uint32 _Pixel; \ + Uint32 _pixel; \ \ - PIXEL_FROM_RGB(_Pixel, fmt, r, g, b); \ - *((Uint32 *)(buf)) = _Pixel; \ + PIXEL_FROM_RGB(_pixel, fmt, r, g, b); \ + *((Uint32 *)(buf)) = _pixel; \ } \ break; \ } \ diff --git a/libs/SDL2/src/video/SDL_blit_0.c b/libs/SDL2/src/video/SDL_blit_0.c index e2eecba7..54882f8b 100644 --- a/libs/SDL2/src/video/SDL_blit_0.c +++ b/libs/SDL2/src/video/SDL_blit_0.c @@ -452,11 +452,94 @@ static const SDL_BlitFunc colorkey_blit[] = { (SDL_BlitFunc) NULL, BlitBto1Key, BlitBto2Key, BlitBto3Key, BlitBto4Key }; + +static void +Blit4bto4(SDL_BlitInfo * info) +{ + int width = info->dst_w; + int height = info->dst_h; + Uint8 *src = info->src; + Uint32 *dst = (Uint32 *) info->dst; + int srcskip = info->src_skip; + int dstskip = info->dst_skip; + Uint32 *map = (Uint32 *) info->table; + int c; + + /* Set up some basic variables */ + srcskip += width - (width + 1) / 2; + + while (height--) { + Uint8 byte = 0, bit; + for (c = 0; c < width; ++c) { + if ((c & 0x1) == 0) { + byte = *src++; + } + bit = (byte & 0xF0) >> 4; + if (1) { + *dst = map[bit]; + } + byte <<= 4; + dst++; + } + src += srcskip; + dst = (Uint32 *) ((Uint8 *) dst + dstskip); + } +} + +static void +Blit4bto4Key(SDL_BlitInfo * info) +{ + int width = info->dst_w; + int height = info->dst_h; + Uint8 *src = info->src; + Uint32 *dst = (Uint32 *) info->dst; + int srcskip = info->src_skip; + int dstskip = info->dst_skip; + Uint32 ckey = info->colorkey; + Uint32 *map = (Uint32 *) info->table; + int c; + + /* Set up some basic variables */ + srcskip += width - (width + 1) / 2; + + while (height--) { + Uint8 byte = 0, bit; + for (c = 0; c < width; ++c) { + if ((c & 0x1) == 0) { + byte = *src++; + } + bit = (byte & 0xF0) >> 4; + if (bit != ckey) { + *dst = map[bit]; + } + byte <<= 4; + dst++; + } + src += srcskip; + dst = (Uint32 *) ((Uint8 *) dst + dstskip); + } +} + SDL_BlitFunc SDL_CalculateBlit0(SDL_Surface * surface) { int which; + /* 4bits to 32bits */ + if (surface->format->BitsPerPixel == 4) { + if (surface->map->dst->format->BytesPerPixel == 4) { + switch (surface->map->info.flags & ~SDL_COPY_RLE_MASK) { + case 0: + return Blit4bto4; + + case SDL_COPY_COLORKEY: + return Blit4bto4Key; + } + } + /* We don't fully support 4-bit packed pixel modes */ + return NULL; + } + if (surface->format->BitsPerPixel != 1) { /* We don't support sub 8-bit packed pixel modes */ return (SDL_BlitFunc) NULL; diff --git a/libs/SDL2/src/video/SDL_blit_1.c b/libs/SDL2/src/video/SDL_blit_1.c index d5030cfb..2c353fd2 100644 --- a/libs/SDL2/src/video/SDL_blit_1.c +++ b/libs/SDL2/src/video/SDL_blit_1.c @@ -50,7 +50,7 @@ Blit1to1(SDL_BlitInfo * info) while (height--) { #ifdef USE_DUFFS_LOOP - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { *dst = map[*src]; @@ -58,7 +58,7 @@ Blit1to1(SDL_BlitInfo * info) dst++; src++; , width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ #else for (c = width; c; --c) { *dst = map[*src]; @@ -103,14 +103,14 @@ Blit1to2(SDL_BlitInfo * info) #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 @@ Blit1to3(SDL_BlitInfo * info) while (height--) { #ifdef USE_DUFFS_LOOP - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { o = *src * 4; @@ -221,7 +221,7 @@ Blit1to3(SDL_BlitInfo * info) src++; dst += 3; , width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ #else for (c = width; c; --c) { o = *src * 4; @@ -259,11 +259,11 @@ Blit1to4(SDL_BlitInfo * info) 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 @@ Blit1to1Key(SDL_BlitInfo * info) if (palmap) { while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { if ( *src != ckey ) { @@ -309,13 +309,13 @@ Blit1to1Key(SDL_BlitInfo * info) 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 @@ Blit1to1Key(SDL_BlitInfo * info) src++; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -348,7 +348,7 @@ Blit1to2Key(SDL_BlitInfo * info) dstskip /= 2; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { if ( *src != ckey ) { @@ -358,7 +358,7 @@ Blit1to2Key(SDL_BlitInfo * info) dstp++; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dstp += dstskip; } @@ -378,7 +378,7 @@ Blit1to3Key(SDL_BlitInfo * info) int o; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { if ( *src != ckey ) { @@ -391,7 +391,7 @@ Blit1to3Key(SDL_BlitInfo * info) dst += 3; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -413,7 +413,7 @@ Blit1to4Key(SDL_BlitInfo * info) dstskip /= 4; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { if ( *src != ckey ) { @@ -423,7 +423,7 @@ Blit1to4Key(SDL_BlitInfo * info) dstp++; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dstp += dstskip; } @@ -450,7 +450,7 @@ Blit1toNAlpha(SDL_BlitInfo * info) dstbpp = dstfmt->BytesPerPixel; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP4( { sR = srcpal[*src].r; @@ -463,7 +463,7 @@ Blit1toNAlpha(SDL_BlitInfo * info) dst += dstbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -491,7 +491,7 @@ Blit1toNAlphaKey(SDL_BlitInfo * info) dstbpp = dstfmt->BytesPerPixel; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { if ( *src != ckey ) { @@ -506,7 +506,7 @@ Blit1toNAlphaKey(SDL_BlitInfo * info) dst += dstbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } diff --git a/libs/SDL2/src/video/SDL_blit_A.c b/libs/SDL2/src/video/SDL_blit_A.c index 4c0726eb..56ba024c 100644 --- a/libs/SDL2/src/video/SDL_blit_A.c +++ b/libs/SDL2/src/video/SDL_blit_A.c @@ -47,7 +47,7 @@ BlitNto1SurfaceAlpha(SDL_BlitInfo * info) 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 @@ BlitNto1SurfaceAlpha(SDL_BlitInfo * info) src += srcbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -93,7 +93,7 @@ BlitNto1PixelAlpha(SDL_BlitInfo * info) 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 @@ BlitNto1PixelAlpha(SDL_BlitInfo * info) src += srcbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -141,7 +141,7 @@ BlitNto1SurfaceAlphaKey(SDL_BlitInfo * info) 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 @@ BlitNto1SurfaceAlphaKey(SDL_BlitInfo * info) src += srcbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -348,7 +348,7 @@ BlitRGBtoRGBPixelAlphaMMX(SDL_BlitInfo * info) multmask2 = 0x00FF00FF00FF00FFULL; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP4({ Uint32 alpha = *srcp & amask; if (alpha == 0) { @@ -382,7 +382,7 @@ BlitRGBtoRGBPixelAlphaMMX(SDL_BlitInfo * info) ++srcp; ++dstp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ srcp += srcskip; dstp += dstskip; } @@ -467,14 +467,14 @@ BlitRGBtoRGBSurfaceAlpha128(SDL_BlitInfo * info) 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 @@ BlitRGBtoRGBSurfaceAlpha(SDL_BlitInfo * info) Uint32 d1; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP4({ s = *srcp; d = *dstp; @@ -515,7 +515,7 @@ BlitRGBtoRGBSurfaceAlpha(SDL_BlitInfo * info) ++srcp; ++dstp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ srcp += srcskip; dstp += dstskip; } @@ -534,7 +534,7 @@ BlitRGBtoRGBPixelAlpha(SDL_BlitInfo * info) 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 @@ BlitRGBtoRGBPixelAlpha(SDL_BlitInfo * info) ++srcp; ++dstp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ srcp += srcskip; dstp += dstskip; } @@ -587,7 +587,7 @@ BlitRGBtoBGRPixelAlpha(SDL_BlitInfo * info) 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 @@ BlitRGBtoBGRPixelAlpha(SDL_BlitInfo * info) ++srcp; ++dstp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ srcp += srcskip; dstp += dstskip; } @@ -654,7 +654,7 @@ BlitRGBtoRGBPixelAlphaMMX3DNOW(SDL_BlitInfo * info) multmask2 = 0x00FF00FF00FF00FFULL; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP4({ Uint32 alpha; @@ -694,7 +694,7 @@ BlitRGBtoRGBPixelAlphaMMX3DNOW(SDL_BlitInfo * info) ++srcp; ++dstp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ srcp += srcskip; dstp += dstskip; } @@ -848,7 +848,7 @@ Blit565to565SurfaceAlphaMMX(SDL_BlitInfo * info) 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 @@ Blit565to565SurfaceAlphaMMX(SDL_BlitInfo * info) srcp += 4; dstp += 4; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ srcp += srcskip; dstp += dstskip; } @@ -986,7 +986,7 @@ Blit555to555SurfaceAlphaMMX(SDL_BlitInfo * info) 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 @@ Blit555to555SurfaceAlphaMMX(SDL_BlitInfo * info) srcp += 4; dstp += 4; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ srcp += srcskip; dstp += dstskip; } @@ -1109,7 +1109,7 @@ Blit565to565SurfaceAlpha(SDL_BlitInfo * info) 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 @@ Blit565to565SurfaceAlpha(SDL_BlitInfo * info) d &= 0x07e0f81f; *dstp++ = (Uint16)(d | d >> 16); }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ srcp += srcskip; dstp += dstskip; } @@ -1148,7 +1148,7 @@ Blit555to555SurfaceAlpha(SDL_BlitInfo * info) 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 @@ Blit555to555SurfaceAlpha(SDL_BlitInfo * info) d &= 0x03e07c1f; *dstp++ = (Uint16)(d | d >> 16); }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ srcp += srcskip; dstp += dstskip; } @@ -1182,7 +1182,7 @@ BlitARGBto565PixelAlpha(SDL_BlitInfo * info) 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 @@ BlitARGBto565PixelAlpha(SDL_BlitInfo * info) srcp++; dstp++; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ srcp += srcskip; dstp += dstskip; } @@ -1228,7 +1228,7 @@ BlitARGBto555PixelAlpha(SDL_BlitInfo * info) 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 @@ BlitARGBto555PixelAlpha(SDL_BlitInfo * info) srcp++; dstp++; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ srcp += srcskip; dstp += dstskip; } @@ -1284,7 +1284,7 @@ BlitNtoNSurfaceAlpha(SDL_BlitInfo * info) 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 @@ BlitNtoNSurfaceAlpha(SDL_BlitInfo * info) dst += dstbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -1323,7 +1323,7 @@ BlitNtoNSurfaceAlphaKey(SDL_BlitInfo * info) 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 @@ BlitNtoNSurfaceAlphaKey(SDL_BlitInfo * info) dst += dstbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -1366,7 +1366,7 @@ BlitNtoNPixelAlpha(SDL_BlitInfo * info) 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 @@ BlitNtoNPixelAlpha(SDL_BlitInfo * info) dst += dstbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } diff --git a/libs/SDL2/src/video/SDL_blit_N.c b/libs/SDL2/src/video/SDL_blit_N.c index 5736b86e..ae9c3088 100644 --- a/libs/SDL2/src/video/SDL_blit_N.c +++ b/libs/SDL2/src/video/SDL_blit_N.c @@ -128,7 +128,7 @@ calc_swizzle32(const SDL_PixelFormat * srcfmt, const SDL_PixelFormat * dstfmt) * leave alpha with a zero mask, but we should still swizzle the bits. */ /* ARGB */ - const static const struct SDL_PixelFormat default_pixel_format = { + static const struct SDL_PixelFormat default_pixel_format = { 0, NULL, 0, 0, {0, 0}, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000, @@ -1008,11 +1008,11 @@ Blit_RGB888_index8(SDL_BlitInfo * info) 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 @@ Blit_RGB888_index8(SDL_BlitInfo * info) 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 @@ Blit_RGB101010_index8(SDL_BlitInfo * info) 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 @@ Blit_RGB101010_index8(SDL_BlitInfo * info) 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 @@ Blit_RGB888_RGB555(SDL_BlitInfo * info) #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 @@ Blit_RGB888_RGB565(SDL_BlitInfo * info) #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 @@ Blit_RGB565_32(SDL_BlitInfo * info, const Uint32 * map) #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 @@ Blit_RGB555_ARGB1555(SDL_BlitInfo * info) 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 @@ Blit_RGB555_ARGB1555(SDL_BlitInfo * info) ++src; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src = (Uint16 *) ((Uint8 *) src + srcskip); dst = (Uint16 *) ((Uint8 *) dst + dstskip); } @@ -2132,7 +2132,7 @@ BlitNto1(SDL_BlitInfo * info) 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 @@ BlitNto1(SDL_BlitInfo * info) 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 @@ BlitNto1(SDL_BlitInfo * info) } 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 @@ BlitNto1(SDL_BlitInfo * info) 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 @@ Blit4to4MaskAlpha(SDL_BlitInfo * info) 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 @@ Blit4to4MaskAlpha(SDL_BlitInfo * info) ++src; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src = (Uint32 *) ((Uint8 *) src + srcskip); dst = (Uint32 *) ((Uint8 *) dst + dstskip); } @@ -2231,7 +2231,7 @@ Blit4to4MaskAlpha(SDL_BlitInfo * info) 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 @@ Blit4to4MaskAlpha(SDL_BlitInfo * info) ++src; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src = (Uint32 *) ((Uint8 *) src + srcskip); dst = (Uint32 *) ((Uint8 *) dst + dstskip); } @@ -2259,7 +2259,7 @@ Blit4to4CopyAlpha(SDL_BlitInfo * info) /* RGBA->RGBA, COPY_ALPHA */ while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { *dst = *src; @@ -2267,7 +2267,7 @@ Blit4to4CopyAlpha(SDL_BlitInfo * info) ++src; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src = (Uint32 *) ((Uint8 *) src + srcskip); dst = (Uint32 *) ((Uint8 *) dst + dstskip); } @@ -2380,7 +2380,7 @@ BlitNtoN(SDL_BlitInfo * info) 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 @@ BlitNtoN(SDL_BlitInfo * info) src += 4; dst += 4; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -2408,7 +2408,7 @@ BlitNtoN(SDL_BlitInfo * info) 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 @@ BlitNtoN(SDL_BlitInfo * info) src += 4; dst += 3; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -2434,7 +2434,7 @@ BlitNtoN(SDL_BlitInfo * info) 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 @@ BlitNtoN(SDL_BlitInfo * info) src += 3; dst += 4; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -2454,7 +2454,7 @@ BlitNtoN(SDL_BlitInfo * info) #endif while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { Uint32 Pixel; @@ -2467,7 +2467,7 @@ BlitNtoN(SDL_BlitInfo * info) src += srcbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -2499,7 +2499,7 @@ BlitNtoNCopyAlpha(SDL_BlitInfo * info) 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 @@ BlitNtoNCopyAlpha(SDL_BlitInfo * info) src += 4; dst += 4; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -2554,7 +2554,7 @@ BlitNto1Key(SDL_BlitInfo * info) if (palmap == NULL) { while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, @@ -2569,13 +2569,13 @@ BlitNto1Key(SDL_BlitInfo * info) 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 @@ BlitNto1Key(SDL_BlitInfo * info) src += srcbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -2615,7 +2615,7 @@ Blit2to2Key(SDL_BlitInfo * info) ckey &= rgbmask; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { if ( (*srcp & rgbmask) != ckey ) { @@ -2625,7 +2625,7 @@ Blit2to2Key(SDL_BlitInfo * info) srcp++; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ srcp += srcskip; dstp += dstskip; } @@ -2662,7 +2662,7 @@ BlitNtoNKey(SDL_BlitInfo * info) /* 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 @@ BlitNtoNKey(SDL_BlitInfo * info) ++dst32; ++src32; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src32 = (Uint32 *) ((Uint8 *) src32 + srcskip); dst32 = (Uint32 *) ((Uint8 *) dst32 + dstskip); } @@ -2680,7 +2680,7 @@ BlitNtoNKey(SDL_BlitInfo * info) /* 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 @@ BlitNtoNKey(SDL_BlitInfo * info) ++dst32; ++src32; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src32 = (Uint32 *) ((Uint8 *) src32 + srcskip); dst32 = (Uint32 *) ((Uint8 *) dst32 + dstskip); } @@ -2708,7 +2708,7 @@ BlitNtoNKey(SDL_BlitInfo * info) 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 @@ BlitNtoNKey(SDL_BlitInfo * info) src += 4; dst += 4; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -2746,7 +2746,7 @@ BlitNtoNKey(SDL_BlitInfo * info) #endif while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { Uint8 s0 = src[0]; @@ -2762,7 +2762,7 @@ BlitNtoNKey(SDL_BlitInfo * info) dst += 3; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -2784,7 +2784,7 @@ BlitNtoNKey(SDL_BlitInfo * info) #endif while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { Uint8 s0 = src[0]; @@ -2800,7 +2800,7 @@ BlitNtoNKey(SDL_BlitInfo * info) dst += 3; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -2816,7 +2816,7 @@ BlitNtoNKey(SDL_BlitInfo * info) 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 @@ BlitNtoNKey(SDL_BlitInfo * info) src += 4; dst += 3; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -2855,7 +2855,7 @@ BlitNtoNKey(SDL_BlitInfo * info) 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 @@ BlitNtoNKey(SDL_BlitInfo * info) src += 3; dst += 4; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -2881,7 +2881,7 @@ BlitNtoNKey(SDL_BlitInfo * info) #endif while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { Uint32 Pixel; @@ -2897,7 +2897,7 @@ BlitNtoNKey(SDL_BlitInfo * info) src += srcbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -2938,7 +2938,7 @@ BlitNtoNKeyCopyAlpha(SDL_BlitInfo * info) 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 @@ BlitNtoNKeyCopyAlpha(SDL_BlitInfo * info) ++dst32; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src32 = (Uint32 *)((Uint8 *)src32 + srcskip); dst32 = (Uint32 *)((Uint8 *)dst32 + dstskip); } @@ -2967,7 +2967,7 @@ BlitNtoNKeyCopyAlpha(SDL_BlitInfo * info) 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 @@ BlitNtoNKeyCopyAlpha(SDL_BlitInfo * info) src += 4; dst += 4; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -2989,7 +2989,7 @@ BlitNtoNKeyCopyAlpha(SDL_BlitInfo * info) #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 @@ BlitNtoNKeyCopyAlpha(SDL_BlitInfo * info) src += srcbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -3022,7 +3022,7 @@ Blit2101010toN(SDL_BlitInfo * info) unsigned sR, sG, sB, sA; while (height--) { - /* *INDENT-OFF* */ + /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( { Pixel = *(Uint32 *)src; @@ -3032,7 +3032,7 @@ Blit2101010toN(SDL_BlitInfo * info) src += 4; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -3054,7 +3054,7 @@ BlitNto2101010(SDL_BlitInfo * info) 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 @@ BlitNto2101010(SDL_BlitInfo * info) src += srcbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -3096,7 +3096,7 @@ Blit_3or4_to_3or4__same_rgb(SDL_BlitInfo * info) 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 @@ Blit_3or4_to_3or4__same_rgb(SDL_BlitInfo * info) dst += 4; src += srcbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -3125,7 +3125,7 @@ Blit_3or4_to_3or4__same_rgb(SDL_BlitInfo * info) 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 @@ Blit_3or4_to_3or4__same_rgb(SDL_BlitInfo * info) dst += dstbpp; src += srcbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -3169,7 +3169,7 @@ Blit_3or4_to_3or4__inversed_rgb(SDL_BlitInfo * info) #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 @@ Blit_3or4_to_3or4__inversed_rgb(SDL_BlitInfo * info) dst += 4; src += 4; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -3197,7 +3197,7 @@ Blit_3or4_to_3or4__inversed_rgb(SDL_BlitInfo * info) 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 @@ Blit_3or4_to_3or4__inversed_rgb(SDL_BlitInfo * info) dst += 4; src += srcbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } @@ -3228,7 +3228,7 @@ Blit_3or4_to_3or4__inversed_rgb(SDL_BlitInfo * info) 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 @@ Blit_3or4_to_3or4__inversed_rgb(SDL_BlitInfo * info) dst += dstbpp; src += srcbpp; }, width); - /* *INDENT-ON* */ + /* *INDENT-ON* */ /* clang-format on */ src += srcskip; dst += dstskip; } diff --git a/libs/SDL2/src/video/SDL_blit_auto.c b/libs/SDL2/src/video/SDL_blit_auto.c index 359c1bdf..f15a4362 100644 --- a/libs/SDL2/src/video/SDL_blit_auto.c +++ b/libs/SDL2/src/video/SDL_blit_auto.c @@ -23,7 +23,7 @@ #if SDL_HAVE_BLIT_AUTO -/* *INDENT-OFF* */ +/* *INDENT-OFF* */ /* clang-format off */ #include "SDL_video.h" #include "SDL_blit.h" @@ -756,7 +756,6 @@ static void SDL_Blit_RGB888_ARGB8888_Scale(SDL_BlitInfo *info) { Uint32 pixel; const Uint32 A = 0xFF; - Uint32 R, G, B; int srcy, srcx; Uint32 posy, posx; int incy, incx; @@ -776,8 +775,7 @@ static void SDL_Blit_RGB888_ARGB8888_Scale(SDL_BlitInfo *info) srcx = posx >> 16; src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); pixel = *src; - R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; - pixel = (A << 24) | (R << 16) | (G << 8) | B; + pixel |= (A << 24); *dst = pixel; posx += incx; ++dst; @@ -2232,7 +2230,6 @@ static void SDL_Blit_BGR888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) static void SDL_Blit_ARGB8888_RGB888_Scale(SDL_BlitInfo *info) { Uint32 pixel; - Uint32 R, G, B; int srcy, srcx; Uint32 posy, posx; int incy, incx; @@ -2252,8 +2249,7 @@ static void SDL_Blit_ARGB8888_RGB888_Scale(SDL_BlitInfo *info) srcx = posx >> 16; src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); pixel = *src; - R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; - pixel = (R << 16) | (G << 8) | B; + pixel &= 0xFFFFFF; *dst = pixel; posx += incx; ++dst; @@ -3395,7 +3391,6 @@ static void SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) static void SDL_Blit_RGBA8888_RGB888_Scale(SDL_BlitInfo *info) { Uint32 pixel; - Uint32 R, G, B; int srcy, srcx; Uint32 posy, posx; int incy, incx; @@ -3415,8 +3410,7 @@ static void SDL_Blit_RGBA8888_RGB888_Scale(SDL_BlitInfo *info) srcx = posx >> 16; src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); pixel = *src; - R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); - pixel = (R << 16) | (G << 8) | B; + pixel >>= 8; *dst = pixel; posx += incx; ++dst; @@ -4163,7 +4157,6 @@ static void SDL_Blit_RGBA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) static void SDL_Blit_RGBA8888_ARGB8888_Scale(SDL_BlitInfo *info) { Uint32 pixel; - Uint32 R, G, B, A; int srcy, srcx; Uint32 posy, posx; int incy, incx; @@ -4183,8 +4176,7 @@ static void SDL_Blit_RGBA8888_ARGB8888_Scale(SDL_BlitInfo *info) srcx = posx >> 16; src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); pixel = *src; - R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; - pixel = (A << 24) | (R << 16) | (G << 8) | B; + pixel = (pixel >> 8) | (pixel << 24); *dst = pixel; posx += incx; ++dst; @@ -4947,7 +4939,6 @@ static void SDL_Blit_ABGR8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) static void SDL_Blit_ABGR8888_BGR888_Scale(SDL_BlitInfo *info) { Uint32 pixel; - Uint32 R, G, B; int srcy, srcx; Uint32 posy, posx; int incy, incx; @@ -4967,8 +4958,7 @@ static void SDL_Blit_ABGR8888_BGR888_Scale(SDL_BlitInfo *info) srcx = posx >> 16; src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); pixel = *src; - B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; - pixel = (B << 16) | (G << 8) | R; + pixel &= 0xFFFFFF; *dst = pixel; posx += incx; ++dst; @@ -6115,7 +6105,6 @@ static void SDL_Blit_BGRA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) static void SDL_Blit_BGRA8888_BGR888_Scale(SDL_BlitInfo *info) { Uint32 pixel; - Uint32 R, G, B; int srcy, srcx; Uint32 posy, posx; int incy, incx; @@ -6135,8 +6124,7 @@ static void SDL_Blit_BGRA8888_BGR888_Scale(SDL_BlitInfo *info) srcx = posx >> 16; src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); pixel = *src; - B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); - pixel = (B << 16) | (G << 8) | R; + pixel >>= 8; *dst = pixel; posx += incx; ++dst; @@ -7026,7 +7014,7 @@ SDL_BlitFuncEntry SDL_GeneratedBlitFuncTable[] = { { 0, 0, 0, 0, NULL } }; -/* *INDENT-ON* */ +/* *INDENT-ON* */ /* clang-format on */ #endif /* SDL_HAVE_BLIT_AUTO */ diff --git a/libs/SDL2/src/video/SDL_blit_slow.c b/libs/SDL2/src/video/SDL_blit_slow.c index a104517e..ed9c692b 100644 --- a/libs/SDL2/src/video/SDL_blit_slow.c +++ b/libs/SDL2/src/video/SDL_blit_slow.c @@ -24,6 +24,21 @@ #include "SDL_blit.h" #include "SDL_blit_slow.h" +#define FORMAT_ALPHA 0 +#define FORMAT_NO_ALPHA -1 +#define FORMAT_2101010 1 +#define FORMAT_HAS_ALPHA(format) format == 0 +#define FORMAT_HAS_NO_ALPHA(format) format < 0 +static int SDL_INLINE detect_format(SDL_PixelFormat *pf) { + if (pf->format == SDL_PIXELFORMAT_ARGB2101010) { + return FORMAT_2101010; + } else if (pf->Amask) { + return FORMAT_ALPHA; + } else { + return FORMAT_NO_ALPHA; + } +} + /* The ONE TRUE BLITTER * This puppy has to handle all the unoptimized cases - yes, it's slow. */ @@ -46,9 +61,14 @@ SDL_Blit_Slow(SDL_BlitInfo * info) SDL_PixelFormat *dst_fmt = info->dst_fmt; int srcbpp = src_fmt->BytesPerPixel; int dstbpp = dst_fmt->BytesPerPixel; + int srcfmt_val; + int dstfmt_val; Uint32 rgbmask = ~src_fmt->Amask; Uint32 ckey = info->colorkey & rgbmask; + srcfmt_val = detect_format(src_fmt); + dstfmt_val = detect_format(dst_fmt); + incy = (info->src_h << 16) / info->dst_h; incx = (info->src_w << 16) / info->dst_w; posy = incy / 2; /* start at the middle of pixel */ @@ -62,14 +82,18 @@ SDL_Blit_Slow(SDL_BlitInfo * info) while (n--) { srcx = posx >> 16; src = (info->src + (srcy * info->src_pitch) + (srcx * srcbpp)); - if (src_fmt->Amask) { - DISEMBLE_RGBA(src, srcbpp, src_fmt, srcpixel, srcR, srcG, - srcB, srcA); - } else { - DISEMBLE_RGB(src, srcbpp, src_fmt, srcpixel, srcR, srcG, - srcB); + + if (FORMAT_HAS_ALPHA(srcfmt_val)) { + DISEMBLE_RGBA(src, srcbpp, src_fmt, srcpixel, srcR, srcG, srcB, srcA); + } else if (FORMAT_HAS_NO_ALPHA(srcfmt_val)) { + DISEMBLE_RGB(src, srcbpp, src_fmt, srcpixel, srcR, srcG, srcB); srcA = 0xFF; + } else { + /* SDL_PIXELFORMAT_ARGB2101010 */ + srcpixel = *((Uint32 *)(src)); + RGBA_FROM_ARGB2101010(srcpixel, srcR, srcG, srcB, srcA); } + if (flags & SDL_COPY_COLORKEY) { /* srcpixel isn't set for 24 bpp */ if (srcbpp == 3) { @@ -82,13 +106,15 @@ SDL_Blit_Slow(SDL_BlitInfo * info) continue; } } - if (dst_fmt->Amask) { - DISEMBLE_RGBA(dst, dstbpp, dst_fmt, dstpixel, dstR, dstG, - dstB, dstA); - } else { - DISEMBLE_RGB(dst, dstbpp, dst_fmt, dstpixel, dstR, dstG, - dstB); + if (FORMAT_HAS_ALPHA(dstfmt_val)) { + DISEMBLE_RGBA(dst, dstbpp, dst_fmt, dstpixel, dstR, dstG, dstB, dstA); + } else if (FORMAT_HAS_NO_ALPHA(dstfmt_val)) { + DISEMBLE_RGB(dst, dstbpp, dst_fmt, dstpixel, dstR, dstG, dstB); dstA = 0xFF; + } else { + /* SDL_PIXELFORMAT_ARGB2101010 */ + dstpixel = *((Uint32 *)(dst)); + RGBA_FROM_ARGB2101010(dstpixel, dstR, dstG, dstB, dstA); } if (flags & SDL_COPY_MODULATE_COLOR) { @@ -151,10 +177,15 @@ SDL_Blit_Slow(SDL_BlitInfo * info) dstA = 255; break; } - if (dst_fmt->Amask) { + if (FORMAT_HAS_ALPHA(dstfmt_val)) { ASSEMBLE_RGBA(dst, dstbpp, dst_fmt, dstR, dstG, dstB, dstA); - } else { + } else if (FORMAT_HAS_NO_ALPHA(dstfmt_val)) { ASSEMBLE_RGB(dst, dstbpp, dst_fmt, dstR, dstG, dstB); + } else { + /* SDL_PIXELFORMAT_ARGB2101010 */ + Uint32 pixel; + ARGB2101010_FROM_RGBA(pixel, dstR, dstG, dstB, dstA); + *(Uint32 *)dst = pixel; } posx += incx; dst += dstbpp; diff --git a/libs/SDL2/src/video/SDL_bmp.c b/libs/SDL2/src/video/SDL_bmp.c index 5bddd735..cb220440 100644 --- a/libs/SDL2/src/video/SDL_bmp.c +++ b/libs/SDL2/src/video/SDL_bmp.c @@ -53,7 +53,7 @@ #define LCS_WINDOWS_COLOR_SPACE 0x57696E20 #endif -static int readRlePixels(SDL_Surface * surface, SDL_RWops * src, int isRle8) +static SDL_bool readRlePixels(SDL_Surface * surface, SDL_RWops * src, int isRle8) { /* | Sets the surface pixels from src. A bmp image is upside down. @@ -70,14 +70,14 @@ static int readRlePixels(SDL_Surface * surface, SDL_RWops * src, int isRle8) #define COPY_PIXEL(x) spot = &bits[ofs++]; if(spot >= start && spot < end) *spot = (x) for (;;) { - if (!SDL_RWread(src, &ch, 1, 1)) return 1; + if (!SDL_RWread(src, &ch, 1, 1)) return SDL_TRUE; /* | encoded mode starts with a run length, and then a byte | with two colour indexes to alternate between for the run */ if (ch) { Uint8 pixel; - if (!SDL_RWread(src, &pixel, 1, 1)) return 1; + if (!SDL_RWread(src, &pixel, 1, 1)) return SDL_TRUE; if (isRle8) { /* 256-color bitmap, compressed */ do { COPY_PIXEL(pixel); @@ -98,18 +98,18 @@ static int readRlePixels(SDL_Surface * surface, SDL_RWops * src, int isRle8) | a cursor move, or some absolute data. | zero tag may be absolute mode or an escape */ - if (!SDL_RWread(src, &ch, 1, 1)) return 1; + if (!SDL_RWread(src, &ch, 1, 1)) return SDL_TRUE; switch (ch) { case 0: /* end of line */ ofs = 0; bits -= pitch; /* go to previous */ break; case 1: /* end of bitmap */ - return 0; /* success! */ + return SDL_FALSE; /* success! */ case 2: /* delta */ - if (!SDL_RWread(src, &ch, 1, 1)) return 1; + if (!SDL_RWread(src, &ch, 1, 1)) return SDL_TRUE; ofs += ch; - if (!SDL_RWread(src, &ch, 1, 1)) return 1; + if (!SDL_RWread(src, &ch, 1, 1)) return SDL_TRUE; bits -= (ch * pitch); break; default: /* no compression */ @@ -117,14 +117,14 @@ static int readRlePixels(SDL_Surface * surface, SDL_RWops * src, int isRle8) needsPad = (ch & 1); do { Uint8 pixel; - if (!SDL_RWread(src, &pixel, 1, 1)) return 1; + if (!SDL_RWread(src, &pixel, 1, 1)) return SDL_TRUE; COPY_PIXEL(pixel); } while (--ch); } else { needsPad = (((ch+1)>>1) & 1); /* (ch+1)>>1: bytes size */ for (;;) { Uint8 pixel; - if (!SDL_RWread(src, &pixel, 1, 1)) return 1; + if (!SDL_RWread(src, &pixel, 1, 1)) return SDL_TRUE; COPY_PIXEL(pixel >> 4); if (!--ch) break; COPY_PIXEL(pixel & 0x0F); @@ -132,7 +132,7 @@ static int readRlePixels(SDL_Surface * surface, SDL_RWops * src, int isRle8) } } /* pad at even boundary */ - if (needsPad && !SDL_RWread(src, &ch, 1, 1)) return 1; + if (needsPad && !SDL_RWread(src, &ch, 1, 1)) return SDL_TRUE; break; } } @@ -213,12 +213,17 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc) surface = NULL; was_error = SDL_FALSE; if (src == NULL) { + SDL_InvalidParamError("src"); was_error = SDL_TRUE; goto done; } /* Read in the BMP file header */ fp_offset = SDL_RWtell(src); + if (fp_offset < 0) { + was_error = SDL_TRUE; + goto done; + } SDL_ClearError(); if (SDL_RWread(src, magic, 1, 2) != 2) { SDL_Error(SDL_EFREAD); @@ -407,6 +412,12 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc) goto done; } + if (biBitCount >= 32) { /* we shift biClrUsed by this value later. */ + SDL_SetError("Unsupported or incorrect biBitCount field"); + was_error = SDL_TRUE; + goto done; + } + if (biClrUsed == 0) { biClrUsed = 1 << biBitCount; } @@ -451,8 +462,8 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc) goto done; } if ((biCompression == BI_RLE4) || (biCompression == BI_RLE8)) { - was_error = (SDL_bool)readRlePixels(surface, src, biCompression == BI_RLE8); - if (was_error) SDL_SetError("Error reading from BMP"); + was_error = readRlePixels(surface, src, biCompression == BI_RLE8); + if (was_error) SDL_Error(SDL_EFREAD); goto done; } top = (Uint8 *)surface->pixels; @@ -484,7 +495,7 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc) for (i = 0; i < surface->w; ++i) { if (i % (8 / ExpandBMP) == 0) { if (!SDL_RWread(src, &pixel, 1, 1)) { - SDL_SetError("Error reading from BMP"); + SDL_Error(SDL_EFREAD); was_error = SDL_TRUE; goto done; } diff --git a/libs/SDL2/src/video/SDL_egl.c b/libs/SDL2/src/video/SDL_egl.c index e10cf7c7..bd1578a7 100644 --- a/libs/SDL2/src/video/SDL_egl.c +++ b/libs/SDL2/src/video/SDL_egl.c @@ -27,7 +27,6 @@ #endif #if SDL_VIDEO_DRIVER_ANDROID #include -#include "../core/android/SDL_android.h" #include "../video/android/SDL_androidvideo.h" #endif #if SDL_VIDEO_DRIVER_RPI @@ -99,7 +98,7 @@ #define DEFAULT_OGL_ES "libGLESv1_CM.so.1" #endif /* SDL_VIDEO_DRIVER_RPI */ -#if SDL_VIDEO_OPENGL +#if SDL_VIDEO_OPENGL && !SDL_VIDEO_VITA_PVR_OGL #include "SDL_opengl.h" #endif @@ -115,7 +114,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); \ @@ -251,12 +250,12 @@ SDL_EGL_GetProcAddress(_THIS, const char *proc) /* 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 @@ -281,14 +280,14 @@ SDL_EGL_UnloadLibrary(_THIS) _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; @@ -298,7 +297,7 @@ SDL_EGL_UnloadLibrary(_THIS) 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; @@ -350,32 +349,32 @@ SDL_EGL_LoadLibraryOnly(_THIS, const char *egl_path) /* 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 } @@ -383,47 +382,47 @@ SDL_EGL_LoadLibraryOnly(_THIS, const char *egl_path) #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"); } @@ -431,9 +430,9 @@ SDL_EGL_LoadLibraryOnly(_THIS, const char *egl_path) } #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 */ @@ -530,7 +529,7 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa } #endif /* Try the implementation-specific eglGetDisplay even if eglGetPlatformDisplay fails */ - if (_this->egl_data->egl_display == EGL_NO_DISPLAY) { + if ((_this->egl_data->egl_display == EGL_NO_DISPLAY) && (_this->egl_data->eglGetDisplay != NULL)) { _this->egl_data->egl_display = _this->egl_data->eglGetDisplay(native_display); } if (_this->egl_data->egl_display == EGL_NO_DISPLAY) { @@ -909,8 +908,7 @@ SDL_EGL_ChooseConfig(_THIS) int ret; if (!_this->egl_data) { - /* The EGL library wasn't loaded, SDL_GetError() should have info */ - return -1; + return SDL_SetError("EGL not initialized"); } /* Try with EGL_CONFIG_CAVEAT set to EGL_NONE, to avoid any EGL_SLOW_CONFIG or EGL_NON_CONFORMANT_CONFIG */ @@ -943,7 +941,7 @@ SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface) SDL_bool profile_es = (profile_mask == SDL_GL_CONTEXT_PROFILE_ES); if (!_this->egl_data) { - /* The EGL library wasn't loaded, SDL_GetError() should have info */ + SDL_SetError("EGL not initialized"); return NULL; } @@ -1044,16 +1042,8 @@ SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface) _this->egl_data->egl_swapinterval = 0; if (SDL_EGL_MakeCurrent(_this, egl_surface, egl_context) < 0) { - /* Save the SDL error set by SDL_EGL_MakeCurrent */ - char errorText[1024]; - SDL_strlcpy(errorText, SDL_GetError(), SDL_arraysize(errorText)); - - /* Delete the context, which may alter the value returned by SDL_GetError() */ + /* Delete the context */ SDL_EGL_DeleteContext(_this, egl_context); - - /* Restore the SDL error */ - SDL_SetError("%s", errorText); - return NULL; } @@ -1071,7 +1061,7 @@ SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface) if (SDL_GL_ExtensionSupported("GL_OES_surfaceless_context")) { _this->gl_allow_no_surface = SDL_TRUE; } -#if SDL_VIDEO_OPENGL +#if SDL_VIDEO_OPENGL && !defined(SDL_VIDEO_DRIVER_VITA) } else { /* Desktop OpenGL supports it by default from version 3.0 on. */ void (APIENTRY * glGetIntegervFunc) (GLenum pname, GLint * params); @@ -1096,7 +1086,7 @@ SDL_EGL_MakeCurrent(_THIS, EGLSurface egl_surface, SDL_GLContext context) EGLContext egl_context = (EGLContext) context; if (!_this->egl_data) { - return SDL_SetError("OpenGL not initialized"); + return SDL_SetError("EGL not initialized"); } if (!_this->egl_data->eglMakeCurrent) { @@ -1104,7 +1094,7 @@ SDL_EGL_MakeCurrent(_THIS, EGLSurface egl_surface, SDL_GLContext context) /* Can't do the nothing there is to do? Probably trying to cleanup a failed startup, just return. */ return 0; } else { - return SDL_SetError("OpenGL not initialized"); /* something clearly went wrong somewhere. */ + return SDL_SetError("EGL not initialized"); /* something clearly went wrong somewhere. */ } } @@ -1260,10 +1250,12 @@ EGLSurface 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 --git a/libs/SDL2/src/video/SDL_egl_c.h b/libs/SDL2/src/video/SDL_egl_c.h index 1827af05..76d26f93 100644 --- a/libs/SDL2/src/video/SDL_egl_c.h +++ b/libs/SDL2/src/video/SDL_egl_c.h @@ -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 --git a/libs/SDL2/src/video/SDL_fillrect.c b/libs/SDL2/src/video/SDL_fillrect.c index 55702191..66985117 100644 --- a/libs/SDL2/src/video/SDL_fillrect.c +++ b/libs/SDL2/src/video/SDL_fillrect.c @@ -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 @@ SDL_FillRect1SSE(Uint8 *pixels, int pitch, Uint32 color, int w, int h) DEFINE_SSE_FILLRECT(2, Uint16) DEFINE_SSE_FILLRECT(4, Uint32) -/* *INDENT-ON* */ +/* *INDENT-ON* */ /* clang-format on */ #endif /* __SSE__ */ static void @@ -238,7 +238,7 @@ int SDL_FillRect(SDL_Surface * dst, const SDL_Rect * rect, Uint32 color) { if (!dst) { - return SDL_SetError("Passed NULL destination surface"); + return SDL_InvalidParamError("SDL_FillRect(): dst"); } /* If 'rect' == NULL, then fill the whole surface */ @@ -306,12 +306,7 @@ SDL_FillRects(SDL_Surface * dst, const SDL_Rect * rects, int count, int i; if (!dst) { - return SDL_SetError("Passed NULL destination surface"); - } - - /* This function doesn't work on surfaces < 8 bpp */ - if (dst->format->BitsPerPixel < 8) { - return SDL_SetError("SDL_FillRect(): Unsupported surface format"); + return SDL_InvalidParamError("SDL_FillRects(): dst"); } /* Nothing to do */ @@ -321,11 +316,28 @@ SDL_FillRects(SDL_Surface * dst, const SDL_Rect * rects, int count, /* Perform software fill */ if (!dst->pixels) { - return SDL_SetError("SDL_FillRect(): You must lock the surface"); + return SDL_SetError("SDL_FillRects(): You must lock the surface"); } if (!rects) { - return SDL_SetError("SDL_FillRects() passed NULL rects"); + return SDL_InvalidParamError("SDL_FillRects(): rects"); + } + + /* This function doesn't usually work on surfaces < 8 bpp + * Except: support for 4bits, when filling full size. + */ + if (dst->format->BitsPerPixel < 8) { + if (count == 1) { + const SDL_Rect *r = &rects[0]; + if (r->x == 0 && r->y == 0 && r->w == dst->w && r->w == dst->h) { + if (dst->format->BitsPerPixel == 4) { + Uint8 b = (((Uint8) color << 4) | (Uint8) color); + SDL_memset(dst->pixels, b, dst->h * dst->pitch); + return 1; + } + } + } + return SDL_SetError("SDL_FillRects(): Unsupported surface format"); } #if SDL_ARM_NEON_BLITTERS diff --git a/libs/SDL2/src/video/SDL_pixels.c b/libs/SDL2/src/video/SDL_pixels.c index 26da00cf..858ccba7 100644 --- a/libs/SDL2/src/video/SDL_pixels.c +++ b/libs/SDL2/src/video/SDL_pixels.c @@ -28,6 +28,7 @@ #include "SDL_blit.h" #include "SDL_pixels_c.h" #include "SDL_RLEaccel_c.h" +#include "../SDL_list.h" /* Lookup tables to expand partial bytes to the full 0..255 range */ @@ -677,7 +678,7 @@ int SDL_SetPixelFormatPalette(SDL_PixelFormat * format, SDL_Palette *palette) { if (!format) { - return SDL_SetError("SDL_SetPixelFormatPalette() passed NULL format"); + return SDL_InvalidParamError("SDL_SetPixelFormatPalette(): format"); } if (palette && palette->ncolors > (1 << format->BitsPerPixel)) { @@ -1024,12 +1025,6 @@ SDL_AllocBlitMap(void) } -typedef struct SDL_ListNode -{ - void *entry; - struct SDL_ListNode *next; -} SDL_ListNode; - void SDL_InvalidateAllBlitMap(SDL_Surface *surface) { @@ -1045,40 +1040,6 @@ SDL_InvalidateAllBlitMap(SDL_Surface *surface) } } -static void SDL_ListAdd(SDL_ListNode **head, void *ent); -static void SDL_ListRemove(SDL_ListNode **head, void *ent); - -void -SDL_ListAdd(SDL_ListNode **head, void *ent) -{ - SDL_ListNode *node = SDL_malloc(sizeof (*node)); - - if (node == NULL) { - SDL_OutOfMemory(); - return; - } - - node->entry = ent; - node->next = *head; - *head = node; -} - -void -SDL_ListRemove(SDL_ListNode **head, void *ent) -{ - SDL_ListNode **ptr = head; - - while (*ptr) { - if ((*ptr)->entry == ent) { - SDL_ListNode *tmp = *ptr; - *ptr = (*ptr)->next; - SDL_free(tmp); - return; - } - ptr = &(*ptr)->next; - } -} - void SDL_InvalidateMap(SDL_BlitMap * map) { diff --git a/libs/SDL2/src/video/SDL_rect.c b/libs/SDL2/src/video/SDL_rect.c index 0c929517..dfa93903 100644 --- a/libs/SDL2/src/video/SDL_rect.c +++ b/libs/SDL2/src/video/SDL_rect.c @@ -23,447 +23,8 @@ #include "SDL_rect.h" #include "SDL_rect_c.h" -SDL_bool -SDL_HasIntersection(const SDL_Rect * A, const SDL_Rect * B) -{ - int Amin, Amax, Bmin, Bmax; - - if (!A) { - SDL_InvalidParamError("A"); - return SDL_FALSE; - } - - if (!B) { - SDL_InvalidParamError("B"); - return SDL_FALSE; - } - - /* Special cases for empty rects */ - if (SDL_RectEmpty(A) || SDL_RectEmpty(B)) { - return SDL_FALSE; - } - - /* Horizontal intersection */ - Amin = A->x; - Amax = Amin + A->w; - Bmin = B->x; - Bmax = Bmin + B->w; - if (Bmin > Amin) - Amin = Bmin; - if (Bmax < Amax) - Amax = Bmax; - if (Amax <= Amin) - return SDL_FALSE; - - /* Vertical intersection */ - Amin = A->y; - Amax = Amin + A->h; - Bmin = B->y; - Bmax = Bmin + B->h; - if (Bmin > Amin) - Amin = Bmin; - if (Bmax < Amax) - Amax = Bmax; - if (Amax <= Amin) - return SDL_FALSE; - - return SDL_TRUE; -} - -SDL_bool -SDL_IntersectRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result) -{ - int Amin, Amax, Bmin, Bmax; - - if (!A) { - SDL_InvalidParamError("A"); - return SDL_FALSE; - } - - if (!B) { - SDL_InvalidParamError("B"); - return SDL_FALSE; - } - - if (!result) { - SDL_InvalidParamError("result"); - return SDL_FALSE; - } - - /* Special cases for empty rects */ - if (SDL_RectEmpty(A) || SDL_RectEmpty(B)) { - result->w = 0; - result->h = 0; - return SDL_FALSE; - } - - /* Horizontal intersection */ - Amin = A->x; - Amax = Amin + A->w; - Bmin = B->x; - Bmax = Bmin + B->w; - if (Bmin > Amin) - Amin = Bmin; - result->x = Amin; - if (Bmax < Amax) - Amax = Bmax; - result->w = Amax - Amin; - - /* Vertical intersection */ - Amin = A->y; - Amax = Amin + A->h; - Bmin = B->y; - Bmax = Bmin + B->h; - if (Bmin > Amin) - Amin = Bmin; - result->y = Amin; - if (Bmax < Amax) - Amax = Bmax; - result->h = Amax - Amin; - - return !SDL_RectEmpty(result); -} - -void -SDL_UnionRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result) -{ - int Amin, Amax, Bmin, Bmax; - - if (!A) { - SDL_InvalidParamError("A"); - return; - } - - if (!B) { - SDL_InvalidParamError("B"); - return; - } - - if (!result) { - SDL_InvalidParamError("result"); - return; - } - - /* Special cases for empty Rects */ - if (SDL_RectEmpty(A)) { - if (SDL_RectEmpty(B)) { - /* A and B empty */ - return; - } else { - /* A empty, B not empty */ - *result = *B; - return; - } - } else { - if (SDL_RectEmpty(B)) { - /* A not empty, B empty */ - *result = *A; - return; - } - } - - /* Horizontal union */ - Amin = A->x; - Amax = Amin + A->w; - Bmin = B->x; - Bmax = Bmin + B->w; - if (Bmin < Amin) - Amin = Bmin; - result->x = Amin; - if (Bmax > Amax) - Amax = Bmax; - result->w = Amax - Amin; - - /* Vertical union */ - Amin = A->y; - Amax = Amin + A->h; - Bmin = B->y; - Bmax = Bmin + B->h; - if (Bmin < Amin) - Amin = Bmin; - result->y = Amin; - if (Bmax > Amax) - Amax = Bmax; - result->h = Amax - Amin; -} - -SDL_bool -SDL_EnclosePoints(const SDL_Point * points, int count, const SDL_Rect * clip, - SDL_Rect * result) -{ - int minx = 0; - int miny = 0; - int maxx = 0; - int maxy = 0; - int x, y, i; - - if (!points) { - SDL_InvalidParamError("points"); - return SDL_FALSE; - } - - if (count < 1) { - SDL_InvalidParamError("count"); - return SDL_FALSE; - } - - if (clip) { - SDL_bool added = SDL_FALSE; - const int clip_minx = clip->x; - const int clip_miny = clip->y; - const int clip_maxx = clip->x+clip->w-1; - const int clip_maxy = clip->y+clip->h-1; - - /* Special case for empty rectangle */ - if (SDL_RectEmpty(clip)) { - return SDL_FALSE; - } - - for (i = 0; i < count; ++i) { - x = points[i].x; - y = points[i].y; - - if (x < clip_minx || x > clip_maxx || - y < clip_miny || y > clip_maxy) { - continue; - } - if (!added) { - /* Special case: if no result was requested, we are done */ - if (result == NULL) { - return SDL_TRUE; - } - - /* First point added */ - minx = maxx = x; - miny = maxy = y; - added = SDL_TRUE; - continue; - } - if (x < minx) { - minx = x; - } else if (x > maxx) { - maxx = x; - } - if (y < miny) { - miny = y; - } else if (y > maxy) { - maxy = y; - } - } - if (!added) { - return SDL_FALSE; - } - } else { - /* Special case: if no result was requested, we are done */ - if (result == NULL) { - return SDL_TRUE; - } - - /* No clipping, always add the first point */ - minx = maxx = points[0].x; - miny = maxy = points[0].y; - - for (i = 1; i < count; ++i) { - x = points[i].x; - y = points[i].y; - - if (x < minx) { - minx = x; - } else if (x > maxx) { - maxx = x; - } - if (y < miny) { - miny = y; - } else if (y > maxy) { - maxy = y; - } - } - } - - if (result) { - result->x = minx; - result->y = miny; - result->w = (maxx-minx)+1; - result->h = (maxy-miny)+1; - } - return SDL_TRUE; -} - -/* Use the Cohen-Sutherland algorithm for line clipping */ -#define CODE_BOTTOM 1 -#define CODE_TOP 2 -#define CODE_LEFT 4 -#define CODE_RIGHT 8 - -static int -ComputeOutCode(const SDL_Rect * rect, int x, int y) -{ - int code = 0; - if (y < rect->y) { - code |= CODE_TOP; - } else if (y >= rect->y + rect->h) { - code |= CODE_BOTTOM; - } - if (x < rect->x) { - code |= CODE_LEFT; - } else if (x >= rect->x + rect->w) { - code |= CODE_RIGHT; - } - return code; -} - -SDL_bool -SDL_IntersectRectAndLine(const SDL_Rect * rect, int *X1, int *Y1, int *X2, - int *Y2) -{ - int x = 0; - int y = 0; - int x1, y1; - int x2, y2; - int rectx1; - int recty1; - int rectx2; - int recty2; - int outcode1, outcode2; - - if (!rect) { - SDL_InvalidParamError("rect"); - return SDL_FALSE; - } - - if (!X1) { - SDL_InvalidParamError("X1"); - return SDL_FALSE; - } - - if (!Y1) { - SDL_InvalidParamError("Y1"); - return SDL_FALSE; - } - - if (!X2) { - SDL_InvalidParamError("X2"); - return SDL_FALSE; - } - - if (!Y2) { - SDL_InvalidParamError("Y2"); - return SDL_FALSE; - } - - /* Special case for empty rect */ - if (SDL_RectEmpty(rect)) { - return SDL_FALSE; - } - - x1 = *X1; - y1 = *Y1; - x2 = *X2; - y2 = *Y2; - rectx1 = rect->x; - recty1 = rect->y; - rectx2 = rect->x + rect->w - 1; - recty2 = rect->y + rect->h - 1; - - /* Check to see if entire line is inside rect */ - if (x1 >= rectx1 && x1 <= rectx2 && x2 >= rectx1 && x2 <= rectx2 && - y1 >= recty1 && y1 <= recty2 && y2 >= recty1 && y2 <= recty2) { - return SDL_TRUE; - } - - /* Check to see if entire line is to one side of rect */ - if ((x1 < rectx1 && x2 < rectx1) || (x1 > rectx2 && x2 > rectx2) || - (y1 < recty1 && y2 < recty1) || (y1 > recty2 && y2 > recty2)) { - return SDL_FALSE; - } - - if (y1 == y2) { - /* Horizontal line, easy to clip */ - if (x1 < rectx1) { - *X1 = rectx1; - } else if (x1 > rectx2) { - *X1 = rectx2; - } - if (x2 < rectx1) { - *X2 = rectx1; - } else if (x2 > rectx2) { - *X2 = rectx2; - } - return SDL_TRUE; - } - - if (x1 == x2) { - /* Vertical line, easy to clip */ - if (y1 < recty1) { - *Y1 = recty1; - } else if (y1 > recty2) { - *Y1 = recty2; - } - if (y2 < recty1) { - *Y2 = recty1; - } else if (y2 > recty2) { - *Y2 = recty2; - } - return SDL_TRUE; - } - - /* More complicated Cohen-Sutherland algorithm */ - outcode1 = ComputeOutCode(rect, x1, y1); - outcode2 = ComputeOutCode(rect, x2, y2); - while (outcode1 || outcode2) { - if (outcode1 & outcode2) { - return SDL_FALSE; - } - - if (outcode1) { - if (outcode1 & CODE_TOP) { - y = recty1; - x = x1 + ((x2 - x1) * (y - y1)) / (y2 - y1); - } else if (outcode1 & CODE_BOTTOM) { - y = recty2; - x = x1 + ((x2 - x1) * (y - y1)) / (y2 - y1); - } else if (outcode1 & CODE_LEFT) { - x = rectx1; - y = y1 + ((y2 - y1) * (x - x1)) / (x2 - x1); - } else if (outcode1 & CODE_RIGHT) { - x = rectx2; - y = y1 + ((y2 - y1) * (x - x1)) / (x2 - x1); - } - x1 = x; - y1 = y; - outcode1 = ComputeOutCode(rect, x, y); - } else { - if (outcode2 & CODE_TOP) { - y = recty1; - x = x1 + ((x2 - x1) * (y - y1)) / (y2 - y1); - } else if (outcode2 & CODE_BOTTOM) { - y = recty2; - x = x1 + ((x2 - x1) * (y - y1)) / (y2 - y1); - } else if (outcode2 & CODE_LEFT) { - /* If this assertion ever fires, here's the static analysis that warned about it: - http://buildbot.libsdl.org/sdl-static-analysis/sdl-macosx-static-analysis/sdl-macosx-static-analysis-1101/report-b0d01a.html#EndPath */ - SDL_assert(x2 != x1); /* if equal: division by zero. */ - x = rectx1; - y = y1 + ((y2 - y1) * (x - x1)) / (x2 - x1); - } else if (outcode2 & CODE_RIGHT) { - /* If this assertion ever fires, here's the static analysis that warned about it: - http://buildbot.libsdl.org/sdl-static-analysis/sdl-macosx-static-analysis/sdl-macosx-static-analysis-1101/report-39b114.html#EndPath */ - SDL_assert(x2 != x1); /* if equal: division by zero. */ - x = rectx2; - y = y1 + ((y2 - y1) * (x - x1)) / (x2 - x1); - } - x2 = x; - y2 = y; - outcode2 = ComputeOutCode(rect, x, y); - } - } - *X1 = x1; - *Y1 = y1; - *X2 = x2; - *Y2 = y2; - return SDL_TRUE; -} - +/* There's no float version of this at the moment, because it's not a public API + and internally we only need the int version. */ SDL_bool SDL_GetSpanEnclosingRect(int width, int height, int numrects, const SDL_Rect * rects, SDL_Rect *span) @@ -475,24 +36,16 @@ SDL_GetSpanEnclosingRect(int width, int height, if (width < 1) { SDL_InvalidParamError("width"); return SDL_FALSE; - } - - if (height < 1) { + } else if (height < 1) { SDL_InvalidParamError("height"); return SDL_FALSE; - } - - if (!rects) { + } else if (!rects) { SDL_InvalidParamError("rects"); return SDL_FALSE; - } - - if (!span) { + } else if (!span) { SDL_InvalidParamError("span"); return SDL_FALSE; - } - - if (numrects < 1) { + } else if (numrects < 1) { SDL_InvalidParamError("numrects"); return SDL_FALSE; } @@ -527,4 +80,36 @@ SDL_GetSpanEnclosingRect(int width, int height, return SDL_FALSE; } + +/* For use with the Cohen-Sutherland algorithm for line clipping, in SDL_rect_impl.h */ +#define CODE_BOTTOM 1 +#define CODE_TOP 2 +#define CODE_LEFT 4 +#define CODE_RIGHT 8 + +/* Same code twice, for float and int versions... */ +#define RECTTYPE SDL_Rect +#define POINTTYPE SDL_Point +#define SCALARTYPE int +#define COMPUTEOUTCODE ComputeOutCode +#define SDL_HASINTERSECTION SDL_HasIntersection +#define SDL_INTERSECTRECT SDL_IntersectRect +#define SDL_RECTEMPTY SDL_RectEmpty +#define SDL_UNIONRECT SDL_UnionRect +#define SDL_ENCLOSEPOINTS SDL_EnclosePoints +#define SDL_INTERSECTRECTANDLINE SDL_IntersectRectAndLine +#include "SDL_rect_impl.h" + +#define RECTTYPE SDL_FRect +#define POINTTYPE SDL_FPoint +#define SCALARTYPE float +#define COMPUTEOUTCODE ComputeOutCodeF +#define SDL_HASINTERSECTION SDL_HasIntersectionF +#define SDL_INTERSECTRECT SDL_IntersectFRect +#define SDL_RECTEMPTY SDL_FRectEmpty +#define SDL_UNIONRECT SDL_UnionFRect +#define SDL_ENCLOSEPOINTS SDL_EncloseFPoints +#define SDL_INTERSECTRECTANDLINE SDL_IntersectFRectAndLine +#include "SDL_rect_impl.h" + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/video/SDL_rect_impl.h b/libs/SDL2/src/video/SDL_rect_impl.h new file mode 100644 index 00000000..993bb8eb --- /dev/null +++ b/libs/SDL2/src/video/SDL_rect_impl.h @@ -0,0 +1,444 @@ +/* + 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 file is #included twice to support int and float versions with the same code. */ + +SDL_bool +SDL_HASINTERSECTION(const RECTTYPE * A, const RECTTYPE * B) +{ + SCALARTYPE Amin, Amax, Bmin, Bmax; + + if (!A) { + SDL_InvalidParamError("A"); + return SDL_FALSE; + } else if (!B) { + SDL_InvalidParamError("B"); + return SDL_FALSE; + } else if (SDL_RECTEMPTY(A) || SDL_RECTEMPTY(B)) { + return SDL_FALSE; /* Special cases for empty rects */ + } + + /* Horizontal intersection */ + Amin = A->x; + Amax = Amin + A->w; + Bmin = B->x; + Bmax = Bmin + B->w; + if (Bmin > Amin) { + Amin = Bmin; + } + if (Bmax < Amax) { + Amax = Bmax; + } + if (Amax <= Amin) { + return SDL_FALSE; + } + /* Vertical intersection */ + Amin = A->y; + Amax = Amin + A->h; + Bmin = B->y; + Bmax = Bmin + B->h; + if (Bmin > Amin) { + Amin = Bmin; + } + if (Bmax < Amax) { + Amax = Bmax; + } + if (Amax <= Amin) { + return SDL_FALSE; + } + return SDL_TRUE; +} + +SDL_bool +SDL_INTERSECTRECT(const RECTTYPE * A, const RECTTYPE * B, RECTTYPE * result) +{ + SCALARTYPE Amin, Amax, Bmin, Bmax; + + if (!A) { + SDL_InvalidParamError("A"); + return SDL_FALSE; + } else if (!B) { + SDL_InvalidParamError("B"); + return SDL_FALSE; + } else if (!result) { + SDL_InvalidParamError("result"); + return SDL_FALSE; + } else if (SDL_RECTEMPTY(A) || SDL_RECTEMPTY(B)) { /* Special cases for empty rects */ + result->w = 0; + result->h = 0; + return SDL_FALSE; + } + + /* Horizontal intersection */ + Amin = A->x; + Amax = Amin + A->w; + Bmin = B->x; + Bmax = Bmin + B->w; + if (Bmin > Amin) { + Amin = Bmin; + } + result->x = Amin; + if (Bmax < Amax) { + Amax = Bmax; + } + result->w = Amax - Amin; + + /* Vertical intersection */ + Amin = A->y; + Amax = Amin + A->h; + Bmin = B->y; + Bmax = Bmin + B->h; + if (Bmin > Amin) { + Amin = Bmin; + } + result->y = Amin; + if (Bmax < Amax) { + Amax = Bmax; + } + result->h = Amax - Amin; + + return !SDL_RECTEMPTY(result); +} + +void +SDL_UNIONRECT(const RECTTYPE * A, const RECTTYPE * B, RECTTYPE * result) +{ + SCALARTYPE Amin, Amax, Bmin, Bmax; + + if (!A) { + SDL_InvalidParamError("A"); + return; + } else if (!B) { + SDL_InvalidParamError("B"); + return; + } else if (!result) { + SDL_InvalidParamError("result"); + return; + } else if (SDL_RECTEMPTY(A)) { /* Special cases for empty Rects */ + if (SDL_RECTEMPTY(B)) { /* A and B empty */ + SDL_zerop(result); + } else { /* A empty, B not empty */ + *result = *B; + } + return; + } else if (SDL_RECTEMPTY(B)) { /* A not empty, B empty */ + *result = *A; + return; + } + + /* Horizontal union */ + Amin = A->x; + Amax = Amin + A->w; + Bmin = B->x; + Bmax = Bmin + B->w; + if (Bmin < Amin) { + Amin = Bmin; + } + result->x = Amin; + if (Bmax > Amax) { + Amax = Bmax; + } + result->w = Amax - Amin; + + /* Vertical union */ + Amin = A->y; + Amax = Amin + A->h; + Bmin = B->y; + Bmax = Bmin + B->h; + if (Bmin < Amin) { + Amin = Bmin; + } + result->y = Amin; + if (Bmax > Amax) { + Amax = Bmax; + } + result->h = Amax - Amin; +} + +SDL_bool SDL_ENCLOSEPOINTS(const POINTTYPE * points, int count, const RECTTYPE * clip, + RECTTYPE * result) +{ + SCALARTYPE minx = 0; + SCALARTYPE miny = 0; + SCALARTYPE maxx = 0; + SCALARTYPE maxy = 0; + SCALARTYPE x, y; + int i; + + if (!points) { + SDL_InvalidParamError("points"); + return SDL_FALSE; + } else if (count < 1) { + SDL_InvalidParamError("count"); + return SDL_FALSE; + } + + if (clip) { + SDL_bool added = SDL_FALSE; + const SCALARTYPE clip_minx = clip->x; + const SCALARTYPE clip_miny = clip->y; + const SCALARTYPE clip_maxx = clip->x+clip->w-1; + const SCALARTYPE clip_maxy = clip->y+clip->h-1; + + /* Special case for empty rectangle */ + if (SDL_RECTEMPTY(clip)) { + return SDL_FALSE; + } + + for (i = 0; i < count; ++i) { + x = points[i].x; + y = points[i].y; + + if (x < clip_minx || x > clip_maxx || + y < clip_miny || y > clip_maxy) { + continue; + } + if (!added) { + /* Special case: if no result was requested, we are done */ + if (result == NULL) { + return SDL_TRUE; + } + + /* First point added */ + minx = maxx = x; + miny = maxy = y; + added = SDL_TRUE; + continue; + } + if (x < minx) { + minx = x; + } else if (x > maxx) { + maxx = x; + } + if (y < miny) { + miny = y; + } else if (y > maxy) { + maxy = y; + } + } + if (!added) { + return SDL_FALSE; + } + } else { + /* Special case: if no result was requested, we are done */ + if (result == NULL) { + return SDL_TRUE; + } + + /* No clipping, always add the first point */ + minx = maxx = points[0].x; + miny = maxy = points[0].y; + + for (i = 1; i < count; ++i) { + x = points[i].x; + y = points[i].y; + + if (x < minx) { + minx = x; + } else if (x > maxx) { + maxx = x; + } + if (y < miny) { + miny = y; + } else if (y > maxy) { + maxy = y; + } + } + } + + if (result) { + result->x = minx; + result->y = miny; + result->w = (maxx-minx)+1; + result->h = (maxy-miny)+1; + } + return SDL_TRUE; +} + +/* Use the Cohen-Sutherland algorithm for line clipping */ +static int +COMPUTEOUTCODE(const RECTTYPE * rect, SCALARTYPE x, SCALARTYPE y) +{ + int code = 0; + if (y < rect->y) { + code |= CODE_TOP; + } else if (y >= rect->y + rect->h) { + code |= CODE_BOTTOM; + } + if (x < rect->x) { + code |= CODE_LEFT; + } else if (x >= rect->x + rect->w) { + code |= CODE_RIGHT; + } + return code; +} + +SDL_bool +SDL_INTERSECTRECTANDLINE(const RECTTYPE * rect, SCALARTYPE *X1, SCALARTYPE *Y1, SCALARTYPE *X2, + SCALARTYPE *Y2) +{ + SCALARTYPE x = 0; + SCALARTYPE y = 0; + SCALARTYPE x1, y1; + SCALARTYPE x2, y2; + SCALARTYPE rectx1; + SCALARTYPE recty1; + SCALARTYPE rectx2; + SCALARTYPE recty2; + int outcode1, outcode2; + + if (!rect) { + SDL_InvalidParamError("rect"); + return SDL_FALSE; + } else if (!X1) { + SDL_InvalidParamError("X1"); + return SDL_FALSE; + } else if (!Y1) { + SDL_InvalidParamError("Y1"); + return SDL_FALSE; + } else if (!X2) { + SDL_InvalidParamError("X2"); + return SDL_FALSE; + } else if (!Y2) { + SDL_InvalidParamError("Y2"); + return SDL_FALSE; + } else if (SDL_RECTEMPTY(rect)) { + return SDL_FALSE; /* Special case for empty rect */ + } + + x1 = *X1; + y1 = *Y1; + x2 = *X2; + y2 = *Y2; + rectx1 = rect->x; + recty1 = rect->y; + rectx2 = rect->x + rect->w - 1; + recty2 = rect->y + rect->h - 1; + + /* Check to see if entire line is inside rect */ + if (x1 >= rectx1 && x1 <= rectx2 && x2 >= rectx1 && x2 <= rectx2 && + y1 >= recty1 && y1 <= recty2 && y2 >= recty1 && y2 <= recty2) { + return SDL_TRUE; + } + + /* Check to see if entire line is to one side of rect */ + if ((x1 < rectx1 && x2 < rectx1) || (x1 > rectx2 && x2 > rectx2) || + (y1 < recty1 && y2 < recty1) || (y1 > recty2 && y2 > recty2)) { + return SDL_FALSE; + } + + if (y1 == y2) { /* Horizontal line, easy to clip */ + if (x1 < rectx1) { + *X1 = rectx1; + } else if (x1 > rectx2) { + *X1 = rectx2; + } + if (x2 < rectx1) { + *X2 = rectx1; + } else if (x2 > rectx2) { + *X2 = rectx2; + } + return SDL_TRUE; + } + + if (x1 == x2) { /* Vertical line, easy to clip */ + if (y1 < recty1) { + *Y1 = recty1; + } else if (y1 > recty2) { + *Y1 = recty2; + } + if (y2 < recty1) { + *Y2 = recty1; + } else if (y2 > recty2) { + *Y2 = recty2; + } + return SDL_TRUE; + } + + /* More complicated Cohen-Sutherland algorithm */ + outcode1 = COMPUTEOUTCODE(rect, x1, y1); + outcode2 = COMPUTEOUTCODE(rect, x2, y2); + while (outcode1 || outcode2) { + if (outcode1 & outcode2) { + return SDL_FALSE; + } + + if (outcode1) { + if (outcode1 & CODE_TOP) { + y = recty1; + x = x1 + ((x2 - x1) * (y - y1)) / (y2 - y1); + } else if (outcode1 & CODE_BOTTOM) { + y = recty2; + x = x1 + ((x2 - x1) * (y - y1)) / (y2 - y1); + } else if (outcode1 & CODE_LEFT) { + x = rectx1; + y = y1 + ((y2 - y1) * (x - x1)) / (x2 - x1); + } else if (outcode1 & CODE_RIGHT) { + x = rectx2; + y = y1 + ((y2 - y1) * (x - x1)) / (x2 - x1); + } + x1 = x; + y1 = y; + outcode1 = COMPUTEOUTCODE(rect, x, y); + } else { + if (outcode2 & CODE_TOP) { + y = recty1; + x = x1 + ((x2 - x1) * (y - y1)) / (y2 - y1); + } else if (outcode2 & CODE_BOTTOM) { + y = recty2; + x = x1 + ((x2 - x1) * (y - y1)) / (y2 - y1); + } else if (outcode2 & CODE_LEFT) { + /* If this assertion ever fires, here's the static analysis that warned about it: + http://buildbot.libsdl.org/sdl-static-analysis/sdl-macosx-static-analysis/sdl-macosx-static-analysis-1101/report-b0d01a.html#EndPath */ + SDL_assert(x2 != x1); /* if equal: division by zero. */ + x = rectx1; + y = y1 + ((y2 - y1) * (x - x1)) / (x2 - x1); + } else if (outcode2 & CODE_RIGHT) { + /* If this assertion ever fires, here's the static analysis that warned about it: + http://buildbot.libsdl.org/sdl-static-analysis/sdl-macosx-static-analysis/sdl-macosx-static-analysis-1101/report-39b114.html#EndPath */ + SDL_assert(x2 != x1); /* if equal: division by zero. */ + x = rectx2; + y = y1 + ((y2 - y1) * (x - x1)) / (x2 - x1); + } + x2 = x; + y2 = y; + outcode2 = COMPUTEOUTCODE(rect, x, y); + } + } + *X1 = x1; + *Y1 = y1; + *X2 = x2; + *Y2 = y2; + return SDL_TRUE; +} + +#undef RECTTYPE +#undef POINTTYPE +#undef SCALARTYPE +#undef COMPUTEOUTCODE +#undef SDL_HASINTERSECTION +#undef SDL_INTERSECTRECT +#undef SDL_RECTEMPTY +#undef SDL_UNIONRECT +#undef SDL_ENCLOSEPOINTS +#undef SDL_INTERSECTRECTANDLINE + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/video/SDL_surface.c b/libs/SDL2/src/video/SDL_surface.c index b3cfa5cd..f3ee6a4c 100644 --- a/libs/SDL2/src/video/SDL_surface.c +++ b/libs/SDL2/src/video/SDL_surface.c @@ -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_Surface * 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 @@ SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth, /* 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 @@ SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth, } 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 @@ SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth, return surface; } +/* TODO: In SDL 3, drop the unused flags parameter */ /* * Create an empty RGB surface of the appropriate depth */ @@ -179,8 +208,34 @@ SDL_CreateRGBSurfaceFrom(void *pixels, Uint32 Amask) { SDL_Surface *surface; + Uint32 format; + size_t minimalPitch; - surface = SDL_CreateRGBSurface(0, 0, 0, depth, Rmask, Gmask, Bmask, Amask); + if (width < 0) { + SDL_InvalidParamError("width"); + return NULL; + } + + if (height < 0) { + SDL_InvalidParamError("height"); + return NULL; + } + + format = SDL_MasksToPixelFormatEnum(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 @@ SDL_CreateRGBSurfaceFrom(void *pixels, 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 @@ SDL_CreateRGBSurfaceWithFormatFrom(void *pixels, 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) { @@ -219,7 +293,7 @@ int SDL_SetSurfacePalette(SDL_Surface * surface, SDL_Palette * palette) { if (!surface) { - return SDL_SetError("SDL_SetSurfacePalette() passed a NULL surface"); + return SDL_InvalidParamError("SDL_SetSurfacePalette(): surface"); } if (SDL_SetPixelFormatPalette(surface->format, palette) < 0) { return -1; @@ -646,7 +720,7 @@ SDL_UpperBlit(SDL_Surface * src, const SDL_Rect * srcrect, /* Make sure the surfaces aren't locked */ if (!src || !dst) { - return SDL_SetError("SDL_UpperBlit: passed a NULL surface"); + return SDL_InvalidParamError("SDL_UpperBlit(): src/dst"); } if (src->locked || dst->locked) { return SDL_SetError("Surfaces must not be locked during blit"); @@ -757,7 +831,7 @@ SDL_PrivateUpperBlitScaled(SDL_Surface * src, const SDL_Rect * srcrect, /* Make sure the surfaces aren't locked */ if (!src || !dst) { - return SDL_SetError("SDL_UpperBlitScaled: passed a NULL surface"); + return SDL_InvalidParamError("SDL_UpperBlitScaled(): src/dst"); } if (src->locked || dst->locked) { return SDL_SetError("Surfaces must not be locked during blit"); @@ -1404,8 +1478,7 @@ int SDL_ConvertPixels(int width, int height, } #else if (SDL_ISPIXELFORMAT_FOURCC(src_format) || SDL_ISPIXELFORMAT_FOURCC(dst_format)) { - SDL_SetError("SDL not built with YUV support"); - return -1; + return SDL_SetError("SDL not built with YUV support"); } #endif diff --git a/libs/SDL2/src/video/SDL_sysvideo.h b/libs/SDL2/src/video/SDL_sysvideo.h index 3f401a5b..b1876b2b 100644 --- a/libs/SDL2/src/video/SDL_sysvideo.h +++ b/libs/SDL2/src/video/SDL_sysvideo.h @@ -237,6 +237,7 @@ struct SDL_VideoDevice 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); @@ -307,6 +308,8 @@ struct SDL_VideoDevice void (*StartTextInput) (_THIS); void (*StopTextInput) (_THIS); void (*SetTextInputRect) (_THIS, SDL_Rect *rect); + void (*ClearComposition) (_THIS); + SDL_bool (*IsTextInputShown) (_THIS); /* Screen keyboard */ SDL_bool (*HasScreenKeyboardSupport) (_THIS); @@ -330,6 +333,8 @@ struct SDL_VideoDevice /* * * */ /* Data common to all drivers */ + SDL_threadID thread; + SDL_bool checked_texture_framebuffer; SDL_bool is_dummy; SDL_bool suspend_screensaver; SDL_Window *wakeup_window; @@ -342,6 +347,7 @@ struct SDL_VideoDevice Uint32 next_object_id; char *clipboard_text; SDL_bool setting_display_mode; + SDL_bool disable_display_mode_switching; /* * * */ /* Data used by the GL drivers */ @@ -452,9 +458,12 @@ 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); @@ -468,6 +477,7 @@ extern SDL_VideoDisplay *SDL_GetDisplay(int displayIndex); 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); diff --git a/libs/SDL2/src/video/SDL_video.c b/libs/SDL2/src/video/SDL_video.c index cad77f1a..cda76558 100644 --- a/libs/SDL2/src/video/SDL_video.c +++ b/libs/SDL2/src/video/SDL_video.c @@ -118,6 +118,9 @@ static VideoBootStrap *bootstrap[] = { #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, @@ -128,8 +131,6 @@ static VideoBootStrap *bootstrap[] = { NULL }; -static SDL_VideoDevice *_this = NULL; - #define CHECK_WINDOW_MAGIC(window, retval) \ if (!_this) { \ SDL_UninitializedVideo(); \ @@ -172,129 +173,58 @@ typedef struct { int bytes_per_pixel; } SDL_WindowTextureData; -static SDL_bool -ShouldUseTextureFramebuffer() -{ - const char *hint; - - /* If there's no native framebuffer support then there's no option */ - if (!_this->CreateWindowFramebuffer) { - return SDL_TRUE; - } - - /* If this is the dummy driver there is no texture support */ - if (_this->is_dummy) { - return SDL_FALSE; - } - - /* See if the user or application wants a specific behavior */ - hint = SDL_GetHint(SDL_HINT_FRAMEBUFFER_ACCELERATION); - if (hint) { - if (*hint == '0' || SDL_strcasecmp(hint, "false") == 0) { - return SDL_FALSE; - } else { - return SDL_TRUE; - } - } - - /* Each platform has different performance characteristics */ -#if defined(__WIN32__) - /* GDI BitBlt() is way faster than Direct3D dynamic textures right now. - */ - return SDL_FALSE; - -#elif defined(__MACOSX__) - /* Mac OS X uses OpenGL as the native fast path (for cocoa and X11) */ - return SDL_TRUE; - -#elif defined(__LINUX__) - /* Properly configured OpenGL drivers are faster than MIT-SHM */ -#if SDL_VIDEO_OPENGL - /* Ugh, find a way to cache this value! */ - { - SDL_Window *window; - SDL_GLContext context; - SDL_bool hasAcceleratedOpenGL = SDL_FALSE; - - window = SDL_CreateWindow("OpenGL test", -32, -32, 32, 32, SDL_WINDOW_OPENGL|SDL_WINDOW_HIDDEN); - if (window) { - context = SDL_GL_CreateContext(window); - if (context) { - const GLubyte *(APIENTRY * glGetStringFunc) (GLenum); - const char *vendor = NULL; - - glGetStringFunc = SDL_GL_GetProcAddress("glGetString"); - if (glGetStringFunc) { - vendor = (const char *) glGetStringFunc(GL_VENDOR); - } - /* Add more vendors here at will... */ - if (vendor && - (SDL_strstr(vendor, "ATI Technologies") || - SDL_strstr(vendor, "NVIDIA"))) { - hasAcceleratedOpenGL = SDL_TRUE; - } - SDL_GL_DeleteContext(context); - } - SDL_DestroyWindow(window); - } - return hasAcceleratedOpenGL; - } -#elif SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 - /* Let's be optimistic about this! */ - return SDL_TRUE; -#else - return SDL_FALSE; -#endif - -#else - /* Play it safe, assume that if there is a framebuffer driver that it's - optimized for the current platform. - */ - return SDL_FALSE; -#endif -} static int -SDL_CreateWindowTexture(SDL_VideoDevice *unused, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch) +SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch) { - SDL_WindowTextureData *data; + SDL_RendererInfo info; + SDL_WindowTextureData *data = SDL_GetWindowData(window, SDL_WINDOWTEXTUREDATA); + int i; - data = SDL_GetWindowData(window, SDL_WINDOWTEXTUREDATA); if (!data) { SDL_Renderer *renderer = NULL; - int i; const char *hint = SDL_GetHint(SDL_HINT_FRAMEBUFFER_ACCELERATION); - - /* Check to see if there's a specific driver requested */ - if (hint && *hint != '0' && *hint != '1' && + const SDL_bool specific_accelerated_renderer = ( + hint && *hint != '0' && *hint != '1' && SDL_strcasecmp(hint, "true") != 0 && SDL_strcasecmp(hint, "false") != 0 && - SDL_strcasecmp(hint, "software") != 0) { + SDL_strcasecmp(hint, "software") != 0 + ); + + /* Check to see if there's a specific driver requested */ + if (specific_accelerated_renderer) { for (i = 0; i < SDL_GetNumRenderDrivers(); ++i) { - SDL_RendererInfo info; SDL_GetRenderDriverInfo(i, &info); if (SDL_strcasecmp(info.name, hint) == 0) { renderer = SDL_CreateRenderer(window, i, 0); break; } } - } - - if (!renderer) { + if (!renderer || (SDL_GetRendererInfo(renderer, &info) == -1)) { + if (renderer) { SDL_DestroyRenderer(renderer); } + return SDL_SetError("Requested renderer for " SDL_HINT_FRAMEBUFFER_ACCELERATION " is not available"); + } + /* if it was specifically requested, even if SDL_RENDERER_ACCELERATED isn't set, we'll accept this renderer. */ + } else { for (i = 0; i < SDL_GetNumRenderDrivers(); ++i) { - SDL_RendererInfo info; SDL_GetRenderDriverInfo(i, &info); if (SDL_strcmp(info.name, "software") != 0) { renderer = SDL_CreateRenderer(window, i, 0); - if (renderer) { - break; + if (renderer && (SDL_GetRendererInfo(renderer, &info) == 0) && (info.flags & SDL_RENDERER_ACCELERATED)) { + break; /* this will work. */ + } + if (renderer) { /* wasn't accelerated, etc, skip it. */ + SDL_DestroyRenderer(renderer); + renderer = NULL; } } } + if (!renderer) { + return SDL_SetError("No hardware accelerated renderers available"); + } } - if (!renderer) { - return SDL_SetError("No hardware accelerated renderers available"); - } + + SDL_assert(renderer != NULL); /* should have explicitly checked this above. */ /* Create the data after we successfully create the renderer (bug #1116) */ data = (SDL_WindowTextureData *)SDL_calloc(1, sizeof(*data)); @@ -305,6 +235,10 @@ SDL_CreateWindowTexture(SDL_VideoDevice *unused, SDL_Window * window, Uint32 * f SDL_SetWindowData(window, SDL_WINDOWTEXTUREDATA, data); data->renderer = renderer; + } else { + if (SDL_GetRendererInfo(data->renderer, &info) == -1) { + return -1; + } } /* Free any old texture and pixel data */ @@ -315,23 +249,14 @@ SDL_CreateWindowTexture(SDL_VideoDevice *unused, SDL_Window * window, Uint32 * f SDL_free(data->pixels); data->pixels = NULL; - { - SDL_RendererInfo info; - Uint32 i; + /* Find the first format without an alpha channel */ + *format = info.texture_formats[0]; - if (SDL_GetRendererInfo(data->renderer, &info) < 0) { - return -1; - } - - /* Find the first format without an alpha channel */ - *format = info.texture_formats[0]; - - for (i = 0; i < info.num_texture_formats; ++i) { - if (!SDL_ISPIXELFORMAT_FOURCC(info.texture_formats[i]) && - !SDL_ISPIXELFORMAT_ALPHA(info.texture_formats[i])) { - *format = info.texture_formats[i]; - break; - } + for (i = 0; i < (int) info.num_texture_formats; ++i) { + if (!SDL_ISPIXELFORMAT_FOURCC(info.texture_formats[i]) && + !SDL_ISPIXELFORMAT_ALPHA(info.texture_formats[i])) { + *format = info.texture_formats[i]; + break; } } @@ -339,6 +264,7 @@ SDL_CreateWindowTexture(SDL_VideoDevice *unused, SDL_Window * window, Uint32 * f SDL_TEXTUREACCESS_STREAMING, window->w, window->h); if (!data->texture) { + /* codechecker_false_positive [Malloc] Static analyzer doesn't realize allocated `data` is saved to SDL_WINDOWTEXTUREDATA and not leaked here. */ return -1; } @@ -364,6 +290,9 @@ SDL_CreateWindowTexture(SDL_VideoDevice *unused, SDL_Window * window, Uint32 * f return 0; } +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) { @@ -413,8 +342,7 @@ SDL_DestroyWindowTexture(SDL_VideoDevice *unused, SDL_Window * window) SDL_free(data); } - -static int +static int SDLCALL cmpmodes(const void *A, const void *B) { const SDL_DisplayMode *a = (const SDL_DisplayMode *) A; @@ -501,7 +429,7 @@ SDL_VideoInit(const char *driver_name) i = index = 0; video = NULL; if (driver_name == NULL) { - driver_name = SDL_getenv("SDL_VIDEODRIVER"); + driver_name = SDL_GetHint(SDL_HINT_VIDEODRIVER); } if (driver_name != NULL && *driver_name != 0) { const char *driver_attempt = driver_name; @@ -542,6 +470,7 @@ SDL_VideoInit(const char *driver_name) _this = video; _this->name = bootstrap[i]->name; _this->next_object_id = 1; + _this->thread = SDL_ThreadID(); /* Set some very sane GL defaults */ @@ -564,13 +493,6 @@ SDL_VideoInit(const char *driver_name) return SDL_SetError("The video driver did not add any displays"); } - /* Add the renderer framebuffer emulation if desired */ - if (ShouldUseTextureFramebuffer()) { - _this->CreateWindowFramebuffer = SDL_CreateWindowTexture; - _this->UpdateWindowFramebuffer = SDL_UpdateWindowTexture; - _this->DestroyWindowFramebuffer = SDL_DestroyWindowTexture; - } - /* Disable the screen saver by default. This is a change from <= 2.0.1, but most things using SDL are games or media players; you wouldn't want a screensaver to trigger if you're playing exclusively with a @@ -628,6 +550,12 @@ SDL_GetVideoDevice(void) return _this; } +SDL_bool +SDL_OnVideoThread() +{ + return (_this && SDL_ThreadID() == _this->thread) ? SDL_TRUE : SDL_FALSE; +} + int SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode) { @@ -970,7 +898,7 @@ SDL_GetClosestDisplayModeForDisplay(SDL_VideoDisplay * display, SDL_DisplayMode *current, *match; if (!mode || !closest) { - SDL_SetError("Missing desired mode or closest mode parameter"); + SDL_InvalidParamError("mode/closest"); return NULL; } @@ -1143,61 +1071,64 @@ SDL_GetDisplay(int displayIndex) int SDL_GetWindowDisplayIndex(SDL_Window * window) { - int displayIndex; - int i, dist; - int closest = -1; - int closest_dist = 0x7FFFFFFF; - SDL_Point center; - SDL_Point delta; - SDL_Rect rect; - CHECK_WINDOW_MAGIC(window, -1); + if (_this->GetWindowDisplayIndex) { + return _this->GetWindowDisplayIndex(_this, window); + } else { + int displayIndex; + int i, dist; + int closest = -1; + int closest_dist = 0x7FFFFFFF; + SDL_Point center; + SDL_Point delta; + SDL_Rect rect; - if (SDL_WINDOWPOS_ISUNDEFINED(window->x) || - SDL_WINDOWPOS_ISCENTERED(window->x)) { - displayIndex = (window->x & 0xFFFF); - if (displayIndex >= _this->num_displays) { - displayIndex = 0; + if (SDL_WINDOWPOS_ISUNDEFINED(window->x) || + SDL_WINDOWPOS_ISCENTERED(window->x)) { + displayIndex = (window->x & 0xFFFF); + if (displayIndex >= _this->num_displays) { + displayIndex = 0; + } + return displayIndex; } - 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 */ - for (i = 0; i < _this->num_displays; ++i) { - SDL_VideoDisplay *display = &_this->displays[i]; - - 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)) { - return i; + if (SDL_WINDOWPOS_ISUNDEFINED(window->y) || + SDL_WINDOWPOS_ISCENTERED(window->y)) { + displayIndex = (window->y & 0xFFFF); + if (displayIndex >= _this->num_displays) { + displayIndex = 0; + } + return displayIndex; } - delta.x = center.x - (rect.x + rect.w / 2); - delta.y = center.y - (rect.y + rect.h / 2); - dist = (delta.x*delta.x + delta.y*delta.y); - if (dist < closest_dist) { - closest = i; - closest_dist = dist; + /* Find the display containing the window */ + for (i = 0; i < _this->num_displays; ++i) { + SDL_VideoDisplay *display = &_this->displays[i]; + + 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)) { + return i; + } + + delta.x = center.x - (rect.x + rect.w / 2); + delta.y = center.y - (rect.y + rect.h / 2); + 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; } - if (closest < 0) { - SDL_SetError("Couldn't find any displays"); - } - return closest; } SDL_VideoDisplay * @@ -1268,6 +1199,7 @@ SDL_GetWindowDisplayMode(SDL_Window * window, SDL_DisplayMode * mode) } else if (!SDL_GetClosestDisplayModeForDisplay(SDL_GetDisplayForWindow(window), &fullscreen_mode, &fullscreen_mode)) { + SDL_zerop(mode); return SDL_SetError("Couldn't find display mode match"); } @@ -1421,14 +1353,17 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen) resized = 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) { - return -1; - } - } else { - if (SDL_SetDisplayModeForDisplay(display, NULL) < 0) { - return -1; + /* Don't try to change the display mode if the driver doesn't want it. */ + if (_this->disable_display_mode_switching == 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) { + return -1; + } + } else { + if (SDL_SetDisplayModeForDisplay(display, NULL) < 0) { + return -1; + } } } @@ -1439,12 +1374,17 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen) /* 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 @@ -1576,12 +1516,16 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) } /* Some platforms have certain graphics backends enabled by default */ - if (!_this->is_dummy && !graphics_flags && !SDL_IsVideoContextExternal()) { + if (!graphics_flags && !SDL_IsVideoContextExternal()) { #if (SDL_VIDEO_OPENGL && __MACOSX__) || (__IPHONEOS__ && !TARGET_OS_MACCATALYST) || __ANDROID__ || __NACL__ - flags |= SDL_WINDOW_OPENGL; + if (_this->GL_CreateContext != NULL) { + flags |= SDL_WINDOW_OPENGL; + } #endif #if SDL_VIDEO_METAL && (TARGET_OS_MACCATALYST || __MACOSX__ || __IPHONEOS__) - flags |= SDL_WINDOW_METAL; + if (_this->Metal_CreateView != NULL) { + flags |= SDL_WINDOW_METAL; + } #endif } @@ -1723,7 +1667,7 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) /* 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; } @@ -1756,6 +1700,7 @@ SDL_Window * SDL_CreateWindowFrom(const void *data) { SDL_Window *window; + Uint32 flags = SDL_WINDOW_FOREIGN; if (!_this) { SDL_UninitializedVideo(); @@ -1765,6 +1710,37 @@ SDL_CreateWindowFrom(const void *data) SDL_Unsupported(); return NULL; } + + if (SDL_GetHintBoolean(SDL_HINT_VIDEO_FOREIGN_WINDOW_OPENGL, SDL_FALSE)) { + if (!_this->GL_CreateContext) { + SDL_SetError("OpenGL support is either not configured in SDL " + "or not available in current SDL video driver " + "(%s) or platform", _this->name); + return NULL; + } + if (SDL_GL_LoadLibrary(NULL) < 0) { + return NULL; + } + flags |= SDL_WINDOW_OPENGL; + } + + if (SDL_GetHintBoolean(SDL_HINT_VIDEO_FOREIGN_WINDOW_VULKAN, SDL_FALSE)) { + if (!_this->Vulkan_CreateSurface) { + SDL_SetError("Vulkan support is either not configured in SDL " + "or not available in current SDL video driver " + "(%s) or platform", _this->name); + return NULL; + } + if (flags & SDL_WINDOW_OPENGL) { + SDL_SetError("Vulkan and OpenGL not supported on same window"); + return NULL; + } + if (SDL_Vulkan_LoadLibrary(NULL) < 0) { + return NULL; + } + flags |= SDL_WINDOW_VULKAN; + } + window = (SDL_Window *)SDL_calloc(1, sizeof(*window)); if (!window) { SDL_OutOfMemory(); @@ -1772,7 +1748,7 @@ SDL_CreateWindowFrom(const void *data) } window->magic = &_this->window_magic; window->id = _this->next_object_id++; - window->flags = SDL_WINDOW_FOREIGN; + window->flags = flags; window->last_fullscreen_flags = window->flags; window->is_destroying = SDL_FALSE; window->opacity = 1.0f; @@ -1818,7 +1794,9 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags) } /* Restore video mode, etc. */ - SDL_HideWindow(window); + if (!(window->flags & SDL_WINDOW_FOREIGN)) { + SDL_HideWindow(window); + } /* Tear down the old native window */ if (window->surface) { @@ -1827,9 +1805,13 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags) window->surface = NULL; window->surface_valid = SDL_FALSE; } - if (_this->DestroyWindowFramebuffer) { - _this->DestroyWindowFramebuffer(_this, window); + + if (_this->checked_texture_framebuffer) { /* never checked? No framebuffer to destroy. Don't risk calling the wrong implementation. */ + if (_this->DestroyWindowFramebuffer) { + _this->DestroyWindowFramebuffer(_this, window); + } } + if (_this->DestroyWindow && !(flags & SDL_WINDOW_FOREIGN)) { _this->DestroyWindow(_this, window); } @@ -1845,17 +1827,6 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags) need_gl_load = SDL_TRUE; } - if ((window->flags & SDL_WINDOW_METAL) != (flags & SDL_WINDOW_METAL)) { - if (flags & SDL_WINDOW_METAL) { - need_gl_load = SDL_TRUE; - } else { - need_gl_unload = SDL_TRUE; - } - } else if (window->flags & SDL_WINDOW_METAL) { - need_gl_unload = SDL_TRUE; - need_gl_load = SDL_TRUE; - } - if ((window->flags & SDL_WINDOW_VULKAN) != (flags & SDL_WINDOW_VULKAN)) { if (flags & SDL_WINDOW_VULKAN) { need_vulkan_load = SDL_TRUE; @@ -1868,18 +1839,15 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags) } if ((flags & SDL_WINDOW_VULKAN) && (flags & SDL_WINDOW_OPENGL)) { - SDL_SetError("Vulkan and OpenGL not supported on same window"); - return -1; + return SDL_SetError("Vulkan and OpenGL not supported on same window"); } if ((flags & SDL_WINDOW_METAL) && (flags & SDL_WINDOW_OPENGL)) { - SDL_SetError("Metal and OpenGL not supported on same window"); - return -1; + return SDL_SetError("Metal and OpenGL not supported on same window"); } if ((flags & SDL_WINDOW_METAL) && (flags & SDL_WINDOW_VULKAN)) { - SDL_SetError("Metal and Vulkan not supported on same window"); - return -1; + return SDL_SetError("Metal and Vulkan not supported on same window"); } if (need_gl_unload) { @@ -2273,12 +2241,14 @@ SDL_SetWindowSize(SDL_Window * window, int w, int h) SDL_UpdateFullscreenMode(window, SDL_TRUE); } } else { + int old_w = window->w; + int old_h = window->h; window->w = w; window->h = h; if (_this->SetWindowSize) { _this->SetWindowSize(_this, window); } - if (window->w == w && window->h == h) { + if (window->w != old_w || window->h != old_h) { /* We didn't get a SDL_WINDOWEVENT_RESIZED event (by design) */ SDL_OnWindowResized(window); } @@ -2539,18 +2509,71 @@ SDL_SetWindowFullscreen(SDL_Window * window, Uint32 flags) static SDL_Surface * SDL_CreateWindowFramebuffer(SDL_Window * window) { - Uint32 format; - void *pixels; - int pitch; + Uint32 format = 0; + void *pixels = NULL; + int pitch = 0; int bpp; Uint32 Rmask, Gmask, Bmask, Amask; + SDL_bool created_framebuffer = SDL_FALSE; - if (!_this->CreateWindowFramebuffer || !_this->UpdateWindowFramebuffer) { - return NULL; + /* This will switch the video backend from using a software surface to + using a GPU texture through the 2D render API, if we think this would + be more efficient. This only checks once, on demand. */ + 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__) || 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; + } + #endif + #if defined(__EMSCRIPTEN__) + else { + attempt_texture_framebuffer = SDL_FALSE; + } + #endif + + if (attempt_texture_framebuffer) { + if (SDL_CreateWindowTexture(_this, window, &format, &pixels, &pitch) == -1) { + /* !!! FIXME: if this failed halfway (made renderer, failed to make texture, etc), + !!! FIXME: we probably need to clean this up so it doesn't interfere with + !!! FIXME: a software fallback at the system level (can we blit to an + !!! FIXME: OpenGL window? etc). */ + } else { + /* future attempts will just try to use a texture framebuffer. */ + /* !!! FIXME: maybe we shouldn't override these but check if we used a texture + !!! FIXME: framebuffer at the right places; is it feasible we could have an + !!! FIXME: accelerated OpenGL window and a second ends up in software? */ + _this->CreateWindowFramebuffer = SDL_CreateWindowTexture; + _this->UpdateWindowFramebuffer = SDL_UpdateWindowTexture; + _this->DestroyWindowFramebuffer = SDL_DestroyWindowTexture; + created_framebuffer = SDL_TRUE; + } + } + + _this->checked_texture_framebuffer = SDL_TRUE; /* don't check this again. */ } - if (_this->CreateWindowFramebuffer(_this, window, &format, &pixels, &pitch) < 0) { - return NULL; + if (!created_framebuffer) { + if (!_this->CreateWindowFramebuffer || !_this->UpdateWindowFramebuffer) { + return NULL; + } + + if (_this->CreateWindowFramebuffer(_this, window, &format, &pixels, &pitch) < 0) { + return NULL; + } } if (window->surface) { @@ -2608,6 +2631,8 @@ SDL_UpdateWindowSurfaceRects(SDL_Window * window, const SDL_Rect * rects, return SDL_SetError("Window surface is invalid, please call SDL_GetWindowSurface() to get a new surface"); } + SDL_assert(_this->checked_texture_framebuffer); /* we should have done this before we had a valid surface. */ + return _this->UpdateWindowFramebuffer(_this, window, rects, numrects); } @@ -3026,7 +3051,7 @@ SDL_OnWindowFocusGained(SDL_Window * window) 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); } } @@ -3062,7 +3087,8 @@ ShouldMinimizeOnFocusLoss(SDL_Window * window) /* Real fullscreen windows should minimize on focus loss so the desktop video mode is restored */ 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) { + if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP || + _this->disable_display_mode_switching == SDL_TRUE) { return SDL_FALSE; } else { return SDL_TRUE; @@ -3113,7 +3139,9 @@ SDL_DestroyWindow(SDL_Window * window) window->is_destroying = SDL_TRUE; /* Restore video mode, etc. */ - SDL_HideWindow(window); + if (!(window->flags & SDL_WINDOW_FOREIGN)) { + SDL_HideWindow(window); + } /* Make sure this window no longer has focus */ if (SDL_GetKeyboardFocus() == window) { @@ -3136,8 +3164,10 @@ SDL_DestroyWindow(SDL_Window * window) window->surface = NULL; window->surface_valid = SDL_FALSE; } - if (_this->DestroyWindowFramebuffer) { - _this->DestroyWindowFramebuffer(_this, window); + if (_this->checked_texture_framebuffer) { /* never checked? No framebuffer to destroy. Don't risk calling the wrong implementation. */ + if (_this->DestroyWindowFramebuffer) { + _this->DestroyWindowFramebuffer(_this, window); + } } if (_this->DestroyWindow) { _this->DestroyWindow(_this, window); @@ -3922,6 +3952,10 @@ SDL_GL_MakeCurrent(SDL_Window * window, SDL_GLContext ctx) { int retval; + if (!_this) { + return SDL_UninitializedVideo(); + } + if (window == SDL_GL_GetCurrentWindow() && ctx == SDL_GL_GetCurrentContext()) { /* We're already current. */ @@ -4179,6 +4213,24 @@ SDL_StartTextInput(void) } } +void +SDL_ClearComposition(void) +{ + if (_this && _this->ClearComposition) { + _this->ClearComposition(_this); + } +} + +SDL_bool +SDL_IsTextInputShown(void) +{ + if (_this && _this->IsTextInputShown) { + return _this->IsTextInputShown(_this); + } + + return SDL_FALSE; +} + SDL_bool SDL_IsTextInputActive(void) { @@ -4232,6 +4284,12 @@ SDL_IsScreenKeyboardShown(SDL_Window *window) return SDL_FALSE; } +int +SDL_GetMessageBoxCount(void) +{ + return SDL_AtomicGet(&SDL_messagebox_count); +} + #if SDL_VIDEO_DRIVER_ANDROID #include "android/SDL_androidmessagebox.h" #endif @@ -4292,7 +4350,6 @@ SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) int retval = -1; SDL_bool relative_mode; int show_cursor_prev; - SDL_bool mouse_captured; SDL_Window *current_window; SDL_MessageBoxData mbdata; @@ -4302,10 +4359,11 @@ SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) 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(); @@ -4332,7 +4390,7 @@ SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) 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) { @@ -4409,15 +4467,15 @@ SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) } } + (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 --git a/libs/SDL2/src/video/SDL_vulkan_internal.h b/libs/SDL2/src/video/SDL_vulkan_internal.h index 52fae34d..1ec1ab47 100644 --- a/libs/SDL2/src/video/SDL_vulkan_internal.h +++ b/libs/SDL2/src/video/SDL_vulkan_internal.h @@ -25,12 +25,10 @@ #include "SDL_stdinc.h" -#if defined(SDL_LOADSO_DISABLED) -#undef SDL_VIDEO_VULKAN -#define SDL_VIDEO_VULKAN 0 -#endif - #if SDL_VIDEO_VULKAN +#if SDL_LOADSO_DISABLED || SDL_LOADSO_DUMMY +#error You should not be here. +#endif #if SDL_VIDEO_DRIVER_ANDROID #define VK_USE_PLATFORM_ANDROID_KHR diff --git a/libs/SDL2/src/video/SDL_yuv.c b/libs/SDL2/src/video/SDL_yuv.c index 72ed99d1..50395ff4 100644 --- a/libs/SDL2/src/video/SDL_yuv.c +++ b/libs/SDL2/src/video/SDL_yuv.c @@ -290,6 +290,48 @@ static SDL_bool yuv_rgb_sse( 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 @@ SDL_ConvertPixels_YUV_to_RGB(int width, int height, 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 --git a/libs/SDL2/src/video/android/SDL_androidevents.c b/libs/SDL2/src/video/android/SDL_androidevents.c index 23a5bf50..3424a825 100644 --- a/libs/SDL2/src/video/android/SDL_androidevents.c +++ b/libs/SDL2/src/video/android/SDL_androidevents.c @@ -67,6 +67,7 @@ SDL_NumberOfEvents(Uint32 type) return SDL_PeepEvents(NULL, 0, SDL_PEEKEVENT, type, type); } +#if SDL_VIDEO_OPENGL_EGL static void android_egl_context_restore(SDL_Window *window) { @@ -96,7 +97,7 @@ android_egl_context_backup(SDL_Window *window) data->backup_done = 1; } } - +#endif /* * Android_ResumeSem and Android_PauseSem are signaled from Java_org_libsdl_app_SDLActivity_nativePause and Java_org_libsdl_app_SDLActivity_nativeResume @@ -113,12 +114,14 @@ Android_PumpEvents_Blocking(_THIS) if (videodata->isPaused) { SDL_bool isContextExternal = SDL_IsVideoContextExternal(); +#if SDL_VIDEO_OPENGL_EGL /* Make sure this is the last thing we do before pausing */ if (!isContextExternal) { SDL_LockMutex(Android_ActivityMutex); android_egl_context_backup(Android_Window); SDL_UnlockMutex(Android_ActivityMutex); } +#endif ANDROIDAUDIO_PauseDevices(); openslES_PauseDevices(); @@ -138,11 +141,13 @@ Android_PumpEvents_Blocking(_THIS) aaudio_ResumeDevices(); /* Restore the GL Context from here, as this operation is thread dependent */ +#if SDL_VIDEO_OPENGL_EGL if (!isContextExternal && !SDL_HasEvent(SDL_QUIT)) { SDL_LockMutex(Android_ActivityMutex); android_egl_context_restore(Android_Window); SDL_UnlockMutex(Android_ActivityMutex); } +#endif /* Make sure SW Keyboard is restored when an app becomes foreground */ if (SDL_IsTextInputActive()) { @@ -188,11 +193,13 @@ Android_PumpEvents_NonBlocking(_THIS) SDL_bool isContextExternal = SDL_IsVideoContextExternal(); if (backup_context) { +#if SDL_VIDEO_OPENGL_EGL if (!isContextExternal) { SDL_LockMutex(Android_ActivityMutex); android_egl_context_backup(Android_Window); SDL_UnlockMutex(Android_ActivityMutex); } +#endif if (videodata->pauseAudio) { ANDROIDAUDIO_PauseDevices(); @@ -219,12 +226,14 @@ Android_PumpEvents_NonBlocking(_THIS) aaudio_ResumeDevices(); } +#if SDL_VIDEO_OPENGL_EGL /* Restore the GL Context from here, as this operation is thread dependent */ if (!isContextExternal && !SDL_HasEvent(SDL_QUIT)) { SDL_LockMutex(Android_ActivityMutex); android_egl_context_restore(Android_Window); SDL_UnlockMutex(Android_ActivityMutex); } +#endif /* Make sure SW Keyboard is restored when an app becomes foreground */ if (SDL_IsTextInputActive()) { diff --git a/libs/SDL2/src/video/android/SDL_androidgl.c b/libs/SDL2/src/video/android/SDL_androidgl.c index 698b8719..fe1b17b2 100644 --- a/libs/SDL2/src/video/android/SDL_androidgl.c +++ b/libs/SDL2/src/video/android/SDL_androidgl.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_ANDROID +#if SDL_VIDEO_DRIVER_ANDROID && SDL_VIDEO_OPENGL_EGL /* Android SDL video driver implementation */ diff --git a/libs/SDL2/src/video/android/SDL_androidkeyboard.c b/libs/SDL2/src/video/android/SDL_androidkeyboard.c index 635a22ea..9bb02552 100644 --- a/libs/SDL2/src/video/android/SDL_androidkeyboard.c +++ b/libs/SDL2/src/video/android/SDL_androidkeyboard.c @@ -41,12 +41,12 @@ void Android_InitKeyboard(void) 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 */ diff --git a/libs/SDL2/src/video/android/SDL_androidvideo.c b/libs/SDL2/src/video/android/SDL_androidvideo.c index 33019291..9555ea07 100644 --- a/libs/SDL2/src/video/android/SDL_androidvideo.c +++ b/libs/SDL2/src/video/android/SDL_androidvideo.c @@ -122,12 +122,14 @@ Android_CreateDevice(int devindex) device->SetWindowTitle = Android_SetWindowTitle; device->SetWindowFullscreen = Android_SetWindowFullscreen; device->MinimizeWindow = Android_MinimizeWindow; + device->SetWindowResizable = Android_SetWindowResizable; device->DestroyWindow = Android_DestroyWindow; device->GetWindowWMInfo = Android_GetWindowWMInfo; device->free = Android_DeleteDevice; /* GL pointers */ +#if SDL_VIDEO_OPENGL_EGL device->GL_LoadLibrary = Android_GLES_LoadLibrary; device->GL_GetProcAddress = Android_GLES_GetProcAddress; device->GL_UnloadLibrary = Android_GLES_UnloadLibrary; @@ -137,6 +139,7 @@ Android_CreateDevice(int devindex) device->GL_GetSwapInterval = Android_GLES_GetSwapInterval; device->GL_SwapWindow = Android_GLES_SwapWindow; device->GL_DeleteContext = Android_GLES_DeleteContext; +#endif #if SDL_VIDEO_VULKAN device->Vulkan_LoadLibrary = Android_Vulkan_LoadLibrary; diff --git a/libs/SDL2/src/video/android/SDL_androidwindow.c b/libs/SDL2/src/video/android/SDL_androidwindow.c index c8e45331..21bedca7 100644 --- a/libs/SDL2/src/video/android/SDL_androidwindow.c +++ b/libs/SDL2/src/video/android/SDL_androidwindow.c @@ -81,6 +81,7 @@ Android_CreateWindow(_THIS, SDL_Window * window) /* Do not create EGLSurface for Vulkan window since it will then make the window incompatible with vkCreateAndroidSurfaceKHR */ +#if SDL_VIDEO_OPENGL_EGL if ((window->flags & SDL_WINDOW_OPENGL) != 0) { data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) data->native_window); @@ -91,6 +92,7 @@ Android_CreateWindow(_THIS, SDL_Window * window) goto endfunction; } } +#endif window->driverdata = data; Android_Window = window; @@ -114,6 +116,8 @@ Android_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display 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) { @@ -130,8 +134,7 @@ Android_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display 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"); @@ -139,11 +142,11 @@ Android_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display 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"); @@ -165,6 +168,12 @@ Android_MinimizeWindow(_THIS, SDL_Window *window) Android_JNI_MinizeWindow(); } +void Android_SetWindowResizable(_THIS, SDL_Window *window, SDL_bool resizable) +{ + /* Set orientation */ + Android_JNI_SetOrientation(window->w, window->h, window->flags & SDL_WINDOW_RESIZABLE, SDL_GetHint(SDL_HINT_ORIENTATIONS)); +} + void Android_DestroyWindow(_THIS, SDL_Window *window) { @@ -175,9 +184,13 @@ Android_DestroyWindow(_THIS, SDL_Window *window) if (window->driverdata) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + +#if SDL_VIDEO_OPENGL_EGL if (data->egl_surface != EGL_NO_SURFACE) { SDL_EGL_DestroySurface(_this, data->egl_surface); } +#endif + if (data->native_window) { ANativeWindow_release(data->native_window); } @@ -194,15 +207,18 @@ Android_GetWindowWMInfo(_THIS, SDL_Window *window, SDL_SysWMinfo *info) { 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; + +#if SDL_VIDEO_OPENGL_EGL info->info.android.surface = data->egl_surface; +#endif + 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 --git a/libs/SDL2/src/video/android/SDL_androidwindow.h b/libs/SDL2/src/video/android/SDL_androidwindow.h index efda3030..58e45900 100644 --- a/libs/SDL2/src/video/android/SDL_androidwindow.h +++ b/libs/SDL2/src/video/android/SDL_androidwindow.h @@ -30,6 +30,7 @@ extern int Android_CreateWindow(_THIS, SDL_Window *window); extern void Android_SetWindowTitle(_THIS, SDL_Window *window); extern void Android_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen); extern void Android_MinimizeWindow(_THIS, SDL_Window *window); +extern void Android_SetWindowResizable(_THIS, SDL_Window *window, SDL_bool resizable); extern void Android_DestroyWindow(_THIS, SDL_Window *window); extern SDL_bool Android_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info); @@ -37,8 +38,10 @@ extern SDL_Window *Android_Window; typedef struct { +#if SDL_VIDEO_OPENGL_EGL EGLSurface egl_surface; EGLContext egl_context; /* We use this to preserve the context when losing focus */ +#endif SDL_bool backup_done; ANativeWindow *native_window; diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoaclipboard.h b/libs/SDL2/src/video/cocoa/SDL_cocoaclipboard.h index dd5e2522..c8c4d680 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoaclipboard.h +++ b/libs/SDL2/src/video/cocoa/SDL_cocoaclipboard.h @@ -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 --git a/libs/SDL2/src/video/cocoa/SDL_cocoaclipboard.m b/libs/SDL2/src/video/cocoa/SDL_cocoaclipboard.m index 1995c728..e3878ce8 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoaclipboard.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoaclipboard.m @@ -29,7 +29,7 @@ int 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 @@ Cocoa_SetClipboardText(_THIS, const char *text) } 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 @@ Cocoa_HasClipboardText(_THIS) } void -Cocoa_CheckClipboardUpdate(struct SDL_VideoData * data) +Cocoa_CheckClipboardUpdate(SDL_VideoData * data) { @autoreleasepool { NSPasteboard *pasteboard; @@ -94,11 +94,11 @@ Cocoa_CheckClipboardUpdate(struct SDL_VideoData * data) 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 --git a/libs/SDL2/src/video/cocoa/SDL_cocoaevents.m b/libs/SDL2/src/video/cocoa/SDL_cocoaevents.m index d077bad6..63cc634c 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoaevents.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoaevents.m @@ -45,7 +45,7 @@ static SDL_Window *FindSDLWindowForNSWindow(NSWindow *win) 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 @@ static void Cocoa_DispatchEvent(NSEvent *theEvent) [NSNumber numberWithBool:YES], @"ApplePersistenceIgnoreState", nil]; [[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults]; - [appDefaults release]; } @end // SDLApplication @@ -182,8 +181,6 @@ static void Cocoa_DispatchEvent(NSEvent *theEvent) removeEventHandlerForEventClass:kInternetEventClass andEventID:kAEGetURL]; } - - [super dealloc]; } - (void)windowWillClose:(NSNotification *)notification; @@ -232,6 +229,7 @@ static void Cocoa_DispatchEvent(NSEvent *theEvent) - (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 @@ static void Cocoa_DispatchEvent(NSEvent *theEvent) return; } - SDL_VideoDevice *device = SDL_GetVideoDevice(); + device = SDL_GetVideoDevice(); if (device && device->windows) { SDL_Window *window = device->windows; int i; @@ -374,9 +372,6 @@ CreateApplicationMenus(void) /* 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 @@ CreateApplicationMenus(void) [menuItem setSubmenu:serviceMenu]; [NSApp setServicesMenu:serviceMenu]; - [serviceMenu release]; [appleMenu addItem:[NSMenuItem separatorItem]]; @@ -417,12 +411,9 @@ CreateApplicationMenus(void) 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 @@ CreateApplicationMenus(void) [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 @@ Cocoa_RegisterApp(void) 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,7 +549,7 @@ Cocoa_PumpEvents(_THIS) void Cocoa_SendWakeupEvent(_THIS, SDL_Window *window) { @autoreleasepool { - NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow; + NSWindow *nswindow = ((__bridge SDL_WindowData *) window->driverdata).nswindow; NSEvent* event = [NSEvent otherEventWithType: NSEventTypeApplicationDefined location: NSMakePoint(0,0) @@ -595,15 +568,11 @@ void Cocoa_SuspendScreenSaver(_THIS) { @autoreleasepool { - SDL_VideoData *data = (SDL_VideoData *)_this->driverdata; + SDL_VideoData *data = (__bridge SDL_VideoData *)_this->driverdata; - if (!data->screensaver_use_iopm) { - return; - } - - 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 +581,13 @@ Cocoa_SuspendScreenSaver(_THIS) * 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 --git a/libs/SDL2/src/video/cocoa/SDL_cocoakeyboard.m b/libs/SDL2/src/video/cocoa/SDL_cocoakeyboard.m index b229ac3f..6e2250de 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoakeyboard.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoakeyboard.m @@ -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 @@ DoSidedModifiers(unsigned short scancode, 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 @@ UpdateKeymap(SDL_VideoData *data, SDL_bool send_event) 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 { @@ -461,7 +453,7 @@ cleanup: 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 +465,39 @@ Cocoa_InitKeyboard(_THIS) 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 +505,38 @@ void 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) { - 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 +568,7 @@ Cocoa_HandleKeyEvent(_THIS, NSEvent *event) #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 --git a/libs/SDL2/src/video/cocoa/SDL_cocoamessagebox.m b/libs/SDL2/src/video/cocoa/SDL_cocoamessagebox.m index e3fc20b7..1f8eddc3 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoamessagebox.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoamessagebox.m @@ -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 @@ Cocoa_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, int *buttonid [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 @@ Cocoa_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, int *buttonid } } - 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 --git a/libs/SDL2/src/video/cocoa/SDL_cocoametalview.m b/libs/SDL2/src/video/cocoa/SDL_cocoametalview.m index 6e33c489..ebdc921a 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoametalview.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoametalview.m @@ -89,7 +89,7 @@ SDL_MetalViewEventWatch(void *userdata, SDL_Event *event) /* Allow resize. */ self.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable; - SDL_AddEventWatch(SDL_MetalViewEventWatch, self); + SDL_AddEventWatch(SDL_MetalViewEventWatch, (__bridge void *)(self)); [self updateDrawableSize]; } @@ -99,8 +99,7 @@ SDL_MetalViewEventWatch(void *userdata, SDL_Event *event) - (void)dealloc { - SDL_DelEventWatch(SDL_MetalViewEventWatch, self); - [super dealloc]; + SDL_DelEventWatch(SDL_MetalViewEventWatch, (__bridge void *)(self)); } - (NSInteger)tag @@ -135,7 +134,7 @@ SDL_MetalView 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 @@ Cocoa_Metal_CreateView(_THIS, SDL_Window * window) [view addSubview:newview]; metalview = (SDL_MetalView)CFBridgingRetain(newview); - [newview release]; return metalview; }} @@ -174,7 +172,7 @@ void 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 @@ Cocoa_Metal_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h) /* 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 --git a/libs/SDL2/src/video/cocoa/SDL_cocoamodes.m b/libs/SDL2/src/video/cocoa/SDL_cocoamodes.m index 7d19030b..072afc8e 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoamodes.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoamodes.m @@ -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 @@ GetDisplayMode(_THIS, CGDisplayModeRef vidmode, SDL_bool vidmodeCurrent, CFArray 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 @@ GetDisplayMode(_THIS, CGDisplayModeRef vidmode, SDL_bool vidmodeCurrent, CFArray 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 @@ Cocoa_GetDisplayName(CGDirectDisplayID displayID) /* 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 @@ Cocoa_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) 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 @@ Cocoa_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdp 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 @@ Cocoa_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdp } } - 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 (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 (hdpi) { - *hdpi = (pixelWidth * MM_IN_INCH / displaySize.width); - } - if (vdpi) { - *vdpi = (pixelHeight * MM_IN_INCH / displaySize.height); - } - return 0; }} @@ -646,10 +632,6 @@ Cocoa_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) } 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 @@ Cocoa_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) 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 @@ Cocoa_QuitModes(_THIS) CFRelease(mode->modes); } } - Cocoa_ToggleMenuBar(YES); } #endif /* SDL_VIDEO_DRIVER_COCOA */ diff --git a/libs/SDL2/src/video/cocoa/SDL_cocoamouse.m b/libs/SDL2/src/video/cocoa/SDL_cocoamouse.m index 4c107d81..b41cec13 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoamouse.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoamouse.m @@ -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 @@ Cocoa_CreateDefaultCursor() if (nscursor) { cursor = SDL_calloc(1, sizeof(*cursor)); if (cursor) { - cursor->driverdata = nscursor; - [nscursor retain]; + cursor->driverdata = (void *)CFBridgingRetain(nscursor); } } @@ -99,15 +98,54 @@ Cocoa_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y) 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 = [[info valueForKey:@"frames"] integerValue]; + NSCursor *cursor; + NSImage *image = [[NSImage alloc] initWithContentsOfFile:[cursorPath stringByAppendingPathComponent:@"cursor.pdf"]]; + if ((image == nil) || (image.valid == 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 @@ Cocoa_CreateSystemCursor(SDL_SystemCursor id) 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 @@ Cocoa_CreateSystemCursor(SDL_SystemCursor id) 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 @@ static void Cocoa_FreeCursor(SDL_Cursor * cursor) { @autoreleasepool { - NSCursor *nscursor = (NSCursor *)cursor->driverdata; - - [nscursor release]; + CFBridgingRelease(cursor->driverdata); SDL_free(cursor); }} @@ -184,11 +221,11 @@ Cocoa_ShowCursor(SDL_Cursor * cursor) 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 @@ SDL_FindWindowAtPoint(const int x, const int y) 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); @@ -253,29 +291,15 @@ Cocoa_WarpMouseGlobal(int x, int y) static void Cocoa_WarpMouse(SDL_Window * window, int x, int y) { - Cocoa_WarpMouseGlobal(x + window->x, y + window->y); + Cocoa_WarpMouseGlobal(window->x + x, window->y + y); } 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_GetMouseFocus(); - 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 @@ Cocoa_SetRelativeMouseMode(SDL_bool enabled) 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 @@ Cocoa_GetGlobalMouseState(int *x, int *y) 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 @@ Cocoa_InitMouse(_THIS) SDL_SetDefaultCursor(Cocoa_CreateDefaultCursor()); - const NSPoint location = [NSEvent mouseLocation]; + location = [NSEvent mouseLocation]; driverdata->lastMoveX = location.x; driverdata->lastMoveY = location.y; return 0; @@ -360,18 +401,18 @@ Cocoa_HandleTitleButtonEvent(_THIS, NSEvent *event) NSWindow *nswindow = [event window]; 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 +425,13 @@ Cocoa_HandleTitleButtonEvent(_THIS, NSEvent *event) 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 +459,19 @@ Cocoa_HandleMouseEvent(_THIS, NSEvent *event) 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 +489,8 @@ Cocoa_HandleMouseEvent(_THIS, NSEvent *event) } } - float deltaX = [event deltaX]; - float deltaY = [event deltaY]; + deltaX = [event deltaX]; + deltaY = [event deltaY]; if (seenWarp) { deltaX += (lastMoveX - driverdata->lastWarpX); @@ -457,25 +505,26 @@ Cocoa_HandleMouseEvent(_THIS, NSEvent *event) 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; + mouseID = mouse->mouseID; + x = -[event deltaX]; + y = [event deltaY]; + direction = SDL_MOUSEWHEEL_NORMAL; - if ([event respondsToSelector:@selector(isDirectionInvertedFromDevice)]) { - if ([event isDirectionInvertedFromDevice] == YES) { - direction = SDL_MOUSEWHEEL_FLIPPED; - } + 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 --git a/libs/SDL2/src/video/cocoa/SDL_cocoaopengl.m b/libs/SDL2/src/video/cocoa/SDL_cocoaopengl.m index 9d31b9c2..5a57612b 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoaopengl.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoaopengl.m @@ -82,10 +82,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 +94,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]; } @@ -180,15 +180,16 @@ Cocoa_GL_CreateContext(_THIS, SDL_Window * window) { 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 +214,15 @@ Cocoa_GL_CreateContext(_THIS, SDL_Window * window) 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; @@ -288,20 +282,20 @@ Cocoa_GL_CreateContext(_THIS, SDL_Window * window) } 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 +309,27 @@ Cocoa_GL_CreateContext(_THIS, SDL_Window * window) 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 +340,7 @@ Cocoa_GL_CreateContext(_THIS, SDL_Window * window) /*_this->gl_config.major_version = glversion_major;*/ /*_this->gl_config.minor_version = glversion_minor;*/ } - return context; + return sdlcontext; }} int @@ -354,7 +348,7 @@ Cocoa_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) { @autoreleasepool { if (context) { - SDLOpenGLContext *nscontext = (SDLOpenGLContext *)context; + SDLOpenGLContext *nscontext = (__bridge SDLOpenGLContext *)context; if ([nscontext window] != window) { [nscontext setWindow:window]; [nscontext updateIfNeeded]; @@ -369,17 +363,15 @@ Cocoa_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) 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 +381,7 @@ Cocoa_GL_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h) if (h) { *h = viewport.size.height; } -} +}} int Cocoa_GL_SetSwapInterval(_THIS, int interval) @@ -403,7 +395,7 @@ Cocoa_GL_SetSwapInterval(_THIS, int interval) 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 +415,7 @@ Cocoa_GL_GetSwapInterval(_THIS) 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 +428,15 @@ int 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 +444,8 @@ void 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 --git a/libs/SDL2/src/video/cocoa/SDL_cocoaopengles.m b/libs/SDL2/src/video/cocoa/SDL_cocoaopengles.m index 13102f8c..bdf2e9a0 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoaopengles.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoaopengles.m @@ -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 @@ Cocoa_GLES_LoadLibrary(_THIS, const char *path) { 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 @@ Cocoa_GLES_CreateContext(_THIS, SDL_Window * window) } #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 @@ Cocoa_GLES_SetupWindow(_THIS, SDL_Window * window) } /* 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 --git a/libs/SDL2/src/video/cocoa/SDL_cocoashape.m b/libs/SDL2/src/video/cocoa/SDL_cocoashape.m index 1176036a..f594cb09 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoashape.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoashape.m @@ -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 @@ Cocoa_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowSha { @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 @@ Cocoa_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowSha [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 --git a/libs/SDL2/src/video/cocoa/SDL_cocoavideo.h b/libs/SDL2/src/video/cocoa/SDL_cocoavideo.h index af0abe5c..4de8511a 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoavideo.h +++ b/libs/SDL2/src/video/cocoa/SDL_cocoavideo.h @@ -97,18 +97,15 @@ DECLARE_ALERT_STYLE(Critical); @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) 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 --git a/libs/SDL2/src/video/cocoa/SDL_cocoavideo.m b/libs/SDL2/src/video/cocoa/SDL_cocoavideo.m index 231b2de5..1df31f64 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoavideo.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoavideo.m @@ -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_VideoQuit(_THIS); 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) +{ @autoreleasepool { SDL_VideoDevice *device; SDL_VideoData *data; @@ -56,16 +66,16 @@ Cocoa_CreateDevice(int devindex) /* 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 @@ Cocoa_CreateDevice(int devindex) 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 @@ Cocoa_CreateDevice(int devindex) device->free = Cocoa_DeleteDevice; return device; -} +}} VideoBootStrap COCOA_bootstrap = { "cocoa", "SDL Cocoa video driver", @@ -175,8 +186,9 @@ VideoBootStrap COCOA_bootstrap = { 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,27 @@ Cocoa_VideoInit(_THIS) return -1; } - data->allow_spaces = ((floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) && SDL_GetHintBoolean(SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES, SDL_TRUE)); + data.allow_spaces = 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->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 +233,7 @@ Cocoa_CreateImage(SDL_Surface * surface) return nil; } - imgrep = [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes: NULL + imgrep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes: NULL pixelsWide: converted->w pixelsHigh: converted->h bitsPerSample: 8 @@ -232,7 +242,7 @@ Cocoa_CreateImage(SDL_Surface * surface) 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 +262,7 @@ Cocoa_CreateImage(SDL_Surface * surface) 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 +279,16 @@ Cocoa_CreateImage(SDL_Surface * surface) * 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 --git a/libs/SDL2/src/video/cocoa/SDL_cocoawindow.h b/libs/SDL2/src/video/cocoa/SDL_cocoawindow.h index a42d9c87..61324550 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoawindow.h +++ b/libs/SDL2/src/video/cocoa/SDL_cocoawindow.h @@ -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 @@ typedef enum } 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; @@ -114,22 +117,22 @@ typedef enum /* *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 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 +156,7 @@ extern void Cocoa_SetWindowAlwaysOnTop(_THIS, SDL_Window * window, SDL_bool on_t 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 --git a/libs/SDL2/src/video/cocoa/SDL_cocoawindow.m b/libs/SDL2/src/video/cocoa/SDL_cocoawindow.m index bf86d7b6..dca560ba 100644 --- a/libs/SDL2/src/video/cocoa/SDL_cocoawindow.m +++ b/libs/SDL2/src/video/cocoa/SDL_cocoawindow.m @@ -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 ConvertNSRect(NSScreen *screen, BOOL fullscreen, NSRect *r) static void ScheduleContextUpdates(SDL_WindowData *data) { - if (!data || !data->nscontexts) { + NSOpenGLContext *currentContext; + NSMutableArray *contexts; + if (!data || !data.nscontexts) { return; } @@ -260,8 +272,8 @@ ScheduleContextUpdates(SDL_WindowData *data) #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) { @@ -316,19 +328,19 @@ GetWindowStyle(SDL_Window * window) 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 +349,9 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) 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 +408,10 @@ AdjustCoordinatesForGrab(SDL_Window * window, int x, int y, CGPoint *adjusted) 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 +465,8 @@ Cocoa_UpdateClipCursor(SDL_Window * window) - (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 +527,12 @@ Cocoa_UpdateClipCursor(SDL_Window * window) 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 +540,18 @@ Cocoa_UpdateClipCursor(SDL_Window * window) -(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 +560,11 @@ Cocoa_UpdateClipCursor(SDL_Window * window) -(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 +608,7 @@ Cocoa_UpdateClipCursor(SDL_Window * window) - (void)close { NSNotificationCenter *center; - NSWindow *window = _data->nswindow; + NSWindow *window = _data.nswindow; NSView *view = [window contentView]; center = [NSNotificationCenter defaultCenter]; @@ -678,15 +690,15 @@ Cocoa_UpdateClipCursor(SDL_Window * window) 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 +708,25 @@ Cocoa_UpdateClipCursor(SDL_Window * window) 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 +735,8 @@ Cocoa_UpdateClipCursor(SDL_Window * window) - (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 +771,19 @@ Cocoa_UpdateClipCursor(SDL_Window * window) - (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 +801,7 @@ Cocoa_UpdateClipCursor(SDL_Window * window) 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 +815,17 @@ Cocoa_UpdateClipCursor(SDL_Window * window) 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 +841,7 @@ Cocoa_UpdateClipCursor(SDL_Window * window) 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 +851,16 @@ Cocoa_UpdateClipCursor(SDL_Window * window) } /* 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 +871,12 @@ Cocoa_UpdateClipCursor(SDL_Window * window) } /* 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 +893,22 @@ Cocoa_UpdateClipCursor(SDL_Window * window) 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 +918,7 @@ Cocoa_UpdateClipCursor(SDL_Window * window) - (void)windowDidFailToEnterFullScreen:(NSNotification *)aNotification { - SDL_Window *window = _data->window; + SDL_Window *window = _data.window; if (window->is_destroying) { return; @@ -917,9 +934,9 @@ Cocoa_UpdateClipCursor(SDL_Window * window) - (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; + SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; + NSWindow *nswindow = data.nswindow; inFullscreenTransition = NO; @@ -949,7 +966,7 @@ Cocoa_UpdateClipCursor(SDL_Window * window) - (void)windowWillExitFullScreen:(NSNotification *)aNotification { - SDL_Window *window = _data->window; + SDL_Window *window = _data.window; isFullscreenSpace = NO; inFullscreenTransition = YES; @@ -967,7 +984,7 @@ Cocoa_UpdateClipCursor(SDL_Window * window) - (void)windowDidFailToExitFullScreen:(NSNotification *)aNotification { - SDL_Window *window = _data->window; + SDL_Window *window = _data.window; if (window->is_destroying) { return; @@ -983,8 +1000,8 @@ Cocoa_UpdateClipCursor(SDL_Window * window) - (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 +1094,7 @@ Cocoa_UpdateClipCursor(SDL_Window * window) -(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 +1144,16 @@ Cocoa_UpdateClipCursor(SDL_Window * window) - (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 +1161,7 @@ Cocoa_UpdateClipCursor(SDL_Window * window) if (isDragAreaRunning) { isDragAreaRunning = NO; - [_data->nswindow setMovableByWindowBackground:NO]; + [_data.nswindow setMovableByWindowBackground:NO]; return YES; /* was dragging, drop event. */ } @@ -1164,7 +1181,7 @@ Cocoa_SendMouseButtonClicks(SDL_Mouse * mouse, NSEvent *theEvent, SDL_Window * w // 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 +1200,12 @@ Cocoa_SendMouseButtonClicks(SDL_Mouse * mouse, NSEvent *theEvent, SDL_Window * w - (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 +1215,7 @@ Cocoa_SendMouseButtonClicks(SDL_Mouse * mouse, NSEvent *theEvent, SDL_Window * w } 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 +1241,7 @@ Cocoa_SendMouseButtonClicks(SDL_Mouse * mouse, NSEvent *theEvent, SDL_Window * w 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 +1257,14 @@ Cocoa_SendMouseButtonClicks(SDL_Mouse * mouse, NSEvent *theEvent, SDL_Window * w - (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 +1288,7 @@ Cocoa_SendMouseButtonClicks(SDL_Mouse * mouse, NSEvent *theEvent, SDL_Window * w 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 +1304,17 @@ Cocoa_SendMouseButtonClicks(SDL_Mouse * mouse, NSEvent *theEvent, SDL_Window * w - (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,11 +1361,15 @@ Cocoa_SendMouseButtonClicks(SDL_Mouse * mouse, NSEvent *theEvent, SDL_Window * w - (void)scrollWheel:(NSEvent *)theEvent { - Cocoa_HandleMouseWheel(_data->window, theEvent); + Cocoa_HandleMouseWheel(_data.window, theEvent); } - (void)touchesBeganWithEvent:(NSEvent *) theEvent { + NSSet *touches; + SDL_TouchID touchID; + int existingTouchCount; + /* probably a MacBook trackpad; make this look like a synthesized event. This is backwards from reality, but better matches user expectations. */ BOOL istrackpad = NO; @@ -1361,9 +1385,9 @@ Cocoa_SendMouseButtonClicks(SDL_Mouse * mouse, NSEvent *theEvent, SDL_Window * w */ } - 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; + 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,6 +1431,8 @@ Cocoa_SendMouseButtonClicks(SDL_Mouse * mouse, NSEvent *theEvent, SDL_Window * w - (void)handleTouches:(NSTouchPhase) phase withEvent:(NSEvent *) theEvent { NSSet *touches = [theEvent touchesMatchingPhase:phase inView:nil]; + SDL_FingerID fingerId; + float x, y; /* probably a MacBook trackpad; make this look like a synthesized event. This is backwards from reality, but better matches user expectations. */ @@ -1453,9 +1479,9 @@ Cocoa_SendMouseButtonClicks(SDL_Mouse * mouse, NSEvent *theEvent, SDL_Window * w 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 +1557,7 @@ Cocoa_SendMouseButtonClicks(SDL_Mouse * mouse, NSEvent *theEvent, SDL_Window * w 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 +1576,13 @@ Cocoa_SendMouseButtonClicks(SDL_Mouse * mouse, NSEvent *theEvent, SDL_Window * w - (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 +1603,23 @@ static int 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.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 +1632,7 @@ SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, NSView *nsview, } /* 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 +1673,22 @@ SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, NSView *nsview, 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 +1696,16 @@ int 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 +1717,6 @@ Cocoa_CreateWindow(_THIS, SDL_Window * window) 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 +1743,7 @@ Cocoa_CreateWindow(_THIS, SDL_Window * window) } #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 +1757,7 @@ Cocoa_CreateWindow(_THIS, SDL_Window * window) /* 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 +1767,8 @@ Cocoa_CreateWindow(_THIS, SDL_Window * window) #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 +1782,8 @@ Cocoa_CreateWindow(_THIS, SDL_Window * window) #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 +1814,19 @@ Cocoa_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) { 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 +1840,8 @@ Cocoa_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) #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 +1854,9 @@ Cocoa_SetWindowTitle(_THIS, SDL_Window * window) { @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 +1874,8 @@ void 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 +1897,8 @@ void 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 +1924,39 @@ void 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 +1964,7 @@ void 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 +1973,26 @@ void 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 +2003,10 @@ void 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 +2016,7 @@ void 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,18 +2044,28 @@ Cocoa_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable) * The window will get permanently stuck if resizable is false. * -flibit */ - SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - Cocoa_WindowListener *listener = data->listener; + 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 (resizable) { + /* resizable windows are Spaces-friendly: they get the "go fullscreen" toggle button on their titlebar. */ + [nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; + } else { + [nswindow setCollectionBehavior:NSWindowCollectionBehaviorManaged]; + } + } }} void 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 { @@ -2041,13 +2077,13 @@ void 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) { @@ -2072,6 +2108,7 @@ Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display [nswindow setStyleMask:NSWindowStyleMaskBorderless]; } else { + NSRect frameRect; rect.origin.x = window->windowed.x; rect.origin.y = window->windowed.y; rect.size.width = window->windowed.w; @@ -2087,14 +2124,14 @@ Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display [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; @@ -2117,9 +2154,9 @@ Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display } if ([nswindow isVisible] || fullscreen) { - [data->listener pauseVisibleObservation]; + [data.listener pauseVisibleObservation]; [nswindow makeKeyAndOrderFront:nil]; - [data->listener resumeVisibleObservation]; + [data.listener resumeVisibleObservation]; } ScheduleContextUpdates(data); @@ -2127,6 +2164,7 @@ Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display 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; @@ -2149,13 +2187,14 @@ Cocoa_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp) 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; @@ -2185,7 +2224,41 @@ Cocoa_GetWindowICCProfile(_THIS, SDL_Window * window, size_t * size) [iccProfileData getBytes:retIccProfileData length:[iccProfileData length]]; *size = [iccProfileData length]; return retIccProfileData; -} +}} + +int +Cocoa_GetWindowDisplayIndex(_THIS, SDL_Window * window) +{ @autoreleasepool +{ + NSRect displayframe; + SDL_Point display_center; + SDL_Rect sdl_display_rect; + SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; + + /* Not recognized via CHECK_WINDOW_MAGIC */ + if (data == NULL){ + return 0; + } + + /* + Considering that we already have the display coordinates in which the window is placed (described via displayframe) + instead of checking in which display the window is placed, we should check which SDL display matches the display described + via displayframe. + */ + displayframe = data.nswindow.screen.frame; + + display_center.x = displayframe.origin.x + displayframe.size.width / 2; + display_center.y = displayframe.origin.y + displayframe.size.height / 2; + + for (int i = 0; i < SDL_GetNumVideoDisplays(); i++){ + SDL_GetDisplayBounds(i, &sdl_display_rect); + if (SDL_EnclosePoints(&display_center, 1, &sdl_display_rect, NULL)) { + return i; + } + } + SDL_SetError("Couldn't find the display where the window is attached to."); + return -1; +}} int Cocoa_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp) @@ -2219,96 +2292,97 @@ Cocoa_SetWindowMouseRect(_THIS, SDL_Window * window) 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) { @@ -2317,7 +2391,7 @@ Cocoa_SetWindowFullscreenSpace(SDL_Window * window, SDL_bool state) */ 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; @@ -2325,16 +2399,16 @@ Cocoa_SetWindowFullscreenSpace(SDL_Window * window, SDL_bool state) 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; }} @@ -2347,25 +2421,26 @@ Cocoa_SetWindowHitTest(SDL_Window * window, SDL_bool enabled) 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) { @@ -2373,10 +2448,10 @@ Cocoa_FlashWindow(_THIS, SDL_Window *window, SDL_FlashOperation operation) /* 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(); @@ -2386,11 +2461,12 @@ Cocoa_FlashWindow(_THIS, SDL_Window *window, SDL_FlashOperation operation) 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 --git a/libs/SDL2/src/video/directfb/SDL_DirectFB_window.c b/libs/SDL2/src/video/directfb/SDL_DirectFB_window.c index 7dfda647..999f21d5 100644 --- a/libs/SDL2/src/video/directfb/SDL_DirectFB_window.c +++ b/libs/SDL2/src/video/directfb/SDL_DirectFB_window.c @@ -482,16 +482,15 @@ DirectFB_GetWindowWMInfo(_THIS, SDL_Window * window, 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 --git a/libs/SDL2/src/video/dummy/SDL_nullframebuffer.c b/libs/SDL2/src/video/dummy/SDL_nullframebuffer.c index f11ee3fe..dd7cbbd1 100644 --- a/libs/SDL2/src/video/dummy/SDL_nullframebuffer.c +++ b/libs/SDL2/src/video/dummy/SDL_nullframebuffer.c @@ -33,17 +33,13 @@ int SDL_DUMMY_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * forma SDL_Surface *surface; const Uint32 surface_format = SDL_PIXELFORMAT_RGB888; int w, h; - int bpp; - Uint32 Rmask, Gmask, Bmask, Amask; /* Free the old framebuffer surface */ - surface = (SDL_Surface *) SDL_GetWindowData(window, DUMMY_SURFACE); - SDL_FreeSurface(surface); + SDL_DUMMY_DestroyWindowFramebuffer(_this, window); /* Create a new one */ - SDL_PixelFormatEnumToMasks(surface_format, &bpp, &Rmask, &Gmask, &Bmask, &Amask); SDL_GetWindowSize(window, &w, &h); - surface = SDL_CreateRGBSurface(0, w, h, bpp, Rmask, Gmask, Bmask, Amask); + surface = SDL_CreateRGBSurfaceWithFormat(0, w, h, 0, surface_format); if (!surface) { return -1; } diff --git a/libs/SDL2/src/video/dummy/SDL_nullvideo.c b/libs/SDL2/src/video/dummy/SDL_nullvideo.c index aafed848..a7fb1aac 100644 --- a/libs/SDL2/src/video/dummy/SDL_nullvideo.c +++ b/libs/SDL2/src/video/dummy/SDL_nullvideo.c @@ -46,6 +46,7 @@ #include "SDL_nullvideo.h" #include "SDL_nullevents_c.h" #include "SDL_nullframebuffer_c.h" +#include "SDL_hints.h" #define DUMMYVID_DRIVER_NAME "dummy" @@ -59,7 +60,7 @@ static void DUMMY_VideoQuit(_THIS); static int DUMMY_Available(void) { - const char *envr = SDL_getenv("SDL_VIDEODRIVER"); + const char *envr = SDL_GetHint(SDL_HINT_VIDEODRIVER); if ((envr) && (SDL_strcmp(envr, DUMMYVID_DRIVER_NAME) == 0)) { return (1); } diff --git a/libs/SDL2/src/video/emscripten/SDL_emscriptenevents.c b/libs/SDL2/src/video/emscripten/SDL_emscriptenevents.c index 0f7da8e3..39578f85 100644 --- a/libs/SDL2/src/video/emscripten/SDL_emscriptenevents.c +++ b/libs/SDL2/src/video/emscripten/SDL_emscriptenevents.c @@ -493,7 +493,7 @@ static EM_BOOL Emscripten_HandleKey(int eventType, const EmscriptenKeyboardEvent *keyEvent, void *userData) { Uint32 scancode; - SDL_bool prevent_default; + SDL_bool prevent_default = SDL_FALSE; SDL_bool is_nav_key; /* .keyCode is deprecated, but still the most reliable way to get keys */ @@ -577,12 +577,10 @@ Emscripten_HandleKey(int eventType, const EmscriptenKeyboardEvent *keyEvent, voi break; } } - SDL_SendKeyboardKey(eventType == EMSCRIPTEN_EVENT_KEYDOWN ? SDL_PRESSED : SDL_RELEASED, scancode); + prevent_default = SDL_SendKeyboardKey(eventType == EMSCRIPTEN_EVENT_KEYDOWN ? SDL_PRESSED : SDL_RELEASED, scancode); } } - prevent_default = SDL_GetEventState(eventType == EMSCRIPTEN_EVENT_KEYDOWN ? SDL_KEYDOWN : SDL_KEYUP) == SDL_ENABLE; - /* if TEXTINPUT events are enabled we can't prevent keydown or we won't get keypress * we need to ALWAYS prevent backspace and tab otherwise chrome takes action and does bad navigation UX */ diff --git a/libs/SDL2/src/video/emscripten/SDL_emscriptenframebuffer.c b/libs/SDL2/src/video/emscripten/SDL_emscriptenframebuffer.c index d4e9cb8e..03fea04e 100644 --- a/libs/SDL2/src/video/emscripten/SDL_emscriptenframebuffer.c +++ b/libs/SDL2/src/video/emscripten/SDL_emscriptenframebuffer.c @@ -26,6 +26,8 @@ #include "SDL_emscriptenframebuffer.h" #include "SDL_hints.h" +#include + int Emscripten_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch) { @@ -69,7 +71,7 @@ int Emscripten_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rec /* Send the data to the display */ - EM_ASM_INT({ + MAIN_THREAD_EM_ASM({ var w = $0; var h = $1; var pixels = $2; @@ -154,7 +156,6 @@ int Emscripten_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rec } SDL2.ctx.putImageData(SDL2.image, 0, 0); - return 0; }, surface->w, surface->h, surface->pixels); if (emscripten_has_asyncify() && SDL_GetHintBoolean(SDL_HINT_EMSCRIPTEN_ASYNCIFY, SDL_TRUE)) { diff --git a/libs/SDL2/src/video/emscripten/SDL_emscriptenmouse.c b/libs/SDL2/src/video/emscripten/SDL_emscriptenmouse.c index e7307259..38e394ac 100644 --- a/libs/SDL2/src/video/emscripten/SDL_emscriptenmouse.c +++ b/libs/SDL2/src/video/emscripten/SDL_emscriptenmouse.c @@ -24,6 +24,7 @@ #include #include +#include #include "SDL_emscriptenmouse.h" #include "SDL_emscriptenvideo.h" @@ -62,6 +63,7 @@ Emscripten_CreateDefaultCursor() return Emscripten_CreateCursorFromString("default", SDL_FALSE); } + static SDL_Cursor* Emscripten_CreateCursor(SDL_Surface* surface, int hot_x, int hot_y) { @@ -74,7 +76,7 @@ Emscripten_CreateCursor(SDL_Surface* surface, int hot_x, int hot_y) return NULL; } - cursor_url = (const char *)EM_ASM_INT({ + cursor_url = (const char *)MAIN_THREAD_EM_ASM_INT({ var w = $0; var h = $1; var hot_x = $2; @@ -206,16 +208,15 @@ Emscripten_ShowCursor(SDL_Cursor* cursor) curdata = (Emscripten_CursorData *) cursor->driverdata; if(curdata->system_cursor) { - EM_ASM_INT({ + MAIN_THREAD_EM_ASM({ if (Module['canvas']) { Module['canvas'].style['cursor'] = UTF8ToString($0); } - return 0; }, curdata->system_cursor); } } else { - EM_ASM( + MAIN_THREAD_EM_ASM( if (Module['canvas']) { Module['canvas'].style['cursor'] = 'none'; } diff --git a/libs/SDL2/src/video/emscripten/SDL_emscriptenvideo.c b/libs/SDL2/src/video/emscripten/SDL_emscriptenvideo.c index 8f422766..4c6038f0 100644 --- a/libs/SDL2/src/video/emscripten/SDL_emscriptenvideo.c +++ b/libs/SDL2/src/video/emscripten/SDL_emscriptenvideo.c @@ -43,6 +43,7 @@ static int Emscripten_VideoInit(_THIS); static int Emscripten_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode); static void Emscripten_VideoQuit(_THIS); static int Emscripten_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect); +static int Emscripten_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdpi, float * vdpi); static int Emscripten_CreateWindow(_THIS, SDL_Window * window); static void Emscripten_SetWindowSize(_THIS, SDL_Window * window); @@ -82,6 +83,7 @@ Emscripten_CreateDevice(int devindex) device->VideoInit = Emscripten_VideoInit; device->VideoQuit = Emscripten_VideoQuit; device->GetDisplayUsableBounds = Emscripten_GetDisplayUsableBounds; + device->GetDisplayDPI = Emscripten_GetDisplayDPI; device->SetDisplayMode = Emscripten_SetDisplayMode; @@ -172,16 +174,37 @@ Emscripten_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * if (rect) { rect->x = 0; rect->y = 0; - rect->w = EM_ASM_INT_V({ + rect->w = MAIN_THREAD_EM_ASM_INT({ return window.innerWidth; }); - rect->h = EM_ASM_INT_V({ + rect->h = MAIN_THREAD_EM_ASM_INT({ return window.innerHeight; }); } return 0; } +static int +Emscripten_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi_out, float * hdpi_out, float * vdpi_out) +{ + const float dpi_reference = 96.0f; + float dpi; + + dpi = (float)emscripten_get_device_pixel_ratio() * dpi_reference; + + if (ddpi_out) { + *ddpi_out = dpi; + } + if (hdpi_out) { + *hdpi_out = dpi; + } + if (vdpi_out) { + *vdpi_out = dpi; + } + + return 0; +} + static void Emscripten_PumpEvents(_THIS) { diff --git a/libs/SDL2/src/video/haiku/SDL_BWin.h b/libs/SDL2/src/video/haiku/SDL_BWin.h index dc6e442a..1ac51716 100644 --- a/libs/SDL2/src/video/haiku/SDL_BWin.h +++ b/libs/SDL2/src/video/haiku/SDL_BWin.h @@ -39,7 +39,6 @@ extern "C" { #include #include #include -#include #if SDL_VIDEO_OPENGL #include #endif @@ -58,19 +57,48 @@ enum WinCommands { BWIN_SET_TITLE, BWIN_SET_BORDERED, BWIN_SET_RESIZABLE, - BWIN_FULLSCREEN + BWIN_FULLSCREEN, + BWIN_UPDATE_FRAMEBUFFER, + BWIN_MINIMUM_SIZE_WINDOW }; +// non-OpenGL framebuffer view +class SDL_BView: public BView +{ +public: + SDL_BView(BRect frame, const char* name, uint32 resizingMode) + : BView(frame, name, resizingMode, B_WILL_DRAW), + fBitmap(NULL) + { + } -class SDL_BWin:public BDirectWindow + void Draw(BRect dirty) + { + if (fBitmap != NULL) + DrawBitmap(fBitmap, B_ORIGIN); + } + + void SetBitmap(BBitmap *bitmap) + { + fBitmap = bitmap; + } + +private: + BBitmap *fBitmap; +}; + +class SDL_BWin: public BWindow { public: /* Constructor/Destructor */ SDL_BWin(BRect bounds, window_look look, uint32 flags) - : BDirectWindow(bounds, "Untitled", look, B_NORMAL_WINDOW_FEEL, flags) + : BWindow(bounds, "Untitled", look, B_NORMAL_WINDOW_FEEL, flags) { _last_buttons = 0; + _cur_view = NULL; + _SDL_View = NULL; + #if SDL_VIDEO_OPENGL _SDL_GLView = NULL; _gl_type = 0; @@ -79,59 +107,88 @@ class SDL_BWin:public BDirectWindow _inhibit_resize = false; _mouse_focused = false; _prev_frame = NULL; + _fullscreen = NULL; /* Handle framebuffer stuff */ - _connected = _connection_disabled = false; - _buffer_created = _buffer_dirty = false; - _trash_window_buffer = false; _buffer_locker = new BLocker(); _bitmap = NULL; - _clips = NULL; - _num_clips = 0; - -#ifdef DRAWTHREAD - _draw_thread_id = spawn_thread(HAIKU_DrawThread, "drawing_thread", - B_NORMAL_PRIORITY, (void*) this); - resume_thread(_draw_thread_id); -#endif } virtual ~ SDL_BWin() { Lock(); - _connection_disabled = true; - int32 result; + + if (_SDL_View != NULL && _SDL_View != _cur_view) { + delete _SDL_View; + _SDL_View = NULL; + } #if SDL_VIDEO_OPENGL if (_SDL_GLView) { - _SDL_GLView->UnlockGL(); - RemoveChild(_SDL_GLView); /* Why was this outside the if - statement before? */ + if (((SDL_BApp*)be_app)->GetCurrentContext() == _SDL_GLView) + ((SDL_BApp*)be_app)->SetCurrentContext(NULL); + if (_SDL_GLView == _cur_view) + RemoveChild(_SDL_GLView); + _SDL_GLView = NULL; + // _SDL_GLView deleted by HAIKU_GL_DeleteContext } #endif Unlock(); -#if SDL_VIDEO_OPENGL - if (_SDL_GLView) { - delete _SDL_GLView; - } -#endif delete _prev_frame; /* Clean up framebuffer stuff */ _buffer_locker->Lock(); -#ifdef DRAWTHREAD - wait_for_thread(_draw_thread_id, &result); -#endif - SDL_free(_clips); delete _buffer_locker; } + + void SetCurrentView(BView *view) + { + if (_cur_view != view) { + if (_cur_view != NULL) + RemoveChild(_cur_view); + _cur_view = view; + if (_cur_view != NULL) + AddChild(_cur_view); + } + } + void UpdateCurrentView() + { + if (_SDL_GLView != NULL) { + SetCurrentView(_SDL_GLView); + } else if (_SDL_View != NULL) { + SetCurrentView(_SDL_View); + } else { + SetCurrentView(NULL); + } + } + + SDL_BView *CreateView() { + Lock(); + if (_SDL_View == NULL) { + _SDL_View = new SDL_BView(Bounds(), "SDL View", B_FOLLOW_ALL_SIDES); + UpdateCurrentView(); + } + Unlock(); + return _SDL_View; + } + + void RemoveView() { + Lock(); + if(_SDL_View != NULL) { + SDL_BView *oldView = _SDL_View; + _SDL_View = NULL; + UpdateCurrentView(); + delete oldView; + } + Unlock(); + } /* * * * * OpenGL functionality * * * * */ #if SDL_VIDEO_OPENGL - virtual BGLView *CreateGLView(Uint32 gl_flags) { + BGLView *CreateGLView(Uint32 gl_flags) { Lock(); if (_SDL_GLView == NULL) { _SDL_GLView = new BGLView(Bounds(), "SDL GLView", @@ -139,92 +196,29 @@ class SDL_BWin:public BDirectWindow (B_WILL_DRAW | B_FRAME_EVENTS), gl_flags); _gl_type = gl_flags; + UpdateCurrentView(); } - AddChild(_SDL_GLView); - _SDL_GLView->EnableDirectMode(false); /* Disable direct mode */ - _SDL_GLView->LockGL(); /* "New" GLViews are created */ Unlock(); - return (_SDL_GLView); + return _SDL_GLView; } - virtual void RemoveGLView() { + void RemoveGLView() { Lock(); - if(_SDL_GLView) { - _SDL_GLView->UnlockGL(); - RemoveChild(_SDL_GLView); + if(_SDL_GLView != NULL) { + if (((SDL_BApp*)be_app)->GetCurrentContext() == _SDL_GLView) + ((SDL_BApp*)be_app)->SetCurrentContext(NULL); + _SDL_GLView = NULL; + UpdateCurrentView(); + // _SDL_GLView deleted by HAIKU_GL_DeleteContext } Unlock(); } - virtual void SwapBuffers(void) { - _SDL_GLView->UnlockGL(); - _SDL_GLView->LockGL(); + void SwapBuffers(void) { _SDL_GLView->SwapBuffers(); } #endif - /* * * * * Framebuffering* * * * */ - virtual void DirectConnected(direct_buffer_info *info) { - if(!_connected && _connection_disabled) { - return; - } - - /* Determine if the pixel buffer is usable after this update */ - _trash_window_buffer = _trash_window_buffer - || ((info->buffer_state & B_BUFFER_RESIZED) - || (info->buffer_state & B_BUFFER_RESET) - || (info->driver_state == B_MODE_CHANGED)); - LockBuffer(); - - switch(info->buffer_state & B_DIRECT_MODE_MASK) { - case B_DIRECT_START: - _connected = true; - - case B_DIRECT_MODIFY: - if (info->clip_list_count > _num_clips) - { - if(_clips) { - SDL_free(_clips); - _clips = NULL; - } - } - - _num_clips = info->clip_list_count; - if (_clips == NULL) - _clips = (clipping_rect *)SDL_malloc(_num_clips*sizeof(clipping_rect)); - if(_clips) { - SDL_memcpy(_clips, info->clip_list, - _num_clips*sizeof(clipping_rect)); - - _bits = (uint8*) info->bits; - _row_bytes = info->bytes_per_row; - _bounds = info->window_bounds; - _bytes_per_px = info->bits_per_pixel / 8; - _buffer_dirty = true; - } - break; - - case B_DIRECT_STOP: - _connected = false; - break; - } -#if SDL_VIDEO_OPENGL - if(_SDL_GLView) { - _SDL_GLView->DirectConnected(info); - } -#endif - - - /* Call the base object directconnected */ - BDirectWindow::DirectConnected(info); - - UnlockBuffer(); - - } - - - - /* * * * * Event sending * * * * */ /* Hook functions */ virtual void FrameMoved(BPoint origin) { @@ -235,10 +229,10 @@ class SDL_BWin:public BDirectWindow _PostWindowEvent(msg); /* Perform normal hook operations */ - BDirectWindow::FrameMoved(origin); + BWindow::FrameMoved(origin); } - virtual void FrameResized(float width, float height) { + void FrameResized(float width, float height) { /* Post a message to the BApp so that it can handle the window event */ BMessage msg(BAPP_WINDOW_RESIZED); @@ -247,10 +241,10 @@ class SDL_BWin:public BDirectWindow _PostWindowEvent(msg); /* Perform normal hook operations */ - BDirectWindow::FrameResized(width, height); + BWindow::FrameResized(width, height); } - virtual bool QuitRequested() { + bool QuitRequested() { BMessage msg(BAPP_WINDOW_CLOSE_REQUESTED); _PostWindowEvent(msg); @@ -258,13 +252,13 @@ class SDL_BWin:public BDirectWindow return false; } - virtual void WindowActivated(bool active) { + void WindowActivated(bool active) { BMessage msg(BAPP_KEYBOARD_FOCUS); /* Mouse focus sold separately */ msg.AddBool("focusGained", active); _PostWindowEvent(msg); } - virtual void Zoom(BPoint origin, + void Zoom(BPoint origin, float width, float height) { BMessage msg(BAPP_MAXIMIZE); /* Closest thing to maximization Haiku has */ @@ -275,13 +269,13 @@ class SDL_BWin:public BDirectWindow _prev_frame = new BRect(Frame()); /* Perform normal hook operations */ - BDirectWindow::Zoom(origin, width, height); + BWindow::Zoom(origin, width, height); } /* Member functions */ - virtual void Show() { + void Show() { while(IsHidden()) { - BDirectWindow::Show(); + BWindow::Show(); } _shown = true; @@ -289,25 +283,33 @@ class SDL_BWin:public BDirectWindow _PostWindowEvent(msg); } - virtual void Hide() { - BDirectWindow::Hide(); + void Hide() { + BWindow::Hide(); _shown = false; BMessage msg(BAPP_HIDE); _PostWindowEvent(msg); } - virtual void Minimize(bool minimize) { - BDirectWindow::Minimize(minimize); + void Minimize(bool minimize) { + BWindow::Minimize(minimize); int32 minState = (minimize ? BAPP_MINIMIZE : BAPP_RESTORE); BMessage msg(minState); _PostWindowEvent(msg); } + void ScreenChanged(BRect screenFrame, color_space depth) + { + if (_fullscreen) { + MoveTo(screenFrame.left, screenFrame.top); + ResizeTo(screenFrame.Width(), screenFrame.Height()); + } + } + /* BView message interruption */ - virtual void DispatchMessage(BMessage * msg, BHandler * target) + void DispatchMessage(BMessage * msg, BHandler * target) { BPoint where; /* Used by mouse moved */ int32 buttons; /* Used for mouse button events */ @@ -356,7 +358,7 @@ class SDL_BWin:public BDirectWindow } } break; - + case B_UNMAPPED_KEY_DOWN: /* modifier keys are unmapped */ if (msg->FindInt32("key", &key) == B_OK) { _KeyEvent((SDL_Scancode)key, NULL, 0, SDL_PRESSED); @@ -376,15 +378,15 @@ class SDL_BWin:public BDirectWindow - CTRL+Q to close window (and other shortcuts) - PrintScreen to make screenshot into /boot/home - etc.. */ - /* BDirectWindow::DispatchMessage(msg, target); */ + /* BWindow::DispatchMessage(msg, target); */ break; } - BDirectWindow::DispatchMessage(msg, target); + BWindow::DispatchMessage(msg, target); } /* Handle command messages */ - virtual void MessageReceived(BMessage* message) { + void MessageReceived(BMessage* message) { switch (message->what) { /* Handle commands from SDL */ case BWIN_SET_TITLE: @@ -396,12 +398,18 @@ class SDL_BWin:public BDirectWindow case BWIN_RESIZE_WINDOW: _ResizeTo(message); break; - case BWIN_SET_BORDERED: - _SetBordered(message); + case BWIN_SET_BORDERED: { + bool bEnabled; + if (message->FindBool("window-border", &bEnabled) == B_OK) + _SetBordered(bEnabled); break; - case BWIN_SET_RESIZABLE: - _SetResizable(message); + } + case BWIN_SET_RESIZABLE: { + bool bEnabled; + if (message->FindBool("window-resizable", &bEnabled) == B_OK) + _SetResizable(bEnabled); break; + } case BWIN_SHOW_WINDOW: Show(); break; @@ -417,12 +425,34 @@ class SDL_BWin:public BDirectWindow case BWIN_RESTORE_WINDOW: _Restore(); break; - case BWIN_FULLSCREEN: - _SetFullScreen(message); + case BWIN_FULLSCREEN: { + bool fullscreen; + if (message->FindBool("fullscreen", &fullscreen) == B_OK) + _SetFullScreen(fullscreen); break; + } + case BWIN_MINIMUM_SIZE_WINDOW: + _SetMinimumSize(message); + break; + case BWIN_UPDATE_FRAMEBUFFER: { + BMessage* pendingMessage; + while ((pendingMessage + = MessageQueue()->FindMessage(BWIN_UPDATE_FRAMEBUFFER, 0))) { + MessageQueue()->RemoveMessage(pendingMessage); + delete pendingMessage; + } + if (_bitmap != NULL) { + if (_SDL_View != NULL && _cur_view == _SDL_View) + _SDL_View->Draw(Bounds()); + else if (_SDL_GLView != NULL && _cur_view == _SDL_GLView) { + _SDL_GLView->CopyPixelsIn(_bitmap, B_ORIGIN); + } + } + break; + } default: /* Perform normal message handling */ - BDirectWindow::MessageReceived(message); + BWindow::MessageReceived(message); break; } @@ -433,19 +463,9 @@ class SDL_BWin:public BDirectWindow /* Accessor methods */ bool IsShown() { return _shown; } int32 GetID() { return _id; } - uint32 GetRowBytes() { return _row_bytes; } - int32 GetFbX() { return _bounds.left; } - int32 GetFbY() { return _bounds.top; } - bool ConnectionEnabled() { return !_connection_disabled; } - bool Connected() { return _connected; } - clipping_rect *GetClips() { return _clips; } - int32 GetNumClips() { return _num_clips; } - uint8* GetBufferPx() { return _bits; } - int32 GetBytesPerPx() { return _bytes_per_px; } - bool CanTrashWindowBuffer() { return _trash_window_buffer; } - bool BufferExists() { return _buffer_created; } - bool BufferIsDirty() { return _buffer_dirty; } BBitmap *GetBitmap() { return _bitmap; } + BView *GetCurView() { return _cur_view; } + SDL_BView *GetView() { return _SDL_View; } #if SDL_VIDEO_OPENGL BGLView *GetGLView() { return _SDL_GLView; } Uint32 GetGLType() { return _gl_type; } @@ -453,12 +473,9 @@ class SDL_BWin:public BDirectWindow /* Setter methods */ void SetID(int32 id) { _id = id; } - void SetBufferExists(bool bufferExists) { _buffer_created = bufferExists; } void LockBuffer() { _buffer_locker->Lock(); } void UnlockBuffer() { _buffer_locker->Unlock(); } - void SetBufferDirty(bool bufferDirty) { _buffer_dirty = bufferDirty; } - void SetTrashBuffer(bool trash) { _trash_window_buffer = trash; } - void SetBitmap(BBitmap *bitmap) { _bitmap = bitmap; } + void SetBitmap(BBitmap *bitmap) { _bitmap = bitmap; if (_SDL_View != NULL) _SDL_View->SetBitmap(bitmap); } private: @@ -564,7 +581,10 @@ private: ) { return; } - MoveTo(x, y); + if (_fullscreen) + _non_fullscreen_frame.OffsetTo(x, y); + else + MoveTo(x, y); } void _ResizeTo(BMessage *msg) { @@ -575,27 +595,48 @@ private: ) { return; } - ResizeTo(w, h); + if (_fullscreen) { + _non_fullscreen_frame.right = _non_fullscreen_frame.left + w; + _non_fullscreen_frame.bottom = _non_fullscreen_frame.top + h; + } else + ResizeTo(w, h); } - void _SetBordered(BMessage *msg) { - bool bEnabled; - if(msg->FindBool("window-border", &bEnabled) != B_OK) { - return; - } - SetLook(bEnabled ? B_TITLED_WINDOW_LOOK : B_NO_BORDER_WINDOW_LOOK); + void _SetBordered(bool bEnabled) { + if (_fullscreen) + _bordered = bEnabled; + else + SetLook(bEnabled ? B_TITLED_WINDOW_LOOK : B_NO_BORDER_WINDOW_LOOK); } - void _SetResizable(BMessage *msg) { - bool bEnabled; - if(msg->FindBool("window-resizable", &bEnabled) != B_OK) { + void _SetResizable(bool bEnabled) { + if (_fullscreen) + _resizable = bEnabled; + else { + if (bEnabled) { + SetFlags(Flags() & ~(B_NOT_RESIZABLE | B_NOT_ZOOMABLE)); + } else { + SetFlags(Flags() | (B_NOT_RESIZABLE | B_NOT_ZOOMABLE)); + } + } + } + + void _SetMinimumSize(BMessage *msg) { + float maxHeight; + float maxWidth; + float _; + int32 minHeight; + int32 minWidth; + + // This is a bit convoluted, we only want to set the minimum not the maximum + // But there is no direct call to do that, so store the maximum size beforehand + GetSizeLimits(&_, &maxWidth, &_, &maxHeight); + if (msg->FindInt32("window-w", &minWidth) != B_OK) return; - } - if (bEnabled) { - SetFlags(Flags() & ~(B_NOT_RESIZABLE | B_NOT_ZOOMABLE)); - } else { - SetFlags(Flags() | (B_NOT_RESIZABLE | B_NOT_ZOOMABLE)); - } + if (msg->FindInt32("window-h", &minHeight) != B_OK) + return; + SetSizeLimits((float)minWidth, maxWidth, (float)minHeight, maxHeight); + UpdateSizeLimits(); } void _Restore() { @@ -603,23 +644,42 @@ private: Minimize(false); } else if(IsHidden()) { Show(); + } else if (_fullscreen) { + } else if(_prev_frame != NULL) { /* Zoomed */ MoveTo(_prev_frame->left, _prev_frame->top); ResizeTo(_prev_frame->Width(), _prev_frame->Height()); } } - void _SetFullScreen(BMessage *msg) { - bool fullscreen; - if( - msg->FindBool("fullscreen", &fullscreen) != B_OK - ) { - return; + void _SetFullScreen(bool fullscreen) { + if (fullscreen != _fullscreen) { + if (fullscreen) { + BScreen screen(this); + BRect screenFrame = screen.Frame(); + printf("screen frame: "); screenFrame.PrintToStream(); printf("\n"); + _bordered = Look() != B_NO_BORDER_WINDOW_LOOK; + _resizable = !(Flags() & B_NOT_RESIZABLE); + _non_fullscreen_frame = Frame(); + _SetBordered(false); + _SetResizable(false); + MoveTo(screenFrame.left, screenFrame.top); + ResizeTo(screenFrame.Width(), screenFrame.Height()); + _fullscreen = fullscreen; + } else { + _fullscreen = fullscreen; + MoveTo(_non_fullscreen_frame.left, _non_fullscreen_frame.top); + ResizeTo(_non_fullscreen_frame.Width(), _non_fullscreen_frame.Height()); + _SetBordered(_bordered); + _SetResizable(_resizable); + } } - SetFullScreen(fullscreen); } /* Members */ + + BView* _cur_view; + SDL_BView* _SDL_View; #if SDL_VIDEO_OPENGL BGLView * _SDL_GLView; Uint32 _gl_type; @@ -632,23 +692,15 @@ private: bool _inhibit_resize; BRect *_prev_frame; /* Previous position and size of the window */ + bool _fullscreen; + // valid only if fullscreen + BRect _non_fullscreen_frame; + bool _bordered; + bool _resizable; /* Framebuffer members */ - bool _connected, - _connection_disabled, - _buffer_created, - _buffer_dirty, - _trash_window_buffer; - uint8 *_bits; - uint32 _row_bytes; - clipping_rect _bounds; - BLocker *_buffer_locker; - clipping_rect *_clips; - uint32 _num_clips; - int32 _bytes_per_px; - thread_id _draw_thread_id; - - BBitmap *_bitmap; + BLocker *_buffer_locker; + BBitmap *_bitmap; }; diff --git a/libs/SDL2/src/video/haiku/SDL_bwindow.cc b/libs/SDL2/src/video/haiku/SDL_bwindow.cc index 587affad..24625337 100644 --- a/libs/SDL2/src/video/haiku/SDL_bwindow.cc +++ b/libs/SDL2/src/video/haiku/SDL_bwindow.cc @@ -226,13 +226,12 @@ void HAIKU_DestroyWindow(_THIS, SDL_Window * window) { 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 --git a/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmsym.h b/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmsym.h index 52c78de5..f53c5c8e 100644 --- a/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmsym.h +++ b/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmsym.h @@ -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 @@ SDL_KMSDRM_SYM(void,gbm_surface_release_buffer,(struct gbm_surface *surf, struct #undef SDL_KMSDRM_SYM #undef SDL_KMSDRM_SYM_CONST -/* *INDENT-ON* */ +/* *INDENT-ON* */ /* clang-format on */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmvulkan.c b/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmvulkan.c index b9ab13c5..d404fd80 100644 --- a/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmvulkan.c +++ b/libs/SDL2/src/video/kmsdrm/SDL_kmsdrmvulkan.c @@ -476,9 +476,9 @@ SDL_bool KMSDRM_Vulkan_CreateSurface(_THIS, } } - /* 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 --git a/libs/SDL2/src/video/nacl/SDL_naclevents.c b/libs/SDL2/src/video/nacl/SDL_naclevents.c index 142d0c1f..f161e9c2 100644 --- a/libs/SDL2/src/video/nacl/SDL_naclevents.c +++ b/libs/SDL2/src/video/nacl/SDL_naclevents.c @@ -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 --git a/libs/SDL2/src/video/nacl/SDL_naclwindow.c b/libs/SDL2/src/video/nacl/SDL_naclwindow.c index 255ac084..f0245aef 100644 --- a/libs/SDL2/src/video/nacl/SDL_naclwindow.c +++ b/libs/SDL2/src/video/nacl/SDL_naclwindow.c @@ -35,8 +35,7 @@ NACL_CreateWindow(_THIS, SDL_Window * window) SDL_VideoData *driverdata = (SDL_VideoData *) _this->driverdata; if (driverdata->window) { - SDL_SetError("NaCl only supports one window"); - return -1; + return SDL_SetError("NaCl only supports one window"); } driverdata->window = window; diff --git a/libs/SDL2/src/video/ngage/SDL_ngageevents.cpp b/libs/SDL2/src/video/ngage/SDL_ngageevents.cpp new file mode 100644 index 00000000..a1363337 --- /dev/null +++ b/libs/SDL2/src/video/ngage/SDL_ngageevents.cpp @@ -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 --git a/libs/SDL2/src/video/ngage/SDL_ngageevents_c.h b/libs/SDL2/src/video/ngage/SDL_ngageevents_c.h new file mode 100644 index 00000000..c7b58ce4 --- /dev/null +++ b/libs/SDL2/src/video/ngage/SDL_ngageevents_c.h @@ -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 --git a/libs/SDL2/src/video/ngage/SDL_ngageframebuffer.cpp b/libs/SDL2/src/video/ngage/SDL_ngageframebuffer.cpp new file mode 100644 index 00000000..a67fa5a8 --- /dev/null +++ b/libs/SDL2/src/video/ngage/SDL_ngageframebuffer.cpp @@ -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 --git a/libs/SDL2/src/video/ngage/SDL_ngageframebuffer_c.h b/libs/SDL2/src/video/ngage/SDL_ngageframebuffer_c.h new file mode 100644 index 00000000..c2f0768c --- /dev/null +++ b/libs/SDL2/src/video/ngage/SDL_ngageframebuffer_c.h @@ -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 --git a/libs/SDL2/src/video/ngage/SDL_ngagevideo.cpp b/libs/SDL2/src/video/ngage/SDL_ngagevideo.cpp new file mode 100644 index 00000000..eea21e8e --- /dev/null +++ b/libs/SDL2/src/video/ngage/SDL_ngagevideo.cpp @@ -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(int devindex) +{ + 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 --git a/libs/SDL2/src/video/ngage/SDL_ngagevideo.h b/libs/SDL2/src/video/ngage/SDL_ngagevideo.h new file mode 100644 index 00000000..86fc1a58 --- /dev/null +++ b/libs/SDL2/src/video/ngage/SDL_ngagevideo.h @@ -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 --git a/libs/SDL2/src/video/ngage/SDL_ngagewindow.cpp b/libs/SDL2/src/video/ngage/SDL_ngagewindow.cpp new file mode 100644 index 00000000..5b0682b2 --- /dev/null +++ b/libs/SDL2/src/video/ngage/SDL_ngagewindow.cpp @@ -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 --git a/libs/SDL2/src/video/ngage/SDL_ngagewindow.h b/libs/SDL2/src/video/ngage/SDL_ngagewindow.h new file mode 100644 index 00000000..148c7998 --- /dev/null +++ b/libs/SDL2/src/video/ngage/SDL_ngagewindow.h @@ -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 --git a/libs/SDL2/src/video/offscreen/SDL_offscreenframebuffer.c b/libs/SDL2/src/video/offscreen/SDL_offscreenframebuffer.c index 9b774896..3ca57e89 100644 --- a/libs/SDL2/src/video/offscreen/SDL_offscreenframebuffer.c +++ b/libs/SDL2/src/video/offscreen/SDL_offscreenframebuffer.c @@ -34,17 +34,13 @@ int SDL_OFFSCREEN_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * f SDL_Surface *surface; const Uint32 surface_format = SDL_PIXELFORMAT_RGB888; int w, h; - int bpp; - Uint32 Rmask, Gmask, Bmask, Amask; /* Free the old framebuffer surface */ - surface = (SDL_Surface *) SDL_GetWindowData(window, OFFSCREEN_SURFACE); - SDL_FreeSurface(surface); + SDL_OFFSCREEN_DestroyWindowFramebuffer(_this, window); /* Create a new one */ - SDL_PixelFormatEnumToMasks(surface_format, &bpp, &Rmask, &Gmask, &Bmask, &Amask); SDL_GetWindowSize(window, &w, &h); - surface = SDL_CreateRGBSurface(0, w, h, bpp, Rmask, Gmask, Bmask, Amask); + surface = SDL_CreateRGBSurfaceWithFormat(0, w, h, 0, surface_format); if (!surface) { return -1; } diff --git a/libs/SDL2/src/video/os2/SDL_os2dive.c b/libs/SDL2/src/video/os2/SDL_os2dive.c index 52f1483b..95aae6f0 100644 --- a/libs/SDL2/src/video/os2/SDL_os2dive.c +++ b/libs/SDL2/src/video/os2/SDL_os2dive.c @@ -67,10 +67,12 @@ OS2VIDEOOUTPUT voDive = { static BOOL voQueryInfo(VIDEOOUTPUTINFO *pInfo) { - DIVE_CAPS sDiveCaps = { 0 }; - FOURCC fccFormats[100] = { 0 }; + DIVE_CAPS sDiveCaps; + FOURCC fccFormats[100]; /* Query information about display hardware from DIVE. */ + SDL_zeroa(fccFormats); + SDL_zero(sDiveCaps); sDiveCaps.pFormatData = fccFormats; sDiveCaps.ulFormatLength = 100; sDiveCaps.ulStructLen = sizeof(DIVE_CAPS); @@ -172,7 +174,7 @@ static BOOL voSetVisibleRegion(PVODATA pVOData, HWND hwnd, /* Setup DIVE blitter. */ SETUP_BLITTER sSetupBlitter; SWP swp; - POINTL pointl = { 0 }; + POINTL pointl = { 0,0 }; WinQueryWindowPos(hwnd, &swp); WinMapWindowPoints(hwnd, HWND_DESKTOP, &pointl, 1); diff --git a/libs/SDL2/src/video/os2/SDL_os2util.c b/libs/SDL2/src/video/os2/SDL_os2util.c index adc2fd5e..bcc6c54e 100644 --- a/libs/SDL2/src/video/os2/SDL_os2util.c +++ b/libs/SDL2/src/video/os2/SDL_os2util.c @@ -27,8 +27,8 @@ HPOINTER utilCreatePointer(SDL_Surface *surface, ULONG ulHotX, ULONG ulHotY) { HBITMAP hbm; - BITMAPINFOHEADER2 bmih = { 0 }; - BITMAPINFO bmi = { 0 }; + BITMAPINFOHEADER2 bmih; + BITMAPINFO bmi; HPS hps; PULONG pulBitmap; PULONG pulDst, pulSrc, pulDstMask; @@ -40,7 +40,7 @@ HPOINTER utilCreatePointer(SDL_Surface *surface, ULONG ulHotX, ULONG ulHotY) return NULLHANDLE; } - pulBitmap = SDL_malloc(surface->h * surface->w * 4 * 2); + pulBitmap = (PULONG) SDL_malloc(surface->h * surface->w * 2 * sizeof(ULONG)); if (pulBitmap == NULL) { SDL_OutOfMemory(); return NULLHANDLE; @@ -72,6 +72,9 @@ HPOINTER utilCreatePointer(SDL_Surface *surface, ULONG ulHotX, ULONG ulHotY) } /* Create system bitmap object. */ + SDL_zero(bmih); + SDL_zero(bmi); + bmih.cbFix = sizeof(BITMAPINFOHEADER2); bmih.cx = surface->w; bmih.cy = 2 * surface->h; diff --git a/libs/SDL2/src/video/os2/SDL_os2video.c b/libs/SDL2/src/video/os2/SDL_os2video.c index d624575c..81e8e554 100644 --- a/libs/SDL2/src/video/os2/SDL_os2video.c +++ b/libs/SDL2/src/video/os2/SDL_os2video.c @@ -335,7 +335,7 @@ static VOID _wmChar(WINDATA *pWinData, MPARAM mp1, MPARAM mp2) static VOID _wmMove(WINDATA *pWinData) { SDL_DisplayMode *pSDLDisplayMode = _getDisplayModeForSDLWindow(pWinData->window); - POINTL pointl = { 0 }; + POINTL pointl = { 0,0 }; RECTL rectl; WinQueryWindowRect(pWinData->hwnd, &rectl); @@ -1137,8 +1137,8 @@ static SDL_bool OS2_GetWindowWMInfo(_THIS, SDL_Window * window, 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; } @@ -1219,7 +1219,7 @@ static int OS2_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, { SDL_ShapeTree *pShapeTree; WINDATA *pWinData; - SHAPERECTS stShapeRects = { 0 }; + SHAPERECTS stShapeRects; HPS hps; debug_os2("Enter"); @@ -1235,6 +1235,7 @@ static int OS2_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, pShapeTree = SDL_CalculateShapeTree(*shape_mode, shape); shaper->driverdata = pShapeTree; + SDL_zero(stShapeRects); stShapeRects.ulWinHeight = shaper->window->h; SDL_TraverseShapeTree(pShapeTree, &_combineRectRegions, &stShapeRects); @@ -1401,18 +1402,19 @@ static char *OS2_GetClipboardText(_THIS) static SDL_bool OS2_HasClipboardText(_THIS) { SDL_VideoData *pVData = (SDL_VideoData *)_this->driverdata; - SDL_bool fClipboard; + PSZ pszClipboard; + SDL_bool result; if (!WinOpenClipbrd(pVData->hab)) { debug_os2("WinOpenClipbrd() failed"); return SDL_FALSE; } - fClipboard = ((PSZ)WinQueryClipbrdData(pVData->hab, CF_TEXT) != NULL)? - SDL_TRUE : SDL_FALSE; + pszClipboard = (PSZ)WinQueryClipbrdData(pVData->hab, CF_TEXT); + result = (pszClipboard && *pszClipboard) ? SDL_TRUE : SDL_FALSE; WinCloseClipbrd(pVData->hab); - return fClipboard; + return result; } @@ -1570,7 +1572,7 @@ static void OS2_GetDisplayModes(_THIS, SDL_VideoDisplay *display) 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)); diff --git a/libs/SDL2/src/video/os2/SDL_os2vman.c b/libs/SDL2/src/video/os2/SDL_os2vman.c index 3fb93f13..acb92006 100644 --- a/libs/SDL2/src/video/os2/SDL_os2vman.c +++ b/libs/SDL2/src/video/os2/SDL_os2vman.c @@ -91,10 +91,10 @@ static VOID APIENTRY ExitVMan(VOID) static BOOL _vmanInit(void) { ULONG ulRC; - CHAR acBuf[255]; + CHAR acBuf[256]; INITPROCOUT stInitProcOut; - if (hmodVMan != NULLHANDLE) /* Already was initialized */ + if (hmodVMan != NULLHANDLE) /* already initialized */ return TRUE; /* Load vman.dll */ @@ -108,8 +108,7 @@ static BOOL _vmanInit(void) /* Get VMIEntry */ ulRC = DosQueryProcAddr(hmodVMan, 0L, "VMIEntry", (PFN *)&pfnVMIEntry); if (ulRC != NO_ERROR) { - debug_os2("Could not query address of pfnVMIEntry func. of VMAN.DLL, " - "rc = %u", ulRC); + debug_os2("Could not query address of VMIEntry from VMAN.DLL (Err: %lu)", ulRC); DosFreeModule(hmodVMan); hmodVMan = NULLHANDLE; return FALSE; @@ -327,9 +326,8 @@ static BOOL voUpdate(PVODATA pVOData, HWND hwnd, SDL_Rect *pSDLRects, PPOINTL pptlSrcOrg; PBLTRECT pbrDst; HWREQIN sHWReqIn; - BITBLTINFO sBitbltInfo = { 0 }; + BITBLTINFO sBitbltInfo; ULONG ulIdx; -/* RECTL rectlScreenUpdate;*/ if (pVOData->pBuffer == NULL) return FALSE; @@ -454,6 +452,7 @@ static BOOL voUpdate(PVODATA pVOData, HWND hwnd, SDL_Rect *pSDLRects, rclSrcBounds.xRight = bmiSrc.ulWidth; rclSrcBounds.yTop = bmiSrc.ulHeight; + SDL_zero(sBitbltInfo); sBitbltInfo.ulLength = sizeof(BITBLTINFO); sBitbltInfo.ulBltFlags = BF_DEFAULT_STATE | BF_ROP_INCL_SRC | BF_PAT_HOLLOW; sBitbltInfo.cBlits = cSDLRects; diff --git a/libs/SDL2/src/video/pandora/SDL_pandora.c b/libs/SDL2/src/video/pandora/SDL_pandora.c index 16349f87..83408383 100644 --- a/libs/SDL2/src/video/pandora/SDL_pandora.c +++ b/libs/SDL2/src/video/pandora/SDL_pandora.c @@ -302,8 +302,8 @@ PND_getwindowwminfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) 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 --git a/libs/SDL2/src/video/psp/SDL_pspevents.c b/libs/SDL2/src/video/psp/SDL_pspevents.c index 04a80477..3d3f8ba4 100644 --- a/libs/SDL2/src/video/psp/SDL_pspevents.c +++ b/libs/SDL2/src/video/psp/SDL_pspevents.c @@ -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 --git a/libs/SDL2/src/video/psp/SDL_pspevents_c.h b/libs/SDL2/src/video/psp/SDL_pspevents_c.h index 8a55dde2..1e1b490f 100644 --- a/libs/SDL2/src/video/psp/SDL_pspevents_c.h +++ b/libs/SDL2/src/video/psp/SDL_pspevents_c.h @@ -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 --git a/libs/SDL2/src/video/psp/SDL_pspvideo.c b/libs/SDL2/src/video/psp/SDL_pspvideo.c index a5c86ecc..de31a201 100644 --- a/libs/SDL2/src/video/psp/SDL_pspvideo.c +++ b/libs/SDL2/src/video/psp/SDL_pspvideo.c @@ -287,8 +287,8 @@ PSP_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) 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 --git a/libs/SDL2/src/video/raspberry/SDL_rpievents.c b/libs/SDL2/src/video/raspberry/SDL_rpievents.c index 31cd1bdc..c1c7bb72 100644 --- a/libs/SDL2/src/video/raspberry/SDL_rpievents.c +++ b/libs/SDL2/src/video/raspberry/SDL_rpievents.c @@ -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 --git a/libs/SDL2/src/video/raspberry/SDL_rpivideo.c b/libs/SDL2/src/video/raspberry/SDL_rpivideo.c index 1a0a4ce1..4503f56d 100644 --- a/libs/SDL2/src/video/raspberry/SDL_rpivideo.c +++ b/libs/SDL2/src/video/raspberry/SDL_rpivideo.c @@ -431,8 +431,8 @@ RPI_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) 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 --git a/libs/SDL2/src/video/riscos/SDL_riscosevents.c b/libs/SDL2/src/video/riscos/SDL_riscosevents.c index b7ae62e9..56fe3988 100644 --- a/libs/SDL2/src/video/riscos/SDL_riscosevents.c +++ b/libs/SDL2/src/video/riscos/SDL_riscosevents.c @@ -67,7 +67,6 @@ RISCOS_PollKeyboard(_THIS) /* Check for key presses */ while (key < 0xff) { - SDL_bool already_pressed = SDL_FALSE; key = _kernel_osbyte(121, key + 1, 0) & 0xff; switch (key) { case 255: @@ -83,22 +82,16 @@ RISCOS_PollKeyboard(_THIS) break; default: - /* Do we already know of this key? */ + SDL_SendKeyboardKey(SDL_PRESSED, SDL_RISCOS_translate_keycode(key)); + + /* Record the press so we can detect release later. */ for (i = 0; i < RISCOS_MAX_KEYS_PRESSED; i++) { if (driverdata->key_pressed[i] == key) { - already_pressed = SDL_TRUE; break; } - } - - if (!already_pressed) { - SDL_SendKeyboardKey(SDL_PRESSED, SDL_RISCOS_translate_keycode(key)); - /* Record the press so we can detect release later. */ - for (i = 0; i < RISCOS_MAX_KEYS_PRESSED; i++) { - if (driverdata->key_pressed[i] == 255) { - driverdata->key_pressed[i] = key; - break; - } + if (driverdata->key_pressed[i] == 255) { + driverdata->key_pressed[i] = key; + break; } } } @@ -150,6 +143,7 @@ int 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++) @@ -160,6 +154,9 @@ RISCOS_InitEvents(_THIS) 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 --git a/libs/SDL2/src/video/riscos/SDL_riscosmodes.c b/libs/SDL2/src/video/riscos/SDL_riscosmodes.c index 0e87c140..9500b222 100644 --- a/libs/SDL2/src/video/riscos/SDL_riscosmodes.c +++ b/libs/SDL2/src/video/riscos/SDL_riscosmodes.c @@ -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 @@ RISCOS_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) _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 --git a/libs/SDL2/src/video/riscos/SDL_riscosmouse.c b/libs/SDL2/src/video/riscos/SDL_riscosmouse.c new file mode 100644 index 00000000..072f8a7a --- /dev/null +++ b/libs/SDL2/src/video/riscos/SDL_riscosmouse.c @@ -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 --git a/libs/SDL2/src/video/riscos/SDL_riscosmouse.h b/libs/SDL2/src/video/riscos/SDL_riscosmouse.h new file mode 100644 index 00000000..3048d7d2 --- /dev/null +++ b/libs/SDL2/src/video/riscos/SDL_riscosmouse.h @@ -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 --git a/libs/SDL2/src/video/riscos/SDL_riscosvideo.c b/libs/SDL2/src/video/riscos/SDL_riscosvideo.c index 1d8bd3d9..ebd4952a 100644 --- a/libs/SDL2/src/video/riscos/SDL_riscosvideo.c +++ b/libs/SDL2/src/video/riscos/SDL_riscosvideo.c @@ -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" @@ -105,6 +106,10 @@ RISCOS_VideoInit(_THIS) return -1; } + if (RISCOS_InitMouse(_this) < 0) { + return -1; + } + if (RISCOS_InitModes(_this) < 0) { return -1; } diff --git a/libs/SDL2/src/video/riscos/SDL_riscoswindow.c b/libs/SDL2/src/video/riscos/SDL_riscoswindow.c index 84e4de03..f47d33ad 100644 --- a/libs/SDL2/src/video/riscos/SDL_riscoswindow.c +++ b/libs/SDL2/src/video/riscos/SDL_riscoswindow.c @@ -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 @@ RISCOS_CreateWindow(_THIS, SDL_Window * window) window->flags |= SDL_WINDOW_FULLSCREEN; + SDL_SetMouseFocus(window); + /* All done! */ window->driverdata = driverdata; return 0; @@ -62,13 +66,12 @@ RISCOS_DestroyWindow(_THIS, SDL_Window * window) 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 --git a/libs/SDL2/src/video/riscos/scancodes_riscos.h b/libs/SDL2/src/video/riscos/scancodes_riscos.h index ced6b0d1..dbba9d1a 100644 --- a/libs/SDL2/src/video/riscos/scancodes_riscos.h +++ b/libs/SDL2/src/video/riscos/scancodes_riscos.h @@ -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 @@ static SDL_Scancode const riscos_scancode_table[] = { /* 126 */ SDL_SCANCODE_RGUI, /* 127 */ SDL_SCANCODE_MENU }; -/* *INDENT-ON* */ +/* *INDENT-ON* */ /* clang-format on */ diff --git a/libs/SDL2/src/video/sdlgenblit.pl b/libs/SDL2/src/video/sdlgenblit.pl index bb70cebb..de07b19e 100755 --- a/libs/SDL2/src/video/sdlgenblit.pl +++ b/libs/SDL2/src/video/sdlgenblit.pl @@ -114,7 +114,7 @@ sub open_file { #if SDL_HAVE_BLIT_AUTO -/* *INDENT-OFF* */ +/* *INDENT-OFF* */ /* clang-format off */ __EOF__ } @@ -122,7 +122,7 @@ __EOF__ sub close_file { my $name = shift; print FILE <<__EOF__; -/* *INDENT-ON* */ +/* *INDENT-ON* */ /* clang-format on */ #endif /* SDL_HAVE_BLIT_AUTO */ @@ -220,16 +220,82 @@ sub output_copycore my $A_is_const_FF = shift; my $s = ""; my $d = ""; + my $dst_has_alpha = ($dst =~ /A/) ? 1 : 0; + my $src_has_alpha = ($src =~ /A/) ? 1 : 0; + my $sa = ""; + my $da = ""; - # Nice and easy... - if ( $src eq $dst && !$modulate && !$blend ) { - print FILE <<__EOF__; + if (!$modulate && !$blend) { + # Nice and easy... + if ( $src eq $dst ) { + print FILE <<__EOF__; *dst = *src; __EOF__ - return; + return; + } + + # Matching color-order + $sa = $src; + $sa =~ s/[A8]//g; + $da = $dst; + $da =~ s/[A8]//g; + if ($sa eq $da) { + if ($dst_has_alpha && $src_has_alpha) { + $da = substr $dst, 0, 1; + if ($da eq "A") { + # RGBA -> ARGB + print FILE <<__EOF__; + pixel = *src; + pixel = (pixel >> 8) | (pixel << 24); + *dst = pixel; +__EOF__ + } else { + # ARGB -> RGBA -- unused + print FILE <<__EOF__; + pixel = *src; + pixel = (pixel << 8) | A; + *dst = pixel; +__EOF__ + } + } elsif ($dst_has_alpha) { + $da = substr $dst, 0, 1; + if ($da eq "A") { + # RGB -> ARGB + print FILE <<__EOF__; + pixel = *src; + pixel |= (A << 24); + *dst = pixel; +__EOF__ + } else { + # RGB -> RGBA -- unused + print FILE <<__EOF__; + pixel = *src; + pixel = (pixel << 8) | A; + *dst = pixel; +__EOF__ + } + } else { + $sa = substr $src, 0, 1; + if ($sa eq "A") { + # ARGB -> RGB + print FILE <<__EOF__; + pixel = *src; + pixel &= 0xFFFFFF; + *dst = pixel; +__EOF__ + } else { + # RGBA -> RGB + print FILE <<__EOF__; + pixel = *src; + pixel >>= 8; + *dst = pixel; +__EOF__ + } + } + return; + } } - my $dst_has_alpha = ($dst =~ /A/) ? 1 : 0; my $ignore_dst_alpha = !$dst_has_alpha && !$blend; if ( $blend ) { @@ -366,6 +432,14 @@ sub output_copyfunc my $is_modulateA_done = 0; my $A_is_const_FF = 0; + my $sa = $src; + my $da = $dst; + my $matching_colors = 0; + + $sa =~ s/[A8]//g; + $da =~ s/[A8]//g; + $matching_colors = (!$modulate && !$blend && ($sa eq $da)) ? 1 : 0; + output_copyfuncname("static void", $src, $dst, $modulate, $blend, $scale, 1, "\n"); print FILE <<__EOF__; { @@ -424,8 +498,8 @@ __EOF__ print FILE <<__EOF__; Uint32 pixel; __EOF__ - if (!$ignore_dst_alpha && !$src_has_alpha) { - if ($modulate){ + if ( !$ignore_dst_alpha && !$src_has_alpha ) { + if ( $modulate ) { $is_modulateA_done = 1; print FILE <<__EOF__; const Uint32 A = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF; @@ -436,14 +510,18 @@ __EOF__ const Uint32 A = 0xFF; __EOF__ } - print FILE <<__EOF__; + if ( !$matching_colors ) { + print FILE <<__EOF__; Uint32 R, G, B; __EOF__ - } elsif (!$ignore_dst_alpha) { - print FILE <<__EOF__; + } + } elsif ( !$ignore_dst_alpha ) { + if ( !$matching_colors ) { + print FILE <<__EOF__; Uint32 R, G, B, A; __EOF__ - } else { + } + } elsif ( !$matching_colors ) { print FILE <<__EOF__; Uint32 R, G, B; __EOF__ diff --git a/libs/SDL2/src/video/uikit/SDL_uikitevents.m b/libs/SDL2/src/video/uikit/SDL_uikitevents.m index 5253aa75..b7ef0bf4 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitevents.m +++ b/libs/SDL2/src/video/uikit/SDL_uikitevents.m @@ -87,7 +87,7 @@ static id keyboard_disconnect_observer = nil; static void OnGCKeyboardConnected(GCKeyboard *keyboard) API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0)) { keyboard_connected = SDL_TRUE; - keyboard.keyboardInput.keyChangedHandler = ^(GCKeyboardInput *keyboard, GCControllerButtonInput *key, GCKeyCode keyCode, BOOL pressed) + keyboard.keyboardInput.keyChangedHandler = ^(GCKeyboardInput *kbrd, GCControllerButtonInput *key, GCKeyCode keyCode, BOOL pressed) { SDL_SendKeyboardKey(pressed ? SDL_PRESSED : SDL_RELEASED, (SDL_Scancode)keyCode); }; @@ -225,15 +225,15 @@ static void OnGCMouseConnected(GCMouse *mouse) API_AVAILABLE(macos(11.0), ios(14 }; int auxiliary_button = SDL_BUTTON_X1; - for (GCControllerButtonInput *button in mouse.mouseInput.auxiliaryButtons) { - button.pressedChangedHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed) + for (GCControllerButtonInput *btn in mouse.mouseInput.auxiliaryButtons) { + btn.pressedChangedHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed) { OnGCMouseButtonChanged(mouseID, auxiliary_button, pressed); }; ++auxiliary_button; } - mouse.mouseInput.mouseMovedHandler = ^(GCMouseInput *mouse, float deltaX, float deltaY) + mouse.mouseInput.mouseMovedHandler = ^(GCMouseInput *mouseInput, float deltaX, float deltaY) { if (SDL_GCMouseRelativeMode()) { SDL_SendMouseMotion(SDL_GetMouseFocus(), mouseID, 1, (int)deltaX, -(int)deltaY); diff --git a/libs/SDL2/src/video/uikit/SDL_uikitmessagebox.m b/libs/SDL2/src/video/uikit/SDL_uikitmessagebox.m index 7aecea80..b6d56f35 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitmessagebox.m +++ b/libs/SDL2/src/video/uikit/SDL_uikitmessagebox.m @@ -86,7 +86,7 @@ UIKit_ShowMessageBoxAlertController(const SDL_MessageBoxData *messageboxdata, in action = [UIAlertAction actionWithTitle:@(sdlButton->text) style:style - handler:^(UIAlertAction *action) { + handler:^(UIAlertAction *alertAction) { clickedindex = (int)(sdlButton - messageboxdata->buttons); }]; [alert addAction:action]; @@ -186,8 +186,8 @@ UIKit_ShowMessageBoxAlertView(const SDL_MessageBoxData *messageboxdata, int *but #endif /* __IPHONE_OS_VERSION_MIN_REQUIRED < 80000 */ } -int -UIKit_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) +static void +UIKit_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, int *buttonid, int *returnValue) { BOOL success = NO; @@ -199,12 +199,26 @@ UIKit_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) } if (!success) { - return SDL_SetError("Could not show message box."); + *returnValue = SDL_SetError("Could not show message box."); + } else { + *returnValue = 0; } - - return 0; } +int +UIKit_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) +{ @autoreleasepool +{ + __block int returnValue = 0; + + if ([NSThread isMainThread]) { + UIKit_ShowMessageBoxImpl(messageboxdata, buttonid, &returnValue); + } else { + dispatch_sync(dispatch_get_main_queue(), ^{ UIKit_ShowMessageBoxImpl(messageboxdata, buttonid, &returnValue); }); + } + return returnValue; +}} + #endif /* SDL_VIDEO_DRIVER_UIKIT */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/video/uikit/SDL_uikitopengles.m b/libs/SDL2/src/video/uikit/SDL_uikitopengles.m index 8722dca9..86fefd76 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitopengles.m +++ b/libs/SDL2/src/video/uikit/SDL_uikitopengles.m @@ -162,8 +162,8 @@ UIKit_GL_CreateContext(_THIS, SDL_Window * window) } if (_this->gl_config.share_with_current_context) { - EAGLContext *context = (__bridge EAGLContext *) SDL_GL_GetCurrentContext(); - sharegroup = context.sharegroup; + EAGLContext *currContext = (__bridge EAGLContext *) SDL_GL_GetCurrentContext(); + sharegroup = currContext.sharegroup; } if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { diff --git a/libs/SDL2/src/video/uikit/SDL_uikitopenglview.m b/libs/SDL2/src/video/uikit/SDL_uikitopenglview.m index 52158f8d..ef5ca74e 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitopenglview.m +++ b/libs/SDL2/src/video/uikit/SDL_uikitopenglview.m @@ -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 --git a/libs/SDL2/src/video/uikit/SDL_uikitvideo.m b/libs/SDL2/src/video/uikit/SDL_uikitvideo.m index 5d2b96e3..81d7bf64 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitvideo.m +++ b/libs/SDL2/src/video/uikit/SDL_uikitvideo.m @@ -278,11 +278,16 @@ UIKit_ForceUpdateHomeIndicator() */ #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 --git a/libs/SDL2/src/video/uikit/SDL_uikitviewcontroller.m b/libs/SDL2/src/video/uikit/SDL_uikitviewcontroller.m index 2ab23abd..23a504c4 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitviewcontroller.m +++ b/libs/SDL2/src/video/uikit/SDL_uikitviewcontroller.m @@ -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 @@ SDL_HideHomeIndicatorHintChanged(void *userdata, const char *name, const char *o * 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]); diff --git a/libs/SDL2/src/video/uikit/SDL_uikitwindow.m b/libs/SDL2/src/video/uikit/SDL_uikitwindow.m index 6808de4e..d68e6e73 100644 --- a/libs/SDL2/src/video/uikit/SDL_uikitwindow.m +++ b/libs/SDL2/src/video/uikit/SDL_uikitwindow.m @@ -403,8 +403,8 @@ UIKit_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) 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 --git a/libs/SDL2/src/video/uikit/keyinfotable.h b/libs/SDL2/src/video/uikit/keyinfotable.h deleted file mode 100644 index 25df1053..00000000 --- a/libs/SDL2/src/video/uikit/keyinfotable.h +++ /dev/null @@ -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 --git a/libs/SDL2/src/video/vita/SDL_vitaframebuffer.c b/libs/SDL2/src/video/vita/SDL_vitaframebuffer.c index 992c7af8..1c558486 100644 --- a/libs/SDL2/src/video/vita/SDL_vitaframebuffer.c +++ b/libs/SDL2/src/video/vita/SDL_vitaframebuffer.c @@ -31,7 +31,7 @@ #define ALIGN(x, a) (((x) + ((a) - 1)) & ~((a) - 1)) #define DISPLAY_PIXEL_FORMAT SCE_DISPLAY_PIXELFORMAT_A8B8G8R8 -void *vita_gpu_alloc(SceKernelMemBlockType type, unsigned int size, SceUID *uid) +void *vita_gpu_alloc(unsigned int type, unsigned int size, SceUID *uid) { void *mem; diff --git a/libs/SDL2/src/video/vita/SDL_vitagl_pvr.c b/libs/SDL2/src/video/vita/SDL_vitagl_pvr.c index 3b7fb747..d51150c0 100644 --- a/libs/SDL2/src/video/vita/SDL_vitagl_pvr.c +++ b/libs/SDL2/src/video/vita/SDL_vitagl_pvr.c @@ -20,11 +20,12 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_VITA && SDL_VIDEO_VITA_PVR +#if SDL_VIDEO_DRIVER_VITA && SDL_VIDEO_VITA_PVR && SDL_VIDEO_VITA_PVR_OGL #include #include #include #include +#include #include "SDL_error.h" #include "SDL_log.h" @@ -34,6 +35,16 @@ #define MAX_PATH 256 // vita limits are somehow wrong +/* Defaults */ +int FB_WIDTH = 960; +int FB_HEIGHT = 544; + +void getFBSize(int *width, int *height) +{ + *width = FB_WIDTH; + *height = FB_HEIGHT; +} + int VITA_GL_LoadLibrary(_THIS, const char *path) { @@ -53,6 +64,9 @@ VITA_GL_LoadLibrary(_THIS, const char *path) sceKernelLoadStartModule("vs0:sys/external/libfios2.suprx", 0, NULL, 0, NULL, NULL); sceKernelLoadStartModule("vs0:sys/external/libc.suprx", 0, NULL, 0, NULL, NULL); + SDL_snprintf(target_path, MAX_PATH, "%s/%s", default_path, "libGL.suprx"); + sceKernelLoadStartModule(target_path, 0, NULL, 0, NULL, NULL); + SDL_snprintf(target_path, MAX_PATH, "%s/%s", default_path, "libgpu_es4_ext.suprx"); sceKernelLoadStartModule(target_path, 0, NULL, 0, NULL, NULL); @@ -74,30 +88,45 @@ VITA_GL_LoadLibrary(_THIS, const char *path) SDL_GLContext VITA_GL_CreateContext(_THIS, SDL_Window * window) { - return SDL_EGL_CreateContext(_this, ((SDL_WindowData *) window->driverdata)->egl_surface); -} + char gl_version[3]; + SDL_GLContext context = NULL; + int temp_major = _this->gl_config.major_version; + int temp_minor = _this->gl_config.minor_version; + int temp_profile = _this->gl_config.profile_mask; -int -VITA_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) -{ - if (window && context) { - return SDL_EGL_MakeCurrent(_this, ((SDL_WindowData *) window->driverdata)->egl_surface, context); - } else { - return SDL_EGL_MakeCurrent(_this, NULL, NULL); + /* Set version to 2.0 and PROFILE to ES */ + _this->gl_config.major_version = 2; + _this->gl_config.minor_version = 0; + _this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES; + + context = SDL_EGL_CreateContext(_this, ((SDL_WindowData *) window->driverdata)->egl_surface); + + if (context != NULL) + { + FB_WIDTH = window->w; + FB_HEIGHT = window->h; + set_getprocaddress((void *(*)(const char *))eglGetProcAddress); + set_getmainfbsize(getFBSize); + SDL_snprintf(gl_version, 3, "%d%d", temp_major, temp_minor); + gl4es_setenv("LIBGL_NOTEXRECT", "1", 1); /* Currently broken in driver */ + gl4es_setenv("LIBGL_GL", gl_version, 1); + initialize_gl4es(); } + + /* Restore gl_config */ + _this->gl_config.major_version = temp_major; + _this->gl_config.minor_version = temp_minor; + _this->gl_config.profile_mask = temp_profile; + + return context; } -int -VITA_GL_SwapWindow(_THIS, SDL_Window * window) +void * +VITA_GL_GetProcAddress(_THIS, const char *proc) { - SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata; - if (videodata->ime_active) { - sceImeUpdate(); - } - return SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface); + return gl4es_GetProcAddress(proc); } - #endif /* SDL_VIDEO_DRIVER_VITA && SDL_VIDEO_VITA_PVR */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/video/vita/SDL_vitagl_pvr_c.h b/libs/SDL2/src/video/vita/SDL_vitagl_pvr_c.h index 670eaebb..2329d472 100644 --- a/libs/SDL2/src/video/vita/SDL_vitagl_pvr_c.h +++ b/libs/SDL2/src/video/vita/SDL_vitagl_pvr_c.h @@ -19,17 +19,16 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef SDL_vitagl_c_h_ -#define SDL_vitagl_c_h_ +#ifndef SDL_vitagl_pvr_c_h_ +#define SDL_vitagl_pvr_c_h_ #include "SDL_vitavideo.h" -extern int VITA_GL_MakeCurrent(_THIS,SDL_Window * window, SDL_GLContext context); -extern int VITA_GL_SwapWindow(_THIS, SDL_Window * window); extern SDL_GLContext VITA_GL_CreateContext(_THIS, SDL_Window * window); extern int VITA_GL_LoadLibrary(_THIS, const char *path); +extern void *VITA_GL_GetProcAddress(_THIS, const char *proc); -#endif /* SDL_vitagl_c_h_ */ +#endif /* SDL_vitagl_pvr_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/video/vita/SDL_vitagl.c b/libs/SDL2/src/video/vita/SDL_vitagles.c similarity index 91% rename from libs/SDL2/src/video/vita/SDL_vitagl.c rename to libs/SDL2/src/video/vita/SDL_vitagles.c index f6502286..18ca7d57 100644 --- a/libs/SDL2/src/video/vita/SDL_vitagl.c +++ b/libs/SDL2/src/video/vita/SDL_vitagles.c @@ -27,7 +27,7 @@ #include "SDL_error.h" #include "SDL_log.h" #include "SDL_vitavideo.h" -#include "SDL_vitagl_c.h" +#include "SDL_vitagles_c.h" /*****************************************************************************/ /* SDL OpenGL/OpenGL ES functions */ @@ -45,7 +45,7 @@ } while (0) void -VITA_GL_KeyboardCallback(ScePigletPreSwapData *data) +VITA_GLES_KeyboardCallback(ScePigletPreSwapData *data) { SceCommonDialogUpdateParam commonDialogParam; SDL_zero(commonDialogParam); @@ -62,20 +62,20 @@ VITA_GL_KeyboardCallback(ScePigletPreSwapData *data) } int -VITA_GL_LoadLibrary(_THIS, const char *path) +VITA_GLES_LoadLibrary(_THIS, const char *path) { pibInit(PIB_SHACCCG | PIB_GET_PROC_ADDR_CORE); return 0; } void * -VITA_GL_GetProcAddress(_THIS, const char *proc) +VITA_GLES_GetProcAddress(_THIS, const char *proc) { return eglGetProcAddress(proc); } void -VITA_GL_UnloadLibrary(_THIS) +VITA_GLES_UnloadLibrary(_THIS) { eglTerminate(_this->gl_data->display); } @@ -84,7 +84,7 @@ static EGLint width = 960; static EGLint height = 544; SDL_GLContext -VITA_GL_CreateContext(_THIS, SDL_Window * window) +VITA_GLES_CreateContext(_THIS, SDL_Window * window) { SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; @@ -159,13 +159,13 @@ VITA_GL_CreateContext(_THIS, SDL_Window * window) _this->gl_data->surface = surface; preSwapCallback = (PFNEGLPIGLETVITASETPRESWAPCALLBACKSCEPROC) eglGetProcAddress("eglPigletVitaSetPreSwapCallbackSCE"); - preSwapCallback(VITA_GL_KeyboardCallback); + preSwapCallback(VITA_GLES_KeyboardCallback); return context; } int -VITA_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) +VITA_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) { if (!eglMakeCurrent(_this->gl_data->display, _this->gl_data->surface, _this->gl_data->surface, _this->gl_data->context)) @@ -176,7 +176,7 @@ VITA_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) } int -VITA_GL_SetSwapInterval(_THIS, int interval) +VITA_GLES_SetSwapInterval(_THIS, int interval) { EGLBoolean status; status = eglSwapInterval(_this->gl_data->display, interval); @@ -190,13 +190,13 @@ VITA_GL_SetSwapInterval(_THIS, int interval) } int -VITA_GL_GetSwapInterval(_THIS) +VITA_GLES_GetSwapInterval(_THIS) { return _this->gl_data->swapinterval; } int -VITA_GL_SwapWindow(_THIS, SDL_Window * window) +VITA_GLES_SwapWindow(_THIS, SDL_Window * window) { if (!eglSwapBuffers(_this->gl_data->display, _this->gl_data->surface)) { return SDL_SetError("eglSwapBuffers() failed"); @@ -205,7 +205,7 @@ VITA_GL_SwapWindow(_THIS, SDL_Window * window) } void -VITA_GL_DeleteContext(_THIS, SDL_GLContext context) +VITA_GLES_DeleteContext(_THIS, SDL_GLContext context) { SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; EGLBoolean status; diff --git a/libs/SDL2/src/video/vita/SDL_vitagl_c.h b/libs/SDL2/src/video/vita/SDL_vitagles_c.h similarity index 67% rename from libs/SDL2/src/video/vita/SDL_vitagl_c.h rename to libs/SDL2/src/video/vita/SDL_vitagles_c.h index 272653d7..10fd8533 100644 --- a/libs/SDL2/src/video/vita/SDL_vitagl_c.h +++ b/libs/SDL2/src/video/vita/SDL_vitagles_c.h @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef SDL_vitagl_c_h_ -#define SDL_vitagl_c_h_ +#ifndef SDL_vitagles_c_h_ +#define SDL_vitagles_c_h_ #include @@ -39,19 +39,19 @@ typedef struct SDL_GLDriverData { uint32_t swapinterval; }SDL_GLDriverData; -extern void * VITA_GL_GetProcAddress(_THIS, const char *proc); -extern int VITA_GL_MakeCurrent(_THIS,SDL_Window * window, SDL_GLContext context); -extern void VITA_GL_SwapBuffers(_THIS); +extern void * VITA_GLES_GetProcAddress(_THIS, const char *proc); +extern int VITA_GLES_MakeCurrent(_THIS,SDL_Window * window, SDL_GLContext context); +extern void VITA_GLES_SwapBuffers(_THIS); -extern int VITA_GL_SwapWindow(_THIS, SDL_Window * window); -extern SDL_GLContext VITA_GL_CreateContext(_THIS, SDL_Window * window); +extern int VITA_GLES_SwapWindow(_THIS, SDL_Window * window); +extern SDL_GLContext VITA_GLES_CreateContext(_THIS, SDL_Window * window); -extern int VITA_GL_LoadLibrary(_THIS, const char *path); -extern void VITA_GL_UnloadLibrary(_THIS); -extern int VITA_GL_SetSwapInterval(_THIS, int interval); -extern int VITA_GL_GetSwapInterval(_THIS); +extern int VITA_GLES_LoadLibrary(_THIS, const char *path); +extern void VITA_GLES_UnloadLibrary(_THIS); +extern int VITA_GLES_SetSwapInterval(_THIS, int interval); +extern int VITA_GLES_GetSwapInterval(_THIS); -#endif /* SDL_vitagl_c_h_ */ +#endif /* SDL_vitagles_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/video/vita/SDL_vitagles_pvr.c b/libs/SDL2/src/video/vita/SDL_vitagles_pvr.c new file mode 100644 index 00000000..bb06d294 --- /dev/null +++ b/libs/SDL2/src/video/vita/SDL_vitagles_pvr.c @@ -0,0 +1,103 @@ +/* + 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_VITA && SDL_VIDEO_VITA_PVR +#include +#include +#include +#include + +#include "SDL_error.h" +#include "SDL_log.h" +#include "SDL_vitavideo.h" +#include "../SDL_egl_c.h" +#include "SDL_vitagles_pvr_c.h" + +#define MAX_PATH 256 // vita limits are somehow wrong + +int +VITA_GLES_LoadLibrary(_THIS, const char *path) +{ + PVRSRV_PSP2_APPHINT hint; + char* override = SDL_getenv("VITA_MODULE_PATH"); + char* skip_init = SDL_getenv("VITA_PVR_SKIP_INIT"); + char* default_path = "app0:module"; + char target_path[MAX_PATH]; + + if (skip_init == NULL) // we don't care about actual value + { + if (override != NULL) + { + default_path = override; + } + + sceKernelLoadStartModule("vs0:sys/external/libfios2.suprx", 0, NULL, 0, NULL, NULL); + sceKernelLoadStartModule("vs0:sys/external/libc.suprx", 0, NULL, 0, NULL, NULL); + + SDL_snprintf(target_path, MAX_PATH, "%s/%s", default_path, "libgpu_es4_ext.suprx"); + sceKernelLoadStartModule(target_path, 0, NULL, 0, NULL, NULL); + + SDL_snprintf(target_path, MAX_PATH, "%s/%s", default_path, "libIMGEGL.suprx"); + sceKernelLoadStartModule(target_path, 0, NULL, 0, NULL, NULL); + + PVRSRVInitializeAppHint(&hint); + + SDL_snprintf(hint.szGLES1, MAX_PATH, "%s/%s", default_path, "libGLESv1_CM.suprx"); + SDL_snprintf(hint.szGLES2, MAX_PATH, "%s/%s", default_path, "libGLESv2.suprx"); + SDL_snprintf(hint.szWindowSystem, MAX_PATH, "%s/%s", default_path, "libpvrPSP2_WSEGL.suprx"); + + PVRSRVCreateVirtualAppHint(&hint); + } + + return SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) 0, 0); +} + +SDL_GLContext +VITA_GLES_CreateContext(_THIS, SDL_Window * window) +{ + return SDL_EGL_CreateContext(_this, ((SDL_WindowData *) window->driverdata)->egl_surface); +} + +int +VITA_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) +{ + if (window && context) { + return SDL_EGL_MakeCurrent(_this, ((SDL_WindowData *) window->driverdata)->egl_surface, context); + } else { + return SDL_EGL_MakeCurrent(_this, NULL, NULL); + } +} + +int +VITA_GLES_SwapWindow(_THIS, SDL_Window * window) +{ + SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata; + if (videodata->ime_active) { + sceImeUpdate(); + } + return SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface); +} + + +#endif /* SDL_VIDEO_DRIVER_VITA && SDL_VIDEO_VITA_PVR */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/video/vita/SDL_vitagles_pvr_c.h b/libs/SDL2/src/video/vita/SDL_vitagles_pvr_c.h new file mode 100644 index 00000000..c3a13c43 --- /dev/null +++ b/libs/SDL2/src/video/vita/SDL_vitagles_pvr_c.h @@ -0,0 +1,35 @@ +/* + 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_vitagles_pvr_c_h_ +#define SDL_vitagles_pvr_c_h_ + +#include "SDL_vitavideo.h" + +extern int VITA_GLES_MakeCurrent(_THIS,SDL_Window * window, SDL_GLContext context); +extern int VITA_GLES_SwapWindow(_THIS, SDL_Window * window); +extern SDL_GLContext VITA_GLES_CreateContext(_THIS, SDL_Window * window); +extern int VITA_GLES_LoadLibrary(_THIS, const char *path); + + +#endif /* SDL_vitagles_pvr_c_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/video/vita/SDL_vitatouch.c b/libs/SDL2/src/video/vita/SDL_vitatouch.c index f28c880b..43a3ecbd 100644 --- a/libs/SDL2/src/video/vita/SDL_vitatouch.c +++ b/libs/SDL2/src/video/vita/SDL_vitatouch.c @@ -108,17 +108,30 @@ VITA_PollTouch(void) float x = 0; float y = 0; float force = (touch[port].report[i].force - force_info[port].min) / force_info[port].range; + int finger_down = 0; + + if (touch_old[port].reportNum > 0) { + for (int j = 0; j < touch_old[port].reportNum; j++) { + if (touch[port].report[i].id == touch_old[port].report[j].id ) { + finger_down = 1; + } + } + } + VITA_ConvertTouchXYToSDLXY(&x, &y, touch[port].report[i].x, touch[port].report[i].y, port); finger_id = (SDL_FingerID) touch[port].report[i].id; - // Send an initial touch - SDL_SendTouch((SDL_TouchID)port, - finger_id, - Vita_Window, - SDL_TRUE, - x, - y, - force); + // Skip if finger was already previously down + if(!finger_down) { + // Send an initial touch + SDL_SendTouch((SDL_TouchID)port, + finger_id, + Vita_Window, + SDL_TRUE, + x, + y, + force); + } // Always send the motion SDL_SendTouchMotion((SDL_TouchID)port, diff --git a/libs/SDL2/src/video/vita/SDL_vitavideo.c b/libs/SDL2/src/video/vita/SDL_vitavideo.c index ad9e559a..33758d69 100644 --- a/libs/SDL2/src/video/vita/SDL_vitavideo.c +++ b/libs/SDL2/src/video/vita/SDL_vitavideo.c @@ -41,15 +41,17 @@ #include "SDL_vitaframebuffer.h" #if defined(SDL_VIDEO_VITA_PIB) - #include "SDL_vitagl_c.h" + #include "SDL_vitagles_c.h" #elif defined(SDL_VIDEO_VITA_PVR) + #include "SDL_vitagles_pvr_c.h" +#if defined(SDL_VIDEO_VITA_PVR_OGL) #include "SDL_vitagl_pvr_c.h" - #include "../SDL_egl_c.h" - #define VITA_GL_GetProcAddress SDL_EGL_GetProcAddress - #define VITA_GL_UnloadLibrary SDL_EGL_UnloadLibrary - #define VITA_GL_SetSwapInterval SDL_EGL_SetSwapInterval - #define VITA_GL_GetSwapInterval SDL_EGL_GetSwapInterval - #define VITA_GL_DeleteContext SDL_EGL_DeleteContext +#endif + #define VITA_GLES_GetProcAddress SDL_EGL_GetProcAddress + #define VITA_GLES_UnloadLibrary SDL_EGL_UnloadLibrary + #define VITA_GLES_SetSwapInterval SDL_EGL_SetSwapInterval + #define VITA_GLES_GetSwapInterval SDL_EGL_GetSwapInterval + #define VITA_GLES_DeleteContext SDL_EGL_DeleteContext #endif SDL_Window *Vita_Window; @@ -140,15 +142,26 @@ VITA_Create() */ #if defined(SDL_VIDEO_VITA_PIB) || defined(SDL_VIDEO_VITA_PVR) +#if defined(SDL_VIDEO_VITA_PVR_OGL) +if(SDL_getenv("VITA_PVR_OGL") != NULL) { device->GL_LoadLibrary = VITA_GL_LoadLibrary; - device->GL_GetProcAddress = VITA_GL_GetProcAddress; - device->GL_UnloadLibrary = VITA_GL_UnloadLibrary; device->GL_CreateContext = VITA_GL_CreateContext; - device->GL_MakeCurrent = VITA_GL_MakeCurrent; - device->GL_SetSwapInterval = VITA_GL_SetSwapInterval; - device->GL_GetSwapInterval = VITA_GL_GetSwapInterval; - device->GL_SwapWindow = VITA_GL_SwapWindow; - device->GL_DeleteContext = VITA_GL_DeleteContext; + device->GL_GetProcAddress = VITA_GL_GetProcAddress; +} else { +#endif + device->GL_LoadLibrary = VITA_GLES_LoadLibrary; + device->GL_CreateContext = VITA_GLES_CreateContext; + device->GL_GetProcAddress = VITA_GLES_GetProcAddress; +#if defined(SDL_VIDEO_VITA_PVR_OGL) +} +#endif + + device->GL_UnloadLibrary = VITA_GLES_UnloadLibrary; + device->GL_MakeCurrent = VITA_GLES_MakeCurrent; + device->GL_SetSwapInterval = VITA_GLES_SetSwapInterval; + device->GL_GetSwapInterval = VITA_GLES_GetSwapInterval; + device->GL_SwapWindow = VITA_GLES_SwapWindow; + device->GL_DeleteContext = VITA_GLES_DeleteContext; #endif device->HasScreenKeyboardSupport = VITA_HasScreenKeyboardSupport; @@ -245,6 +258,9 @@ VITA_CreateWindow(_THIS, SDL_Window * window) SDL_WindowData *wdata; #if defined(SDL_VIDEO_VITA_PVR) Psp2NativeWindow win; + int temp_major = 2; + int temp_minor = 1; + int temp_profile = 0; #endif /* Allocate window internal data */ @@ -259,8 +275,7 @@ VITA_CreateWindow(_THIS, SDL_Window * window) // Vita can only have one window if (Vita_Window != NULL) { - SDL_SetError("Only one window supported"); - return -1; + return SDL_SetError("Only one window supported"); } Vita_Window = window; @@ -283,11 +298,26 @@ VITA_CreateWindow(_THIS, SDL_Window * window) win.windowSize = PSP2_WINDOW_960X544; } if ((window->flags & SDL_WINDOW_OPENGL) != 0) { - wdata->egl_surface = SDL_EGL_CreateSurface(_this, &win); + if(SDL_getenv("VITA_PVR_OGL") != NULL) { + /* Set version to 2.1 and PROFILE to ES */ + temp_major = _this->gl_config.major_version; + temp_minor = _this->gl_config.minor_version; + temp_profile = _this->gl_config.profile_mask; + _this->gl_config.major_version = 2; + _this->gl_config.minor_version = 1; + _this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES; + } + wdata->egl_surface = SDL_EGL_CreateSurface(_this, &win); if (wdata->egl_surface == EGL_NO_SURFACE) { return SDL_SetError("Could not create GLES window surface"); } + if(SDL_getenv("VITA_PVR_OGL") != NULL) { + /* Revert */ + _this->gl_config.major_version = temp_major; + _this->gl_config.minor_version = temp_minor; + _this->gl_config.profile_mask = temp_profile; + } } #endif @@ -374,8 +404,8 @@ VITA_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) 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 --git a/libs/SDL2/src/video/vita/SDL_vitavideo.h b/libs/SDL2/src/video/vita/SDL_vitavideo.h index 04488dde..9fdf7e69 100644 --- a/libs/SDL2/src/video/vita/SDL_vitavideo.h +++ b/libs/SDL2/src/video/vita/SDL_vitavideo.h @@ -90,16 +90,23 @@ SDL_bool VITA_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info); #if SDL_VIDEO_DRIVER_VITA +#if defined(SDL_VIDEO_VITA_PVR_OGL) /* OpenGL functions */ int VITA_GL_LoadLibrary(_THIS, const char *path); -void *VITA_GL_GetProcAddress(_THIS, const char *proc); -void VITA_GL_UnloadLibrary(_THIS); SDL_GLContext VITA_GL_CreateContext(_THIS, SDL_Window * window); -int VITA_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); -int VITA_GL_SetSwapInterval(_THIS, int interval); -int VITA_GL_GetSwapInterval(_THIS); -int VITA_GL_SwapWindow(_THIS, SDL_Window * window); -void VITA_GL_DeleteContext(_THIS, SDL_GLContext context); +void *VITA_GL_GetProcAddress(_THIS, const char *proc); +#endif + +/* OpenGLES functions */ +int VITA_GLES_LoadLibrary(_THIS, const char *path); +void *VITA_GLES_GetProcAddress(_THIS, const char *proc); +void VITA_GLES_UnloadLibrary(_THIS); +SDL_GLContext VITA_GLES_CreateContext(_THIS, SDL_Window * window); +int VITA_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); +int VITA_GLES_SetSwapInterval(_THIS, int interval); +int VITA_GLES_GetSwapInterval(_THIS); +int VITA_GLES_SwapWindow(_THIS, SDL_Window * window); +void VITA_GLES_DeleteContext(_THIS, SDL_GLContext context); #endif /* VITA on screen keyboard */ diff --git a/libs/SDL2/src/video/vivante/SDL_vivantevideo.c b/libs/SDL2/src/video/vivante/SDL_vivantevideo.c index de2fdbfd..3b18b7db 100644 --- a/libs/SDL2/src/video/vivante/SDL_vivantevideo.c +++ b/libs/SDL2/src/video/vivante/SDL_vivantevideo.c @@ -382,15 +382,14 @@ VIVANTE_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) 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 --git a/libs/SDL2/src/video/wayland/SDL_waylanddyn.h b/libs/SDL2/src/video/wayland/SDL_waylanddyn.h index c867ec00..43a3372d 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylanddyn.h +++ b/libs/SDL2/src/video/wayland/SDL_waylanddyn.h @@ -52,6 +52,14 @@ enum libdecor_window_state; #include "xkbcommon/xkbcommon.h" #include "xkbcommon/xkbcommon-compose.h" +/* Must be included before our #defines, see Bugzilla #4957 */ +#include "wayland-client-core.h" + +#define SDL_WAYLAND_CHECK_VERSION(x, y, z) \ + (WAYLAND_VERSION_MAJOR > x || \ + (WAYLAND_VERSION_MAJOR == x && WAYLAND_VERSION_MINOR > y) || \ + (WAYLAND_VERSION_MAJOR == x && WAYLAND_VERSION_MINOR == y && WAYLAND_VERSION_MICRO >= z)) + #ifdef __cplusplus extern "C" { @@ -71,9 +79,6 @@ void SDL_WAYLAND_UnloadSymbols(void); } #endif -/* Must be included before our #defines, see Bugzilla #4957 */ -#include "wayland-client-core.h" - #ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC #if defined(_WAYLAND_CLIENT_H) || defined(WAYLAND_CLIENT_H) @@ -148,6 +153,7 @@ void SDL_WAYLAND_UnloadSymbols(void); #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 --git a/libs/SDL2/src/video/wayland/SDL_waylandevents.c b/libs/SDL2/src/video/wayland/SDL_waylandevents.c index bf2aeea5..08a7e1a3 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandevents.c +++ b/libs/SDL2/src/video/wayland/SDL_waylandevents.c @@ -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" @@ -40,6 +41,7 @@ #include "xdg-shell-client-protocol.h" #include "keyboard-shortcuts-inhibit-unstable-v1-client-protocol.h" #include "text-input-unstable-v3-client-protocol.h" +#include "tablet-unstable-v2-client-protocol.h" #ifdef HAVE_LIBDECOR_H #include @@ -83,6 +85,7 @@ static const struct { { XKB_KEY_Super_R, SDLK_RGUI }, { XKB_KEY_Hyper_L, SDLK_LGUI }, { XKB_KEY_Hyper_R, SDLK_RGUI }, + { XKB_KEY_BackSpace, SDLK_BACKSPACE }, }; struct SDL_WaylandTouchPoint { @@ -292,6 +295,12 @@ Wayland_WaitEventTimeout(_THIS, int timeout) } } +#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) { @@ -387,8 +396,10 @@ pointer_handle_motion(void *data, struct wl_pointer *pointer, input->sx_w = sx_w; input->sy_w = sy_w; if (input->pointer_focus) { - const int sx = wl_fixed_to_int(sx_w); - const int sy = wl_fixed_to_int(sy_w); + const float sx_f = (float)wl_fixed_to_double(sx_w); + const float sy_f = (float)wl_fixed_to_double(sy_w); + const int sx = (int)SDL_floorf(sx_f * window->pointer_scale_x); + const int sy = (int)SDL_floorf(sy_f * window->pointer_scale_y); SDL_SendMouseMotion(window->sdlwindow, 0, 0, sx, sy); } } @@ -468,20 +479,24 @@ ProcessHitTest(struct SDL_WaylandInput *input, uint32_t serial) }; #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 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, @@ -499,13 +514,13 @@ ProcessHitTest(struct SDL_WaylandInput *input, uint32_t serial) 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, @@ -715,8 +730,8 @@ touch_handler_down(void *data, struct wl_touch *touch, unsigned int serial, int id, wl_fixed_t fx, wl_fixed_t fy) { SDL_WindowData *window_data = (SDL_WindowData *)wl_surface_get_user_data(surface); - const double dblx = wl_fixed_to_double(fx); - const double dbly = wl_fixed_to_double(fy); + const double dblx = wl_fixed_to_double(fx) * window_data->pointer_scale_x; + const double dbly = wl_fixed_to_double(fy) * window_data->pointer_scale_y; const float x = dblx / window_data->sdlwindow->w; const float y = dbly / window_data->sdlwindow->h; @@ -748,8 +763,8 @@ touch_handler_motion(void *data, struct wl_touch *touch, unsigned int timestamp, int id, wl_fixed_t fx, wl_fixed_t fy) { SDL_WindowData *window_data = (SDL_WindowData *)wl_surface_get_user_data(touch_surface(id)); - const double dblx = wl_fixed_to_double(fx); - const double dbly = wl_fixed_to_double(fy); + const double dblx = wl_fixed_to_double(fx) * window_data->pointer_scale_x; + const double dbly = wl_fixed_to_double(fy) * window_data->pointer_scale_y; const float x = dblx / window_data->sdlwindow->w; const float y = dbly / window_data->sdlwindow->h; @@ -815,6 +830,16 @@ keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, return; } + #define GET_MOD_INDEX(mod) \ + WAYLAND_xkb_keymap_mod_get_index(input->xkb.keymap, XKB_MOD_NAME_##mod) + input->xkb.idx_shift = 1 << GET_MOD_INDEX(SHIFT); + input->xkb.idx_ctrl = 1 << GET_MOD_INDEX(CTRL); + input->xkb.idx_alt = 1 << GET_MOD_INDEX(ALT); + input->xkb.idx_gui = 1 << GET_MOD_INDEX(LOGO); + input->xkb.idx_num = 1 << GET_MOD_INDEX(NUM); + input->xkb.idx_caps = 1 << GET_MOD_INDEX(CAPS); + #undef GET_MOD_INDEX + input->xkb.state = WAYLAND_xkb_state_new(input->xkb.keymap); if (!input->xkb.state) { fprintf(stderr, "failed to create XKB state\n"); @@ -829,10 +854,14 @@ keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, */ /* Look up the preferred locale, falling back to "C" as default */ - if (!(locale = SDL_getenv("LC_ALL"))) - if (!(locale = SDL_getenv("LC_CTYPE"))) - if (!(locale = SDL_getenv("LANG"))) + if (!(locale = SDL_getenv("LC_ALL"))) { + if (!(locale = SDL_getenv("LC_CTYPE"))) { + if (!(locale = SDL_getenv("LANG"))) { locale = "C"; + } + } + } + /* Set up XKB compose table */ input->xkb.compose_table = WAYLAND_xkb_compose_table_new_from_locale(input->display->xkb_context, locale, XKB_COMPOSE_COMPILE_NO_FLAGS); @@ -903,7 +932,7 @@ keyboard_handle_leave(void *data, struct wl_keyboard *keyboard, } static SDL_bool -keyboard_input_get_text(char text[8], const struct SDL_WaylandInput *input, uint32_t key, SDL_bool *handled_by_ime) +keyboard_input_get_text(char text[8], const struct SDL_WaylandInput *input, uint32_t key, Uint8 state, SDL_bool *handled_by_ime) { SDL_WindowData *window = input->keyboard_focus; const xkb_keysym_t *syms; @@ -920,12 +949,16 @@ keyboard_input_get_text(char text[8], const struct SDL_WaylandInput *input, uint sym = syms[0]; #ifdef SDL_USE_IME - if (SDL_IME_ProcessKeyEvent(sym, key + 8)) { + if (SDL_IME_ProcessKeyEvent(sym, key + 8, state)) { *handled_by_ime = SDL_TRUE; return SDL_TRUE; } #endif + if (state == SDL_RELEASED) { + return SDL_FALSE; + } + if (input->xkb.compose_state && WAYLAND_xkb_compose_state_feed(input->xkb.compose_state, sym) == XKB_COMPOSE_FEED_ACCEPTED) { switch(WAYLAND_xkb_compose_state_get_status(input->xkb.compose_state)) { case XKB_COMPOSE_COMPOSING: @@ -959,7 +992,7 @@ keyboard_handle_key(void *data, struct wl_keyboard *keyboard, SDL_bool handled_by_ime = SDL_FALSE; if (state == WL_KEYBOARD_KEY_STATE_PRESSED) { - has_text = keyboard_input_get_text(text, input, key, &handled_by_ime); + has_text = keyboard_input_get_text(text, input, key, SDL_PRESSED, &handled_by_ime); } else { if (keyboard_repeat_is_set(&input->keyboard_repeat)) { // Send any due key repeat events before stopping the repeat and generating the key up event @@ -969,6 +1002,7 @@ keyboard_handle_key(void *data, struct wl_keyboard *keyboard, keyboard_repeat_handle(&input->keyboard_repeat, time - input->keyboard_repeat.wl_press_time); keyboard_repeat_clear(&input->keyboard_repeat); } + keyboard_input_get_text(text, input, key, SDL_RELEASED, &handled_by_ime); } if (!handled_by_ime && key < SDL_arraysize(xfree86_scancode_table2)) { @@ -987,7 +1021,9 @@ keyboard_handle_key(void *data, struct wl_keyboard *keyboard, SDL_SendKeyboardText(text); } } - keyboard_repeat_set(&input->keyboard_repeat, time, scancode, has_text, text); + if (input->xkb.keymap && WAYLAND_xkb_keymap_key_repeats(input->xkb.keymap, key + 8)) { + keyboard_repeat_set(&input->keyboard_repeat, time, scancode, has_text, text); + } } } @@ -1052,10 +1088,24 @@ keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard, { struct SDL_WaylandInput *input = data; Wayland_Keymap keymap; + uint32_t modstate = (mods_depressed | mods_latched | mods_locked); WAYLAND_xkb_state_update_mask(input->xkb.state, mods_depressed, mods_latched, mods_locked, 0, 0, group); + SDL_ToggleModState(KMOD_SHIFT, modstate & input->xkb.idx_shift); + SDL_ToggleModState(KMOD_CTRL, modstate & input->xkb.idx_ctrl); + SDL_ToggleModState(KMOD_ALT, modstate & input->xkb.idx_alt); + SDL_ToggleModState(KMOD_GUI, modstate & input->xkb.idx_gui); + SDL_ToggleModState(KMOD_NUM, modstate & input->xkb.idx_num); + SDL_ToggleModState(KMOD_CAPS, modstate & input->xkb.idx_caps); + + if (group == input->xkb.current_group) { + return; + } + + /* The layout changed, remap and fire an event */ + input->xkb.current_group = group; keymap.layout = group; SDL_GetDefaultKeymap(keymap.keymap); WAYLAND_xkb_keymap_key_for_each(input->xkb.keymap, @@ -1505,20 +1555,37 @@ text_input_preedit_string(void *data, int32_t cursor_begin, int32_t cursor_end) { + SDL_WaylandTextInput *text_input = data; 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); @@ -1557,7 +1624,11 @@ text_input_done(void *data, struct zwp_text_input_v3 *zwp_text_input_v3, uint32_t serial) { - /* No-op */ + SDL_WaylandTextInput *text_input = data; + if (!text_input->has_preedit) { + SDL_SendEditingText("", 0, 0); + } + text_input->has_preedit = SDL_FALSE; } static const struct zwp_text_input_v3_listener text_input_listener = { @@ -1638,6 +1709,363 @@ Wayland_add_text_input_manager(SDL_VideoData *d, uint32_t id, uint32_t version) } } +static void +tablet_tool_handle_type(void* data, struct zwp_tablet_tool_v2* tool, uint32_t type) +{ + /* unimplemented */ +} + +static void +tablet_tool_handle_hardware_serial(void* data, struct zwp_tablet_tool_v2* tool, uint32_t serial_hi, uint32_t serial_lo) +{ + /* unimplemented */ +} + +static void +tablet_tool_handle_hardware_id_wacom(void* data, struct zwp_tablet_tool_v2* tool, uint32_t id_hi, uint32_t id_lo) +{ + /* unimplemented */ +} + +static void +tablet_tool_handle_capability(void* data, struct zwp_tablet_tool_v2* tool, uint32_t capability) +{ + /* unimplemented */ +} + +static void +tablet_tool_handle_done(void* data, struct zwp_tablet_tool_v2* tool) +{ + /* unimplemented */ +} + +static void +tablet_tool_handle_removed(void* data, struct zwp_tablet_tool_v2* tool) +{ + /* unimplemented */ +} + +static void +tablet_tool_handle_proximity_in(void* data, struct zwp_tablet_tool_v2* tool, uint32_t serial, struct zwp_tablet_v2* tablet, struct wl_surface* surface) +{ + struct SDL_WaylandTabletInput* input = data; + SDL_WindowData* window; + + if (!surface) { + return; + } + + if (!SDL_WAYLAND_own_surface(surface)) { + return; + } + + window = (SDL_WindowData*)wl_surface_get_user_data(surface); + + if (window) { + input->tool_focus = window; + input->tool_prox_serial = serial; + + input->is_down = SDL_FALSE; + + input->btn_stylus = SDL_FALSE; + input->btn_stylus2 = SDL_FALSE; + input->btn_stylus3 = SDL_FALSE; + + SDL_SetMouseFocus(window->sdlwindow); + SDL_SetCursor(NULL); + } +} + +static void +tablet_tool_handle_proximity_out(void* data, struct zwp_tablet_tool_v2* tool) +{ + struct SDL_WaylandTabletInput* input = data; + + if (input->tool_focus) { + SDL_SetMouseFocus(NULL); + input->tool_focus = NULL; + } +} + +uint32_t +tablet_tool_btn_to_sdl_button(struct SDL_WaylandTabletInput* input) +{ + unsigned int tool_btn = input->btn_stylus3 << 2 | input->btn_stylus2 << 1 | input->btn_stylus << 0; + switch (tool_btn) { + case 0b000: + return SDL_BUTTON_LEFT; + case 0b001: + return SDL_BUTTON_RIGHT; + case 0b010: + return SDL_BUTTON_MIDDLE; + case 0b100: + return SDL_BUTTON_X1; + default: + return SDL_BUTTON_LEFT; + } +} + +static void +tablet_tool_handle_down(void* data, struct zwp_tablet_tool_v2* tool, uint32_t serial) +{ + struct SDL_WaylandTabletInput* input = data; + SDL_WindowData* window = input->tool_focus; + input->is_down = SDL_TRUE; + if (!window) { + /* tablet_tool_handle_proximity_out gets called when moving over the libdecoration csd. + * that sets input->tool_focus (window) to NULL, but handle_{down,up} events are still + * received. To prevent SIGSEGV this returns when this is the case. + */ + return; + } + + SDL_SendMouseButton(window->sdlwindow, 0, SDL_PRESSED, tablet_tool_btn_to_sdl_button(input)); +} + +static void +tablet_tool_handle_up(void* data, struct zwp_tablet_tool_v2* tool) +{ + struct SDL_WaylandTabletInput* input = data; + SDL_WindowData* window = input->tool_focus; + + input->is_down = SDL_FALSE; + + if (!window) { + /* tablet_tool_handle_proximity_out gets called when moving over the libdecoration csd. + * that sets input->tool_focus (window) to NULL, but handle_{down,up} events are still + * received. To prevent SIGSEGV this returns when this is the case. + */ + return; + } + + SDL_SendMouseButton(window->sdlwindow, 0, SDL_RELEASED, tablet_tool_btn_to_sdl_button(input)); +} + +static void +tablet_tool_handle_motion(void* data, struct zwp_tablet_tool_v2* tool, wl_fixed_t sx_w, wl_fixed_t sy_w) +{ + struct SDL_WaylandTabletInput* input = data; + SDL_WindowData* window = input->tool_focus; + + input->sx_w = sx_w; + input->sy_w = sy_w; + if (input->tool_focus) { + const float sx_f = (float)wl_fixed_to_double(sx_w); + const float sy_f = (float)wl_fixed_to_double(sy_w); + const int sx = (int)SDL_floorf(sx_f * window->pointer_scale_x); + const int sy = (int)SDL_floorf(sy_f * window->pointer_scale_y); + SDL_SendMouseMotion(window->sdlwindow, 0, 0, sx, sy); + } +} + +static void +tablet_tool_handle_pressure(void* data, struct zwp_tablet_tool_v2* tool, uint32_t pressure) +{ + /* unimplemented */ +} + +static void +tablet_tool_handle_distance(void* data, struct zwp_tablet_tool_v2* tool, uint32_t distance) +{ + /* unimplemented */ +} + +static void +tablet_tool_handle_tilt(void* data, struct zwp_tablet_tool_v2* tool, wl_fixed_t xtilt, wl_fixed_t ytilt) +{ + /* unimplemented */ +} + +static void +tablet_tool_handle_button(void* data, struct zwp_tablet_tool_v2* tool, uint32_t serial, uint32_t button, uint32_t state) +{ + struct SDL_WaylandTabletInput* input = data; + + if (input->is_down) { + tablet_tool_handle_up(data, tool); + input->is_down = SDL_TRUE; + } + + switch (button) { + /* see %{_includedir}/linux/input-event-codes.h */ + case 0x14b: /* BTN_STYLUS */ + input->btn_stylus = state == ZWP_TABLET_PAD_V2_BUTTON_STATE_PRESSED ? SDL_TRUE : SDL_FALSE; + break; + case 0x14c: /* BTN_STYLUS2 */ + input->btn_stylus2 = state == ZWP_TABLET_PAD_V2_BUTTON_STATE_PRESSED ? SDL_TRUE : SDL_FALSE; + break; + case 0x149: /* BTN_STYLUS3 */ + input->btn_stylus3 = state == ZWP_TABLET_PAD_V2_BUTTON_STATE_PRESSED ? SDL_TRUE : SDL_FALSE; + break; + } + + if (input->is_down) { + tablet_tool_handle_down(data, tool, serial); + } +} + +static void +tablet_tool_handle_rotation(void* data, struct zwp_tablet_tool_v2* tool, wl_fixed_t degrees) +{ + /* unimplemented */ +} + +static void +tablet_tool_handle_slider(void* data, struct zwp_tablet_tool_v2* tool, int32_t position) +{ + /* unimplemented */ +} + +static void +tablet_tool_handle_wheel(void* data, struct zwp_tablet_tool_v2* tool, int32_t degrees, int32_t clicks) +{ + /* unimplemented */ +} + +static void +tablet_tool_handle_frame(void* data, struct zwp_tablet_tool_v2* tool, uint32_t time) +{ + /* unimplemented */ +} + + +static const struct zwp_tablet_tool_v2_listener tablet_tool_listener = { + tablet_tool_handle_type, + tablet_tool_handle_hardware_serial, + tablet_tool_handle_hardware_id_wacom, + tablet_tool_handle_capability, + tablet_tool_handle_done, + tablet_tool_handle_removed, + tablet_tool_handle_proximity_in, + tablet_tool_handle_proximity_out, + tablet_tool_handle_down, + tablet_tool_handle_up, + tablet_tool_handle_motion, + tablet_tool_handle_pressure, + tablet_tool_handle_distance, + tablet_tool_handle_tilt, + tablet_tool_handle_rotation, + tablet_tool_handle_slider, + tablet_tool_handle_wheel, + tablet_tool_handle_button, + tablet_tool_handle_frame +}; + +struct SDL_WaylandTabletObjectListNode* +tablet_object_list_new_node(void* object) +{ + struct SDL_WaylandTabletObjectListNode* node; + + node = SDL_calloc(1, sizeof *node); + if (node == NULL) { + return NULL; + } + + node->next = NULL; + node->object = object; + + return node; +} + +void tablet_object_list_append(struct SDL_WaylandTabletObjectListNode* head, void* object) +{ + if (head->object == NULL) { + head->object = object; + return; + } + + while (head->next) { + head = head->next; + } + + head->next = tablet_object_list_new_node(object); +} + +void tablet_object_list_destroy(struct SDL_WaylandTabletObjectListNode* head, void (*deleter)(void* object)) +{ + while (head) { + struct SDL_WaylandTabletObjectListNode* next = head->next; + if (head->object) { + (*deleter)(head->object); + } + SDL_free(head); + head = next; + } +} + + +static void +tablet_seat_handle_tablet_added(void* data, struct zwp_tablet_seat_v2* seat, struct zwp_tablet_v2* tablet) +{ + struct SDL_WaylandTabletInput* input = data; + + tablet_object_list_append(input->tablets, tablet); +} + +static void +tablet_seat_handle_tool_added(void* data, struct zwp_tablet_seat_v2* seat, struct zwp_tablet_tool_v2* tool) +{ + struct SDL_WaylandTabletInput* input = data; + + zwp_tablet_tool_v2_add_listener(tool, &tablet_tool_listener, data); + zwp_tablet_tool_v2_set_user_data(tool, data); + + tablet_object_list_append(input->tools, tool); +} + +static void +tablet_seat_handle_pad_added(void* data, struct zwp_tablet_seat_v2* seat, struct zwp_tablet_pad_v2* pad) +{ + struct SDL_WaylandTabletInput* input = data; + + tablet_object_list_append(input->pads, pad); +} + +static const struct zwp_tablet_seat_v2_listener tablet_seat_listener = { + tablet_seat_handle_tablet_added, + tablet_seat_handle_tool_added, + tablet_seat_handle_pad_added +}; + +void +Wayland_input_add_tablet(struct SDL_WaylandInput *input, struct SDL_WaylandTabletManager* tablet_manager) +{ + struct SDL_WaylandTabletInput* tablet_input; + + if (!tablet_manager || !input || !input->seat) { + return; + } + + tablet_input = SDL_calloc(1, sizeof *tablet_input); + if (tablet_input == NULL) { + return; + } + + input->tablet = tablet_input; + + tablet_input->seat = (struct SDL_WaylandTabletSeat*)zwp_tablet_manager_v2_get_tablet_seat((struct zwp_tablet_manager_v2*)tablet_manager, input->seat); + + tablet_input->tablets = tablet_object_list_new_node(NULL); + tablet_input->tools = tablet_object_list_new_node(NULL); + tablet_input->pads = tablet_object_list_new_node(NULL); + + zwp_tablet_seat_v2_add_listener((struct zwp_tablet_seat_v2*)tablet_input->seat, &tablet_seat_listener, tablet_input); +} + +#define TABLET_OBJECT_LIST_DELETER(fun) (void (*)(void*))fun +void +Wayland_input_destroy_tablet(struct SDL_WaylandInput* input) +{ + tablet_object_list_destroy(input->tablet->pads, TABLET_OBJECT_LIST_DELETER(zwp_tablet_pad_v2_destroy)); + tablet_object_list_destroy(input->tablet->tools, TABLET_OBJECT_LIST_DELETER(zwp_tablet_tool_v2_destroy)); + tablet_object_list_destroy(input->tablet->tablets, TABLET_OBJECT_LIST_DELETER(zwp_tablet_v2_destroy)); + + zwp_tablet_seat_v2_destroy((struct zwp_tablet_seat_v2*)input->tablet->seat); + + SDL_free(input->tablet); + input->tablet = NULL; +} + void Wayland_display_add_input(SDL_VideoData *d, uint32_t id, uint32_t version) { @@ -1651,6 +2079,7 @@ Wayland_display_add_input(SDL_VideoData *d, uint32_t id, uint32_t version) input->seat = wl_registry_bind(d->registry, id, &wl_seat_interface, SDL_min(5, version)); input->sx_w = wl_fixed_from_int(0); input->sy_w = wl_fixed_from_int(0); + input->xkb.current_group = ~0; d->input = input; if (d->data_device_manager != NULL) { @@ -1663,6 +2092,10 @@ Wayland_display_add_input(SDL_VideoData *d, uint32_t id, uint32_t version) wl_seat_add_listener(input->seat, &seat_listener, input); wl_seat_set_user_data(input->seat, input); + if (d->tablet_manager) { + Wayland_input_add_tablet(input, d->tablet_manager); + } + WAYLAND_wl_display_flush(d->display); } @@ -1703,6 +2136,10 @@ void Wayland_display_destroy_input(SDL_VideoData *d) wl_touch_destroy(input->touch); } + if (input->tablet) { + Wayland_input_destroy_tablet(input); + } + if (input->seat) wl_seat_destroy(input->seat); @@ -1943,12 +2380,19 @@ int Wayland_input_confine_pointer(struct SDL_WaylandInput *input, SDL_Window *wi if (SDL_RectEmpty(&window->mouse_rect)) { confine_rect = NULL; } else { + SDL_Rect scaled_mouse_rect; + + scaled_mouse_rect.x = (int)SDL_floorf((float)window->mouse_rect.x / w->pointer_scale_x); + scaled_mouse_rect.y = (int)SDL_floorf((float)window->mouse_rect.y / w->pointer_scale_y); + scaled_mouse_rect.w = (int)SDL_ceilf((float)window->mouse_rect.w / w->pointer_scale_x); + scaled_mouse_rect.h = (int)SDL_ceilf((float)window->mouse_rect.h / w->pointer_scale_y); + confine_rect = wl_compositor_create_region(d->compositor); wl_region_add(confine_rect, - window->mouse_rect.x, - window->mouse_rect.y, - window->mouse_rect.w, - window->mouse_rect.h); + scaled_mouse_rect.x, + scaled_mouse_rect.y, + scaled_mouse_rect.w, + scaled_mouse_rect.h); } confined_pointer = diff --git a/libs/SDL2/src/video/wayland/SDL_waylandevents_c.h b/libs/SDL2/src/video/wayland/SDL_waylandevents_c.h index 24256a7d..59dc0c8a 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandevents_c.h +++ b/libs/SDL2/src/video/wayland/SDL_waylandevents_c.h @@ -29,6 +29,34 @@ #include "SDL_waylanddatamanager.h" #include "SDL_waylandkeyboard.h" +struct SDL_WaylandTabletSeat; + +struct SDL_WaylandTabletObjectListNode { + void* object; + struct SDL_WaylandTabletObjectListNode* next; +}; + +struct SDL_WaylandTabletInput { + struct SDL_WaylandTabletSeat* seat; + + struct SDL_WaylandTabletObjectListNode* tablets; + struct SDL_WaylandTabletObjectListNode* tools; + struct SDL_WaylandTabletObjectListNode* pads; + + SDL_WindowData *tool_focus; + uint32_t tool_prox_serial; + + /* Last motion location */ + wl_fixed_t sx_w; + wl_fixed_t sy_w; + + SDL_bool is_down; + + SDL_bool btn_stylus; + SDL_bool btn_stylus2; + SDL_bool btn_stylus3; +}; + typedef struct { // repeat_rate in range of [1, 1000] int32_t repeat_rate; @@ -68,6 +96,17 @@ struct SDL_WaylandInput { struct xkb_state *state; struct xkb_compose_table *compose_table; struct xkb_compose_state *compose_state; + + /* Keyboard layout "group" */ + uint32_t current_group; + + /* Modifier bitshift values */ + uint32_t idx_shift; + uint32_t idx_ctrl; + uint32_t idx_alt; + uint32_t idx_gui; + uint32_t idx_num; + uint32_t idx_caps; } xkb; /* information about axis events on current frame */ @@ -80,6 +119,8 @@ struct SDL_WaylandInput { } pointer_curr_axis_info; SDL_WaylandKeyboardRepeat keyboard_repeat; + + struct SDL_WaylandTabletInput* tablet; }; extern void Wayland_PumpEvents(_THIS); @@ -107,6 +148,9 @@ extern void Wayland_display_destroy_relative_pointer_manager(SDL_VideoData *d); extern int Wayland_input_grab_keyboard(SDL_Window *window, struct SDL_WaylandInput *input); extern int Wayland_input_ungrab_keyboard(SDL_Window *window); +extern void Wayland_input_add_tablet(struct SDL_WaylandInput *input, struct SDL_WaylandTabletManager* tablet_manager); +extern void Wayland_input_destroy_tablet(struct SDL_WaylandInput *input); + #endif /* SDL_waylandevents_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/video/wayland/SDL_waylandkeyboard.c b/libs/SDL2/src/video/wayland/SDL_waylandkeyboard.c index ad91ca5c..8f293a54 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandkeyboard.c +++ b/libs/SDL2/src/video/wayland/SDL_waylandkeyboard.c @@ -120,7 +120,7 @@ Wayland_SetTextInputRect(_THIS, SDL_Rect *rect) 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 --git a/libs/SDL2/src/video/wayland/SDL_waylandkeyboard.h b/libs/SDL2/src/video/wayland/SDL_waylandkeyboard.h index dd8c146e..604e0f37 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandkeyboard.h +++ b/libs/SDL2/src/video/wayland/SDL_waylandkeyboard.h @@ -27,6 +27,7 @@ typedef struct SDL_WaylandTextInput { struct zwp_text_input_v3 *text_input; SDL_Rect cursor_rect; + SDL_bool has_preedit; } SDL_WaylandTextInput; extern int Wayland_InitKeyboard(_THIS); diff --git a/libs/SDL2/src/video/wayland/SDL_waylandopengles.c b/libs/SDL2/src/video/wayland/SDL_waylandopengles.c index 6b10cbee..26626ee5 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandopengles.c +++ b/libs/SDL2/src/video/wayland/SDL_waylandopengles.c @@ -140,9 +140,9 @@ Wayland_GLES_SwapWindow(_THIS, SDL_Window *window) /* 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 @@ Wayland_GLES_SwapWindow(_THIS, SDL_Window *window) /* 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); } @@ -205,11 +205,11 @@ Wayland_GLES_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h) data = (SDL_WindowData *) window->driverdata; if (w) { - *w = window->w * data->scale_factor; + *w = data->drawable_width; } if (h) { - *h = window->h * data->scale_factor; + *h = data->drawable_height; } } } diff --git a/libs/SDL2/src/video/wayland/SDL_waylandsym.h b/libs/SDL2/src/video/wayland/SDL_waylandsym.h index 366ce9e9..0473fa1b 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandsym.h +++ b/libs/SDL2/src/video/wayland/SDL_waylandsym.h @@ -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) @@ -72,21 +72,19 @@ SDL_WAYLAND_SYM(void, wl_list_remove, (struct wl_list *)) SDL_WAYLAND_SYM(int, wl_list_length, (const struct wl_list *)) SDL_WAYLAND_SYM(int, wl_list_empty, (const struct wl_list *)) SDL_WAYLAND_SYM(void, wl_list_insert_list, (struct wl_list *, struct wl_list *)) - -/* These functions are available in Wayland >= 1.4 */ -SDL_WAYLAND_MODULE(WAYLAND_CLIENT_1_4) SDL_WAYLAND_SYM(struct wl_proxy *, wl_proxy_marshal_constructor, (struct wl_proxy *, uint32_t opcode, const struct wl_interface *interface, ...)) - -SDL_WAYLAND_MODULE(WAYLAND_CLIENT_1_10) SDL_WAYLAND_SYM(struct wl_proxy *, wl_proxy_marshal_constructor_versioned, (struct wl_proxy *proxy, uint32_t opcode, const struct wl_interface *interface, uint32_t version, ...)) - -SDL_WAYLAND_MODULE(WAYLAND_CLIENT_1_18) SDL_WAYLAND_SYM(void, wl_proxy_set_tag, (struct wl_proxy *, const char * const *)) SDL_WAYLAND_SYM(const char * const *, wl_proxy_get_tag, (struct wl_proxy *)) -SDL_WAYLAND_MODULE(WAYLAND_CLIENT_1_20) +#if SDL_WAYLAND_CHECK_VERSION(1, 20, 0) +/* wayland-scanner 1.20 generates code that will call these, so these are + * non-optional when we are compiling against Wayland 1.20. We don't + * explicitly call them ourselves, though, so if we are only compiling + * against Wayland 1.18, they're unnecessary. */ SDL_WAYLAND_SYM(struct wl_proxy*, wl_proxy_marshal_flags, (struct wl_proxy *proxy, uint32_t opcode, const struct wl_interface *interfac, uint32_t version, uint32_t flags, ...)) SDL_WAYLAND_SYM(struct wl_proxy*, wl_proxy_marshal_array_flags, (struct wl_proxy *proxy, uint32_t opcode, const struct wl_interface *interface, uint32_t version, uint32_t flags, union wl_argument *args)) +#endif SDL_WAYLAND_INTERFACE(wl_seat_interface) SDL_WAYLAND_INTERFACE(wl_surface_interface) @@ -122,6 +120,7 @@ SDL_WAYLAND_SYM(int, xkb_state_key_get_syms, (struct xkb_state *, xkb_keycode_t, SDL_WAYLAND_SYM(int, xkb_keysym_to_utf8, (xkb_keysym_t, char *, size_t) ) SDL_WAYLAND_SYM(struct xkb_keymap *, xkb_keymap_new_from_string, (struct xkb_context *, const char *, enum xkb_keymap_format, enum xkb_keymap_compile_flags)) SDL_WAYLAND_SYM(struct xkb_state *, xkb_state_new, (struct xkb_keymap *) ) +SDL_WAYLAND_SYM(int, xkb_keymap_key_repeats, (struct xkb_keymap *keymap, xkb_keycode_t key) ); SDL_WAYLAND_SYM(void, xkb_keymap_unref, (struct xkb_keymap *) ) SDL_WAYLAND_SYM(void, xkb_state_unref, (struct xkb_state *) ) SDL_WAYLAND_SYM(void, xkb_context_unref, (struct xkb_context *) ) @@ -148,6 +147,8 @@ SDL_WAYLAND_SYM(int, xkb_keymap_key_get_syms_by_level, (struct xkb_keymap *, xkb_layout_index_t, const xkb_keysym_t **) ) SDL_WAYLAND_SYM(uint32_t, xkb_keysym_to_utf32, (xkb_keysym_t) ) +SDL_WAYLAND_SYM(uint32_t, xkb_keymap_mod_get_index, (struct xkb_keymap *, + const char *) ) #ifdef HAVE_LIBDECOR_H SDL_WAYLAND_MODULE(WAYLAND_LIBDECOR) @@ -203,12 +204,13 @@ SDL_WAYLAND_SYM(bool, libdecor_configuration_get_content_size, (struct libdecor_ 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 --git a/libs/SDL2/src/video/wayland/SDL_waylandvideo.c b/libs/SDL2/src/video/wayland/SDL_waylandvideo.c index f009fb7c..1bed2b23 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandvideo.c +++ b/libs/SDL2/src/video/wayland/SDL_waylandvideo.c @@ -52,6 +52,9 @@ #include "idle-inhibit-unstable-v1-client-protocol.h" #include "xdg-activation-v1-client-protocol.h" #include "text-input-unstable-v3-client-protocol.h" +#include "tablet-unstable-v2-client-protocol.h" +#include "xdg-output-unstable-v1-client-protocol.h" +#include "viewporter-client-protocol.h" #ifdef HAVE_LIBDECOR_H #include @@ -59,6 +62,9 @@ #define WAYLANDVID_DRIVER_NAME "wayland" +static void +display_handle_done(void *data, struct wl_output *output); + /* Initialization/Query functions */ static int Wayland_VideoInit(_THIS); @@ -133,32 +139,22 @@ static const char *SDL_WAYLAND_output_tag = "sdl-output"; void SDL_WAYLAND_register_surface(struct wl_surface *surface) { - if (SDL_WAYLAND_HAVE_WAYLAND_CLIENT_1_18) { - wl_proxy_set_tag((struct wl_proxy *)surface, &SDL_WAYLAND_surface_tag); - } + wl_proxy_set_tag((struct wl_proxy *)surface, &SDL_WAYLAND_surface_tag); } void SDL_WAYLAND_register_output(struct wl_output *output) { - if (SDL_WAYLAND_HAVE_WAYLAND_CLIENT_1_18) { - wl_proxy_set_tag((struct wl_proxy *)output, &SDL_WAYLAND_output_tag); - } + wl_proxy_set_tag((struct wl_proxy *)output, &SDL_WAYLAND_output_tag); } SDL_bool SDL_WAYLAND_own_surface(struct wl_surface *surface) { - if (SDL_WAYLAND_HAVE_WAYLAND_CLIENT_1_18) { - return wl_proxy_get_tag((struct wl_proxy *) surface) == &SDL_WAYLAND_surface_tag; - } - return SDL_TRUE; /* For older clients we have to assume this is us... */ + return wl_proxy_get_tag((struct wl_proxy *) surface) == &SDL_WAYLAND_surface_tag; } SDL_bool SDL_WAYLAND_own_output(struct wl_output *output) { - if (SDL_WAYLAND_HAVE_WAYLAND_CLIENT_1_18) { - return wl_proxy_get_tag((struct wl_proxy *) output) == &SDL_WAYLAND_output_tag; - } - return SDL_TRUE; /* For older clients we have to assume this is us... */ + return wl_proxy_get_tag((struct wl_proxy *) output) == &SDL_WAYLAND_output_tag; } static void @@ -230,6 +226,7 @@ Wayland_CreateDevice(int devindex) device->WaitEventTimeout = Wayland_WaitEventTimeout; device->SendWakeupEvent = Wayland_SendWakeupEvent; +#if SDL_VIDEO_OPENGL_EGL device->GL_SwapWindow = Wayland_GLES_SwapWindow; device->GL_GetSwapInterval = Wayland_GLES_GetSwapInterval; device->GL_SetSwapInterval = Wayland_GLES_SetSwapInterval; @@ -240,6 +237,7 @@ Wayland_CreateDevice(int devindex) device->GL_UnloadLibrary = Wayland_GLES_UnloadLibrary; device->GL_GetProcAddress = Wayland_GLES_GetProcAddress; device->GL_DeleteContext = Wayland_GLES_DeleteContext; +#endif device->CreateSDLWindow = Wayland_CreateWindow; device->ShowWindow = Wayland_ShowWindow; @@ -281,6 +279,8 @@ Wayland_CreateDevice(int devindex) device->free = Wayland_DeleteDevice; + device->disable_display_mode_switching = SDL_TRUE; + return device; } @@ -289,6 +289,167 @@ VideoBootStrap Wayland_bootstrap = { Wayland_CreateDevice }; +static void +xdg_output_handle_logical_position(void *data, struct zxdg_output_v1 *xdg_output, + int32_t x, int32_t y) +{ + SDL_WaylandOutputData* driverdata = data; + + driverdata->x = x; + driverdata->y = y; + driverdata->has_logical_position = SDL_TRUE; +} + +static void +xdg_output_handle_logical_size(void *data, struct zxdg_output_v1 *xdg_output, + int32_t width, int32_t height) +{ + SDL_WaylandOutputData* driverdata = data; + + if (driverdata->width != 0 && driverdata->height != 0) { + /* FIXME: GNOME has a bug where the logical size does not account for + * scale, resulting in bogus viewport sizes. + * + * Until this is fixed, validate that _some_ kind of scaling is being + * done (we can't match exactly because fractional scaling can't be + * detected otherwise), then override if necessary. + * -flibit + */ + const float scale = (float) driverdata->width / (float) width; + if ((scale == 1.0f) && (driverdata->scale_factor != 1.0f)) { + SDL_LogWarn( + SDL_LOG_CATEGORY_VIDEO, + "xdg_output scale did not match, overriding with wl_output scale" + ); + return; + } + } + + driverdata->width = width; + driverdata->height = height; + driverdata->has_logical_size = SDL_TRUE; +} + +static void +xdg_output_handle_done(void *data, struct zxdg_output_v1 *xdg_output) +{ + SDL_WaylandOutputData* driverdata = data; + + /* + * xdg-output.done events are deprecated and only apply below version 3 of the protocol. + * A wl-output.done event will be emitted in version 3 or higher. + */ + if (zxdg_output_v1_get_version(driverdata->xdg_output) < 3) { + display_handle_done(data, driverdata->output); + } +} + +static void +xdg_output_handle_name(void *data, struct zxdg_output_v1 *xdg_output, + const char *name) +{ +} + +static void +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 = { + xdg_output_handle_logical_position, + xdg_output_handle_logical_size, + xdg_output_handle_done, + xdg_output_handle_name, + xdg_output_handle_description, +}; + +static void +AddEmulatedModes(SDL_VideoDisplay *dpy, SDL_bool rot_90) +{ + struct EmulatedMode + { + int w; + int h; + }; + + /* Resolution lists courtesy of XWayland */ + const struct EmulatedMode mode_list[] = { + /* 16:9 (1.77) */ + { 7680, 4320 }, + { 6144, 3160 }, + { 5120, 2880 }, + { 4096, 2304 }, + { 3840, 2160 }, + { 3200, 1800 }, + { 2880, 1620 }, + { 2560, 1440 }, + { 2048, 1152 }, + { 1920, 1080 }, + { 1600, 900 }, + { 1368, 768 }, + { 1280, 720 }, + { 864, 486 }, + + /* 16:10 (1.6) */ + { 2560, 1600 }, + { 1920, 1200 }, + { 1680, 1050 }, + { 1440, 900 }, + { 1280, 800 }, + + /* 3:2 (1.5) */ + { 720, 480 }, + + /* 4:3 (1.33) */ + { 2048, 1536 }, + { 1920, 1440 }, + { 1600, 1200 }, + { 1440, 1080 }, + { 1400, 1050 }, + { 1280, 1024 }, + { 1280, 960 }, + { 1152, 864 }, + { 1024, 768 }, + { 800, 600 }, + { 640, 480 } + }; + + 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) { + 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); + } + } +} + static void display_handle_geometry(void *data, struct wl_output *output, @@ -305,7 +466,7 @@ display_handle_geometry(void *data, SDL_VideoDisplay *display; int i; - if (driverdata->done) { + if (driverdata->wl_output_done_count) { /* Clear the wl_output ref so Reset doesn't free it */ display = SDL_GetDisplay(driverdata->index); for (i = 0; i < display->num_display_modes; i += 1) { @@ -316,14 +477,19 @@ display_handle_geometry(void *data, SDL_ResetDisplayModes(driverdata->index); /* The display has officially started over. */ - driverdata->done = SDL_FALSE; + driverdata->wl_output_done_count = 0; } - driverdata->x = x; - driverdata->y = y; + /* Apply the change from wl-output only if xdg-output is not supported */ + if (!driverdata->has_logical_position) { + driverdata->x = x; + driverdata->y = y; + } 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); } @@ -367,36 +533,21 @@ display_handle_mode(void *data, int refresh) { SDL_WaylandOutputData* driverdata = data; - SDL_DisplayMode mode; if (flags & WL_OUTPUT_MODE_CURRENT) { - /* Don't rotate this yet, handle_done will do it later */ - driverdata->width = width; - driverdata->height = height; - driverdata->refresh = refresh; - } + driverdata->native_width = width; + driverdata->native_height = height; - /* Note that the width/height are NOT multiplied by scale_factor! - * This is intentional and is designed to get the unscaled modes, which is - * important for high-DPI games intending to use the display mode as the - * target drawable size. The scaled desktop mode will be added at the end - * when display_handle_done is called (see below). - */ - SDL_zero(mode); - mode.format = SDL_PIXELFORMAT_RGB888; - if (driverdata->transform & WL_OUTPUT_TRANSFORM_90) { - mode.w = height; - mode.h = width; - } else { - mode.w = width; - mode.h = height; - } - mode.refresh_rate = refresh / 1000; /* mHz to Hz */ - mode.driverdata = driverdata->output; - if (driverdata->index > -1) { - SDL_AddDisplayMode(SDL_GetDisplay(driverdata->index), &mode); - } else { - SDL_AddDisplayMode(&driverdata->placeholder, &mode); + /* + * Don't rotate this yet, wl-output coordinates are transformed in + * handle_done and xdg-output coordinates are pre-transformed. + */ + if (!driverdata->has_logical_size) { + driverdata->width = width; + driverdata->height = height; + } + + driverdata->refresh = refresh; } } @@ -405,20 +556,75 @@ display_handle_done(void *data, struct wl_output *output) { SDL_WaylandOutputData* driverdata = data; - SDL_DisplayMode mode; + 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); - if (driverdata->done) + /* + * When using xdg-output, two wl-output.done events will be emitted: + * one at the completion of wl-display and one at the completion of xdg-output. + * + * All required events must be received before proceeding. + */ + const int event_await_count = 1 + (driverdata->xdg_output != NULL); + + driverdata->wl_output_done_count = SDL_min(driverdata->wl_output_done_count + 1, event_await_count + 1); + + if (driverdata->wl_output_done_count != event_await_count) { return; + } - driverdata->done = SDL_TRUE; + /* The native display resolution */ + SDL_zero(native_mode); + native_mode.format = SDL_PIXELFORMAT_RGB888; - SDL_zero(mode); - mode.format = SDL_PIXELFORMAT_RGB888; if (driverdata->transform & WL_OUTPUT_TRANSFORM_90) { - mode.w = driverdata->height / driverdata->scale_factor; - mode.h = driverdata->width / driverdata->scale_factor; + native_mode.w = driverdata->native_height; + native_mode.h = driverdata->native_width; + } else { + native_mode.w = driverdata->native_width; + native_mode.h = driverdata->native_height; + } + native_mode.refresh_rate = (int)SDL_round(driverdata->refresh / 1000.0); /* mHz to Hz */ + native_mode.driverdata = driverdata->output; + /* The scaled desktop mode */ + SDL_zero(desktop_mode); + desktop_mode.format = SDL_PIXELFORMAT_RGB888; + + 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; + } + + /* xdg-output dimensions are already transformed, so no need to rotate. */ + if (driverdata->has_logical_size || !(driverdata->transform & WL_OUTPUT_TRANSFORM_90)) { + desktop_mode.w = driverdata->width; + desktop_mode.h = driverdata->height; + } else { + desktop_mode.w = driverdata->height; + desktop_mode.h = driverdata->width; + } + desktop_mode.refresh_rate = (int)SDL_round(driverdata->refresh / 1000.0); /* mHz to Hz */ + 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. + */ + if (driverdata->scale_factor > 1.0f && video->viewporter != NULL) { + if (driverdata->index > -1) { + SDL_AddDisplayMode(SDL_GetDisplay(driverdata->index), &native_mode); + } else { + SDL_AddDisplayMode(&driverdata->placeholder, &native_mode); + } + } + + /* Calculate the display DPI */ + if (driverdata->transform & WL_OUTPUT_TRANSFORM_90) { driverdata->hdpi = driverdata->physical_height ? (((float) driverdata->height) * 25.4f / driverdata->physical_height) : 0.0f; @@ -430,9 +636,6 @@ display_handle_done(void *data, ((float) driverdata->physical_height) / 25.4f, ((float) driverdata->physical_width) / 25.4f); } else { - mode.w = driverdata->width / driverdata->scale_factor; - mode.h = driverdata->height / driverdata->scale_factor; - driverdata->hdpi = driverdata->physical_width ? (((float) driverdata->width) * 25.4f / driverdata->physical_width) : 0.0f; @@ -444,8 +647,6 @@ display_handle_done(void *data, ((float) driverdata->physical_width) / 25.4f, ((float) driverdata->physical_height) / 25.4f); } - mode.refresh_rate = driverdata->refresh / 1000; /* mHz to Hz */ - mode.driverdata = driverdata->output; if (driverdata->index > -1) { dpy = SDL_GetDisplay(driverdata->index); @@ -453,9 +654,16 @@ display_handle_done(void *data, dpy = &driverdata->placeholder; } - SDL_AddDisplayMode(dpy, &mode); - SDL_SetCurrentDisplayMode(dpy, &mode); - SDL_SetDesktopDisplayMode(dpy, &mode); + SDL_AddDisplayMode(dpy, &desktop_mode); + SDL_SetCurrentDisplayMode(dpy, &desktop_mode); + SDL_SetDesktopDisplayMode(dpy, &desktop_mode); + + /* 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) { /* First time getting display info, create the VideoDisplay */ @@ -502,11 +710,29 @@ Wayland_add_display(SDL_VideoData *d, uint32_t id) data->videodata = d; data->output = output; data->registry_id = id; - data->scale_factor = 1.0; + data->scale_factor = 1.0f; data->index = -1; wl_output_add_listener(output, &output_listener, data); SDL_WAYLAND_register_output(output); + + /* Keep a list of outputs for deferred xdg-output initialization. */ + if (d->output_list != NULL) { + SDL_WaylandOutputData *node = (SDL_WaylandOutputData*)d->output_list; + + while (node->next != NULL) { + node = (SDL_WaylandOutputData*)node->next; + } + + node->next = (struct SDL_WaylandOutputData*)data; + } else { + d->output_list = (struct SDL_WaylandOutputData*)data; + } + + if (data->videodata->xdg_output_manager) { + data->xdg_output = zxdg_output_manager_v1_get_xdg_output(data->videodata->xdg_output_manager, output); + zxdg_output_v1_add_listener(data->xdg_output, &xdg_output_listener, data); + } } static void @@ -522,6 +748,9 @@ Wayland_free_display(uint32_t id) data = (SDL_WaylandOutputData *) display->driverdata; if (data->registry_id == id) { SDL_DelVideoDisplay(i); + if (data->xdg_output) { + zxdg_output_v1_destroy(data->xdg_output); + } wl_output_destroy(data->output); SDL_free(data); @@ -538,6 +767,16 @@ Wayland_free_display(uint32_t id) } } +static void +Wayland_init_xdg_output(SDL_VideoData *d) +{ + SDL_WaylandOutputData *node; + for (node = d->output_list; node != NULL; node = node->next) { + node->xdg_output = zxdg_output_manager_v1_get_xdg_output(node->videodata->xdg_output_manager, node->output); + zxdg_output_v1_add_listener(node->xdg_output, &xdg_output_listener, node); + } +} + #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH static void windowmanager_hints(void *data, struct qt_windowmanager *qt_windowmanager, @@ -598,7 +837,7 @@ display_handle_global(void *data, struct wl_registry *registry, uint32_t id, } else if (SDL_strcmp(interface, "wl_seat") == 0) { Wayland_display_add_input(d, id, version); } else if (SDL_strcmp(interface, "xdg_wm_base") == 0) { - d->shell.xdg = wl_registry_bind(d->registry, id, &xdg_wm_base_interface, 1); + d->shell.xdg = wl_registry_bind(d->registry, id, &xdg_wm_base_interface, SDL_min(version, 3)); xdg_wm_base_add_listener(d->shell.xdg, &shell_listener_xdg, NULL); } else if (SDL_strcmp(interface, "wl_shm") == 0) { d->shm = wl_registry_bind(registry, id, &wl_shm_interface, 1); @@ -618,6 +857,17 @@ display_handle_global(void *data, struct wl_registry *registry, uint32_t id, Wayland_add_data_device_manager(d, id, version); } else if (SDL_strcmp(interface, "zxdg_decoration_manager_v1") == 0) { d->decoration_manager = wl_registry_bind(d->registry, id, &zxdg_decoration_manager_v1_interface, 1); + } else if (SDL_strcmp(interface, "zwp_tablet_manager_v2") == 0) { + d->tablet_manager = wl_registry_bind(d->registry, id, &zwp_tablet_manager_v2_interface, 1); + if (d->input) { + Wayland_input_add_tablet(d->input, d->tablet_manager); + } + } else if (SDL_strcmp(interface, "zxdg_output_manager_v1") == 0) { + version = SDL_min(version, 3); /* Versions 1 through 3 are supported. */ + d->xdg_output_manager = wl_registry_bind(d->registry, id, &zxdg_output_manager_v1_interface, version); + Wayland_init_xdg_output(d); + } else if (SDL_strcmp(interface, "wp_viewporter") == 0) { + d->viewporter = wl_registry_bind(d->registry, id, &wp_viewporter_interface, 1); #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH } else if (SDL_strcmp(interface, "qt_touch_extension") == 0) { @@ -644,6 +894,48 @@ static const struct wl_registry_listener registry_listener = { display_handle_global, display_remove_global }; + +#ifdef HAVE_LIBDECOR_H +static SDL_bool should_use_libdecor(SDL_VideoData *data, SDL_bool ignore_xdg) +{ + if (!SDL_WAYLAND_HAVE_WAYLAND_LIBDECOR) { + return SDL_FALSE; + } + + if (!SDL_GetHintBoolean(SDL_HINT_VIDEO_WAYLAND_ALLOW_LIBDECOR, SDL_TRUE)) { + return SDL_FALSE; + } + + if (SDL_GetHintBoolean(SDL_HINT_VIDEO_WAYLAND_PREFER_LIBDECOR, SDL_FALSE)) { + return SDL_TRUE; + } + + if (ignore_xdg) { + return SDL_TRUE; + } + + if (data->decoration_manager) { + return SDL_FALSE; + } + + return SDL_TRUE; +} +#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) @@ -665,18 +957,8 @@ Wayland_VideoInit(_THIS) // 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 (!data->decoration_manager && SDL_WAYLAND_HAVE_WAYLAND_LIBDECOR && SDL_GetHintBoolean(SDL_HINT_VIDEO_WAYLAND_ALLOW_LIBDECOR, SDL_TRUE)) { - data->shell.libdecor = libdecor_new(data->display, &libdecor_interface); - - /* If libdecor works, we don't need xdg-shell anymore. */ - if (data->shell.libdecor && data->shell.xdg) { - xdg_wm_base_destroy(data->shell.xdg); - data->shell.xdg = NULL; - } - } -#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); @@ -735,6 +1017,10 @@ Wayland_VideoQuit(_THIS) for (i = 0; i < _this->num_displays; ++i) { SDL_VideoDisplay *display = &_this->displays[i]; + if (((SDL_WaylandOutputData*)display->driverdata)->xdg_output) { + zxdg_output_v1_destroy(((SDL_WaylandOutputData*)display->driverdata)->xdg_output); + } + wl_output_destroy(((SDL_WaylandOutputData*)display->driverdata)->output); SDL_free(display->driverdata); display->driverdata = NULL; @@ -777,6 +1063,9 @@ Wayland_VideoQuit(_THIS) Wayland_touch_destroy(data); #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ + if (data->tablet_manager) + zwp_tablet_manager_v2_destroy((struct zwp_tablet_manager_v2*)data->tablet_manager); + if (data->data_device_manager) wl_data_device_manager_destroy(data->data_device_manager); @@ -796,6 +1085,14 @@ Wayland_VideoQuit(_THIS) } #endif + if (data->xdg_output_manager) { + zxdg_output_manager_v1_destroy(data->xdg_output_manager); + } + + if (data->viewporter) { + wp_viewporter_destroy(data->viewporter); + } + if (data->compositor) wl_compositor_destroy(data->compositor); diff --git a/libs/SDL2/src/video/wayland/SDL_waylandvideo.h b/libs/SDL2/src/video/wayland/SDL_waylandvideo.h index 31168a9d..9b2d6835 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandvideo.h +++ b/libs/SDL2/src/video/wayland/SDL_waylandvideo.h @@ -34,6 +34,7 @@ struct xkb_context; struct SDL_WaylandInput; +struct SDL_WaylandTabletManager; #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH struct SDL_WaylandTouch; @@ -46,6 +47,8 @@ typedef struct { int size; } SDL_WaylandCursorTheme; +typedef struct SDL_WaylandOutputData SDL_WaylandOutputData; + typedef struct { SDL_bool initializing; struct wl_display *display; @@ -70,6 +73,8 @@ typedef struct { struct zwp_idle_inhibit_manager_v1 *idle_inhibit_manager; struct xdg_activation_v1 *activation_manager; struct zwp_text_input_manager_v3 *text_input_manager; + struct zxdg_output_manager_v1 *xdg_output_manager; + struct wp_viewporter *viewporter; EGLDisplay edpy; EGLContext context; @@ -77,6 +82,8 @@ typedef struct { struct xkb_context *xkb_context; struct SDL_WaylandInput *input; + struct SDL_WaylandTabletManager *tablet_manager; + SDL_WaylandOutputData *output_list; #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH struct SDL_WaylandTouch *touch; @@ -89,19 +96,23 @@ typedef struct { int relative_mouse_mode; } SDL_VideoData; -typedef struct { +struct SDL_WaylandOutputData { SDL_VideoData *videodata; struct wl_output *output; + struct zxdg_output_v1 *xdg_output; uint32_t registry_id; float scale_factor; + int native_width, native_height; int x, y, width, height, refresh, transform; SDL_DisplayOrientation orientation; int physical_width, physical_height; float ddpi, hdpi, vdpi; + SDL_bool has_logical_position, has_logical_size; int index; SDL_VideoDisplay placeholder; - SDL_bool done; -} SDL_WaylandOutputData; + int wl_output_done_count; + SDL_WaylandOutputData *next; +}; /* Needed here to get wl_surface declaration, fixes GitHub#4594 */ #include "SDL_waylanddyn.h" @@ -111,6 +122,8 @@ extern void SDL_WAYLAND_register_output(struct wl_output *output); 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 --git a/libs/SDL2/src/video/wayland/SDL_waylandvulkan.c b/libs/SDL2/src/video/wayland/SDL_waylandvulkan.c index eb443513..90b318fc 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandvulkan.c +++ b/libs/SDL2/src/video/wayland/SDL_waylandvulkan.c @@ -139,11 +139,11 @@ void Wayland_Vulkan_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h) data = (SDL_WindowData *) window->driverdata; if (w) { - *w = window->w * data->scale_factor; + *w = data->drawable_width; } if (h) { - *h = window->h * data->scale_factor; + *h = data->drawable_height; } } } diff --git a/libs/SDL2/src/video/wayland/SDL_waylandwindow.c b/libs/SDL2/src/video/wayland/SDL_waylandwindow.c index 3eae22bf..8ca08422 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandwindow.c +++ b/libs/SDL2/src/video/wayland/SDL_waylandwindow.c @@ -21,33 +21,309 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL +#if SDL_VIDEO_DRIVER_WAYLAND #include "../SDL_sysvideo.h" #include "../../events/SDL_windowevents_c.h" +#include "../../events/SDL_mouse_c.h" #include "../SDL_egl_c.h" #include "SDL_waylandevents_c.h" #include "SDL_waylandwindow.h" #include "SDL_waylandvideo.h" #include "SDL_waylandtouch.h" #include "SDL_hints.h" +#include "SDL_events.h" #include "xdg-shell-client-protocol.h" #include "xdg-decoration-unstable-v1-client-protocol.h" #include "idle-inhibit-unstable-v1-client-protocol.h" #include "xdg-activation-v1-client-protocol.h" +#include "viewporter-client-protocol.h" #ifdef HAVE_LIBDECOR_H #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 -CommitMinMaxDimensions(SDL_Window *window) +GetFullScreenDimensions(SDL_Window *window, int *width, int *height, int *drawable_width, int *drawable_height) +{ + SDL_WaylandOutputData *output = (SDL_WaylandOutputData *)SDL_GetDisplayForWindow(window)->driverdata; + + int fs_width, fs_height; + int buf_width, buf_height; + + /* + * Fullscreen desktop mandates a desktop sized window, so that's what applications will get. + * If the application is DPI aware, it will need to handle the transformations between the + * differently sized window and backbuffer spaces on its own. + */ + if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) { + fs_width = output->width; + fs_height = output->height; + + /* If the application is DPI aware, we can expose the true backbuffer size */ + if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { + buf_width = output->native_width; + buf_height = output->native_height; + } else { + buf_width = fs_width; + buf_height = fs_height; + } + } else { + /* + * If a mode was set, use it, otherwise use the native resolution + * for DPI aware apps and the desktop size for legacy apps. + */ + if (window->fullscreen_mode.w != 0 && window->fullscreen_mode.h != 0) { + fs_width = window->fullscreen_mode.w; + fs_height = window->fullscreen_mode.h; + } else if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { + fs_width = output->native_width; + fs_height = output->native_height; + } else { + fs_width = output->width; + fs_height = output->height; + } + + buf_width = fs_width; + buf_height = fs_height; + } + + if (width) { + *width = fs_width; + } + if (height) { + *height = fs_height; + } + if (drawable_width) { + *drawable_width = buf_width; + } + if (drawable_height) { + *drawable_height = buf_height; + } +} + +SDL_FORCE_INLINE SDL_bool +SurfaceScaleIsFractional(SDL_Window *window) +{ + SDL_WindowData *data = window->driverdata; + return !FloatEqual(SDL_roundf(data->scale_factor), data->scale_factor); +} + +SDL_FORCE_INLINE SDL_bool +FullscreenModeEmulation(SDL_Window *window) +{ + return (window->flags & SDL_WINDOW_FULLSCREEN) && + ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP); +} + +SDL_bool +NeedViewport(SDL_Window *window) +{ + SDL_WindowData *wind = window->driverdata; + SDL_VideoData *video = wind->waylandData; + SDL_WaylandOutputData *output = ((SDL_WaylandOutputData *)SDL_GetDisplayForWindow(window)->driverdata); + int fs_width, fs_height; + + /* + * 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) { + 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 (SurfaceScaleIsFractional(window) && (window->flags & SDL_WINDOW_ALLOW_HIGHDPI)) { + return SDL_TRUE; + } + } + + return SDL_FALSE; +} + +/* If a viewport is active, use the width and height for the window dimensions. */ +SDL_FORCE_INLINE int +GetWindowWidth(SDL_Window *window) +{ + 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) +{ + SDL_WindowData *data = (SDL_WindowData *)window->driverdata; + return SDL_RectEmpty(&data->viewport_rect) ? window->h : data->viewport_rect.h; +} + +static void +GetBufferSize(SDL_Window *window, int *width, int *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); + + buf_width = window->w * scale_factor; + buf_height = window->h * scale_factor; + } + + if (width) { + *width = buf_width; + } + if (height) { + *height = buf_height; + } +} + +static void +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->draw_viewport == NULL) { + wind->draw_viewport = wp_viewporter_get_viewport(video->viewporter, wind->surface); + } + + 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 +UnsetDrawSurfaceViewport(SDL_Window *window) +{ + SDL_WindowData *wind = window->driverdata; + + if (wind->draw_viewport) { + wp_viewport_destroy(wind->draw_viewport); + wind->draw_viewport = NULL; + } +} + +static void +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; + + /* 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); + + /* 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; + + 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 { + 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->viewport_rect); + + data->pointer_scale_x = 1.0f; + data->pointer_scale_y = 1.0f; + + 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); + } + } + + /* Recreate the pointer confinement region when the window geometry changes. */ + if (data->confined_pointer) { + Wayland_input_confine_pointer(viddata->input, window); + } +} + +static void +SetMinMaxDimensions(SDL_Window *window, SDL_bool commit) { SDL_WindowData *wind = window->driverdata; SDL_VideoData *viddata = wind->waylandData; int min_width, min_height, max_width, max_height; + /* Pop-ups don't get to change size */ + if (WINDOW_IS_XDG_POPUP(window)) { + /* ... but we still want to commit, particularly for ShowWindow */ + if (commit) { + wl_surface_commit(wind->surface); + } + return; + } + if (window->flags & SDL_WINDOW_FULLSCREEN) { min_width = 0; min_height = 0; @@ -66,7 +342,7 @@ CommitMinMaxDimensions(SDL_Window *window) } #ifdef HAVE_LIBDECOR_H - if (viddata->shell.libdecor) { + if (WINDOW_IS_LIBDECOR(viddata, window)) { if (wind->shell_surface.libdecor.frame == NULL) { return; /* Can't do anything yet, wait for ShowWindow */ } @@ -76,6 +352,13 @@ CommitMinMaxDimensions(SDL_Window *window) 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) { @@ -88,39 +371,64 @@ CommitMinMaxDimensions(SDL_Window *window) xdg_toplevel_set_max_size(wind->shell_surface.xdg.roleobj.toplevel, max_width, max_height); - wl_surface_commit(wind->surface); + if (commit) { + wl_surface_commit(wind->surface); + } } } static void -SetFullscreen(SDL_Window *window, struct wl_output *output) +SetFullscreen(SDL_Window *window, struct wl_output *output, SDL_bool commit) { SDL_WindowData *wind = window->driverdata; SDL_VideoData *viddata = wind->waylandData; + /* Pop-ups don't get to be fullscreened */ + if (WINDOW_IS_XDG_POPUP(window)) { + /* ... but we still want to commit, particularly for ShowWindow */ + if (commit) { + wl_surface_commit(wind->surface); + } + return; + } + /* The desktop may try to enforce min/max sizes here, so turn them off for * fullscreen and on (if applicable) for windowed */ - CommitMinMaxDimensions(window); + SetMinMaxDimensions(window, SDL_FALSE); #ifdef HAVE_LIBDECOR_H - if (viddata->shell.libdecor) { + if (WINDOW_IS_LIBDECOR(viddata, window)) { if (wind->shell_surface.libdecor.frame == NULL) { return; /* Can't do anything yet, wait for ShowWindow */ } 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 @@ -129,6 +437,9 @@ SetFullscreen(SDL_Window *window, struct wl_output *output) 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 { @@ -137,22 +448,44 @@ SetFullscreen(SDL_Window *window, struct wl_output *output) } } -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; + + /* 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 }; @@ -215,7 +548,7 @@ handle_configure_xdg_toplevel(void *data, if (!fullscreen) { if (window->flags & SDL_WINDOW_FULLSCREEN) { /* We might need to re-enter fullscreen after being restored from minimized */ - SetFullscreen(window, driverdata->output); + 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. @@ -224,14 +557,16 @@ handle_configure_xdg_toplevel(void *data, * us a completely stateless, sizeless configure, with which we have * to enforce our own state anyway. */ - if (width != 0 && height != 0) { + 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) { + 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; } return; @@ -284,8 +619,11 @@ handle_configure_xdg_toplevel(void *data, } /* Store this now so the xdg_surface configure knows what to resize to */ - window->w = width; - window->h = height; + if (window->w != width || window->h != height) { + window->w = width; + window->h = height; + wind->needs_resize_event = SDL_TRUE; + } } else { /* For fullscreen, foolishly do what the compositor says. If it's wrong, * don't blame us, we were explicitly instructed to do this. @@ -293,14 +631,21 @@ handle_configure_xdg_toplevel(void *data, * UPDATE: Nope, sure enough a compositor sends 0,0. This is a known bug: * https://bugs.kde.org/show_bug.cgi?id=444962 */ - if (width != 0 && height != 0) { - window->w = width; - window->h = height; + if (!FullscreenModeEmulation(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); + wind->needs_resize_event = SDL_TRUE; } /* This part is good though. */ - if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { + 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; } } } @@ -317,6 +662,88 @@ static const struct xdg_toplevel_listener toplevel_listener_xdg = { handle_close_xdg_toplevel }; +static void +handle_configure_xdg_popup(void *data, + struct xdg_popup *xdg_popup, + int32_t x, + int32_t y, + int32_t width, + int32_t height) +{ + /* No-op, we don't use x/y and width/height are fixed-size */ +} + +static void +handle_done_xdg_popup(void *data, struct xdg_popup *xdg_popup) +{ + SDL_WindowData *window = (SDL_WindowData *)data; + SDL_SendWindowEvent(window->sdlwindow, SDL_WINDOWEVENT_CLOSE, 0, 0); +} + +static void +handle_repositioned_xdg_popup(void *data, + struct xdg_popup *xdg_popup, + uint32_t token) +{ + /* No-op, configure does all the work we care about */ +} + +static const struct xdg_popup_listener popup_listener_xdg = { + handle_configure_xdg_popup, + handle_done_xdg_popup, + handle_repositioned_xdg_popup +}; + +#define TOOLTIP_CURSOR_OFFSET 8 /* FIXME: Arbitrary, eyeballed from X tooltip */ + +static int +Wayland_PopupWatch(void *data, SDL_Event *event) +{ + if (event->type == SDL_MOUSEMOTION) { + SDL_Window *window = (SDL_Window *) data; + SDL_WindowData *wind = window->driverdata; + + /* Coordinates might be relative to the popup, which we don't want */ + if (event->motion.windowID == wind->shell_surface.xdg.roleobj.popup.parentID) { + xdg_positioner_set_offset(wind->shell_surface.xdg.roleobj.popup.positioner, + event->motion.x + TOOLTIP_CURSOR_OFFSET, + event->motion.y + TOOLTIP_CURSOR_OFFSET); + xdg_popup_reposition(wind->shell_surface.xdg.roleobj.popup.popup, + wind->shell_surface.xdg.roleobj.popup.positioner, + 0); + } + } + 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 (!Wayland_LoadLibdecor(driverdata->waylandData, SDL_TRUE)) { + /* libdecor isn't available, so no borders for you... oh well */ + return; + } + 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, @@ -330,6 +757,7 @@ decoration_frame_configure(struct libdecor_frame *frame, enum libdecor_window_state window_state; int width, height; + float scale_factor = wind->scale_factor; SDL_bool focused = SDL_FALSE; SDL_bool fullscreen = SDL_FALSE; @@ -356,7 +784,7 @@ decoration_frame_configure(struct libdecor_frame *frame, if (!fullscreen) { if (window->flags & SDL_WINDOW_FULLSCREEN) { /* We might need to re-enter fullscreen after being restored from minimized */ - SetFullscreen(window, driverdata->output); + SetFullscreen(window, driverdata->output, SDL_FALSE); fullscreen = SDL_TRUE; floating = SDL_FALSE; } @@ -386,24 +814,31 @@ decoration_frame_configure(struct libdecor_frame *frame, * Always assume the configure is wrong. */ if (fullscreen) { - /* 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 - * told to do this. - */ - if (!libdecor_configuration_get_content_size(configuration, frame, - &width, &height)) { - width = window->w; - height = window->h; + 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 + * told to do this. + */ + if (!libdecor_configuration_get_content_size(configuration, frame, + &width, &height)) { + width = window->w; + height = window->h; + } + } else { + GetFullScreenDimensions(window, &width, &height, NULL, NULL); } + wind->needs_resize_event = SDL_TRUE; + /* This part is good though. */ if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { - wind->scale_factor = driverdata->scale_factor; + scale_factor = driverdata->scale_factor; } - } else if (!(window->flags & SDL_WINDOW_RESIZABLE)) { + } else if (!(window->flags & SDL_WINDOW_RESIZABLE) || (floating && wind->floating_resize_pending)) { width = window->windowed.w; height = window->windowed.h; + wind->floating_resize_pending = SDL_FALSE; } else { /* This will never set 0 for width/height unless the function returns false */ if (!libdecor_configuration_get_content_size(configuration, frame, &width, &height)) { @@ -427,11 +862,11 @@ decoration_frame_configure(struct libdecor_frame *frame, } /* Do the resize on the SDL side (this will set window->w/h)... */ - Wayland_HandleResize(window, width, height, wind->scale_factor); + Wayland_HandleResize(window, width, height, scale_factor); wind->shell_surface.libdecor.initial_configure_seen = SDL_TRUE; /* ... then commit the changes on the libdecor side. */ - state = libdecor_state_new(width, height); + state = libdecor_state_new(GetWindowWidth(window), GetWindowHeight(window)); libdecor_frame_commit(frame, state, configuration); libdecor_state_free(state); @@ -518,13 +953,11 @@ update_scale_factor(SDL_WindowData *window) 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); } } @@ -540,9 +973,28 @@ Wayland_move_window(SDL_Window *window, int i, numdisplays = SDL_GetNumVideoDisplays(); for (i = 0; i < numdisplays; i += 1) { if (SDL_GetDisplay(i)->driverdata == driverdata) { - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, - SDL_WINDOWPOS_CENTERED_DISPLAY(i), - SDL_WINDOWPOS_CENTERED_DISPLAY(i)); + /* We want to send a very very specific combination here: + * + * 1. A coordinate that tells the application what display we're on + * 2. Exactly (0, 0) + * + * Part 1 is useful information but is also really important for + * ensuring we end up on the right display for fullscreen, while + * part 2 is important because numerous applications use a specific + * combination of GetWindowPosition and GetGlobalMouseState, and of + * course neither are supported by Wayland. Since global mouse will + * fall back to just GetMouseState, we need the window position to + * be zero so the cursor math works without it going off in some + * random direction. See UE5 Editor for a notable example of this! + * + * This may be an issue some day if we're ever able to implement + * SDL_GetDisplayUsableBounds! + * + * -flibit + */ + SDL_Rect bounds; + SDL_GetDisplayBounds(i, &bounds); + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, bounds.x, bounds.y); break; } } @@ -610,6 +1062,19 @@ static const struct wl_surface_listener surface_listener = { handle_surface_leave }; +static void +Wayland_FillEmptyShellInfo(SDL_SysWMinfo * info, const Uint32 version) +{ + info->info.wl.xdg_surface = NULL; + if (version >= SDL_VERSIONNUM(2, 0, 17)) { + info->info.wl.xdg_toplevel = NULL; + if (version >= SDL_VERSIONNUM(2, 0, 22)) { + info->info.wl.xdg_popup = NULL; + info->info.wl.xdg_positioner = NULL; + } + } +} + SDL_bool Wayland_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) { @@ -642,23 +1107,40 @@ Wayland_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) info->info.wl.egl_window = data->egl_window; #ifdef HAVE_LIBDECOR_H - if (viddata->shell.libdecor && data->shell_surface.libdecor.frame != NULL) { - info->info.wl.xdg_surface = libdecor_frame_get_xdg_surface(data->shell_surface.libdecor.frame); - if (version >= SDL_VERSIONNUM(2, 0, 17)) { - info->info.wl.xdg_toplevel = libdecor_frame_get_xdg_toplevel(data->shell_surface.libdecor.frame); + if (WINDOW_IS_LIBDECOR(viddata, window)) { + if (data->shell_surface.libdecor.frame != NULL) { + info->info.wl.xdg_surface = libdecor_frame_get_xdg_surface(data->shell_surface.libdecor.frame); + if (version >= SDL_VERSIONNUM(2, 0, 17)) { + info->info.wl.xdg_toplevel = libdecor_frame_get_xdg_toplevel(data->shell_surface.libdecor.frame); + if (version >= SDL_VERSIONNUM(2, 0, 22)) { + info->info.wl.xdg_popup = NULL; + info->info.wl.xdg_positioner = NULL; + } + } + } else { + /* Not mapped yet */ + Wayland_FillEmptyShellInfo(info, version); } } else #endif if (viddata->shell.xdg && data->shell_surface.xdg.surface != NULL) { info->info.wl.xdg_surface = data->shell_surface.xdg.surface; if (version >= SDL_VERSIONNUM(2, 0, 17)) { - info->info.wl.xdg_toplevel = data->shell_surface.xdg.roleobj.toplevel; + SDL_bool popup = WINDOW_IS_XDG_POPUP(window); + info->info.wl.xdg_toplevel = popup ? NULL : data->shell_surface.xdg.roleobj.toplevel; + if (version >= SDL_VERSIONNUM(2, 0, 22)) { + if (popup) { + info->info.wl.xdg_popup = data->shell_surface.xdg.roleobj.popup.popup; + info->info.wl.xdg_positioner = data->shell_surface.xdg.roleobj.popup.positioner; + } else { + info->info.wl.xdg_popup = NULL; + info->info.wl.xdg_positioner = NULL; + } + } } } else { - info->info.wl.xdg_surface = NULL; - if (version >= SDL_VERSIONNUM(2, 0, 17)) { - info->info.wl.xdg_toplevel = NULL; - } + /* Either it's not mapped yet or we don't have a shell protocol */ + Wayland_FillEmptyShellInfo(info, version); } } @@ -683,6 +1165,10 @@ Wayland_SetWindowModalFor(_THIS, SDL_Window *modal_window, SDL_Window *parent_wi SDL_WindowData *modal_data = modal_window->driverdata; SDL_WindowData *parent_data = parent_window->driverdata; + if (WINDOW_IS_XDG_POPUP(modal_window) || WINDOW_IS_XDG_POPUP(parent_window)) { + return SDL_SetError("Modal/Parent was a popup, not a toplevel"); + } + #ifdef HAVE_LIBDECOR_H if (viddata->shell.libdecor) { if (modal_data->shell_surface.libdecor.frame == NULL) { @@ -716,17 +1202,27 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window) { SDL_VideoData *c = _this->driverdata; SDL_WindowData *data = window->driverdata; - SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); /* Detach any previous buffers before resetting everything, otherwise when - * calling this a second time you'll get an annoying protocol error + * calling this a second time you'll get an annoying protocol error! + * + * FIXME: This was originally moved to HideWindow, which _should_ make + * sense, but for whatever reason UE5's popups require that this actually + * be in both places at once? Possibly from renderers making commits? I can't + * fully remember if this location caused crashes or if I was fixing a pair + * of Hide/Show calls. In any case, UE gives us a pretty good test and having + * both detach calls passes. This bug may be relevant if I'm wrong: + * + * https://bugs.kde.org/show_bug.cgi?id=448856 + * + * -flibit */ wl_surface_attach(data->surface, NULL, 0, 0); wl_surface_commit(data->surface); - /* Create the shell surface and map the toplevel */ + /* Create the shell surface and map the toplevel/popup */ #ifdef HAVE_LIBDECOR_H - if (c->shell.libdecor) { + if (WINDOW_IS_LIBDECOR(c, window)) { data->shell_surface.libdecor.frame = libdecor_decorate(c->shell.libdecor, data->surface, &libdecor_frame_interface, @@ -744,10 +1240,42 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window) xdg_surface_set_user_data(data->shell_surface.xdg.surface, data); xdg_surface_add_listener(data->shell_surface.xdg.surface, &shell_surface_listener_xdg, data); - /* !!! FIXME: add popup role */ - data->shell_surface.xdg.roleobj.toplevel = xdg_surface_get_toplevel(data->shell_surface.xdg.surface); - xdg_toplevel_set_app_id(data->shell_surface.xdg.roleobj.toplevel, c->classname); - xdg_toplevel_add_listener(data->shell_surface.xdg.roleobj.toplevel, &toplevel_listener_xdg, data); + if (WINDOW_IS_XDG_POPUP(window)) { + SDL_Mouse *mouse = SDL_GetMouse(); + SDL_Window *focused = SDL_GetMouseFocus(); + SDL_WindowData *focuseddata = focused->driverdata; + + /* This popup may be a child of another popup! */ + data->shell_surface.xdg.roleobj.popup.parentID = SDL_GetWindowID(focused); + data->shell_surface.xdg.roleobj.popup.child = NULL; + if (WINDOW_IS_XDG_POPUP(focused)) { + SDL_assert(focuseddata->shell_surface.xdg.roleobj.popup.child == NULL); + focuseddata->shell_surface.xdg.roleobj.popup.child = window; + } + + /* Set up the positioner for the popup */ + data->shell_surface.xdg.roleobj.popup.positioner = xdg_wm_base_create_positioner(c->shell.xdg); + xdg_positioner_set_offset(data->shell_surface.xdg.roleobj.popup.positioner, + mouse->x + TOOLTIP_CURSOR_OFFSET, + mouse->y + TOOLTIP_CURSOR_OFFSET); + + /* Assign the popup role */ + data->shell_surface.xdg.roleobj.popup.popup = xdg_surface_get_popup(data->shell_surface.xdg.surface, + focuseddata->shell_surface.xdg.surface, + data->shell_surface.xdg.roleobj.popup.positioner); + xdg_popup_add_listener(data->shell_surface.xdg.roleobj.popup.popup, &popup_listener_xdg, data); + + /* For tooltips, track mouse motion so it follows the cursor */ + if (window->flags & SDL_WINDOW_TOOLTIP) { + if (xdg_popup_get_version(data->shell_surface.xdg.roleobj.popup.popup) >= 3) { + SDL_AddEventWatch(Wayland_PopupWatch, window); + } + } + } else { + data->shell_surface.xdg.roleobj.toplevel = xdg_surface_get_toplevel(data->shell_surface.xdg.surface); + xdg_toplevel_set_app_id(data->shell_surface.xdg.roleobj.toplevel, c->classname); + xdg_toplevel_add_listener(data->shell_surface.xdg.roleobj.toplevel, &toplevel_listener_xdg, data); + } } /* Restore state that was set prior to this call */ @@ -758,13 +1286,12 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window) if (window->flags & SDL_WINDOW_MINIMIZED) { Wayland_MinimizeWindow(_this, window); } - Wayland_SetWindowFullscreen(_this, window, display, (window->flags & SDL_WINDOW_FULLSCREEN) != 0); /* We have to wait until the surface gets a "configure" event, or use of * this surface will fail. This is a new rule for xdg_shell. */ #ifdef HAVE_LIBDECOR_H - if (c->shell.libdecor) { + if (WINDOW_IS_LIBDECOR(c, window)) { if (data->shell_surface.libdecor.frame) { while (!data->shell_surface.libdecor.initial_configure_seen) { WAYLAND_wl_display_flush(c->display); @@ -774,6 +1301,12 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window) } else #endif if (c->shell.xdg) { + /* Unlike libdecor we need to call this explicitly to prevent a deadlock. + * 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); if (data->shell_surface.xdg.surface) { while (!data->shell_surface.xdg.initial_configure_seen) { WAYLAND_wl_display_flush(c->display); @@ -782,9 +1315,15 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window) } /* Create the window decorations */ - if (data->shell_surface.xdg.roleobj.toplevel && c->decoration_manager) { + 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. */ + wl_surface_commit(data->surface); } /* Unlike the rest of window state we have to set this _after_ flushing the @@ -792,11 +1331,11 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window) * them immediately afterward. */ #ifdef HAVE_LIBDECOR_H - if (c->shell.libdecor) { + if (WINDOW_IS_LIBDECOR(c, window)) { /* ... but don't call it redundantly for libdecor, the decorator * may not interpret a redundant call nicely and cause weird stuff to happen */ - if (window->flags & SDL_WINDOW_BORDERLESS) { + if (data->shell_surface.libdecor.frame && window->flags & SDL_WINDOW_BORDERLESS) { Wayland_SetWindowBordered(_this, window, SDL_FALSE); } } else @@ -822,6 +1361,42 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window) } } +static void +Wayland_ReleasePopup(_THIS, SDL_Window *popup) +{ + SDL_WindowData *popupdata; + + /* Basic sanity checks to weed out the weird popup closures */ + if (popup == NULL || popup->magic != &_this->window_magic) { + return; + } + popupdata = popup->driverdata; + if (popupdata == NULL) { + return; + } + + /* This may already be freed by a parent popup! */ + if (popupdata->shell_surface.xdg.roleobj.popup.popup == NULL) { + return; + } + + /* Release the child _first_, otherwise a protocol error triggers */ + if (popupdata->shell_surface.xdg.roleobj.popup.child != NULL) { + Wayland_ReleasePopup(_this, popupdata->shell_surface.xdg.roleobj.popup.child); + popupdata->shell_surface.xdg.roleobj.popup.child = NULL; + } + + if (popup->flags & SDL_WINDOW_TOOLTIP) { + if (xdg_popup_get_version(popupdata->shell_surface.xdg.roleobj.popup.popup) >= 3) { + SDL_DelEventWatch(Wayland_PopupWatch, popup); + } + } + xdg_popup_destroy(popupdata->shell_surface.xdg.roleobj.popup.popup); + xdg_positioner_destroy(popupdata->shell_surface.xdg.roleobj.popup.positioner); + popupdata->shell_surface.xdg.roleobj.popup.popup = NULL; + popupdata->shell_surface.xdg.roleobj.popup.positioner = NULL; +} + void Wayland_HideWindow(_THIS, SDL_Window *window) { SDL_VideoData *data = _this->driverdata; @@ -833,7 +1408,7 @@ void Wayland_HideWindow(_THIS, SDL_Window *window) } #ifdef HAVE_LIBDECOR_H - if (data->shell.libdecor) { + 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; @@ -841,7 +1416,9 @@ void Wayland_HideWindow(_THIS, SDL_Window *window) } else #endif if (data->shell.xdg) { - if (wind->shell_surface.xdg.roleobj.toplevel) { + if (WINDOW_IS_XDG_POPUP(window)) { + Wayland_ReleasePopup(_this, window); + } else if (wind->shell_surface.xdg.roleobj.toplevel) { xdg_toplevel_destroy(wind->shell_surface.xdg.roleobj.toplevel); wind->shell_surface.xdg.roleobj.toplevel = NULL; } @@ -850,6 +1427,10 @@ void Wayland_HideWindow(_THIS, SDL_Window *window) wind->shell_surface.xdg.surface = 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); } static void @@ -1043,7 +1624,7 @@ Wayland_SetWindowFullscreen(_THIS, SDL_Window * window, { struct wl_output *output = ((SDL_WaylandOutputData*) _display->driverdata)->output; SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata; - SetFullscreen(window, fullscreen ? output : NULL); + SetFullscreen(window, fullscreen ? output : NULL, SDL_TRUE); WAYLAND_wl_display_flush(viddata->display); } @@ -1054,13 +1635,17 @@ Wayland_RestoreWindow(_THIS, SDL_Window * window) SDL_WindowData *wind = window->driverdata; SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata; + if (WINDOW_IS_XDG_POPUP(window)) { + return; + } + /* Set this flag now even if we never actually maximized, eventually * ShowWindow will take care of it along with the other window state. */ window->flags &= ~SDL_WINDOW_MAXIMIZED; #ifdef HAVE_LIBDECOR_H - if (viddata->shell.libdecor) { + if (WINDOW_IS_LIBDECOR(viddata, window)) { if (wind->shell_surface.libdecor.frame == NULL) { return; /* Can't do anything yet, wait for ShowWindow */ } @@ -1083,8 +1668,13 @@ Wayland_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered) { SDL_WindowData *wind = window->driverdata; const SDL_VideoData *viddata = (const SDL_VideoData *) _this->driverdata; + + if (WINDOW_IS_XDG_POPUP(window)) { + return; + } + #ifdef HAVE_LIBDECOR_H - if (viddata->shell.libdecor) { + if (WINDOW_IS_LIBDECOR(viddata, window)) { if (wind->shell_surface.libdecor.frame) { libdecor_frame_set_visibility(wind->shell_surface.libdecor.frame, bordered); } @@ -1100,10 +1690,9 @@ void 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 (data->shell.libdecor) { + if (WINDOW_IS_LIBDECOR(data, window)) { if (wind->shell_surface.libdecor.frame == NULL) { return; /* Can't do anything yet, wait for ShowWindow */ } @@ -1115,7 +1704,7 @@ Wayland_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable) } else #endif { - CommitMinMaxDimensions(window); + SetMinMaxDimensions(window, SDL_TRUE); } } @@ -1125,6 +1714,10 @@ Wayland_MaximizeWindow(_THIS, SDL_Window * window) SDL_WindowData *wind = window->driverdata; SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata; + if (WINDOW_IS_XDG_POPUP(window)) { + return; + } + if (!(window->flags & SDL_WINDOW_RESIZABLE)) { return; } @@ -1135,7 +1728,7 @@ Wayland_MaximizeWindow(_THIS, SDL_Window * window) window->flags |= SDL_WINDOW_MAXIMIZED; #ifdef HAVE_LIBDECOR_H - if (viddata->shell.libdecor) { + if (WINDOW_IS_LIBDECOR(viddata, window)) { if (wind->shell_surface.libdecor.frame == NULL) { return; /* Can't do anything yet, wait for ShowWindow */ } @@ -1158,8 +1751,12 @@ Wayland_MinimizeWindow(_THIS, SDL_Window * window) SDL_WindowData *wind = window->driverdata; SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata; + if (WINDOW_IS_XDG_POPUP(window)) { + return; + } + #ifdef HAVE_LIBDECOR_H - if (viddata->shell.libdecor) { + if (WINDOW_IS_LIBDECOR(viddata, window)) { if (wind->shell_surface.libdecor.frame == NULL) { return; /* Can't do anything yet, wait for ShowWindow */ } @@ -1250,15 +1847,15 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window) data->waylandData = c; data->sdlwindow = window; - data->scale_factor = 1.0; + data->scale_factor = 1.0f; + data->pointer_scale_x = 1.0f; + data->pointer_scale_y = 1.0f; if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { 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); } } @@ -1280,13 +1877,17 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window) * 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( @@ -1297,16 +1898,20 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window) } #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ - if (window->flags & SDL_WINDOW_OPENGL) { - data->egl_window = WAYLAND_wl_egl_window_create(data->surface, - window->w * data->scale_factor, 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); + +#if SDL_VIDEO_OPENGL_EGL /* Create the GLES window surface */ data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) data->egl_window); if (data->egl_surface == EGL_NO_SURFACE) { - return SDL_SetError("failed to create an EGL window surface"); + return -1; /* SDL_EGL_CreateSurface should have set error */ } +#endif } #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH @@ -1317,21 +1922,39 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window) } #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); } - wl_surface_commit(data->surface); + /* Moved this call to ShowWindow: wl_surface_commit(data->surface); */ WAYLAND_wl_display_flush(c->display); /* 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; } @@ -1342,80 +1965,74 @@ Wayland_HandleResize(SDL_Window *window, int width, int height, float scale) SDL_WindowData *data = (SDL_WindowData *) window->driverdata; SDL_VideoData *viddata = data->waylandData; - struct wl_region *region; - window->w = 0; - window->h = 0; - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, width, height); - window->w = width; - window->h = height; - data->scale_factor = scale; - - wl_surface_set_buffer_scale(data->surface, data->scale_factor); - - if (data->egl_window) { - WAYLAND_wl_egl_window_resize(data->egl_window, - window->w * data->scale_factor, - window->h * data->scale_factor, - 0, 0); + if (data->needs_resize_event || window->w != width || window->h != height || !FloatEqual(data->scale_factor, 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; + window->h = 0; + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, width, height); + window->w = width; + window->h = height; + data->scale_factor = scale; + data->needs_resize_event = SDL_FALSE; } - 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); + /* Update the window geometry. */ + ConfigureWindowGeometry(window); /* 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, * but at least lets us not be terminated by the compositor. * Can be removed once SDL's resize logic becomes compliant. */ - if (viddata->shell.xdg && data->shell_surface.xdg.surface) { - xdg_surface_set_window_geometry(data->shell_surface.xdg.surface, 0, 0, window->w, window->h); + if ( +#ifdef HAVE_LIBDECOR_H + !WINDOW_IS_LIBDECOR(viddata, window) && +#endif + viddata->shell.xdg && + data->shell_surface.xdg.surface) { + xdg_surface_set_window_geometry(data->shell_surface.xdg.surface, 0, 0, + GetWindowWidth(window), GetWindowHeight(window)); } } void Wayland_SetWindowMinimumSize(_THIS, SDL_Window * window) { - CommitMinMaxDimensions(window); + SetMinMaxDimensions(window, SDL_TRUE); } void Wayland_SetWindowMaximumSize(_THIS, SDL_Window * window) { - CommitMinMaxDimensions(window); + SetMinMaxDimensions(window, SDL_TRUE); } void Wayland_SetWindowSize(_THIS, SDL_Window * window) { SDL_VideoData *data = _this->driverdata; SDL_WindowData *wind = window->driverdata; - struct wl_region *region; #ifdef HAVE_LIBDECOR_H struct libdecor_state *state; #endif #ifdef HAVE_LIBDECOR_H /* we must not resize the window while we have a static (non-floating) size */ - if (data->shell.libdecor && + if (WINDOW_IS_LIBDECOR(data, window) && wind->shell_surface.libdecor.frame && !libdecor_frame_is_floating(wind->shell_surface.libdecor.frame)) { + /* Commit the resize when we re-enter floating state */ + wind->floating_resize_pending = SDL_TRUE; return; } #endif - wl_surface_set_buffer_scale(wind->surface, wind->scale_factor); - - if (wind->egl_window) { - WAYLAND_wl_egl_window_resize(wind->egl_window, - window->w * wind->scale_factor, - window->h * wind->scale_factor, - 0, 0); - } + /* Update the window geometry. */ + ConfigureWindowGeometry(window); #ifdef HAVE_LIBDECOR_H - if (data->shell.libdecor && wind->shell_surface.libdecor.frame) { - state = libdecor_state_new(window->w, window->h); + if (WINDOW_IS_LIBDECOR(data, window) && wind->shell_surface.libdecor.frame) { + state = libdecor_state_new(GetWindowWidth(window), GetWindowHeight(window)); libdecor_frame_commit(wind->shell_surface.libdecor.frame, state, NULL); libdecor_state_free(state); } @@ -1425,14 +2042,15 @@ void Wayland_SetWindowSize(_THIS, SDL_Window * window) 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 (data->shell.xdg && wind->shell_surface.xdg.surface) { - xdg_surface_set_window_geometry(wind->shell_surface.xdg.surface, 0, 0, window->w, window->h); + if ( +#ifdef HAVE_LIBDECOR_H + !WINDOW_IS_LIBDECOR(data, window) && +#endif + data->shell.xdg && + wind->shell_surface.xdg.surface) { + xdg_surface_set_window_geometry(wind->shell_surface.xdg.surface, 0, 0, + GetWindowWidth(window), GetWindowHeight(window)); } } @@ -1441,9 +2059,13 @@ void Wayland_SetWindowTitle(_THIS, SDL_Window * window) SDL_WindowData *wind = window->driverdata; SDL_VideoData *viddata = _this->driverdata; + if (WINDOW_IS_XDG_POPUP(window)) { + return; + } + if (window->title != NULL) { #ifdef HAVE_LIBDECOR_H - if (viddata->shell.libdecor) { + if (WINDOW_IS_LIBDECOR(viddata, window)) { if (wind->shell_surface.libdecor.frame == NULL) { return; /* Can't do anything yet, wait for ShowWindow */ } @@ -1505,9 +2127,11 @@ void Wayland_DestroyWindow(_THIS, SDL_Window *window) SDL_WindowData *wind = window->driverdata; if (data) { +#if SDL_VIDEO_OPENGL_EGL if (wind->egl_surface) { SDL_EGL_DestroySurface(_this, wind->egl_surface); } +#endif if (wind->egl_window) { WAYLAND_wl_egl_window_destroy(wind->egl_window); } @@ -1520,12 +2144,20 @@ void Wayland_DestroyWindow(_THIS, SDL_Window *window) xdg_activation_token_v1_destroy(wind->activation_token); } + 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 @@ -1543,6 +2175,6 @@ void Wayland_DestroyWindow(_THIS, SDL_Window *window) window->driverdata = NULL; } -#endif /* SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL */ +#endif /* SDL_VIDEO_DRIVER_WAYLAND */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/src/video/wayland/SDL_waylandwindow.h b/libs/SDL2/src/video/wayland/SDL_waylandwindow.h index 8ca090f0..703ec53d 100644 --- a/libs/SDL2/src/video/wayland/SDL_waylandwindow.h +++ b/libs/SDL2/src/video/wayland/SDL_waylandwindow.h @@ -32,44 +32,61 @@ struct SDL_WaylandInput; -typedef struct { - struct xdg_surface *surface; - union { - struct xdg_toplevel *toplevel; - struct xdg_popup *popup; - } roleobj; - SDL_bool initial_configure_seen; -} SDL_xdg_shell_surface; - -#ifdef HAVE_LIBDECOR_H -typedef struct { - struct libdecor_frame *frame; - SDL_bool initial_configure_seen; -} SDL_libdecor_surface; -#endif +/* TODO: Remove these helpers, they're from before we had shell_surface_type */ +#define WINDOW_IS_XDG_POPUP(window) \ + (((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 EGLSurface egl_surface; +#endif struct zwp_locked_pointer_v1 *locked_pointer; struct zwp_confined_pointer_v1 *confined_pointer; struct zxdg_toplevel_decoration_v1 *server_decoration; 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 *draw_viewport; /* floating dimensions for restoring from maximized and fullscreen */ int floating_width, floating_height; @@ -84,6 +101,12 @@ typedef struct { int num_outputs; float scale_factor; + float pointer_scale_x; + float pointer_scale_y; + int drawable_width, drawable_height; + SDL_Rect viewport_rect; + SDL_bool needs_resize_event; + SDL_bool floating_resize_pending; } SDL_WindowData; extern void Wayland_ShowWindow(_THIS, SDL_Window *window); diff --git a/libs/SDL2/src/video/windows/SDL_windowsclipboard.c b/libs/SDL2/src/video/windows/SDL_windowsclipboard.c index 09f33e25..e961a2be 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsclipboard.c +++ b/libs/SDL2/src/video/windows/SDL_windowsclipboard.c @@ -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 --git a/libs/SDL2/src/video/windows/SDL_windowsevents.c b/libs/SDL2/src/video/windows/SDL_windowsevents.c index 471bbee8..d2f62a7b 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsevents.c +++ b/libs/SDL2/src/video/windows/SDL_windowsevents.c @@ -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 @@ -40,12 +42,23 @@ /* For GET_X_LPARAM, GET_Y_LPARAM. */ #include +/* For WM_TABLET_QUERYSYSTEMGESTURESTATUS et. al. */ +#if HAVE_TPCSHRD_H +#include +#endif /* HAVE_TPCSHRD_H */ + /* #define WMMSG_DEBUG */ #ifdef WMMSG_DEBUG #include #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) @@ -80,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)) @@ -246,6 +265,7 @@ WindowsScanCodeToSDLScanCode(LPARAM lParam, WPARAM wParam) return code; } +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) static SDL_bool WIN_ShouldIgnoreFocusClick() { @@ -369,18 +389,18 @@ WIN_CheckAsyncMouseRelease(SDL_WindowData *data) if (!(keyState & 0x8000)) { WIN_CheckWParamMouseButton(SDL_FALSE, mouseFlags, swapButtons, data, SDL_BUTTON_X2, 0); } - data->mouse_button_flags = 0; + data->mouse_button_flags = (WPARAM)-1; } static void -WIN_UpdateFocus(SDL_Window *window) +WIN_UpdateFocus(SDL_Window *window, SDL_bool expect_focus) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; HWND hwnd = data->hwnd; SDL_bool had_focus = (SDL_GetKeyboardFocus() == window) ? SDL_TRUE : SDL_FALSE; SDL_bool has_focus = (GetForegroundWindow() == hwnd) ? SDL_TRUE : SDL_FALSE; - if (had_focus == has_focus) { + if (had_focus == has_focus || has_focus != expect_focus) { return; } @@ -441,6 +461,7 @@ WIN_UpdateFocus(SDL_Window *window) data->in_window_deactivation = SDL_FALSE; } } +#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ static BOOL WIN_ConvertUTF32toUTF8(UINT32 codepoint, char * text) @@ -483,6 +504,7 @@ ShouldGenerateWindowCloseOnAltF4(void) 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 @@ -513,6 +535,7 @@ static SDL_MOUSE_EVENT_SOURCE GetMouseMessageSource() } return SDL_MOUSE_EVENT_SOURCE_MOUSE; } +#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ static SDL_WindowData * WIN_GetWindowDataFromHWND(HWND hwnd) @@ -531,6 +554,7 @@ WIN_GetWindowDataFromHWND(HWND hwnd) return NULL; } +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) LRESULT CALLBACK WIN_KeyboardHookProc(int nCode, WPARAM wParam, LPARAM lParam) { @@ -616,6 +640,7 @@ static void WIN_CheckICMProfileChanged(SDL_Window* window) } } } +#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) @@ -638,10 +663,12 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) /* 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); } @@ -658,8 +685,10 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } #endif /* WMMSG_DEBUG */ +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) if (IME_HandleMessage(hwnd, msg, wParam, &lParam, data->videodata)) return 0; +#endif switch (msg) { @@ -673,6 +702,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } break; +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) case WM_NCACTIVATE: { /* Don't immediately clip the cursor in case we're clicking minimize/maximize buttons */ @@ -681,7 +711,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) /* Update the focus here, since it's possible to get WM_ACTIVATE and WM_SETFOCUS without 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); + WIN_UpdateFocus(data->window, !!wParam); WIN_CheckICMProfileChanged(data->window); } break; @@ -689,16 +719,22 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_ACTIVATE: { /* Update the focus in case we changed focus to a child window and then away from the application */ - WIN_UpdateFocus(data->window); + WIN_UpdateFocus(data->window, !!LOWORD(wParam)); } break; case WM_SETFOCUS: + { + /* Update the focus in case it's changing between top-level windows in the same application */ + WIN_UpdateFocus(data->window, SDL_TRUE); + } + break; + case WM_KILLFOCUS: case WM_ENTERIDLE: { /* Update the focus in case it's changing between top-level windows in the same application */ - WIN_UpdateFocus(data->window); + WIN_UpdateFocus(data->window, SDL_FALSE); } break; @@ -728,12 +764,17 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) /* 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); } } } - /* don't break here, fall through to check the wParam like the button presses */ - SDL_FALLTHROUGH; + break; + case WM_LBUTTONUP: case WM_RBUTTONUP: case WM_MBUTTONUP: @@ -911,6 +952,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) returnCode = 0; break; +#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ case WM_KEYDOWN: case WM_SYSKEYDOWN: @@ -992,6 +1034,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) returnCode = 0; break; +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #ifdef WM_INPUTLANGCHANGE case WM_INPUTLANGCHANGE: { @@ -1047,6 +1090,12 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) 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; @@ -1067,14 +1116,25 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) 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 */ @@ -1136,12 +1196,23 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) 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); @@ -1162,10 +1233,12 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MINIMIZED, 0, 0); break; - default: + case SIZE_RESTORED: SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESTORED, 0, 0); break; + default: + break; } } break; @@ -1285,6 +1358,25 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } break; +#if HAVE_TPCSHRD_H + + case WM_TABLET_QUERYSYSTEMGESTURESTATUS: + /* See https://msdn.microsoft.com/en-us/library/windows/desktop/bb969148(v=vs.85).aspx . + * If we're handling our own touches, we don't want any gestures. + * Not all of these settings are documented. + * The use of the undocumented ones was suggested by https://github.com/bjarkeck/GCGJ/blob/master/Monogame/Windows/WinFormsGameForm.cs . */ + return TABLET_DISABLE_PRESSANDHOLD | /* disables press and hold (right-click) gesture */ + TABLET_DISABLE_PENTAPFEEDBACK | /* disables UI feedback on pen up (waves) */ + TABLET_DISABLE_PENBARRELFEEDBACK | /* disables UI feedback on pen button down (circle) */ + TABLET_DISABLE_TOUCHUIFORCEON | + TABLET_DISABLE_TOUCHUIFORCEOFF | + TABLET_DISABLE_TOUCHSWITCH | + TABLET_DISABLE_FLICKS | /* disables pen flicks (back, forward, drag down, drag up) */ + TABLET_DISABLE_SMOOTHSCROLLING | + TABLET_DISABLE_FLICKFALLBACKKEYS; + +#endif /* HAVE_TPCSHRD_H */ + case WM_DROPFILES: { UINT i; @@ -1326,6 +1418,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) 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; } @@ -1338,10 +1431,16 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { 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); @@ -1361,6 +1460,181 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } } 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. */ + 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 */ @@ -1373,6 +1647,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } } +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) static void WIN_UpdateClipCursorForWindows() { SDL_VideoDevice *_this = SDL_GetVideoDevice(); @@ -1419,6 +1694,7 @@ static void WIN_UpdateMouseCapture() } } } +#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ /* A message hook called before TranslateMessage() */ static SDL_WindowsMessageHook g_WindowsMessageHook = NULL; @@ -1476,11 +1752,13 @@ WIN_SendWakeupEvent(_THIS, SDL_Window *window) 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)) { @@ -1488,6 +1766,7 @@ WIN_PumpEvents(_THIS) 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))) { @@ -1497,6 +1776,7 @@ WIN_PumpEvents(_THIS) /* 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); @@ -1517,6 +1797,7 @@ WIN_PumpEvents(_THIS) } } +#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, @@ -1547,6 +1828,11 @@ WIN_PumpEvents(_THIS) /* Update mouse capture */ WIN_UpdateMouseCapture(); +#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ + +#ifdef __GDK__ + GDK_DispatchTaskQueue(); +#endif } @@ -1555,32 +1841,41 @@ LPTSTR SDL_Appname = NULL; Uint32 SDL_Appstyle = 0; HINSTANCE SDL_Instance = NULL; +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; +} + /* Register the class for this application */ 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) { ++app_registered; return (0); } - if (!name && !SDL_Appname) { + SDL_assert(SDL_Appname == NULL); + if (!name) { name = "SDL_app"; #if defined(CS_BYTEALIGNCLIENT) || defined(CS_OWNDC) - SDL_Appstyle = (CS_BYTEALIGNCLIENT | CS_OWNDC); + style = (CS_BYTEALIGNCLIENT | CS_OWNDC); #endif - SDL_Instance = hInst ? hInst : GetModuleHandle(NULL); - } - - if (name) { - SDL_Appname = WIN_UTF8ToString(name); - SDL_Appstyle = style; - SDL_Instance = hInst ? hInst : GetModuleHandle(NULL); } + SDL_Appname = WIN_UTF8ToString(name); + SDL_Appstyle = style; + SDL_Instance = hInst ? hInst : GetModuleHandle(NULL); /* Register the application class */ wcex.cbSize = sizeof(WNDCLASSEX); @@ -1596,6 +1891,7 @@ SDL_RegisterApp(const char *name, Uint32 style, void *hInst) 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))); @@ -1609,8 +1905,10 @@ SDL_RegisterApp(const char *name, Uint32 style, void *hInst) 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); return SDL_SetError("Couldn't register application class"); } @@ -1630,14 +1928,16 @@ SDL_UnregisterApp() } --app_registered; if (app_registered == 0) { + /* Ensure the icons are initialized. */ + 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); - if (wcex.hIcon) DestroyIcon(wcex.hIcon); - if (wcex.hIconSm) DestroyIcon(wcex.hIconSm); } - SDL_free(SDL_Appname); - SDL_Appname = NULL; +#endif + WIN_CleanRegisterApp(wcex); } } diff --git a/libs/SDL2/src/video/windows/SDL_windowsframebuffer.c b/libs/SDL2/src/video/windows/SDL_windowsframebuffer.c index f41f9c09..4076e6f5 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsframebuffer.c +++ b/libs/SDL2/src/video/windows/SDL_windowsframebuffer.c @@ -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 --git a/libs/SDL2/src/video/windows/SDL_windowskeyboard.c b/libs/SDL2/src/video/windows/SDL_windowskeyboard.c index 92903251..e447a4a5 100644 --- a/libs/SDL2/src/video/windows/SDL_windowskeyboard.c +++ b/libs/SDL2/src/video/windows/SDL_windowskeyboard.c @@ -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" @@ -36,6 +36,8 @@ static void IME_Init(SDL_VideoData *videodata, HWND hwnd); static void IME_Enable(SDL_VideoData *videodata, HWND hwnd); static void IME_Disable(SDL_VideoData *videodata, HWND hwnd); static void IME_Quit(SDL_VideoData *videodata); +static void IME_ClearComposition(SDL_VideoData *videodata); +static SDL_bool IME_IsTextInputShown(SDL_VideoData* videodata); #endif /* !SDL_DISABLE_WINDOWS_IME */ #ifndef MAPVK_VK_TO_VSC @@ -62,12 +64,14 @@ WIN_InitKeyboard(_THIS) data->ime_hwnd_main = 0; 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 + sizeof(WCHAR)); data->ime_composition[0] = 0; data->ime_readingstring[0] = 0; data->ime_cursor = 0; data->ime_candlist = SDL_FALSE; - SDL_memset(data->ime_candidates, 0, sizeof(data->ime_candidates)); + data->ime_candidates = NULL; data->ime_candcount = 0; data->ime_candref = 0; data->ime_candsel = 0; @@ -272,14 +276,17 @@ WIN_SetTextInputRect(_THIS, SDL_Rect *rect) } } -static SDL_bool -WIN_ShouldShowNativeUI() -{ - return SDL_GetHintBoolean(SDL_HINT_IME_SHOW_UI, SDL_FALSE); -} #ifdef SDL_DISABLE_WINDOWS_IME +void WIN_ClearComposition(_THIS) +{ +} + +SDL_bool WIN_IsTextInputShown(_THIS) +{ + return SDL_FALSE; +} SDL_bool IME_HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, SDL_VideoData *videodata) @@ -349,6 +356,7 @@ DEFINE_GUID(IID_ITfThreadMgrEx, 0x3E90ADE3,0x7594 #define SUBLANG() SUBLANGID(LANG()) static void IME_UpdateInputLocale(SDL_VideoData *videodata); +static int IME_ShowCandidateList(SDL_VideoData *videodata); static void IME_ClearComposition(SDL_VideoData *videodata); static void IME_SetWindow(SDL_VideoData* videodata, HWND hwnd); static void IME_SetupAPI(SDL_VideoData *videodata); @@ -361,6 +369,12 @@ static void UILess_ReleaseSinks(SDL_VideoData *videodata); static void UILess_EnableUIUpdates(SDL_VideoData *videodata); static void UILess_DisableUIUpdates(SDL_VideoData *videodata); +static SDL_bool +WIN_ShouldShowNativeUI() +{ + return SDL_GetHintBoolean(SDL_HINT_IME_SHOW_UI, SDL_FALSE); +} + static void IME_Init(SDL_VideoData *videodata, HWND hwnd) { @@ -587,16 +601,16 @@ IME_GetId(SDL_VideoData *videodata, UINT uIndex) char szTemp[256]; HKL hkl = 0; DWORD dwLang = 0; - if (uIndex >= sizeof(dwRet) / sizeof(dwRet[0])) - return 0; + SDL_assert(uIndex < sizeof(dwRet) / sizeof(dwRet[0])); hkl = videodata->ime_hkl; if (hklprev == hkl) return dwRet[uIndex]; - hklprev = hkl; + + SDL_assert(uIndex == 0); dwLang = ((DWORD_PTR)hkl & 0xffff); - if (videodata->ime_uiless && LANG() == LANG_CHT) { + if (videodata->ime_uiless && dwLang == LANG_CHT) { dwRet[0] = IMEID_CHT_VER_VISTA; dwRet[1] = 0; return dwRet[0]; @@ -607,11 +621,11 @@ IME_GetId(SDL_VideoData *videodata, UINT uIndex) && hkl != CHT_HKL_HK_CANTONESE && hkl != CHS_HKL) { dwRet[0] = dwRet[1] = 0; - return dwRet[uIndex]; + 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[uIndex]; + return dwRet[0]; } if (!videodata->GetReadingString) { #define LCID_INVARIANT MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) @@ -621,7 +635,7 @@ IME_GetId(SDL_VideoData *videodata, UINT uIndex) && CompareStringA(LCID_INVARIANT, NORM_IGNORECASE, szTemp, -1, CHS_IMEFILENAME1, -1) != 2 && CompareStringA(LCID_INVARIANT, NORM_IGNORECASE, szTemp, -1, CHS_IMEFILENAME2, -1) != 2) { dwRet[0] = dwRet[1] = 0; - return dwRet[uIndex]; + return dwRet[0]; } #undef LCID_INVARIANT dwVerSize = GetFileVersionInfoSizeA(szTemp, &dwVerHandle); @@ -660,7 +674,7 @@ IME_GetId(SDL_VideoData *videodata, UINT uIndex) } } dwRet[0] = dwRet[1] = 0; - return dwRet[uIndex]; + return dwRet[0]; } static void @@ -675,7 +689,7 @@ IME_SetupAPI(SDL_VideoData *videodata) 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); @@ -712,26 +726,13 @@ IME_SetWindow(SDL_VideoData* videodata, HWND hwnd) static void IME_UpdateInputLocale(SDL_VideoData *videodata) { - static HKL hklprev = 0; - videodata->ime_hkl = GetKeyboardLayout(0); - if (hklprev == videodata->ime_hkl) + HKL hklnext = GetKeyboardLayout(0); + + if (hklnext == videodata->ime_hkl) return; - hklprev = videodata->ime_hkl; - switch (PRIMLANG()) { - case LANG_CHINESE: - videodata->ime_candvertical = SDL_TRUE; - if (SUBLANG() == SUBLANG_CHINESE_SIMPLIFIED) - videodata->ime_candvertical = SDL_FALSE; - - break; - case LANG_JAPANESE: - videodata->ime_candvertical = SDL_TRUE; - break; - case LANG_KOREAN: - videodata->ime_candvertical = SDL_FALSE; - break; - } + videodata->ime_hkl = hklnext; + videodata->ime_candvertical = (PRIMLANG() == LANG_KOREAN || LANG() == LANG_CHS) ? SDL_FALSE : SDL_TRUE; } static void @@ -754,18 +755,48 @@ IME_ClearComposition(SDL_VideoData *videodata) SDL_SendEditingText("", 0, 0); } +static SDL_bool +IME_IsTextInputShown(SDL_VideoData* videodata) +{ + if (!videodata->ime_initialized || !videodata->ime_available || !videodata->ime_enabled) + return SDL_FALSE; + + return videodata->ime_uicontext != 0 ? SDL_TRUE : SDL_FALSE; +} + static void IME_GetCompositionString(SDL_VideoData *videodata, HIMC himc, DWORD string) { - LONG length = ImmGetCompositionStringW(himc, string, videodata->ime_composition, sizeof(videodata->ime_composition) - sizeof(videodata->ime_composition[0])); + LONG length; + DWORD dwLang = ((DWORD_PTR)videodata->ime_hkl & 0xffff); + + length = ImmGetCompositionStringW(himc, string, NULL, 0); + if (length > 0 && videodata->ime_composition_length < length) { + if (videodata->ime_composition != NULL) + SDL_free(videodata->ime_composition); + + videodata->ime_composition = (WCHAR*)SDL_malloc(length + sizeof(WCHAR)); + videodata->ime_composition_length = length; + } + + length = ImmGetCompositionStringW( + himc, + string, + videodata->ime_composition, + videodata->ime_composition_length + ); + if (length < 0) length = 0; - length /= sizeof(videodata->ime_composition[0]); + length /= sizeof(WCHAR); videodata->ime_cursor = LOWORD(ImmGetCompositionStringW(himc, GCS_CURSORPOS, 0, 0)); - if (videodata->ime_cursor > 0 && - videodata->ime_cursor < SDL_arraysize(videodata->ime_composition) && - videodata->ime_composition[videodata->ime_cursor] == 0x3000) { + if ((dwLang == LANG_CHT || dwLang == LANG_CHS) && + videodata->ime_cursor > 0 && + videodata->ime_cursor < (int)(videodata->ime_composition_length / sizeof(WCHAR)) && + (videodata->ime_composition[0] == 0x3000 || videodata->ime_composition[0] == 0x0020)) { + // Traditional Chinese IMEs add a placeholder U+3000 + // Simplified Chinese IMEs seem to add a placeholder U+0020 sometimes int i; for (i = videodata->ime_cursor + 1; i < length; ++i) videodata->ime_composition[i - 1] = videodata->ime_composition[i]; @@ -774,6 +805,39 @@ IME_GetCompositionString(SDL_VideoData *videodata, HIMC himc, DWORD string) } videodata->ime_composition[length] = 0; + + // Get the correct caret position if we've selected a candidate from the candidate window + if (videodata->ime_cursor == 0 && length > 0) { + Sint32 start = 0; + Sint32 end = 0; + + length = ImmGetCompositionStringW(himc, GCS_COMPATTR, NULL, 0); + if (length > 0) { + Uint8* attributes = (Uint8*)SDL_malloc(length + sizeof(WCHAR)); + ImmGetCompositionString(himc, GCS_COMPATTR, attributes, length); + + for (start = 0; start < length; ++start) { + if (attributes[start] == ATTR_TARGET_CONVERTED || + attributes[start] == ATTR_TARGET_NOTCONVERTED) + break; + } + + for (end = start; end < length; ++end) { + if (attributes[end] != ATTR_TARGET_CONVERTED && + attributes[end] != ATTR_TARGET_NOTCONVERTED) + break; + } + + if (start == length) { + start = 0; + end = length; + } + + SDL_free(attributes); + } + + videodata->ime_cursor = end; + } } static void @@ -792,48 +856,66 @@ IME_SendInputEvent(SDL_VideoData *videodata) static void IME_SendEditingEvent(SDL_VideoData *videodata) { - char *s = 0; - WCHAR buffer[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; - const size_t size = SDL_arraysize(buffer); - buffer[0] = 0; + char *s = NULL; + WCHAR *buffer = NULL; + size_t size = videodata->ime_composition_length; if (videodata->ime_readingstring[0]) { 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 + sizeof(WCHAR)); + buffer[0] = 0; + SDL_wcslcpy(buffer, videodata->ime_composition, len + 1); SDL_wcslcat(buffer, videodata->ime_readingstring, size); SDL_wcslcat(buffer, &videodata->ime_composition[len], size); } else { + buffer = (WCHAR*)SDL_malloc(size + sizeof(WCHAR)); + buffer[0] = 0; SDL_wcslcpy(buffer, videodata->ime_composition, size); } + s = WIN_StringToUTF8W(buffer); SDL_SendEditingText(s, videodata->ime_cursor + (int)SDL_wcslen(videodata->ime_readingstring), 0); SDL_free(s); + SDL_free(buffer); } static void IME_AddCandidate(SDL_VideoData *videodata, UINT i, LPCWSTR candidate) { - LPWSTR dst = videodata->ime_candidates[i]; + LPWSTR dst = &videodata->ime_candidates[i * MAX_CANDLENGTH]; + LPWSTR end = &dst[MAX_CANDLENGTH - 1]; + SDL_COMPILE_TIME_ASSERT(IME_CANDIDATE_INDEXING_REQUIRES, MAX_CANDLIST == 10); *dst++ = (WCHAR)(TEXT('0') + ((i + videodata->ime_candlistindexbase) % 10)); if (videodata->ime_candvertical) *dst++ = TEXT(' '); - while (*candidate && (SDL_arraysize(videodata->ime_candidates[i]) > (dst - videodata->ime_candidates[i]))) + while (*candidate && dst < end) *dst++ = *candidate++; *dst = (WCHAR)'\0'; } static void -IME_GetCandidateList(HIMC himc, SDL_VideoData *videodata) +IME_GetCandidateList(HWND hwnd, SDL_VideoData *videodata) { - LPCANDIDATELIST cand_list = 0; - DWORD size = ImmGetCandidateListW(himc, 0, 0, 0); - if (size) { + HIMC himc; + DWORD size; + LPCANDIDATELIST cand_list; + + if (IME_ShowCandidateList(videodata) < 0) + return; + himc = ImmGetContext(hwnd); + if (!himc) + return; + size = ImmGetCandidateListW(himc, 0, 0, 0); + if (size != 0) { cand_list = (LPCANDIDATELIST)SDL_malloc(size); - if (cand_list) { + if (cand_list != NULL) { size = ImmGetCandidateListW(himc, 0, cand_list, size); - if (size) { + if (size != 0) { UINT i, j; UINT page_start = 0; videodata->ime_candsel = cand_list->dwSelection; @@ -858,34 +940,44 @@ IME_GetCandidateList(HIMC himc, SDL_VideoData *videodata) } videodata->ime_candpgsize = i - page_start; } else { - videodata->ime_candpgsize = SDL_min(cand_list->dwPageSize, MAX_CANDLIST); - if (videodata->ime_candpgsize > 0) { - page_start = (cand_list->dwSelection / videodata->ime_candpgsize) * videodata->ime_candpgsize; - } else { - page_start = 0; - } + videodata->ime_candpgsize = SDL_min(cand_list->dwPageSize == 0 ? MAX_CANDLIST : cand_list->dwPageSize, MAX_CANDLIST); + page_start = (cand_list->dwSelection / videodata->ime_candpgsize) * videodata->ime_candpgsize; } - SDL_memset(&videodata->ime_candidates, 0, sizeof(videodata->ime_candidates)); - for (i = page_start, j = 0; (DWORD)i < cand_list->dwCount && j < (int)videodata->ime_candpgsize; i++, j++) { + for (i = page_start, j = 0; (DWORD)i < cand_list->dwCount && j < videodata->ime_candpgsize; i++, j++) { LPCWSTR candidate = (LPCWSTR)((DWORD_PTR)cand_list + cand_list->dwOffset[i]); IME_AddCandidate(videodata, j, candidate); } - if (PRIMLANG() == LANG_KOREAN || (PRIMLANG() == LANG_CHT && !IME_GetId(videodata, 0))) - videodata->ime_candsel = -1; + // TODO: why was this necessary? check ime_candvertical instead? PRIMLANG() never equals LANG_CHT ! + //if (PRIMLANG() == LANG_KOREAN || (PRIMLANG() == LANG_CHT && !IME_GetId(videodata, 0))) + // videodata->ime_candsel = -1; } SDL_free(cand_list); } } + ImmReleaseContext(hwnd, himc); } -static void +static int IME_ShowCandidateList(SDL_VideoData *videodata) { + void *candidates; + + videodata->ime_candcount = 0; + candidates = SDL_realloc(videodata->ime_candidates, MAX_CANDSIZE); + if (candidates != NULL) + videodata->ime_candidates = (WCHAR *)candidates; + + if (videodata->ime_candidates == NULL) + return -1; + + SDL_memset(videodata->ime_candidates, 0, MAX_CANDSIZE); + videodata->ime_dirty = SDL_TRUE; videodata->ime_candlist = SDL_TRUE; IME_DestroyTextures(videodata); IME_SendEditingEvent(videodata); + return 0; } static void @@ -906,6 +998,15 @@ IME_HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, SDL_VideoD return SDL_FALSE; switch (msg) { + case WM_KEYDOWN: + if (wParam == VK_PROCESSKEY) + { + videodata->ime_uicontext = 1; + trap = SDL_TRUE; + } + else + videodata->ime_uicontext = 0; + break; case WM_INPUTLANGCHANGE: IME_InputLangChanged(videodata); break; @@ -914,14 +1015,17 @@ IME_HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, SDL_VideoD *lParam = 0; } break; - case WM_IME_STARTCOMPOSITION: + case WM_IME_STARTCOMPOSITION: + videodata->ime_suppress_endcomposition_event = SDL_FALSE; trap = SDL_TRUE; break; case WM_IME_COMPOSITION: trap = SDL_TRUE; himc = ImmGetContext(hwnd); if (*lParam & GCS_RESULTSTR) { + videodata->ime_suppress_endcomposition_event = SDL_TRUE; IME_GetCompositionString(videodata, himc, GCS_RESULTSTR); + SDL_SendEditingText("", 0, 0); IME_SendInputEvent(videodata); } if (*lParam & GCS_COMPSTR) { @@ -934,10 +1038,13 @@ IME_HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, SDL_VideoD ImmReleaseContext(hwnd, himc); break; case WM_IME_ENDCOMPOSITION: + videodata->ime_uicontext = 0; videodata->ime_composition[0] = 0; videodata->ime_readingstring[0] = 0; videodata->ime_cursor = 0; - SDL_SendEditingText("", 0, 0); + if (videodata->ime_suppress_endcomposition_event == SDL_FALSE) + SDL_SendEditingText("", 0, 0); + videodata->ime_suppress_endcomposition_event = SDL_FALSE; break; case WM_IME_NOTIFY: switch (wParam) { @@ -951,16 +1058,12 @@ IME_HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, SDL_VideoD break; trap = SDL_TRUE; - IME_ShowCandidateList(videodata); - himc = ImmGetContext(hwnd); - if (!himc) - break; - - IME_GetCandidateList(himc, videodata); - ImmReleaseContext(hwnd, himc); + videodata->ime_uicontext = 1; + IME_GetCandidateList(hwnd, videodata); break; case IMN_CLOSECANDIDATE: trap = SDL_TRUE; + videodata->ime_uicontext = 0; IME_HideCandidateList(videodata); break; case IMN_PRIVATE: @@ -1007,7 +1110,8 @@ IME_CloseCandidateList(SDL_VideoData *videodata) { IME_HideCandidateList(videodata); videodata->ime_candcount = 0; - SDL_memset(videodata->ime_candidates, 0, sizeof(videodata->ime_candidates)); + SDL_free(videodata->ime_candidates); + videodata->ime_candidates = NULL; } static void @@ -1020,13 +1124,16 @@ UILess_GetCandidateList(SDL_VideoData *videodata, ITfCandidateListUIElement *pca DWORD pgstart = 0; DWORD pgsize = 0; UINT i, j; + + if (IME_ShowCandidateList(videodata) < 0) + return; + pcandlist->lpVtbl->GetSelection(pcandlist, &selection); pcandlist->lpVtbl->GetCount(pcandlist, &count); pcandlist->lpVtbl->GetCurrentPage(pcandlist, &page); videodata->ime_candsel = selection; videodata->ime_candcount = count; - IME_ShowCandidateList(videodata); pcandlist->lpVtbl->GetPageIndex(pcandlist, 0, 0, &pgcount); if (pgcount > 0) { @@ -1044,8 +1151,6 @@ UILess_GetCandidateList(SDL_VideoData *videodata, ITfCandidateListUIElement *pca } videodata->ime_candpgsize = SDL_min(pgsize, MAX_CANDLIST); videodata->ime_candsel = videodata->ime_candsel - pgstart; - - SDL_memset(videodata->ime_candidates, 0, sizeof(videodata->ime_candidates)); for (i = pgstart, j = 0; (DWORD)i < count && j < videodata->ime_candpgsize; i++, j++) { BSTR bstr; if (SUCCEEDED(pcandlist->lpVtbl->GetString(pcandlist, i, &bstr))) { @@ -1055,8 +1160,9 @@ UILess_GetCandidateList(SDL_VideoData *videodata, ITfCandidateListUIElement *pca } } } - if (PRIMLANG() == LANG_KOREAN) - videodata->ime_candsel = -1; + // TODO: why was this necessary? check ime_candvertical instead? + //if (PRIMLANG() == LANG_KOREAN) + // videodata->ime_candsel = -1; } STDMETHODIMP_(ULONG) TSFSink_AddRef(TSFSink *sink) @@ -1473,7 +1579,7 @@ IME_RenderCandidateList(SDL_VideoData *videodata, HDC hdc) SelectObject(hdc, font); for (i = 0; i < candcount; ++i) { - const WCHAR *s = videodata->ime_candidates[i]; + const WCHAR *s = &videodata->ime_candidates[i * MAX_CANDLENGTH]; if (!*s) break; @@ -1535,7 +1641,7 @@ IME_RenderCandidateList(SDL_VideoData *videodata, HDC hdc) SetBkMode(hdc, TRANSPARENT); for (i = 0; i < candcount; ++i) { - const WCHAR *s = videodata->ime_candidates[i]; + const WCHAR *s = &videodata->ime_candidates[i * MAX_CANDLENGTH]; int left, top, right, bottom; if (!*s) break; @@ -1605,6 +1711,18 @@ void IME_Present(SDL_VideoData *videodata) /* FIXME: Need to show the IME bitmap */ } +SDL_bool WIN_IsTextInputShown(_THIS) +{ + SDL_VideoData* videodata = (SDL_VideoData*)_this->driverdata; + return IME_IsTextInputShown(videodata); +} + +void WIN_ClearComposition(_THIS) +{ + SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata; + IME_ClearComposition(videodata); +} + #endif /* SDL_DISABLE_WINDOWS_IME */ #endif /* SDL_VIDEO_DRIVER_WINDOWS */ diff --git a/libs/SDL2/src/video/windows/SDL_windowskeyboard.h b/libs/SDL2/src/video/windows/SDL_windowskeyboard.h index 76048e78..97382c7b 100644 --- a/libs/SDL2/src/video/windows/SDL_windowskeyboard.h +++ b/libs/SDL2/src/video/windows/SDL_windowskeyboard.h @@ -32,6 +32,8 @@ 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_ClearComposition(_THIS); +extern SDL_bool WIN_IsTextInputShown(_THIS); extern SDL_bool IME_HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, struct SDL_VideoData *videodata); diff --git a/libs/SDL2/src/video/windows/SDL_windowsmessagebox.c b/libs/SDL2/src/video/windows/SDL_windowsmessagebox.c index 812f4536..f3042818 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsmessagebox.c +++ b/libs/SDL2/src/video/windows/SDL_windowsmessagebox.c @@ -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 --git a/libs/SDL2/src/video/windows/SDL_windowsmodes.c b/libs/SDL2/src/video/windows/SDL_windowsmodes.c index 9080cc89..e56581f7 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsmodes.c +++ b/libs/SDL2/src/video/windows/SDL_windowsmodes.c @@ -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 @@ WIN_UpdateDisplayMode(_THIS, LPCWSTR deviceName, DWORD index, SDL_DisplayMode * 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,99 @@ WIN_GetDisplayMode(_THIS, LPCWSTR deviceName, DWORD index, SDL_DisplayMode * mod 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); + } + 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 +297,6 @@ WIN_AddDisplay(_THIS, HMONITOR hMonitor, const MONITORINFOEXW *info, SDL_bool se SDL_DisplayData *displaydata; SDL_DisplayMode mode; SDL_DisplayOrientation orientation; - DISPLAY_DEVICEW device; #ifdef DEBUG_MODES SDL_Log("Display: %s\n", WIN_StringToUTF8W(info->szDevice)); @@ -233,10 +335,16 @@ WIN_AddDisplay(_THIS, HMONITOR hMonitor, const MONITORINFOEXW *info, SDL_bool se 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 +409,46 @@ WIN_InitModes(_THIS) 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 +460,7 @@ WIN_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) 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 +532,7 @@ int 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 +544,7 @@ WIN_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) 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 +553,190 @@ WIN_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) return 0; } +/** + * 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, int *x, int *y) +{ + const int right = rect->x + rect->w - 1; + const int bottom = rect->y + rect->h - 1; + + if (*x < rect->x) { + *x = rect->x; + } else if (*x > right) { + *x = right; + } + + if (*y < rect->y) { + *y = rect->y; + } else if (*y > bottom) { + *y = bottom; + } +} + +/** + * Returns the display index of the display which either encloses the given point + * or is closest to it. The point is in SDL screen coordinates. + */ +static int +SDL_GetPointDisplayIndex(int x, int y) +{ + int i, dist; + int closest = -1; + int closest_dist = 0x7FFFFFFF; + SDL_Point closest_point_on_display; + SDL_Point delta; + SDL_Rect rect; + SDL_VideoDevice *_this = SDL_GetVideoDevice(); + SDL_Point point; + point.x = x; + point.y = y; + + for (i = 0; i < _this->num_displays; ++i) { + /* Check for an exact match */ + SDL_GetDisplayBounds(i, &rect); + if (SDL_EnclosePoints(&point, 1, &rect, NULL)) { + return i; + } + + /* Snap x, y to the display rect */ + closest_point_on_display = point; + SDL_GetClosestPointOnRect(&rect, &closest_point_on_display.x, &closest_point_on_display.y); + + delta.x = point.x - closest_point_on_display.x; + delta.y = point.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; +} + +/** + * 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; + + 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(*x, *y); + + 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 +763,37 @@ WIN_GetDisplayModes(_THIS, SDL_VideoDisplay * display) } } +#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 +801,30 @@ WIN_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) 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 +845,12 @@ WIN_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) } 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 --git a/libs/SDL2/src/video/windows/SDL_windowsmodes.h b/libs/SDL2/src/video/windows/SDL_windowsmodes.h index 0f2cdf48..6bf62e58 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsmodes.h +++ b/libs/SDL2/src/video/windows/SDL_windowsmodes.h @@ -38,6 +38,8 @@ typedef struct 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 --git a/libs/SDL2/src/video/windows/SDL_windowsmouse.c b/libs/SDL2/src/video/windows/SDL_windowsmouse.c index 19977e21..a52c4407 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsmouse.c +++ b/libs/SDL2/src/video/windows/SDL_windowsmouse.c @@ -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" @@ -175,11 +175,13 @@ WIN_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y) static SDL_Cursor * WIN_CreateBlankCursor() { + SDL_Cursor *cursor = NULL; SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormat(0, 32, 32, 32, SDL_PIXELFORMAT_ARGB8888); if (surface) { - return WIN_CreateCursor(surface, 0, 0); + cursor = WIN_CreateCursor(surface, 0, 0); + SDL_FreeSurface(surface); } - return NULL; + return cursor; } static SDL_Cursor * @@ -288,6 +290,7 @@ WIN_WarpMouseGlobal(int x, int y) { POINT pt; + WIN_ScreenPointFromSDL(&x, &y, NULL); pt.x = x; pt.y = y; SetCursorPos(pt.x, pt.y); @@ -331,6 +334,7 @@ WIN_GetGlobalMouseState(int *x, int *y) 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; @@ -370,7 +374,8 @@ WIN_QuitMouse(_THIS) } if (SDL_blank_cursor) { - SDL_FreeCursor(SDL_blank_cursor); + WIN_FreeCursor(SDL_blank_cursor); + SDL_blank_cursor = NULL; } } diff --git a/libs/SDL2/src/video/windows/SDL_windowsopengl.c b/libs/SDL2/src/video/windows/SDL_windowsopengl.c index 0c99ca9a..549b01bb 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsopengl.c +++ b/libs/SDL2/src/video/windows/SDL_windowsopengl.c @@ -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" @@ -676,6 +676,7 @@ WIN_GL_CreateContext(_THIS, SDL_Window * window) _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 +823,12 @@ WIN_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) 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 --git a/libs/SDL2/src/video/windows/SDL_windowsopengl.h b/libs/SDL2/src/video/windows/SDL_windowsopengl.h index 2dec0023..36779aa4 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsopengl.h +++ b/libs/SDL2/src/video/windows/SDL_windowsopengl.h @@ -71,6 +71,7 @@ extern int WIN_GL_SetupWindow(_THIS, SDL_Window * window); 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 --git a/libs/SDL2/src/video/windows/SDL_windowsopengles.c b/libs/SDL2/src/video/windows/SDL_windowsopengles.c index eedc0e6a..ff4c5941 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsopengles.c +++ b/libs/SDL2/src/video/windows/SDL_windowsopengles.c @@ -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 @@ WIN_GLES_LoadLibrary(_THIS, const char *path) { _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 @@ WIN_GLES_CreateContext(_THIS, SDL_Window * window) _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 @@ WIN_GLES_DeleteContext(_THIS, SDL_GLContext context) 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 --git a/libs/SDL2/src/video/windows/SDL_windowsopengles.h b/libs/SDL2/src/video/windows/SDL_windowsopengles.h index b21c56f4..e59c02eb 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsopengles.h +++ b/libs/SDL2/src/video/windows/SDL_windowsopengles.h @@ -39,6 +39,7 @@ extern int WIN_GLES_LoadLibrary(_THIS, const char *path); 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 --git a/libs/SDL2/src/video/windows/SDL_windowsshape.c b/libs/SDL2/src/video/windows/SDL_windowsshape.c index 7af545d9..ef716a50 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsshape.c +++ b/libs/SDL2/src/video/windows/SDL_windowsshape.c @@ -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 --git a/libs/SDL2/src/video/windows/SDL_windowsvideo.c b/libs/SDL2/src/video/windows/SDL_windowsvideo.c index 39806930..6114808f 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsvideo.c +++ b/libs/SDL2/src/video/windows/SDL_windowsvideo.c @@ -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 @@ UpdateWindowFrameUsableWhileCursorHidden(void *userdata, const char *name, const } } +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) static void WIN_SuspendScreenSaver(_THIS) { if (_this->suspend_screensaver) { @@ -71,6 +74,11 @@ static void WIN_SuspendScreenSaver(_THIS) 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 @@ WIN_DeleteDevice(SDL_VideoDevice * device) 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); } @@ -117,11 +127,22 @@ WIN_CreateDevice(int devindex) 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 @@ WIN_CreateDevice(int devindex) 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 @@ WIN_CreateDevice(int devindex) 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 @@ WIN_CreateDevice(int devindex) 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 @@ WIN_CreateDevice(int devindex) 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 @@ WIN_CreateDevice(int devindex) 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,15 +244,20 @@ WIN_CreateDevice(int devindex) 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; + device->ClearComposition = WIN_ClearComposition; + device->IsTextInputShown = WIN_IsTextInputShown; device->SetClipboardText = WIN_SetClipboardText; device->GetClipboardText = WIN_GetClipboardText; device->HasClipboardText = WIN_HasClipboardText; +#endif device->free = WIN_DeleteDevice; @@ -231,22 +269,201 @@ VideoBootStrap WINDOWS_bootstrap = { "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; } @@ -254,15 +471,34 @@ WIN_VideoInit(_THIS) 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) { @@ -344,6 +580,7 @@ SDL_Direct3D9GetAdapterIndex(int displayIndex) return adapterIndex; } } +#endif /* !defined(__XBOXONE__) && !defined(__XBOXSERIES__) */ #if HAVE_DXGI_H #define CINTERFACE @@ -455,6 +692,21 @@ SDL_DXGIGetOutputInfo(int displayIndex, int *adapterIndex, int *outputIndex) #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 --git a/libs/SDL2/src/video/windows/SDL_windowsvideo.h b/libs/SDL2/src/video/windows/SDL_windowsvideo.h index 7dae16a4..e07c3444 100644 --- a/libs/SDL2/src/video/windows/SDL_windowsvideo.h +++ b/libs/SDL2/src/video/windows/SDL_windowsvideo.h @@ -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" @@ -37,14 +37,19 @@ #define MAX_CANDLIST 10 #define MAX_CANDLENGTH 256 +#define MAX_CANDSIZE (sizeof(WCHAR) * MAX_CANDLIST * MAX_CANDLENGTH) #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" @@ -74,9 +79,206 @@ typedef struct _TOUCHINPUT { 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, @@ -85,9 +287,42 @@ typedef enum MONITOR_DPI_TYPE { 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*); @@ -99,6 +334,7 @@ typedef struct void *data; } TSFSink; +#ifndef SDL_DISABLE_WINDOWS_IME /* Definition from Win98DDK version of IMM.H */ typedef struct tagINPUTCONTEXT2 { HWND hWnd; @@ -122,6 +358,7 @@ typedef struct tagINPUTCONTEXT2 { DWORD fdwInit; DWORD dwReserve[3]; } INPUTCONTEXT2, *PINPUTCONTEXT2, NEAR *NPINPUTCONTEXT2, FAR *LPINPUTCONTEXT2; +#endif /* !SDL_DISABLE_WINDOWS_IME */ /* Private display data */ @@ -131,18 +368,34 @@ typedef struct SDL_VideoData 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; @@ -150,14 +403,16 @@ typedef struct SDL_VideoData SDL_bool ime_available; HWND ime_hwnd_main; HWND ime_hwnd_current; + SDL_bool ime_suppress_endcomposition_event; HIMC ime_himc; - WCHAR ime_composition[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; + WCHAR* ime_composition; + int ime_composition_length; WCHAR ime_readingstring[16]; int ime_cursor; SDL_bool ime_candlist; - WCHAR ime_candidates[MAX_CANDLIST][MAX_CANDLENGTH]; + WCHAR* ime_candidates; DWORD ime_candcount; DWORD ime_candref; DWORD ime_candsel; @@ -188,6 +443,8 @@ typedef struct SDL_VideoData DWORD ime_convmodesinkcookie; TSFSink *ime_uielemsink; TSFSink *ime_ippasink; + LONG ime_uicontext; +#endif /* !SDL_DISABLE_WINDOWS_IME */ BYTE pre_hook_key_state[256]; UINT _SDL_WAKEUP; @@ -199,6 +456,8 @@ extern SDL_bool g_WindowFrameUsableWhileCursorHidden; 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 --git a/libs/SDL2/src/video/windows/SDL_windowswindow.c b/libs/SDL2/src/video/windows/SDL_windowswindow.c index e392e586..413c006e 100644 --- a/libs/SDL2/src/video/windows/SDL_windowswindow.c +++ b/libs/SDL2/src/video/windows/SDL_windowswindow.c @@ -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 "../../SDL_hints_c.h" #include "SDL_windowsvideo.h" #include "SDL_windowswindow.h" @@ -45,22 +47,25 @@ #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"); static const TCHAR *SDL_HelperWindowName = TEXT("SDLHelperWindowInputMsgWindow"); static ATOM SDL_HelperWindowClass = 0; -/* For borderless Windows, still want the following flags: +/* For borderless Windows, still want the following flag: + - WS_MINIMIZEBOX: window will respond to Windows minimize commands sent to all windows, such as windows key + m, shaking title bar, etc. + Additionally, non-fullscreen windows can add: - WS_CAPTION: this seems to enable the Windows minimize animation - WS_SYSMENU: enables system context menu on task bar - - WS_MINIMIZEBOX: window will respond to Windows minimize commands sent to all windows, such as windows key + m, shaking title bar, etc. This will also cause the task bar to overlap the window and other windowed behaviors, so only use this for windows that shouldn't appear to be fullscreen */ #define STYLE_BASIC (WS_CLIPSIBLINGS | WS_CLIPCHILDREN) -#define STYLE_FULLSCREEN (WS_POPUP) -#define STYLE_BORDERLESS (WS_POPUP) +#define STYLE_FULLSCREEN (WS_POPUP | WS_MINIMIZEBOX) +#define STYLE_BORDERLESS (WS_POPUP | WS_MINIMIZEBOX) #define STYLE_BORDERLESS_WINDOWED (WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX) #define STYLE_NORMAL (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX) #define STYLE_RESIZABLE (WS_THICKFRAME | WS_MAXIMIZEBOX) @@ -111,26 +116,95 @@ GetWindowStyle(SDL_Window * window) 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; - *x = (use_current ? window->x : window->windowed.x) + rect.left; - *y = (use_current ? window->y : window->windowed.y) + rect.top; + 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; + } + + 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 @@ -142,7 +216,11 @@ WIN_AdjustWindowRect(SDL_Window *window, int *x, int *y, int *width, int *height 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); } @@ -156,7 +234,7 @@ WIN_SetWindowPositionInternal(_THIS, SDL_Window * window, UINT flags) int w, h; /* Figure out what the window area will be */ - if (SDL_ShouldAllowTopmost() && ((window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) == (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS) || (window->flags & SDL_WINDOW_ALWAYS_ON_TOP))) { + if (SDL_ShouldAllowTopmost() && (window->flags & SDL_WINDOW_ALWAYS_ON_TOP)) { top = HWND_TOPMOST; } else { top = HWND_NOTOPMOST; @@ -169,6 +247,54 @@ WIN_SetWindowPositionInternal(_THIS, SDL_Window * window, UINT flags) data->expected_resize = SDL_FALSE; } +static void SDLCALL +WIN_MouseRelativeModeCenterChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + SDL_WindowData *data = (SDL_WindowData *)userdata; + data->mouse_relative_mode_center = SDL_GetStringBoolean(hint, SDL_TRUE); +} + +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) { @@ -183,23 +309,34 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, HWND parent, SDL_bool cre 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; - data->mouse_button_flags = 0; + data->mouse_button_flags = (WPARAM)-1; 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 @@ -224,27 +361,36 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, HWND parent, SDL_bool cre 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; } } +#endif { DWORD style = GetWindowLong(hwnd, GWL_STYLE); if (style & WS_VISIBLE) { @@ -279,16 +425,27 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, HWND parent, SDL_bool cre 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; @@ -296,7 +453,41 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, HWND parent, SDL_bool cre return 0; } +static void CleanupWindowData(_THIS, SDL_Window * window) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + if (data) { + SDL_DelHintCallback(SDL_HINT_MOUSE_RELATIVE_MODE_CENTER, WIN_MouseRelativeModeCenterChanged, data); + +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) + 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) { + DestroyWindow(data->parent); + } + } else { + /* Restore any original event handler... */ + if (data->wndproc != NULL) { +#ifdef GWLP_WNDPROC + SetWindowLongPtr(data->hwnd, GWLP_WNDPROC, + (LONG_PTR) data->wndproc); +#else + SetWindowLong(data->hwnd, GWL_WNDPROC, + (LONG_PTR) data->wndproc); +#endif + } + } + SDL_free(data); + } + window->driverdata = NULL; +} int WIN_CreateWindow(_THIS, SDL_Window * window) @@ -377,6 +568,9 @@ WIN_CreateWindow(_THIS, SDL_Window * window) 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; @@ -421,60 +615,68 @@ WIN_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) } } } + } else if (window->flags & SDL_WINDOW_OPENGL) { + /* Try to set up the pixel format, if it hasn't been set by the application */ + WIN_GL_SetupWindow(_this, window); } } #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; - int icon_len, mask_len, y; - SDL_RWops *dst; + int icon_len, mask_len, row_len, y; + BITMAPINFOHEADER *bmi; + Uint8 *dst; SDL_bool isstack; /* Create temporary buffer for ICONIMAGE structure */ + SDL_COMPILE_TIME_ASSERT(WIN_SetWindowIcon_uses_BITMAPINFOHEADER_to_prepare_an_ICONIMAGE, sizeof(BITMAPINFOHEADER) == 40); mask_len = (icon->h * (icon->w + 7)/8); - icon_len = 40 + icon->h * icon->w * sizeof(Uint32) + mask_len; + icon_len = sizeof(BITMAPINFOHEADER) + icon->h * icon->w * sizeof(Uint32) + mask_len; icon_bmp = SDL_small_alloc(BYTE, icon_len, &isstack); - dst = SDL_RWFromMem(icon_bmp, icon_len); - if (!dst) { - SDL_small_free(icon_bmp, isstack); - return; - } /* Write the BITMAPINFO header */ - SDL_WriteLE32(dst, 40); - SDL_WriteLE32(dst, icon->w); - SDL_WriteLE32(dst, icon->h * 2); - SDL_WriteLE16(dst, 1); - SDL_WriteLE16(dst, 32); - SDL_WriteLE32(dst, BI_RGB); - SDL_WriteLE32(dst, icon->h * icon->w * sizeof(Uint32)); - SDL_WriteLE32(dst, 0); - SDL_WriteLE32(dst, 0); - SDL_WriteLE32(dst, 0); - SDL_WriteLE32(dst, 0); + bmi = (BITMAPINFOHEADER *)icon_bmp; + bmi->biSize = SDL_SwapLE32(sizeof(BITMAPINFOHEADER)); + bmi->biWidth = SDL_SwapLE32(icon->w); + bmi->biHeight = SDL_SwapLE32(icon->h * 2); + bmi->biPlanes = SDL_SwapLE16(1); + bmi->biBitCount = SDL_SwapLE16(32); + bmi->biCompression = SDL_SwapLE32(BI_RGB); + bmi->biSizeImage = SDL_SwapLE32(icon->h * icon->w * sizeof(Uint32)); + bmi->biXPelsPerMeter = SDL_SwapLE32(0); + bmi->biYPelsPerMeter = SDL_SwapLE32(0); + bmi->biClrUsed = SDL_SwapLE32(0); + bmi->biClrImportant = SDL_SwapLE32(0); /* Write the pixels upside down into the bitmap buffer */ SDL_assert(icon->format->format == SDL_PIXELFORMAT_ARGB8888); + dst = &icon_bmp[sizeof(BITMAPINFOHEADER)]; + row_len = icon->w * sizeof(Uint32); y = icon->h; while (y--) { Uint8 *src = (Uint8 *) icon->pixels + y * icon->pitch; - SDL_RWwrite(dst, src, icon->w * sizeof(Uint32), 1); + SDL_memcpy(dst, src, row_len); + dst += row_len; } /* Write the mask */ @@ -482,7 +684,6 @@ WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) hicon = CreateIconFromResource(icon_bmp, icon_len, TRUE, 0x00030000); - SDL_RWclose(dst); SDL_small_free(icon_bmp, isstack); /* Set the icon for the window */ @@ -490,12 +691,16 @@ WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) /* 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 @@ -507,6 +712,21 @@ WIN_SetWindowSize(_THIS, SDL_Window * window) 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; @@ -545,6 +765,7 @@ WIN_GetWindowBordersSize(_THIS, SDL_Window * window, int *top, int *left, int *b *right = rcWindow.right - rcClient.right; return 0; +#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ } void @@ -573,8 +794,40 @@ WIN_HideWindow(_THIS, SDL_Window * window) 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 . + * + * The issue is that Microsoft has gone through a lot of trouble to make it + * nearly impossible to programmatically move a window to the foreground, + * for "security" reasons. Apparently, the following song-and-dance gets + * around their objections. */ + SDL_bool bForce = SDL_GetHintBoolean(SDL_HINT_FORCE_RAISEWINDOW, SDL_FALSE); + + HWND hCurWnd = NULL; + DWORD dwMyID = 0u; + DWORD dwCurID = 0u; + HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; + if(bForce) + { + hCurWnd = GetForegroundWindow(); + dwMyID = GetCurrentThreadId(); + dwCurID = GetWindowThreadProcessId(hCurWnd, NULL); + ShowWindow(hwnd, SW_RESTORE); + AttachThreadInput(dwCurID, dwMyID, TRUE); + SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); + SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); + } SetForegroundWindow(hwnd); + if (bForce) + { + AttachThreadInput(dwCurID, dwMyID, FALSE); + SetFocus(hwnd); + SetActiveWindow(hwnd); + } +#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ } void @@ -647,18 +900,39 @@ WIN_RestoreWindow(_THIS, SDL_Window * window) 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; int w, h; - if (SDL_ShouldAllowTopmost() && ((window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) == (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS) || window->flags & SDL_WINDOW_ALWAYS_ON_TOP)) { + if (!fullscreen && (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_FULLSCREEN_DESKTOP)) != 0) { + /* Resizing the window on hide causes problems restoring it in Wine, and it's unnecessary. + * Also, Windows would preview the minimized window with the wrong size. + */ + return; + } + +#ifdef HIGHDPI_DEBUG + SDL_Log("WIN_SetWindowFullscreen: %d", (int)fullscreen); +#endif + + /* Clear the window size, to force SDL_SendWindowEvent to send a SDL_WINDOWEVENT_RESIZED + event in WM_WINDOWPOSCHANGED. */ + data->window->w = 0; + data->window->h = 0; + + if (SDL_ShouldAllowTopmost() && (window->flags & SDL_WINDOW_ALWAYS_ON_TOP)) { top = HWND_TOPMOST; } else { top = HWND_NOTOPMOST; @@ -668,13 +942,20 @@ WIN_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, 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 @@ -704,8 +985,15 @@ WIN_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, 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) { @@ -824,15 +1112,6 @@ void WIN_SetWindowMouseGrab(_THIS, SDL_Window * window, SDL_bool grabbed) { WIN_UpdateClipCursor(window); - - if (window->flags & SDL_WINDOW_FULLSCREEN) { - UINT flags = SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOSIZE; - - if (!(window->flags & SDL_WINDOW_SHOWN)) { - flags |= SWP_NOACTIVATE; - } - WIN_SetWindowPositionInternal(_this, window, flags); - } } void @@ -844,38 +1123,12 @@ WIN_SetWindowKeyboardGrab(_THIS, SDL_Window * window, SDL_bool grabbed) WIN_UngrabKeyboard(window); } } +#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ void WIN_DestroyWindow(_THIS, SDL_Window * window) { - SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - - if (data) { - if (data->keyboard_hook) { - UnhookWindowsHookEx(data->keyboard_hook); - } - ReleaseDC(data->hwnd, data->hdc); - RemoveProp(data->hwnd, TEXT("SDL_WindowData")); - if (data->created) { - DestroyWindow(data->hwnd); - if (data->parent) { - DestroyWindow(data->parent); - } - } else { - /* Restore any original event handler... */ - if (data->wndproc != NULL) { -#ifdef GWLP_WNDPROC - SetWindowLongPtr(data->hwnd, GWLP_WNDPROC, - (LONG_PTR) data->wndproc); -#else - SetWindowLong(data->hwnd, GWL_WNDPROC, - (LONG_PTR) data->wndproc); -#endif - } - } - SDL_free(data); - } - window->driverdata = NULL; + CleanupWindowData(_this, window); } SDL_bool @@ -898,8 +1151,8 @@ WIN_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) 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; } } @@ -973,6 +1226,7 @@ SDL_HelperWindowDestroy(void) } } +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) void WIN_OnWindowEnter(_THIS, SDL_Window * window) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; @@ -1007,7 +1261,7 @@ WIN_UpdateClipCursor(SDL_Window *window) if ((mouse->relative_mode || (window->flags & SDL_WINDOW_MOUSE_GRABBED) || (window->mouse_rect.w > 0 && window->mouse_rect.h > 0)) && (window->flags & SDL_WINDOW_INPUT_FOCUS)) { - if (mouse->relative_mode && !mouse->relative_mode_warp) { + if (mouse->relative_mode && !mouse->relative_mode_warp && data->mouse_relative_mode_center) { if (GetWindowRect(data->hwnd, &rect)) { LONG cx, cy; @@ -1031,12 +1285,19 @@ WIN_UpdateClipCursor(SDL_Window *window) 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 - 1; + mouse_rect.bottom = mouse_rect.top + mouse_rect_win_client.h - 1; if (IntersectRect(&intersection, &rect, &mouse_rect)) { SDL_memcpy(&rect, &intersection, sizeof(rect)); } else if ((window->flags & SDL_WINDOW_MOUSE_GRABBED) != 0) { @@ -1078,10 +1339,14 @@ WIN_SetWindowHitTest(SDL_Window *window, SDL_bool enabled) { 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); @@ -1110,8 +1375,65 @@ WIN_SetWindowOpacity(_THIS, SDL_Window * window, float opacity) } 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) { @@ -1146,6 +1468,7 @@ WIN_FlashWindow(_THIS, SDL_Window * window, SDL_FlashOperation operation) return 0; } +#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ #endif /* SDL_VIDEO_DRIVER_WINDOWS */ diff --git a/libs/SDL2/src/video/windows/SDL_windowswindow.h b/libs/SDL2/src/video/windows/SDL_windowswindow.h index d1570fdb..8b3c1ff1 100644 --- a/libs/SDL2/src/video/windows/SDL_windowswindow.h +++ b/libs/SDL2/src/video/windows/SDL_windowswindow.h @@ -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 @@ -49,6 +56,7 @@ typedef struct Uint8 focus_click_pending; SDL_bool skip_update_clipcursor; Uint32 last_updated_clipcursor; + SDL_bool mouse_relative_mode_center; SDL_bool windowed_mode_was_maximized; SDL_bool in_window_deactivation; RECT cursor_clipped_rect; @@ -58,6 +66,11 @@ typedef struct #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); @@ -90,9 +103,17 @@ extern SDL_bool WIN_GetWindowWMInfo(_THIS, SDL_Window * window, 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 --git a/libs/SDL2/src/video/windows/wmmsg.h b/libs/SDL2/src/video/windows/wmmsg.h index bd416eb8..86cae1df 100644 --- a/libs/SDL2/src/video/windows/wmmsg.h +++ b/libs/SDL2/src/video/windows/wmmsg.h @@ -762,7 +762,7 @@ const char *wmtab[] = { "UNKNOWN (737)", "UNKNOWN (738)", "UNKNOWN (739)", - "UNKNOWN (740)", + "WM_GETDPISCALEDSIZE", "UNKNOWN (741)", "UNKNOWN (742)", "UNKNOWN (743)", diff --git a/libs/SDL2/src/video/winrt/SDL_winrtopengles.cpp b/libs/SDL2/src/video/winrt/SDL_winrtopengles.cpp index 9e3c1772..d5301006 100644 --- a/libs/SDL2/src/video/winrt/SDL_winrtopengles.cpp +++ b/libs/SDL2/src/video/winrt/SDL_winrtopengles.cpp @@ -63,7 +63,7 @@ WINRT_GLES_LoadLibrary(_THIS, const char *path) } /* 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 --git a/libs/SDL2/src/video/winrt/SDL_winrtvideo.cpp b/libs/SDL2/src/video/winrt/SDL_winrtvideo.cpp index 0b231b79..e2d3f9e6 100644 --- a/libs/SDL2/src/video/winrt/SDL_winrtvideo.cpp +++ b/libs/SDL2/src/video/winrt/SDL_winrtvideo.cpp @@ -478,8 +478,7 @@ WINRT_InitModes(_THIS) hr = CreateDXGIFactory1(SDL_IID_IDXGIFactory2, (void **)&dxgiFactory2); if (FAILED(hr)) { - WIN_SetErrorFromHRESULT(__FUNCTION__ ", CreateDXGIFactory1() failed", hr); - return -1; + return WIN_SetErrorFromHRESULT(__FUNCTION__ ", CreateDXGIFactory1() failed", hr); } for (int adapterIndex = 0; ; ++adapterIndex) { @@ -630,14 +629,12 @@ WINRT_CreateWindow(_THIS, SDL_Window * window) // Make sure that only one window gets created, at least until multimonitor // support is added. if (WINRT_GlobalSDLWindow != NULL) { - SDL_SetError("WinRT only supports one window"); - return -1; + return SDL_SetError("WinRT only supports one window"); } SDL_WindowData *data = new SDL_WindowData; /* use 'new' here as SDL_WindowData may use WinRT/C++ types */ if (!data) { - SDL_OutOfMemory(); - return -1; + return SDL_OutOfMemory(); } window->driverdata = data; data->sdlWindow = window; @@ -673,9 +670,8 @@ WINRT_CreateWindow(_THIS, SDL_Window * window) * be passed into eglCreateWindowSurface. */ if (SDL_EGL_ChooseConfig(_this) != 0) { - char buf[512]; - SDL_snprintf(buf, sizeof(buf), "SDL_EGL_ChooseConfig failed: %s", SDL_GetError()); - return SDL_SetError("%s", buf); + /* SDL_EGL_ChooseConfig failed, SDL_GetError() should have info */ + return -1; } if (video_data->winrtEglWindow) { /* ... is the 'old' version of ANGLE/WinRT being used? */ @@ -838,8 +834,8 @@ WINRT_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) 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 --git a/libs/SDL2/src/video/x11/SDL_x11dyn.c b/libs/SDL2/src/video/x11/SDL_x11dyn.c index 29a8186f..4bfef21e 100644 --- a/libs/SDL2/src/video/x11/SDL_x11dyn.c +++ b/libs/SDL2/src/video/x11/SDL_x11dyn.c @@ -47,9 +47,6 @@ typedef struct #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 @@ typedef struct #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 --git a/libs/SDL2/src/video/x11/SDL_x11dyn.h b/libs/SDL2/src/video/x11/SDL_x11dyn.h index c2678bfe..feac35fa 100644 --- a/libs/SDL2/src/video/x11/SDL_x11dyn.h +++ b/libs/SDL2/src/video/x11/SDL_x11dyn.h @@ -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 --git a/libs/SDL2/src/video/x11/SDL_x11events.c b/libs/SDL2/src/video/x11/SDL_x11events.c index c1260215..6e3c0679 100644 --- a/libs/SDL2/src/video/x11/SDL_x11events.c +++ b/libs/SDL2/src/video/x11/SDL_x11events.c @@ -380,7 +380,7 @@ X11_GetScrollLockModifierMask(_THIS) return num_mask; } -static void +void X11_ReconcileKeyboardState(_THIS) { SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata; @@ -408,7 +408,22 @@ X11_ReconcileKeyboardState(_THIS) SDL_bool sdlKeyPressed = keyboardState[scancode] == SDL_PRESSED; if (x11KeyPressed && !sdlKeyPressed) { - SDL_SendKeyboardKey(SDL_PRESSED, scancode); + /* Only update modifier state for keys that are pressed in another application */ + switch (SDL_GetKeyFromScancode(scancode)) { + case SDLK_LCTRL: + case SDLK_RCTRL: + case SDLK_LSHIFT: + case SDLK_RSHIFT: + case SDLK_LALT: + case SDLK_RALT: + case SDLK_LGUI: + case SDLK_RGUI: + case SDLK_MODE: + SDL_SendKeyboardKey(SDL_PRESSED, scancode); + break; + default: + break; + } } else if (!x11KeyPressed && sdlKeyPressed) { SDL_SendKeyboardKey(SDL_RELEASED, scancode); } @@ -718,7 +733,6 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent) { SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; - XkbEvent* xkbEvent = (XkbEvent*) xevent; Display *display; SDL_WindowData *data; int orig_event_type; @@ -771,6 +785,12 @@ X11_DispatchEvent(_THIS, XEvent *xevent) } #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; @@ -805,11 +825,13 @@ X11_DispatchEvent(_THIS, XEvent *xevent) if (!data) { /* The window for KeymapNotify, etc events is 0 */ if (xevent->type == KeymapNotify) { +#ifdef DEBUG_XEVENTS + printf("window %p: KeymapNotify!\n", data); +#endif if (SDL_GetKeyboardFocus() != NULL) { X11_ReconcileKeyboardState(_this); } - } else if (xevent->type == MappingNotify || - (xevent->type == videodata->xkb_event && xkbEvent->any.xkb_type == XkbStateNotify)) { + } else if (xevent->type == MappingNotify) { /* Has the keyboard layout changed? */ const int request = xevent->xmapping.request; @@ -996,8 +1018,9 @@ X11_DispatchEvent(_THIS, XEvent *xevent) } break; - /* Key press? */ - case KeyPress:{ + /* Key press/release? */ + case KeyPress: + case KeyRelease: { KeyCode keycode = xevent->xkey.keycode; KeySym keysym = NoSymbol; char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; @@ -1005,7 +1028,7 @@ X11_DispatchEvent(_THIS, XEvent *xevent) SDL_bool handled_by_ime = SDL_FALSE; #ifdef DEBUG_XEVENTS - printf("window %p: KeyPress (X11 keycode = 0x%X)\n", data, xevent->xkey.keycode); + printf("window %p: %s (X11 keycode = 0x%X)\n", data, (xevent->type == KeyPress ? "KeyPress" : "KeyRelease"), xevent->xkey.keycode); #endif #if 1 if (videodata->key_layout[keycode] == SDL_SCANCODE_UNKNOWN && keycode) { @@ -1021,7 +1044,7 @@ X11_DispatchEvent(_THIS, XEvent *xevent) /* */ SDL_zeroa(text); #ifdef X_HAVE_UTF8_STRING - if (data->ic) { + if (data->ic && xevent->type == KeyPress) { X11_Xutf8LookupString(data->ic, &xevent->xkey, text, sizeof(text), &keysym, &status); } else { @@ -1033,35 +1056,30 @@ X11_DispatchEvent(_THIS, XEvent *xevent) #ifdef SDL_USE_IME if(SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE){ - handled_by_ime = SDL_IME_ProcessKeyEvent(keysym, keycode); + handled_by_ime = SDL_IME_ProcessKeyEvent(keysym, keycode, (xevent->type == KeyPress ? SDL_PRESSED : SDL_RELEASED)); } #endif if (!handled_by_ime) { - /* Don't send the key if it looks like a duplicate of a filtered key sent by an IME */ - if (xevent->xkey.keycode != videodata->filter_code || xevent->xkey.time != videodata->filter_time) { - SDL_SendKeyboardKey(SDL_PRESSED, videodata->key_layout[keycode]); - } - if(*text) { - SDL_SendKeyboardText(text); + if (xevent->type == KeyPress) { + /* Don't send the key if it looks like a duplicate of a filtered key sent by an IME */ + if (xevent->xkey.keycode != videodata->filter_code || xevent->xkey.time != videodata->filter_time) { + SDL_SendKeyboardKey(SDL_PRESSED, videodata->key_layout[keycode]); + } + if(*text) { + SDL_SendKeyboardText(text); + } + } else { + if (X11_KeyRepeat(display, xevent)) { + /* We're about to get a repeated key down, ignore the key up */ + break; + } + SDL_SendKeyboardKey(SDL_RELEASED, videodata->key_layout[keycode]); } } - X11_UpdateUserTime(data, xevent->xkey.time); - } - break; - - /* Key release? */ - case KeyRelease:{ - KeyCode keycode = xevent->xkey.keycode; - -#ifdef DEBUG_XEVENTS - printf("window %p: KeyRelease (X11 keycode = 0x%X)\n", data, xevent->xkey.keycode); -#endif - if (X11_KeyRepeat(display, xevent)) { - /* We're about to get a repeated key down, ignore the key up */ - break; + if (xevent->type == KeyPress) { + X11_UpdateUserTime(data, xevent->xkey.time); } - SDL_SendKeyboardKey(SDL_RELEASED, videodata->key_layout[keycode]); } break; diff --git a/libs/SDL2/src/video/x11/SDL_x11events.h b/libs/SDL2/src/video/x11/SDL_x11events.h index fc8a57ae..de89110d 100644 --- a/libs/SDL2/src/video/x11/SDL_x11events.h +++ b/libs/SDL2/src/video/x11/SDL_x11events.h @@ -27,6 +27,7 @@ extern void X11_PumpEvents(_THIS); extern int X11_WaitEventTimeout(_THIS, int timeout); extern void X11_SendWakeupEvent(_THIS, SDL_Window *window); extern void X11_SuspendScreenSaver(_THIS); +extern void X11_ReconcileKeyboardState(_THIS); #endif /* SDL_x11events_h_ */ diff --git a/libs/SDL2/src/video/x11/SDL_x11keyboard.c b/libs/SDL2/src/video/x11/SDL_x11keyboard.c index c82570c6..9d9f3f9f 100644 --- a/libs/SDL2/src/video/x11/SDL_x11keyboard.c +++ b/libs/SDL2/src/video/x11/SDL_x11keyboard.c @@ -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 @@ static const struct { 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 @@ X11_InitKeyboard(_THIS) 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 { @@ -409,6 +402,8 @@ X11_InitKeyboard(_THIS) SDL_IME_Init(); #endif + X11_ReconcileKeyboardState(_this); + return 0; } diff --git a/libs/SDL2/src/video/x11/SDL_x11messagebox.c b/libs/SDL2/src/video/x11/SDL_x11messagebox.c index aafccca9..9bc9702c 100644 --- a/libs/SDL2/src/video/x11/SDL_x11messagebox.c +++ b/libs/SDL2/src/video/x11/SDL_x11messagebox.c @@ -830,10 +830,11 @@ X11_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) int exitcode = 0; close(fds[0]); status = X11_ShowMessageBoxImpl(messageboxdata, buttonid); - if (write(fds[1], &status, sizeof (int)) != sizeof (int)) + if (write(fds[1], &status, sizeof (int)) != sizeof (int)) { exitcode = 1; - else if (write(fds[1], buttonid, sizeof (int)) != sizeof (int)) + } else if (write(fds[1], buttonid, sizeof (int)) != sizeof (int)) { exitcode = 1; + } close(fds[1]); _exit(exitcode); /* don't run atexit() stuff, static destructors, etc. */ } else { /* we're the parent */ @@ -846,13 +847,12 @@ X11_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) SDL_assert(rc == pid); /* not sure what to do if this fails. */ if ((rc == -1) || (!WIFEXITED(status)) || (WEXITSTATUS(status) != 0)) { - return SDL_SetError("msgbox child process failed"); + status = SDL_SetError("msgbox child process failed"); + } else if ( (read(fds[0], &status, sizeof (int)) != sizeof (int)) || + (read(fds[0], buttonid, sizeof (int)) != sizeof (int)) ) { + status = SDL_SetError("read from msgbox child process failed"); + *buttonid = 0; } - - if (read(fds[0], &status, sizeof (int)) != sizeof (int)) - status = -1; - else if (read(fds[0], buttonid, sizeof (int)) != sizeof (int)) - status = -1; close(fds[0]); return status; diff --git a/libs/SDL2/src/video/x11/SDL_x11modes.c b/libs/SDL2/src/video/x11/SDL_x11modes.c index c1efe243..c8f6c54b 100644 --- a/libs/SDL2/src/video/x11/SDL_x11modes.c +++ b/libs/SDL2/src/video/x11/SDL_x11modes.c @@ -148,62 +148,6 @@ X11_GetPixelFormatFromVisualInfo(Display * display, XVisualInfo * vinfo) 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,6 +289,249 @@ SetXRandRDisplayName(Display *dpy, Atom EDID, char *name, const size_t namelen, #endif } + +static int +X11_AddXRandRDisplay(_THIS, Display *dpy, int screen, RROutput outputid, XRRScreenResources *res, SDL_bool send_event) +{ + 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; + + if (get_visualinfo(dpy, screen, &vinfo) < 0) { + return 0; /* uh, skip this screen? */ + } + + pixelformat = X11_GetPixelFormatFromVisualInfo(dpy, &vinfo); + if (SDL_ISPIXELFORMAT_INDEXED(pixelformat)) { + return 0; /* Palettized video modes are no longer supported, ignore this one. */ + } + + 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); + } + + 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) +{ + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + Display *dpy = data->display; + const int screencount = ScreenCount(dpy); + const int default_screen = DefaultScreen(dpy); + RROutput primary = X11_XRRGetOutputPrimary(dpy, RootWindow(dpy, default_screen)); + XRRScreenResources *res = NULL; + int xrandr_error_base = 0; + int looking_for_primary; + int output; + 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++) { + + /* we want the primary output first, and then skipped later. */ + if (looking_for_primary && (screen != default_screen)) { + continue; + } + + 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) { + continue; + } + } + + for (output = 0; output < res->noutput; output++) { + /* 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; + } + if (X11_AddXRandRDisplay(_this, dpy, screen, res->outputs[output], res, SDL_FALSE) == -1) { + break; + } + } + + X11_XRRFreeScreenResources(res); + + /* This will generate events for displays that come and go at runtime. */ + X11_XRRSelectInput(dpy, RootWindow(dpy, screen), RROutputChangeNotifyMask); + } + } + + if (_this->num_displays == 0) { + return SDL_SetError("No available displays"); + } + + return 0; +} +#endif /* SDL_VIDEO_DRIVER_X11_XRANDR */ + static int GetXftDPI(Display* dpy) { @@ -369,508 +556,124 @@ GetXftDPI(Display* dpy) return err == ERANGE ? 0 : xft_dpi; } -static int -X11_InitModes_XRandR(_THIS) +/* 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) { + /* !!! 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 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; + 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; - XPixmapFormatValues *pixmapformats; - int looking_for_primary; - int scanline_pad; - int output; - int screen, i, n; + SDL_VideoDisplay display; - for (looking_for_primary = 1; looking_for_primary >= 0; looking_for_primary--) { - for (screen = 0; screen < screencount; screen++) { + /* note that generally even if you have a multiple physical monitors, ScreenCount(dpy) still only reports ONE screen. */ - /* we want the primary output first, and then skipped later. */ - if (looking_for_primary && (screen != default_screen)) { - continue; + if (get_visualinfo(dpy, default_screen, &vinfo) < 0) { + return SDL_SetError("Failed to find an X11 visual for the primary display"); + } + + pixelformat = X11_GetPixelFormatFromVisualInfo(dpy, &vinfo); + if (SDL_ISPIXELFORMAT_INDEXED(pixelformat)) { + return SDL_SetError("Palettized video modes are no longer supported"); + } + + SDL_zero(mode); + mode.w = WidthOfScreen(screen); + mode.h = HeightOfScreen(screen); + mode.format = pixelformat; + mode.refresh_rate = 0; /* don't know it, sorry. */ + + 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(); + } + mode.driverdata = modedata; + + display_mm_width = WidthMMOfScreen(screen); + display_mm_height = HeightMMOfScreen(screen); + + 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); + + xft_dpi = GetXftDPI(dpy); + if(xft_dpi > 0) { + displaydata->hdpi = (float)xft_dpi; + displaydata->vdpi = (float)xft_dpi; + } + + 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; } - - 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) { - X11_XRRFreeScreenResources(res); - } - - res = X11_XRRGetScreenResources(dpy, RootWindow(dpy, screen)); - if (!res) { - continue; - } - } - - 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; - } - display.desktop_mode = mode; - display.current_mode = mode; - display.driverdata = displaydata; - SDL_AddVideoDisplay(&display, SDL_FALSE); - } - - X11_XRRFreeScreenResources(res); } + X11_XFree(pixmapformats); } - if (_this->num_displays == 0) { - return SDL_SetError("No available displays"); - } + displaydata->scanline_pad = scanline_pad; + displaydata->x = 0; + displaydata->y = 0; + displaydata->use_xrandr = SDL_FALSE; + + 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); return 0; } -#endif /* SDL_VIDEO_DRIVER_X11_XRANDR */ -#if SDL_VIDEO_DRIVER_X11_XVIDMODE -static SDL_bool -CheckVidMode(Display * display, int *major, int *minor) -{ - int vm_event, vm_error = -1; - /* Default the extension not available */ - *major = *minor = 0; - - /* 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; - } - - if (!SDL_X11_HAVE_XVIDMODE) { -#ifdef X11MODES_DEBUG - printf("XVidMode support not available\n"); -#endif - return SDL_FALSE; - } - - /* 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; -} - -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; -} - -static int -CalculateXVidModeRefreshRate(const XF86VidModeModeInfo * info) -{ - return (info->htotal - && info->vtotal) ? (1000 * info->dotclock / (info->htotal * - info->vtotal)) : 0; -} - -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 */ 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 + /* 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 - int xrandr_major, xrandr_minor; -#endif -#if SDL_VIDEO_DRIVER_X11_XVIDMODE - int vm_major, vm_minor; - int use_vidmode = 0; -#endif - -/* 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; + { + 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 /* SDL_VIDEO_DRIVER_X11_XRANDR */ -/* !!! FIXME: eventually remove support for Xinerama and XVidMode (everything below here). */ - - /* 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 - } - } - -#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); - } -#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 - - 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; - - modedata = (SDL_DisplayModeData *) SDL_calloc(1, sizeof(SDL_DisplayModeData)); - if (!modedata) { - SDL_free(displaydata); - continue; - } - mode.driverdata = modedata; - -#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; - - /* 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; - } - } - 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; - } - -#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); - 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 - - 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."); - } -#endif - - 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 @@ X11_GetDisplayModes(_THIS, SDL_VideoDisplay * sdl_display) 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 @@ X11_GetDisplayModes(_THIS, SDL_VideoDisplay * sdl_display) } #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,28 +733,36 @@ X11_GetDisplayModes(_THIS, SDL_VideoDisplay * sdl_display) } } +#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; static int SDL_XRRSetScreenSizeErrHandler(Display *d, XErrorEvent *e) { - return (e->error_code == BadMatch) ? 0 : PreXRRSetScreenSizeErrorHandler(d, e); + /* BadMatch: https://github.com/libsdl-org/SDL/issues/4561 */ + /* BadValue: https://github.com/libsdl-org/SDL/issues/4840 */ + if ((e->error_code == BadMatch) || (e->error_code == BadValue)) { + return 0; + } + + 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; @@ -1099,12 +835,6 @@ freeInfo: } #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; } @@ -1123,19 +853,6 @@ X11_GetDisplayBounds(_THIS, SDL_VideoDisplay * sdl_display, SDL_Rect * rect) 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 --git a/libs/SDL2/src/video/x11/SDL_x11modes.h b/libs/SDL2/src/video/x11/SDL_x11modes.h index 55486801..9a4257e4 100644 --- a/libs/SDL2/src/video/x11/SDL_x11modes.h +++ b/libs/SDL2/src/video/x11/SDL_x11modes.h @@ -35,35 +35,20 @@ typedef struct 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_GetDisplayBounds(_THIS, SDL_VideoDisplay * sdl_display, SDL_Rect 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 --git a/libs/SDL2/src/video/x11/SDL_x11mouse.c b/libs/SDL2/src/video/x11/SDL_x11mouse.c index 033df8d2..ed29288c 100644 --- a/libs/SDL2/src/video/x11/SDL_x11mouse.c +++ b/libs/SDL2/src/video/x11/SDL_x11mouse.c @@ -244,8 +244,8 @@ X11_CreateSystemCursor(SDL_SystemCursor id) 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; @@ -294,14 +294,15 @@ X11_ShowCursor(SDL_Cursor * cursor) SDL_VideoDevice *video = SDL_GetVideoDevice(); Display *display = GetDisplay(); SDL_Window *window; - SDL_WindowData *data; for (window = video->windows; window; window = window->next) { - data = (SDL_WindowData *)window->driverdata; - if (x11_cursor != None) { - X11_XDefineCursor(display, data->xwindow, x11_cursor); - } else { - X11_XUndefineCursor(display, data->xwindow); + SDL_WindowData *data = (SDL_WindowData *)window->driverdata; + if (data) { + if (x11_cursor != None) { + X11_XDefineCursor(display, data->xwindow, x11_cursor); + } else { + X11_XUndefineCursor(display, data->xwindow); + } } } X11_XFlush(display); @@ -405,6 +406,8 @@ X11_GetGlobalMouseState(int *x, int *y) 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). * diff --git a/libs/SDL2/src/video/x11/SDL_x11opengl.c b/libs/SDL2/src/video/x11/SDL_x11opengl.c index 64b06340..3e17e97f 100644 --- a/libs/SDL2/src/video/x11/SDL_x11opengl.c +++ b/libs/SDL2/src/video/x11/SDL_x11opengl.c @@ -247,11 +247,6 @@ X11_GL_LoadLibrary(_THIS, const char *path) X11_GL_UseEGL(_this) ) { #if SDL_VIDEO_OPENGL_EGL X11_GL_UnloadLibrary(_this); - /* Better avoid conflicts! */ - if (_this->gl_config.dll_handle != NULL ) { - GL_UnloadObject(_this->gl_config.dll_handle); - _this->gl_config.dll_handle = NULL; - } _this->GL_LoadLibrary = X11_GLES_LoadLibrary; _this->GL_GetProcAddress = X11_GLES_GetProcAddress; _this->GL_UnloadLibrary = X11_GLES_UnloadLibrary; diff --git a/libs/SDL2/src/video/x11/SDL_x11sym.h b/libs/SDL2/src/video/x11/SDL_x11sym.h index 67b0a793..1a1b102a 100644 --- a/libs/SDL2/src/video/x11/SDL_x11sym.h +++ b/libs/SDL2/src/video/x11/SDL_x11sym.h @@ -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_MODULE(BASEXLIB) 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(char*,XGetAtomName,(Display *a,Atom b),(a,b),return) 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) @@ -185,7 +182,6 @@ SDL_X11_SYM(XkbDescPtr,XkbGetMap,(Display* a,unsigned int b,unsigned int c),(a,b SDL_X11_SYM(void,XkbFreeClientMap,(XkbDescPtr a,unsigned int b, Bool c),(a,b,c),) SDL_X11_SYM(void,XkbFreeKeyboard,(XkbDescPtr a,unsigned int b, Bool c),(a,b,c),) SDL_X11_SYM(Bool,XkbSetDetectableAutoRepeat,(Display* a, Bool b, Bool* c),(a,b,c),return) -SDL_X11_SYM(Bool,XkbSelectEvents,(Display* a, unsigned int b, unsigned int c, unsigned int d),(a,b,c,d),return) #endif #if NeedWidePrototypes @@ -264,15 +260,6 @@ SDL_X11_SYM(void,XdbeFreeVisualInfo,(XdbeScreenVisualInfo *visual_info),(visual_ 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) @@ -289,6 +276,7 @@ SDL_X11_SYM(XIEventMask*,XIGetSelectedEvents,(Display *a,Window b,int *c),(a,b,c #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) @@ -310,6 +298,7 @@ SDL_X11_SYM(Atom*,XRRListOutputProperties,(Display *dpy, RROutput output, int *n 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 */ @@ -325,20 +314,9 @@ SDL_X11_MODULE(XSHAPE) 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 --git a/libs/SDL2/src/video/x11/SDL_x11video.h b/libs/SDL2/src/video/x11/SDL_x11video.h index 8c7eb09e..5360d037 100644 --- a/libs/SDL2/src/video/x11/SDL_x11video.h +++ b/libs/SDL2/src/video/x11/SDL_x11video.h @@ -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,8 @@ typedef struct SDL_VideoData SDL_Point global_mouse_position; Uint32 global_mouse_buttons; + int xrandr_event_base; + #if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM XkbDescPtr xkb; #endif diff --git a/libs/SDL2/src/video/x11/SDL_x11window.c b/libs/SDL2/src/video/x11/SDL_x11window.c index 709f813e..f7ec281b 100644 --- a/libs/SDL2/src/video/x11/SDL_x11window.c +++ b/libs/SDL2/src/video/x11/SDL_x11window.c @@ -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" @@ -72,13 +73,6 @@ X11_XIfEventTimeout(Display *display, XEvent *event_return, Bool (*predicate)(), } */ -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) { @@ -678,8 +672,6 @@ X11_CreateWindow(_THIS, SDL_Window * window) /* For _ICC_PROFILE. */ X11_XSelectInput(display, RootWindow(display, screen), PropertyChangeMask); - X11_XkbSelectEvents(display, XkbUseCoreKbd, XkbStateNotifyMask, XkbStateNotifyMask); - X11_XFlush(display); return 0; @@ -782,11 +774,22 @@ X11_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) X11_XFlush(display); } +static SDL_bool caught_x11_error = SDL_FALSE; +static int +X11_CatchAnyError(Display * d, XErrorEvent * e) +{ + /* this may happen during tumultuous times when we are polling anyhow, + so just note we had an error and return control. */ + caught_x11_error = SDL_TRUE; + return 0; +} + void X11_SetWindowPosition(_THIS, SDL_Window * window) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; Display *display = data->videodata->display; + int (*prev_handler) (Display *, XErrorEvent *) = NULL; unsigned int childCount; Window childReturn, root, parent; Window* children; @@ -805,20 +808,27 @@ X11_SetWindowPosition(_THIS, SDL_Window * window) /* Wait a brief time to see if the window manager decided to let this move happen. If the window changes at all, even to an unexpected value, we break out. */ + X11_XSync(display, False); + prev_handler = X11_XSetErrorHandler(X11_CatchAnyError); + timeout = SDL_GetTicks() + 100; while (SDL_TRUE) { int x, y; + + caught_x11_error = SDL_FALSE; X11_XSync(display, False); X11_XGetWindowAttributes(display, data->xwindow, &attrs); X11_XTranslateCoordinates(display, parent, DefaultRootWindow(display), attrs.x, attrs.y, &x, &y, &childReturn); - if ((x != orig_x) || (y != orig_y)) { - window->x = x; - window->y = y; - break; /* window moved, time to go. */ - } else if ((x == window->x) && (y == window->y)) { - break; /* we're at the place we wanted to be anyhow, drop out. */ + if (!caught_x11_error) { + if ((x != orig_x) || (y != orig_y)) { + window->x = x; + window->y = y; + break; /* window moved, time to go. */ + } else if ((x == window->x) && (y == window->y)) { + break; /* we're at the place we wanted to be anyhow, drop out. */ + } } if (SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) { @@ -827,6 +837,9 @@ X11_SetWindowPosition(_THIS, SDL_Window * window) SDL_Delay(10); } + + X11_XSetErrorHandler(prev_handler); + caught_x11_error = SDL_FALSE; } void @@ -892,6 +905,7 @@ X11_SetWindowSize(_THIS, SDL_Window * window) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; Display *display = data->videodata->display; + int (*prev_handler) (Display *, XErrorEvent *) = NULL; XWindowAttributes attrs; int orig_w, orig_h; Uint32 timeout; @@ -943,19 +957,25 @@ X11_SetWindowSize(_THIS, SDL_Window * window) X11_XResizeWindow(display, data->xwindow, window->w, window->h); } + X11_XSync(display, False); + prev_handler = X11_XSetErrorHandler(X11_CatchAnyError); + /* Wait a brief time to see if the window manager decided to let this resize happen. If the window changes at all, even to an unexpected value, we break out. */ timeout = SDL_GetTicks() + 100; while (SDL_TRUE) { + caught_x11_error = SDL_FALSE; X11_XSync(display, False); X11_XGetWindowAttributes(display, data->xwindow, &attrs); - if ((attrs.width != orig_w) || (attrs.height != orig_h)) { - window->w = attrs.width; - window->h = attrs.height; - break; /* window changed, time to go. */ - } else if ((attrs.width == window->w) && (attrs.height == window->h)) { - break; /* we're at the place we wanted to be anyhow, drop out. */ + if (!caught_x11_error) { + if ((attrs.width != orig_w) || (attrs.height != orig_h)) { + window->w = attrs.width; + window->h = attrs.height; + break; /* window changed, time to go. */ + } else if ((attrs.width == window->w) && (attrs.height == window->h)) { + break; /* we're at the place we wanted to be anyhow, drop out. */ + } } if (SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) { @@ -964,6 +984,9 @@ X11_SetWindowSize(_THIS, SDL_Window * window) SDL_Delay(10); } + + X11_XSetErrorHandler(prev_handler); + caught_x11_error = SDL_FALSE; } int @@ -1051,6 +1074,10 @@ X11_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered) 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 @@ -1281,6 +1308,22 @@ X11_SetWindowFullscreenViaWM(_THIS, SDL_Window * window, SDL_VideoDisplay * _dis if (X11_IsWindowMapped(_this, window)) { XEvent e; + /* !!! FIXME: most of this waiting code is copy/pasted from elsewhere. */ + int (*prev_handler) (Display *, XErrorEvent *) = NULL; + unsigned int childCount; + Window childReturn, root, parent; + Window* children; + XWindowAttributes attrs; + int orig_w, orig_h, orig_x, orig_y; + Uint64 timeout; + + X11_XSync(display, False); + X11_XQueryTree(display, data->xwindow, &root, &parent, &children, &childCount); + X11_XGetWindowAttributes(display, data->xwindow, &attrs); + X11_XTranslateCoordinates(display, parent, DefaultRootWindow(display), + attrs.x, attrs.y, &orig_x, &orig_y, &childReturn); + orig_w = attrs.width; + orig_h = attrs.height; if (!(window->flags & SDL_WINDOW_RESIZABLE)) { /* Compiz refuses fullscreen toggle if we're not resizable, so update the hints so we @@ -1330,6 +1373,48 @@ X11_SetWindowFullscreenViaWM(_THIS, SDL_Window * window, SDL_VideoDisplay * _dis X11_XSendEvent(display, RootWindow(display, displaydata->screen), 0, SubstructureNotifyMask | SubstructureRedirectMask, &e); } + + /* Wait a brief time to see if the window manager decided to let this happen. + If the window changes at all, even to an unexpected value, we break out. */ + X11_XSync(display, False); + prev_handler = X11_XSetErrorHandler(X11_CatchAnyError); + + timeout = SDL_GetTicks64() + 100; + while (SDL_TRUE) { + int x, y; + + caught_x11_error = SDL_FALSE; + X11_XSync(display, False); + X11_XGetWindowAttributes(display, data->xwindow, &attrs); + X11_XTranslateCoordinates(display, parent, DefaultRootWindow(display), + attrs.x, attrs.y, &x, &y, &childReturn); + + if (!caught_x11_error) { + 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. */ + } + } + + if (SDL_GetTicks64() >= timeout) { + break; + } + + SDL_Delay(10); + } + + X11_XSetErrorHandler(prev_handler); + caught_x11_error = SDL_FALSE; } else { Uint32 flags; @@ -1353,161 +1438,12 @@ X11_SetWindowFullscreenViaWM(_THIS, SDL_Window * window, SDL_VideoDisplay * _dis 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) { @@ -1619,7 +1555,7 @@ X11_GetWindowICCProfile(_THIS, SDL_Window * window, size_t * size) 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 { @@ -1659,16 +1595,15 @@ void X11_SetWindowMouseGrab(_THIS, SDL_Window * window, SDL_bool grabbed) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - Display *display = data->videodata->display; - SDL_bool oldstyle_fullscreen; + Display *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 (data == NULL) { + return; + } - if (oldstyle_fullscreen || grabbed) { + display = data->videodata->display; + + 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. */ @@ -1702,11 +1637,6 @@ X11_SetWindowMouseGrab(_THIS, SDL_Window * window, SDL_bool grabbed) /* 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); @@ -1719,7 +1649,13 @@ void X11_SetWindowKeyboardGrab(_THIS, SDL_Window * window, SDL_bool grabbed) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - Display *display = data->videodata->display; + Display *display; + + if (data == NULL) { + return; + } + + display = data->videodata->display; if (grabbed) { /* If the window is unmapped, XGrab calls return GrabNotViewable, @@ -1794,15 +1730,14 @@ X11_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) 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; } } @@ -1892,7 +1827,7 @@ int SDL_X11_SetWindowTitle(Display* display, Window xwindow, char* title) { } 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 --git a/libs/SDL2/src/video/x11/SDL_x11window.h b/libs/SDL2/src/video/x11/SDL_x11window.h index 6f1c71c6..6f7560af 100644 --- a/libs/SDL2/src/video/x11/SDL_x11window.h +++ b/libs/SDL2/src/video/x11/SDL_x11window.h @@ -44,7 +44,6 @@ typedef struct { 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 diff --git a/libs/SDL2/src/video/yuv2rgb/yuv_rgb.c b/libs/SDL2/src/video/yuv2rgb/yuv_rgb.c index 7908b8c4..c7415aa7 100644 --- a/libs/SDL2/src/video/yuv2rgb/yuv_rgb.c +++ b/libs/SDL2/src/video/yuv2rgb/yuv_rgb.c @@ -687,4 +687,38 @@ void rgb24_yuv420_sseu(uint32_t width, uint32_t height, #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 --git a/libs/SDL2/src/video/yuv2rgb/yuv_rgb.h b/libs/SDL2/src/video/yuv2rgb/yuv_rgb.h index 81d97ebd..5668c0fc 100644 --- a/libs/SDL2/src/video/yuv2rgb/yuv_rgb.h +++ b/libs/SDL2/src/video/yuv2rgb/yuv_rgb.h @@ -379,3 +379,34 @@ void rgb24_yuv420_sseu( 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 --git a/libs/SDL2/src/video/yuv2rgb/yuv_rgb_lsx_func.h b/libs/SDL2/src/video/yuv2rgb/yuv_rgb_lsx_func.h new file mode 100644 index 00000000..89d582a6 --- /dev/null +++ b/libs/SDL2/src/video/yuv2rgb/yuv_rgb_lsx_func.h @@ -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 --git a/libs/SDL2/src/video/yuv2rgb/yuv_rgb_sse_func.h b/libs/SDL2/src/video/yuv2rgb/yuv_rgb_sse_func.h index 3c5ee0db..f541017a 100644 --- a/libs/SDL2/src/video/yuv2rgb/yuv_rgb_sse_func.h +++ b/libs/SDL2/src/video/yuv2rgb/yuv_rgb_sse_func.h @@ -426,9 +426,17 @@ void SSE_FUNCTION_NAME(uint32_t width, uint32_t height, const int fix_read_nv12 = 0; #endif +#if YUV_FORMAT == YUV_FORMAT_422 + /* Avoid invalid read on last line */ + const int fix_read_422 = 1; +#else + const int fix_read_422 = 0; +#endif + + if (width >= 32) { uint32_t xpos, ypos; - for(ypos=0; ypos<(height-(uv_y_sample_interval-1)); ypos+=uv_y_sample_interval) + for(ypos=0; ypos<(height-(uv_y_sample_interval-1)) - fix_read_422; ypos+=uv_y_sample_interval) { const uint8_t *y_ptr1=Y+ypos*Y_stride, *y_ptr2=Y+(ypos+1)*Y_stride, @@ -459,6 +467,15 @@ void SSE_FUNCTION_NAME(uint32_t width, uint32_t height, } } + if (fix_read_422) { + 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); + ypos += uv_y_sample_interval; + } + /* Catch the last line, if needed */ if (uv_y_sample_interval == 2 && ypos == (height-1)) { diff --git a/libs/SDL2/src/video/yuv2rgb/yuv_rgb_std_func.h b/libs/SDL2/src/video/yuv2rgb/yuv_rgb_std_func.h index f0ab5c66..94872ec9 100644 --- a/libs/SDL2/src/video/yuv2rgb/yuv_rgb_std_func.h +++ b/libs/SDL2/src/video/yuv2rgb/yuv_rgb_std_func.h @@ -97,10 +97,13 @@ void STD_FUNCTION_NAME( 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 @@ void STD_FUNCTION_NAME( #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 --git a/libs/SDL2/test/CMakeLists.txt b/libs/SDL2/test/CMakeLists.txt index 665d2d72..0781aad1 100644 --- a/libs/SDL2/test/CMakeLists.txt +++ b/libs/SDL2/test/CMakeLists.txt @@ -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,16 @@ if(PSP) psphprm psppower ) +elseif(PS2) +link_libraries( + SDL2main + SDL2_test + SDL2-static + patches + ps2_drivers +) else() - link_libraries(SDL2_test SDL2-static) + link_libraries(SDL2::SDL2test SDL2::SDL2-static) endif() if(WINDOWS) @@ -39,6 +53,8 @@ endif() # 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 +64,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) @@ -57,8 +73,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) @@ -68,9 +84,14 @@ add_executable(testdraw2 testdraw2.c) 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 +100,172 @@ 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) +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(SDL_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,48 +308,49 @@ else() testaudiohotplug testmultiaudio testime - testnative testiconv testoverlay2 teststreaming testviewport ) + if(WINDOWS OR APPLE OR SDL_X11) + list(APPEND NEEDS_RESOURCES testnative) + endif() endif() if(PSP) # Build EBOOT files if building for PSP set(BUILD_EBOOT ${NEEDS_RESOURCES} - testbounds - testgl2 - testsem - testdisplayinfo - teststreaming - testgeometry - testfile - testdraw2 - testviewport - testhittesting - testoverlay2 - testver - testdrawchessboard - testsurround - testintersections - testmessage - testaudiocapture - testerror testatomic - testjoystick - testiconv - testfilesystem - testplatform - testthread - testloadso - testqsort + testaudiocapture testaudioinfo + testbounds + testdisplayinfo + testdraw2 + testdrawchessboard + testerror + testfile + testfilesystem + testgeometry + testgl2 + testhittesting + testiconv + testintersections + testjoystick testlock - testtimer + testmessage + testoverlay2 + testplatform testpower + testqsort + testsem + teststreaming + testsurround + testthread + testtimer + testver + testviewport testwm2 torturethread ) @@ -263,9 +395,23 @@ if(PSP) 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} $) @@ -299,3 +445,47 @@ 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}" + ) + 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 --git a/libs/SDL2/test/Makefile.in b/libs/SDL2/test/Makefile.in index d29dc6ec..435e50fd 100644 --- a/libs/SDL2/test/Makefile.in +++ b/libs/SDL2/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 @@ -79,7 +88,26 @@ 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 $(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 @@ 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 @@ -109,6 +137,7 @@ testautomation$(EXE): $(srcdir)/testautomation.c \ $(srcdir)/testautomation_audio.c \ $(srcdir)/testautomation_clipboard.c \ $(srcdir)/testautomation_events.c \ + $(srcdir)/testautomation_guid.c \ $(srcdir)/testautomation_keyboard.c \ $(srcdir)/testautomation_main.c \ $(srcdir)/testautomation_mouse.c \ @@ -123,13 +152,14 @@ testautomation$(EXE): $(srcdir)/testautomation.c \ $(srcdir)/testautomation_syswm.c \ $(srcdir)/testautomation_timer.c \ $(srcdir)/testautomation_video.c \ - $(srcdir)/testautomation_hints.c + $(srcdir)/testautomation_hints.c \ + $(srcdir)/testautomation_math.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 +195,15 @@ 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 $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@ - + testgl2$(EXE): $(srcdir)/testgl2.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@ @@ -183,7 +213,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 +228,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 +249,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 +285,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 +297,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 +315,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 +333,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 +345,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 +363,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 @@ -344,13 +377,56 @@ testmouse$(EXE): $(srcdir)/testmouse.c 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 \ @@ -364,6 +440,7 @@ DATA = \ testgles2_sdf_img_sdf.bmp \ testyuv.bmp \ unifont-13.0.06.hex \ + utf8.txt \ $(NULL) ifneq ($(srcdir), .) diff --git a/libs/SDL2/test/Makefile.os2 b/libs/SDL2/test/Makefile.os2 index e238af4b..75aaeedf 100644 --- a/libs/SDL2/test/Makefile.os2 +++ b/libs/SDL2/test/Makefile.os2 @@ -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 +INCPATH = -I"$(%WATCOM)/h/os2" -I"$(%WATCOM)/h" + +CFLAGS = -bt=os2 -d0 -q -bm -5s -fp5 -fpi87 -sg -oteanbmier -ei CFLAGS+= -wx -wcd=303 -LIBPATH = .. -LIBS = SDL2.lib SDL2test.lib +TNSRCS = testnative.c testnativeos2.c -#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) - -.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 $@ - -testime.exe: testime.obj - wlink SYS os2v2 libpath $(LIBPATH) lib {$(LIBS) $(TTFLIBS)} op q op el file {$<} name $@ - -clean: .SYMBOLIC - @if exist *.obj rm *.obj - @if exist *.err rm *.err -distclean: .SYMBOLIC clean - @if exist *.exe rm *.exe +!include watcom.mif diff --git a/libs/SDL2/test/Makefile.w32 b/libs/SDL2/test/Makefile.w32 new file mode 100644 index 00000000..51ca7eaf --- /dev/null +++ b/libs/SDL2/test/Makefile.w32 @@ -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 --git a/libs/SDL2/test/autogen.sh b/libs/SDL2/test/autogen.sh index 988d4176..f1716a59 100755 --- a/libs/SDL2/test/autogen.sh +++ b/libs/SDL2/test/autogen.sh @@ -1,11 +1,9 @@ #!/bin/sh +set -e + cp acinclude.m4 aclocal.m4 -if test "$AUTOCONF"x = x; then - AUTOCONF=autoconf -fi - -$AUTOCONF || exit 1 +"${AUTOCONF:-autoconf}" rm aclocal.m4 rm -rf autom4te.cache diff --git a/libs/SDL2/test/checkkeys.c b/libs/SDL2/test/checkkeys.c index caec4b95..9167c5c0 100644 --- a/libs/SDL2/test/checkkeys.c +++ b/libs/SDL2/test/checkkeys.c @@ -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 @@ loop() 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 @@ loop() 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 @@ loop() 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 @@ main(int argc, char *argv[]) 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 --git a/libs/SDL2/test/configure b/libs/SDL2/test/configure index 60344e3e..b598ebe0 100755 --- a/libs/SDL2/test/configure +++ b/libs/SDL2/test/configure @@ -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 @@ esac 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 @@ if test "${PATH_SEPARATOR+set}" != set; then 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 @@ case $0 in #(( 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 @@ if test "x$as_myself" = x; then 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 @@ esac 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_success || { exitcode=1; echo as_fn_success failed.; } 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 @@ fi 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 @@ esac 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_fn_unset () } as_unset=as_fn_unset + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -307,6 +309,14 @@ as_fn_exit () 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_fn_mkdir_p () 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 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ 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 @@ as_fn_executable_p () # 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 @@ fi # as_fn_append # 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_fn_error () 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_me=`$as_basename -- "$0" || $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 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits 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 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits 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 @@ case `echo -n x` in #((((( 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 @@ MFLAGS= 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 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -725,6 +757,7 @@ datadir='${datarootdir}' 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 @@ do *) 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 @@ do 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 @@ do 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 @@ do | -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 @@ do 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 @@ do 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 @@ Try \`$0 --help' for more information" *) # 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 @@ if test -n "$ac_unrecognized_opts"; then 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 @@ fi 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 @@ $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ 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 @@ Fine tuning of the installation directories: --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 @@ if test "$ac_init_help" = "recursive"; then 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 @@ esac 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 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix 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 @@ test -n "$ac_init_help" && exit $ac_status 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 @@ fi 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 @@ $as_echo "$ac_try_echo"; } >&5 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 @@ fi 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 @@ $as_echo "$ac_try_echo"; } >&5 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 @@ fi # 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 @@ case "(($ac_try" in *) 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 @@ case "(($ac_try" in *) 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 @@ $as_echo "$ac_try_echo"; } >&5 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 @@ fi 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 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR 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 @@ do | -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 @@ done # 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 @@ trap 'exit_status=$? 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 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; ) echo - $as_echo "## ----------------- ## + printf "%s\n" "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo @@ -1734,14 +1806,14 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; 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 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; 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 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; 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 @@ ac_signal=0 # 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 @@ if test -r "$cache_file"; then # 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 @@ for ac_var in $ac_precious_vars; do 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 @@ $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} 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 @@ $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} 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_compiler_gnu=$ac_cv_c_compiler_gnu -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 @@ IFS=$ac_save_IFS 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 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + + + + + + + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -2038,11 +2488,12 @@ 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 +{ 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 @@ 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 + 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 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 @@ 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 @@ -2090,11 +2546,15 @@ 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 + 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 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 @@ fi 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 -z "$CC"; then 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 @@ 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 + 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 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 @@ fi 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 @@ 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 - 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 @@ if test $ac_prog_rejected = yes; then # 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 @@ if test -z "$CC"; then 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 @@ 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 + 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 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 @@ if test -z "$CC"; then 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 @@ 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 + 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 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,8 +2797,8 @@ done 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 @@ -2326,25 +2806,129 @@ esac 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 -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +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; } # 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 @@ $as_echo "$ac_try_echo"; } >&5 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 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; @@ -2374,9 +2958,9 @@ ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # 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 @@ case "(($ac_try" in *) 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 @@ do # 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 @@ do 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; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "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; } +{ 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 @@ for ac_file in conftest.exe conftest conftest.*; do * ) 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 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main () +main (void) { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; @@ -2514,8 +3101,8 @@ _ACEOF 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 @@ case "(($ac_try" in *) 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 @@ $as_echo "$ac_try_echo"; } >&5 *) 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 @@ case "(($ac_try" in *) 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 @@ $as_echo "$ac_try_echo"; } >&5 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 @@ main () 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 @@ else /* 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 @@ else 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_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. */ +$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 + +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 + +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. */ -#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]; - -/* 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 **, 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; -} +$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 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $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 @@ main () /* 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 @@ main () 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 @@ main () 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 @@ case "$host" in 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 @@ else 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 @@ esac 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 @@ fi 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 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then 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 @@ else 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 @@ esac 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 @@ if test -z "$ac_cv_path_PKG_CONFIG"; then 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 @@ else 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 @@ esac 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 @@ fi 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 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 @@ fi 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 @@ if test -n "$SDL_LIBS"; then 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 @@ fi 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 @@ fi 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 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 @@ else 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 @@ esac 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 @@ $as_echo_n "checking for SDL - version >= $min_sdl_version... " >&6; } 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 @@ int main (int argc, char *argv[]) _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 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 @@ int main(int argc, char *argv[]) #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 @@ if ac_fn_c_try_link "$LINENO"; then : 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_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; } +{ 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 @@ rm -f conftest.err conftest.i conftest.$ac_ext /* 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 @@ 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 : +if $ac_preproc_ok +then : break fi @@ -3578,29 +4251,24 @@ fi 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 @@ rm -f conftest.err conftest.i conftest.$ac_ext /* 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 @@ 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 : +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_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ 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 @@ if test "x$with_x" = xno; then 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 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 @@ if test "$ac_x_includes" = no; then /* 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 @@ if test "$ac_x_libraries" = no; then /* 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 @@ do 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 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 @@ else 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 @@ if test x$have_x = xyes; then 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 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #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 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #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 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #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 @@ fi -{ $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 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 @@ fi 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 @@ if test -n "$LIBUNWIND_LIBS"; then 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 @@ fi 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 @@ fi 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 @@ _ACEOF 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 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; /^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 @@ $as_echo "$as_me: updating cache $cache_file" >&6;} 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 @@ U= 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 @@ LTLIBOBJS=$ac_ltlibobjs 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 @@ cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 # 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 @@ esac 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 @@ if test "${PATH_SEPARATOR+set}" != set; then 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 @@ case $0 in #(( 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 @@ if test "x$as_myself" = x; then 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_fn_error () 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 @@ as_fn_unset () { 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 @@ fi # as_fn_append # 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_me=`$as_basename -- "$0" || $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_Letters=$as_cr_letters$as_cr_LETTERS 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 @@ case `echo -n x` in #((((( 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_fn_mkdir_p () 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 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ 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 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # 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 @@ $config_files 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 @@ do -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 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 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 @@ exec 5>>config.log 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 @@ done # 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 @@ do 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 @@ do # 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 @@ $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ 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 @@ $as_echo X"$ac_file" | 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 @@ ac_sed_dataroot=' 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 @@ test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { 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 @@ if test "$no_create" != yes; then $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 --git a/libs/SDL2/test/controllermap.c b/libs/SDL2/test/controllermap.c index 308ddf51..429125a1 100644 --- a/libs/SDL2/test/controllermap.c +++ b/libs/SDL2/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/libs/SDL2/test/gcc-fat.sh b/libs/SDL2/test/gcc-fat.sh deleted file mode 100755 index 44d37ffd..00000000 --- a/libs/SDL2/test/gcc-fat.sh +++ /dev/null @@ -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 --git a/libs/SDL2/test/loopwave.c b/libs/SDL2/test/loopwave.c index 14ac4dba..354ac2cb 100644 --- a/libs/SDL2/test/loopwave.c +++ b/libs/SDL2/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/libs/SDL2/test/loopwavequeue.c b/libs/SDL2/test/loopwavequeue.c index a5d0ea3c..1996d784 100644 --- a/libs/SDL2/test/loopwavequeue.c +++ b/libs/SDL2/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/libs/SDL2/test/template.test.in b/libs/SDL2/test/template.test.in new file mode 100644 index 00000000..e1ac063f --- /dev/null +++ b/libs/SDL2/test/template.test.in @@ -0,0 +1,3 @@ +[Test] +Type=session +Exec=@installedtestsdir@/@exe@ diff --git a/libs/SDL2/test/testatomic.c b/libs/SDL2/test/testatomic.c index 16678db5..9efbb29c 100644 --- a/libs/SDL2/test/testatomic.c +++ b/libs/SDL2/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); @@ -709,6 +706,12 @@ main(int argc, char *argv[]) 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 --git a/libs/SDL2/test/testaudiohotplug.c b/libs/SDL2/test/testaudiohotplug.c index 536cc4c3..dc84a782 100644 --- a/libs/SDL2/test/testaudiohotplug.c +++ b/libs/SDL2/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/libs/SDL2/test/testautomation.c b/libs/SDL2/test/testautomation.c index 0dc37f4a..5f469db2 100644 --- a/libs/SDL2/test/testautomation.c +++ b/libs/SDL2/test/testautomation.c @@ -101,7 +101,7 @@ main(int argc, char *argv[]) } /* 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 --git a/libs/SDL2/test/testautomation_guid.c b/libs/SDL2/test/testautomation_guid.c new file mode 100644 index 00000000..0bfedebd --- /dev/null +++ b/libs/SDL2/test/testautomation_guid.c @@ -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 --git a/libs/SDL2/test/testautomation_hints.c b/libs/SDL2/test/testautomation_hints.c index 0d1b7b6f..91b8c02a 100644 --- a/libs/SDL2/test/testautomation_hints.c +++ b/libs/SDL2/test/testautomation_hints.c @@ -8,7 +8,6 @@ #include "SDL_test.h" -const int _numHintsEnum = 25; const char* _HintsEnum[] = { SDL_HINT_ACCELEROMETER_AS_JOYSTICK, @@ -32,9 +31,7 @@ const char* _HintsEnum[] = 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 @@ const char* _HintsVerbose[] = "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 */ diff --git a/libs/SDL2/test/testautomation_main.c b/libs/SDL2/test/testautomation_main.c index 229f2bc5..f267789b 100644 --- a/libs/SDL2/test/testautomation_main.c +++ b/libs/SDL2/test/testautomation_main.c @@ -125,6 +125,26 @@ static int main_testImpliedJoystickQuit (void *arg) #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 mainTest3 = 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 --git a/libs/SDL2/test/testautomation_math.c b/libs/SDL2/test/testautomation_math.c new file mode 100644 index 00000000..8e3d9e55 --- /dev/null +++ b/libs/SDL2/test/testautomation_math.c @@ -0,0 +1,3351 @@ +/** + * 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(EULER == result, + "Exp(%f), expected %f, got %f", + 1.0, EULER, 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 --git a/libs/SDL2/test/testautomation_platform.c b/libs/SDL2/test/testautomation_platform.c index 4e28ba16..5eb37b33 100644 --- a/libs/SDL2/test/testautomation_platform.c +++ b/libs/SDL2/test/testautomation_platform.c @@ -54,12 +54,18 @@ int platform_testTypes(void *arg) 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 @@ int platform_testEndianessAndSwap(void *arg) 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 @@ int platform_testEndianessAndSwap(void *arg) (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 @@ static const SDLTest_TestCaseReference platformTest1 = { (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 --git a/libs/SDL2/test/testautomation_rect.c b/libs/SDL2/test/testautomation_rect.c index 26f03e9b..729ff29d 100644 --- a/libs/SDL2/test/testautomation_rect.c +++ b/libs/SDL2/test/testautomation_rect.c @@ -408,6 +408,32 @@ void _validateRectEqualsResults( refRectB->x, refRectB->y, refRectB->w, refRectB->h); } +/* ! + * \brief Private helper to check SDL_FRectEquals results + */ +void _validateFRectEqualsResults( + SDL_bool equals, SDL_bool expectedEquals, + SDL_FRect *rectA, SDL_FRect *rectB, SDL_FRect *refRectA, SDL_FRect *refRectB) +{ + int cmpRes; + SDLTest_AssertCheck(equals == expectedEquals, + "Check for correct equals result: expected %s, got %s testing (%f,%f,%f,%f) and (%f,%f,%f,%f)", + (expectedEquals == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE", + (equals == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE", + rectA->x, rectA->y, rectA->w, rectA->h, + rectB->x, rectB->y, rectB->w, rectB->h); + cmpRes = SDL_memcmp(rectA, refRectA, sizeof(*rectA)); + SDLTest_AssertCheck(cmpRes == 0, + "Check that source rectangle A was not modified: got (%f,%f,%f,%f) expected (%f,%f,%f,%f)", + rectA->x, rectA->y, rectA->w, rectA->h, + refRectA->x, refRectA->y, refRectA->w, refRectA->h); + cmpRes = SDL_memcmp(rectB, refRectB, sizeof(*rectB)); + SDLTest_AssertCheck(cmpRes == 0, + "Check that source rectangle B was not modified: got (%f,%f,%f,%f) expected (%f,%f,%f,%f)", + rectB->x, rectB->y, rectB->w, rectB->h, + refRectB->x, refRectB->y, refRectB->w, refRectB->h); +} + /* ! * \brief Tests SDL_IntersectRect() with B fully inside A * @@ -681,7 +707,7 @@ int rect_testIntersectRectEmpty (void *arg) int rect_testIntersectRectParam(void *arg) { SDL_Rect rectA; - SDL_Rect rectB; + SDL_Rect rectB = {0}; SDL_Rect result; SDL_bool intersection; @@ -936,7 +962,7 @@ int rect_testHasIntersectionEmpty (void *arg) int rect_testHasIntersectionParam(void *arg) { SDL_Rect rectA; - SDL_Rect rectB; + SDL_Rect rectB = {0}; SDL_bool intersection; /* invalid parameter combinations */ @@ -1205,7 +1231,7 @@ int rect_testEnclosePointsParam(void *arg) { SDL_Point points[1]; int count; - SDL_Rect clip; + SDL_Rect clip = { 0 }; SDL_Rect result; SDL_bool anyEnclosed; @@ -1431,7 +1457,7 @@ int rect_testUnionRectInside(void *arg) */ int rect_testUnionRectParam(void *arg) { - SDL_Rect rectA, rectB; + SDL_Rect rectA, rectB = { 0 }; SDL_Rect result; /* invalid parameter combinations */ @@ -1574,6 +1600,69 @@ int rect_testRectEqualsParam(void *arg) return TEST_COMPLETED; } +/* ! + * \brief Tests SDL_FRectEquals() with various inputs + * + * \sa + * http://wiki.libsdl.org/SDL_FRectEquals + */ +int rect_testFRectEquals(void *arg) +{ + SDL_FRect refRectA; + SDL_FRect refRectB; + SDL_FRect rectA; + SDL_FRect rectB; + SDL_bool expectedResult; + SDL_bool result; + + /* Equals */ + refRectA.x=(float)SDLTest_RandomIntegerInRange(-1024, 1024); + refRectA.y=(float)SDLTest_RandomIntegerInRange(-1024, 1024); + refRectA.w=(float)SDLTest_RandomIntegerInRange(1, 1024); + refRectA.h=(float)SDLTest_RandomIntegerInRange(1, 1024); + refRectB = refRectA; + expectedResult = SDL_TRUE; + rectA = refRectA; + rectB = refRectB; + result = (SDL_bool)SDL_FRectEquals((const SDL_FRect *)&rectA, (const SDL_FRect *)&rectB); + _validateFRectEqualsResults(result, expectedResult, &rectA, &rectB, &refRectA, &refRectB); + + return TEST_COMPLETED; +} + +/* ! + * \brief Negative tests against SDL_FRectEquals() with invalid parameters + * + * \sa + * http://wiki.libsdl.org/SDL_FRectEquals + */ +int rect_testFRectEqualsParam(void *arg) +{ + SDL_FRect rectA; + SDL_FRect rectB; + SDL_bool result; + + /* data setup -- For the purpose of this test, the values don't matter. */ + rectA.x=SDLTest_RandomFloat(); + rectA.y=SDLTest_RandomFloat(); + rectA.w=SDLTest_RandomFloat(); + rectA.h=SDLTest_RandomFloat(); + rectB.x=SDLTest_RandomFloat(); + rectB.y=SDLTest_RandomFloat(); + rectB.w=SDLTest_RandomFloat(); + rectB.h=SDLTest_RandomFloat(); + + /* invalid parameter combinations */ + result = (SDL_bool)SDL_FRectEquals((const SDL_FRect *)NULL, (const SDL_FRect *)&rectB); + SDLTest_AssertCheck(result == SDL_FALSE, "Check that function returns SDL_FALSE when 1st parameter is NULL"); + result = (SDL_bool)SDL_FRectEquals((const SDL_FRect *)&rectA, (const SDL_FRect *)NULL); + SDLTest_AssertCheck(result == SDL_FALSE, "Check that function returns SDL_FALSE when 2nd parameter is NULL"); + result = (SDL_bool)SDL_FRectEquals((const SDL_FRect *)NULL, (const SDL_FRect *)NULL); + SDLTest_AssertCheck(result == SDL_FALSE, "Check that function returns SDL_FALSE when 1st and 2nd parameter are NULL"); + + return TEST_COMPLETED; +} + /* ================= Test References ================== */ /* Rect test cases */ @@ -1673,6 +1762,13 @@ static const SDLTest_TestCaseReference rectTest28 = static const SDLTest_TestCaseReference rectTest29 = { (SDLTest_TestCaseFp)rect_testRectEqualsParam, "rect_testRectEqualsParam", "Negative tests against SDL_RectEquals with invalid parameters", TEST_ENABLED }; +/* SDL_FRectEquals */ + +static const SDLTest_TestCaseReference rectTest30 = + { (SDLTest_TestCaseFp)rect_testFRectEquals, "rect_testFRectEquals", "Tests SDL_FRectEquals with various inputs", TEST_ENABLED }; + +static const SDLTest_TestCaseReference rectTest31 = + { (SDLTest_TestCaseFp)rect_testFRectEqualsParam, "rect_testFRectEqualsParam", "Negative tests against SDL_FRectEquals with invalid parameters", TEST_ENABLED }; /* ! * \brief Sequence of Rect test cases; functions that handle simple rectangles including overlaps and merges. @@ -1683,7 +1779,7 @@ static const SDLTest_TestCaseReference rectTest29 = static const SDLTest_TestCaseReference *rectTests[] = { &rectTest1, &rectTest2, &rectTest3, &rectTest4, &rectTest5, &rectTest6, &rectTest7, &rectTest8, &rectTest9, &rectTest10, &rectTest11, &rectTest12, &rectTest13, &rectTest14, &rectTest15, &rectTest16, &rectTest17, &rectTest18, &rectTest19, &rectTest20, &rectTest21, &rectTest22, &rectTest23, &rectTest24, &rectTest25, &rectTest26, &rectTest27, - &rectTest28, &rectTest29, NULL + &rectTest28, &rectTest29, &rectTest30, &rectTest31, NULL }; diff --git a/libs/SDL2/test/testautomation_render.c b/libs/SDL2/test/testautomation_render.c index 42fc54de..0117334a 100644 --- a/libs/SDL2/test/testautomation_render.c +++ b/libs/SDL2/test/testautomation_render.c @@ -187,14 +187,14 @@ int render_testPrimitives (void *arg) ret = SDL_RenderDrawLine(renderer, 79, 59, 50, 30 ); SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret); - - /* Make current */ - SDL_RenderPresent(renderer); - + /* See if it's the same. */ referenceSurface = SDLTest_ImagePrimitives(); _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE ); + /* Make current */ + SDL_RenderPresent(renderer); + /* Clean up. */ SDL_FreeSurface(referenceSurface); referenceSurface = NULL; @@ -335,13 +335,13 @@ int render_testPrimitivesBlend (void *arg) SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetRenderDrawBlendMode, expected: 0, got: %i", checkFailCount2); SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_RenderDrawPoint, expected: 0, got: %i", checkFailCount3); - /* Make current */ - SDL_RenderPresent(renderer); - /* See if it's the same. */ referenceSurface = SDLTest_ImagePrimitivesBlend(); _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED ); + /* Make current */ + SDL_RenderPresent(renderer); + /* Clean up. */ SDL_FreeSurface(referenceSurface); referenceSurface = NULL; @@ -404,13 +404,13 @@ render_testBlit(void *arg) } SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount1); - /* Make current */ - SDL_RenderPresent(renderer); - /* See if it's the same */ referenceSurface = SDLTest_ImageBlit(); _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE ); + /* Make current */ + SDL_RenderPresent(renderer); + /* Clean up. */ SDL_DestroyTexture( tface ); SDL_FreeSurface(referenceSurface); @@ -478,13 +478,13 @@ render_testBlitColor (void *arg) SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureColorMod, expected: 0, got: %i", checkFailCount1); SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2); - /* Make current */ - SDL_RenderPresent(renderer); - /* See if it's the same. */ referenceSurface = SDLTest_ImageBlitColor(); _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE ); + /* Make current */ + SDL_RenderPresent(renderer); + /* Clean up. */ SDL_DestroyTexture( tface ); SDL_FreeSurface(referenceSurface); @@ -555,13 +555,13 @@ render_testBlitAlpha (void *arg) SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureAlphaMod, expected: 0, got: %i", checkFailCount1); SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2); - /* Make current */ - SDL_RenderPresent(renderer); - /* See if it's the same. */ referenceSurface = SDLTest_ImageBlitAlpha(); _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED ); + /* Make current */ + SDL_RenderPresent(renderer); + /* Clean up. */ SDL_DestroyTexture( tface ); SDL_FreeSurface(referenceSurface); @@ -674,9 +674,10 @@ render_testBlitBlend (void *arg) _testBlitBlendMode( tface, SDL_BLENDMODE_NONE ); referenceSurface = SDLTest_ImageBlitBlendNone(); - /* Make current and compare */ - SDL_RenderPresent(renderer); + /* Compare, then Present */ _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE ); + SDL_RenderPresent(renderer); + SDL_FreeSurface(referenceSurface); referenceSurface = NULL; @@ -684,9 +685,10 @@ render_testBlitBlend (void *arg) _testBlitBlendMode( tface, SDL_BLENDMODE_BLEND ); referenceSurface = SDLTest_ImageBlitBlend(); - /* Make current and compare */ - SDL_RenderPresent(renderer); + /* Compare, then Present */ _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED ); + SDL_RenderPresent(renderer); + SDL_FreeSurface(referenceSurface); referenceSurface = NULL; @@ -694,9 +696,10 @@ render_testBlitBlend (void *arg) _testBlitBlendMode( tface, SDL_BLENDMODE_ADD ); referenceSurface = SDLTest_ImageBlitBlendAdd(); - /* Make current and compare */ - SDL_RenderPresent(renderer); + /* Compare, then Present */ _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED ); + SDL_RenderPresent(renderer); + SDL_FreeSurface(referenceSurface); referenceSurface = NULL; @@ -704,9 +707,10 @@ render_testBlitBlend (void *arg) _testBlitBlendMode( tface, SDL_BLENDMODE_MOD); referenceSurface = SDLTest_ImageBlitBlendMod(); - /* Make current and compare */ - SDL_RenderPresent(renderer); + /* Compare, then Present */ _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED ); + SDL_RenderPresent(renderer); + SDL_FreeSurface(referenceSurface); referenceSurface = NULL; @@ -753,12 +757,13 @@ render_testBlitBlend (void *arg) /* Clean up. */ SDL_DestroyTexture( tface ); - /* Make current */ - SDL_RenderPresent(renderer); - /* Check to see if final image matches. */ referenceSurface = SDLTest_ImageBlitBlendAll(); _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED); + + /* Make current */ + SDL_RenderPresent(renderer); + SDL_FreeSurface(referenceSurface); referenceSurface = NULL; diff --git a/libs/SDL2/test/testautomation_stdlib.c b/libs/SDL2/test/testautomation_stdlib.c index bfc8ad37..1956d737 100644 --- a/libs/SDL2/test/testautomation_stdlib.c +++ b/libs/SDL2/test/testautomation_stdlib.c @@ -319,6 +319,176 @@ stdlib_sscanf(void *arg) 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 stdlibTest3 = 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 --git a/libs/SDL2/test/testautomation_suites.h b/libs/SDL2/test/testautomation_suites.h index b5f921e3..a03cdbcb 100644 --- a/libs/SDL2/test/testautomation_suites.h +++ b/libs/SDL2/test/testautomation_suites.h @@ -12,6 +12,7 @@ extern SDLTest_TestSuiteReference audioTestSuite; extern SDLTest_TestSuiteReference clipboardTestSuite; extern SDLTest_TestSuiteReference eventsTestSuite; +extern SDLTest_TestSuiteReference guidTestSuite; extern SDLTest_TestSuiteReference keyboardTestSuite; extern SDLTest_TestSuiteReference mainTestSuite; extern SDLTest_TestSuiteReference mouseTestSuite; @@ -27,12 +28,14 @@ extern SDLTest_TestSuiteReference syswmTestSuite; extern SDLTest_TestSuiteReference timerTestSuite; extern SDLTest_TestSuiteReference videoTestSuite; extern SDLTest_TestSuiteReference hintsTestSuite; +extern SDLTest_TestSuiteReference mathTestSuite; /* All test suites */ SDLTest_TestSuiteReference *testSuites[] = { &audioTestSuite, &clipboardTestSuite, &eventsTestSuite, + &guidTestSuite, &keyboardTestSuite, &mainTestSuite, &mouseTestSuite, @@ -48,6 +51,7 @@ SDLTest_TestSuiteReference *testSuites[] = { &timerTestSuite, &videoTestSuite, &hintsTestSuite, + &mathTestSuite, NULL }; diff --git a/libs/SDL2/test/testautomation_surface.c b/libs/SDL2/test/testautomation_surface.c index fcfaad66..63d4c294 100644 --- a/libs/SDL2/test/testautomation_surface.c +++ b/libs/SDL2/test/testautomation_surface.c @@ -178,6 +178,10 @@ void _testBlitBlendMode(int mode) 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++; @@ -333,7 +337,7 @@ surface_testCompleteSurfaceConversion(void *arg) SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGRA8888, - /*SDL_PIXELFORMAT_ARGB2101010,*/ /* SDL_PIXELFORMAT_ARGB2101010 isn't fully supported yet */ + SDL_PIXELFORMAT_ARGB2101010, }; SDL_Surface *face = NULL, *cvt1, *cvt2, *final; SDL_PixelFormat *fmt1, *fmt2; @@ -589,6 +593,177 @@ surface_testBlitBlendLoop(void *arg) { } +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 surfaceTest11 = 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 --git a/libs/SDL2/test/testautomation_video.c b/libs/SDL2/test/testautomation_video.c index 342848ac..c5b648cf 100644 --- a/libs/SDL2/test/testautomation_video.c +++ b/libs/SDL2/test/testautomation_video.c @@ -1372,7 +1372,8 @@ video_getSetWindowMinimumSize(void *arg) 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 @@ video_getSetWindowData(void *arg) 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 videoTest22 = 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 --git a/libs/SDL2/test/testcustomcursor.c b/libs/SDL2/test/testcustomcursor.c index 2feee81a..698d31f9 100644 --- a/libs/SDL2/test/testcustomcursor.c +++ b/libs/SDL2/test/testcustomcursor.c @@ -135,6 +135,8 @@ init_system_cursor(const char *image[]) 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 @@ loop() 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 @@ main(int argc, char *argv[]) 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); - } - 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 = init_system_cursor(arrow); + if (cursor) { + cursors[num_cursors] = cursor; + cursor_types[num_cursors] = (SDL_SystemCursor)-1; + num_cursors++; } } - SDL_SetCursor(cursors[0]); + + for (i = 0; i < SDL_NUM_SYSTEM_CURSORS; ++i) { + SDL_Cursor *cursor = SDL_CreateSystemCursor((SDL_SystemCursor)i); + if (cursor) { + cursors[num_cursors] = cursor; + cursor_types[num_cursors] = i; + num_cursors++; + } + } + + if (num_cursors > 0) { + SDL_SetCursor(cursors[0]); + } + + show_cursor = SDL_ShowCursor(SDL_QUERY); /* Main render loop */ done = 0; @@ -247,7 +287,7 @@ main(int argc, char *argv[]) } #endif - for (i = 0; i < SDL_arraysize(cursors); ++i) { + for (i = 0; i < num_cursors; ++i) { SDL_FreeCursor(cursors[i]); } quit(0); diff --git a/libs/SDL2/test/testerror.c b/libs/SDL2/test/testerror.c index e847c282..c118abde 100644 --- a/libs/SDL2/test/testerror.c +++ b/libs/SDL2/test/testerror.c @@ -58,6 +58,12 @@ main(int argc, char *argv[]) /* 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 --git a/libs/SDL2/test/testevdev.c b/libs/SDL2/test/testevdev.c index 572c60a0..938a9a50 100644 --- a/libs/SDL2/test/testevdev.c +++ b/libs/SDL2/test/testevdev.c @@ -41,6 +41,7 @@ static const struct CLS(SOUND), CLS(TOUCHSCREEN), CLS(ACCELEROMETER), + CLS(TOUCHPAD), #undef CLS { 0, NULL } }; @@ -185,9 +186,7 @@ static const GuessTest guess_tests[] = .bus_type = 0x0003, .vendor_id = 0x054c, .product_id = 0x09cc, - /* TODO: Should this be MOUSE? That's what it most closely - * resembles */ - .expected = SDL_UDEV_DEVICE_UNKNOWN, + .expected = SDL_UDEV_DEVICE_TOUCHPAD, /* SYN, KEY, ABS */ .ev = { 0x0b }, /* X, Y, multitouch */ @@ -596,7 +595,7 @@ static const GuessTest guess_tests[] = * to the arrow, page up and page down keys, so it's a joystick * with a subset of a keyboard attached. */ /* TODO: Should this be JOYSTICK, or even JOYSTICK|KEYBOARD? */ - .expected = SDL_UDEV_DEVICE_UNKNOWN, + .expected = SDL_UDEV_DEVICE_KEYBOARD, /* SYN, KEY */ .ev = { 0x03 }, .keys = { @@ -608,7 +607,7 @@ static const GuessTest guess_tests[] = /* BTN_1, BTN_2, BTN_A, BTN_B, BTN_MODE */ /* 0x100 */ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x10, /* 0x140 */ ZEROx8, - /* next, previous */ + /* next (keyboard page down), previous (keyboard page up) */ /* 0x180 */ 0x00, 0x00, 0x80, 0x10, ZEROx4, }, }, @@ -659,7 +658,7 @@ static const GuessTest guess_tests[] = .name = "Wiimote - Classic Controller", /* TODO: Should this be JOYSTICK, or maybe JOYSTICK|KEYBOARD? * It's unusual in the same ways as the Wiimote */ - .expected = SDL_UDEV_DEVICE_UNKNOWN, + .expected = SDL_UDEV_DEVICE_KEYBOARD, /* SYN, KEY, ABS */ .ev = { 0x0b }, /* Hat 1-3 */ @@ -673,7 +672,7 @@ static const GuessTest guess_tests[] = /* A, B, X, Y, MODE, TL, TL2, TR, TR2 */ /* 0x100 */ ZEROx4, 0x00, 0x13, 0xdb, 0x10, /* 0x140 */ ZEROx8, - /* next, previous */ + /* next (keyboard page down), previous (keyboard page up) */ /* 0x180 */ 0x00, 0x00, 0x80, 0x10, ZEROx4, }, }, @@ -718,9 +717,7 @@ static const GuessTest guess_tests[] = .vendor_id = 0x06cb, .product_id = 0x0000, .version = 0x0000, - /* TODO: Should this be MOUSE? That's what it most closely - * resembles */ - .expected = SDL_UDEV_DEVICE_UNKNOWN, + .expected = SDL_UDEV_DEVICE_TOUCHPAD, /* SYN, KEY, ABS */ .ev = { 0x0b }, /* X, Y, pressure, multitouch */ @@ -756,7 +753,8 @@ static const GuessTest guess_tests[] = }, { .name = "Thinkpad ACPI buttons", - .expected = SDL_UDEV_DEVICE_UNKNOWN, + /* SDL treats this as a keyboard because it has a power button */ + .expected = SDL_UDEV_DEVICE_KEYBOARD, /* SYN, KEY, MSC, SW */ .ev = { 0x33 }, .keys = { @@ -815,7 +813,8 @@ static const GuessTest guess_tests[] = .vendor_id = 0x0000, .product_id = 0x0003, .version = 0x0000, - .expected = SDL_UDEV_DEVICE_UNKNOWN, + /* SDL treats KEY_SLEEP as indicating a keyboard */ + .expected = SDL_UDEV_DEVICE_KEYBOARD, /* SYN, KEY */ .ev = { 0x03 }, .keys = { @@ -841,7 +840,8 @@ static const GuessTest guess_tests[] = .vendor_id = 0x0000, .product_id = 0x0001, .version = 0x0000, - .expected = SDL_UDEV_DEVICE_UNKNOWN, + /* SDL treats KEY_POWER as indicating a keyboard */ + .expected = SDL_UDEV_DEVICE_KEYBOARD, /* SYN, KEY */ .ev = { 0x03 }, .keys = { @@ -856,7 +856,8 @@ static const GuessTest guess_tests[] = .vendor_id = 0x0000, .product_id = 0x0006, .version = 0x0000, - .expected = SDL_UDEV_DEVICE_UNKNOWN, + /* SDL treats brightness control, etc. as keyboard keys */ + .expected = SDL_UDEV_DEVICE_KEYBOARD, /* SYN, KEY */ .ev = { 0x03 }, .keys = { @@ -873,7 +874,7 @@ static const GuessTest guess_tests[] = .vendor_id = 0x17aa, .product_id = 0x5054, .version = 0x4101, - .expected = SDL_UDEV_DEVICE_UNKNOWN, + .expected = SDL_UDEV_DEVICE_KEYBOARD, /* SYN, KEY */ .ev = { 0x03 }, .keys = { @@ -911,9 +912,8 @@ static const GuessTest guess_tests[] = .product_id = 0x6009, /* For some reason the special keys like mute and wlan toggle * show up here instead of, or in addition to, as part of - * the keyboard - so udev reports this as having keys too. - * SDL currently doesn't. */ - .expected = SDL_UDEV_DEVICE_MOUSE, + * the keyboard - so both udev and SDL report this as having keys too. */ + .expected = SDL_UDEV_DEVICE_MOUSE | SDL_UDEV_DEVICE_KEYBOARD, /* SYN, KEY, REL, MSC, LED */ .ev = { 0x17, 0x00, 0x02 }, /* X, Y */ @@ -1019,7 +1019,7 @@ static int run_test(void) { printf("SDL compiled without evdev capability check.\n"); - return 0; + return 1; } #endif diff --git a/libs/SDL2/test/testfilesystem.c b/libs/SDL2/test/testfilesystem.c index 9862608d..d60308d0 100644 --- a/libs/SDL2/test/testfilesystem.c +++ b/libs/SDL2/test/testfilesystem.c @@ -37,7 +37,7 @@ main(int argc, char *argv[]) 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 @@ main(int argc, char *argv[]) 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 --git a/libs/SDL2/test/testgamecontroller.c b/libs/SDL2/test/testgamecontroller.c index 077a6abd..bd228107 100644 --- a/libs/SDL2/test/testgamecontroller.c +++ b/libs/SDL2/test/testgamecontroller.c @@ -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 @@ static const struct { int x; int y; } button_positions[] = { {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,7 @@ static const struct { int x; int y; double angle; } axis_positions[] = { {91, -20, 0.0}, /* TRIGGERLEFT */ {375, -20, 0.0}, /* TRIGGERRIGHT */ }; +SDL_COMPILE_TIME_ASSERT(axis_positions, SDL_arraysize(axis_positions) == SDL_CONTROLLER_AXIS_MAX); static SDL_Window *window = NULL; static SDL_Renderer *screen = NULL; @@ -71,6 +79,11 @@ static SDL_Texture *background_front, *background_back, *button, *axis; 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 +133,7 @@ static void AddController(int device_index, SDL_bool verbose) 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 +165,15 @@ static void AddController(int device_index, SDL_bool verbose) 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 +238,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 */ @@ -306,12 +300,223 @@ static void CyclePS5TriggerEffect() 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 +587,24 @@ loop(void *arg) } 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 +614,14 @@ loop(void *arg) } 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 +634,7 @@ loop(void *arg) } } - 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 +650,8 @@ loop(void *arg) 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 +666,16 @@ loop(void *arg) 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 +730,7 @@ loop(void *arg) } } } - + SDL_Delay(16); SDL_RenderPresent(screen); #ifdef __EMSCRIPTEN__ @@ -529,6 +752,7 @@ main(int argc, char *argv[]) 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"); SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1"); SDL_SetHint(SDL_HINT_LINUX_JOYSTICK_DEADZONES, "1"); @@ -559,6 +783,7 @@ main(int argc, char *argv[]) /* 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), @@ -567,6 +792,7 @@ main(int argc, char *argv[]) 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"; @@ -602,10 +828,11 @@ main(int argc, char *argv[]) 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()); @@ -633,10 +860,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); @@ -649,8 +876,14 @@ main(int argc, char *argv[]) /* !!! 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]; @@ -674,6 +907,7 @@ main(int argc, char *argv[]) CyclePS5TriggerEffect(); } + CloseVirtualController(); SDL_DestroyRenderer(screen); SDL_DestroyWindow(window); SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER); diff --git a/libs/SDL2/test/testgeometry.c b/libs/SDL2/test/testgeometry.c index 3a87e3d2..f0f07eed 100644 --- a/libs/SDL2/test/testgeometry.c +++ b/libs/SDL2/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/libs/SDL2/test/testgesture.c b/libs/SDL2/test/testgesture.c index b4bce696..856fd6a2 100644 --- a/libs/SDL2/test/testgesture.c +++ b/libs/SDL2/test/testgesture.c @@ -190,7 +190,8 @@ loop(void) case SDLK_i: { for (i = 0; i < SDL_GetNumTouchDevices(); ++i) { const SDL_TouchID id = SDL_GetTouchDevice(i); - SDL_Log("Fingers Down on device %"SDL_PRIs64": %d", id, SDL_GetNumTouchFingers(id)); + const char *name = SDL_GetTouchName(i); + SDL_Log("Fingers Down on device %"SDL_PRIs64" (%s): %d", id, name, SDL_GetNumTouchFingers(id)); } break; } diff --git a/libs/SDL2/test/testgles2.c b/libs/SDL2/test/testgles2.c index b6180aea..4b9e5d25 100644 --- a/libs/SDL2/test/testgles2.c +++ b/libs/SDL2/test/testgles2.c @@ -38,6 +38,18 @@ typedef struct GLES2_Context #undef SDL_PROC } GLES2_Context; +typedef struct shader_data +{ + GLuint shader_program, shader_frag, shader_vert; + + GLint attr_position; + GLint attr_color, attr_mvp; + + int angle_x, angle_y, angle_z; + + GLuint position_buffer; + GLuint color_buffer; +} shader_data; static SDLTest_CommonState *state; static SDL_GLContext *context = NULL; @@ -197,13 +209,13 @@ multiply_matrix(float *lhs, float *rhs, float *r) * source: Passed-in shader source code. * shader_type: Passed to GL, e.g. GL_VERTEX_SHADER. */ -void +static void process_shader(GLuint *shader, const char * source, GLint shader_type) { GLint status = GL_FALSE; const char *shaders[1] = { NULL }; char buffer[1024]; - GLsizei length; + GLsizei length = 0; /* Create shader and load into GL. */ *shader = GL_CHECK(ctx.glCreateShader(shader_type)); @@ -221,13 +233,35 @@ process_shader(GLuint *shader, const char * source, GLint shader_type) /* Dump debug info (source and log) if compilation failed. */ if(status != GL_TRUE) { - ctx.glGetProgramInfoLog(*shader, sizeof(buffer), &length, &buffer[0]); + ctx.glGetShaderInfoLog(*shader, sizeof(buffer), &length, &buffer[0]); buffer[length] = '\0'; - SDL_Log("Shader compilation failed: %s", buffer);fflush(stderr); + SDL_Log("Shader compilation failed: %s", buffer); + fflush(stderr); quit(-1); } } +static void +link_program(struct shader_data *data) +{ + GLint status = GL_FALSE; + char buffer[1024]; + GLsizei length = 0; + + GL_CHECK(ctx.glAttachShader(data->shader_program, data->shader_vert)); + GL_CHECK(ctx.glAttachShader(data->shader_program, data->shader_frag)); + GL_CHECK(ctx.glLinkProgram(data->shader_program)); + GL_CHECK(ctx.glGetProgramiv(data->shader_program, GL_LINK_STATUS, &status)); + + if(status != GL_TRUE) { + ctx.glGetProgramInfoLog(data->shader_program, sizeof(buffer), &length, &buffer[0]); + buffer[length] = '\0'; + SDL_Log("Program linking failed: %s", buffer); + fflush(stderr); + quit(-1); + } +} + /* 3D data. Vertex range -0.5..0.5 in all axes. * Z -0.5 is near, 0.5 is far. */ const float _vertices[] = @@ -363,17 +397,6 @@ const char* _shader_frag_src = " gl_FragColor = vec4(vv3color, 1.0); " " } "; -typedef struct shader_data -{ - GLuint shader_program, shader_frag, shader_vert; - - GLint attr_position; - GLint attr_color, attr_mvp; - - int angle_x, angle_y, angle_z; - -} shader_data; - static void Render(unsigned int width, unsigned int height, shader_data* data) { @@ -431,7 +454,7 @@ void loop() switch (event.type) { case SDL_WINDOWEVENT: switch (event.window.event) { - case SDL_WINDOWEVENT_RESIZED: + case SDL_WINDOWEVENT_SIZE_CHANGED: for (i = 0; i < state->num_windows; ++i) { if (event.window.windowID == SDL_GetWindowID(state->windows[i])) { int w, h; @@ -670,9 +693,7 @@ main(int argc, char *argv[]) data->shader_program = GL_CHECK(ctx.glCreateProgram()); /* Attach shaders and link shader_program */ - GL_CHECK(ctx.glAttachShader(data->shader_program, data->shader_vert)); - GL_CHECK(ctx.glAttachShader(data->shader_program, data->shader_frag)); - GL_CHECK(ctx.glLinkProgram(data->shader_program)); + link_program(data); /* Get attribute locations of non-fixed attributes like color and texture coordinates. */ data->attr_position = GL_CHECK(ctx.glGetAttribLocation(data->shader_program, "av4position")); @@ -688,8 +709,18 @@ main(int argc, char *argv[]) GL_CHECK(ctx.glEnableVertexAttribArray(data->attr_color)); /* Populate attributes for position, color and texture coordinates etc. */ - GL_CHECK(ctx.glVertexAttribPointer(data->attr_position, 3, GL_FLOAT, GL_FALSE, 0, _vertices)); - GL_CHECK(ctx.glVertexAttribPointer(data->attr_color, 3, GL_FLOAT, GL_FALSE, 0, _colors)); + + GL_CHECK(ctx.glGenBuffers(1, &data->position_buffer)); + GL_CHECK(ctx.glBindBuffer(GL_ARRAY_BUFFER, data->position_buffer)); + GL_CHECK(ctx.glBufferData(GL_ARRAY_BUFFER, sizeof(_vertices), _vertices, GL_STATIC_DRAW)); + GL_CHECK(ctx.glVertexAttribPointer(data->attr_position, 3, GL_FLOAT, GL_FALSE, 0, 0)); + GL_CHECK(ctx.glBindBuffer(GL_ARRAY_BUFFER, 0)); + + GL_CHECK(ctx.glGenBuffers(1, &data->color_buffer)); + GL_CHECK(ctx.glBindBuffer(GL_ARRAY_BUFFER, data->color_buffer)); + GL_CHECK(ctx.glBufferData(GL_ARRAY_BUFFER, sizeof(_colors), _colors, GL_STATIC_DRAW)); + GL_CHECK(ctx.glVertexAttribPointer(data->attr_color, 3, GL_FLOAT, GL_FALSE, 0, 0)); + GL_CHECK(ctx.glBindBuffer(GL_ARRAY_BUFFER, 0)); GL_CHECK(ctx.glEnable(GL_CULL_FACE)); GL_CHECK(ctx.glEnable(GL_DEPTH_TEST)); diff --git a/libs/SDL2/test/testgles2_sdf.c b/libs/SDL2/test/testgles2_sdf.c index a7f8016e..064b6bc2 100644 --- a/libs/SDL2/test/testgles2_sdf.c +++ b/libs/SDL2/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); - if (tmp == NULL) { - SDL_Log("missing image file: %s", f); + path = GetNearbyFilename(f); + + if (path == NULL) + path = SDL_strdup(f); + + if (path == NULL) { + SDL_Log("out of memory\n"); exit(-1); - } else { - SDL_Log("Load image file: %s", f); } + tmp = SDL_LoadBMP(path); + if (tmp == NULL) { + SDL_Log("missing image file: %s", path); + exit(-1); + } else { + SDL_Log("Load image file: %s", path); + } + + SDL_free(path); #else /* Generate SDF image using SDL_ttf */ diff --git a/libs/SDL2/test/testiconv.c b/libs/SDL2/test/testiconv.c index bf9ad3b9..31d05e19 100644 --- a/libs/SDL2/test/testiconv.c +++ b/libs/SDL2/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/libs/SDL2/test/testime.c b/libs/SDL2/test/testime.c index 5541d484..15583422 100644 --- a/libs/SDL2/test/testime.c +++ b/libs/SDL2/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/libs/SDL2/test/testmouse.c b/libs/SDL2/test/testmouse.c index 0c9f7ee1..11a17606 100644 --- a/libs/SDL2/test/testmouse.c +++ b/libs/SDL2/test/testmouse.c @@ -39,6 +39,11 @@ static Line *active = NULL; static Line *lines = NULL; static int buttons = 0; +static SDL_bool wheel_x_active = SDL_FALSE; +static SDL_bool wheel_y_active = SDL_FALSE; +static float wheel_x = SCREEN_WIDTH * 0.5f; +static float wheel_y = SCREEN_HEIGHT * 0.5f; + static SDL_bool done = SDL_FALSE; void @@ -81,6 +86,25 @@ loop(void *arg) /* Check for events */ while (SDL_PollEvent(&event)) { switch (event.type) { + case SDL_MOUSEWHEEL: + if (event.wheel.direction == SDL_MOUSEWHEEL_FLIPPED) { + event.wheel.preciseX *= -1.0f; + event.wheel.preciseY *= -1.0f; + event.wheel.x *= -1; + event.wheel.y *= -1; + } + if (event.wheel.preciseX != 0.0f) { + wheel_x_active = SDL_TRUE; + /* "positive to the right and negative to the left" */ + wheel_x += event.wheel.preciseX * 10.0f; + } + if (event.wheel.preciseY != 0.0f) { + wheel_y_active = SDL_TRUE; + /* "positive away from the user and negative towards the user" */ + wheel_y -= event.wheel.preciseY * 10.0f; + } + break; + case SDL_MOUSEMOTION: if (!active) break; @@ -100,6 +124,8 @@ loop(void *arg) case SDL_BUTTON_LEFT: active->r = 255; buttons |= SDL_BUTTON_LMASK; break; case SDL_BUTTON_MIDDLE: active->g = 255; buttons |= SDL_BUTTON_MMASK; break; case SDL_BUTTON_RIGHT: active->b = 255; buttons |= SDL_BUTTON_RMASK; break; + case SDL_BUTTON_X1: active->r = 255; active->b = 255; buttons |= SDL_BUTTON_X1MASK; break; + case SDL_BUTTON_X2: active->g = 255; active->b = 255; buttons |= SDL_BUTTON_X2MASK; break; } break; case SDL_MOUSEBUTTONUP: @@ -110,6 +136,8 @@ loop(void *arg) case SDL_BUTTON_LEFT: buttons &= ~SDL_BUTTON_LMASK; break; case SDL_BUTTON_MIDDLE: buttons &= ~SDL_BUTTON_MMASK; break; case SDL_BUTTON_RIGHT: buttons &= ~SDL_BUTTON_RMASK; break; + case SDL_BUTTON_X1: buttons &= ~SDL_BUTTON_X1MASK; break; + case SDL_BUTTON_X2: buttons &= ~SDL_BUTTON_X2MASK; break; } if (buttons == 0) { @@ -130,6 +158,16 @@ loop(void *arg) SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255); SDL_RenderClear(renderer); + /* Mouse wheel */ + SDL_SetRenderDrawColor(renderer, 0, 255, 128, 255); + if (wheel_x_active) { + SDL_RenderDrawLine(renderer, wheel_x, 0, wheel_x, SCREEN_HEIGHT); + } + if (wheel_y_active) { + SDL_RenderDrawLine(renderer, 0, wheel_y, SCREEN_WIDTH, wheel_y); + } + + /* Lines from mouse clicks */ DrawLines(renderer); if (active) DrawLine(renderer, active); diff --git a/libs/SDL2/test/testmultiaudio.c b/libs/SDL2/test/testmultiaudio.c index 51a7ff03..1154b83a 100644 --- a/libs/SDL2/test/testmultiaudio.c +++ b/libs/SDL2/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/libs/SDL2/test/testnative.c b/libs/SDL2/test/testnative.c index 48f6f0ea..34ee661f 100644 --- a/libs/SDL2/test/testnative.c +++ b/libs/SDL2/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/libs/SDL2/test/testoverlay2.c b/libs/SDL2/test/testoverlay2.c index 8bb59a9f..ab0fd82d 100644 --- a/libs/SDL2/test/testoverlay2.c +++ b/libs/SDL2/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/libs/SDL2/test/testplatform.c b/libs/SDL2/test/testplatform.c index 107c277b..f5b524d5 100644 --- a/libs/SDL2/test/testplatform.c +++ b/libs/SDL2/test/testplatform.c @@ -25,31 +25,31 @@ badsize(size_t sizeoftype, size_t hardcodetype) return sizeoftype != hardcodetype; } +SDL_COMPILE_TIME_ASSERT(SDL_MAX_SINT8, SDL_MAX_SINT8 == 127); +SDL_COMPILE_TIME_ASSERT(SDL_MIN_SINT8, SDL_MIN_SINT8 == -128); +SDL_COMPILE_TIME_ASSERT(SDL_MAX_UINT8, SDL_MAX_UINT8 == 255); +SDL_COMPILE_TIME_ASSERT(SDL_MIN_UINT8, SDL_MIN_UINT8 == 0); + +SDL_COMPILE_TIME_ASSERT(SDL_MAX_SINT16, SDL_MAX_SINT16 == 32767); +SDL_COMPILE_TIME_ASSERT(SDL_MIN_SINT16, SDL_MIN_SINT16 == -32768); +SDL_COMPILE_TIME_ASSERT(SDL_MAX_UINT16, SDL_MAX_UINT16 == 65535); +SDL_COMPILE_TIME_ASSERT(SDL_MIN_UINT16, SDL_MIN_UINT16 == 0); + +SDL_COMPILE_TIME_ASSERT(SDL_MAX_SINT32, SDL_MAX_SINT32 == 2147483647); +SDL_COMPILE_TIME_ASSERT(SDL_MIN_SINT32, SDL_MIN_SINT32 == ~0x7fffffff); /* Instead of -2147483648, which is treated as unsigned by some compilers */ +SDL_COMPILE_TIME_ASSERT(SDL_MAX_UINT32, SDL_MAX_UINT32 == 4294967295u); +SDL_COMPILE_TIME_ASSERT(SDL_MIN_UINT32, SDL_MIN_UINT32 == 0); + +SDL_COMPILE_TIME_ASSERT(SDL_MAX_SINT64, SDL_MAX_SINT64 == 9223372036854775807ll); +SDL_COMPILE_TIME_ASSERT(SDL_MIN_SINT64, SDL_MIN_SINT64 == ~0x7fffffffffffffffll); /* Instead of -9223372036854775808, which is treated as unsigned by compilers */ +SDL_COMPILE_TIME_ASSERT(SDL_MAX_UINT64, SDL_MAX_UINT64 == 18446744073709551615ull); +SDL_COMPILE_TIME_ASSERT(SDL_MIN_UINT64, SDL_MIN_UINT64 == 0); + int TestTypes(SDL_bool verbose) { int error = 0; - SDL_COMPILE_TIME_ASSERT(SDL_MAX_SINT8, SDL_MAX_SINT8 == 127); - SDL_COMPILE_TIME_ASSERT(SDL_MIN_SINT8, SDL_MIN_SINT8 == -128); - SDL_COMPILE_TIME_ASSERT(SDL_MAX_UINT8, SDL_MAX_UINT8 == 255); - SDL_COMPILE_TIME_ASSERT(SDL_MIN_UINT8, SDL_MIN_UINT8 == 0); - - SDL_COMPILE_TIME_ASSERT(SDL_MAX_SINT16, SDL_MAX_SINT16 == 32767); - SDL_COMPILE_TIME_ASSERT(SDL_MIN_SINT16, SDL_MIN_SINT16 == -32768); - SDL_COMPILE_TIME_ASSERT(SDL_MAX_UINT16, SDL_MAX_UINT16 == 65535); - SDL_COMPILE_TIME_ASSERT(SDL_MIN_UINT16, SDL_MIN_UINT16 == 0); - - SDL_COMPILE_TIME_ASSERT(SDL_MAX_SINT32, SDL_MAX_SINT32 == 2147483647); - SDL_COMPILE_TIME_ASSERT(SDL_MIN_SINT32, SDL_MIN_SINT32 == ~0x7fffffff); /* Instead of -2147483648, which is treated as unsigned by some compilers */ - SDL_COMPILE_TIME_ASSERT(SDL_MAX_UINT32, SDL_MAX_UINT32 == 4294967295u); - SDL_COMPILE_TIME_ASSERT(SDL_MIN_UINT32, SDL_MIN_UINT32 == 0); - - SDL_COMPILE_TIME_ASSERT(SDL_MAX_SINT64, SDL_MAX_SINT64 == 9223372036854775807ll); - SDL_COMPILE_TIME_ASSERT(SDL_MIN_SINT64, SDL_MIN_SINT64 == ~0x7fffffffffffffffll); /* Instead of -9223372036854775808, which is treated as unsigned by compilers */ - SDL_COMPILE_TIME_ASSERT(SDL_MAX_UINT64, SDL_MAX_UINT64 == 18446744073709551615ull); - SDL_COMPILE_TIME_ASSERT(SDL_MIN_UINT64, SDL_MIN_UINT64 == 0); - if (badsize(sizeof(Uint8), 1)) { if (verbose) SDL_Log("sizeof(Uint8) != 1, instead = %u\n", @@ -86,18 +86,25 @@ TestEndian(SDL_bool verbose) 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 @@ TestEndian(SDL_bool verbose) } ++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 --git a/libs/SDL2/test/testqsort.c b/libs/SDL2/test/testqsort.c index d28daebd..29ea0562 100644 --- a/libs/SDL2/test/testqsort.c +++ b/libs/SDL2/test/testqsort.c @@ -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 --git a/libs/SDL2/test/testrendercopyex.c b/libs/SDL2/test/testrendercopyex.c index 47d3ae96..b954499e 100644 --- a/libs/SDL2/test/testrendercopyex.c +++ b/libs/SDL2/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/libs/SDL2/test/testrendertarget.c b/libs/SDL2/test/testrendertarget.c index 3fb61127..98ceb160 100644 --- a/libs/SDL2/test/testrendertarget.c +++ b/libs/SDL2/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/libs/SDL2/test/testscale.c b/libs/SDL2/test/testscale.c index 1235c811..0f1d21bf 100644 --- a/libs/SDL2/test/testscale.c +++ b/libs/SDL2/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/libs/SDL2/test/testshader.c b/libs/SDL2/test/testshader.c index 2cee7d9b..3c2da590 100644 --- a/libs/SDL2/test/testshader.c +++ b/libs/SDL2/test/testshader.c @@ -126,21 +126,52 @@ static PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB; static SDL_bool CompileShader(GLhandleARB shader, const char *source) { - GLint status; + GLint status = 0; glShaderSourceARB(shader, 1, &source, NULL); glCompileShaderARB(shader); glGetObjectParameterivARB(shader, GL_OBJECT_COMPILE_STATUS_ARB, &status); if (status == 0) { - GLint length; + GLint length = 0; char *info; glGetObjectParameterivARB(shader, GL_OBJECT_INFO_LOG_LENGTH_ARB, &length); - info = SDL_stack_alloc(char, length+1); - glGetInfoLogARB(shader, length, NULL, info); - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to compile shader:\n%s\n%s", source, info); - SDL_stack_free(info); + info = (char *) SDL_malloc(length + 1); + if (!info) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!"); + } else { + glGetInfoLogARB(shader, length, NULL, info); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to compile shader:\n%s\n%s", source, info); + SDL_free(info); + } + return SDL_FALSE; + } else { + return SDL_TRUE; + } +} +static SDL_bool LinkProgram(ShaderData *data) +{ + GLint status = 0; + + glAttachObjectARB(data->program, data->vert_shader); + glAttachObjectARB(data->program, data->frag_shader); + glLinkProgramARB(data->program); + + glGetObjectParameterivARB(data->program, GL_OBJECT_LINK_STATUS_ARB, &status); + if (status == 0) { + GLint length = 0; + char *info; + + glGetObjectParameterivARB(data->program, GL_OBJECT_INFO_LOG_LENGTH_ARB, &length); + info = (char *) SDL_malloc(length + 1); + if (!info) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!"); + } else { + glGetInfoLogARB(data->program, length, NULL, info); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to link program:\n%s", info); + SDL_free(info); + } return SDL_FALSE; } else { return SDL_TRUE; @@ -171,9 +202,9 @@ static SDL_bool CompileShaderProgram(ShaderData *data) } /* ... and in the darkness bind them */ - glAttachObjectARB(data->program, data->vert_shader); - glAttachObjectARB(data->program, data->frag_shader); - glLinkProgramARB(data->program); + if (!LinkProgram(data)) { + return SDL_FALSE; + } /* Set up some uniform variables */ glUseProgramObjectARB(data->program); diff --git a/libs/SDL2/test/testsprite2.c b/libs/SDL2/test/testsprite2.c index 88419ffc..a91ddd86 100644 --- a/libs/SDL2/test/testsprite2.c +++ b/libs/SDL2/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 @@ -55,61 +56,31 @@ quit(int rc) 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 --git a/libs/SDL2/test/testspriteminimal.c b/libs/SDL2/test/testspriteminimal.c index b9762cab..36ea373b 100644 --- a/libs/SDL2/test/testspriteminimal.c +++ b/libs/SDL2/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/libs/SDL2/test/teststreaming.c b/libs/SDL2/test/teststreaming.c index 72444f80..dc3ae61d 100644 --- a/libs/SDL2/test/teststreaming.c +++ b/libs/SDL2/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/libs/SDL2/test/testsurround.c b/libs/SDL2/test/testsurround.c index 168415ac..1537b35f 100644 --- a/libs/SDL2/test/testsurround.c +++ b/libs/SDL2/test/testsurround.c @@ -19,6 +19,7 @@ static int total_channels; 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 @@ main(int argc, char *argv[]) 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 --git a/libs/SDL2/test/testthread.c b/libs/SDL2/test/testthread.c index bf201e8e..ea94dfb2 100644 --- a/libs/SDL2/test/testthread.c +++ b/libs/SDL2/test/testthread.c @@ -91,6 +91,12 @@ main(int argc, char *argv[]) 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 --git a/libs/SDL2/test/testtimer.c b/libs/SDL2/test/testtimer.c index d696097c..62c5cd5f 100644 --- a/libs/SDL2/test/testtimer.c +++ b/libs/SDL2/test/testtimer.c @@ -54,6 +54,12 @@ main(int argc, char *argv[]) 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 --git a/libs/SDL2/test/testurl.c b/libs/SDL2/test/testurl.c index 4b5a4ed2..390976e1 100644 --- a/libs/SDL2/test/testurl.c +++ b/libs/SDL2/test/testurl.c @@ -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 @@ int main(int argc, char **argv) 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 --git a/libs/SDL2/test/testutils.c b/libs/SDL2/test/testutils.c new file mode 100644 index 00000000..ab58824d --- /dev/null +++ b/libs/SDL2/test/testutils.c @@ -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 --git a/libs/SDL2/test/testutils.h b/libs/SDL2/test/testutils.h new file mode 100644 index 00000000..cf24ca04 --- /dev/null +++ b/libs/SDL2/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/libs/SDL2/test/testviewport.c b/libs/SDL2/test/testviewport.c index 0e39d852..162b3106 100644 --- a/libs/SDL2/test/testviewport.c +++ b/libs/SDL2/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 --git a/libs/SDL2/test/versioning.sh b/libs/SDL2/test/versioning.sh new file mode 100644 index 00000000..e224ff5b --- /dev/null +++ b/libs/SDL2/test/versioning.sh @@ -0,0 +1,162 @@ +#!/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 + +version=$(sed -Ene 's/^[$]SDLVersion = "([0-9.]*)"\r?$/\1/p' build-scripts/winrtbuild.ps1) + +if [ "$ref_version" = "$version" ]; then + ok "winrtbuild.ps1 $version" +else + not_ok "winrtbuild.ps1 $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 --git a/libs/SDL2/test/watcom.mif b/libs/SDL2/test/watcom.mif new file mode 100644 index 00000000..91036f9a --- /dev/null +++ b/libs/SDL2/test/watcom.mif @@ -0,0 +1,116 @@ +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_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 & + testautomation_math.c testautomation_guid.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 --git a/libs/SDL2/wayland-protocols/tablet-unstable-v2.xml b/libs/SDL2/wayland-protocols/tablet-unstable-v2.xml new file mode 100644 index 00000000..b286d964 --- /dev/null +++ b/libs/SDL2/wayland-protocols/tablet-unstable-v2.xml @@ -0,0 +1,1178 @@ + + + + + Copyright 2014 © Stephen "Lyude" Chandler Paul + Copyright 2015-2016 © Red Hat, Inc. + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation files + (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice (including the + next paragraph) shall be included in all copies or substantial + portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + + + + This description provides a high-level overview of the interplay between + the interfaces defined this protocol. For details, see the protocol + specification. + + More than one tablet may exist, and device-specifics matter. Tablets are + not represented by a single virtual device like wl_pointer. A client + binds to the tablet manager object which is just a proxy object. From + that, the client requests wp_tablet_manager.get_tablet_seat(wl_seat) + and that returns the actual interface that has all the tablets. With + this indirection, we can avoid merging wp_tablet into the actual Wayland + protocol, a long-term benefit. + + The wp_tablet_seat sends a "tablet added" event for each tablet + connected. That event is followed by descriptive events about the + hardware; currently that includes events for name, vid/pid and + a wp_tablet.path event that describes a local path. This path can be + used to uniquely identify a tablet or get more information through + libwacom. Emulated or nested tablets can skip any of those, e.g. a + virtual tablet may not have a vid/pid. The sequence of descriptive + events is terminated by a wp_tablet.done event to signal that a client + may now finalize any initialization for that tablet. + + Events from tablets require a tool in proximity. Tools are also managed + by the tablet seat; a "tool added" event is sent whenever a tool is new + to the compositor. That event is followed by a number of descriptive + events about the hardware; currently that includes capabilities, + hardware id and serial number, and tool type. Similar to the tablet + interface, a wp_tablet_tool.done event is sent to terminate that initial + sequence. + + Any event from a tool happens on the wp_tablet_tool interface. When the + tool gets into proximity of the tablet, a proximity_in event is sent on + the wp_tablet_tool interface, listing the tablet and the surface. That + event is followed by a motion event with the coordinates. After that, + it's the usual motion, axis, button, etc. events. The protocol's + serialisation means events are grouped by wp_tablet_tool.frame events. + + Two special events (that don't exist in X) are down and up. They signal + "tip touching the surface". For tablets without real proximity + detection, the sequence is: proximity_in, motion, down, frame. + + When the tool leaves proximity, a proximity_out event is sent. If any + button is still down, a button release event is sent before this + proximity event. These button events are sent in the same frame as the + proximity event to signal to the client that the buttons were held when + the tool left proximity. + + If the tool moves out of the surface but stays in proximity (i.e. + between windows), compositor-specific grab policies apply. This usually + means that the proximity-out is delayed until all buttons are released. + + Moving a tool physically from one tablet to the other has no real effect + on the protocol, since we already have the tool object from the "tool + added" event. All the information is already there and the proximity + events on both tablets are all a client needs to reconstruct what + happened. + + Some extra axes are normalized, i.e. the client knows the range as + specified in the protocol (e.g. [0, 65535]), the granularity however is + unknown. The current normalized axes are pressure, distance, and slider. + + Other extra axes are in physical units as specified in the protocol. + The current extra axes with physical units are tilt, rotation and + wheel rotation. + + Since tablets work independently of the pointer controlled by the mouse, + the focus handling is independent too and controlled by proximity. + The wp_tablet_tool.set_cursor request sets a tool-specific cursor. + This cursor surface may be the same as the mouse cursor, and it may be + the same across tools but it is possible to be more fine-grained. For + example, a client may set different cursors for the pen and eraser. + + Tools are generally independent of tablets and it is + compositor-specific policy when a tool can be removed. Common approaches + will likely include some form of removing a tool when all tablets the + tool was used on are removed. + + Warning! The protocol described in this file is experimental and + backward incompatible changes may be made. Backward compatible changes + may be added together with the corresponding interface version bump. + Backward incompatible changes are done by bumping the version number in + the protocol and interface names and resetting the interface version. + Once the protocol is to be declared stable, the 'z' prefix and the + version number in the protocol and interface names are removed and the + interface version number is reset. + + + + + An object that provides access to the graphics tablets available on this + system. All tablets are associated with a seat, to get access to the + actual tablets, use wp_tablet_manager.get_tablet_seat. + + + + + Get the wp_tablet_seat object for the given seat. This object + provides access to all graphics tablets in this seat. + + + + + + + + Destroy the wp_tablet_manager object. Objects created from this + object are unaffected and should be destroyed separately. + + + + + + + An object that provides access to the graphics tablets available on this + seat. After binding to this interface, the compositor sends a set of + wp_tablet_seat.tablet_added and wp_tablet_seat.tool_added events. + + + + + Destroy the wp_tablet_seat object. Objects created from this + object are unaffected and should be destroyed separately. + + + + + + This event is sent whenever a new tablet becomes available on this + seat. This event only provides the object id of the tablet, any + static information about the tablet (device name, vid/pid, etc.) is + sent through the wp_tablet interface. + + + + + + + This event is sent whenever a tool that has not previously been used + with a tablet comes into use. This event only provides the object id + of the tool; any static information about the tool (capabilities, + type, etc.) is sent through the wp_tablet_tool interface. + + + + + + + This event is sent whenever a new pad is known to the system. Typically, + pads are physically attached to tablets and a pad_added event is + sent immediately after the wp_tablet_seat.tablet_added. + However, some standalone pad devices logically attach to tablets at + runtime, and the client must wait for wp_tablet_pad.enter to know + the tablet a pad is attached to. + + This event only provides the object id of the pad. All further + features (buttons, strips, rings) are sent through the wp_tablet_pad + interface. + + + + + + + + An object that represents a physical tool that has been, or is + currently in use with a tablet in this seat. Each wp_tablet_tool + object stays valid until the client destroys it; the compositor + reuses the wp_tablet_tool object to indicate that the object's + respective physical tool has come into proximity of a tablet again. + + A wp_tablet_tool object's relation to a physical tool depends on the + tablet's ability to report serial numbers. If the tablet supports + this capability, then the object represents a specific physical tool + and can be identified even when used on multiple tablets. + + A tablet tool has a number of static characteristics, e.g. tool type, + hardware_serial and capabilities. These capabilities are sent in an + event sequence after the wp_tablet_seat.tool_added event before any + actual events from this tool. This initial event sequence is + terminated by a wp_tablet_tool.done event. + + Tablet tool events are grouped by wp_tablet_tool.frame events. + Any events received before a wp_tablet_tool.frame event should be + considered part of the same hardware state change. + + + + + Sets the surface of the cursor used for this tool on the given + tablet. This request only takes effect if the tool is in proximity + of one of the requesting client's surfaces or the surface parameter + is the current pointer surface. If there was a previous surface set + with this request it is replaced. If surface is NULL, the cursor + image is hidden. + + The parameters hotspot_x and hotspot_y define the position of the + pointer surface relative to the pointer location. Its top-left corner + is always at (x, y) - (hotspot_x, hotspot_y), where (x, y) are the + coordinates of the pointer location, in surface-local coordinates. + + On surface.attach requests to the pointer surface, hotspot_x and + hotspot_y are decremented by the x and y parameters passed to the + request. Attach must be confirmed by wl_surface.commit as usual. + + The hotspot can also be updated by passing the currently set pointer + surface to this request with new values for hotspot_x and hotspot_y. + + The current and pending input regions of the wl_surface are cleared, + and wl_surface.set_input_region is ignored until the wl_surface is no + longer used as the cursor. When the use as a cursor ends, the current + and pending input regions become undefined, and the wl_surface is + unmapped. + + This request gives the surface the role of a wp_tablet_tool cursor. A + surface may only ever be used as the cursor surface for one + wp_tablet_tool. If the surface already has another role or has + previously been used as cursor surface for a different tool, a + protocol error is raised. + + + + + + + + + + This destroys the client's resource for this tool object. + + + + + + Describes the physical type of a tool. The physical type of a tool + generally defines its base usage. + + The mouse tool represents a mouse-shaped tool that is not a relative + device but bound to the tablet's surface, providing absolute + coordinates. + + The lens tool is a mouse-shaped tool with an attached lens to + provide precision focus. + + + + + + + + + + + + + + The tool type is the high-level type of the tool and usually decides + the interaction expected from this tool. + + This event is sent in the initial burst of events before the + wp_tablet_tool.done event. + + + + + + + If the physical tool can be identified by a unique 64-bit serial + number, this event notifies the client of this serial number. + + If multiple tablets are available in the same seat and the tool is + uniquely identifiable by the serial number, that tool may move + between tablets. + + Otherwise, if the tool has no serial number and this event is + missing, the tool is tied to the tablet it first comes into + proximity with. Even if the physical tool is used on multiple + tablets, separate wp_tablet_tool objects will be created, one per + tablet. + + This event is sent in the initial burst of events before the + wp_tablet_tool.done event. + + + + + + + + This event notifies the client of a hardware id available on this tool. + + The hardware id is a device-specific 64-bit id that provides extra + information about the tool in use, beyond the wl_tool.type + enumeration. The format of the id is specific to tablets made by + Wacom Inc. For example, the hardware id of a Wacom Grip + Pen (a stylus) is 0x802. + + This event is sent in the initial burst of events before the + wp_tablet_tool.done event. + + + + + + + + Describes extra capabilities on a tablet. + + Any tool must provide x and y values, extra axes are + device-specific. + + + + + + + + + + + + This event notifies the client of any capabilities of this tool, + beyond the main set of x/y axes and tip up/down detection. + + One event is sent for each extra capability available on this tool. + + This event is sent in the initial burst of events before the + wp_tablet_tool.done event. + + + + + + + This event signals the end of the initial burst of descriptive + events. A client may consider the static description of the tool to + be complete and finalize initialization of the tool. + + + + + + This event is sent when the tool is removed from the system and will + send no further events. Should the physical tool come back into + proximity later, a new wp_tablet_tool object will be created. + + It is compositor-dependent when a tool is removed. A compositor may + remove a tool on proximity out, tablet removal or any other reason. + A compositor may also keep a tool alive until shutdown. + + If the tool is currently in proximity, a proximity_out event will be + sent before the removed event. See wp_tablet_tool.proximity_out for + the handling of any buttons logically down. + + When this event is received, the client must wp_tablet_tool.destroy + the object. + + + + + + Notification that this tool is focused on a certain surface. + + This event can be received when the tool has moved from one surface to + another, or when the tool has come back into proximity above the + surface. + + If any button is logically down when the tool comes into proximity, + the respective button event is sent after the proximity_in event but + within the same frame as the proximity_in event. + + + + + + + + + Notification that this tool has either left proximity, or is no + longer focused on a certain surface. + + When the tablet tool leaves proximity of the tablet, button release + events are sent for each button that was held down at the time of + leaving proximity. These events are sent before the proximity_out + event but within the same wp_tablet.frame. + + If the tool stays within proximity of the tablet, but the focus + changes from one surface to another, a button release event may not + be sent until the button is actually released or the tool leaves the + proximity of the tablet. + + + + + + Sent whenever the tablet tool comes in contact with the surface of the + tablet. + + If the tool is already in contact with the tablet when entering the + input region, the client owning said region will receive a + wp_tablet.proximity_in event, followed by a wp_tablet.down + event and a wp_tablet.frame event. + + Note that this event describes logical contact, not physical + contact. On some devices, a compositor may not consider a tool in + logical contact until a minimum physical pressure threshold is + exceeded. + + + + + + + Sent whenever the tablet tool stops making contact with the surface of + the tablet, or when the tablet tool moves out of the input region + and the compositor grab (if any) is dismissed. + + If the tablet tool moves out of the input region while in contact + with the surface of the tablet and the compositor does not have an + ongoing grab on the surface, the client owning said region will + receive a wp_tablet.up event, followed by a wp_tablet.proximity_out + event and a wp_tablet.frame event. If the compositor has an ongoing + grab on this device, this event sequence is sent whenever the grab + is dismissed in the future. + + Note that this event describes logical contact, not physical + contact. On some devices, a compositor may not consider a tool out + of logical contact until physical pressure falls below a specific + threshold. + + + + + + Sent whenever a tablet tool moves. + + + + + + + + Sent whenever the pressure axis on a tool changes. The value of this + event is normalized to a value between 0 and 65535. + + Note that pressure may be nonzero even when a tool is not in logical + contact. See the down and up events for more details. + + + + + + + Sent whenever the distance axis on a tool changes. The value of this + event is normalized to a value between 0 and 65535. + + Note that distance may be nonzero even when a tool is not in logical + contact. See the down and up events for more details. + + + + + + + Sent whenever one or both of the tilt axes on a tool change. Each tilt + value is in degrees, relative to the z-axis of the tablet. + The angle is positive when the top of a tool tilts along the + positive x or y axis. + + + + + + + + Sent whenever the z-rotation axis on the tool changes. The + rotation value is in degrees clockwise from the tool's + logical neutral position. + + + + + + + Sent whenever the slider position on the tool changes. The + value is normalized between -65535 and 65535, with 0 as the logical + neutral position of the slider. + + The slider is available on e.g. the Wacom Airbrush tool. + + + + + + + Sent whenever the wheel on the tool emits an event. This event + contains two values for the same axis change. The degrees value is + in the same orientation as the wl_pointer.vertical_scroll axis. The + clicks value is in discrete logical clicks of the mouse wheel. This + value may be zero if the movement of the wheel was less + than one logical click. + + Clients should choose either value and avoid mixing degrees and + clicks. The compositor may accumulate values smaller than a logical + click and emulate click events when a certain threshold is met. + Thus, wl_tablet_tool.wheel events with non-zero clicks values may + have different degrees values. + + + + + + + + Describes the physical state of a button that produced the button event. + + + + + + + + Sent whenever a button on the tool is pressed or released. + + If a button is held down when the tool moves in or out of proximity, + button events are generated by the compositor. See + wp_tablet_tool.proximity_in and wp_tablet_tool.proximity_out for + details. + + + + + + + + + Marks the end of a series of axis and/or button updates from the + tablet. The Wayland protocol requires axis updates to be sent + sequentially, however all events within a frame should be considered + one hardware event. + + + + + + + + + + + + The wp_tablet interface represents one graphics tablet device. The + tablet interface itself does not generate events; all events are + generated by wp_tablet_tool objects when in proximity above a tablet. + + A tablet has a number of static characteristics, e.g. device name and + pid/vid. These capabilities are sent in an event sequence after the + wp_tablet_seat.tablet_added event. This initial event sequence is + terminated by a wp_tablet.done event. + + + + + This destroys the client's resource for this tablet object. + + + + + + This event is sent in the initial burst of events before the + wp_tablet.done event. + + + + + + + This event is sent in the initial burst of events before the + wp_tablet.done event. + + + + + + + + A system-specific device path that indicates which device is behind + this wp_tablet. This information may be used to gather additional + information about the device, e.g. through libwacom. + + A device may have more than one device path. If so, multiple + wp_tablet.path events are sent. A device may be emulated and not + have a device path, and in that case this event will not be sent. + + The format of the path is unspecified, it may be a device node, a + sysfs path, or some other identifier. It is up to the client to + identify the string provided. + + This event is sent in the initial burst of events before the + wp_tablet.done event. + + + + + + + This event is sent immediately to signal the end of the initial + burst of descriptive events. A client may consider the static + description of the tablet to be complete and finalize initialization + of the tablet. + + + + + + Sent when the tablet has been removed from the system. When a tablet + is removed, some tools may be removed. + + When this event is received, the client must wp_tablet.destroy + the object. + + + + + + + A circular interaction area, such as the touch ring on the Wacom Intuos + Pro series tablets. + + Events on a ring are logically grouped by the wl_tablet_pad_ring.frame + event. + + + + + Request that the compositor use the provided feedback string + associated with this ring. This request should be issued immediately + after a wp_tablet_pad_group.mode_switch event from the corresponding + group is received, or whenever the ring is mapped to a different + action. See wp_tablet_pad_group.mode_switch for more details. + + Clients are encouraged to provide context-aware descriptions for + the actions associated with the ring; compositors may use this + information to offer visual feedback about the button layout + (eg. on-screen displays). + + The provided string 'description' is a UTF-8 encoded string to be + associated with this ring, and is considered user-visible; general + internationalization rules apply. + + The serial argument will be that of the last + wp_tablet_pad_group.mode_switch event received for the group of this + ring. Requests providing other serials than the most recent one will be + ignored. + + + + + + + + This destroys the client's resource for this ring object. + + + + + + Describes the source types for ring events. This indicates to the + client how a ring event was physically generated; a client may + adjust the user interface accordingly. For example, events + from a "finger" source may trigger kinetic scrolling. + + + + + + + Source information for ring events. + + This event does not occur on its own. It is sent before a + wp_tablet_pad_ring.frame event and carries the source information + for all events within that frame. + + The source specifies how this event was generated. If the source is + wp_tablet_pad_ring.source.finger, a wp_tablet_pad_ring.stop event + will be sent when the user lifts the finger off the device. + + This event is optional. If the source is unknown for an interaction, + no event is sent. + + + + + + + Sent whenever the angle on a ring changes. + + The angle is provided in degrees clockwise from the logical + north of the ring in the pad's current rotation. + + + + + + + Stop notification for ring events. + + For some wp_tablet_pad_ring.source types, a wp_tablet_pad_ring.stop + event is sent to notify a client that the interaction with the ring + has terminated. This enables the client to implement kinetic scrolling. + See the wp_tablet_pad_ring.source documentation for information on + when this event may be generated. + + Any wp_tablet_pad_ring.angle events with the same source after this + event should be considered as the start of a new interaction. + + + + + + Indicates the end of a set of ring events that logically belong + together. A client is expected to accumulate the data in all events + within the frame before proceeding. + + All wp_tablet_pad_ring events before a wp_tablet_pad_ring.frame event belong + logically together. For example, on termination of a finger interaction + on a ring the compositor will send a wp_tablet_pad_ring.source event, + a wp_tablet_pad_ring.stop event and a wp_tablet_pad_ring.frame event. + + A wp_tablet_pad_ring.frame event is sent for every logical event + group, even if the group only contains a single wp_tablet_pad_ring + event. Specifically, a client may get a sequence: angle, frame, + angle, frame, etc. + + + + + + + + A linear interaction area, such as the strips found in Wacom Cintiq + models. + + Events on a strip are logically grouped by the wl_tablet_pad_strip.frame + event. + + + + + Requests the compositor to use the provided feedback string + associated with this strip. This request should be issued immediately + after a wp_tablet_pad_group.mode_switch event from the corresponding + group is received, or whenever the strip is mapped to a different + action. See wp_tablet_pad_group.mode_switch for more details. + + Clients are encouraged to provide context-aware descriptions for + the actions associated with the strip, and compositors may use this + information to offer visual feedback about the button layout + (eg. on-screen displays). + + The provided string 'description' is a UTF-8 encoded string to be + associated with this ring, and is considered user-visible; general + internationalization rules apply. + + The serial argument will be that of the last + wp_tablet_pad_group.mode_switch event received for the group of this + strip. Requests providing other serials than the most recent one will be + ignored. + + + + + + + + This destroys the client's resource for this strip object. + + + + + + Describes the source types for strip events. This indicates to the + client how a strip event was physically generated; a client may + adjust the user interface accordingly. For example, events + from a "finger" source may trigger kinetic scrolling. + + + + + + + Source information for strip events. + + This event does not occur on its own. It is sent before a + wp_tablet_pad_strip.frame event and carries the source information + for all events within that frame. + + The source specifies how this event was generated. If the source is + wp_tablet_pad_strip.source.finger, a wp_tablet_pad_strip.stop event + will be sent when the user lifts their finger off the device. + + This event is optional. If the source is unknown for an interaction, + no event is sent. + + + + + + + Sent whenever the position on a strip changes. + + The position is normalized to a range of [0, 65535], the 0-value + represents the top-most and/or left-most position of the strip in + the pad's current rotation. + + + + + + + Stop notification for strip events. + + For some wp_tablet_pad_strip.source types, a wp_tablet_pad_strip.stop + event is sent to notify a client that the interaction with the strip + has terminated. This enables the client to implement kinetic + scrolling. See the wp_tablet_pad_strip.source documentation for + information on when this event may be generated. + + Any wp_tablet_pad_strip.position events with the same source after this + event should be considered as the start of a new interaction. + + + + + + Indicates the end of a set of events that represent one logical + hardware strip event. A client is expected to accumulate the data + in all events within the frame before proceeding. + + All wp_tablet_pad_strip events before a wp_tablet_pad_strip.frame event belong + logically together. For example, on termination of a finger interaction + on a strip the compositor will send a wp_tablet_pad_strip.source event, + a wp_tablet_pad_strip.stop event and a wp_tablet_pad_strip.frame + event. + + A wp_tablet_pad_strip.frame event is sent for every logical event + group, even if the group only contains a single wp_tablet_pad_strip + event. Specifically, a client may get a sequence: position, frame, + position, frame, etc. + + + + + + + + A pad group describes a distinct (sub)set of buttons, rings and strips + present in the tablet. The criteria of this grouping is usually positional, + eg. if a tablet has buttons on the left and right side, 2 groups will be + presented. The physical arrangement of groups is undisclosed and may + change on the fly. + + Pad groups will announce their features during pad initialization. Between + the corresponding wp_tablet_pad.group event and wp_tablet_pad_group.done, the + pad group will announce the buttons, rings and strips contained in it, + plus the number of supported modes. + + Modes are a mechanism to allow multiple groups of actions for every element + in the pad group. The number of groups and available modes in each is + persistent across device plugs. The current mode is user-switchable, it + will be announced through the wp_tablet_pad_group.mode_switch event both + whenever it is switched, and after wp_tablet_pad.enter. + + The current mode logically applies to all elements in the pad group, + although it is at clients' discretion whether to actually perform different + actions, and/or issue the respective .set_feedback requests to notify the + compositor. See the wp_tablet_pad_group.mode_switch event for more details. + + + + + Destroy the wp_tablet_pad_group object. Objects created from this object + are unaffected and should be destroyed separately. + + + + + + Sent on wp_tablet_pad_group initialization to announce the available + buttons in the group. Button indices start at 0, a button may only be + in one group at a time. + + This event is first sent in the initial burst of events before the + wp_tablet_pad_group.done event. + + Some buttons are reserved by the compositor. These buttons may not be + assigned to any wp_tablet_pad_group. Compositors may broadcast this + event in the case of changes to the mapping of these reserved buttons. + If the compositor happens to reserve all buttons in a group, this event + will be sent with an empty array. + + + + + + + Sent on wp_tablet_pad_group initialization to announce available rings. + One event is sent for each ring available on this pad group. + + This event is sent in the initial burst of events before the + wp_tablet_pad_group.done event. + + + + + + + Sent on wp_tablet_pad initialization to announce available strips. + One event is sent for each strip available on this pad group. + + This event is sent in the initial burst of events before the + wp_tablet_pad_group.done event. + + + + + + + Sent on wp_tablet_pad_group initialization to announce that the pad + group may switch between modes. A client may use a mode to store a + specific configuration for buttons, rings and strips and use the + wl_tablet_pad_group.mode_switch event to toggle between these + configurations. Mode indices start at 0. + + Switching modes is compositor-dependent. See the + wp_tablet_pad_group.mode_switch event for more details. + + This event is sent in the initial burst of events before the + wp_tablet_pad_group.done event. This event is only sent when more than + more than one mode is available. + + + + + + + This event is sent immediately to signal the end of the initial + burst of descriptive events. A client may consider the static + description of the tablet to be complete and finalize initialization + of the tablet group. + + + + + + Notification that the mode was switched. + + A mode applies to all buttons, rings and strips in a group + simultaneously, but a client is not required to assign different actions + for each mode. For example, a client may have mode-specific button + mappings but map the ring to vertical scrolling in all modes. Mode + indices start at 0. + + Switching modes is compositor-dependent. The compositor may provide + visual cues to the client about the mode, e.g. by toggling LEDs on + the tablet device. Mode-switching may be software-controlled or + controlled by one or more physical buttons. For example, on a Wacom + Intuos Pro, the button inside the ring may be assigned to switch + between modes. + + The compositor will also send this event after wp_tablet_pad.enter on + each group in order to notify of the current mode. Groups that only + feature one mode will use mode=0 when emitting this event. + + If a button action in the new mode differs from the action in the + previous mode, the client should immediately issue a + wp_tablet_pad.set_feedback request for each changed button. + + If a ring or strip action in the new mode differs from the action + in the previous mode, the client should immediately issue a + wp_tablet_ring.set_feedback or wp_tablet_strip.set_feedback request + for each changed ring or strip. + + + + + + + + + + A pad device is a set of buttons, rings and strips + usually physically present on the tablet device itself. Some + exceptions exist where the pad device is physically detached, e.g. the + Wacom ExpressKey Remote. + + Pad devices have no axes that control the cursor and are generally + auxiliary devices to the tool devices used on the tablet surface. + + A pad device has a number of static characteristics, e.g. the number + of rings. These capabilities are sent in an event sequence after the + wp_tablet_seat.pad_added event before any actual events from this pad. + This initial event sequence is terminated by a wp_tablet_pad.done + event. + + All pad features (buttons, rings and strips) are logically divided into + groups and all pads have at least one group. The available groups are + notified through the wp_tablet_pad.group event; the compositor will + emit one event per group before emitting wp_tablet_pad.done. + + Groups may have multiple modes. Modes allow clients to map multiple + actions to a single pad feature. Only one mode can be active per group, + although different groups may have different active modes. + + + + + Requests the compositor to use the provided feedback string + associated with this button. This request should be issued immediately + after a wp_tablet_pad_group.mode_switch event from the corresponding + group is received, or whenever a button is mapped to a different + action. See wp_tablet_pad_group.mode_switch for more details. + + Clients are encouraged to provide context-aware descriptions for + the actions associated with each button, and compositors may use + this information to offer visual feedback on the button layout + (e.g. on-screen displays). + + Button indices start at 0. Setting the feedback string on a button + that is reserved by the compositor (i.e. not belonging to any + wp_tablet_pad_group) does not generate an error but the compositor + is free to ignore the request. + + The provided string 'description' is a UTF-8 encoded string to be + associated with this ring, and is considered user-visible; general + internationalization rules apply. + + The serial argument will be that of the last + wp_tablet_pad_group.mode_switch event received for the group of this + button. Requests providing other serials than the most recent one will + be ignored. + + + + + + + + + Destroy the wp_tablet_pad object. Objects created from this object + are unaffected and should be destroyed separately. + + + + + + Sent on wp_tablet_pad initialization to announce available groups. + One event is sent for each pad group available. + + This event is sent in the initial burst of events before the + wp_tablet_pad.done event. At least one group will be announced. + + + + + + + A system-specific device path that indicates which device is behind + this wp_tablet_pad. This information may be used to gather additional + information about the device, e.g. through libwacom. + + The format of the path is unspecified, it may be a device node, a + sysfs path, or some other identifier. It is up to the client to + identify the string provided. + + This event is sent in the initial burst of events before the + wp_tablet_pad.done event. + + + + + + + Sent on wp_tablet_pad initialization to announce the available + buttons. + + This event is sent in the initial burst of events before the + wp_tablet_pad.done event. This event is only sent when at least one + button is available. + + + + + + + This event signals the end of the initial burst of descriptive + events. A client may consider the static description of the pad to + be complete and finalize initialization of the pad. + + + + + + Describes the physical state of a button that caused the button + event. + + + + + + + + Sent whenever the physical state of a button changes. + + + + + + + + + Notification that this pad is focused on the specified surface. + + + + + + + + + Notification that this pad is no longer focused on the specified + surface. + + + + + + + + Sent when the pad has been removed from the system. When a tablet + is removed its pad(s) will be removed too. + + When this event is received, the client must destroy all rings, strips + and groups that were offered by this pad, and issue wp_tablet_pad.destroy + the pad itself. + + + + diff --git a/libs/SDL2/wayland-protocols/viewporter.xml b/libs/SDL2/wayland-protocols/viewporter.xml new file mode 100644 index 00000000..c732d8c3 --- /dev/null +++ b/libs/SDL2/wayland-protocols/viewporter.xml @@ -0,0 +1,186 @@ + + + + + Copyright © 2013-2016 Collabora, Ltd. + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice (including the next + paragraph) shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + + + + The global interface exposing surface cropping and scaling + capabilities is used to instantiate an interface extension for a + wl_surface object. This extended interface will then allow + cropping and scaling the surface contents, effectively + disconnecting the direct relationship between the buffer and the + surface size. + + + + + Informs the server that the client will not be using this + protocol object anymore. This does not affect any other objects, + wp_viewport objects included. + + + + + + + + + + Instantiate an interface extension for the given wl_surface to + crop and scale its content. If the given wl_surface already has + a wp_viewport object associated, the viewport_exists + protocol error is raised. + + + + + + + + + An additional interface to a wl_surface object, which allows the + client to specify the cropping and scaling of the surface + contents. + + This interface works with two concepts: the source rectangle (src_x, + src_y, src_width, src_height), and the destination size (dst_width, + dst_height). The contents of the source rectangle are scaled to the + destination size, and content outside the source rectangle is ignored. + This state is double-buffered, and is applied on the next + wl_surface.commit. + + The two parts of crop and scale state are independent: the source + rectangle, and the destination size. Initially both are unset, that + is, no scaling is applied. The whole of the current wl_buffer is + used as the source, and the surface size is as defined in + wl_surface.attach. + + If the destination size is set, it causes the surface size to become + dst_width, dst_height. The source (rectangle) is scaled to exactly + this size. This overrides whatever the attached wl_buffer size is, + unless the wl_buffer is NULL. If the wl_buffer is NULL, the surface + has no content and therefore no size. Otherwise, the size is always + at least 1x1 in surface local coordinates. + + If the source rectangle is set, it defines what area of the wl_buffer is + taken as the source. If the source rectangle is set and the destination + size is not set, then src_width and src_height must be integers, and the + surface size becomes the source rectangle size. This results in cropping + without scaling. If src_width or src_height are not integers and + destination size is not set, the bad_size protocol error is raised when + the surface state is applied. + + The coordinate transformations from buffer pixel coordinates up to + the surface-local coordinates happen in the following order: + 1. buffer_transform (wl_surface.set_buffer_transform) + 2. buffer_scale (wl_surface.set_buffer_scale) + 3. crop and scale (wp_viewport.set*) + This means, that the source rectangle coordinates of crop and scale + are given in the coordinates after the buffer transform and scale, + i.e. in the coordinates that would be the surface-local coordinates + if the crop and scale was not applied. + + If src_x or src_y are negative, the bad_value protocol error is raised. + Otherwise, if the source rectangle is partially or completely outside of + the non-NULL wl_buffer, then the out_of_buffer protocol error is raised + when the surface state is applied. A NULL wl_buffer does not raise the + out_of_buffer error. + + The x, y arguments of wl_surface.attach are applied as normal to + the surface. They indicate how many pixels to remove from the + surface size from the left and the top. In other words, they are + still in the surface-local coordinate system, just like dst_width + and dst_height are. + + If the wl_surface associated with the wp_viewport is destroyed, + all wp_viewport requests except 'destroy' raise the protocol error + no_surface. + + If the wp_viewport object is destroyed, the crop and scale + state is removed from the wl_surface. The change will be applied + on the next wl_surface.commit. + + + + + The associated wl_surface's crop and scale state is removed. + The change is applied on the next wl_surface.commit. + + + + + + + + + + + + + Set the source rectangle of the associated wl_surface. See + wp_viewport for the description, and relation to the wl_buffer + size. + + If all of x, y, width and height are -1.0, the source rectangle is + unset instead. Any other set of values where width or height are zero + or negative, or x or y are negative, raise the bad_value protocol + error. + + The crop and scale state is double-buffered state, and will be + applied on the next wl_surface.commit. + + + + + + + + + + Set the destination size of the associated wl_surface. See + wp_viewport for the description, and relation to the wl_buffer + size. + + If width is -1 and height is -1, the destination size is unset + instead. Any other pair of values for width and height that + contains zero or negative values raises the bad_value protocol + error. + + The crop and scale state is double-buffered state, and will be + applied on the next wl_surface.commit. + + + + + + + diff --git a/libs/SDL2/wayland-protocols/xdg-output-unstable-v1.xml b/libs/SDL2/wayland-protocols/xdg-output-unstable-v1.xml new file mode 100644 index 00000000..9a5b7900 --- /dev/null +++ b/libs/SDL2/wayland-protocols/xdg-output-unstable-v1.xml @@ -0,0 +1,220 @@ + + + + + Copyright © 2017 Red Hat Inc. + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice (including the next + paragraph) shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + + + This protocol aims at describing outputs in a way which is more in line + with the concept of an output on desktop oriented systems. + + Some information are more specific to the concept of an output for + a desktop oriented system and may not make sense in other applications, + such as IVI systems for example. + + Typically, the global compositor space on a desktop system is made of + a contiguous or overlapping set of rectangular regions. + + Some of the information provided in this protocol might be identical + to their counterparts already available from wl_output, in which case + the information provided by this protocol should be preferred to their + equivalent in wl_output. The goal is to move the desktop specific + concepts (such as output location within the global compositor space, + the connector name and types, etc.) out of the core wl_output protocol. + + Warning! The protocol described in this file is experimental and + backward incompatible changes may be made. Backward compatible + changes may be added together with the corresponding interface + version bump. + Backward incompatible changes are done by bumping the version + number in the protocol and interface names and resetting the + interface version. Once the protocol is to be declared stable, + the 'z' prefix and the version number in the protocol and + interface names are removed and the interface version number is + reset. + + + + + A global factory interface for xdg_output objects. + + + + + Using this request a client can tell the server that it is not + going to use the xdg_output_manager object anymore. + + Any objects already created through this instance are not affected. + + + + + + This creates a new xdg_output object for the given wl_output. + + + + + + + + + An xdg_output describes part of the compositor geometry. + + This typically corresponds to a monitor that displays part of the + compositor space. + + For objects version 3 onwards, after all xdg_output properties have been + sent (when the object is created and when properties are updated), a + wl_output.done event is sent. This allows changes to the output + properties to be seen as atomic, even if they happen via multiple events. + + + + + Using this request a client can tell the server that it is not + going to use the xdg_output object anymore. + + + + + + The position event describes the location of the wl_output within + the global compositor space. + + The logical_position event is sent after creating an xdg_output + (see xdg_output_manager.get_xdg_output) and whenever the location + of the output changes within the global compositor space. + + + + + + + + The logical_size event describes the size of the output in the + global compositor space. + + For example, a surface without any buffer scale, transformation + nor rotation set, with the size matching the logical_size will + have the same size as the corresponding output when displayed. + + Most regular Wayland clients should not pay attention to the + logical size and would rather rely on xdg_shell interfaces. + + Some clients such as Xwayland, however, need this to configure + their surfaces in the global compositor space as the compositor + may apply a different scale from what is advertised by the output + scaling property (to achieve fractional scaling, for example). + + For example, for a wl_output mode 3840×2160 and a scale factor 2: + + - A compositor not scaling the surface buffers will advertise a + logical size of 3840×2160, + + - A compositor automatically scaling the surface buffers will + advertise a logical size of 1920×1080, + + - A compositor using a fractional scale of 1.5 will advertise a + logical size of 2560×1440. + + For example, for a wl_output mode 1920×1080 and a 90 degree rotation, + the compositor will advertise a logical size of 1080x1920. + + The logical_size event is sent after creating an xdg_output + (see xdg_output_manager.get_xdg_output) and whenever the logical + size of the output changes, either as a result of a change in the + applied scale or because of a change in the corresponding output + mode(see wl_output.mode) or transform (see wl_output.transform). + + + + + + + + This event is sent after all other properties of an xdg_output + have been sent. + + This allows changes to the xdg_output properties to be seen as + atomic, even if they happen via multiple events. + + For objects version 3 onwards, this event is deprecated. Compositors + are not required to send it anymore and must send wl_output.done + instead. + + + + + + + + Many compositors will assign names to their outputs, show them to the + user, allow them to be configured by name, etc. The client may wish to + know this name as well to offer the user similar behaviors. + + The naming convention is compositor defined, but limited to + alphanumeric characters and dashes (-). Each name is unique among all + wl_output globals, but if a wl_output global is destroyed the same name + may be reused later. The names will also remain consistent across + sessions with the same hardware and software configuration. + + Examples of names include 'HDMI-A-1', 'WL-1', 'X11-1', etc. However, do + not assume that the name is a reflection of an underlying DRM + connector, X11 connection, etc. + + The name event is sent after creating an xdg_output (see + xdg_output_manager.get_xdg_output). This event is only sent once per + xdg_output, and the name does not change over the lifetime of the + wl_output global. + + + + + + + Many compositors can produce human-readable descriptions of their + outputs. The client may wish to know this description as well, to + communicate the user for various purposes. + + The description is a UTF-8 string with no convention defined for its + contents. Examples might include 'Foocorp 11" Display' or 'Virtual X11 + output via :1'. + + The description event is sent after creating an xdg_output (see + xdg_output_manager.get_xdg_output) and whenever the description + changes. The description is optional, and may not be sent at all. + + For objects of version 2 and lower, this event is only sent once per + xdg_output, and the description does not change over the lifetime of + the wl_output global. + + + + + +