Merge commit 'dec0d4ec4153bf9fc2b78ae6c2df45b6ea8dde7a' as 'external/sdl/SDL'
This commit is contained in:
2692
external/sdl/SDL/build-scripts/SDL_migration.cocci
vendored
Normal file
2692
external/sdl/SDL/build-scripts/SDL_migration.cocci
vendored
Normal file
File diff suppressed because it is too large
Load Diff
315
external/sdl/SDL/build-scripts/android-prefab.sh
vendored
Executable file
315
external/sdl/SDL/build-scripts/android-prefab.sh
vendored
Executable file
@ -0,0 +1,315 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
if ! [ "x$ANDROID_NDK_HOME" != "x" -a -d "$ANDROID_NDK_HOME" ]; then
|
||||
echo "ANDROID_NDK_HOME environment variable is not set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! [ "x$ANDROID_HOME" != "x" -a -d "$ANDROID_HOME" ]; then
|
||||
echo "ANDROID_HOME environment variable is not set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "x$ANDROID_API" = "x" ]; then
|
||||
ANDROID_API="$(ls "$ANDROID_HOME/platforms" | grep -E "^android-[0-9]+$" | sed 's/android-//' | sort -n -r | head -1)"
|
||||
if [ "x$ANDROID_API" = "x" ]; then
|
||||
echo "No Android platform found in $ANDROID_HOME/platforms"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
if ! [ -d "$ANDROID_HOME/platforms/android-$ANDROID_API" ]; then
|
||||
echo "Android api version $ANDROID_API is not available ($ANDROID_HOME/platforms/android-$ANDROID_API does not exist)" >2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
android_platformdir="$ANDROID_HOME/platforms/android-$ANDROID_API"
|
||||
|
||||
echo "Building for android api version $ANDROID_API"
|
||||
echo "android_platformdir=$android_platformdir"
|
||||
|
||||
scriptdir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)")
|
||||
sdl_root=$(cd -P -- "$(dirname -- "$0")/.." && printf '%s\n' "$(pwd -P)")
|
||||
|
||||
build_root="${sdl_root}/build-android-prefab"
|
||||
|
||||
android_abis="armeabi-v7a arm64-v8a x86 x86_64"
|
||||
android_api=19
|
||||
android_ndk=21
|
||||
android_stl="c++_shared"
|
||||
|
||||
sdl_major=$(sed -ne 's/^#define SDL_MAJOR_VERSION *//p' "${sdl_root}/include/SDL3/SDL_version.h")
|
||||
sdl_minor=$(sed -ne 's/^#define SDL_MINOR_VERSION *//p' "${sdl_root}/include/SDL3/SDL_version.h")
|
||||
sdl_patch=$(sed -ne 's/^#define SDL_PATCHLEVEL *//p' "${sdl_root}/include/SDL3/SDL_version.h")
|
||||
sdl_version="${sdl_major}.${sdl_minor}.${sdl_patch}"
|
||||
echo "Building Android prefab package for SDL version $sdl_version"
|
||||
|
||||
prefabhome="${build_root}/prefab-${sdl_version}"
|
||||
rm -rf "$prefabhome"
|
||||
mkdir -p "${prefabhome}"
|
||||
|
||||
build_cmake_projects() {
|
||||
for android_abi in $android_abis; do
|
||||
echo "Configuring CMake project for $android_abi"
|
||||
cmake -S "$sdl_root" -B "${build_root}/build_${android_abi}" \
|
||||
-DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake" \
|
||||
-DANDROID_PLATFORM=${android_platform} \
|
||||
-DANDROID_ABI=${android_abi} \
|
||||
-DSDL_SHARED=ON \
|
||||
-DSDL_STATIC=ON \
|
||||
-DSDL_STATIC_PIC=ON \
|
||||
-DSDL_TEST=ON \
|
||||
-DSDL_DISABLE_INSTALL=OFF \
|
||||
-DCMAKE_INSTALL_PREFIX="${build_root}/build_${android_abi}/prefix" \
|
||||
-DCMAKE_INSTALL_INCLUDEDIR=include \
|
||||
-DCMAKE_INSTALL_LIBDIR=lib \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-GNinja
|
||||
|
||||
rm -rf "${build_root}/build_${android_abi}/prefix"
|
||||
|
||||
echo "Building CMake project for $android_abi"
|
||||
cmake --build "${build_root}/build_${android_abi}"
|
||||
|
||||
echo "Installing CMake project for $android_abi"
|
||||
cmake --install "${build_root}/build_${android_abi}"
|
||||
done
|
||||
}
|
||||
|
||||
classes_sources_jar_path="${prefabhome}/classes-sources.jar"
|
||||
classes_jar_path="${prefabhome}/classes.jar"
|
||||
compile_java() {
|
||||
classes_sources_root="${prefabhome}/classes-sources"
|
||||
|
||||
rm -rf "${classes_sources_root}"
|
||||
mkdir -p "${classes_sources_root}/META-INF"
|
||||
|
||||
echo "Copying LICENSE.txt to java build folder"
|
||||
cp "$sdl_root/LICENSE.txt" "${classes_sources_root}/META-INF"
|
||||
|
||||
echo "Copy JAVA sources to java build folder"
|
||||
cp -r "$sdl_root/android-project/app/src/main/java/org" "${classes_sources_root}"
|
||||
|
||||
java_sourceslist_path="${prefabhome}/java_sources.txt"
|
||||
pushd "${classes_sources_root}"
|
||||
echo "Collecting sources for classes-sources.jar"
|
||||
find "." -name "*.java" >"${java_sourceslist_path}"
|
||||
find "META-INF" -name "*" >>"${java_sourceslist_path}"
|
||||
|
||||
echo "Creating classes-sources.jar"
|
||||
jar -cf "${classes_sources_jar_path}" "@${java_sourceslist_path}"
|
||||
popd
|
||||
|
||||
classes_root="${prefabhome}/classes"
|
||||
mkdir -p "${classes_root}/META-INF"
|
||||
cp "$sdl_root/LICENSE.txt" "${classes_root}/META-INF"
|
||||
java_sourceslist_path="${prefabhome}/java_sources.txt"
|
||||
|
||||
echo "Collecting sources for classes.jar"
|
||||
find "$sdl_root/android-project/app/src/main/java" -name "*.java" >"${java_sourceslist_path}"
|
||||
|
||||
echo "Compiling classes"
|
||||
javac -encoding utf-8 -classpath "$android_platformdir/android.jar" -d "${classes_root}" "@${java_sourceslist_path}"
|
||||
|
||||
java_classeslist_path="${prefabhome}/java_classes.txt"
|
||||
pushd "${classes_root}"
|
||||
find "." -name "*.class" >"${java_classeslist_path}"
|
||||
find "META-INF" -name "*" >>"${java_classeslist_path}"
|
||||
echo "Creating classes.jar"
|
||||
jar -cf "${classes_jar_path}" "@${java_classeslist_path}"
|
||||
popd
|
||||
}
|
||||
|
||||
pom_filename="SDL${sdl_major}-${sdl_version}.pom"
|
||||
pom_filepath="${prefabhome}/${pom_filename}"
|
||||
create_pom_xml() {
|
||||
echo "Creating ${pom_filename}"
|
||||
cat >"${pom_filepath}" <<EOF
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.libsdl.android</groupId>
|
||||
<artifactId>SDL${sdl_major}</artifactId>
|
||||
<version>${sdl_version}</version>
|
||||
<packaging>aar</packaging>
|
||||
<name>SDL${sdl_major}</name>
|
||||
<description>The AAR for SDL${sdl_major}</description>
|
||||
<url>https://libsdl.org/</url>
|
||||
<licenses>
|
||||
<license>
|
||||
<name>zlib License</name>
|
||||
<url>https://github.com/libsdl-org/SDL/blob/main/LICENSE.txt</url>
|
||||
<distribution>repo</distribution>
|
||||
</license>
|
||||
</licenses>
|
||||
<scm>
|
||||
<connection>scm:git:https://github.com/libsdl-org/SDL</connection>
|
||||
<url>https://github.com/libsdl-org/SDL</url>
|
||||
</scm>
|
||||
</project>
|
||||
EOF
|
||||
}
|
||||
|
||||
create_aar_androidmanifest() {
|
||||
echo "Creating AndroidManifest.xml"
|
||||
cat >"${aar_root}/AndroidManifest.xml" <<EOF
|
||||
<manifest
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.libsdl.android" android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
<uses-sdk android:minSdkVersion="16"
|
||||
android:targetSdkVersion="29"/>
|
||||
</manifest>
|
||||
EOF
|
||||
}
|
||||
|
||||
echo "Creating AAR root directory"
|
||||
aar_root="${prefabhome}/SDL${sdl_major}-${sdl_version}"
|
||||
mkdir -p "${aar_root}"
|
||||
|
||||
aar_metainfdir_path=${aar_root}/META-INF
|
||||
mkdir -p "${aar_metainfdir_path}"
|
||||
cp "${sdl_root}/LICENSE.txt" "${aar_metainfdir_path}"
|
||||
|
||||
prefabworkdir="${aar_root}/prefab"
|
||||
mkdir -p "${prefabworkdir}"
|
||||
|
||||
cat >"${prefabworkdir}/prefab.json" <<EOF
|
||||
{
|
||||
"schema_version": 2,
|
||||
"name": "SDL$sdl_major",
|
||||
"version": "$sdl_version",
|
||||
"dependencies": []
|
||||
}
|
||||
EOF
|
||||
|
||||
modulesworkdir="${prefabworkdir}/modules"
|
||||
mkdir -p "${modulesworkdir}"
|
||||
|
||||
create_shared_sdl_module() {
|
||||
echo "Creating SDL${sdl_major} prefab module"
|
||||
for android_abi in $android_abis; do
|
||||
sdl_moduleworkdir="${modulesworkdir}/SDL${sdl_major}"
|
||||
mkdir -p "${sdl_moduleworkdir}"
|
||||
|
||||
abi_build_prefix="${build_root}/build_${android_abi}/prefix"
|
||||
|
||||
cat >"${sdl_moduleworkdir}/module.json" <<EOF
|
||||
{
|
||||
"export_libraries": [],
|
||||
"library_name": "libSDL${sdl_major}"
|
||||
}
|
||||
EOF
|
||||
mkdir -p "${sdl_moduleworkdir}/include/SDL${sdl_major}"
|
||||
cp -r "${abi_build_prefix}/include/SDL${sdl_major}/"* "${sdl_moduleworkdir}/include/SDL${sdl_major}"
|
||||
|
||||
abi_sdllibdir="${sdl_moduleworkdir}/libs/android.${android_abi}"
|
||||
mkdir -p "${abi_sdllibdir}"
|
||||
cat >"${abi_sdllibdir}/abi.json" <<EOF
|
||||
{
|
||||
"abi": "${android_abi}",
|
||||
"api": ${android_api},
|
||||
"ndk": ${android_ndk},
|
||||
"stl": "${android_stl}",
|
||||
"static": false
|
||||
}
|
||||
EOF
|
||||
cp "${abi_build_prefix}/lib/libSDL${sdl_major}.so" "${abi_sdllibdir}"
|
||||
done
|
||||
}
|
||||
|
||||
create_static_sdl_module() {
|
||||
echo "Creating SDL${sdl_major}-static prefab module"
|
||||
for android_abi in $android_abis; do
|
||||
sdl_moduleworkdir="${modulesworkdir}/SDL${sdl_major}-static"
|
||||
mkdir -p "${sdl_moduleworkdir}"
|
||||
|
||||
abi_build_prefix="${build_root}/build_${android_abi}/prefix"
|
||||
|
||||
cat >"${sdl_moduleworkdir}/module.json" <<EOF
|
||||
{
|
||||
"export_libraries": ["-ldl", "-lGLESv1_CM", "-lGLESv2", "-llog", "-landroid", "-lOpenSLES"]
|
||||
"library_name": "libSDL${sdl_major}"
|
||||
}
|
||||
EOF
|
||||
mkdir -p "${sdl_moduleworkdir}/include/SDL${sdl_major}"
|
||||
cp -r "${abi_build_prefix}/include/SDL${sdl_major}/"* "${sdl_moduleworkdir}/include/SDL${sdl_major}"
|
||||
|
||||
abi_sdllibdir="${sdl_moduleworkdir}/libs/android.${android_abi}"
|
||||
mkdir -p "${abi_sdllibdir}"
|
||||
cat >"${abi_sdllibdir}/abi.json" <<EOF
|
||||
{
|
||||
"abi": "${android_abi}",
|
||||
"api": ${android_api},
|
||||
"ndk": ${android_ndk},
|
||||
"stl": "${android_stl}",
|
||||
"static": true
|
||||
}
|
||||
EOF
|
||||
cp "${abi_build_prefix}/lib/libSDL${sdl_major}.a" "${abi_sdllibdir}"
|
||||
done
|
||||
}
|
||||
|
||||
create_sdltest_module() {
|
||||
echo "Creating SDL${sdl_major}test prefab module"
|
||||
for android_abi in $android_abis; do
|
||||
sdl_moduleworkdir="${modulesworkdir}/SDL${sdl_major}test"
|
||||
mkdir -p "${sdl_moduleworkdir}"
|
||||
|
||||
abi_build_prefix="${build_root}/build_${android_abi}/prefix"
|
||||
|
||||
cat >"${sdl_moduleworkdir}/module.json" <<EOF
|
||||
{
|
||||
"export_libraries": [],
|
||||
"library_name": "libSDL${sdl_major}_test"
|
||||
}
|
||||
EOF
|
||||
abi_sdllibdir="${sdl_moduleworkdir}/libs/android.${android_abi}"
|
||||
mkdir -p "${abi_sdllibdir}"
|
||||
cat >"${abi_sdllibdir}/abi.json" <<EOF
|
||||
{
|
||||
"abi": "${android_abi}",
|
||||
"api": ${android_api},
|
||||
"ndk": ${android_ndk},
|
||||
"stl": "${android_stl}",
|
||||
"static": true
|
||||
}
|
||||
EOF
|
||||
cp "${abi_build_prefix}/lib/libSDL${sdl_major}_test.a" "${abi_sdllibdir}"
|
||||
done
|
||||
}
|
||||
|
||||
build_cmake_projects
|
||||
|
||||
compile_java
|
||||
|
||||
create_pom_xml
|
||||
|
||||
create_aar_androidmanifest
|
||||
|
||||
create_shared_sdl_module
|
||||
|
||||
create_static_sdl_module
|
||||
|
||||
create_sdltest_module
|
||||
|
||||
pushd "${aar_root}"
|
||||
aar_filename="SDL${sdl_major}-${sdl_version}.aar"
|
||||
cp "${classes_jar_path}" ./classes.jar
|
||||
cp "${classes_sources_jar_path}" ./classes-sources.jar
|
||||
zip -r "${aar_filename}" AndroidManifest.xml classes.jar classes-sources.jar prefab META-INF
|
||||
zip -Tv "${aar_filename}" 2>/dev/null ;
|
||||
mv "${aar_filename}" "${prefabhome}"
|
||||
popd
|
||||
|
||||
maven_filename="SDL${sdl_major}-${sdl_version}.zip"
|
||||
|
||||
pushd "${prefabhome}"
|
||||
zip_filename="SDL${sdl_major}-${sdl_version}.zip"
|
||||
zip "${maven_filename}" "${aar_filename}" "${pom_filename}" 2>/dev/null;
|
||||
zip -Tv "${zip_filename}" 2>/dev/null;
|
||||
popd
|
||||
|
||||
echo "Prefab zip is ready at ${prefabhome}/${aar_filename}"
|
||||
echo "Maven archive is ready at ${prefabhome}/${zip_filename}"
|
100
external/sdl/SDL/build-scripts/androidbuild.sh
vendored
Executable file
100
external/sdl/SDL/build-scripts/androidbuild.sh
vendored
Executable file
@ -0,0 +1,100 @@
|
||||
#!/bin/bash
|
||||
|
||||
SOURCES=()
|
||||
MKSOURCES=""
|
||||
CURDIR=`pwd -P`
|
||||
|
||||
# Fetch sources
|
||||
if [[ $# -ge 2 ]]; then
|
||||
for src in ${@:2}
|
||||
do
|
||||
SOURCES+=($src)
|
||||
MKSOURCES="$MKSOURCES $(basename $src)"
|
||||
done
|
||||
else
|
||||
if [ -n "$1" ]; then
|
||||
while read src
|
||||
do
|
||||
SOURCES+=($src)
|
||||
MKSOURCES="$MKSOURCES $(basename $src)"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$1" ] || [ -z "$SOURCES" ]; then
|
||||
echo "Usage: androidbuild.sh com.yourcompany.yourapp < sources.list"
|
||||
echo "Usage: androidbuild.sh com.yourcompany.yourapp source1.c source2.c ...sourceN.c"
|
||||
echo "To copy SDL source instead of symlinking: COPYSOURCE=1 androidbuild.sh ... "
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SDLPATH="$( cd "$(dirname "$0")/.." ; pwd -P )"
|
||||
|
||||
if [ -z "$ANDROID_HOME" ];then
|
||||
echo "Please set the ANDROID_HOME directory to the path of the Android SDK"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "$ANDROID_HOME/ndk-bundle" -a -z "$ANDROID_NDK_HOME" ]; then
|
||||
echo "Please set the ANDROID_NDK_HOME directory to the path of the Android NDK"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
APP="$1"
|
||||
APPARR=(${APP//./ })
|
||||
BUILDPATH="$SDLPATH/build/$APP"
|
||||
|
||||
# Start Building
|
||||
|
||||
rm -rf $BUILDPATH
|
||||
mkdir -p $BUILDPATH
|
||||
|
||||
cp -r $SDLPATH/android-project/* $BUILDPATH
|
||||
|
||||
# Copy SDL sources
|
||||
mkdir -p $BUILDPATH/app/jni/SDL
|
||||
if [ -z "$COPYSOURCE" ]; then
|
||||
ln -s $SDLPATH/src $BUILDPATH/app/jni/SDL
|
||||
ln -s $SDLPATH/include $BUILDPATH/app/jni/SDL
|
||||
else
|
||||
cp -r $SDLPATH/src $BUILDPATH/app/jni/SDL
|
||||
cp -r $SDLPATH/include $BUILDPATH/app/jni/SDL
|
||||
fi
|
||||
|
||||
cp -r $SDLPATH/Android.mk $BUILDPATH/app/jni/SDL
|
||||
sed -i -e "s|YourSourceHere.c|$MKSOURCES|g" $BUILDPATH/app/jni/src/Android.mk
|
||||
sed -i -e "s|org\.libsdl\.app|$APP|g" $BUILDPATH/app/build.gradle
|
||||
sed -i -e "s|org\.libsdl\.app|$APP|g" $BUILDPATH/app/src/main/AndroidManifest.xml
|
||||
|
||||
# Copy user sources
|
||||
for src in "${SOURCES[@]}"
|
||||
do
|
||||
cp $src $BUILDPATH/app/jni/src
|
||||
done
|
||||
|
||||
# Create an inherited Activity
|
||||
cd $BUILDPATH/app/src/main/java
|
||||
for folder in "${APPARR[@]}"
|
||||
do
|
||||
mkdir -p $folder
|
||||
cd $folder
|
||||
done
|
||||
|
||||
ACTIVITY="${folder}Activity"
|
||||
sed -i -e "s|\"SDLActivity\"|\"$ACTIVITY\"|g" $BUILDPATH/app/src/main/AndroidManifest.xml
|
||||
|
||||
# Fill in a default Activity
|
||||
cat >"$ACTIVITY.java" <<__EOF__
|
||||
package $APP;
|
||||
|
||||
import org.libsdl.app.SDLActivity;
|
||||
|
||||
public class $ACTIVITY extends SDLActivity
|
||||
{
|
||||
}
|
||||
__EOF__
|
||||
|
||||
# Update project and build
|
||||
echo "To build and install to a device for testing, run the following:"
|
||||
echo "cd $BUILDPATH"
|
||||
echo "./gradlew installDebug"
|
78
external/sdl/SDL/build-scripts/androidbuildlibs.sh
vendored
Executable file
78
external/sdl/SDL/build-scripts/androidbuildlibs.sh
vendored
Executable file
@ -0,0 +1,78 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Build the Android libraries without needing a project
|
||||
# (AndroidManifest.xml, jni/{Application,Android}.mk, etc.)
|
||||
#
|
||||
# Usage: androidbuildlibs.sh [arg for ndk-build ...]"
|
||||
#
|
||||
# Useful NDK arguments:
|
||||
#
|
||||
# NDK_DEBUG=1 - build debug version
|
||||
# NDK_LIBS_OUT=<dest> - specify alternate destination for installable
|
||||
# modules.
|
||||
#
|
||||
|
||||
|
||||
# Android.mk is in srcdir
|
||||
srcdir=`dirname $0`/..
|
||||
srcdir=`cd $srcdir && pwd`
|
||||
cd $srcdir
|
||||
|
||||
|
||||
#
|
||||
# Create the build directories
|
||||
#
|
||||
|
||||
build=build
|
||||
buildandroid=$build/android
|
||||
platform=android-16
|
||||
abi="arm64-v8a" # "armeabi-v7a arm64-v8a x86 x86_64"
|
||||
obj=
|
||||
lib=
|
||||
ndk_args=
|
||||
|
||||
# Allow an external caller to specify locations and platform.
|
||||
while [ $# -gt 0 ]; do
|
||||
arg=$1
|
||||
if [ "${arg:0:8}" == "NDK_OUT=" ]; then
|
||||
obj=${arg#NDK_OUT=}
|
||||
elif [ "${arg:0:13}" == "NDK_LIBS_OUT=" ]; then
|
||||
lib=${arg#NDK_LIBS_OUT=}
|
||||
elif [ "${arg:0:13}" == "APP_PLATFORM=" ]; then
|
||||
platform=${arg#APP_PLATFORM=}
|
||||
elif [ "${arg:0:8}" == "APP_ABI=" ]; then
|
||||
abi=${arg#APP_ABI=}
|
||||
else
|
||||
ndk_args="$ndk_args $arg"
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
if [ -z $obj ]; then
|
||||
obj=$buildandroid/obj
|
||||
fi
|
||||
if [ -z $lib ]; then
|
||||
lib=$buildandroid/lib
|
||||
fi
|
||||
|
||||
for dir in $build $buildandroid $obj $lib; do
|
||||
if test -d $dir; then
|
||||
:
|
||||
else
|
||||
mkdir $dir || exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
# APP_* variables set in the environment here will not be seen by the
|
||||
# ndk-build makefile segments that use them, e.g., default-application.mk.
|
||||
# For consistency, pass all values on the command line.
|
||||
ndk-build \
|
||||
NDK_PROJECT_PATH=null \
|
||||
NDK_OUT=$obj \
|
||||
NDK_LIBS_OUT=$lib \
|
||||
APP_BUILD_SCRIPT=Android.mk \
|
||||
APP_ABI="$abi" \
|
||||
APP_PLATFORM="$platform" \
|
||||
APP_MODULES="SDL3" \
|
||||
$ndk_args
|
260
external/sdl/SDL/build-scripts/check_stdlib_usage.py
vendored
Executable file
260
external/sdl/SDL/build-scripts/check_stdlib_usage.py
vendored
Executable file
@ -0,0 +1,260 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Simple DirectMedia Layer
|
||||
# Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
|
||||
#
|
||||
# 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 script detects use of stdlib function in SDL code
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import pathlib
|
||||
import re
|
||||
import sys
|
||||
|
||||
SDL_ROOT = pathlib.Path(__file__).resolve().parents[1]
|
||||
|
||||
words = [
|
||||
'abs',
|
||||
'acos',
|
||||
'acosf',
|
||||
'asin',
|
||||
'asinf',
|
||||
'asprintf',
|
||||
'atan',
|
||||
'atan2',
|
||||
'atan2f',
|
||||
'atanf',
|
||||
'atof',
|
||||
'atoi',
|
||||
'calloc',
|
||||
'ceil',
|
||||
'ceilf',
|
||||
'copysign',
|
||||
'copysignf',
|
||||
'cos',
|
||||
'cosf',
|
||||
'crc32',
|
||||
'exp',
|
||||
'expf',
|
||||
'fabs',
|
||||
'fabsf',
|
||||
'floor',
|
||||
'floorf',
|
||||
'fmod',
|
||||
'fmodf',
|
||||
'free',
|
||||
'getenv',
|
||||
'isalnum',
|
||||
'isalpha',
|
||||
'isblank',
|
||||
'iscntrl',
|
||||
'isdigit',
|
||||
'isgraph',
|
||||
'islower',
|
||||
'isprint',
|
||||
'ispunct',
|
||||
'isspace',
|
||||
'isupper',
|
||||
'isxdigit',
|
||||
'itoa',
|
||||
'lltoa',
|
||||
'log10',
|
||||
'log10f',
|
||||
'logf',
|
||||
'lround',
|
||||
'lroundf',
|
||||
'ltoa',
|
||||
'malloc',
|
||||
'memalign',
|
||||
'memcmp',
|
||||
'memcpy',
|
||||
'memcpy4',
|
||||
'memmove',
|
||||
'memset',
|
||||
'pow',
|
||||
'powf',
|
||||
'qsort',
|
||||
'realloc',
|
||||
'round',
|
||||
'roundf',
|
||||
'scalbn',
|
||||
'scalbnf',
|
||||
'setenv',
|
||||
'sin',
|
||||
'sinf',
|
||||
'snprintf',
|
||||
'sqrt',
|
||||
'sqrtf',
|
||||
'sscanf',
|
||||
'strcasecmp',
|
||||
'strchr',
|
||||
'strcmp',
|
||||
'strdup',
|
||||
'strlcat',
|
||||
'strlcpy',
|
||||
'strlen',
|
||||
'strlwr',
|
||||
'strncasecmp',
|
||||
'strncmp',
|
||||
'strrchr',
|
||||
'strrev',
|
||||
'strstr',
|
||||
'strtod',
|
||||
'strtokr',
|
||||
'strtol',
|
||||
'strtoll',
|
||||
'strtoul',
|
||||
'strupr',
|
||||
'tan',
|
||||
'tanf',
|
||||
'tolower',
|
||||
'toupper',
|
||||
'trunc',
|
||||
'truncf',
|
||||
'uitoa',
|
||||
'ulltoa',
|
||||
'ultoa',
|
||||
'utf8strlcpy',
|
||||
'utf8strlen',
|
||||
'vasprintf',
|
||||
'vsnprintf',
|
||||
'vsscanf',
|
||||
'wcscasecmp',
|
||||
'wcscmp',
|
||||
'wcsdup',
|
||||
'wcslcat',
|
||||
'wcslcpy',
|
||||
'wcslen',
|
||||
'wcsncasecmp',
|
||||
'wcsncmp',
|
||||
'wcsstr' ]
|
||||
|
||||
|
||||
reg_comment_remove_content = re.compile('\/\*.*\*/')
|
||||
reg_comment_remove_content2 = re.compile('".*"')
|
||||
reg_comment_remove_content3 = re.compile(':strlen')
|
||||
reg_comment_remove_content4 = re.compile('->free')
|
||||
|
||||
def find_symbols_in_file(file, regex):
|
||||
|
||||
allowed_extensions = [ ".c", ".cpp", ".m", ".h", ".hpp", ".cc" ]
|
||||
|
||||
excluded_paths = [
|
||||
"src/stdlib",
|
||||
"src/libm",
|
||||
"src/hidapi",
|
||||
"src/video/khronos",
|
||||
"include/SDL3",
|
||||
"build-scripts/gen_audio_resampler_filter.c",
|
||||
"build-scripts/gen_audio_channel_conversion.c" ]
|
||||
|
||||
filename = pathlib.Path(file)
|
||||
|
||||
for ep in excluded_paths:
|
||||
if ep in filename.as_posix():
|
||||
# skip
|
||||
return
|
||||
|
||||
if filename.suffix not in allowed_extensions:
|
||||
# skip
|
||||
return
|
||||
|
||||
# print("Parse %s" % file)
|
||||
|
||||
try:
|
||||
with file.open("r", encoding="UTF-8", newline="") as rfp:
|
||||
parsing_comment = False
|
||||
for l in rfp:
|
||||
l = l.strip()
|
||||
|
||||
# Get the comment block /* ... */ across several lines
|
||||
match_start = "/*" in l
|
||||
match_end = "*/" in l
|
||||
if match_start and match_end:
|
||||
continue
|
||||
if match_start:
|
||||
parsing_comment = True
|
||||
continue
|
||||
if match_end:
|
||||
parsing_comment = False
|
||||
continue
|
||||
if parsing_comment:
|
||||
continue
|
||||
|
||||
if regex.match(l):
|
||||
|
||||
# free() allowed here
|
||||
if "This should NOT be SDL_" in l:
|
||||
continue
|
||||
|
||||
# double check
|
||||
# Remove one line comment /* ... */
|
||||
# eg: extern DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open_path(const char *path, int bExclusive /* = false */);
|
||||
l = reg_comment_remove_content.sub('', l)
|
||||
|
||||
# Remove strings " ... "
|
||||
l = reg_comment_remove_content2.sub('', l)
|
||||
|
||||
# :strlen
|
||||
l = reg_comment_remove_content3.sub('', l)
|
||||
|
||||
# ->free
|
||||
l = reg_comment_remove_content4.sub('', l)
|
||||
|
||||
if regex.match(l):
|
||||
print("File %s" % filename)
|
||||
print(" %s" % l)
|
||||
print("")
|
||||
|
||||
except UnicodeDecodeError:
|
||||
print("%s is not text, skipping" % file)
|
||||
except Exception as err:
|
||||
print("%s" % err)
|
||||
|
||||
def find_symbols_in_dir(path, regex):
|
||||
|
||||
for entry in path.glob("*"):
|
||||
if entry.is_dir():
|
||||
find_symbols_in_dir(entry, regex)
|
||||
else:
|
||||
find_symbols_in_file(entry, regex)
|
||||
|
||||
def main():
|
||||
str = ".*\\b("
|
||||
for w in words:
|
||||
str += w + "|"
|
||||
str = str[:-1]
|
||||
str += ")\("
|
||||
regex = re.compile(str)
|
||||
find_symbols_in_dir(SDL_ROOT, regex)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
parser = argparse.ArgumentParser(fromfile_prefix_chars='@')
|
||||
args = parser.parse_args()
|
||||
|
||||
try:
|
||||
main()
|
||||
except Exception as e:
|
||||
print(e)
|
||||
exit(-1)
|
||||
|
||||
exit(0)
|
||||
|
||||
|
32
external/sdl/SDL/build-scripts/clang-format-src.sh
vendored
Executable file
32
external/sdl/SDL/build-scripts/clang-format-src.sh
vendored
Executable file
@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
cd "$(dirname $0)/../src"
|
||||
|
||||
echo "Running clang-format in $(pwd)"
|
||||
|
||||
find . -regex '.*\.[chm]p*' -exec clang-format -i {} \;
|
||||
|
||||
# Revert third-party code
|
||||
git checkout \
|
||||
events/imKStoUCS.* \
|
||||
hidapi \
|
||||
joystick/controller_type.c \
|
||||
joystick/controller_type.h \
|
||||
joystick/hidapi/steam/controller_constants.h \
|
||||
joystick/hidapi/steam/controller_structs.h \
|
||||
libm \
|
||||
stdlib/SDL_malloc.c \
|
||||
stdlib/SDL_qsort.c \
|
||||
stdlib/SDL_strtokr.c \
|
||||
video/arm \
|
||||
video/khronos \
|
||||
video/x11/edid-parse.c \
|
||||
video/yuv2rgb
|
||||
clang-format -i hidapi/SDL_hidapi.c
|
||||
|
||||
# Revert generated code
|
||||
git checkout dynapi/SDL_dynapi_overrides.h
|
||||
git checkout dynapi/SDL_dynapi_procs.h
|
||||
git checkout render/metal/SDL_shaders_metal_*.h
|
||||
|
||||
echo "clang-format complete!"
|
13
external/sdl/SDL/build-scripts/cmake-toolchain-mingw64-i686.cmake
vendored
Normal file
13
external/sdl/SDL/build-scripts/cmake-toolchain-mingw64-i686.cmake
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
set(CMAKE_SYSTEM_PROCESSOR x86)
|
||||
|
||||
find_program(CMAKE_C_COMPILER NAMES i686-w64-mingw32-gcc)
|
||||
find_program(CMAKE_CXX_COMPILER NAMES i686-w64-mingw32-g++)
|
||||
|
||||
if(NOT CMAKE_C_COMPILER)
|
||||
message(FATAL_ERROR "Failed to find CMAKE_C_COMPILER.")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_CXX_COMPILER)
|
||||
message(FATAL_ERROR "Failed to find CMAKE_CXX_COMPILER.")
|
||||
endif()
|
13
external/sdl/SDL/build-scripts/cmake-toolchain-mingw64-x86_64.cmake
vendored
Normal file
13
external/sdl/SDL/build-scripts/cmake-toolchain-mingw64-x86_64.cmake
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
set(CMAKE_SYSTEM_PROCESSOR x86_64)
|
||||
|
||||
find_program(CMAKE_C_COMPILER NAMES x86_64-w64-mingw32-gcc)
|
||||
find_program(CMAKE_CXX_COMPILER NAMES x86_64-w64-mingw32-g++)
|
||||
|
||||
if(NOT CMAKE_C_COMPILER)
|
||||
message(FATAL_ERROR "Failed to find CMAKE_C_COMPILER.")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_CXX_COMPILER)
|
||||
message(FATAL_ERROR "Failed to find CMAKE_CXX_COMPILER.")
|
||||
endif()
|
14
external/sdl/SDL/build-scripts/cmake-toolchain-qnx-aarch64le.cmake
vendored
Normal file
14
external/sdl/SDL/build-scripts/cmake-toolchain-qnx-aarch64le.cmake
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
set(CMAKE_SYSTEM_NAME QNX)
|
||||
|
||||
set(arch gcc_ntoaarch64le)
|
||||
|
||||
set(CMAKE_C_COMPILER qcc)
|
||||
set(CMAKE_C_COMPILER_TARGET ${arch})
|
||||
set(CMAKE_CXX_COMPILER q++)
|
||||
set(CMAKE_CXX_COMPILER_TARGET ${arch})
|
||||
|
||||
set(CMAKE_SYSROOT $ENV{QNX_TARGET})
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
14
external/sdl/SDL/build-scripts/cmake-toolchain-qnx-x86_64.cmake
vendored
Normal file
14
external/sdl/SDL/build-scripts/cmake-toolchain-qnx-x86_64.cmake
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
set(CMAKE_SYSTEM_NAME QNX)
|
||||
|
||||
set(arch gcc_ntox86_64)
|
||||
|
||||
set(CMAKE_C_COMPILER qcc)
|
||||
set(CMAKE_C_COMPILER_TARGET ${arch})
|
||||
set(CMAKE_CXX_COMPILER q++)
|
||||
set(CMAKE_CXX_COMPILER_TARGET ${arch})
|
||||
|
||||
set(CMAKE_SYSROOT $ENV{QNX_TARGET})
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
59
external/sdl/SDL/build-scripts/codechecker-buildbot.sh
vendored
Executable file
59
external/sdl/SDL/build-scripts/codechecker-buildbot.sh
vendored
Executable file
@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This is a script used by some Buildbot build workers to push the project
|
||||
# through Clang's static analyzer and prepare the output to be uploaded
|
||||
# back to the buildmaster. You might find it useful too.
|
||||
|
||||
# Install Clang (you already have it on macOS, apt-get install clang
|
||||
# on Ubuntu, etc), install CMake, and pip3 install codechecker.
|
||||
|
||||
FINALDIR="$1"
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
cd `dirname "$0"`
|
||||
cd ..
|
||||
|
||||
rm -rf codechecker-buildbot
|
||||
if [ ! -z "$FINALDIR" ]; then
|
||||
rm -rf "$FINALDIR"
|
||||
fi
|
||||
|
||||
mkdir codechecker-buildbot
|
||||
cd codechecker-buildbot
|
||||
|
||||
# We turn off deprecated declarations, because we don't care about these warnings during static analysis.
|
||||
cmake -Wno-dev -DSDL_STATIC=OFF -DCMAKE_BUILD_TYPE=Debug -DSDL_ASSERTIONS=enabled -DCMAKE_C_FLAGS="-Wno-deprecated-declarations" -DCMAKE_EXPORT_COMPILE_COMMANDS=1 ..
|
||||
|
||||
# CMake on macOS adds "-arch arm64" or whatever is appropriate, but this confuses CodeChecker, so strip it out.
|
||||
perl -w -pi -e 's/\-arch\s+.*?\s+//g;' compile_commands.json
|
||||
|
||||
rm -rf ../analysis
|
||||
CodeChecker analyze compile_commands.json -o ./reports
|
||||
|
||||
# "parse" returns 2 if there was a static analysis issue to report, but this
|
||||
# does not signify an error in the parsing (that would be error code 1). Turn
|
||||
# off the abort-on-error flag.
|
||||
set +e
|
||||
CodeChecker parse ./reports -e html -o ../analysis
|
||||
set -e
|
||||
|
||||
cd ..
|
||||
chmod -R a+r analysis
|
||||
chmod -R go-w analysis
|
||||
find analysis -type d -exec chmod a+x {} \;
|
||||
if [ -x /usr/bin/xattr ]; then find analysis -exec /usr/bin/xattr -d com.apple.quarantine {} \; 2>/dev/null ; fi
|
||||
|
||||
if [ ! -z "$FINALDIR" ]; then
|
||||
mv analysis "$FINALDIR"
|
||||
else
|
||||
FINALDIR=analysis
|
||||
fi
|
||||
|
||||
rm -rf codechecker-buildbot
|
||||
|
||||
echo "Done. Final output is in '$FINALDIR' ..."
|
||||
|
||||
# end of codechecker-buildbot.sh ...
|
||||
|
156
external/sdl/SDL/build-scripts/fnsince.pl
vendored
Executable file
156
external/sdl/SDL/build-scripts/fnsince.pl
vendored
Executable file
@ -0,0 +1,156 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
use File::Basename;
|
||||
use Cwd qw(abs_path);
|
||||
|
||||
my $wikipath = undef;
|
||||
foreach (@ARGV) {
|
||||
$wikipath = abs_path($_), next if not defined $wikipath;
|
||||
}
|
||||
|
||||
chdir(dirname(__FILE__));
|
||||
chdir('..');
|
||||
|
||||
my @unsorted_releases = ();
|
||||
open(PIPEFH, '-|', 'git tag -l') or die "Failed to read git release tags: $!\n";
|
||||
|
||||
while (<PIPEFH>) {
|
||||
chomp;
|
||||
if (/\Arelease\-(.*?)\Z/) {
|
||||
# Ignore anything that isn't a x.y.0 release.
|
||||
# Make sure new APIs are assigned to the next minor version and ignore the patch versions.
|
||||
my $ver = $1;
|
||||
my @versplit = split /\./, $ver;
|
||||
next if (scalar(@versplit) < 1) || ($versplit[0] != 3); # Ignore anything that isn't an SDL3 release.
|
||||
next if (scalar(@versplit) < 3) || ($versplit[2] != 0);
|
||||
|
||||
# Consider this release version.
|
||||
push @unsorted_releases, $ver;
|
||||
}
|
||||
|
||||
}
|
||||
close(PIPEFH);
|
||||
|
||||
#print("\n\nUNSORTED\n");
|
||||
#foreach (@unsorted_releases) {
|
||||
# print "$_\n";
|
||||
#}
|
||||
|
||||
my @releases = sort {
|
||||
my @asplit = split /\./, $a;
|
||||
my @bsplit = split /\./, $b;
|
||||
my $rc;
|
||||
for (my $i = 0; $i < scalar(@asplit); $i++) {
|
||||
return 1 if (scalar(@bsplit) <= $i); # a is "2.0.1" and b is "2.0", or whatever.
|
||||
my $aseg = $asplit[$i];
|
||||
my $bseg = $bsplit[$i];
|
||||
$rc = int($aseg) <=> int($bseg);
|
||||
return $rc if ($rc != 0); # found the difference.
|
||||
}
|
||||
return 0; # still here? They matched completely?!
|
||||
} @unsorted_releases;
|
||||
|
||||
my $current_release = 'in-development';
|
||||
my $next_release = '3.0.0'; # valid until we actually ship something. :)
|
||||
if (scalar(@releases) > 0) {
|
||||
# this happens to work for how SDL versions things at the moment.
|
||||
$current_release = $releases[-1];
|
||||
|
||||
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) {
|
||||
# print "$_\n";
|
||||
#}
|
||||
#print("\nCURRENT RELEASE: $current_release\n");
|
||||
#print("NEXT RELEASE: $next_release\n\n");
|
||||
|
||||
push @releases, 'HEAD';
|
||||
|
||||
my %funcs = ();
|
||||
foreach my $release (@releases) {
|
||||
#print("Checking $release...\n");
|
||||
my $tag = ($release eq 'HEAD') ? $release : "release-$release";
|
||||
my $blobname = "$tag:src/dynapi/SDL_dynapi_overrides.h";
|
||||
open(PIPEFH, '-|', "git show '$blobname'") or die "Failed to read git blob '$blobname': $!\n";
|
||||
while (<PIPEFH>) {
|
||||
chomp;
|
||||
if (/\A\#define\s+(SDL_.*?)\s+SDL_.*?_REAL\Z/) {
|
||||
my $fn = $1;
|
||||
$funcs{$fn} = $release if not defined $funcs{$fn};
|
||||
}
|
||||
}
|
||||
close(PIPEFH);
|
||||
}
|
||||
|
||||
# these are incorrect in the dynapi header, because we forgot to add them
|
||||
# until a later release, but are available in the older release.
|
||||
$funcs{'SDL_WinRTGetFSPathUNICODE'} = '2.0.3';
|
||||
$funcs{'SDL_WinRTGetFSPathUTF8'} = '2.0.3';
|
||||
|
||||
if (not defined $wikipath) {
|
||||
foreach my $release (@releases) {
|
||||
foreach my $fn (sort keys %funcs) {
|
||||
print("$fn: $funcs{$fn}\n") if $funcs{$fn} eq $release;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (defined $wikipath) {
|
||||
chdir($wikipath);
|
||||
foreach my $fn (keys %funcs) {
|
||||
my $revision = $funcs{$fn};
|
||||
$revision = $next_release if $revision eq 'HEAD';
|
||||
my $fname = "$fn.mediawiki";
|
||||
if ( ! -f $fname ) {
|
||||
#print STDERR "No such file: $fname\n";
|
||||
next;
|
||||
}
|
||||
|
||||
my @lines = ();
|
||||
open(FH, '<', $fname) or die("Can't open $fname for read: $!\n");
|
||||
my $added = 0;
|
||||
while (<FH>) {
|
||||
chomp;
|
||||
if ((/\A\-\-\-\-/) && (!$added)) {
|
||||
push @lines, "== Version ==";
|
||||
push @lines, "";
|
||||
push @lines, "This function is available since SDL $revision.";
|
||||
push @lines, "";
|
||||
$added = 1;
|
||||
}
|
||||
push @lines, $_;
|
||||
next if not /\A\=\=\s+Version\s+\=\=/;
|
||||
$added = 1;
|
||||
push @lines, "";
|
||||
push @lines, "This function is available since SDL $revision.";
|
||||
push @lines, "";
|
||||
while (<FH>) {
|
||||
chomp;
|
||||
next if not (/\A\=\=\s+/ || /\A\-\-\-\-/);
|
||||
push @lines, $_;
|
||||
last;
|
||||
}
|
||||
}
|
||||
close(FH);
|
||||
|
||||
if (!$added) {
|
||||
push @lines, "== Version ==";
|
||||
push @lines, "";
|
||||
push @lines, "This function is available since SDL $revision.";
|
||||
push @lines, "";
|
||||
}
|
||||
|
||||
open(FH, '>', $fname) or die("Can't open $fname for write: $!\n");
|
||||
foreach (@lines) {
|
||||
print FH "$_\n";
|
||||
}
|
||||
close(FH);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
461
external/sdl/SDL/build-scripts/gen_audio_channel_conversion.c
vendored
Normal file
461
external/sdl/SDL/build-scripts/gen_audio_channel_conversion.c
vendored
Normal file
@ -0,0 +1,461 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
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 <stdio.h>
|
||||
|
||||
/*
|
||||
|
||||
Built with:
|
||||
|
||||
gcc -o genchancvt build-scripts/gen_audio_channel_conversion.c -lm && ./genchancvt > src/audio/SDL_audio_channel_converters.h
|
||||
|
||||
*/
|
||||
|
||||
#define NUM_CHANNELS 8
|
||||
|
||||
static const char *layout_names[NUM_CHANNELS] = {
|
||||
"Mono", "Stereo", "2.1", "Quad", "4.1", "5.1", "6.1", "7.1"
|
||||
};
|
||||
|
||||
static const char *channel_names[NUM_CHANNELS][NUM_CHANNELS] = {
|
||||
/* mono */ { "FC" },
|
||||
/* stereo */ { "FL", "FR" },
|
||||
/* 2.1 */ { "FL", "FR", "LFE" },
|
||||
/* quad */ { "FL", "FR", "BL", "BR" },
|
||||
/* 4.1 */ { "FL", "FR", "LFE", "BL", "BR" },
|
||||
/* 5.1 */ { "FL", "FR", "FC", "LFE", "BL", "BR" },
|
||||
/* 6.1 */ { "FL", "FR", "FC", "LFE", "BC", "SL", "SR" },
|
||||
/* 7.1 */ { "FL", "FR", "FC", "LFE", "BL", "BR", "SL", "SR" },
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* This table is from FAudio:
|
||||
*
|
||||
* https://raw.githubusercontent.com/FNA-XNA/FAudio/master/src/matrix_defaults.inl
|
||||
*/
|
||||
static const float channel_conversion_matrix[8][8][64] = {
|
||||
{
|
||||
/* 1 x 1 */
|
||||
{ 1.000000000f },
|
||||
/* 1 x 2 */
|
||||
{ 1.000000000f, 1.000000000f },
|
||||
/* 1 x 3 */
|
||||
{ 1.000000000f, 1.000000000f, 0.000000000f },
|
||||
/* 1 x 4 */
|
||||
{ 1.000000000f, 1.000000000f, 0.000000000f, 0.000000000f },
|
||||
/* 1 x 5 */
|
||||
{ 1.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f },
|
||||
/* 1 x 6 */
|
||||
{ 1.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f },
|
||||
/* 1 x 7 */
|
||||
{ 1.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f },
|
||||
/* 1 x 8 */
|
||||
{ 1.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f }
|
||||
},
|
||||
{
|
||||
/* 2 x 1 */
|
||||
{ 0.500000000f, 0.500000000f },
|
||||
/* 2 x 2 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 1.000000000f },
|
||||
/* 2 x 3 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f },
|
||||
/* 2 x 4 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f },
|
||||
/* 2 x 5 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f },
|
||||
/* 2 x 6 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f },
|
||||
/* 2 x 7 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f },
|
||||
/* 2 x 8 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f }
|
||||
},
|
||||
{
|
||||
/* 3 x 1 */
|
||||
{ 0.333333343f, 0.333333343f, 0.333333343f },
|
||||
/* 3 x 2 */
|
||||
{ 0.800000012f, 0.000000000f, 0.200000003f, 0.000000000f, 0.800000012f, 0.200000003f },
|
||||
/* 3 x 3 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f },
|
||||
/* 3 x 4 */
|
||||
{ 0.888888896f, 0.000000000f, 0.111111112f, 0.000000000f, 0.888888896f, 0.111111112f, 0.000000000f, 0.000000000f, 0.111111112f, 0.000000000f, 0.000000000f, 0.111111112f },
|
||||
/* 3 x 5 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f },
|
||||
/* 3 x 6 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f },
|
||||
/* 3 x 7 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f },
|
||||
/* 3 x 8 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f }
|
||||
},
|
||||
{
|
||||
/* 4 x 1 */
|
||||
{ 0.250000000f, 0.250000000f, 0.250000000f, 0.250000000f },
|
||||
/* 4 x 2 */
|
||||
{ 0.421000004f, 0.000000000f, 0.358999997f, 0.219999999f, 0.000000000f, 0.421000004f, 0.219999999f, 0.358999997f },
|
||||
/* 4 x 3 */
|
||||
{ 0.421000004f, 0.000000000f, 0.358999997f, 0.219999999f, 0.000000000f, 0.421000004f, 0.219999999f, 0.358999997f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f },
|
||||
/* 4 x 4 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f },
|
||||
/* 4 x 5 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f },
|
||||
/* 4 x 6 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f },
|
||||
/* 4 x 7 */
|
||||
{ 0.939999998f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.939999998f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.500000000f, 0.500000000f, 0.000000000f, 0.000000000f, 0.796000004f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.796000004f },
|
||||
/* 4 x 8 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f }
|
||||
},
|
||||
{
|
||||
/* 5 x 1 */
|
||||
{ 0.200000003f, 0.200000003f, 0.200000003f, 0.200000003f, 0.200000003f },
|
||||
/* 5 x 2 */
|
||||
{ 0.374222219f, 0.000000000f, 0.111111112f, 0.319111109f, 0.195555553f, 0.000000000f, 0.374222219f, 0.111111112f, 0.195555553f, 0.319111109f },
|
||||
/* 5 x 3 */
|
||||
{ 0.421000004f, 0.000000000f, 0.000000000f, 0.358999997f, 0.219999999f, 0.000000000f, 0.421000004f, 0.000000000f, 0.219999999f, 0.358999997f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f },
|
||||
/* 5 x 4 */
|
||||
{ 0.941176474f, 0.000000000f, 0.058823530f, 0.000000000f, 0.000000000f, 0.000000000f, 0.941176474f, 0.058823530f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.058823530f, 0.941176474f, 0.000000000f, 0.000000000f, 0.000000000f, 0.058823530f, 0.000000000f, 0.941176474f },
|
||||
/* 5 x 5 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f },
|
||||
/* 5 x 6 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f },
|
||||
/* 5 x 7 */
|
||||
{ 0.939999998f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.939999998f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.500000000f, 0.500000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.796000004f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.796000004f },
|
||||
/* 5 x 8 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f }
|
||||
},
|
||||
{
|
||||
/* 6 x 1 */
|
||||
{ 0.166666672f, 0.166666672f, 0.166666672f, 0.166666672f, 0.166666672f, 0.166666672f },
|
||||
/* 6 x 2 */
|
||||
{ 0.294545442f, 0.000000000f, 0.208181813f, 0.090909094f, 0.251818180f, 0.154545456f, 0.000000000f, 0.294545442f, 0.208181813f, 0.090909094f, 0.154545456f, 0.251818180f },
|
||||
/* 6 x 3 */
|
||||
{ 0.324000001f, 0.000000000f, 0.229000002f, 0.000000000f, 0.277000010f, 0.170000002f, 0.000000000f, 0.324000001f, 0.229000002f, 0.000000000f, 0.170000002f, 0.277000010f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f },
|
||||
/* 6 x 4 */
|
||||
{ 0.558095276f, 0.000000000f, 0.394285709f, 0.047619049f, 0.000000000f, 0.000000000f, 0.000000000f, 0.558095276f, 0.394285709f, 0.047619049f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.047619049f, 0.558095276f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.047619049f, 0.000000000f, 0.558095276f },
|
||||
/* 6 x 5 */
|
||||
{ 0.586000025f, 0.000000000f, 0.414000005f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.586000025f, 0.414000005f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.586000025f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.586000025f },
|
||||
/* 6 x 6 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f },
|
||||
/* 6 x 7 */
|
||||
{ 0.939999998f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.939999998f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.939999998f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.500000000f, 0.500000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.796000004f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.796000004f },
|
||||
/* 6 x 8 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f }
|
||||
},
|
||||
{
|
||||
/* 7 x 1 */
|
||||
{ 0.143142849f, 0.143142849f, 0.143142849f, 0.142857149f, 0.143142849f, 0.143142849f, 0.143142849f },
|
||||
/* 7 x 2 */
|
||||
{ 0.247384623f, 0.000000000f, 0.174461529f, 0.076923080f, 0.174461529f, 0.226153851f, 0.100615382f, 0.000000000f, 0.247384623f, 0.174461529f, 0.076923080f, 0.174461529f, 0.100615382f, 0.226153851f },
|
||||
/* 7 x 3 */
|
||||
{ 0.268000007f, 0.000000000f, 0.188999996f, 0.000000000f, 0.188999996f, 0.245000005f, 0.108999997f, 0.000000000f, 0.268000007f, 0.188999996f, 0.000000000f, 0.188999996f, 0.108999997f, 0.245000005f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f },
|
||||
/* 7 x 4 */
|
||||
{ 0.463679999f, 0.000000000f, 0.327360004f, 0.040000003f, 0.000000000f, 0.168960005f, 0.000000000f, 0.000000000f, 0.463679999f, 0.327360004f, 0.040000003f, 0.000000000f, 0.000000000f, 0.168960005f, 0.000000000f, 0.000000000f, 0.000000000f, 0.040000003f, 0.327360004f, 0.431039989f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.040000003f, 0.327360004f, 0.000000000f, 0.431039989f },
|
||||
/* 7 x 5 */
|
||||
{ 0.483000010f, 0.000000000f, 0.340999991f, 0.000000000f, 0.000000000f, 0.175999999f, 0.000000000f, 0.000000000f, 0.483000010f, 0.340999991f, 0.000000000f, 0.000000000f, 0.000000000f, 0.175999999f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.340999991f, 0.449000001f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.340999991f, 0.000000000f, 0.449000001f },
|
||||
/* 7 x 6 */
|
||||
{ 0.611000001f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.223000005f, 0.000000000f, 0.000000000f, 0.611000001f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.223000005f, 0.000000000f, 0.000000000f, 0.611000001f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.432000011f, 0.568000019f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.432000011f, 0.000000000f, 0.568000019f },
|
||||
/* 7 x 7 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f },
|
||||
/* 7 x 8 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.707000017f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.707000017f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f }
|
||||
},
|
||||
{
|
||||
/* 8 x 1 */
|
||||
{ 0.125125006f, 0.125125006f, 0.125125006f, 0.125000000f, 0.125125006f, 0.125125006f, 0.125125006f, 0.125125006f },
|
||||
/* 8 x 2 */
|
||||
{ 0.211866662f, 0.000000000f, 0.150266662f, 0.066666670f, 0.181066677f, 0.111066669f, 0.194133341f, 0.085866667f, 0.000000000f, 0.211866662f, 0.150266662f, 0.066666670f, 0.111066669f, 0.181066677f, 0.085866667f, 0.194133341f },
|
||||
/* 8 x 3 */
|
||||
{ 0.226999998f, 0.000000000f, 0.160999998f, 0.000000000f, 0.194000006f, 0.119000003f, 0.208000004f, 0.092000000f, 0.000000000f, 0.226999998f, 0.160999998f, 0.000000000f, 0.119000003f, 0.194000006f, 0.092000000f, 0.208000004f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f },
|
||||
/* 8 x 4 */
|
||||
{ 0.466344833f, 0.000000000f, 0.329241365f, 0.034482758f, 0.000000000f, 0.000000000f, 0.169931039f, 0.000000000f, 0.000000000f, 0.466344833f, 0.329241365f, 0.034482758f, 0.000000000f, 0.000000000f, 0.000000000f, 0.169931039f, 0.000000000f, 0.000000000f, 0.000000000f, 0.034482758f, 0.466344833f, 0.000000000f, 0.433517247f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.034482758f, 0.000000000f, 0.466344833f, 0.000000000f, 0.433517247f },
|
||||
/* 8 x 5 */
|
||||
{ 0.483000010f, 0.000000000f, 0.340999991f, 0.000000000f, 0.000000000f, 0.000000000f, 0.175999999f, 0.000000000f, 0.000000000f, 0.483000010f, 0.340999991f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.175999999f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.483000010f, 0.000000000f, 0.449000001f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.483000010f, 0.000000000f, 0.449000001f },
|
||||
/* 8 x 6 */
|
||||
{ 0.518000007f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.188999996f, 0.000000000f, 0.000000000f, 0.518000007f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.188999996f, 0.000000000f, 0.000000000f, 0.518000007f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.518000007f, 0.000000000f, 0.481999993f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.518000007f, 0.000000000f, 0.481999993f },
|
||||
/* 8 x 7 */
|
||||
{ 0.541000009f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.541000009f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.541000009f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.287999988f, 0.287999988f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.458999991f, 0.000000000f, 0.541000009f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.458999991f, 0.000000000f, 0.541000009f },
|
||||
/* 8 x 8 */
|
||||
{ 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f }
|
||||
}
|
||||
};
|
||||
|
||||
static char *remove_dots(const char *str) /* this is NOT robust. */
|
||||
{
|
||||
static char retval1[32];
|
||||
static char retval2[32];
|
||||
static int idx = 0;
|
||||
char *retval = (idx++ & 1) ? retval1 : retval2;
|
||||
char *ptr = retval;
|
||||
while (*str) {
|
||||
if (*str != '.') {
|
||||
*(ptr++) = *str;
|
||||
}
|
||||
str++;
|
||||
}
|
||||
*ptr = '\0';
|
||||
return retval;
|
||||
}
|
||||
|
||||
static char *lowercase(const char *str) /* this is NOT robust. */
|
||||
{
|
||||
static char retval1[32];
|
||||
static char retval2[32];
|
||||
static int idx = 0;
|
||||
char *retval = (idx++ & 1) ? retval1 : retval2;
|
||||
char *ptr = retval;
|
||||
while (*str) {
|
||||
const char ch = *(str++);
|
||||
*(ptr++) = ((ch >= 'A') && (ch <= 'Z')) ? (ch - ('A' - 'a')) : ch;
|
||||
}
|
||||
*ptr = '\0';
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void write_converter(const int fromchans, const int tochans)
|
||||
{
|
||||
const char *fromstr = layout_names[fromchans-1];
|
||||
const char *tostr = layout_names[tochans-1];
|
||||
const float *cvtmatrix = channel_conversion_matrix[fromchans-1][tochans-1];
|
||||
const float *fptr;
|
||||
const int convert_backwards = (tochans > fromchans);
|
||||
int input_channel_used[NUM_CHANNELS];
|
||||
int i, j;
|
||||
|
||||
if (tochans == fromchans) {
|
||||
return; /* nothing to convert, don't generate a converter. */
|
||||
}
|
||||
|
||||
for (i = 0; i < fromchans; i++) {
|
||||
input_channel_used[i] = 0;
|
||||
}
|
||||
|
||||
fptr = cvtmatrix;
|
||||
for (j = 0; j < tochans; j++) {
|
||||
for (i = 0; i < fromchans; i++) {
|
||||
#if 0
|
||||
printf("to=%d, from=%d, coeff=%f\n", j, i, *fptr);
|
||||
#endif
|
||||
if (*(fptr++) != 0.0f) {
|
||||
input_channel_used[i]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf("static void SDL_Convert%sTo%s(float *dst, const float *src, int num_frames)\n{\n", remove_dots(fromstr), remove_dots(tostr));
|
||||
|
||||
printf(" int i;\n"
|
||||
"\n"
|
||||
" LOG_DEBUG_AUDIO_CONVERT(\"%s\", \"%s\");\n"
|
||||
"\n", lowercase(fromstr), lowercase(tostr));
|
||||
|
||||
if (convert_backwards) { /* must convert backwards when growing the output in-place. */
|
||||
printf(" /* convert backwards, since output is growing in-place. */\n");
|
||||
printf(" src += (num_frames-1)");
|
||||
if (fromchans != 1) {
|
||||
printf(" * %d", fromchans);
|
||||
}
|
||||
printf(";\n");
|
||||
|
||||
printf(" dst += (num_frames-1)");
|
||||
if (tochans != 1) {
|
||||
printf(" * %d", tochans);
|
||||
}
|
||||
printf(";\n");
|
||||
printf(" for (i = num_frames; i; i--, ");
|
||||
if (fromchans == 1) {
|
||||
printf("src--");
|
||||
} else {
|
||||
printf("src -= %d", fromchans);
|
||||
}
|
||||
printf(", ");
|
||||
if (tochans == 1) {
|
||||
printf("dst--");
|
||||
} else {
|
||||
printf("dst -= %d", tochans);
|
||||
}
|
||||
printf(") {\n");
|
||||
fptr = cvtmatrix;
|
||||
for (i = 0; i < fromchans; i++) {
|
||||
if (input_channel_used[i] > 1) { /* don't read it from src more than once. */
|
||||
printf(" const float src%s = src[%d];\n", channel_names[fromchans-1][i], i);
|
||||
}
|
||||
}
|
||||
|
||||
for (j = tochans - 1; j >= 0; j--) {
|
||||
int has_input = 0;
|
||||
fptr = cvtmatrix + (fromchans * j);
|
||||
printf(" dst[%d] /* %s */ =", j, channel_names[tochans-1][j]);
|
||||
for (i = fromchans - 1; i >= 0; i--) {
|
||||
const float coefficient = fptr[i];
|
||||
char srcname[32];
|
||||
if (coefficient == 0.0f) {
|
||||
continue;
|
||||
} else if (input_channel_used[i] > 1) {
|
||||
snprintf(srcname, sizeof (srcname), "src%s", channel_names[fromchans-1][i]);
|
||||
} else {
|
||||
snprintf(srcname, sizeof (srcname), "src[%d]", i);
|
||||
}
|
||||
|
||||
if (has_input) {
|
||||
printf(" +");
|
||||
}
|
||||
|
||||
has_input = 1;
|
||||
|
||||
if (coefficient == 1.0f) {
|
||||
printf(" %s", srcname);
|
||||
} else {
|
||||
printf(" (%s * %.9ff)", srcname, coefficient);
|
||||
}
|
||||
}
|
||||
|
||||
if (!has_input) {
|
||||
printf(" 0.0f");
|
||||
}
|
||||
|
||||
printf(";\n");
|
||||
}
|
||||
|
||||
printf(" }\n");
|
||||
} else {
|
||||
printf(" for (i = num_frames; i; i--, ");
|
||||
if (fromchans == 1) {
|
||||
printf("src++");
|
||||
} else {
|
||||
printf("src += %d", fromchans);
|
||||
}
|
||||
printf(", ");
|
||||
if (tochans == 1) {
|
||||
printf("dst++");
|
||||
} else {
|
||||
printf("dst += %d", tochans);
|
||||
}
|
||||
printf(") {\n");
|
||||
|
||||
fptr = cvtmatrix;
|
||||
for (i = 0; i < fromchans; i++) {
|
||||
if (input_channel_used[i] > 1) { /* don't read it from src more than once. */
|
||||
printf(" const float src%s = src[%d];\n", channel_names[fromchans-1][i], i);
|
||||
}
|
||||
}
|
||||
|
||||
for (j = 0; j < tochans; j++) {
|
||||
int has_input = 0;
|
||||
fptr = cvtmatrix + (fromchans * j);
|
||||
printf(" dst[%d] /* %s */ =", j, channel_names[tochans-1][j]);
|
||||
for (i = 0; i < fromchans; i++) {
|
||||
const float coefficient = fptr[i];
|
||||
char srcname[32];
|
||||
if (coefficient == 0.0f) {
|
||||
continue;
|
||||
} else if (input_channel_used[i] > 1) {
|
||||
snprintf(srcname, sizeof (srcname), "src%s", channel_names[fromchans-1][i]);
|
||||
} else {
|
||||
snprintf(srcname, sizeof (srcname), "src[%d]", i);
|
||||
}
|
||||
|
||||
if (has_input) {
|
||||
printf(" +");
|
||||
}
|
||||
|
||||
has_input = 1;
|
||||
|
||||
if (coefficient == 1.0f) {
|
||||
printf(" %s", srcname);
|
||||
} else {
|
||||
printf(" (%s * %.9ff)", srcname, coefficient);
|
||||
}
|
||||
}
|
||||
|
||||
if (!has_input) {
|
||||
printf(" 0.0f");
|
||||
}
|
||||
|
||||
printf(";\n");
|
||||
}
|
||||
printf(" }\n");
|
||||
}
|
||||
|
||||
printf("\n}\n\n");
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int ini, outi;
|
||||
|
||||
printf(
|
||||
"/*\n"
|
||||
" Simple DirectMedia Layer\n"
|
||||
" Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>\n"
|
||||
"\n"
|
||||
" This software is provided 'as-is', without any express or implied\n"
|
||||
" warranty. In no event will the authors be held liable for any damages\n"
|
||||
" arising from the use of this software.\n"
|
||||
"\n"
|
||||
" Permission is granted to anyone to use this software for any purpose,\n"
|
||||
" including commercial applications, and to alter it and redistribute it\n"
|
||||
" freely, subject to the following restrictions:\n"
|
||||
"\n"
|
||||
" 1. The origin of this software must not be misrepresented; you must not\n"
|
||||
" claim that you wrote the original software. If you use this software\n"
|
||||
" in a product, an acknowledgment in the product documentation would be\n"
|
||||
" appreciated but is not required.\n"
|
||||
" 2. Altered source versions must be plainly marked as such, and must not be\n"
|
||||
" misrepresented as being the original software.\n"
|
||||
" 3. This notice may not be removed or altered from any source distribution.\n"
|
||||
"*/\n"
|
||||
"\n"
|
||||
"/* DO NOT EDIT, THIS FILE WAS GENERATED BY build-scripts/gen_audio_channel_conversion.c */\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"typedef void (*SDL_AudioChannelConverter)(float *dst, const float *src, int num_frames);\n"
|
||||
"\n"
|
||||
);
|
||||
|
||||
for (ini = 1; ini <= NUM_CHANNELS; ini++) {
|
||||
for (outi = 1; outi <= NUM_CHANNELS; outi++) {
|
||||
write_converter(ini, outi);
|
||||
}
|
||||
}
|
||||
|
||||
printf("static const SDL_AudioChannelConverter channel_converters[%d][%d] = { /* [from][to] */\n", NUM_CHANNELS, NUM_CHANNELS);
|
||||
for (ini = 1; ini <= NUM_CHANNELS; ini++) {
|
||||
const char *comma = "";
|
||||
printf(" {");
|
||||
for (outi = 1; outi <= NUM_CHANNELS; outi++) {
|
||||
const char *fromstr = layout_names[ini-1];
|
||||
const char *tostr = layout_names[outi-1];
|
||||
if (ini == outi) {
|
||||
printf("%s NULL", comma);
|
||||
} else {
|
||||
printf("%s SDL_Convert%sTo%s", comma, remove_dots(fromstr), remove_dots(tostr));
|
||||
}
|
||||
comma = ",";
|
||||
}
|
||||
printf(" }%s\n", (ini == NUM_CHANNELS) ? "" : ",");
|
||||
}
|
||||
|
||||
printf("};\n\n");
|
||||
|
||||
return 0;
|
||||
}
|
159
external/sdl/SDL/build-scripts/gen_audio_resampler_filter.c
vendored
Normal file
159
external/sdl/SDL/build-scripts/gen_audio_resampler_filter.c
vendored
Normal file
@ -0,0 +1,159 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
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 <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#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-2023 Sam Lantinga <slouken@libsdl.org>\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");
|
||||
|
||||
return 0;
|
||||
}
|
78
external/sdl/SDL/build-scripts/git-pre-push-hook.pl
vendored
Executable file
78
external/sdl/SDL/build-scripts/git-pre-push-hook.pl
vendored
Executable file
@ -0,0 +1,78 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
# To use this script: symlink it to .git/hooks/pre-push, then "git push"
|
||||
#
|
||||
# This script is called by "git push" after it has checked the remote status,
|
||||
# but before anything has been pushed. If this script exits with a non-zero
|
||||
# status nothing will be pushed.
|
||||
#
|
||||
# This hook is called with the following parameters:
|
||||
#
|
||||
# $1 -- Name of the remote to which the push is being done
|
||||
# $2 -- URL to which the push is being done
|
||||
#
|
||||
# If pushing without using a named remote those arguments will be equal.
|
||||
#
|
||||
# Information about the commits which are being pushed is supplied as lines to
|
||||
# the standard input in the form:
|
||||
#
|
||||
# <local ref> <local sha1> <remote ref> <remote sha1>
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
my $remote = $ARGV[0];
|
||||
my $url = $ARGV[1];
|
||||
|
||||
#print("remote: $remote\n");
|
||||
#print("url: $url\n");
|
||||
|
||||
$url =~ s/\.git$//; # change myorg/myproject.git to myorg/myproject
|
||||
$url =~ s#^git\@github\.com\:#https://github.com/#i;
|
||||
my $commiturl = $url =~ /\Ahttps?:\/\/github.com\// ? "$url/commit/" : '';
|
||||
|
||||
my $z40 = '0000000000000000000000000000000000000000';
|
||||
my $reported = 0;
|
||||
|
||||
while (<STDIN>) {
|
||||
chomp;
|
||||
my ($local_ref, $local_sha, $remote_ref, $remote_sha) = split / /;
|
||||
#print("local_ref: $local_ref\n");
|
||||
#print("local_sha: $local_sha\n");
|
||||
#print("remote_ref: $remote_ref\n");
|
||||
#print("remote_sha: $remote_sha\n");
|
||||
|
||||
my $range = '';
|
||||
if ($remote_sha eq $z40) { # New branch, examine all commits
|
||||
$range = $local_sha;
|
||||
} else { # Update to existing branch, examine new commits
|
||||
$range = "$remote_sha..$local_sha";
|
||||
}
|
||||
|
||||
my $gitcmd = "git log --reverse --oneline --no-abbrev-commit '$range'";
|
||||
open(GITPIPE, '-|', $gitcmd) or die("\n\n$0: Failed to run '$gitcmd': $!\n\nAbort push!\n\n");
|
||||
while (<GITPIPE>) {
|
||||
chomp;
|
||||
if (/\A([a-fA-F0-9]+)\s+(.*?)\Z/) {
|
||||
my $hash = $1;
|
||||
my $msg = $2;
|
||||
|
||||
if (!$reported) {
|
||||
print("\nCommits expected to be pushed:\n");
|
||||
$reported = 1;
|
||||
}
|
||||
|
||||
#print("hash: $hash\n");
|
||||
#print("msg: $msg\n");
|
||||
|
||||
print("$commiturl$hash -- $msg\n");
|
||||
} else {
|
||||
die("$0: Unexpected output from '$gitcmd'!\n\nAbort push!\n\n");
|
||||
}
|
||||
}
|
||||
die("\n\n$0: Failing exit code from running '$gitcmd'!\n\nAbort push!\n\n") if !close(GITPIPE);
|
||||
}
|
||||
|
||||
print("\n") if $reported;
|
||||
|
||||
exit(0); # Let the push go forward.
|
162
external/sdl/SDL/build-scripts/mkinstalldirs
vendored
Executable file
162
external/sdl/SDL/build-scripts/mkinstalldirs
vendored
Executable file
@ -0,0 +1,162 @@
|
||||
#! /bin/sh
|
||||
# mkinstalldirs --- make directory hierarchy
|
||||
|
||||
scriptversion=2020-07-26.22; # UTC
|
||||
|
||||
# Original author: Noah Friedman <friedman@prep.ai.mit.edu>
|
||||
# Created: 1993-05-16
|
||||
# Public domain.
|
||||
#
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
nl='
|
||||
'
|
||||
IFS=" "" $nl"
|
||||
errstatus=0
|
||||
dirmode=
|
||||
|
||||
usage="\
|
||||
Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
|
||||
|
||||
Create each directory DIR (with mode MODE, if specified), including all
|
||||
leading file name components.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>."
|
||||
|
||||
# process command line arguments
|
||||
while test $# -gt 0 ; do
|
||||
case $1 in
|
||||
-h | --help | --h*) # -h for help
|
||||
echo "$usage"
|
||||
exit $?
|
||||
;;
|
||||
-m) # -m PERM arg
|
||||
shift
|
||||
test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
|
||||
dirmode=$1
|
||||
shift
|
||||
;;
|
||||
--version)
|
||||
echo "$0 $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
--) # stop option processing
|
||||
shift
|
||||
break
|
||||
;;
|
||||
-*) # unknown option
|
||||
echo "$usage" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
*) # first non-opt arg
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
for file
|
||||
do
|
||||
if test -d "$file"; then
|
||||
shift
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
case $# in
|
||||
0) exit 0 ;;
|
||||
esac
|
||||
|
||||
# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and
|
||||
# mkdir -p a/c at the same time, both will detect that a is missing,
|
||||
# one will create a, then the other will try to create a and die with
|
||||
# a "File exists" error. This is a problem when calling mkinstalldirs
|
||||
# from a parallel make. We use --version in the probe to restrict
|
||||
# ourselves to GNU mkdir, which is thread-safe.
|
||||
case $dirmode in
|
||||
'')
|
||||
if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
|
||||
echo "mkdir -p -- $*"
|
||||
exec mkdir -p -- "$@"
|
||||
else
|
||||
# On NextStep and OpenStep, the 'mkdir' command does not
|
||||
# recognize any option. It will interpret all options as
|
||||
# directories to create, and then abort because '.' already
|
||||
# exists.
|
||||
test -d ./-p && rmdir ./-p
|
||||
test -d ./--version && rmdir ./--version
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
|
||||
test ! -d ./--version; then
|
||||
echo "umask 22"
|
||||
umask 22
|
||||
echo "mkdir -m $dirmode -p -- $*"
|
||||
exec mkdir -m "$dirmode" -p -- "$@"
|
||||
else
|
||||
# Clean up after NextStep and OpenStep mkdir.
|
||||
for d in ./-m ./-p ./--version "./$dirmode";
|
||||
do
|
||||
test -d $d && rmdir $d
|
||||
done
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "umask 22"
|
||||
umask 22
|
||||
|
||||
for file
|
||||
do
|
||||
case $file in
|
||||
/*) pathcomp=/ ;;
|
||||
*) pathcomp= ;;
|
||||
esac
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
set fnord $file
|
||||
shift
|
||||
IFS=$oIFS
|
||||
|
||||
for d
|
||||
do
|
||||
test "x$d" = x && continue
|
||||
|
||||
pathcomp=$pathcomp$d
|
||||
case $pathcomp in
|
||||
-*) pathcomp=./$pathcomp ;;
|
||||
esac
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
echo "mkdir $pathcomp"
|
||||
|
||||
mkdir "$pathcomp" || lasterr=$?
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
errstatus=$lasterr
|
||||
fi
|
||||
fi
|
||||
|
||||
pathcomp=$pathcomp/
|
||||
done
|
||||
|
||||
if test ! -z "$dirmode"; then
|
||||
echo "chmod $dirmode $file"
|
||||
chmod "$dirmode" "$file" || errstatus=$?
|
||||
fi
|
||||
done
|
||||
|
||||
exit $errstatus
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
250
external/sdl/SDL/build-scripts/rename_api.py
vendored
Executable file
250
external/sdl/SDL/build-scripts/rename_api.py
vendored
Executable file
@ -0,0 +1,250 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# This script renames symbols in the API, updating SDL_oldnames.h and
|
||||
# adding documentation for the change.
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import pathlib
|
||||
import pprint
|
||||
import re
|
||||
import sys
|
||||
from rename_symbols import create_regex_from_replacements, replace_symbols_in_path
|
||||
|
||||
SDL_ROOT = pathlib.Path(__file__).resolve().parents[1]
|
||||
|
||||
SDL_INCLUDE_DIR = SDL_ROOT / "include/SDL3"
|
||||
SDL_BUILD_SCRIPTS = SDL_ROOT / "build-scripts"
|
||||
|
||||
|
||||
def main():
|
||||
if len(args.args) == 0 or (len(args.args) % 2) != 0:
|
||||
print("Usage: %s [-h] [--skip-header-check] header {enum,function,hint,structure,symbol} [old new ...]" % sys.argv[0])
|
||||
exit(1)
|
||||
|
||||
# Check whether we can still modify the ABI
|
||||
version_header = pathlib.Path( SDL_INCLUDE_DIR / "SDL_version.h" ).read_text()
|
||||
if not re.search("SDL_MINOR_VERSION\s+[01]\s", version_header):
|
||||
raise Exception("ABI is frozen, symbols cannot be renamed")
|
||||
|
||||
# Find the symbol in the headers
|
||||
if pathlib.Path(args.header).is_file():
|
||||
header = pathlib.Path(args.header)
|
||||
else:
|
||||
header = pathlib.Path(SDL_INCLUDE_DIR / args.header)
|
||||
|
||||
if not header.exists():
|
||||
raise Exception("Couldn't find header %s" % header)
|
||||
|
||||
header_text = header.read_text()
|
||||
|
||||
# Replace the symbols in source code
|
||||
replacements = {}
|
||||
i = 0
|
||||
while i < len(args.args):
|
||||
oldname = args.args[i + 0]
|
||||
newname = args.args[i + 1]
|
||||
|
||||
if not args.skip_header_check and not re.search((r"\b%s\b" % oldname), header_text):
|
||||
raise Exception("Couldn't find %s in %s" % (oldname, header))
|
||||
|
||||
replacements[ oldname ] = newname
|
||||
replacements[ oldname + "_REAL" ] = newname + "_REAL"
|
||||
i += 2
|
||||
|
||||
regex = create_regex_from_replacements(replacements)
|
||||
for dir in ["src", "test", "include", "docs", "cmake/test"]:
|
||||
replace_symbols_in_path(SDL_ROOT / dir, regex, replacements)
|
||||
|
||||
# Replace the symbols in documentation
|
||||
i = 0
|
||||
while i < len(args.args):
|
||||
oldname = args.args[i + 0]
|
||||
newname = args.args[i + 1]
|
||||
|
||||
add_symbol_to_oldnames(header.name, oldname, newname)
|
||||
add_symbol_to_migration(header.name, args.type, oldname, newname)
|
||||
add_symbol_to_coccinelle(args.type, oldname, newname)
|
||||
i += 2
|
||||
|
||||
|
||||
def add_line(lines, i, section):
|
||||
lines.insert(i, section)
|
||||
i += 1
|
||||
return i
|
||||
|
||||
|
||||
def add_content(lines, i, content, add_trailing_line):
|
||||
if lines[i - 1] == "":
|
||||
lines[i - 1] = content
|
||||
else:
|
||||
i = add_line(lines, i, content)
|
||||
|
||||
if add_trailing_line:
|
||||
i = add_line(lines, i, "")
|
||||
return i
|
||||
|
||||
|
||||
def add_symbol_to_coccinelle(symbol_type, oldname, newname):
|
||||
file = open(SDL_BUILD_SCRIPTS / "SDL_migration.cocci", "a")
|
||||
# Append-adds at last
|
||||
|
||||
if symbol_type == "function":
|
||||
file.write("@@\n")
|
||||
file.write("@@\n")
|
||||
file.write("- %s\n" % oldname)
|
||||
file.write("+ %s\n" % newname)
|
||||
file.write(" (...)\n")
|
||||
|
||||
if symbol_type == "symbol":
|
||||
file.write("@@\n")
|
||||
file.write("@@\n")
|
||||
file.write("- %s\n" % oldname)
|
||||
file.write("+ %s\n" % newname)
|
||||
|
||||
# double check ?
|
||||
if symbol_type == "hint":
|
||||
file.write("@@\n")
|
||||
file.write("@@\n")
|
||||
file.write("- %s\n" % oldname)
|
||||
file.write("+ %s\n" % newname)
|
||||
|
||||
if symbol_type == "enum" or symbol_type == "structure":
|
||||
file.write("@@\n")
|
||||
file.write("typedef %s, %s;\n" % (oldname, newname))
|
||||
file.write("@@\n")
|
||||
file.write("- %s\n" % oldname)
|
||||
file.write("+ %s\n" % newname)
|
||||
|
||||
file.close()
|
||||
|
||||
|
||||
def add_symbol_to_oldnames(header, oldname, newname):
|
||||
file = (SDL_INCLUDE_DIR / "SDL_oldnames.h")
|
||||
lines = file.read_text().splitlines()
|
||||
mode = 0
|
||||
i = 0
|
||||
while i < len(lines):
|
||||
line = lines[i]
|
||||
if line == "#ifdef SDL_ENABLE_OLD_NAMES":
|
||||
if mode == 0:
|
||||
mode = 1
|
||||
section = ("/* ##%s */" % header)
|
||||
section_added = False
|
||||
content = ("#define %s %s" % (oldname, newname))
|
||||
content_added = False
|
||||
else:
|
||||
raise Exception("add_symbol_to_oldnames(): expected mode 0")
|
||||
elif line == "#elif !defined(SDL_DISABLE_OLD_NAMES)":
|
||||
if mode == 1:
|
||||
if not section_added:
|
||||
i = add_line(lines, i, section)
|
||||
|
||||
if not content_added:
|
||||
i = add_content(lines, i, content, True)
|
||||
|
||||
mode = 2
|
||||
section = ("/* ##%s */" % header)
|
||||
section_added = False
|
||||
content = ("#define %s %s_renamed_%s" % (oldname, oldname, newname))
|
||||
content_added = False
|
||||
else:
|
||||
raise Exception("add_symbol_to_oldnames(): expected mode 1")
|
||||
elif line == "#endif /* SDL_ENABLE_OLD_NAMES */":
|
||||
if mode == 2:
|
||||
if not section_added:
|
||||
i = add_line(lines, i, section)
|
||||
|
||||
if not content_added:
|
||||
i = add_content(lines, i, content, True)
|
||||
|
||||
mode = 3
|
||||
else:
|
||||
raise Exception("add_symbol_to_oldnames(): expected mode 2")
|
||||
elif line != "" and (mode == 1 or mode == 2):
|
||||
if line.startswith("/* ##"):
|
||||
if section_added:
|
||||
if not content_added:
|
||||
i = add_content(lines, i, content, True)
|
||||
content_added = True
|
||||
elif line == section:
|
||||
section_added = True
|
||||
elif section < line:
|
||||
i = add_line(lines, i, section)
|
||||
section_added = True
|
||||
i = add_content(lines, i, content, True)
|
||||
content_added = True
|
||||
elif line != "" and section_added and not content_added:
|
||||
if content == line:
|
||||
content_added = True
|
||||
elif content < line:
|
||||
i = add_content(lines, i, content, False)
|
||||
content_added = True
|
||||
i += 1
|
||||
|
||||
file.write_text("\n".join(lines) + "\n")
|
||||
|
||||
|
||||
def add_symbol_to_migration(header, symbol_type, oldname, newname):
|
||||
file = (SDL_ROOT / "docs/README-migration.md")
|
||||
lines = file.read_text().splitlines()
|
||||
section = ("## %s" % header)
|
||||
section_added = False
|
||||
note = ("The following %ss have been renamed:" % symbol_type)
|
||||
note_added = False
|
||||
if symbol_type == "function":
|
||||
content = ("* %s() => %s()" % (oldname, newname))
|
||||
else:
|
||||
content = ("* %s => %s" % (oldname, newname))
|
||||
content_added = False
|
||||
mode = 0
|
||||
i = 0
|
||||
while i < len(lines):
|
||||
line = lines[i]
|
||||
if line.startswith("##") and line.endswith(".h"):
|
||||
if line == section:
|
||||
section_added = True
|
||||
elif section < line:
|
||||
break
|
||||
|
||||
elif section_added and not note_added:
|
||||
if note == line:
|
||||
note_added = True
|
||||
elif note_added and not content_added:
|
||||
if content == line:
|
||||
content_added = True
|
||||
elif line == "" or content < line:
|
||||
i = add_line(lines, i, content)
|
||||
content_added = True
|
||||
i += 1
|
||||
|
||||
if not section_added:
|
||||
i = add_line(lines, i, section)
|
||||
i = add_line(lines, i, "")
|
||||
|
||||
if not note_added:
|
||||
i = add_line(lines, i, note)
|
||||
|
||||
if not content_added:
|
||||
i = add_content(lines, i, content, True)
|
||||
|
||||
file.write_text("\n".join(lines) + "\n")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
parser = argparse.ArgumentParser(fromfile_prefix_chars='@')
|
||||
parser.add_argument("--skip-header-check", action="store_true")
|
||||
parser.add_argument("header");
|
||||
parser.add_argument("type", choices=["enum", "function", "hint", "structure", "symbol"]);
|
||||
parser.add_argument("args", nargs="*")
|
||||
args = parser.parse_args()
|
||||
|
||||
try:
|
||||
main()
|
||||
except Exception as e:
|
||||
print(e)
|
||||
exit(-1)
|
||||
|
||||
exit(0)
|
||||
|
71
external/sdl/SDL/build-scripts/rename_headers.py
vendored
Executable file
71
external/sdl/SDL/build-scripts/rename_headers.py
vendored
Executable file
@ -0,0 +1,71 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# This script renames SDL headers in the specified paths
|
||||
|
||||
import argparse
|
||||
import pathlib
|
||||
import re
|
||||
|
||||
|
||||
def main():
|
||||
replacements = [
|
||||
( re.compile(r"(?:[\"<])(?:SDL2/)?SDL_gamecontroller.h(?:[\">])"), r"<SDL3/SDL_gamepad.h>" ),
|
||||
( re.compile(r"(?:[\"<])(?:SDL2/)?begin_code.h(?:[\">])"), r"<SDL3/SDL_begin_code.h>" ),
|
||||
( re.compile(r"(?:[\"<])(?:SDL2/)?close_code.h(?:[\">])"), r"<SDL3/SDL_close_code.h>" ),
|
||||
( re.compile(r"(?:[\"<])(?:SDL2/)?(SDL[_a-z0-9]*\.h)(?:[\">])"), r"<SDL3/\1>" )
|
||||
]
|
||||
for entry in args.args:
|
||||
path = pathlib.Path(entry)
|
||||
if not path.exists():
|
||||
print("%s doesn't exist, skipping" % entry)
|
||||
continue
|
||||
|
||||
replace_headers_in_path(path, replacements)
|
||||
|
||||
|
||||
def replace_headers_in_file(file, replacements):
|
||||
try:
|
||||
with file.open("r", encoding="UTF-8", newline="") as rfp:
|
||||
original = rfp.read()
|
||||
contents = original
|
||||
for regex, replacement in replacements:
|
||||
contents = regex.sub(replacement, contents)
|
||||
if contents != original:
|
||||
with file.open("w", encoding="UTF-8", newline="") as wfp:
|
||||
wfp.write(contents)
|
||||
except UnicodeDecodeError:
|
||||
print("%s is not text, skipping" % file)
|
||||
except Exception as err:
|
||||
print("%s" % err)
|
||||
|
||||
|
||||
def replace_headers_in_dir(path, replacements):
|
||||
for entry in path.glob("*"):
|
||||
if entry.is_dir():
|
||||
replace_headers_in_dir(entry, replacements)
|
||||
else:
|
||||
print("Processing %s" % entry)
|
||||
replace_headers_in_file(entry, replacements)
|
||||
|
||||
|
||||
def replace_headers_in_path(path, replacements):
|
||||
if path.is_dir():
|
||||
replace_headers_in_dir(path, replacements)
|
||||
else:
|
||||
replace_headers_in_file(path, replacements)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
parser = argparse.ArgumentParser(fromfile_prefix_chars='@')
|
||||
parser.add_argument("args", nargs="*")
|
||||
args = parser.parse_args()
|
||||
|
||||
try:
|
||||
main()
|
||||
except Exception as e:
|
||||
print(e)
|
||||
exit(-1)
|
||||
|
||||
exit(0)
|
||||
|
130
external/sdl/SDL/build-scripts/rename_symbols.py
vendored
Executable file
130
external/sdl/SDL/build-scripts/rename_symbols.py
vendored
Executable file
@ -0,0 +1,130 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# This script renames symbols in the specified paths
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import pathlib
|
||||
import re
|
||||
import sys
|
||||
|
||||
|
||||
SDL_ROOT = pathlib.Path(__file__).resolve().parents[1]
|
||||
|
||||
SDL_INCLUDE_DIR = SDL_ROOT / "include/SDL3"
|
||||
|
||||
|
||||
def main():
|
||||
if args.all_symbols:
|
||||
if len(args.args) < 1:
|
||||
print("Usage: %s --all-symbols files_or_directories ..." % sys.argv[0])
|
||||
exit(1)
|
||||
|
||||
replacements = get_all_replacements()
|
||||
entries = args.args
|
||||
|
||||
else:
|
||||
if len(args.args) < 3:
|
||||
print("Usage: %s oldname newname files_or_directories ..." % sys.argv[0])
|
||||
exit(1)
|
||||
|
||||
replacements = { args.args[0]: args.args[1] }
|
||||
entries = args.args[2:]
|
||||
|
||||
if args.substring:
|
||||
regex = create_substring_regex_from_replacements(replacements)
|
||||
else:
|
||||
regex = create_regex_from_replacements(replacements)
|
||||
|
||||
for entry in entries:
|
||||
path = pathlib.Path(entry)
|
||||
if not path.exists():
|
||||
print("%s doesn't exist, skipping" % entry)
|
||||
continue
|
||||
|
||||
replace_symbols_in_path(path, regex, replacements)
|
||||
|
||||
|
||||
def get_all_replacements():
|
||||
replacements = {}
|
||||
file = (SDL_INCLUDE_DIR / "SDL_oldnames.h")
|
||||
mode = 0
|
||||
for line in file.read_text().splitlines():
|
||||
if line == "#ifdef SDL_ENABLE_OLD_NAMES":
|
||||
if mode == 0:
|
||||
mode = 1
|
||||
else:
|
||||
raise Exception("get_all_replacements(): expected mode 0")
|
||||
elif line == "#elif !defined(SDL_DISABLE_OLD_NAMES)":
|
||||
if mode == 1:
|
||||
mode = 2
|
||||
else:
|
||||
raise Exception("get_all_replacements(): expected mode 1")
|
||||
elif line == "#endif /* SDL_ENABLE_OLD_NAMES */":
|
||||
if mode == 2:
|
||||
mode = 3
|
||||
else:
|
||||
raise Exception("add_symbol_to_oldnames(): expected mode 2")
|
||||
elif mode == 1 and line.startswith("#define "):
|
||||
words = line.split()
|
||||
replacements[words[1]] = words[2]
|
||||
# In case things are accidentally renamed to the "X_renamed_Y" symbol
|
||||
#replacements[words[1] + "_renamed_" + words[2]] = words[2]
|
||||
|
||||
return replacements
|
||||
|
||||
|
||||
def create_regex_from_replacements(replacements):
|
||||
return re.compile(r"\b(%s)\b" % "|".join(map(re.escape, replacements.keys())))
|
||||
|
||||
|
||||
def create_substring_regex_from_replacements(replacements):
|
||||
return re.compile(r"(%s)" % "|".join(map(re.escape, replacements.keys())))
|
||||
|
||||
|
||||
def replace_symbols_in_file(file, regex, replacements):
|
||||
try:
|
||||
with file.open("r", encoding="UTF-8", newline="") as rfp:
|
||||
original = rfp.read()
|
||||
contents = regex.sub(lambda mo: replacements[mo.string[mo.start():mo.end()]], original)
|
||||
if contents != original:
|
||||
with file.open("w", encoding="UTF-8", newline="") as wfp:
|
||||
wfp.write(contents)
|
||||
except UnicodeDecodeError:
|
||||
print("%s is not text, skipping" % file)
|
||||
except Exception as err:
|
||||
print("%s" % err)
|
||||
|
||||
|
||||
def replace_symbols_in_dir(path, regex, replacements):
|
||||
for entry in path.glob("*"):
|
||||
if entry.is_dir():
|
||||
replace_symbols_in_dir(entry, regex, replacements)
|
||||
else:
|
||||
print("Processing %s" % entry)
|
||||
replace_symbols_in_file(entry, regex, replacements)
|
||||
|
||||
|
||||
def replace_symbols_in_path(path, regex, replacements):
|
||||
if path.is_dir():
|
||||
replace_symbols_in_dir(path, regex, replacements)
|
||||
else:
|
||||
replace_symbols_in_file(path, regex, replacements)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
parser = argparse.ArgumentParser(fromfile_prefix_chars='@')
|
||||
parser.add_argument("--all-symbols", action="store_true")
|
||||
parser.add_argument("--substring", action="store_true")
|
||||
parser.add_argument("args", nargs="*")
|
||||
args = parser.parse_args()
|
||||
|
||||
try:
|
||||
main()
|
||||
except Exception as e:
|
||||
print(e)
|
||||
exit(-1)
|
||||
|
||||
exit(0)
|
||||
|
48
external/sdl/SDL/build-scripts/showrev.sh
vendored
Executable file
48
external/sdl/SDL/build-scripts/showrev.sh
vendored
Executable file
@ -0,0 +1,48 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Print the current source revision, if available
|
||||
|
||||
SDL_ROOT=$(dirname $0)/..
|
||||
cd $SDL_ROOT
|
||||
|
||||
if [ -e ./VERSION.txt ]; then
|
||||
cat ./VERSION.txt
|
||||
exit 0
|
||||
fi
|
||||
|
||||
major=$(sed -ne 's/^#define SDL_MAJOR_VERSION *//p' include/SDL3/SDL_version.h)
|
||||
minor=$(sed -ne 's/^#define SDL_MINOR_VERSION *//p' include/SDL3/SDL_version.h)
|
||||
micro=$(sed -ne 's/^#define SDL_PATCHLEVEL *//p' include/SDL3/SDL_version.h)
|
||||
version="${major}.${minor}.${micro}"
|
||||
|
||||
if [ -x "$(command -v git)" ]; then
|
||||
rev="$(git describe --tags --long 2>/dev/null)"
|
||||
if [ -n "$rev" ]; then
|
||||
# e.g. release-2.24.0-542-g96361fc47
|
||||
# or release-2.24.1-5-g36b987dab
|
||||
# or prerelease-2.23.2-0-gcb46e1b3f
|
||||
echo "$rev"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
rev="$(git describe --always --tags --long 2>/dev/null)"
|
||||
if [ -n "$rev" ]; then
|
||||
# Just a truncated sha1, e.g. 96361fc47.
|
||||
# Turn it into e.g. 2.25.0-g96361fc47
|
||||
echo "${version}-g${rev}"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -x "$(command -v p4)" ]; then
|
||||
rev="$(p4 changes -m1 ./...\#have 2>/dev/null| awk '{print $2}')"
|
||||
if [ $? = 0 ]; then
|
||||
# e.g. 2.25.0-p7511446
|
||||
echo "${version}-p${rev}"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# best we can do
|
||||
echo "${version}-no-vcs"
|
||||
exit 0
|
21
external/sdl/SDL/build-scripts/strip_fPIC.sh
vendored
Executable file
21
external/sdl/SDL/build-scripts/strip_fPIC.sh
vendored
Executable file
@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# libtool assumes that the compiler can handle the -fPIC flag
|
||||
# This isn't always true (for example, nasm can't handle it)
|
||||
command=""
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
-?PIC)
|
||||
# Ignore -fPIC and -DPIC options
|
||||
;;
|
||||
-fno-common)
|
||||
# Ignore -fPIC and -DPIC options
|
||||
;;
|
||||
*)
|
||||
command="$command $1"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
echo $command
|
||||
exec $command
|
162
external/sdl/SDL/build-scripts/test-versioning.sh
vendored
Executable file
162
external/sdl/SDL/build-scripts/test-versioning.sh
vendored
Executable file
@ -0,0 +1,162 @@
|
||||
#!/bin/sh
|
||||
# Copyright 2022 Collabora Ltd.
|
||||
# SPDX-License-Identifier: Zlib
|
||||
|
||||
set -eu
|
||||
|
||||
cd `dirname $0`/..
|
||||
|
||||
ref_major=$(sed -ne 's/^#define SDL_MAJOR_VERSION *//p' include/SDL3/SDL_version.h)
|
||||
ref_minor=$(sed -ne 's/^#define SDL_MINOR_VERSION *//p' include/SDL3/SDL_version.h)
|
||||
ref_micro=$(sed -ne 's/^#define SDL_PATCHLEVEL *//p' include/SDL3/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
|
||||
}
|
||||
|
||||
version=$(sed -Ene 's/^project\(SDL[0-9]+ LANGUAGES C CXX VERSION "([0-9.]*)"\)$/\1/p' CMakeLists.txt)
|
||||
|
||||
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/.*SDL_MAJOR_VERSION = \([0-9]*\);/\1/p' android-project/app/src/main/java/org/libsdl/app/SDLActivity.java)
|
||||
minor=$(sed -ne 's/.*SDL_MINOR_VERSION = \([0-9]*\);/\1/p' android-project/app/src/main/java/org/libsdl/app/SDLActivity.java)
|
||||
micro=$(sed -ne 's/.*SDL_MICRO_VERSION = \([0-9]*\);/\1/p' android-project/app/src/main/java/org/libsdl/app/SDLActivity.java)
|
||||
version="${major}.${minor}.${micro}"
|
||||
|
||||
if [ "$ref_version" = "$version" ]; then
|
||||
ok "SDLActivity.java $version"
|
||||
else
|
||||
not_ok "android-project/app/src/main/java/org/libsdl/app/SDLActivity.java $version disagrees with SDL_version.h $ref_version"
|
||||
fi
|
||||
|
||||
tuple=$(sed -ne 's/^ *FILEVERSION *//p' src/core/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/core/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/core/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/core/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>(.*)<\/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>(.*)<\/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
|
||||
|
||||
version=$(sed -Ene 's/Title SDL (.*)/\1/p' Xcode/SDL/pkg-support/SDL.info)
|
||||
|
||||
if [ "$ref_version" = "$version" ]; then
|
||||
ok "SDL.info Title $version"
|
||||
else
|
||||
not_ok "SDL.info Title $version disagrees with SDL_version.h $ref_version"
|
||||
fi
|
||||
|
||||
marketing=$(sed -Ene 's/.*MARKETING_VERSION = (.*);/\1/p' Xcode/SDL/SDL.xcodeproj/project.pbxproj)
|
||||
|
||||
ref="$ref_version
|
||||
$ref_version"
|
||||
|
||||
if [ "$ref" = "$marketing" ]; then
|
||||
ok "project.pbxproj MARKETING_VERSION is consistent"
|
||||
else
|
||||
not_ok "project.pbxproj MARKETING_VERSION is inconsistent, expected $ref, got $marketing"
|
||||
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)
|
||||
|
||||
case "$ref_minor" in
|
||||
(*[02468])
|
||||
major="$(( ref_minor * 100 + 1 ))"
|
||||
minor="0"
|
||||
;;
|
||||
(*)
|
||||
major="$(( ref_minor * 100 + ref_micro + 1 ))"
|
||||
minor="0"
|
||||
;;
|
||||
esac
|
||||
|
||||
ref="${major}.${minor}.0
|
||||
${major}.${minor}.0"
|
||||
|
||||
if [ "$ref" = "$dylib_compat" ]; then
|
||||
ok "project.pbxproj DYLIB_COMPATIBILITY_VERSION is consistent"
|
||||
else
|
||||
not_ok "project.pbxproj DYLIB_COMPATIBILITY_VERSION is inconsistent, expected $ref, got $dylib_compat"
|
||||
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, expected $ref, got $dylib_cur"
|
||||
fi
|
||||
|
||||
echo "1..$tests"
|
||||
exit "$failed"
|
15
external/sdl/SDL/build-scripts/update-copyright.sh
vendored
Executable file
15
external/sdl/SDL/build-scripts/update-copyright.sh
vendored
Executable file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "$SED" = "" ]; then
|
||||
if type gsed >/dev/null; then
|
||||
SED=gsed
|
||||
else
|
||||
SED=sed
|
||||
fi
|
||||
fi
|
||||
|
||||
find . -type f \
|
||||
| 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
|
79
external/sdl/SDL/build-scripts/update-version.sh
vendored
Executable file
79
external/sdl/SDL/build-scripts/update-version.sh
vendored
Executable file
@ -0,0 +1,79 @@
|
||||
#!/bin/sh
|
||||
|
||||
#set -x
|
||||
|
||||
cd `dirname $0`/..
|
||||
|
||||
ARGSOKAY=1
|
||||
if [ -z $1 ]; then
|
||||
ARGSOKAY=0
|
||||
fi
|
||||
if [ -z $2 ]; then
|
||||
ARGSOKAY=0
|
||||
fi
|
||||
if [ -z $3 ]; then
|
||||
ARGSOKAY=0
|
||||
fi
|
||||
|
||||
if [ "x$ARGSOKAY" = "x0" ]; then
|
||||
echo "USAGE: $0 <major> <minor> <patch>" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
MAJOR="$1"
|
||||
MINOR="$2"
|
||||
PATCH="$3"
|
||||
NEWVERSION="$MAJOR.$MINOR.$PATCH"
|
||||
|
||||
echo "Updating version to '$NEWVERSION' ..."
|
||||
|
||||
# !!! FIXME: This first one is a kinda scary search/replace that might fail later if another X.Y.Z version is added to the file.
|
||||
perl -w -pi -e 's/(\<string\>)\d+\.\d+\.\d+/${1}'$NEWVERSION'/;' Xcode/SDL/Info-Framework.plist
|
||||
|
||||
perl -w -pi -e 's/(Title SDL )\d+\.\d+\.\d+/${1}'$NEWVERSION'/;' Xcode/SDL/pkg-support/SDL.info
|
||||
|
||||
perl -w -pi -e 's/(MARKETING_VERSION\s*=\s*)\d+\.\d+\.\d+/${1}'$NEWVERSION'/;' Xcode/SDL/SDL.xcodeproj/project.pbxproj
|
||||
|
||||
DYVER=`expr $MINOR \* 100 + 1`
|
||||
perl -w -pi -e 's/(DYLIB_CURRENT_VERSION\s*=\s*)\d+\.\d+\.\d+/${1}'$DYVER'.0.0/;' Xcode/SDL/SDL.xcodeproj/project.pbxproj
|
||||
|
||||
# Set compat to major.minor.0 by default.
|
||||
perl -w -pi -e 's/(DYLIB_COMPATIBILITY_VERSION\s*=\s*)\d+\.\d+\.\d+/${1}'$DYVER'.0.0/;' Xcode/SDL/SDL.xcodeproj/project.pbxproj
|
||||
|
||||
# non-zero patch?
|
||||
if [ "x$PATCH" != "x0" ]; then
|
||||
if [ `expr $MINOR % 2` = "0" ]; then
|
||||
# If patch is not zero, but minor is even, it's a bugfix release.
|
||||
perl -w -pi -e 's/(DYLIB_CURRENT_VERSION\s*=\s*)\d+\.\d+\.\d+/${1}'$DYVER'.'$PATCH'.0/;' Xcode/SDL/SDL.xcodeproj/project.pbxproj
|
||||
|
||||
else
|
||||
# If patch is not zero, but minor is odd, it's a development prerelease.
|
||||
DYVER=`expr $MINOR \* 100 + $PATCH + 1`
|
||||
perl -w -pi -e 's/(DYLIB_CURRENT_VERSION\s*=\s*)\d+\.\d+\.\d+/${1}'$DYVER'.0.0/;' Xcode/SDL/SDL.xcodeproj/project.pbxproj
|
||||
perl -w -pi -e 's/(DYLIB_COMPATIBILITY_VERSION\s*=\s*)\d+\.\d+\.\d+/${1}'$DYVER'.0.0/;' Xcode/SDL/SDL.xcodeproj/project.pbxproj
|
||||
fi
|
||||
fi
|
||||
|
||||
perl -w -pi -e 's/\A(project\(SDL[0-9]+ LANGUAGES C CXX VERSION ")[0-9.]+/${1}'$NEWVERSION'/;' CMakeLists.txt
|
||||
|
||||
perl -w -pi -e 's/\A(.* SDL_MAJOR_VERSION = )\d+/${1}'$MAJOR'/;' android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
|
||||
perl -w -pi -e 's/\A(.* SDL_MINOR_VERSION = )\d+/${1}'$MINOR'/;' android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
|
||||
perl -w -pi -e 's/\A(.* SDL_MICRO_VERSION = )\d+/${1}'$PATCH'/;' android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
|
||||
|
||||
perl -w -pi -e 's/(\#define SDL_MAJOR_VERSION\s+)\d+/${1}'$MAJOR'/;' include/SDL3/SDL_version.h
|
||||
perl -w -pi -e 's/(\#define SDL_MINOR_VERSION\s+)\d+/${1}'$MINOR'/;' include/SDL3/SDL_version.h
|
||||
perl -w -pi -e 's/(\#define SDL_PATCHLEVEL\s+)\d+/${1}'$PATCH'/;' include/SDL3/SDL_version.h
|
||||
|
||||
perl -w -pi -e 's/(FILEVERSION\s+)\d+,\d+,\d+/${1}'$MAJOR','$MINOR','$PATCH'/;' src/core/windows/version.rc
|
||||
perl -w -pi -e 's/(PRODUCTVERSION\s+)\d+,\d+,\d+/${1}'$MAJOR','$MINOR','$PATCH'/;' src/core/windows/version.rc
|
||||
perl -w -pi -e 's/(VALUE "FileVersion", ")\d+, \d+, \d+/${1}'$MAJOR', '$MINOR', '$PATCH'/;' src/core/windows/version.rc
|
||||
perl -w -pi -e 's/(VALUE "ProductVersion", ")\d+, \d+, \d+/${1}'$MAJOR', '$MINOR', '$PATCH'/;' src/core/windows/version.rc
|
||||
|
||||
echo "Running build-scripts/test-versioning.sh to verify changes..."
|
||||
./build-scripts/test-versioning.sh
|
||||
|
||||
echo "All done."
|
||||
echo "Run 'git diff' and make sure this looks correct, before 'git commit'."
|
||||
|
||||
exit 0
|
||||
|
49
external/sdl/SDL/build-scripts/updaterev.sh
vendored
Executable file
49
external/sdl/SDL/build-scripts/updaterev.sh
vendored
Executable file
@ -0,0 +1,49 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Generate a header file with the current source revision
|
||||
|
||||
outdir=`pwd`
|
||||
cd `dirname $0`
|
||||
srcdir=..
|
||||
header=$outdir/include/SDL3/SDL_revision.h
|
||||
dist=
|
||||
vendor=
|
||||
|
||||
while [ "$#" -gt 0 ]; do
|
||||
case "$1" in
|
||||
(--dist)
|
||||
dist=yes
|
||||
shift
|
||||
;;
|
||||
(--vendor)
|
||||
vendor="$2"
|
||||
shift 2
|
||||
;;
|
||||
(*)
|
||||
echo "$0: Unknown option: $1" >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
rev=`sh showrev.sh 2>/dev/null`
|
||||
if [ "$rev" != "" ]; then
|
||||
if [ -n "$dist" ]; then
|
||||
echo "$rev" > "$outdir/VERSION.txt"
|
||||
fi
|
||||
echo "/* Generated by updaterev.sh, do not edit */" >"$header.new"
|
||||
if [ -n "$vendor" ]; then
|
||||
echo "#define SDL_VENDOR_INFO \"$vendor\"" >>"$header.new"
|
||||
fi
|
||||
echo "#ifdef SDL_VENDOR_INFO" >>"$header.new"
|
||||
echo "#define SDL_REVISION \"SDL-$rev (\" SDL_VENDOR_INFO \")\"" >>"$header.new"
|
||||
echo "#else" >>"$header.new"
|
||||
echo "#define SDL_REVISION \"SDL-$rev\"" >>"$header.new"
|
||||
echo "#endif" >>"$header.new"
|
||||
echo "#define SDL_REVISION_NUMBER 0" >>"$header.new"
|
||||
if diff $header $header.new >/dev/null 2>&1; then
|
||||
rm "$header.new"
|
||||
else
|
||||
mv "$header.new" "$header"
|
||||
fi
|
||||
fi
|
1663
external/sdl/SDL/build-scripts/wikiheaders.pl
vendored
Executable file
1663
external/sdl/SDL/build-scripts/wikiheaders.pl
vendored
Executable file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user